Generated from af_offload.h with ROBODoc vunknown on Thu Aug 01 16:42:21 2002
TABLE OF CONTENTS
- AF_INET_OFFLOAD/Offload Protocol Switch Overview
- AF_INET_OFFLOAD/ipv4v6_addr_fmt_t
- AF_INET_OFFLOAD/ipv4v6_addr_t
- AF_INET_OFFLOAD/constants
- AF_INET_OFFLOAD/offload_event_t
- AF_INET_OFFLOAD/offload_interface_t
- AF_INET_OFFLOAD/offload_protosw_t
- AF_INET_OFFLOAD/offload_accept_t
- AF_INET_OFFLOAD/offload_prot_t
- AF_INET_OFFLOAD/offload_sock_t
- AF_INET_OFFLOAD/offload_prot_ops_t
- AF_INET_OFFLOAD/offload_register_protosw
- AF_INET_OFFLOAD/offload_unregister_protosw
- AF_INET_OFFLOAD/offload_notification
NAME
Offload Protocol Switch
COPYRIGHT
Intel Corporation 2002
DESCRIPTION
Defines type definitions and API's for the Offload Protocol Switch (OPS).
Offload Protocol Switch module implements a new
AF_INET_OFFLOAD address family that supports OFFLOAD protocols.
CREATION DATE
03.15.02
NOTES
DESCRIPTION
The Offload Protocol Switch (OPS) provides, a dynamic binding
facility for the underneath AF_INET_OFFLOAD Family type supported
protocols and transport modules. It registers itself with the socket
layer as a new AF_INET_OFFLOAD address family provider.
OPS will provide switching across both OFFLOAD protocol modules and
protocols under the AF_INET address family when IPPROTO_ANY is
specified during sock_create. This is accomplished by calling AF_INET
address family at the very top of the stack via socket.c.
OPS dynamically binds a socket request at the time of connection with
an Offload protocol (OP) provider, based on matching OP capabilities
and network address information.
OPS also supports non self-routing capable offload protocols. Routing
information is retrived using the net_device provided by each protocol
interface. The linux routing tables will be queried as needed using
this net_device structure.
OPS will provide automatic fail over to legacy TCP/IP stack, in case
of failure on making connection from an offload protocol
NAME
ipv4v6_addr_fmt_t -- IP address format identifier
DESCRIPTION
Identify types of Internet Protocol (IP) address formats.
SYNOPSIS
typedef enum
{
ADDR_IPV4,
ADDR_IPV6
} ipv4v6_addr_fmt_t;
NAME
ipv4v6_addr_t -- Internet Protocol address: IPv4 or IPv6 format
DESCRIPTION
Define an Internet Protocol (IP) address structure. An address may be an
IP version 4 or an IP version 6 format. IP type is identified by the
'IP_addr_type' field.
typedef struct ipv4v6_addr {
union {
struct in6_addr in6;
struct in_addr in4;
} inet_u;
#define ip4_addr inet_u.in4.s_addr
#define ip6_saddr32 inet_u.in6.s6_addr32
ipv4v6_addr_fmt_t IP_addr_type; // IPv4 or IPv6 ?
} ipv4v6_addr_t;
#define SET_IPV4_ADDR(w,h) w.ip4_addr = (h); w.IP_addr_type=ADDR_IPV4
FIELDS
Union in_u
in_u.in6 - IPv6 address structure
in_u.in4 - IPv4 address structure
Union-end
IP_addr_type - Identifies which type of IP address: V4 or V6.
SEE ALSO
offload_addr_fmt_t
#include <linux/in.h>
#include <linux/in6.h>
NAME
constants for AF INET offload switch
#define MAX_OFFLOAD_PROTOCOLS 16
#define MAX_OFFLOAD_INTERFACES 16
VALUES
Self explanatory
NAME
offload_event_t -- Offload protocol events
typedef enum
{
OFFLOAD_IF_UP,
OFFLOAD_IF_DOWN,
OFFLOAD_ADDR_ADD,
OFFLOAD_ADDR_REMOVE
} offload_event_t;
VALUES
Self explanatory
NAME
offload_interface_t
DESCRIPTION
offload protocol INET address list
SYNOPSIS
typedef struct offload_interface {
struct offload_interface *next;
struct net_device *device;
struct ipv4v6_addr addr;
struct ipv4v6_addr netmask;
struct ipv4v6_addr hop;
} offload_interface_t;
FIELDS
next
A pointer used to chain address structures. This permits multiple
address per protocol provider. This value is set to NULL to mark
the end of the chain.
device
pointer to net_device structure of protocol interface. Supplied
by protocol.
addr_len
length of sockaddr in bytes. Supplied by protocol.
addr
IPv4 or v6 sockaddr structure which includes address family and data.
Supplied by protocol.
netmask
IPv4 or v6 sockaddr structure with netmask. Supplied by protocol.
hop
first hop managed by the OPS per linux AF_INET routing table.
Supplied by OPS.
NOTES
SEE ALSO
offload_protosw_t
NAME
offload_protosw_t
DESCRIPTION
offload_protosw structure for registered protocols under
AF_INET_OFFLOAD family. Updated via offload_register_protosw() call.
SYNOPSIS
typedef struct offload_protosw {
struct offload_protosw *next;
unsigned short type;
int protocol;
struct offload_ops *ops; /* protocol interface */
void (*unload)( void );
int capability;
unsigned char flags;
int ref_cnt; /* sock refcnt per protocol */
int if_cnt; /* interface count */
spinlock_t ilock; /* lock for interfaces */
/* INET addresses under offload control to enable switching */
struct offload_interface interfaces[MAX_OFFLOAD_INTERFACES];
} offload_protosw_t;
FIELDS
*next
A pointer used by the offload switch to chain data structures.
This value is set to NULL to mark the end of the chain.
type
protocol_type
protocol
offload protocol id
*ops
socket interface
*prot
protocol sock interface
(*unload)()
A pointer to the protocol function to call when the OPS module
is shutting down and unloading.
capability
protocol stack capability
flags
protocol flags
ref_cnt
socket reference count per protocol
if_cnt
number of active interface addresses via protocol provider
ilock
spinlock for protocol interface list
interfaces
array of interfaces with address information.
NOTES
SEE ALSO
NAME
offload_accept_t: structure for the accept queue
DESCRIPTION
Defines data structure for accept queue. Enables
the OPS to process a socket listen that spans across
multiple protocols.
SYNOPSIS
typedef struct offload_accept {
struct offload_accept *next;
/* multiple protocol support per socket */
struct offload_prot *prot; /* protocol reference */
/* address info from the SYN recv or offload connect request */
struct ipv4v6_addr raddr;
} offload_accept_t;
FIELDS
*next
A pointer used to chain data structures.
This value is set to NULL to mark the end of the chain.
*prot
reference to the protocol provider processing this inbound
connect request.
raddr
IPv4 or v6 socket address info from the inbound connect request.
NOTES
SEE ALSO
offload_prot_t
NAME
offload_prot_t: offload protocol structure
DESCRIPTION
Defines protocol data structure for offloaded protocols
registered with AF_INET_OFFLOAD address family. Most of
the information is shared by all protocols via the parent
sock structure to prevent unnecessary duplication. The
information in this structure is limited to offload protocol specifics.
SYNOPSIS
typedef struct offload_prot
{
/* Reference to parent socket and sock */
struct offload_sock *parent;
/* Reference to protocol */
struct offload_protosw *protosw;
/* protocols address information */
struct ipv4v6_addr *src;
struct ipv4v6_addr *hop;
struct ipv4v6_addr *dst;
/* Private data for protocols, includes transport interface, etc. */
void *priv_opt;
/* protocol wait queue */
wait_queue_head_t *sleep;
/* upcalls and callbacks for protocols, set by OPS */
void (*listen_cb)( struct offload_prot *prot,
struct sockaddr *raddr,
int raddr_len );
void (*connect_cb)( struct offload_prot *prot);
int (*getopts_cb)( struct offload_prot *prot);
void (*destruct)( struct offload_prot *prot);
} offload_prot_t;
FIELDS
parent
AF_INET_OFFLOAD Parent sock structure. Reference only, protocols
should not directly access any field in the structure. OPS calls
are provided for accessibility.
p_sw
reference to protocols software structure, see offload_protosw_t.
priv_opt
Private data area owned by the protocol provider.
sleep
Protocol level wait queue for protocol completion processing.
listen_cb
callback for protocol connect requests in listen state
connect_cb
callback function for protocol connection requests
getopts_cb
upcall for protocol to get generic socket option values
destruct
function called when destoying offload protocol
NOTES
SEE ALSO
NAME
offload_sock_t : AF_INET_OFFLOAD Parent sock structure
DESCRIPTION
Defines data structure for socket that is used by AF_INET_OFFLOAD
in place of regular struct sock structure. The OFFLOAD dynamically maps
offload protocol socket structure based on OP registration and selection.
It also retains reference to TCP native socket structure.
SYNOPSIS
typedef struct offload_sock {
struct sock sock; /* Parent sock MUST be at top */
struct socket *org_socket; /* original Socket */
struct socket *nat_socket; /* native tcp Socket */
wait_queue_head_t *sleep; /* socket wait queue */
struct offload_prot prot_list[MAX_OFFLOAD_PROTOCOLS]; /* prot list */
struct offload_accept *accept; /* accept_queue for listens */
spinlock_t alock; /* lock for accept queue */
void (*destruct)( struct offload_sock *osk );
} offload_sock_t;
FIELDS
sock
a parent sock structure that is always referenced via the
socket.c above the address family. This MUST always remain
at the top of the structure since setsockopt and getsockopt
assumes that the socket->sock always references a sock with
socket option fields.
*org_socket
reference to the original socket that was created in socket.c
from the initial application socket call.
*nat_socket
reference to the native socket that was created as a result of
the offload switch calling socket.c sock_create call when multiple
offload protocols exist.
sleep
socket level wait queue for application process
raddr_len
received socket address length in bytes.
*raddr
pointer to received socket address info from the inbound
connect request.
destruct
function called when destoying offload sock
NOTES
SEE ALSO
offload_prot_t
NAME
offload_prot_ops_t: offload protocol operations
DESCRIPTION
Defines operation interfaces for the offload protocol
providers. AF offload socket layer -> protocol interface.
SYNOPSIS
typedef struct offload_prot_ops {
int (*init)( struct offload_prot *prot);
int (*destroy)( struct offload_prot *prot);
void (*close)( struct offload_prot *prot,
long timeout);
void (*shutdown)( struct offload_prot *prot,
int how);
int (*connect)( struct offload_prot *prot);
int (*disconnect)( struct offload_prot *prot,
int flags,
int *err );
struct offload_prot *
(*accept)( struct offload_prot *prot,
int flags,
int *err);
int (*ioctl)( struct offload_prot *prot,
int cmd,
unsigned long arg);
int (*setsockopt)( struct offload_prot *prot,
int level,
int optname,
char *optval,
int optlen);
int (*getsockopt)( struct offload_prot *prot,
int level,
int optname,
char *optval,
int *option);
int (*sendmsg)( struct offload_prot *prot,
struct msghdr *msg,
int len);
int (*recvmsg)( struct offload_prot,
struct msghdr *msg,
int len,
int noblock,
int flags,
int *addr_len);
int (*bind)( struct offload_prot *prot);
/* Port selection methods. */
void (*hash)( struct offload_prot *prot); ;
void (*unhash)( struct offload_prot *prot);
int (*get_port)( struct offload_prot *prot,
unsigned short port);
char name[32];
struct {
int inuse;
u8 __pad[SMP_CACHE_BYTES - sizeof(int)];
} stats[NR_CPUS];
} offload_prot_ops_t;
FIELDS
NOTES
SEE ALSO
NAME
offload_register_protosw -- Register an Offload Protocol (OP) module
with the OFFLOAD Protocol Swithc (OPS).
DESCRIPTION
The OP and default TCPstack, as part of their initialization are
expected to make this call to register their services to OPS,
As part of registeration, the OP specifies the protocol type its intend
to support and its capabilites ( like self_routing, stream support etc)
struct offload_protosw *
offload_register_protosw( int protocol,
int capability,
struct offload_prot_ops *ops,
void (*unload)(void));
PARAMETERS
INPUTS
protocol
Name of the Protocol this OP supports: IPPROTO_TCP, IPPROTO_SDP, etc.
capabilities
OP capabilities this OP supports: AT_STREAM, AT_DGRM, AT_IPV4. SelfRoute...
ops
offload_prot_ops_t structure initialized with protocol entry points.
RETURN VALUE
NAME
offload_unregister_protosw -- unregister a registered Offload Protocol
(OP) module with the OPS.
DESCRIPTION
Offload protocol under AF_INET_OFFLOAD calls this function to
deregister itself from the OPS
void
offload_unregister_protosw( struct offload_protosw *protosw );
PARAMETERS
INPUTS
*protocol
Reference to the offload_protosw structure created by OPS
during protocol registration.
RETURN VALUE
Void
PARAMETERS
INPUTS
*protocol
Reference to the offload_protosw structure created by OPS
during protocol registration.
RETURN VALUE
Void
NAME
offload_notification -- protocol event notification to OPS.
DESCRIPTION
Offload protocol under AF_INET_OFFLOAD calls this function to
notify OPS of unsolicited events. Protocol interface and address
assignment and removal events.
void
offload_notification( offload_event_t event,
int event_len,
void *data );
PARAMETERS
INPUTS
event
type of offload protocol event. See offload_event_t
event_len
offload protocol event data length in bytes
data
pointer to offload protocol event data
RETURN VALUE
Void
PARAMETERS
INPUTS
event
type of offload protocol event. See offload_event_t
event_len
offload protocol event data length in bytes
data
pointer to offload protocol event data
RETURN VALUE
Void