[Midnightbsd-cvs] src [9114] trunk/sys/netinet: remove toecore patch for now.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Oct 1 20:06:53 EDT 2016


Revision: 9114
          http://svnweb.midnightbsd.org/src/?rev=9114
Author:   laffer1
Date:     2016-10-01 20:06:52 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
remove toecore patch for now.

Added Paths:
-----------
    trunk/sys/netinet/toedev.h

Removed Paths:
-------------
    trunk/sys/netinet/toecore.c
    trunk/sys/netinet/toecore.h

Deleted: trunk/sys/netinet/toecore.c
===================================================================
--- trunk/sys/netinet/toecore.c	2016-10-02 00:05:04 UTC (rev 9113)
+++ trunk/sys/netinet/toecore.c	2016-10-02 00:06:52 UTC (rev 9114)
@@ -1,646 +0,0 @@
-/*-
- * Copyright (c) 2012 Chelsio Communications, Inc.
- * All rights reserved.
- * Written by: Navdeep Parhar <np at FreeBSD.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/sys/netinet/toecore.c 252555 2013-07-03 09:25:29Z np $");
-
-#include "opt_inet.h"
-#include "opt_inet6.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.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_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>
-#define TCPSTATES
-#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>
-
-static struct mtx toedev_lock;
-static TAILQ_HEAD(, toedev) toedev_list;
-static eventhandler_tag listen_start_eh;
-static eventhandler_tag listen_stop_eh;
-static eventhandler_tag lle_event_eh;
-static eventhandler_tag route_redirect_eh;
-
-static int
-toedev_connect(struct toedev *tod __unused, struct socket *so __unused,
-    struct rtentry *rt __unused, struct sockaddr *nam __unused)
-{
-
-	return (ENOTSUP);
-}
-
-static int
-toedev_listen_start(struct toedev *tod __unused, struct tcpcb *tp __unused)
-{
-
-	return (ENOTSUP);
-}
-
-static int
-toedev_listen_stop(struct toedev *tod __unused, struct tcpcb *tp __unused)
-{
-
-	return (ENOTSUP);
-}
-
-static void
-toedev_input(struct toedev *tod __unused, struct tcpcb *tp __unused,
-    struct mbuf *m)
-{
-
-	m_freem(m);
-	return;
-}
-
-static void
-toedev_rcvd(struct toedev *tod __unused, struct tcpcb *tp __unused)
-{
-
-	return;
-}
-
-static int
-toedev_output(struct toedev *tod __unused, struct tcpcb *tp __unused)
-{
-
-	return (ENOTSUP);
-}
-
-static void
-toedev_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp __unused)
-{
-
-	return;
-}
-
-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)
-{
-
-	return;
-}
-
-static void
-toedev_route_redirect(struct toedev *tod __unused, struct ifnet *ifp __unused,
-    struct rtentry *rt0 __unused, struct rtentry *rt1 __unused)
-{
-
-	return;
-}
-
-static void
-toedev_syncache_added(struct toedev *tod __unused, void *ctx __unused)
-{
-
-	return;
-}
-
-static void
-toedev_syncache_removed(struct toedev *tod __unused, void *ctx __unused)
-{
-
-	return;
-}
-
-static int
-toedev_syncache_respond(struct toedev *tod __unused, void *ctx __unused,
-    struct mbuf *m)
-{
-
-	m_freem(m);
-	return (0);
-}
-
-static void
-toedev_offload_socket(struct toedev *tod __unused, void *ctx __unused,
-    struct socket *so __unused)
-{
-
-	return;
-}
-
-static void
-toedev_ctloutput(struct toedev *tod __unused, struct tcpcb *tp __unused,
-    int sopt_dir __unused, int sopt_name __unused)
-{
-
-	return;
-}
-
-/*
- * Inform one or more TOE devices about a listening socket.
- */
-static void
-toe_listen_start(struct inpcb *inp, void *arg)
-{
-	struct toedev *t, *tod;
-	struct tcpcb *tp;
-
-	INP_WLOCK_ASSERT(inp);
-	KASSERT(inp->inp_pcbinfo == &V_tcbinfo,
-	    ("%s: inp is not a TCP inp", __func__));
-
-	if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))
-		return;
-
-	tp = intotcpcb(inp);
-	if (tp->t_state != TCPS_LISTEN)
-		return;
-
-	t = arg;
-	mtx_lock(&toedev_lock);
-	TAILQ_FOREACH(tod, &toedev_list, link) {
-		if (t == NULL || t == tod)
-			tod->tod_listen_start(tod, tp);
-	}
-	mtx_unlock(&toedev_lock);
-}
-
-static void
-toe_listen_start_event(void *arg __unused, struct tcpcb *tp)
-{
-	struct inpcb *inp = tp->t_inpcb;
-
-	INP_WLOCK_ASSERT(inp);
-	KASSERT(tp->t_state == TCPS_LISTEN,
-	    ("%s: t_state %s", __func__, tcpstates[tp->t_state]));
-
-	toe_listen_start(inp, NULL);
-}
-
-static void
-toe_listen_stop_event(void *arg __unused, struct tcpcb *tp)
-{
-	struct toedev *tod;
-#ifdef INVARIANTS
-	struct inpcb *inp = tp->t_inpcb;
-#endif
-
-	INP_WLOCK_ASSERT(inp);
-	KASSERT(tp->t_state == TCPS_LISTEN,
-	    ("%s: t_state %s", __func__, tcpstates[tp->t_state]));
-
-	mtx_lock(&toedev_lock);
-	TAILQ_FOREACH(tod, &toedev_list, link)
-	    tod->tod_listen_stop(tod, tp);
-	mtx_unlock(&toedev_lock);
-}
-
-/*
- * Fill up a freshly allocated toedev struct with reasonable defaults.
- */
-void
-init_toedev(struct toedev *tod)
-{
-
-	tod->tod_softc = NULL;
-
-	/*
-	 * Provide no-op defaults so that the kernel can call any toedev
-	 * function without having to check whether the TOE driver supplied one
-	 * or not.
-	 */
-	tod->tod_connect = toedev_connect;
-	tod->tod_listen_start = toedev_listen_start;
-	tod->tod_listen_stop = toedev_listen_stop;
-	tod->tod_input = toedev_input;
-	tod->tod_rcvd = toedev_rcvd;
-	tod->tod_output = toedev_output;
-	tod->tod_send_rst = toedev_output;
-	tod->tod_send_fin = toedev_output;
-	tod->tod_pcb_detach = toedev_pcb_detach;
-	tod->tod_l2_update = toedev_l2_update;
-	tod->tod_route_redirect = toedev_route_redirect;
-	tod->tod_syncache_added = toedev_syncache_added;
-	tod->tod_syncache_removed = toedev_syncache_removed;
-	tod->tod_syncache_respond = toedev_syncache_respond;
-	tod->tod_offload_socket = toedev_offload_socket;
-	tod->tod_ctloutput = toedev_ctloutput;
-}
-
-/*
- * Register an active TOE device with the system.  This allows it to receive
- * notifications from the kernel.
- */
-int
-register_toedev(struct toedev *tod)
-{
-	struct toedev *t;
-
-	mtx_lock(&toedev_lock);
-	TAILQ_FOREACH(t, &toedev_list, link) {
-		if (t == tod) {
-			mtx_unlock(&toedev_lock);
-			return (EEXIST);
-		}
-	}
-
-	TAILQ_INSERT_TAIL(&toedev_list, tod, link);
-	registered_toedevs++;
-	mtx_unlock(&toedev_lock);
-
-	inp_apply_all(toe_listen_start, tod);
-
-	return (0);
-}
-
-/*
- * Remove the TOE device from the global list of active TOE devices.  It is the
- * caller's responsibility to ensure that the TOE device is quiesced prior to
- * this call.
- */
-int
-unregister_toedev(struct toedev *tod)
-{
-	struct toedev *t, *t2;
-	int rc = ENODEV;
-
-	mtx_lock(&toedev_lock);
-	TAILQ_FOREACH_SAFE(t, &toedev_list, link, t2) {
-		if (t == tod) {
-			TAILQ_REMOVE(&toedev_list, tod, link);
-			registered_toedevs--;
-			rc = 0;
-			break;
-		}
-	}
-	KASSERT(registered_toedevs >= 0,
-	    ("%s: registered_toedevs (%d) < 0", __func__, registered_toedevs));
-	mtx_unlock(&toedev_lock);
-	return (rc);
-}
-
-void
-toe_syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
-    struct inpcb *inp, void *tod, void *todctx)
-{
-	struct socket *lso = inp->inp_socket;
-
-	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-	INP_WLOCK_ASSERT(inp);
-
-	tcp_offload_syncache_add(inc, to, th, inp, &lso, tod, todctx);
-}
-
-int
-toe_syncache_expand(struct in_conninfo *inc, struct tcpopt *to,
-    struct tcphdr *th, struct socket **lsop)
-{
-
-	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-
-	return (syncache_expand(inc, to, th, lsop, NULL));
-}
-
-/*
- * General purpose check to see if a 4-tuple is in use by the kernel.  If a TCP
- * header (presumably for an incoming SYN) is also provided, an existing 4-tuple
- * in TIME_WAIT may be assassinated freeing it up for re-use.
- *
- * Note that the TCP header must have been run through tcp_fields_to_host() or
- * equivalent.
- */
-int
-toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
-{
-	struct inpcb *inp;
-
-	if (inc->inc_flags & INC_ISIPV6) {
-		inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr,
-		    inc->inc_fport, &inc->inc6_laddr, inc->inc_lport,
-		    INPLOOKUP_WLOCKPCB, ifp);
-	} else {
-		inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport,
-		    inc->inc_laddr, inc->inc_lport, INPLOOKUP_WLOCKPCB, ifp);
-	}
-	if (inp != NULL) {
-		INP_WLOCK_ASSERT(inp);
-
-		if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) {
-
-			INP_INFO_WLOCK_ASSERT(&V_tcbinfo); /* for twcheck */
-			if (!tcp_twcheck(inp, NULL, th, NULL, 0))
-				return (EADDRINUSE);
-		} else {
-			INP_WUNLOCK(inp);
-			return (EADDRINUSE);
-		}
-	}
-
-	return (0);
-}
-
-static void
-toe_lle_event(void *arg __unused, struct llentry *lle, int evt)
-{
-	struct toedev *tod;
-	struct ifnet *ifp;
-	struct sockaddr *sa;
-	uint8_t *lladdr;
-	uint16_t vtag;
-
-	LLE_WLOCK_ASSERT(lle);
-
-	ifp = lle->lle_tbl->llt_ifp;
-	sa = L3_ADDR(lle);
-
-	KASSERT(sa->sa_family == AF_INET || sa->sa_family == AF_INET6,
-	    ("%s: lle_event %d for lle %p but sa %p !INET && !INET6",
-	    __func__, evt, lle, sa));
-
-	/*
-	 * Not interested if the interface's TOE capability is not enabled.
-	 */
-	if ((sa->sa_family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4)) ||
-	    (sa->sa_family == AF_INET6 && !(ifp->if_capenable & IFCAP_TOE6)))
-		return;
-
-	tod = TOEDEV(ifp);
-	if (tod == NULL)
-		return;
-
-	vtag = 0xfff;
-	if (evt != LLENTRY_RESOLVED) {
-
-		/*
-		 * LLENTRY_TIMEDOUT, LLENTRY_DELETED, LLENTRY_EXPIRED all mean
-		 * this entry is going to be deleted.
-		 */
-
-		lladdr = NULL;
-	} else {
-
-		KASSERT(lle->la_flags & LLE_VALID,
-		    ("%s: %p resolved but not valid?", __func__, lle));
-
-		lladdr = (uint8_t *)&lle->ll_addr;
-#ifdef VLAN_TAG
-		VLAN_TAG(ifp, &vtag);
-#endif
-	}
-
-	tod->tod_l2_update(tod, ifp, sa, lladdr, vtag);
-}
-
-/*
- * XXX: implement.
- */
-static void
-toe_route_redirect_event(void *arg __unused, struct rtentry *rt0,
-    struct rtentry *rt1, struct sockaddr *sa)
-{
-
-	return;
-}
-
-#ifdef INET6
-/*
- * XXX: no checks to verify that sa is really a neighbor because we assume it is
- * the result of a route lookup and is on-link on the given ifp.
- */
-static int
-toe_nd6_resolve(struct ifnet *ifp, struct sockaddr *sa, uint8_t *lladdr)
-{
-	struct llentry *lle;
-	struct sockaddr_in6 *sin6 = (void *)sa;
-	int rc, flags = 0;
-
-restart:
-	IF_AFDATA_RLOCK(ifp);
-	lle = lla_lookup(LLTABLE6(ifp), flags, sa);
-	IF_AFDATA_RUNLOCK(ifp);
-	if (lle == NULL) {
-		IF_AFDATA_LOCK(ifp);
-		lle = nd6_lookup(&sin6->sin6_addr, ND6_CREATE | ND6_EXCLUSIVE,
-		    ifp);
-		IF_AFDATA_UNLOCK(ifp);
-		if (lle == NULL)
-			return (ENOMEM); /* Couldn't create entry in cache. */
-		lle->ln_state = ND6_LLINFO_INCOMPLETE;
-		nd6_llinfo_settimer_locked(lle,
-		    (long)ND_IFINFO(ifp)->retrans * hz / 1000);
-		LLE_WUNLOCK(lle);
-
-		nd6_ns_output(ifp, NULL, &sin6->sin6_addr, NULL, 0);
-
-		return (EWOULDBLOCK);
-	}
-
-	if (lle->ln_state == ND6_LLINFO_STALE) {
-		if ((flags & LLE_EXCLUSIVE) == 0) {
-			LLE_RUNLOCK(lle);
-			flags |= LLE_EXCLUSIVE;
-			goto restart;
-		}
-
-		LLE_WLOCK_ASSERT(lle);
-
-		lle->la_asked = 0;
-		lle->ln_state = ND6_LLINFO_DELAY;
-		nd6_llinfo_settimer_locked(lle, (long)V_nd6_delay * hz);
-	}
-
-	if (lle->la_flags & LLE_VALID) {
-		memcpy(lladdr, &lle->ll_addr, ifp->if_addrlen);
-		rc = 0;
-	} else
-		rc = EWOULDBLOCK;
-
-	if (flags & LLE_EXCLUSIVE)
-		LLE_WUNLOCK(lle);
-	else
-		LLE_RUNLOCK(lle);
-
-	return (rc);
-}
-#endif
-
-/*
- * Returns 0 or EWOULDBLOCK on success (any other value is an error).  0 means
- * lladdr and vtag are valid on return, EWOULDBLOCK means the TOE driver's
- * tod_l2_update will be called later, when the entry is resolved or times out.
- */
-int
-toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa,
-    uint8_t *lladdr, uint16_t *vtag)
-{
-#ifdef INET
-	struct llentry *lle;
-#endif
-	int rc;
-
-	switch (sa->sa_family) {
-#ifdef INET
-	case AF_INET:
-		rc = arpresolve(ifp, NULL, NULL, sa, lladdr, &lle);
-		break;
-#endif
-#ifdef INET6
-	case AF_INET6:
-		rc = toe_nd6_resolve(ifp, sa, lladdr);
-		break;
-#endif
-	default:
-		return (EPROTONOSUPPORT);
-	}
-
-	if (rc == 0) {
-#ifdef VLAN_TAG
-		if (VLAN_TAG(ifp, vtag) != 0)
-#endif
-			*vtag = 0xfff;
-	}
-
-	return (rc);
-}
-
-void
-toe_connect_failed(struct toedev *tod, struct inpcb *inp, int err)
-{
-
-	INP_WLOCK_ASSERT(inp);
-
-	if (!(inp->inp_flags & INP_DROPPED)) {
-		struct tcpcb *tp = intotcpcb(inp);
-
-		KASSERT(tp->t_flags & TF_TOE,
-		    ("%s: tp %p not offloaded.", __func__, tp));
-
-		if (err == EAGAIN) {
-
-			/*
-			 * Temporary failure during offload, take this PCB back.
-			 * Detach from the TOE driver and do the rest of what
-			 * TCP's pru_connect would have done if the connection
-			 * wasn't offloaded.
-			 */
-
-			tod->tod_pcb_detach(tod, tp);
-			KASSERT(!(tp->t_flags & TF_TOE),
-			    ("%s: tp %p still offloaded.", __func__, tp));
-			tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp));
-			(void) tcp_output(tp);
-		} else {
-
-			INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-			tp = tcp_drop(tp, err);
-			if (tp == NULL)
-				INP_WLOCK(inp);	/* re-acquire */
-		}
-	}
-	INP_WLOCK_ASSERT(inp);
-}
-
-static int
-toecore_load(void)
-{
-
-	mtx_init(&toedev_lock, "toedev lock", NULL, MTX_DEF);
-	TAILQ_INIT(&toedev_list);
-
-	listen_start_eh = EVENTHANDLER_REGISTER(tcp_offload_listen_start,
-	    toe_listen_start_event, NULL, EVENTHANDLER_PRI_ANY);
-	listen_stop_eh = EVENTHANDLER_REGISTER(tcp_offload_listen_stop,
-	    toe_listen_stop_event, NULL, EVENTHANDLER_PRI_ANY);
-	lle_event_eh = EVENTHANDLER_REGISTER(lle_event, toe_lle_event, NULL,
-	    EVENTHANDLER_PRI_ANY);
-	route_redirect_eh = EVENTHANDLER_REGISTER(route_redirect_event,
-	    toe_route_redirect_event, NULL, EVENTHANDLER_PRI_ANY);
-
-	return (0);
-}
-
-static int
-toecore_unload(void)
-{
-
-	mtx_lock(&toedev_lock);
-	if (!TAILQ_EMPTY(&toedev_list)) {
-		mtx_unlock(&toedev_lock);
-		return (EBUSY);
-	}
-
-	EVENTHANDLER_DEREGISTER(tcp_offload_listen_start, listen_start_eh);
-	EVENTHANDLER_DEREGISTER(tcp_offload_listen_stop, listen_stop_eh);
-	EVENTHANDLER_DEREGISTER(lle_event, lle_event_eh);
-	EVENTHANDLER_DEREGISTER(route_redirect_event, route_redirect_eh);
-
-	mtx_unlock(&toedev_lock);
-	mtx_destroy(&toedev_lock);
-
-	return (0);
-}
-
-static int
-toecore_mod_handler(module_t mod, int cmd, void *arg)
-{
-
-	if (cmd == MOD_LOAD)
-		return (toecore_load());
-
-	if (cmd == MOD_UNLOAD)
-		return (toecore_unload());
-
-	return (EOPNOTSUPP);
-}
-
-static moduledata_t mod_data= {
-	"toecore",
-	toecore_mod_handler,
-	0
-};
-
-MODULE_VERSION(toecore, 1);
-DECLARE_MODULE(toecore, mod_data, SI_SUB_EXEC, SI_ORDER_ANY);

