From owner-freebsd-net@FreeBSD.ORG Tue May 1 17:10:12 2012 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F3B91065672 for ; Tue, 1 May 2012 17:10:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 417758FC0C for ; Tue, 1 May 2012 17:10:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q41HACjA077076 for ; Tue, 1 May 2012 17:10:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q41HACc2077075; Tue, 1 May 2012 17:10:12 GMT (envelope-from gnats) Date: Tue, 1 May 2012 17:10:12 GMT Message-Id: <201205011710.q41HACc2077075@freefall.freebsd.org> To: freebsd-net@FreeBSD.org From: Ed Maste Cc: Subject: kern/138620 [patch] Sysctl for direct BPF writes to lagg child ports X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ed Maste List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2012 17:10:12 -0000 The following reply was made to PR kern/138620; it has been noted by GNATS. From: Ed Maste To: , Cc: Subject: kern/138620 [patch] Sysctl for direct BPF writes to lagg child ports Date: Tue, 1 May 2012 13:08:01 -0400 --jRHKVT23PllUwdXP Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline The attached patch adds a sysctl to enable or disable the behaviour you're looking for (direct BPF writes to the underlying lagg child ports). I intend to commit it shortly after review / test. --jRHKVT23PllUwdXP Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="if_lagg.c.diff" Index: if_lagg.c =================================================================== --- if_lagg.c (revision 234896) +++ if_lagg.c (working copy) @@ -177,6 +177,10 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, default_use_flowid, CTLFLAG_RW, &def_use_flowid, 0, "Default setting for using flow id for load sharing"); +static int lagg_tx_child = 0; /* Direct tx to child interface */ +SYSCTL_INT(_net_link_lagg, OID_AUTO, lagg_tx_child, CTLFLAG_RW, + &lagg_tx_child, 0, + "Allow direct writes to child ports (e.g. via BPF)"); static int lagg_modevent(module_t mod, int type, void *data) @@ -764,6 +768,9 @@ return (EINVAL); } +/* + * For direct output to child ports. + */ static int lagg_port_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct route *ro) @@ -775,6 +782,8 @@ switch (dst->sa_family) { case pseudo_AF_HDRCMPLT: case AF_UNSPEC: + if (lagg_tx_child) + goto sendit; eh = (struct ether_header *)dst->sa_data; type = eh->ether_type; break; @@ -786,12 +795,15 @@ */ switch (ntohs(type)) { case ETHERTYPE_PAE: /* EAPOL PAE/802.1x */ - return ((*lp->lp_output)(ifp, m, dst, ro)); + goto sendit; } /* drop any other frames */ m_freem(m); return (EBUSY); + +sendit: + return ((*lp->lp_output)(ifp, m, dst, ro)); } static void --jRHKVT23PllUwdXP--