FreeBSD kernel IPv4 code
toecore.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/types.h>
#include <sys/sockopt.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/if_vlan_var.h>
#include <net/if_llatbl.h>
#include <net/route.h>
#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet6/in6_var.h>
#include <netinet6/in6_pcb.h>
#include <netinet6/nd6.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp_syncache.h>
#include <netinet/tcp_offload.h>
#include <netinet/toecore.h>
Include dependency graph for toecore.c:

Go to the source code of this file.

Macros

#define TCPSTATES
 

Functions

 __FBSDID ("$FreeBSD$")
 
static TAILQ_HEAD (toedev)
 
static int toedev_listen_start (struct toedev *tod __unused, struct tcpcb *tp __unused)
 
static int toedev_listen_stop (struct toedev *tod __unused, struct tcpcb *tp __unused)
 
static void toedev_input (struct toedev *tod __unused, struct tcpcb *tp __unused, struct mbuf *m)
 
static void toedev_rcvd (struct toedev *tod __unused, struct tcpcb *tp __unused)
 
static int toedev_output (struct toedev *tod __unused, struct tcpcb *tp __unused)
 
static void toedev_pcb_detach (struct toedev *tod __unused, struct tcpcb *tp __unused)
 
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)
 
static void toedev_route_redirect (struct toedev *tod __unused, struct ifnet *ifp __unused, struct nhop_object *nh0 __unused, struct nhop_object *nh1 __unused)
 
static void toedev_syncache_added (struct toedev *tod __unused, void *ctx __unused)
 
static void toedev_syncache_removed (struct toedev *tod __unused, void *ctx __unused)
 
static int toedev_syncache_respond (struct toedev *tod __unused, void *ctx __unused, struct mbuf *m)
 
static void toedev_offload_socket (struct toedev *tod __unused, void *ctx __unused, struct socket *so __unused)
 
static void toedev_ctloutput (struct toedev *tod __unused, struct tcpcb *tp __unused, int sopt_dir __unused, int sopt_name __unused)
 
static void toedev_tcp_info (struct toedev *tod __unused, struct tcpcb *tp __unused, struct tcp_info *ti __unused)
 
static int toedev_alloc_tls_session (struct toedev *tod __unused, struct tcpcb *tp __unused, struct ktls_session *tls __unused, int direction __unused)
 
static void toedev_pmtu_update (struct toedev *tod __unused, struct tcpcb *tp __unused, tcp_seq seq __unused, int mtu __unused)
 
static void toe_listen_start (struct inpcb *inp, void *arg)
 
static void toe_listen_start_event (void *arg __unused, struct tcpcb *tp)
 
static void toe_listen_stop_event (void *arg __unused, struct tcpcb *tp)
 
void init_toedev (struct toedev *tod)
 
int register_toedev (struct toedev *tod)
 
int unregister_toedev (struct toedev *tod)
 
void toe_syncache_add (struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, void *tod, void *todctx, uint8_t iptos)
 
int toe_syncache_expand (struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct socket **lsop)
 