Deleted: trunk/sys/netinet/toecore.h
===================================================================
--- trunk/sys/netinet/toecore.h	2016-10-02 00:05:04 UTC (rev 9113)
+++ trunk/sys/netinet/toecore.h	2016-10-02 00:06:52 UTC (rev 9114)
@@ -1,130 +0,0 @@
-/*-
- * Copyright (c) 2012 Chelsio Communications, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: release/9.2.0/sys/netinet/toecore.h 252555 2013-07-03 09:25:29Z np $
- */
-
-#ifndef _NETINET_TOE_H_
-#define	_NETINET_TOE_H_
-
-#ifndef _KERNEL
-#error "no user-serviceable parts inside"
-#endif
-
-struct tcpopt;
-struct tcphdr;
-struct in_conninfo;
-
-struct toedev {
-	TAILQ_ENTRY(toedev) link;	/* glue for toedev_list */
-	void *tod_softc;		/* TOE driver private data */
-
-	/*
-	 * Active open.  If a failure occurs, it is reported back by the driver
-	 * via toe_connect_failed.
-	 */
-	int (*tod_connect)(struct toedev *, struct socket *, struct rtentry *,
-	    struct sockaddr *);
-
-	/* Passive open. */
-	int (*tod_listen_start)(struct toedev *, struct tcpcb *);
-	int (*tod_listen_stop)(struct toedev *, struct tcpcb *);
-
-	/*
-	 * The kernel uses this routine to pass on any frame it receives for an
-	 * offloaded connection to the TOE driver.  This is an unusual event.
-	 */
-	void (*tod_input)(struct toedev *, struct tcpcb *, struct mbuf *);
-
-	/*
-	 * This is called by the kernel during pru_rcvd for an offloaded TCP
-	 * connection and provides an opportunity for the TOE driver to manage
-	 * its rx window and credits.
-	 */
-	void (*tod_rcvd)(struct toedev *, struct tcpcb *);
-
-	/*
-	 * Transmit routine.  The kernel calls this to have the TOE driver
-	 * evaluate whether there is data to be transmitted, and transmit it.
-	 */
-	int (*tod_output)(struct toedev *, struct tcpcb *);
-
-	/* Immediate teardown: send RST to peer. */
-	int (*tod_send_rst)(struct toedev *, struct tcpcb *);
-
-	/* Initiate orderly disconnect by sending FIN to the peer. */
-	int (*tod_send_fin)(struct toedev *, struct tcpcb *);
-
-	/* Called to indicate that the kernel is done with this TCP PCB. */
-	void (*tod_pcb_detach)(struct toedev *, struct tcpcb *);
-
-	/*
-	 * The kernel calls this once it has information about an L2 entry that
-	 * the TOE driver enquired about previously (via toe_l2_resolve).
-	 */
-	void (*tod_l2_update)(struct toedev *, struct ifnet *,
-	    struct sockaddr *, uint8_t *, uint16_t);
-
-	/* XXX.  Route has been redirected. */
-	void (*tod_route_redirect)(struct toedev *, struct ifnet *,
-	    struct rtentry *, struct rtentry *);
-
-	/* Syncache interaction. */
-	void (*tod_syncache_added)(struct toedev *, void *);
-	void (*tod_syncache_removed)(struct toedev *, void *);
-	int (*tod_syncache_respond)(struct toedev *, void *, struct mbuf *);
-	void (*tod_offload_socket)(struct toedev *, void *, struct socket *);
-
-	/* TCP socket option */
-	void (*tod_ctloutput)(struct toedev *, struct tcpcb *, int, int);
-};
-
-#include <sys/eventhandler.h>
-typedef	void (*tcp_offload_listen_start_fn)(void *, struct tcpcb *);
-typedef	void (*tcp_offload_listen_stop_fn)(void *, struct tcpcb *);
-EVENTHANDLER_DECLARE(tcp_offload_listen_start, tcp_offload_listen_start_fn);
-EVENTHANDLER_DECLARE(tcp_offload_listen_stop, tcp_offload_listen_stop_fn);
-
-void init_toedev(struct toedev *);
-int register_toedev(struct toedev *);
-int unregister_toedev(struct toedev *);
-
-/*
- * General interface for looking up L2 information for an IP address.  If an
- * answer is not available right away then the TOE driver's tod_l2_update will
- * be called later.
- */
-int toe_l2_resolve(struct toedev *, struct ifnet *, struct sockaddr *,
-    uint8_t *, uint16_t *);
-
-void toe_connect_failed(struct toedev *, struct inpcb *, int);
-
-void toe_syncache_add(struct in_conninfo *, struct tcpopt *, struct tcphdr *,
-    struct inpcb *, void *, void *);
-int  toe_syncache_expand(struct in_conninfo *, struct tcpopt *, struct tcphdr *,
-    struct socket **);
-
-int toe_4tuple_check(struct in_conninfo *, struct tcphdr *, struct ifnet *);
-#endif

