FreeBSD/Linux Kernel Cross Reference
sys/netinet/toedev.h
1 /*-
2 * Copyright (c) 2007-2008, Chelsio Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Neither the name of the Chelsio Corporation nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $FreeBSD: releng/7.4/sys/netinet/toedev.h 182949 2008-09-11 23:49:36Z kmacy $
28 */
29
30 #ifndef _NETINET_TOEDEV_H_
31 #define _NETINET_TOEDEV_H_
32
33 #ifndef _KERNEL
34 #error "no user-serviceable parts inside"
35 #endif
36
37 extern uint32_t toedev_registration_count;
38
39 /* Parameter values for offload_get_phys_egress(). */
40 enum {
41 TOE_OPEN,
42 TOE_FAILOVER,
43 };
44
45 /* Parameter values for toe_failover(). */
46 enum {
47 TOE_ACTIVE_SLAVE,
48 TOE_LINK_DOWN,
49 TOE_LINK_UP,
50 TOE_RELEASE,
51 TOE_RELEASE_ALL,
52 };
53
54 #define TOENAMSIZ 16
55
56 /* Get the toedev associated with a ifnet. */
57 #define TOEDEV(ifp) ((ifp)->if_llsoftc)
58
59 struct offload_id {
60 unsigned int id;
61 unsigned long data;
62 };
63
64 struct ifnet;
65 struct rt_entry;
66 struct tom_info;
67 struct sysctl_oid;
68 struct socket;
69 struct mbuf;
70
71 struct toedev {
72 TAILQ_ENTRY(toedev) entry;
73 char tod_name[TOENAMSIZ]; /* TOE device name */
74 unsigned int tod_ttid; /* TOE type id */
75 unsigned long tod_flags; /* device flags */
76 unsigned int tod_mtu; /* max TX offloaded data */
77 unsigned int tod_nconn; /* max # of offloaded
78 * connections
79 */
80 struct ifnet *tod_lldev; /* first interface */
81 const struct tom_info *tod_offload_mod; /* TCP offload module */
82
83 /*
84 * This TOE device is capable of offloading the connection for socket so
85 */
86 int (*tod_can_offload)(struct toedev *dev, struct socket *so);
87
88 /*
89 * Establish a connection to nam using the TOE device dev
90 */
91 int (*tod_connect)(struct toedev *dev, struct socket *so,
92 struct rtentry *rt, struct sockaddr *nam);
93 /*
94 * Send an mbuf down to the toe device
95 */
96 int (*tod_send)(struct toedev *dev, struct mbuf *m);
97 /*
98 * Receive an array of mbufs from the TOE device dev
99 */
100 int (*tod_recv)(struct toedev *dev, struct mbuf **m, int n);
101 /*
102 * Device specific ioctl interface
103 */
104 int (*tod_ctl)(struct toedev *dev, unsigned int req, void *data);
105 /*
106 * Update L2 entry in toedev
107 */
108 void (*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);
109 /*
110 * Failover from one toe device to another
111 */
112 void (*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,
113 struct ifnet *ndev, int event);
114 void *tod_priv; /* driver private data */
115 void *tod_l2opt; /* optional layer 2 data */
116 void *tod_l3opt; /* optional layer 3 data */
117 void *tod_l4opt; /* optional layer 4 data */
118 void *tod_ulp; /* upper lever protocol */
119 };
120
121 struct tom_info {
122 TAILQ_ENTRY(tom_info) entry;
123 int (*ti_attach)(struct toedev *dev,
124 const struct offload_id *entry);
125 int (*ti_detach)(struct toedev *dev);
126 const char *ti_name;
127 const struct offload_id *ti_id_table;
128 };
129
130 static __inline void
131 init_offload_dev(struct toedev *dev)
132 {
133 }
134
135 int register_tom(struct tom_info *t);
136 int unregister_tom(struct tom_info *t);
137 int register_toedev(struct toedev *dev, const char *name);
138 int unregister_toedev(struct toedev *dev);
139 int activate_offload(struct toedev *dev);
140 int toe_send(struct toedev *dev, struct mbuf *m);
141 void toe_arp_update(struct rtentry *rt);
142 struct ifnet *offload_get_phys_egress(struct ifnet *ifp,
143 struct socket *so, int context);
144 int toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
145
146 static __inline void
147 toe_neigh_update(struct ifnet *ifp)
148 {
149 }
150
151 static __inline void
152 toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)
153 {
154 }
155
156 static __inline int
157 toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)
158 {
159 return (0);
160 }
161
162 #endif /* _NETINET_TOEDEV_H_ */
Cache object: 673abe362842bc143777a956fdddba10
|