int toe_4tuple_check (struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
 
static void toe_lle_event (void *arg __unused, struct llentry *lle, int evt)
 
int toe_l2_resolve (struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, uint8_t *lladdr, uint16_t *vtag)
 
void toe_connect_failed (struct toedev *tod, struct inpcb *inp, int err)
 
static int toecore_load (void)
 
static int toecore_unload (void)
 
static int toecore_mod_handler (module_t mod, int cmd, void *arg)
 
 MODULE_VERSION (toecore, 1)
 
 DECLARE_MODULE (toecore, mod_data, SI_SUB_EXEC, SI_ORDER_ANY)
 

Variables

static struct mtx toedev_lock
 
static moduledata_t mod_data
 

Macro Definition Documentation

◆ TCPSTATES

#define TCPSTATES

Definition at line 63 of file toecore.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DECLARE_MODULE()

DECLARE_MODULE ( toecore  ,
mod_data  ,
SI_SUB_EXEC  ,
SI_ORDER_ANY   
)

◆ init_toedev()

◆ MODULE_VERSION()

MODULE_VERSION ( toecore  ,
 
)

◆ register_toedev()

int register_toedev ( struct toedev tod)

Definition at line 309 of file toecore.c.

References inp_apply_all(), registered_toedevs, toe_listen_start(), and toedev_lock.

Here is the call graph for this function:

◆ TAILQ_HEAD()

static TAILQ_HEAD ( toedev  )
static

Definition at line 73 of file toecore.c.

◆ toe_4tuple_check()

int toe_4tuple_check ( struct in_conninfo inc,
struct tcphdr *  th,
struct ifnet *  ifp 
)

Definition at line 386 of file toecore.c.

References in_pcblookup(), in_conninfo::inc_flags, INC_ISIPV6, inpcb::inp_flags, INP_RLOCK_ASSERT, INP_RUNLOCK, INP_TIMEWAIT, INPLOOKUP_RLOCKPCB, tcp_twcheck(), and V_tcbinfo.

Here is the call graph for this function:

◆ toe_connect_failed()

void toe_connect_failed ( struct toedev tod,
struct inpcb inp,
int  err 
)

◆ toe_l2_resolve()

int toe_l2_resolve ( struct toedev tod,
struct ifnet *  ifp,
struct sockaddr *  sa,
uint8_t lladdr,
uint16_t vtag 
)

Definition at line 472 of file toecore.c.

References arpresolve().

Here is the call graph for this function:

◆ toe_listen_start()

static void toe_listen_start ( struct inpcb inp,
void *  arg 
)
static

◆ toe_listen_start_event()

static void toe_listen_start_event ( void *arg  __unused,
struct tcpcb tp 
)
static

Definition at line 240 of file toecore.c.

References INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_state, TCPS_LISTEN, and toe_listen_start().

Referenced by toecore_load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toe_listen_stop_event()

static void toe_listen_stop_event ( void *arg  __unused,
struct tcpcb tp 
)
static

Definition at line 252 of file toecore.c.

References INP_WLOCK_ASSERT, tcpcb::t_inpcb, tcpcb::t_state, TCPS_LISTEN, toedev::tod_listen_stop, and toedev_lock.

Referenced by toecore_load().

Here is the caller graph for this function:

◆ toe_lle_event()

static void toe_lle_event ( void *arg  __unused,
struct llentry *  lle,
int  evt 
)
static

Definition at line 414 of file toecore.c.

References toedev::tod_l2_update.

Referenced by toecore_load().

Here is the caller graph for this function:

◆ toe_syncache_add()

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 at line 357 of file toecore.c.

References INP_RLOCK_ASSERT, inpcb::inp_socket, and syncache_add().

Here is the call graph for this function:

◆ toe_syncache_expand()

int toe_syncache_expand ( struct in_conninfo inc,
struct tcpopt to,
struct tcphdr *  th,
struct socket **  lsop 
)

Definition at line 368 of file toecore.c.

References syncache_expand().

Here is the call graph for this function:

◆ toecore_load()

static int toecore_load ( void  )
static

Definition at line 547 of file toecore.c.

References tcp_offload_listen_start(), tcp_offload_listen_stop(), toe_listen_start_event(), toe_listen_stop_event(), toe_lle_event(), and toedev_lock.

Referenced by toecore_mod_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toecore_mod_handler()

static int toecore_mod_handler ( module_t  mod,
int  cmd,
void *  arg 
)
static

Definition at line 584 of file toecore.c.

References toecore_load(), and toecore_unload().

Here is the call graph for this function:

◆ toecore_unload()

static int toecore_unload ( void  )
static

Definition at line 564 of file toecore.c.

References tcp_offload_listen_start(), tcp_offload_listen_stop(), and toedev_lock.

Referenced by toecore_mod_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toedev_alloc_tls_session()

static int toedev_alloc_tls_session ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused,
struct ktls_session *tls  __unused,
int direction  __unused 
)
static

Definition at line 195 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_ctloutput()

static void toedev_ctloutput ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused,
int sopt_dir  __unused,
int sopt_name  __unused 
)
static

Definition at line 179 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_input()

static void toedev_input ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused,
struct mbuf *  m 
)
static

Definition at line 101 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_l2_update()

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 
)
static

Definition at line 131 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_listen_start()

static int toedev_listen_start ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused 
)
static

Definition at line 87 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_listen_stop()

static int toedev_listen_stop ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused 
)
static

Definition at line 94 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_offload_socket()

static void toedev_offload_socket ( struct toedev *tod  __unused,
void *ctx  __unused,
struct socket *so  __unused 
)
static

Definition at line 171 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_output()

static int toedev_output ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused 
)
static

Definition at line 117 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_pcb_detach()

static void toedev_pcb_detach ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused 
)
static

Definition at line 124 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_pmtu_update()

static void toedev_pmtu_update ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused,
tcp_seq seq  __unused,
int mtu  __unused 
)
static

Definition at line 203 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_rcvd()

static void toedev_rcvd ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused 
)
static

Definition at line 110 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_route_redirect()

static void toedev_route_redirect ( struct toedev *tod  __unused,
struct ifnet *ifp  __unused,
struct nhop_object *nh0  __unused,
struct nhop_object *nh1  __unused 
)
static

Definition at line 140 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_syncache_added()

static void toedev_syncache_added ( struct toedev *tod  __unused,
void *ctx  __unused 
)
static

Definition at line 148 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_syncache_removed()

static void toedev_syncache_removed ( struct toedev *tod  __unused,
void *ctx  __unused 
)
static

Definition at line 155 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_syncache_respond()

static int toedev_syncache_respond ( struct toedev *tod  __unused,
void *ctx  __unused,
struct mbuf *  m 
)
static

Definition at line 162 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ toedev_tcp_info()

static void toedev_tcp_info ( struct toedev *tod  __unused,
struct tcpcb *tp  __unused,
struct tcp_info *ti  __unused 
)
static

Definition at line 187 of file toecore.c.

Referenced by init_toedev().

Here is the caller graph for this function:

◆ unregister_toedev()

int unregister_toedev ( struct toedev tod)

Definition at line 336 of file toecore.c.

References registered_toedevs, and toedev_lock.

Variable Documentation

◆ mod_data

moduledata_t mod_data
static
Initial value:
= {
"toecore",
0
}
static int toecore_mod_handler(module_t mod, int cmd, void *arg)
Definition: toecore.c:584

Definition at line 596 of file toecore.c.

◆ toedev_lock

struct mtx toedev_lock
static