Added: trunk/sys/netinet/toedev.h
===================================================================
--- trunk/sys/netinet/toedev.h	                        (rev 0)
+++ trunk/sys/netinet/toedev.h	2016-10-02 00:06:52 UTC (rev 9114)
@@ -0,0 +1,162 @@
+/*-
+ * Copyright (c) 2007, Chelsio Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Neither the name of the Chelsio Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $MidnightBSD$
+ */
+
+#ifndef _NETINET_TOEDEV_H_
+#define	_NETINET_TOEDEV_H_
+
+#ifndef _KERNEL
+#error "no user-serviceable parts inside"
+#endif
+
+extern uint32_t toedev_registration_count;
+
+/* Parameter values for offload_get_phys_egress(). */
+enum {
+	TOE_OPEN,
+	TOE_FAILOVER,
+};
+
+/* Parameter values for toe_failover(). */
+enum {
+	TOE_ACTIVE_SLAVE,
+	TOE_LINK_DOWN,
+	TOE_LINK_UP,
+	TOE_RELEASE,
+	TOE_RELEASE_ALL,
+};
+
+#define	TOENAMSIZ	16
+
+/* Get the toedev associated with a ifnet. */
+#define	TOEDEV(ifp)	((ifp)->if_llsoftc)
+
+struct offload_id {
+	unsigned int	id;
+	unsigned long	data;
+};
+
+struct ifnet;
+struct rt_entry;
+struct tom_info;
+struct sysctl_oid;
+struct socket;
+struct mbuf;
+
+struct toedev {
+	TAILQ_ENTRY(toedev) entry;  
+	char 		tod_name[TOENAMSIZ];	/* TOE device name */
+	unsigned int 	tod_ttid;		/* TOE type id */
+	unsigned long 	tod_flags;		/* device flags */
+	unsigned int	tod_mtu;		/* max TX offloaded data */
+	unsigned int	tod_nconn;		/* max # of offloaded
+						 * connections
+						 */
+	struct ifnet 	*tod_lldev;   		/* first interface */
+	const struct tom_info *tod_offload_mod; /* TCP offload module */
+
+	/*
+	 * This TOE device is capable of offloading the connection for socket so
+	 */
+	int	(*tod_can_offload)(struct toedev *dev, struct socket *so);
+
+	/*
+	 * Establish a connection to nam using the TOE device dev
+	 */
+	int	(*tod_connect)(struct toedev *dev, struct socket *so,
+	        struct rtentry *rt, struct sockaddr *nam);
+	/*
+	 * Send an mbuf down to the toe device 
+	 */
+	int	(*tod_send)(struct toedev *dev, struct mbuf *m);
+	/*
+	 * Receive an array of mbufs from the TOE device dev 
+	 */
+	int	(*tod_recv)(struct toedev *dev, struct mbuf **m, int n);
+	/*
+	 * Device specific ioctl interface
+	 */
+	int	(*tod_ctl)(struct toedev *dev, unsigned int req, void *data);
+	/*
+	 * Update L2 entry in toedev 
+	 */
+	void	(*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);
+	/*
+	 * Failover from one toe device to another
+	 */
+	void	(*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,
+			 struct ifnet *ndev, int event);
+	void	*tod_priv;			/* driver private data */
+	void 	*tod_l2opt;			/* optional layer 2 data */
+	void	*tod_l3opt; 			/* optional layer 3 data */
+	void 	*tod_l4opt;			/* optional layer 4 data */
+	void 	*tod_ulp;			/* upper lever protocol */
+};
+
+struct tom_info {
+	TAILQ_ENTRY(tom_info)	entry;
+	int		(*ti_attach)(struct toedev *dev,
+	                             const struct offload_id *entry);
+	int		(*ti_detach)(struct toedev *dev);
+	const char	*ti_name;
+	const struct offload_id	*ti_id_table;
+};
+
+static __inline void
+init_offload_dev(struct toedev *dev)
+{
+}
+
+int	register_tom(struct tom_info *t);
+int	unregister_tom(struct tom_info *t);
+int	register_toedev(struct toedev *dev, const char *name);
+int	unregister_toedev(struct toedev *dev);
+int	activate_offload(struct toedev *dev);
+int	toe_send(struct toedev *dev, struct mbuf *m);
+void	toe_arp_update(struct rtentry *rt);
+struct ifnet	*offload_get_phys_egress(struct ifnet *ifp,
+        struct socket *so, int context);
+int 	toe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);
+
+static __inline void
+toe_neigh_update(struct ifnet *ifp)
+{
+}
+
+static __inline void
+toe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)
+{
+}
+
+static __inline int
+toe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)
+{
+	return (0);
+}
+
+#endif /* _NETINET_TOEDEV_H_ */


Property changes on: trunk/sys/netinet/toedev.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list