FreeBSD kernel IPv4 code
toecore.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Chelsio Communications, Inc.
5 * All rights reserved.
6 * Written by: Navdeep Parhar <np@FreeBSD.org>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD$");
32
33#include "opt_inet.h"
34#include "opt_inet6.h"
35
36#include <sys/param.h>
37#include <sys/eventhandler.h>
38#include <sys/kernel.h>
39#include <sys/systm.h>
40#include <sys/malloc.h>
41#include <sys/mbuf.h>
42#include <sys/module.h>
43#include <sys/types.h>
44#include <sys/sockopt.h>
45#include <sys/sysctl.h>
46#include <sys/socket.h>
47
48#include <net/ethernet.h>
49#include <net/if.h>
50#include <net/if_var.h>
51#include <net/if_types.h>
52#include <net/if_vlan_var.h>
53#include <net/if_llatbl.h>
54#include <net/route.h>
55
56#include <netinet/if_ether.h>
57#include <netinet/in.h>
58#include <netinet/in_pcb.h>
59#include <netinet/in_var.h>
60#include <netinet6/in6_var.h>
61#include <netinet6/in6_pcb.h>
62#include <netinet6/nd6.h>
63#define TCPSTATES
64#include <netinet/tcp.h>
65#include <netinet/tcp_fsm.h>
66#include <netinet/tcp_timer.h>
67#include <netinet/tcp_var.h>
69#include <netinet/tcp_offload.h>
70#include <netinet/toecore.h>
71
72static struct mtx toedev_lock;
73static TAILQ_HEAD(, toedev) toedev_list;
74static eventhandler_tag listen_start_eh;
75static eventhandler_tag listen_stop_eh;
76static eventhandler_tag lle_event_eh;
77
78static int
79toedev_connect(struct toedev *tod __unused, struct socket *so __unused,
80 struct nhop_object *nh __unused, struct sockaddr *nam __unused)
81{
82
83 return (ENOTSUP);
84}
85
86static int
87toedev_listen_start(struct toedev *tod __unused, struct tcpcb *tp __unused)
88{
89
90 return (ENOTSUP);
91}
92
93static int
94toedev_listen_stop(struct toedev *tod __unused, struct tcpcb *tp __unused)
95{
96
97 return (ENOTSUP);
98}
99
100static void
101toedev_input(struct toedev *tod __unused, struct tcpcb *tp __unused,
102 struct mbuf *m)
103{
104
105 m_freem(m);
106 return;
107}
108
109static void
110toedev_rcvd(struct toedev *tod __unused, struct tcpcb *tp __unused)
111{
112
113 return;
114}
115
116static int
117toedev_output(struct toedev *tod __unused, struct tcpcb *tp __unused)
118{
119
120 return (ENOTSUP);
121}
122
123static void
124toedev_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp __unused)
125{
126
127 return;
128}
129
130static void
131toedev_l2_update(struct toedev *tod __unused, struct ifnet *ifp __unused,
132 struct sockaddr *sa __unused, uint8_t *lladdr __unused,
133 uint16_t vtag __unused)
134{
135
136 return;
137}
138
139static void
140toedev_route_redirect(struct toedev *tod __unused, struct ifnet *ifp __unused,
141 struct nhop_object *nh0 __unused, struct nhop_object *nh1 __unused)
142{
143
144 return;
145}
146
147static void
148toedev_syncache_added(struct toedev *tod __unused, void *ctx __unused)
149{
150
151 return;
152}
153
154static void
155toedev_syncache_removed(struct toedev *tod __unused, void *ctx __unused)
156{
157
158 return;
159}
160
161static int
162toedev_syncache_respond(struct toedev *tod __unused, void *ctx __unused,
163 struct mbuf *m)
164{
165
166 m_freem(m);
167 return (0);
168}
169
170static void
171toedev_offload_socket(struct toedev *tod __unused, void *ctx __unused,
172 struct socket *so __unused)
173{
174
175 return;
176}
177
178static void
179toedev_ctloutput(struct toedev *tod __unused, struct tcpcb *tp __unused,
180 int sopt_dir __unused, int sopt_name __unused)
181{
182
183 return;
184}
185
186static void
187toedev_tcp_info(struct toedev *tod __unused, struct tcpcb *tp __unused,
188 struct tcp_info *ti __unused)
189{
190
191 return;
192}
193
194static int
195toedev_alloc_tls_session(struct toedev *tod __unused, struct tcpcb *tp __unused,
196 struct ktls_session *tls __unused, int direction __unused)
197{
198
199 return (EINVAL);
200}
201
202static void
203toedev_pmtu_update(struct toedev *tod __unused, struct tcpcb *tp __unused,
204 tcp_seq seq __unused, int mtu __unused)
205{
206
207 return;
208}
209
210/*
211 * Inform one or more TOE devices about a listening socket.
212 */
213static void
214toe_listen_start(struct inpcb *inp, void *arg)
215{
216 struct toedev *t, *tod;
217 struct tcpcb *tp;
218
219 INP_WLOCK_ASSERT(inp);
220 KASSERT(inp->inp_pcbinfo == &V_tcbinfo,
221 ("%s: inp is not a TCP inp", __func__));
222
223 if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))
224 return;
225
226 tp = intotcpcb(inp);
227 if (tp->t_state != TCPS_LISTEN)
228 return;
229
230 t = arg;
231 mtx_lock(&toedev_lock);
232 TAILQ_FOREACH(tod, &toedev_list, link) {
233 if (t == NULL || t == tod)
235 }
236 mtx_unlock(&toedev_lock);
237}
238
239static void
240toe_listen_start_event(void *arg __unused, struct tcpcb *tp)
241{
242 struct inpcb *inp = tp->t_inpcb;
243
244 INP_WLOCK_ASSERT(inp);
245 KASSERT(tp->t_state == TCPS_LISTEN,
246 ("%s: t_state %s", __func__, tcpstates[tp->t_state]));
247
248 toe_listen_start(inp, NULL);
249}
250
251static void
252toe_listen_stop_event(void *arg __unused, struct tcpcb *tp)
253{
254 struct toedev *tod;
255#ifdef INVARIANTS
256 struct inpcb *inp = tp->t_inpcb;
257#endif
258
259 INP_WLOCK_ASSERT(inp);
260 KASSERT(tp->t_state == TCPS_LISTEN,
261 ("%s: t_state %s", __func__, tcpstates[tp->t_state]));
262
263 mtx_lock(&toedev_lock);
264 TAILQ_FOREACH(tod, &toedev_list, link)
265 tod->tod_listen_stop(tod, tp);
266 mtx_unlock(&toedev_lock);
267}
268
269/*
270 * Fill up a freshly allocated toedev struct with reasonable defaults.
271 */
272void
273init_toedev(struct toedev *tod)
274{
275
276 tod->tod_softc = NULL;
277
278 /*
279 * Provide no-op defaults so that the kernel can call any toedev
280 * function without having to check whether the TOE driver supplied one
281 * or not.
282 */
283 tod->tod_connect = toedev_connect;
286 tod->tod_input = toedev_input;
287 tod->tod_rcvd = toedev_rcvd;
302}
303
304/*
305 * Register an active TOE device with the system. This allows it to receive
306 * notifications from the kernel.
307 */
308int
310{
311 struct toedev *t;
312
313 mtx_lock(&toedev_lock);
314 TAILQ_FOREACH(t, &toedev_list, link) {
315 if (t == tod) {
316 mtx_unlock(&toedev_lock);
317 return (EEXIST);
318 }
319 }
320
321 TAILQ_INSERT_TAIL(&toedev_list, tod, link);
323 mtx_unlock(&toedev_lock);
324
326
327 return (0);
328}
329
330/*
331 * Remove the TOE device from the global list of active TOE devices. It is the
332 * caller's responsibility to ensure that the TOE device is quiesced prior to
333 * this call.
334 */
335int
337{
338 struct toedev *t, *t2;
339 int rc = ENODEV;
340
341 mtx_lock(&toedev_lock);
342 TAILQ_FOREACH_SAFE(t, &toedev_list, link, t2) {
343 if (t == tod) {
344 TAILQ_REMOVE(&toedev_list, tod, link);
346 rc = 0;
347 break;
348 }
349 }
350 KASSERT(registered_toedevs >= 0,
351 ("%s: registered_toedevs (%d) < 0", __func__, registered_toedevs));
352 mtx_unlock(&toedev_lock);
353 return (rc);
354}
355
356void
357toe_syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
358 struct inpcb *inp, void *tod, void *todctx, uint8_t iptos)
359{
360
361 INP_RLOCK_ASSERT(inp);
362
363 (void )syncache_add(inc, to, th, inp, inp->inp_socket, NULL, tod,
364 todctx, iptos, htons(0));
365}
366
367int
368toe_syncache_expand(struct in_conninfo *inc, struct tcpopt *to,
369 struct tcphdr *th, struct socket **lsop)
370{
371
372 NET_EPOCH_ASSERT();
373
374 return (syncache_expand(inc, to, th, lsop, NULL, htons(0)));
375}
376
377/*
378 * General purpose check to see if a 4-tuple is in use by the kernel. If a TCP
379 * header (presumably for an incoming SYN) is also provided, an existing 4-tuple
380 * in TIME_WAIT may be assassinated freeing it up for re-use.
381 *
382 * Note that the TCP header must have been run through tcp_fields_to_host() or
383 * equivalent.
384 */
385int
386toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
387{
388 struct inpcb *inp;
389
390 if (inc->inc_flags & INC_ISIPV6) {
391 inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr,
392 inc->inc_fport, &inc->inc6_laddr, inc->inc_lport,
393 INPLOOKUP_RLOCKPCB, ifp);
394 } else {
395 inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport,
396 inc->inc_laddr, inc->inc_lport, INPLOOKUP_RLOCKPCB, ifp);
397 }
398 if (inp != NULL) {
399 INP_RLOCK_ASSERT(inp);
400
401 if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) {
402 if (!tcp_twcheck(inp, NULL, th, NULL, 0))
403 return (EADDRINUSE);
404 } else {
405 INP_RUNLOCK(inp);
406 return (EADDRINUSE);
407 }
408 }
409
410 return (0);
411}
412
413static void
414toe_lle_event(void *arg __unused, struct llentry *lle, int evt)
415{
416 struct toedev *tod;
417 struct ifnet *ifp;
418 struct sockaddr *sa;
419 uint8_t *lladdr;
420 uint16_t vid, pcp;
421 int family;
422 struct sockaddr_in6 sin6;
423
424 LLE_WLOCK_ASSERT(lle);
425
426 ifp = lltable_get_ifp(lle->lle_tbl);
427 family = lltable_get_af(lle->lle_tbl);
428
429 if (family != AF_INET && family != AF_INET6)
430 return;
431 /*
432 * Not interested if the interface's TOE capability is not enabled.
433 */
434 if ((family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4)) ||
435 (family == AF_INET6 && !(ifp->if_capenable & IFCAP_TOE6)))
436 return;
437
438 tod = TOEDEV(ifp);
439 if (tod == NULL)
440 return;
441
442 sa = (struct sockaddr *)&sin6;
443 lltable_fill_sa_entry(lle, sa);
444
445 vid = 0xfff;
446 pcp = 0;
447 if (evt != LLENTRY_RESOLVED) {
448 /*
449 * LLENTRY_TIMEDOUT, LLENTRY_DELETED, LLENTRY_EXPIRED all mean
450 * this entry is going to be deleted.
451 */
452
453 lladdr = NULL;
454 } else {
455 KASSERT(lle->la_flags & LLE_VALID,
456 ("%s: %p resolved but not valid?", __func__, lle));
457
458 lladdr = (uint8_t *)lle->ll_addr;
459 VLAN_TAG(ifp, &vid);
460 VLAN_PCP(ifp, &pcp);
461 }
462
463 tod->tod_l2_update(tod, ifp, sa, lladdr, EVL_MAKETAG(vid, pcp, 0));
464}
465
466/*
467 * Returns 0 or EWOULDBLOCK on success (any other value is an error). 0 means
468 * lladdr and vtag are valid on return, EWOULDBLOCK means the TOE driver's
469 * tod_l2_update will be called later, when the entry is resolved or times out.
470 */
471int
472toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa,
473 uint8_t *lladdr, uint16_t *vtag)
474{
475 int rc;
476 uint16_t vid, pcp;
477
478 switch (sa->sa_family) {
479#ifdef INET
480 case AF_INET:
481 rc = arpresolve(ifp, 0, NULL, sa, lladdr, NULL, NULL);
482 break;
483#endif
484#ifdef INET6
485 case AF_INET6:
486 rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr,
487 NULL, NULL);
488 break;
489#endif
490 default:
491 return (EPROTONOSUPPORT);
492 }
493
494 if (rc == 0) {
495 vid = 0xfff;
496 pcp = 0;
497 if (ifp->if_type == IFT_L2VLAN) {
498 VLAN_TAG(ifp, &vid);
499 VLAN_PCP(ifp, &pcp);
500 } else if (ifp->if_pcp != IFNET_PCP_NONE) {
501 vid = 0;
502 pcp = ifp->if_pcp;
503 }
504 *vtag = EVL_MAKETAG(vid, pcp, 0);
505 }
506
507 return (rc);
508}
509
510void
511toe_connect_failed(struct toedev *tod, struct inpcb *inp, int err)
512{
513
514 NET_EPOCH_ASSERT();
515 INP_WLOCK_ASSERT(inp);
516
517 if (!(inp->inp_flags & INP_DROPPED)) {
518 struct tcpcb *tp = intotcpcb(inp);
519
520 KASSERT(tp->t_flags & TF_TOE,
521 ("%s: tp %p not offloaded.", __func__, tp));
522
523 if (err == EAGAIN) {
524 /*
525 * Temporary failure during offload, take this PCB back.
526 * Detach from the TOE driver and do the rest of what
527 * TCP's pru_connect would have done if the connection
528 * wasn't offloaded.
529 */
530
531 tod->tod_pcb_detach(tod, tp);
532 KASSERT(!(tp->t_flags & TF_TOE),
533 ("%s: tp %p still offloaded.", __func__, tp));
535 if (tcp_output(tp) < 0)
536 INP_WLOCK(inp); /* re-acquire */
537 } else {
538 tp = tcp_drop(tp, err);
539 if (tp == NULL)
540 INP_WLOCK(inp); /* re-acquire */
541 }
542 }
543 INP_WLOCK_ASSERT(inp);
544}
545
546static int
548{
549
550 mtx_init(&toedev_lock, "toedev lock", NULL, MTX_DEF);
551 TAILQ_INIT(&toedev_list);
552
553 listen_start_eh = EVENTHANDLER_REGISTER(tcp_offload_listen_start,
554 toe_listen_start_event, NULL, EVENTHANDLER_PRI_ANY);
555 listen_stop_eh = EVENTHANDLER_REGISTER(tcp_offload_listen_stop,
556 toe_listen_stop_event, NULL, EVENTHANDLER_PRI_ANY);
557 lle_event_eh = EVENTHANDLER_REGISTER(lle_event, toe_lle_event, NULL,
558 EVENTHANDLER_PRI_ANY);
559
560 return (0);
561}
562
563static int
565{
566
567 mtx_lock(&toedev_lock);
568 if (!TAILQ_EMPTY(&toedev_list)) {
569 mtx_unlock(&toedev_lock);
570 return (EBUSY);
571 }
572
573 EVENTHANDLER_DEREGISTER(tcp_offload_listen_start, listen_start_eh);
574 EVENTHANDLER_DEREGISTER(tcp_offload_listen_stop, listen_stop_eh);
575 EVENTHANDLER_DEREGISTER(lle_event, lle_event_eh);
576
577 mtx_unlock(&toedev_lock);
578 mtx_destroy(&toedev_lock);
579
580 return (0);
581}
582
583static int
584toecore_mod_handler(module_t mod, int cmd, void *arg)
585{
586
587 if (cmd == MOD_LOAD)
588 return (toecore_load());
589
590 if (cmd == MOD_UNLOAD)
591 return (toecore_unload());
592
593 return (EOPNOTSUPP);
594}
595
596static moduledata_t mod_data= {
597 "toecore",
599 0
600};
601
602MODULE_VERSION(toecore, 1);
603DECLARE_MODULE(toecore, mod_data, SI_SUB_EXEC, SI_ORDER_ANY);
int arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, const struct sockaddr *dst, u_char *desten, uint32_t *pflags, struct llentry **plle)
Definition: if_ether.c:614
__uint16_t uint16_t
Definition: in.h:57
__uint8_t uint8_t
Definition: in.h:52
void inp_apply_all(void(*func)(struct inpcb *, void *), void *arg)
Definition: in_pcb.c:2702
#define INC_ISIPV6
Definition: in_pcb.h:124
#define INP_WLOCK(inp)
Definition: in_pcb.h:518
struct inpcb * in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, struct in_addr, u_int, int, struct ifnet *)
#define INP_RUNLOCK(inp)
Definition: in_pcb.h:521
#define INP_WLOCK_ASSERT(inp)
Definition: in_pcb.h:529
#define INP_TIMEWAIT
Definition: in_pcb.h:644
#define INP_DROPPED
Definition: in_pcb.h:646
@ INPLOOKUP_RLOCKPCB
Definition: in_pcb.h:693
#define INP_RLOCK_ASSERT(inp)
Definition: in_pcb.h:528
u_int8_t inc_flags
Definition: in_pcb.h:114
Definition: in_pcb.h:217
struct socket * inp_socket
Definition: in_pcb.h:254
int inp_flags
Definition: in_pcb.h:246
struct inpcbinfo * inp_pcbinfo
Definition: in_pcb.h:257
Definition: tcp_var.h:132
uint32_t t_state
Definition: tcp_var.h:140
struct toedev * tod
Definition: tcp_var.h:236
u_int t_flags
Definition: tcp_var.h:146
struct inpcb * t_inpcb
Definition: tcp_var.h:134
Definition: toecore.h:48
int(* tod_syncache_respond)(struct toedev *, void *, struct mbuf *)
Definition: toecore.h:105
int(* tod_send_fin)(struct toedev *, struct tcpcb *)
Definition: toecore.h:86
int(* tod_listen_stop)(struct toedev *, struct tcpcb *)
Definition: toecore.h:61
void(* tod_pmtu_update)(struct toedev *, struct tcpcb *, tcp_seq, int)
Definition: toecore.h:120
void(* tod_offload_socket)(struct toedev *, void *, struct socket *)
Definition: toecore.h:106
int(* tod_connect)(struct toedev *, struct socket *, struct nhop_object *, struct sockaddr *)
Definition: toecore.h:56
void(* tod_pcb_detach)(struct toedev *, struct tcpcb *)
Definition: toecore.h:89
void(* tod_tcp_info)(struct toedev *, struct tcpcb *, struct tcp_info *)
Definition: toecore.h:112
int(* tod_send_rst)(struct toedev *, struct tcpcb *)
Definition: toecore.h:83
void(* tod_input)(struct toedev *, struct tcpcb *, struct mbuf *)
Definition: toecore.h:67
int(* tod_output)(struct toedev *, struct tcpcb *)
Definition: toecore.h:80
void(* tod_syncache_removed)(struct toedev *, void *)
Definition: toecore.h:104
int(* tod_alloc_tls_session)(struct toedev *, struct tcpcb *, struct ktls_session *, int)
Definition: toecore.h:116
void * tod_softc
Definition: toecore.h:50
void(* tod_l2_update)(struct toedev *, struct ifnet *, struct sockaddr *, uint8_t *, uint16_t)
Definition: toecore.h:95
int(* tod_listen_start)(struct toedev *, struct tcpcb *)
Definition: toecore.h:60
void(* tod_syncache_added)(struct toedev *, void *)
Definition: toecore.h:103
void(* tod_rcvd)(struct toedev *, struct tcpcb *)
Definition: toecore.h:74
void(* tod_route_redirect)(struct toedev *, struct ifnet *, struct nhop_object *, struct nhop_object *)
Definition: toecore.h:99
void(* tod_ctloutput)(struct toedev *, struct tcpcb *, int, int)
Definition: toecore.h:109
#define TCPS_LISTEN
Definition: tcp_fsm.h:48
void tcp_offload_listen_stop(struct tcpcb *tp)
Definition: tcp_offload.c:123
void tcp_offload_listen_start(struct tcpcb *tp)
Definition: tcp_offload.c:114
int registered_toedevs
Definition: tcp_offload.c:57
struct tcpcb * tcp_drop(struct tcpcb *tp, int errno)
Definition: tcp_subr.c:2283
struct socket * syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, struct socket *so, struct mbuf *m, void *tod, void *todctx, uint8_t iptos, uint16_t port)
int syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct socket **lsop, struct mbuf *m, uint16_t port)
void tcp_timer_activate(struct tcpcb *tp, uint32_t timer_type, u_int delta)
Definition: tcp_timer.c:854
#define TP_KEEPINIT(tp)
Definition: tcp_timer.h:180
#define TT_KEEP
Definition: tcp_timer.h:164
int tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, struct mbuf *m, int tlen)
Definition: tcp_timewait.c:392
#define intotcpcb(ip)
Definition: tcp_var.h:645
#define TF_TOE
Definition: tcp_var.h:522
#define V_tcbinfo
Definition: tcp_var.h:1030
static int toecore_load(void)
Definition: toecore.c:547
static moduledata_t mod_data
Definition: toecore.c:596
int register_toedev(struct toedev *tod)
Definition: toecore.c:309
static void toe_listen_start_event(void *arg __unused, struct tcpcb *tp)
Definition: toecore.c:240
static void toedev_route_redirect(struct toedev *tod __unused, struct ifnet *ifp __unused, struct nhop_object *nh0 __unused, struct nhop_object *nh1 __unused)
Definition: toecore.c:140
static void toe_listen_stop_event(void *arg __unused, struct tcpcb *tp)
Definition: toecore.c:252
static int toedev_listen_start(struct toedev *tod __unused, struct tcpcb *tp __unused)
Definition: toecore.c:87
static int toedev_syncache_respond(struct toedev *tod __unused, void *ctx __unused, struct mbuf *m)
Definition: toecore.c:162
static int toedev_output(struct toedev *tod __unused, struct tcpcb *tp __unused)
Definition: toecore.c:117
static void toedev_offload_socket(struct toedev *tod __unused, void *ctx __unused, struct socket *so __unused)
Definition: toecore.c:171
static void toedev_l2_update(struct toedev *tod __unused, struct ifnet *ifp __unused, struct sockaddr *sa __unused, uint8_t *lladdr __unused, uint16_t vtag __unused)
Definition: toecore.c:131
static void toedev_tcp_info(struct toedev *tod __unused, struct tcpcb *tp __unused, struct tcp_info *ti __unused)
Definition: toecore.c:187
void toe_connect_failed(struct toedev *tod, struct inpcb *inp, int err)
Definition: toecore.c:511
static int toecore_unload(void)
Definition: toecore.c:564
int toe_syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct socket **lsop)
Definition: toecore.c:368
static void toedev_pmtu_update(struct toedev *tod __unused, struct tcpcb *tp __unused, tcp_seq seq __unused, int mtu __unused)
Definition: toecore.c:203
static void toedev_syncache_removed(struct toedev *tod __unused, void *ctx __unused)
Definition: toecore.c:155
static void toedev_ctloutput(struct toedev *tod __unused, struct tcpcb *tp __unused, int sopt_dir __unused, int sopt_name __unused)
Definition: toecore.c:179
static int toedev_alloc_tls_session(struct toedev *tod __unused, struct tcpcb *tp __unused, struct ktls_session *tls __unused, int direction __unused)
Definition: toecore.c:195
static TAILQ_HEAD(toedev)
Definition: toecore.c:73
int toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, uint8_t *lladdr, uint16_t *vtag)
Definition: toecore.c:472
__FBSDID("$FreeBSD$")
static void toedev_rcvd(struct toedev *tod __unused, struct tcpcb *tp __unused)
Definition: toecore.c:110
static void toedev_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp __unused)
Definition: toecore.c:124
static void toedev_input(struct toedev *tod __unused, struct tcpcb *tp __unused, struct mbuf *m)
Definition: toecore.c:101
MODULE_VERSION(toecore, 1)
static void toe_lle_event(void *arg __unused, struct llentry *lle, int evt)
Definition: toecore.c:414
void init_toedev(struct toedev *tod)
Definition: toecore.c:273
static int toedev_listen_stop(struct toedev *tod __unused, struct tcpcb *tp __unused)
Definition: toecore.c:94
int toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
Definition: toecore.c:386
DECLARE_MODULE(toecore, mod_data, SI_SUB_EXEC, SI_ORDER_ANY)
static int toecore_mod_handler(module_t mod, int cmd, void *arg)
Definition: toecore.c:584
int unregister_toedev(struct toedev *tod)
Definition: toecore.c:336
void toe_syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, void *tod, void *todctx, uint8_t iptos)
Definition: toecore.c:357
static void toe_listen_start(struct inpcb *inp, void *arg)
Definition: toecore.c:214
static void toedev_syncache_added(struct toedev *tod __unused, void *ctx __unused)
Definition: toecore.c:148
static struct mtx toedev_lock
Definition: toecore.c:72