PERFORCE change 119434 for review
Paolo Pisati
piso at FreeBSD.org
Mon May 7 18:01:07 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119434
Change 119434 by piso at piso_newluxor on 2007/05/07 18:00:42
IFC at 119432
Affected files ...
.. //depot/projects/soc2006/intr_filter/dev/nve/if_nve.c#4 integrate
.. //depot/projects/soc2006/intr_filter/dev/sound/pcm/buffer.h#7 integrate
.. //depot/projects/soc2006/intr_filter/dev/usb/if_rum.c#2 integrate
.. //depot/projects/soc2006/intr_filter/i386/conf/PAE#3 integrate
.. //depot/projects/soc2006/intr_filter/modules/em/Makefile#3 integrate
.. //depot/projects/soc2006/intr_filter/net/ieee8023ad_lacp.c#3 integrate
.. //depot/projects/soc2006/intr_filter/net/ieee8023ad_lacp.h#2 integrate
.. //depot/projects/soc2006/intr_filter/net/if_lagg.c#3 integrate
.. //depot/projects/soc2006/intr_filter/net/if_lagg.h#3 integrate
.. //depot/projects/soc2006/intr_filter/netinet/tcp_debug.c#3 integrate
.. //depot/projects/soc2006/intr_filter/netinet/tcp_subr.c#12 integrate
.. //depot/projects/soc2006/intr_filter/netinet/udp_usrreq.c#10 integrate
Differences ...
==== //depot/projects/soc2006/intr_filter/dev/nve/if_nve.c#4 (text+ko) ====
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/nve/if_nve.c,v 1.25 2007/02/23 12:18:48 piso Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/nve/if_nve.c,v 1.26 2007/05/07 09:45:31 yar Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -530,6 +530,7 @@
ifp->if_snd.ifq_drv_maxlen = TX_RING_SIZE - 1;
IFQ_SET_READY(&ifp->if_snd);
ifp->if_capabilities |= IFCAP_VLAN_MTU;
+ ifp->if_capenable |= IFCAP_VLAN_MTU;
/* Attach to OS's managers. */
ether_ifattach(ifp, eaddr);
==== //depot/projects/soc2006/intr_filter/dev/sound/pcm/buffer.h#7 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/sound/pcm/buffer.h,v 1.15 2007/04/18 18:26:40 ariff Exp $
+ * $FreeBSD: src/sys/dev/sound/pcm/buffer.h,v 1.16 2007/05/07 02:46:48 ariff Exp $
*/
#define SND_DMA(b) (sndbuf_getflags((b)) & SNDBUF_F_DMA)
@@ -54,8 +54,8 @@
u_int32_t flags;
bus_dmamap_t dmamap;
bus_dma_tag_t dmatag;
+ bus_addr_t buf_addr;
int dmaflags;
- u_int32_t buf_addr;
struct selinfo sel;
struct pcm_channel *channel;
char name[SNDBUF_NAMELEN];
==== //depot/projects/soc2006/intr_filter/dev/usb/if_rum.c#2 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/if_rum.c,v 1.2 2007/05/06 14:25:52 des Exp $ */
+/* $FreeBSD: src/sys/dev/usb/if_rum.c,v 1.3 2007/05/06 21:06:08 des Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini at free.fr>
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/if_rum.c,v 1.2 2007/05/06 14:25:52 des Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/if_rum.c,v 1.3 2007/05/06 21:06:08 des Exp $");
/*-
* Ralink Technology RT2501USB/RT2601USB chipset driver
@@ -1192,7 +1192,7 @@
xferlen += 4;
DPRINTFN(10, ("sending mgt frame len=%d rate=%d xfer len=%d\n",
- m0->m_pkthdr.len + RT2573_TX_DESC_SIZE, rate, xferlen));
+ m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, rate, xferlen));
usbd_setup_xfer(data->xfer, sc->sc_tx_pipeh, data, data->buf, xferlen,
USBD_FORCE_SHORT_XFER | USBD_NO_COPY, RUM_TX_TIMEOUT, rum_txeof);
@@ -1354,7 +1354,7 @@
xferlen += 4;
DPRINTFN(10, ("sending frame len=%d rate=%d xfer len=%d\n",
- m0->m_pkthdr.len + RT2573_TX_DESC_SIZE, rate, xferlen));
+ m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, rate, xferlen));
usbd_setup_xfer(data->xfer, sc->sc_tx_pipeh, data, data->buf, xferlen,
USBD_FORCE_SHORT_XFER | USBD_NO_COPY, RUM_TX_TIMEOUT, rum_txeof);
==== //depot/projects/soc2006/intr_filter/i386/conf/PAE#3 (text+ko) ====
@@ -1,7 +1,7 @@
#
# PAE -- Generic kernel configuration file for FreeBSD/i386 PAE
#
-# $FreeBSD: src/sys/i386/conf/PAE,v 1.23 2006/07/09 16:38:58 mjacob Exp $
+# $FreeBSD: src/sys/i386/conf/PAE,v 1.24 2007/05/07 02:06:03 kevlo Exp $
include GENERIC
@@ -79,6 +79,7 @@
nodevice wlan_wep # 802.11 WEP support
nodevice wlan_ccmp # 802.11 CCMP support
nodevice wlan_tkip # 802.11 TKIP support
+nodevice wlan_amrr # AMRR transmit rate control algorithm
nodevice an
nodevice ath # Atheros pci/cardbus NIC's
nodevice ath_hal # Atheros HAL (Hardware Access Layer)
@@ -99,6 +100,7 @@
nodevice ums
nodevice ural
nodevice urio
+nodevice rum
nodevice uscanner
nodevice aue
nodevice axe
==== //depot/projects/soc2006/intr_filter/modules/em/Makefile#3 (text+ko) ====
@@ -1,11 +1,11 @@
-# $FreeBSD: src/sys/modules/em/Makefile,v 1.8 2007/05/04 13:34:33 rwatson Exp $
+# $FreeBSD: src/sys/modules/em/Makefile,v 1.9 2007/05/07 09:55:25 le Exp $
.PATH: ${.CURDIR}/../../dev/em
KMOD = if_em
SRCS = device_if.h bus_if.h pci_if.h opt_bdg.h
SRCS += if_em.c $(SHARED_SRCS)
SHARED_SRCS = e1000_api.c e1000_phy.c e1000_nvm.c e1000_mac.c e1000_manage.c
SHARED_SRCS += e1000_80003es2lan.c e1000_82542.c e1000_82541.c e1000_82543.c
-SHARED_SRCS += e1000_82540.c e1000_ich8lan.c e1000_82571.c
+SHARED_SRCS += e1000_82540.c e1000_ich8lan.c e1000_82571.c e1000_82575.c
CFLAGS+= -I${.CURDIR}/../../dev/em
==== //depot/projects/soc2006/intr_filter/net/ieee8023ad_lacp.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/ieee8023ad_lacp.c,v 1.4 2007/05/03 08:56:20 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/net/ieee8023ad_lacp.c,v 1.6 2007/05/07 00:28:55 thompsa Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -453,6 +453,7 @@
lp->lp_ifp = ifp;
lp->lp_lagg = lgp;
lp->lp_lsc = lsc;
+ lp->lp_ifma = rifma;
LIST_INSERT_HEAD(&lsc->lsc_ports, lp, lp_next);
@@ -471,9 +472,7 @@
lacp_port_destroy(struct lagg_port *lgp)
{
struct lacp_port *lp = LACP_PORT(lgp);
- struct ifnet *ifp = lgp->lp_ifp;
- struct sockaddr_dl sdl;
- int i, error;
+ int i;
LAGG_LOCK_ASSERT(lgp->lp_lagg);
@@ -486,18 +485,9 @@
lacp_unselect(lp);
lgp->lp_flags &= ~LAGG_PORT_DISABLED;
- bzero((char *)&sdl, sizeof(sdl));
- sdl.sdl_len = sizeof(sdl);
- sdl.sdl_family = AF_LINK;
- sdl.sdl_index = ifp->if_index;
- sdl.sdl_type = IFT_ETHER;
- sdl.sdl_alen = ETHER_ADDR_LEN;
-
- bcopy(ðermulticastaddr_slowprotocols,
- LLADDR(&sdl), ETHER_ADDR_LEN);
- error = if_delmulti(ifp, (struct sockaddr *)&sdl);
- if (error)
- printf("%s: DELMULTI failed on %s\n", __func__, lgp->lp_ifname);
+ /* The address may have already been removed by if_purgemaddrs() */
+ if (!lgp->lp_detaching)
+ if_delmulti_ifma(lp->lp_ifma);
LIST_REMOVE(lp, lp_next);
free(lp, M_DEVBUF);
==== //depot/projects/soc2006/intr_filter/net/ieee8023ad_lacp.h#2 (text+ko) ====
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.2 2007/04/17 00:35:11 thompsa Exp $
+ * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.3 2007/05/07 00:18:56 thompsa Exp $
*/
/*
@@ -190,6 +190,7 @@
int lp_flags;
u_int lp_media; /* XXX redundant */
int lp_timer[LACP_NTIMER];
+ struct ifmultiaddr *lp_ifma;
struct lacp_aggregator *lp_aggregator;
};
==== //depot/projects/soc2006/intr_filter/net/if_lagg.c#3 (text+ko) ====
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/if_lagg.c,v 1.3 2007/05/03 08:56:20 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/net/if_lagg.c,v 1.8 2007/05/07 09:53:02 thompsa Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -35,6 +35,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/hash.h>
+#include <sys/taskqueue.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -81,6 +82,7 @@
static void lagg_lladdr(struct lagg_softc *, uint8_t *);
static int lagg_capabilities(struct lagg_softc *);
static void lagg_port_lladdr(struct lagg_port *, uint8_t *);
+static void lagg_port_setlladdr(void *, int);
static int lagg_port_create(struct lagg_softc *, struct ifnet *);
static int lagg_port_destroy(struct lagg_port *, int);
static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
@@ -96,7 +98,6 @@
static int lagg_ioctl(struct ifnet *, u_long, caddr_t);
static int lagg_ether_setmulti(struct lagg_softc *);
static int lagg_ether_cmdmulti(struct lagg_port *, int);
-static void lagg_ether_purgemulti(struct lagg_softc *);
static int lagg_setflag(struct lagg_port *, int, int,
int (*func)(struct ifnet *, int));
static int lagg_setflags(struct lagg_port *, int status);
@@ -221,6 +222,7 @@
}
LAGG_LOCK_INIT(sc);
SLIST_INIT(&sc->sc_ports);
+ TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc);
/* Initialise pseudo media types */
ifmedia_init(&sc->sc_media, 0, lagg_media_change,
@@ -272,9 +274,6 @@
if (sc->sc_detach != NULL)
(*sc->sc_detach)(sc);
- /* Remove any multicast groups that we may have joined. */
- lagg_ether_purgemulti(sc);
-
LAGG_UNLOCK(sc);
ifmedia_removeall(&sc->sc_media);
@@ -285,6 +284,7 @@
SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries);
mtx_unlock(&lagg_list_mtx);
+ taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task);
LAGG_LOCK_DESTROY(sc);
free(sc, M_DEVBUF);
}
@@ -329,17 +329,74 @@
static void
lagg_port_lladdr(struct lagg_port *lp, uint8_t *lladdr)
{
+ struct lagg_softc *sc = lp->lp_lagg;
struct ifnet *ifp = lp->lp_ifp;
+ struct lagg_llq *llq;
+ int pending = 0;
+
+ LAGG_LOCK_ASSERT(sc);
+
+ if (lp->lp_detaching ||
+ memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0)
+ return;
+
+ /* Check to make sure its not already queued to be changed */
+ SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) {
+ if (llq->llq_ifp == ifp) {
+ pending = 1;
+ break;
+ }
+ }
+
+ if (!pending) {
+ llq = malloc(sizeof(struct lagg_llq), M_DEVBUF, M_NOWAIT);
+ if (llq == NULL) /* XXX what to do */
+ return;
+ }
+
+ /* Update the lladdr even if pending, it may have changed */
+ llq->llq_ifp = ifp;
+ bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN);
+
+ if (!pending)
+ SLIST_INSERT_HEAD(&sc->sc_llq_head, llq, llq_entries);
+
+ taskqueue_enqueue(taskqueue_swi, &sc->sc_lladdr_task);
+}
+
+/*
+ * Set the interface MAC address from a taskqueue to avoid a LOR.
+ */
+static void
+lagg_port_setlladdr(void *arg, int pending)
+{
+ struct lagg_softc *sc = (struct lagg_softc *)arg;
+ struct lagg_llq *llq, *head;
+ struct ifnet *ifp;
int error;
- if (memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0)
- return;
+ /* Grab a local reference of the queue and remove it from the softc */
+ LAGG_LOCK(sc);
+ head = SLIST_FIRST(&sc->sc_llq_head);
+ SLIST_FIRST(&sc->sc_llq_head) = NULL;
+ LAGG_UNLOCK(sc);
+
+ /*
+ * Traverse the queue and set the lladdr on each ifp. It is safe to do
+ * unlocked as we have the only reference to it.
+ */
+ for (llq = head; llq != NULL; llq = head) {
+ ifp = llq->llq_ifp;
- /* Set the link layer address */
- error = if_setlladdr(ifp, lladdr, ETHER_ADDR_LEN);
- if (error)
- printf("%s: setlladdr failed on %s\n", __func__, lp->lp_ifname);
+ /* Set the link layer address */
+ error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN);
+ if (error)
+ printf("%s: setlladdr failed on %s\n", __func__,
+ ifp->if_xname);
+ head = SLIST_NEXT(llq, llq_entries);
+ free(llq, M_DEVBUF);
+ }
}
static int
@@ -460,6 +517,7 @@
{
struct lagg_softc *sc = lp->lp_lagg;
struct lagg_port *lp_ptr;
+ struct lagg_llq *llq;
struct ifnet *ifp = lp->lp_ifp;
LAGG_LOCK_ASSERT(sc);
@@ -467,9 +525,15 @@
if (runpd && sc->sc_port_destroy != NULL)
(*sc->sc_port_destroy)(lp);
- /* Remove multicast addresses and interface flags from this port */
- lagg_ether_cmdmulti(lp, 0);
- lagg_setflags(lp, 0);
+ /*
+ * Remove multicast addresses and interface flags from this port and
+ * reset the MAC address, skip if the interface is being detached.
+ */
+ if (!lp->lp_detaching) {
+ lagg_ether_cmdmulti(lp, 0);
+ lagg_setflags(lp, 0);
+ lagg_port_lladdr(lp, lp->lp_lladdr);
+ }
/* Restore interface */
ifp->if_type = lp->lp_iftype;
@@ -499,8 +563,17 @@
lagg_port_lladdr(lp_ptr, lladdr);
}
- /* Reset the port lladdr */
- lagg_port_lladdr(lp, lp->lp_lladdr);
+ /* Remove any pending lladdr changes from the queue */
+ if (lp->lp_detaching) {
+ SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) {
+ if (llq->llq_ifp == ifp) {
+ SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq,
+ llq_entries);
+ free(llq, M_DEVBUF);
+ break; /* Only appears once */
+ }
+ }
+ }
if (lp->lp_ifflags)
if_printf(ifp, "%s: lp_ifflags unclean\n", __func__);
@@ -550,7 +623,7 @@
return (error);
fallback:
- if (lp != NULL)
+ if (lp->lp_ioctl != NULL)
return ((*lp->lp_ioctl)(ifp, cmd, data));
return (EINVAL);
@@ -598,6 +671,7 @@
sc = lp->lp_lagg;
LAGG_LOCK(sc);
+ lp->lp_detaching = 1;
lagg_port_destroy(lp, 1);
LAGG_UNLOCK(sc);
}
@@ -838,48 +912,16 @@
static int
lagg_ether_setmulti(struct lagg_softc *sc)
{
- struct ifnet *trifp = sc->sc_ifp;
- struct ifnet *ifp;
- struct ifmultiaddr *ifma, *rifma = NULL;
- struct lagg_port *lp;
- struct lagg_mc *mc;
- struct sockaddr_dl sdl;
- int error;
+ struct lagg_port *lp;
LAGG_LOCK_ASSERT(sc);
- bzero((char *)&sdl, sizeof(sdl));
- sdl.sdl_len = sizeof(sdl);
- sdl.sdl_family = AF_LINK;
- sdl.sdl_type = IFT_ETHER;
- sdl.sdl_alen = ETHER_ADDR_LEN;
-
- /* First, remove any existing filter entries. */
- lagg_ether_purgemulti(sc);
-
- /* Now program new ones. */
- TAILQ_FOREACH(ifma, &trifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT);
- if (mc == NULL)
- return (ENOMEM);
- bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- (char *)&mc->mc_addr, ETHER_ADDR_LEN);
- SLIST_INSERT_HEAD(&sc->sc_mc_head, mc, mc_entries);
- bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- LLADDR(&sdl), ETHER_ADDR_LEN);
-
- /* do all the ports */
- SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
- ifp = lp->lp_ifp;
- sdl.sdl_index = ifp->if_index;
- error = if_addmulti(ifp, (struct sockaddr *)&sdl, &rifma);
- if (error)
- return (error);
- }
+ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
+ /* First, remove any existing filter entries. */
+ lagg_ether_cmdmulti(lp, 0);
+ /* copy all addresses from the lagg interface to the port */
+ lagg_ether_cmdmulti(lp, 1);
}
-
return (0);
}
@@ -887,11 +929,12 @@
lagg_ether_cmdmulti(struct lagg_port *lp, int set)
{
struct lagg_softc *sc = lp->lp_lagg;
- struct ifnet *ifp = lp->lp_ifp;;
- struct lagg_mc *mc;
- struct ifmultiaddr *rifma = NULL;
- struct sockaddr_dl sdl;
- int error;
+ struct ifnet *ifp = lp->lp_ifp;
+ struct ifnet *trifp = sc->sc_ifp;
+ struct lagg_mc *mc;
+ struct ifmultiaddr *ifma, *rifma = NULL;
+ struct sockaddr_dl sdl;
+ int error;
LAGG_LOCK_ASSERT(sc);
@@ -902,41 +945,32 @@
sdl.sdl_alen = ETHER_ADDR_LEN;
sdl.sdl_index = ifp->if_index;
- SLIST_FOREACH(mc, &sc->sc_mc_head, mc_entries) {
- bcopy((char *)&mc->mc_addr, LLADDR(&sdl), ETHER_ADDR_LEN);
+ if (set) {
+ TAILQ_FOREACH(ifma, &trifp->if_multiaddrs, ifma_link) {
+ if (ifma->ifma_addr->sa_family != AF_LINK)
+ continue;
+ bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
+ LLADDR(&sdl), ETHER_ADDR_LEN);
- if (set)
error = if_addmulti(ifp, (struct sockaddr *)&sdl, &rifma);
- else
- error = if_delmulti(ifp, (struct sockaddr *)&sdl);
-
- if (error) {
- printf("cmdmulti error on %s, set = %d\n",
- ifp->if_xname, set);
- return (error);
+ if (error)
+ return (error);
+ mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT);
+ if (mc == NULL)
+ return (ENOMEM);
+ mc->mc_ifma = rifma;
+ SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries);
+ }
+ } else {
+ while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) {
+ SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries);
+ if_delmulti_ifma(mc->mc_ifma);
+ free(mc, M_DEVBUF);
}
}
return (0);
}
-static void
-lagg_ether_purgemulti(struct lagg_softc *sc)
-{
- struct lagg_port *lp;
- struct lagg_mc *mc;
-
- LAGG_LOCK_ASSERT(sc);
-
- /* remove from ports */
- SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
- lagg_ether_cmdmulti(lp, 0);
-
- while ((mc = SLIST_FIRST(&sc->sc_mc_head)) != NULL) {
- SLIST_REMOVE(&sc->sc_mc_head, mc, lagg_mc, mc_entries);
- free(mc, M_DEVBUF);
- }
-}
-
/* Handle a ref counted flag that should be set on the lagg port as well */
static int
lagg_setflag(struct lagg_port *lp, int flag, int status,
@@ -1072,9 +1106,10 @@
imr->ifm_active = IFM_ETHER | IFM_AUTO;
LAGG_LOCK(sc);
- lp = sc->sc_primary;
- if (lp != NULL && lp->lp_ifp->if_flags & IFF_UP)
- imr->ifm_status |= IFM_ACTIVE;
+ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) {
+ if (LAGG_PORTACTIVE(lp))
+ imr->ifm_status |= IFM_ACTIVE;
+ }
LAGG_UNLOCK(sc);
}
==== //depot/projects/soc2006/intr_filter/net/if_lagg.h#3 (text+ko) ====
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $FreeBSD: src/sys/net/if_lagg.h,v 1.3 2007/05/03 09:07:36 thompsa Exp $
+ * $FreeBSD: src/sys/net/if_lagg.h,v 1.6 2007/05/07 00:35:15 thompsa Exp $
*/
#ifndef _NET_LAGG_H
@@ -136,12 +136,15 @@
};
struct lagg_mc {
- union {
- struct ether_multi *mcu_enm;
- } mc_u;
- struct sockaddr_storage mc_addr;
+ struct ifmultiaddr *mc_ifma;
+ SLIST_ENTRY(lagg_mc) mc_entries;
+};
- SLIST_ENTRY(lagg_mc) mc_entries;
+/* List of interfaces to have the MAC address modified */
+struct lagg_llq {
+ struct ifnet *llq_ifp;
+ uint8_t llq_lladdr[ETHER_ADDR_LEN];
+ SLIST_ENTRY(lagg_llq) llq_entries;
};
struct lagg_softc {
@@ -156,7 +159,9 @@
SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */
SLIST_ENTRY(lagg_softc) sc_entries;
- SLIST_HEAD(__mclhd, lagg_mc) sc_mc_head; /* multicast addresses */
+ struct task sc_lladdr_task;
+ SLIST_HEAD(__llqhd, lagg_llq) sc_llq_head; /* interfaces to program
+ the lladdr on */
/* lagg protocol callbacks */
int (*sc_detach)(struct lagg_softc *);
@@ -182,6 +187,9 @@
int lp_ifflags; /* saved ifp flags */
void *lh_cookie; /* if state hook */
caddr_t lp_psc; /* protocol data */
+ int lp_detaching; /* ifnet is detaching */
+
+ SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */
/* Redirected callbacks */
int (*lp_ioctl)(struct ifnet *, u_long, caddr_t);
==== //depot/projects/soc2006/intr_filter/netinet/tcp_debug.c#3 (text+ko) ====
@@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_debug.c 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/tcp_debug.c,v 1.27 2007/05/04 23:43:18 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/tcp_debug.c,v 1.28 2007/05/07 14:05:23 rwatson Exp $
*/
#include "opt_inet.h"
@@ -108,85 +108,58 @@
mtx_lock(&tcp_debug_mtx);
td = &tcp_debug[tcp_debx++];
-
+ if (tcp_debx == TCP_NDEBUG)
+ tcp_debx = 0;
+ bzero(td, sizeof(*td));
#ifdef INET6
isipv6 = (ipgen != NULL && ((struct ip *)ipgen)->ip_v == 6) ? 1 : 0;
#endif /* INET6 */
td->td_family =
#ifdef INET6
- (isipv6 != 0) ? AF_INET6 :
+ (isipv6 != 0) ? AF_INET6 :
#endif
- AF_INET;
- if (tcp_debx == TCP_NDEBUG)
- tcp_debx = 0;
+ AF_INET;
td->td_time = iptime();
td->td_act = act;
td->td_ostate = ostate;
td->td_tcb = (caddr_t)tp;
- if (tp)
+ if (tp != NULL)
td->td_cb = *tp;
- else
- bzero((caddr_t)&td->td_cb, sizeof (*tp));
- if (ipgen) {
+ if (ipgen != NULL) {
switch (td->td_family) {
case AF_INET:
- bcopy((caddr_t)ipgen, (caddr_t)&td->td_ti.ti_i,
- sizeof(td->td_ti.ti_i));
- bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf));
+ bcopy(ipgen, &td->td_ti.ti_i, sizeof(td->td_ti.ti_i));
break;
#ifdef INET6
case AF_INET6:
- bcopy((caddr_t)ipgen, (caddr_t)td->td_ip6buf,
- sizeof(td->td_ip6buf));
- bzero((caddr_t)&td->td_ti.ti_i,
- sizeof(td->td_ti.ti_i));
+ bcopy(ipgen, td->td_ip6buf, sizeof(td->td_ip6buf));
break;
#endif
- default:
- bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf));
- bzero((caddr_t)&td->td_ti.ti_i,
- sizeof(td->td_ti.ti_i));
- break;
}
- } else {
- bzero((caddr_t)&td->td_ti.ti_i, sizeof(td->td_ti.ti_i));
- bzero((caddr_t)td->td_ip6buf, sizeof(td->td_ip6buf));
}
- if (th) {
+ if (th != NULL) {
switch (td->td_family) {
case AF_INET:
td->td_ti.ti_t = *th;
- bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th));
break;
#ifdef INET6
case AF_INET6:
td->td_ti6.th = *th;
- bzero((caddr_t)&td->td_ti.ti_t,
- sizeof(td->td_ti.ti_t));
break;
#endif
- default:
- bzero((caddr_t)&td->td_ti.ti_t,
- sizeof(td->td_ti.ti_t));
- bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th));
- break;
}
- } else {
- bzero((caddr_t)&td->td_ti.ti_t, sizeof(td->td_ti.ti_t));
- bzero((caddr_t)&td->td_ti6.th, sizeof(td->td_ti6.th));
}
td->td_req = req;
mtx_unlock(&tcp_debug_mtx);
#ifdef TCPDEBUG
if (tcpconsdebug == 0)
return;
- if (tp)
+ if (tp != NULL)
printf("%p %s:", tp, tcpstates[ostate]);
else
printf("???????? ");
printf("%s ", tanames[act]);
switch (act) {
-
case TA_INPUT:
case TA_OUTPUT:
case TA_DROP:
@@ -196,9 +169,9 @@
ack = th->th_ack;
len =
#ifdef INET6
- isipv6 ? ((struct ip6_hdr *)ipgen)->ip6_plen :
+ isipv6 ? ((struct ip6_hdr *)ipgen)->ip6_plen :
#endif
- ((struct ip *)ipgen)->ip_len;
+ ((struct ip *)ipgen)->ip_len;
if (act == TA_OUTPUT) {
seq = ntohl(seq);
ack = ntohl(ack);
@@ -231,11 +204,11 @@
printf("<%s>", tcptimers[req>>8]);
break;
}
- if (tp)
+ if (tp != NULL)
printf(" -> %s", tcpstates[tp->t_state]);
/* print out internal state of tp !?! */
printf("\n");
- if (tp == 0)
+ if (tp == NULL)
return;
printf(
"\trcv_(nxt,wnd,up) (%lx,%lx,%lx) snd_(una,nxt,max) (%lx,%lx,%lx)\n",
==== //depot/projects/soc2006/intr_filter/netinet/tcp_subr.c#12 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.277 2007/05/06 15:56:31 andre Exp $
+ * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.278 2007/05/07 13:04:25 rwatson Exp $
*/
#include "opt_compat.h"
@@ -1811,8 +1811,8 @@
tcp_discardcb(tp);
so = inp->inp_socket;
soisdisconnected(so);
+ tw->tw_cred = crhold(so->so_cred);
SOCK_LOCK(so);
- tw->tw_cred = crhold(so->so_cred);
tw->tw_so_options = so->so_options;
SOCK_UNLOCK(so);
if (acknow)
==== //depot/projects/soc2006/intr_filter/netinet/udp_usrreq.c#10 (text+ko) ====
@@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
- * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.205 2007/05/01 16:31:02 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.207 2007/05/07 13:51:24 rwatson Exp $
*/
#include "opt_ipfw.h"
@@ -117,14 +117,14 @@
SYSCTL_INT(_net_inet_udp, OID_AUTO, strict_mcast_mship, CTLFLAG_RW,
&strict_mcast_mship, 0, "Only send multicast to member sockets");
-struct inpcbhead udb; /* from udp_var.h */
-struct inpcbinfo udbinfo;
+struct inpcbhead udb; /* from udp_var.h */
+struct inpcbinfo udbinfo;
#ifndef UDBHASHSIZE
-#define UDBHASHSIZE 16
+#define UDBHASHSIZE 16
#endif
-struct udpstat udpstat; /* from udp_var.h */
+struct udpstat udpstat; /* from udp_var.h */
SYSCTL_STRUCT(_net_inet_udp, UDPCTL_STATS, stats, CTLFLAG_RW, &udpstat,
udpstat, "UDP statistics (struct udpstat, netinet/udp_var.h)");
@@ -145,15 +145,17 @@
static int
udp_inpcb_init(void *mem, int size, int flags)
{
- struct inpcb *inp = mem;
+ struct inpcb *inp;
+ inp = mem;
INP_LOCK_INIT(inp, "inp", "udpinp");
return (0);
}
void
-udp_init()
+udp_init(void)
{
+
INP_INFO_LOCK_INIT(&udbinfo, "udp");
LIST_INIT(&udb);
udbinfo.ipi_listhead = &udb;
@@ -165,7 +167,7 @@
NULL, udp_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
uma_zone_set_max(udbinfo.ipi_zone, maxsockets);
EVENTHANDLER_REGISTER(maxsockets_change, udp_zone_change, NULL,
- EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_PRI_ANY);
}
void
@@ -224,8 +226,8 @@
udp_in.sin_addr = ip->ip_src;
/*
- * Make mbuf data length reflect UDP length.
- * If not enough data to reflect UDP length, drop.
+ * Make mbuf data length reflect UDP length. If not enough data to
+ * reflect UDP length, drop.
*/
len = ntohs((u_short)uh->uh_ulen);
if (ip->ip_len != len) {
@@ -258,6 +260,7 @@
uh->uh_sum ^= 0xffff;
} else {
char b[9];
+
bcopy(((struct ipovly *)ip)->ih_x1, b, 9);
bzero(((struct ipovly *)ip)->ih_x1, 9);
((struct ipovly *)ip)->ih_len = uh->uh_ulen;
@@ -295,7 +298,6 @@
#endif
INP_INFO_RLOCK(&udbinfo);
-
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) {
struct inpcb *last;
@@ -340,8 +342,8 @@
* sent to sockets with multicast memberships for the
* packet's destination address and arrival interface
*/
-#define MSHIP(_inp, n) ((_inp)->inp_moptions->imo_membership[(n)])
-#define NMSHIPS(_inp) ((_inp)->inp_moptions->imo_num_memberships)
+#define MSHIP(_inp, n) ((_inp)->inp_moptions->imo_membership[(n)])
+#define NMSHIPS(_inp) ((_inp)->inp_moptions->imo_num_memberships)
INP_LOCK(inp);
if (strict_mcast_mship && inp->inp_moptions != NULL) {
int mship, foundmship = 0;
@@ -566,10 +568,10 @@
* DoS attack on machines with many connections.
*/
if (cmd == PRC_HOSTDEAD)
- ip = 0;
+ ip = NULL;
else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
return;
- if (ip) {
+ if (ip != NULL) {
uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
INP_INFO_RLOCK(&udbinfo);
inp = in_pcblookup_hash(&udbinfo, faddr, uh->uh_dport,
@@ -763,8 +765,8 @@
control->m_data += CMSG_ALIGN(cm->cmsg_len),
control->m_len -= CMSG_ALIGN(cm->cmsg_len)) {
cm = mtod(control, struct cmsghdr *);
- if (control->m_len < sizeof(*cm) || cm->cmsg_len == 0 ||
- cm->cmsg_len > control->m_len) {
+ if (control->m_len < sizeof(*cm) || cm->cmsg_len == 0
+ || cm->cmsg_len > control->m_len) {
error = EINVAL;
break;
}
@@ -782,8 +784,10 @@
src.sin_family = AF_INET;
src.sin_len = sizeof(src);
src.sin_port = inp->inp_lport;
- src.sin_addr = *(struct in_addr *)CMSG_DATA(cm);
+ src.sin_addr =
+ *(struct in_addr *)CMSG_DATA(cm);
break;
+
default:
error = ENOPROTOOPT;
break;
@@ -957,6 +961,7 @@
sizeof(struct sockaddr_in)
#endif
);
+
SYSCTL_ULONG(_net_inet_udp, UDPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
&udp_recvspace, 0, "Maximum space for incoming UDP datagrams");
@@ -1130,29 +1135,6 @@
return (0);
}
-/*
- * This is the wrapper function for in_setsockaddr. We just pass down the
- * pcbinfo for in_setsockaddr() to lock. We don't want to do the locking
- * here because in_setsockaddr() will call malloc and might block.
- */
-static int
-udp_sockaddr(struct socket *so, struct sockaddr **nam)
-{
-
- return (in_setsockaddr(so, nam));
-}
-
-/*
- * This is the wrapper function for in_setpeeraddr(). We just pass down the
- * pcbinfo for in_setpeeraddr() to lock.
- */
-static int
-udp_peeraddr(struct socket *so, struct sockaddr **nam)
-{
-
- return (in_setpeeraddr(so, nam));
-}
-
struct pr_usrreqs udp_usrreqs = {
.pru_abort = udp_abort,
.pru_attach = udp_attach,
@@ -1161,11 +1143,11 @@
.pru_control = in_control,
.pru_detach = udp_detach,
.pru_disconnect = udp_disconnect,
- .pru_peeraddr = udp_peeraddr,
+ .pru_peeraddr = in_setpeeraddr,
.pru_send = udp_send,
.pru_sosend = sosend_dgram,
.pru_shutdown = udp_shutdown,
- .pru_sockaddr = udp_sockaddr,
+ .pru_sockaddr = in_setsockaddr,
.pru_sosetlabel = in_pcbsosetlabel,
.pru_close = udp_close,
};
More information about the p4-projects
mailing list