svn commit: r237246 - in user/np/toe_iwarp/sys: net netinet
ofed/include/net
Navdeep Parhar
np at FreeBSD.org
Tue Jun 19 00:41:30 UTC 2012
Author: np
Date: Tue Jun 19 00:41:29 2012
New Revision: 237246
URL: http://svn.freebsd.org/changeset/base/237246
Log:
- Retire arp_update_event.
- style(9) fixes.
- More detailed comments in netinet/toecore.h
Modified:
user/np/toe_iwarp/sys/net/if_var.h
user/np/toe_iwarp/sys/net/if_vlan.c
user/np/toe_iwarp/sys/netinet/if_ether.c
user/np/toe_iwarp/sys/netinet/if_ether.h
user/np/toe_iwarp/sys/netinet/in.c
user/np/toe_iwarp/sys/netinet/tcp_offload.c
user/np/toe_iwarp/sys/netinet/tcp_offload.h
user/np/toe_iwarp/sys/netinet/toecore.c
user/np/toe_iwarp/sys/netinet/toecore.h
user/np/toe_iwarp/sys/ofed/include/net/netevent.h
Modified: user/np/toe_iwarp/sys/net/if_var.h
==============================================================================
--- user/np/toe_iwarp/sys/net/if_var.h Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/net/if_var.h Tue Jun 19 00:41:29 2012 (r237246)
@@ -209,8 +209,6 @@ struct ifnet {
void *if_pspare[8]; /* 1 netmap, 7 TDB */
};
-#define TOEDEV(ifp) ((ifp)->if_llsoftc)
-
typedef void if_init_f_t(void *);
/*
@@ -714,6 +712,8 @@ drbr_inuse(struct ifnet *ifp, struct buf
#define IF_MINMTU 72
#define IF_MAXMTU 65535
+#define TOEDEV(ifp) ((ifp)->if_llsoftc)
+
#endif /* _KERNEL */
/*
Modified: user/np/toe_iwarp/sys/net/if_vlan.c
==============================================================================
--- user/np/toe_iwarp/sys/net/if_vlan.c Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/net/if_vlan.c Tue Jun 19 00:41:29 2012 (r237246)
@@ -1512,7 +1512,7 @@ vlan_capabilities(struct ifvlan *ifv)
* changes then IFCAP_VLAN_TOE should be promoted to a full capability
* with its own bit.
*/
-#define IFCAP_VLAN_TOE IFCAP_TOE
+#define IFCAP_VLAN_TOE IFCAP_TOE
if (p->if_capabilities & IFCAP_VLAN_TOE)
ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE;
if (p->if_capenable & IFCAP_VLAN_TOE) {
Modified: user/np/toe_iwarp/sys/netinet/if_ether.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/if_ether.c Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/if_ether.c Tue Jun 19 00:41:29 2012 (r237246)
@@ -323,7 +323,7 @@ arpresolve(struct ifnet *ifp, struct rte
}
retry:
IF_AFDATA_RLOCK(ifp);
- la = *lle = lla_lookup(LLTABLE(ifp), flags, dst);
+ la = lla_lookup(LLTABLE(ifp), flags, dst);
IF_AFDATA_RUNLOCK(ifp);
if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0)
&& ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) {
@@ -355,6 +355,7 @@ retry:
la->la_preempt--;
}
+ *lle = la;
error = 0;
goto done;
}
@@ -736,7 +737,6 @@ match:
(void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen);
la->la_flags |= LLE_VALID;
- EVENTHANDLER_INVOKE(arp_update_event, la);
EVENTHANDLER_INVOKE(lle_event, la, LLENTRY_RESOLVED);
if (!(la->la_flags & LLE_STATIC)) {
Modified: user/np/toe_iwarp/sys/netinet/if_ether.h
==============================================================================
--- user/np/toe_iwarp/sys/netinet/if_ether.h Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/if_ether.h Tue Jun 19 00:41:29 2012 (r237246)
@@ -122,10 +122,6 @@ void arp_ifinit2(struct ifnet *, struct
void arp_ifscrub(struct ifnet *, uint32_t);
#include <sys/eventhandler.h>
-/* XXX: can be retired once OFED code is updated to use lle_event */
-typedef void (*llevent_arp_update_fn)(void *, struct llentry *);
-EVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn);
-
enum {
LLENTRY_RESOLVED,
LLENTRY_TIMEDOUT,
Modified: user/np/toe_iwarp/sys/netinet/in.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/in.c Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/in.c Tue Jun 19 00:41:29 2012 (r237246)
@@ -1469,7 +1469,6 @@ in_lltable_lookup(struct lltable *llt, u
if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) {
LLE_WLOCK(lle);
lle->la_flags = LLE_DELETED;
- EVENTHANDLER_INVOKE(arp_update_event, lle);
EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED);
LLE_WUNLOCK(lle);
#ifdef DIAGNOSTIC
Modified: user/np/toe_iwarp/sys/netinet/tcp_offload.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/tcp_offload.c Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/tcp_offload.c Tue Jun 19 00:41:29 2012 (r237246)
@@ -111,7 +111,7 @@ tcp_offload_input(struct tcpcb *tp, stru
{
struct toedev *tod = tp->tod;
- KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__));
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_input(tod, tp, m);
@@ -123,7 +123,7 @@ tcp_offload_output(struct tcpcb *tp)
struct toedev *tod = tp->tod;
int error, flags;
- KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__));
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
flags = tcp_outflags[tp->t_state];
@@ -147,7 +147,7 @@ tcp_offload_rcvd(struct tcpcb *tp)
{
struct toedev *tod = tp->tod;
- KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__));
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_rcvd(tod, tp);
@@ -158,7 +158,7 @@ tcp_offload_ctloutput(struct tcpcb *tp,
{
struct toedev *tod = tp->tod;
- KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__));
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_ctloutput(tod, tp, sopt_dir, sopt_name);
@@ -169,7 +169,7 @@ tcp_offload_detach(struct tcpcb *tp)
{
struct toedev *tod = tp->tod;
- KASSERT(tod != NULL, ("%s: tp->tod is NULL", __func__));
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
INP_WLOCK_ASSERT(tp->t_inpcb);
tod->tod_pcb_detach(tod, tp);
Modified: user/np/toe_iwarp/sys/netinet/tcp_offload.h
==============================================================================
--- user/np/toe_iwarp/sys/netinet/tcp_offload.h Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/tcp_offload.h Tue Jun 19 00:41:29 2012 (r237246)
@@ -28,7 +28,7 @@
*/
#ifndef _NETINET_TCP_OFFLOAD_H_
-#define _NETINET_TCP_OFFLOAD_H_
+#define _NETINET_TCP_OFFLOAD_H_
#ifndef _KERNEL
#error "no user-serviceable parts inside"
Modified: user/np/toe_iwarp/sys/netinet/toecore.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/toecore.c Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/toecore.c Tue Jun 19 00:41:29 2012 (r237246)
@@ -28,6 +28,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
@@ -37,17 +40,19 @@ __FBSDID("$FreeBSD$");
#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/nd6.h>
-#include <netinet/in_pcb.h>
#define TCPSTATES
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
@@ -59,8 +64,10 @@ __FBSDID("$FreeBSD$");
static struct mtx toedev_lock;
static TAILQ_HEAD(, toedev) toedev_list;
-static eventhandler_tag listen_start_eh, listen_stop_eh;
-static eventhandler_tag lle_event_eh, route_redirect_eh;
+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,
@@ -176,7 +183,7 @@ toedev_ctloutput(struct toedev *tod __un
static void
toe_listen_start(struct inpcb *inp, void *arg)
{
- struct toedev *t = arg, *tod;
+ struct toedev *t, *tod;
struct tcpcb *tp;
INP_WLOCK_ASSERT(inp);
@@ -190,6 +197,7 @@ toe_listen_start(struct inpcb *inp, void
if (tp->t_state != TCPS_LISTEN)
return;
+ t = arg;
mtx_lock(&toedev_lock);
TAILQ_FOREACH(tod, &toedev_list, link) {
if (t == NULL || t == tod)
@@ -307,7 +315,7 @@ unregister_toedev(struct toedev *tod)
}
}
KASSERT(registered_toedevs >= 0,
- ("%s: registered_toedevs < 0", __func__));
+ ("%s: registered_toedevs (%d) < 0", __func__, registered_toedevs));
mtx_unlock(&toedev_lock);
return (rc);
}
@@ -374,9 +382,9 @@ toe_lle_event(void *arg __unused, struct
{
struct toedev *tod;
struct ifnet *ifp;
- uint8_t *lladdr;
- uint16_t vtag = 0xfff;
struct sockaddr *sa;
+ uint8_t *lladdr;
+ uint16_t vtag;
LLE_WLOCK_ASSERT(lle);
@@ -384,7 +392,8 @@ toe_lle_event(void *arg __unused, struct
sa = L3_ADDR(lle);
KASSERT(sa->sa_family == AF_INET || sa->sa_family == AF_INET6,
- ("%s: lle_event but sa !INET && !INET6", __func__));
+ ("%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.
@@ -397,6 +406,7 @@ toe_lle_event(void *arg __unused, struct
if (tod == NULL)
return;
+ vtag = 0xfff;
if (evt != LLENTRY_RESOLVED) {
/*
@@ -426,6 +436,7 @@ static void
toe_route_redirect_event(void *arg __unused, struct rtentry *rt0,
struct rtentry *rt1, struct sockaddr *sa)
{
+
return;
}
@@ -442,12 +453,16 @@ toe_l2_resolve(struct toedev *tod, struc
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 = nd6_storelladdr(ifp, NULL, sa, lladdr, &lle);
break;
+#endif
default:
return (EPROTONOSUPPORT);
}
@@ -547,7 +562,7 @@ toecore_mod_handler(module_t mod, int cm
if (cmd == MOD_UNLOAD)
return (toecore_unload());
- return (0);
+ return (EOPNOTSUPP);
}
static moduledata_t mod_data= {
Modified: user/np/toe_iwarp/sys/netinet/toecore.h
==============================================================================
--- user/np/toe_iwarp/sys/netinet/toecore.h Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/netinet/toecore.h Tue Jun 19 00:41:29 2012 (r237246)
@@ -24,11 +24,10 @@
* SUCH DAMAGE.
*
* $FreeBSD$
- *
*/
#ifndef _NETINET_TOE_H_
-#define _NETINET_TOE_H_
+#define _NETINET_TOE_H_
#ifndef _KERNEL
#error "no user-serviceable parts inside"
@@ -42,7 +41,10 @@ struct toedev {
TAILQ_ENTRY(toedev) link; /* glue for toedev_list */
void *tod_softc; /* TOE driver private data */
- /* Active open. */
+ /*
+ * 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 *);
@@ -50,25 +52,38 @@ struct toedev {
int (*tod_listen_start)(struct toedev *, struct tcpcb *);
int (*tod_listen_stop)(struct toedev *, struct tcpcb *);
- /* Frame received by kernel for an offloaded connection */
+ /*
+ * 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 *);
- /* Some data read */
+ /*
+ * 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 *);
- /* Output data, if any is waiting to be sent out. */
+ /*
+ * 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 */
+ /* Immediate teardown: send RST to peer. */
int (*tod_send_rst)(struct toedev *, struct tcpcb *);
- /* Orderly disconnect, send FIN to the peer */
+ /* Initiate orderly disconnect by sending FIN to the peer. */
int (*tod_send_fin)(struct toedev *, struct tcpcb *);
- /* Kernel is done with the TCP PCB */
+ /* Called to indicate that the kernel is done with this TCP PCB. */
void (*tod_pcb_detach)(struct toedev *, struct tcpcb *);
- /* Information about an L2 entry is now available. */
+ /*
+ * 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);
@@ -93,13 +108,13 @@ EVENTHANDLER_DECLARE(tcp_offload_listen_
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 *);
+int register_toedev(struct toedev *);
+int unregister_toedev(struct toedev *);
/*
- * General interface for looking up L2 information for an IP or IPv6 address.
- * If an answer is not available right away then the TOE driver's tod_l2_update
- * will be called later.
+ * 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 *);
Modified: user/np/toe_iwarp/sys/ofed/include/net/netevent.h
==============================================================================
--- user/np/toe_iwarp/sys/ofed/include/net/netevent.h Mon Jun 18 23:18:49 2012 (r237245)
+++ user/np/toe_iwarp/sys/ofed/include/net/netevent.h Tue Jun 19 00:41:29 2012 (r237246)
@@ -42,7 +42,7 @@ enum netevent_notif_type {
struct llentry;
static inline void
-_handle_arp_update_event(void *arg, struct llentry *lle)
+_handle_arp_update_event(void *arg, struct llentry *lle, int evt __unused)
{
struct notifier_block *nb;
@@ -54,7 +54,7 @@ static inline int
register_netevent_notifier(struct notifier_block *nb)
{
nb->tags[NETEVENT_NEIGH_UPDATE] = EVENTHANDLER_REGISTER(
- arp_update_event, _handle_arp_update_event, nb, 0);
+ lle_event, _handle_arp_update_event, nb, 0);
return (0);
}
@@ -62,8 +62,7 @@ static inline int
unregister_netevent_notifier(struct notifier_block *nb)
{
- EVENTHANDLER_DEREGISTER(arp_update_event,
- nb->tags[NETEVENT_NEIGH_UPDATE]);
+ EVENTHANDLER_DEREGISTER(lle_event, nb->tags[NETEVENT_NEIGH_UPDATE]);
return (0);
}
More information about the svn-src-user
mailing list