Netdev List
 help / color / mirror / Atom feed
* [net-next-2.6 PATCH] net: convert multiple drivers to use netdev_for_each_mc_addr, part5 V2
From: Jiri Pirko @ 2010-02-23 19:19 UTC (permalink / raw)
  To: netdev; +Cc: davem

this time without octeon - I'll leave that for later.
------

removed some needless checks and also corrected bug in lp486e (dmi was passed
instead of dmi->dmi_addr)

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/jme.c                  |    6 +-----
 drivers/net/korina.c               |    6 ++----
 drivers/net/ks8851.c               |    5 ++---
 drivers/net/ks8851_mll.c           |    3 ++-
 drivers/net/ksz884x.c              |    4 ++--
 drivers/net/lib82596.c             |    7 ++++---
 drivers/net/lib8390.c              |   15 ++++-----------
 drivers/net/ll_temac_main.c        |    7 ++++---
 drivers/net/lp486e.c               |    4 ++--
 drivers/net/mac89x0.c              |    4 +---
 drivers/net/macb.c                 |    7 ++-----
 drivers/net/mace.c                 |   11 +++++------
 drivers/net/macmace.c              |   12 ++++++------
 drivers/net/mv643xx_eth.c          |    2 +-
 drivers/net/myri10ge/myri10ge.c    |    2 +-
 drivers/net/natsemi.c              |    4 ++--
 drivers/net/netxen/netxen_nic_hw.c |   19 +++++++------------
 drivers/net/ni5010.c               |    3 ++-
 drivers/net/ni52.c                 |    8 ++++----
 drivers/net/niu.c                  |    2 +-
 drivers/net/pci-skeleton.c         |    6 +++---
 drivers/net/pcnet32.c              |    5 ++---
 drivers/net/ps3_gelic_net.c        |    2 +-
 drivers/net/qlcnic/qlcnic_hw.c     |    3 +--
 drivers/net/qlge/qlge_main.c       |    6 ++++--
 drivers/net/r6040.c                |   30 +++++++++++++++---------------
 drivers/net/r8169.c                |    4 +---
 27 files changed, 82 insertions(+), 105 deletions(-)

diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 558b6a0..0f31497 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -1997,7 +1997,6 @@ jme_set_multi(struct net_device *netdev)
 {
 	struct jme_adapter *jme = netdev_priv(netdev);
 	u32 mc_hash[2] = {};
-	int i;
 
 	spin_lock_bh(&jme->rxmcs_lock);
 
@@ -2012,10 +2011,7 @@ jme_set_multi(struct net_device *netdev)
 		int bit_nr;
 
 		jme->reg_rxmcs |= RXMCS_MULFRAME | RXMCS_MULFILTERED;
-		for (i = 0, mclist = netdev->mc_list;
-			mclist && i < netdev_mc_count(netdev);
-			++i, mclist = mclist->next) {
-
+		netdev_for_each_mc_addr(mclist, netdev) {
 			bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3F;
 			mc_hash[bit_nr >> 5] |= 1 << (bit_nr & 0x1F);
 		}
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index af0c764..300c224 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -482,7 +482,7 @@ static void korina_multicast_list(struct net_device *dev)
 {
 	struct korina_private *lp = netdev_priv(dev);
 	unsigned long flags;
-	struct dev_mc_list *dmi = dev->mc_list;
+	struct dev_mc_list *dmi;
 	u32 recognise = ETH_ARC_AB;	/* always accept broadcasts */
 	int i;
 
@@ -502,11 +502,9 @@ static void korina_multicast_list(struct net_device *dev)
 		for (i = 0; i < 4; i++)
 			hash_table[i] = 0;
 
-		for (i = 0; i < netdev_mc_count(dev); i++) {
+		netdev_for_each_mc_addr(dmi, dev) {
 			char *addrs = dmi->dmi_addr;
 
-			dmi = dmi->next;
-
 			if (!(*addrs & 1))
 				continue;
 
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9845ab1..b5219cc 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -966,13 +966,12 @@ static void ks8851_set_rx_mode(struct net_device *dev)
 		rxctrl.rxcr1 = (RXCR1_RXME | RXCR1_RXAE |
 				RXCR1_RXPAFMA | RXCR1_RXMAFMA);
 	} else if (dev->flags & IFF_MULTICAST && !netdev_mc_empty(dev)) {
-		struct dev_mc_list *mcptr = dev->mc_list;
+		struct dev_mc_list *mcptr;
 		u32 crc;
-		int i;
 
 		/* accept some multicast */
 
-		for (i = netdev_mc_count(dev); i > 0; i--) {
+		netdev_for_each_mc_addr(mcptr, dev) {
 			crc = ether_crc(ETH_ALEN, mcptr->dmi_addr);
 			crc >>= (32 - 6);  /* get top six bits */
 
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index ffffb38..84b0e15 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -1196,7 +1196,8 @@ static void ks_set_rx_mode(struct net_device *netdev)
 	if ((netdev->flags & IFF_MULTICAST) && netdev_mc_count(netdev)) {
 		if (netdev_mc_count(netdev) <= MAX_MCAST_LST) {
 			int i = 0;
-			for (ptr = netdev->mc_list; ptr; ptr = ptr->next) {
+
+			netdev_for_each_mc_addr(ptr, netdev) {
 				if (!(*ptr->dmi_addr & 1))
 					continue;
 				if (i >= MAX_MCAST_LST)
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 6f187c7..7264a3e 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -5777,7 +5777,7 @@ static void netdev_set_rx_mode(struct net_device *dev)
 	if (hw_priv->hw.dev_count > 1)
 		return;
 
-	if ((dev->flags & IFF_MULTICAST) && dev->mc_count) {
+	if ((dev->flags & IFF_MULTICAST) && !netdev_mc_empty(dev)) {
 		int i = 0;
 
 		/* List too big to support so turn on all multicast mode. */
@@ -5790,7 +5790,7 @@ static void netdev_set_rx_mode(struct net_device *dev)
 			return;
 		}
 
-		for (mc_ptr = dev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) {
+		netdev_for_each_mc_addr(mc_ptr, dev) {
 			if (!(*mc_ptr->dmi_addr & 1))
 				continue;
 			if (i >= MAX_MULTICAST_LIST)
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index 371b58b..443c39a 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -1396,15 +1396,16 @@ static void set_multicast_list(struct net_device *dev)
 		cmd->cmd.command = SWAP16(CmdMulticastList);
 		cmd->mc_cnt = SWAP16(netdev_mc_count(dev) * 6);
 		cp = cmd->mc_addrs;
-		for (dmi = dev->mc_list;
-		     cnt && dmi != NULL;
-		     dmi = dmi->next, cnt--, cp += 6) {
+		netdev_for_each_mc_addr(dmi, dev) {
+			if (!cnt--)
+				break;
 			memcpy(cp, dmi->dmi_addr, 6);
 			if (i596_debug > 1)
 				DEB(DEB_MULTI,
 				    printk(KERN_DEBUG
 					   "%s: Adding address %pM\n",
 					   dev->name, cp));
+			cp += 6;
 		}
 		DMA_WBACK_INV(dev, &dma->mc_cmd, sizeof(struct mc_cmd));
 		i596_add_cmd(dev, &cmd->cmd);
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c
index 57f2584..e629233 100644
--- a/drivers/net/lib8390.c
+++ b/drivers/net/lib8390.c
@@ -907,15 +907,8 @@ static inline void make_mc_bits(u8 *bits, struct net_device *dev)
 {
 	struct dev_mc_list *dmi;
 
-	for (dmi=dev->mc_list; dmi; dmi=dmi->next)
-	{
-		u32 crc;
-		if (dmi->dmi_addrlen != ETH_ALEN)
-		{
-			printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name);
-			continue;
-		}
-		crc = ether_crc(ETH_ALEN, dmi->dmi_addr);
+	netdev_for_each_mc_addr(dmi, dev) {
+		u32 crc = ether_crc(ETH_ALEN, dmi->dmi_addr);
 		/*
 		 * The 8390 uses the 6 most significant bits of the
 		 * CRC to index the multicast table.
@@ -941,7 +934,7 @@ static void do_set_multicast_list(struct net_device *dev)
 	if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI)))
 	{
 		memset(ei_local->mcfilter, 0, 8);
-		if (dev->mc_list)
+		if (!netdev_mc_empty(dev))
 			make_mc_bits(ei_local->mcfilter, dev);
 	}
 	else
@@ -975,7 +968,7 @@ static void do_set_multicast_list(struct net_device *dev)
 
   	if(dev->flags&IFF_PROMISC)
   		ei_outb_p(E8390_RXCONFIG | 0x18, e8390_base + EN0_RXCR);
-	else if(dev->flags&IFF_ALLMULTI || dev->mc_list)
+	else if (dev->flags & IFF_ALLMULTI || !netdev_mc_addr(dev))
   		ei_outb_p(E8390_RXCONFIG | 0x08, e8390_base + EN0_RXCR);
   	else
   		ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index e534402..a18e348 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -250,9 +250,10 @@ static void temac_set_multicast_list(struct net_device *ndev)
 		temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
 		dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
 	} else if (!netdev_mc_empty(ndev)) {
-		struct dev_mc_list *mclist = ndev->mc_list;
-		for (i = 0; mclist && i < netdev_mc_count(ndev); i++) {
+		struct dev_mc_list *mclist;
 
+		i = 0;
+		netdev_for_each_mc_addr(mclist, ndev) {
 			if (i >= MULTICAST_CAM_TABLE_NUM)
 				break;
 			multi_addr_msw = ((mclist->dmi_addr[3] << 24) |
@@ -265,7 +266,7 @@ static void temac_set_multicast_list(struct net_device *ndev)
 					  (mclist->dmi_addr[4]) | (i << 16));
 			temac_indirect_out32(lp, XTE_MAW1_OFFSET,
 					     multi_addr_lsw);
-			mclist = mclist->next;
+			i++;
 		}
 	} else {
 		val = temac_indirect_in32(lp, XTE_AFM_OFFSET);
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index b1f5d79..3e3cc04 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -1267,8 +1267,8 @@ static void set_multicast_list(struct net_device *dev) {
 		cmd->command = CmdMulticastList;
 		*((unsigned short *) (cmd + 1)) = netdev_mc_count(dev) * 6;
 		cp = ((char *)(cmd + 1))+2;
-		for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) {
-			memcpy(cp, dmi,6);
+		netdev_for_each_mc_addr(dmi, dev) {
+			memcpy(cp, dmi->dmi_addr, 6);
 			cp += 6;
 		}
 		if (i596_debug & LOG_SRCDST)
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 23b633e..c292a60 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -568,9 +568,7 @@ static void set_multicast_list(struct net_device *dev)
 	if(dev->flags&IFF_PROMISC)
 	{
 		lp->rx_mode = RX_ALL_ACCEPT;
-	}
-	else if((dev->flags&IFF_ALLMULTI)||dev->mc_list)
-	{
+	} else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev)) {
 		/* The multicast-accept list is initialized to accept-all, and we
 		   rely on higher-level filtering for now. */
 		lp->rx_mode = RX_MULTCAST_ACCEPT;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 7a5f897..c8a18a6 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -884,15 +884,12 @@ static void macb_sethashtable(struct net_device *dev)
 {
 	struct dev_mc_list *curr;
 	unsigned long mc_filter[2];
-	unsigned int i, bitnr;
+	unsigned int bitnr;
 	struct macb *bp = netdev_priv(dev);
 
 	mc_filter[0] = mc_filter[1] = 0;
 
-	curr = dev->mc_list;
-	for (i = 0; i < netdev_mc_count(dev); i++, curr = curr->next) {
-		if (!curr) break;	/* unexpected end of list */
-
+	netdev_for_each_mc_addr(curr, dev) {
 		bitnr = hash_get_index(curr->dmi_addr);
 		mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
 	}
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index fdb0bbd..57534f0 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -588,7 +588,7 @@ static void mace_set_multicast(struct net_device *dev)
 {
     struct mace_data *mp = netdev_priv(dev);
     volatile struct mace __iomem *mb = mp->mace;
-    int i, j;
+    int i;
     u32 crc;
     unsigned long flags;
 
@@ -598,7 +598,7 @@ static void mace_set_multicast(struct net_device *dev)
 	mp->maccc |= PROM;
     } else {
 	unsigned char multicast_filter[8];
-	struct dev_mc_list *dmi = dev->mc_list;
+	struct dev_mc_list *dmi;
 
 	if (dev->flags & IFF_ALLMULTI) {
 	    for (i = 0; i < 8; i++)
@@ -606,11 +606,10 @@ static void mace_set_multicast(struct net_device *dev)
 	} else {
 	    for (i = 0; i < 8; i++)
 		multicast_filter[i] = 0;
-	    for (i = 0; i < netdev_mc_count(dev); i++) {
+	    netdev_for_each_mc_addr(dmi, dev) {
 	        crc = ether_crc_le(6, dmi->dmi_addr);
-		j = crc >> 26;	/* bit number in multicast_filter */
-		multicast_filter[j >> 3] |= 1 << (j & 7);
-		dmi = dmi->next;
+		i = crc >> 26;	/* bit number in multicast_filter */
+		multicast_filter[i >> 3] |= 1 << (i & 7);
 	    }
 	}
 #if 0
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c
index 740accb..4e4eac0 100644
--- a/drivers/net/macmace.c
+++ b/drivers/net/macmace.c
@@ -496,7 +496,7 @@ static void mace_set_multicast(struct net_device *dev)
 {
 	struct mace_data *mp = netdev_priv(dev);
 	volatile struct mace *mb = mp->mace;
-	int i, j;
+	int i;
 	u32 crc;
 	u8 maccc;
 	unsigned long flags;
@@ -509,7 +509,7 @@ static void mace_set_multicast(struct net_device *dev)
 		mb->maccc |= PROM;
 	} else {
 		unsigned char multicast_filter[8];
-		struct dev_mc_list *dmi = dev->mc_list;
+		struct dev_mc_list *dmi;
 
 		if (dev->flags & IFF_ALLMULTI) {
 			for (i = 0; i < 8; i++) {
@@ -518,11 +518,11 @@ static void mace_set_multicast(struct net_device *dev)
 		} else {
 			for (i = 0; i < 8; i++)
 				multicast_filter[i] = 0;
-			for (i = 0; i < netdev_mc_count(dev); i++) {
+			netdev_for_each_mc_addr(dmi, dev) {
 				crc = ether_crc_le(6, dmi->dmi_addr);
-				j = crc >> 26;	/* bit number in multicast_filter */
-				multicast_filter[j >> 3] |= 1 << (j & 7);
-				dmi = dmi->next;
+				/* bit number in multicast_filter */
+				i = crc >> 26;
+				multicast_filter[i >> 3] |= 1 << (i & 7);
 			}
 		}
 
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 2733b0a..c97b6e4 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1794,7 +1794,7 @@ oom:
 	memset(mc_spec, 0, 0x100);
 	memset(mc_other, 0, 0x100);
 
-	for (addr = dev->mc_list; addr != NULL; addr = addr->next) {
+	netdev_for_each_mc_addr(addr, dev) {
 		u8 *a = addr->da_addr;
 		u32 *table;
 		int entry;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index c0884a9..e06fbd9 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -3065,7 +3065,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
 	}
 
 	/* Walk the multicast list, and add each address */
-	for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) {
+	netdev_for_each_mc_addr(mc_list, dev) {
 		memcpy(data, &mc_list->dmi_addr, 6);
 		cmd.data0 = ntohl(data[0]);
 		cmd.data1 = ntohl(data[1]);
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index c64e5b0..e520387 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2495,9 +2495,9 @@ static void __set_rx_mode(struct net_device *dev)
 	} else {
 		struct dev_mc_list *mclist;
 		int i;
+
 		memset(mc_filter, 0, sizeof(mc_filter));
-		for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
-			 i++, mclist = mclist->next) {
+		netdev_for_each_mc_addr(mclist, dev) {
 			int b = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 23) & 0x1ff;
 			mc_filter[b/8] |= (1 << (b & 0x07));
 		}
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 25f4414..a945591 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -539,7 +539,7 @@ void netxen_p2_nic_set_multi(struct net_device *netdev)
 	struct netxen_adapter *adapter = netdev_priv(netdev);
 	struct dev_mc_list *mc_ptr;
 	u8 null_addr[6];
-	int index = 0;
+	int i;
 
 	memset(null_addr, 0, 6);
 
@@ -570,16 +570,13 @@ void netxen_p2_nic_set_multi(struct net_device *netdev)
 
 	netxen_nic_enable_mcast_filter(adapter);
 
-	for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next, index++)
-		netxen_nic_set_mcast_addr(adapter, index, mc_ptr->dmi_addr);
-
-	if (index != netdev_mc_count(netdev))
-		printk(KERN_WARNING "%s: %s multicast address count mismatch\n",
-			netxen_nic_driver_name, netdev->name);
+	i = 0;
+	netdev_for_each_mc_addr(mc_ptr, netdev)
+		netxen_nic_set_mcast_addr(adapter, i++, mc_ptr->dmi_addr);
 
 	/* Clear out remaining addresses */
-	for (; index < adapter->max_mc_count; index++)
-		netxen_nic_set_mcast_addr(adapter, index, null_addr);
+	while (i < adapter->max_mc_count)
+		netxen_nic_set_mcast_addr(adapter, i++, null_addr);
 }
 
 static int
@@ -710,10 +707,8 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
 	}
 
 	if (!netdev_mc_empty(netdev)) {
-		for (mc_ptr = netdev->mc_list; mc_ptr;
-		     mc_ptr = mc_ptr->next) {
+		netdev_for_each_mc_addr(mc_ptr, netdev)
 			nx_p3_nic_add_mac(adapter, mc_ptr->dmi_addr, &del_list);
-		}
 	}
 
 send_fw_cmd:
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index 6a87d81..c16cbfb 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -651,7 +651,8 @@ static void ni5010_set_multicast_list(struct net_device *dev)
 
 	PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name));
 
-	if (dev->flags&IFF_PROMISC || dev->flags&IFF_ALLMULTI || dev->mc_list) {
+	if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI ||
+	    !netdev_mc_empty(dev)) {
 		outb(RMD_PROMISC, EDLC_RMODE); /* Enable promiscuous mode */
 		PRINTK((KERN_DEBUG "%s: Entering promiscuous mode\n", dev->name));
 	} else {
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index 497c6d5..05c29c2 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -596,7 +596,7 @@ static int init586(struct net_device *dev)
 	struct iasetup_cmd_struct __iomem *ias_cmd;
 	struct tdr_cmd_struct __iomem *tdr_cmd;
 	struct mcsetup_cmd_struct __iomem *mc_cmd;
-	struct dev_mc_list *dmi = dev->mc_list;
+	struct dev_mc_list *dmi;
 	int num_addrs = netdev_mc_count(dev);
 
 	ptr = p->scb + 1;
@@ -724,9 +724,9 @@ static int init586(struct net_device *dev)
 		writew(0xffff, &mc_cmd->cmd_link);
 		writew(num_addrs * 6, &mc_cmd->mc_cnt);
 
-		for (i = 0; i < num_addrs; i++, dmi = dmi->next)
-			memcpy_toio(mc_cmd->mc_list[i],
-							dmi->dmi_addr, 6);
+		i = 0;
+		netdev_for_each_mc_addr(dmi, dev)
+			memcpy_toio(mc_cmd->mc_list[i++], dmi->dmi_addr, 6);
 
 		writew(make16(mc_cmd), &p->scb->cbl_offset);
 		writeb(CUC_START, &p->scb->cmd_cuc);
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 5e604e3..0678f31 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6365,7 +6365,7 @@ static void niu_set_rx_mode(struct net_device *dev)
 		for (i = 0; i < 16; i++)
 			hash[i] = 0xffff;
 	} else if (!netdev_mc_empty(dev)) {
-		for (addr = dev->mc_list; addr; addr = addr->next) {
+		netdev_for_each_mc_addr(addr, dev) {
 			u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr);
 
 			crc >>= 24;
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index 11d4398..3678585 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -1793,7 +1793,7 @@ static void netdrv_set_rx_mode(struct net_device *dev)
 	struct netdrv_private *tp = netdev_priv(dev);
 	void *ioaddr = tp->mmio_addr;
 	u32 mc_filter[2];	/* Multicast hash filter */
-	int i, rx_mode;
+	int rx_mode;
 	u32 tmp;
 
 	DPRINTK("ENTER\n");
@@ -1814,10 +1814,10 @@ static void netdrv_set_rx_mode(struct net_device *dev)
 		mc_filter[1] = mc_filter[0] = 0xffffffff;
 	} else {
 		struct dev_mc_list *mclist;
+
 		rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
 		mc_filter[1] = mc_filter[0] = 0;
-		for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
-		     i++, mclist = mclist->next) {
+		netdev_for_each_mc_addr(mclist, dev) {
 			int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
 
 			mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 63e0315..084d78d 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -2590,7 +2590,7 @@ static void pcnet32_load_multicast(struct net_device *dev)
 	struct pcnet32_private *lp = netdev_priv(dev);
 	volatile struct pcnet32_init_block *ib = lp->init_block;
 	volatile __le16 *mcast_table = (__le16 *)ib->filter;
-	struct dev_mc_list *dmi = dev->mc_list;
+	struct dev_mc_list *dmi;
 	unsigned long ioaddr = dev->base_addr;
 	char *addrs;
 	int i;
@@ -2611,9 +2611,8 @@ static void pcnet32_load_multicast(struct net_device *dev)
 	ib->filter[1] = 0;
 
 	/* Add addresses */
-	for (i = 0; i < netdev_mc_count(dev); i++) {
+	netdev_for_each_mc_addr(dmi, dev) {
 		addrs = dmi->dmi_addr;
-		dmi = dmi->next;
 
 		/* multicast address? */
 		if (!(*addrs & 1))
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index c19dd4a..a849f6f 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -580,7 +580,7 @@ void gelic_net_set_multi(struct net_device *netdev)
 	}
 
 	/* set multicast addresses */
-	for (mc = netdev->mc_list; mc; mc = mc->next) {
+	netdev_for_each_mc_addr(mc, netdev) {
 		addr = 0;
 		p = mc->dmi_addr;
 		for (i = 0; i < ETH_ALEN; i++) {
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 8ea7f86..99a4d13 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -453,8 +453,7 @@ void qlcnic_set_multi(struct net_device *netdev)
 	}
 
 	if (!netdev_mc_empty(netdev)) {
-		for (mc_ptr = netdev->mc_list; mc_ptr;
-				     mc_ptr = mc_ptr->next) {
+		netdev_for_each_mc_addr(mc_ptr, netdev) {
 			qlcnic_nic_add_mac(adapter, mc_ptr->dmi_addr,
 							&del_list);
 		}
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index c170349..c26ec5d 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -4270,8 +4270,8 @@ static void qlge_set_multicast_list(struct net_device *ndev)
 		status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK);
 		if (status)
 			goto exit;
-		for (i = 0, mc_ptr = ndev->mc_list; mc_ptr;
-		     i++, mc_ptr = mc_ptr->next)
+		i = 0;
+		netdev_for_each_mc_addr(mc_ptr, ndev) {
 			if (ql_set_mac_addr_reg(qdev, (u8 *) mc_ptr->dmi_addr,
 						MAC_ADDR_TYPE_MULTI_MAC, i)) {
 				netif_err(qdev, hw, qdev->ndev,
@@ -4279,6 +4279,8 @@ static void qlge_set_multicast_list(struct net_device *ndev)
 				ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
 				goto exit;
 			}
+			i++;
+		}
 		ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
 		if (ql_set_routing_reg
 		    (qdev, RT_IDX_MCAST_MATCH_SLOT, RT_IDX_MCAST_MATCH, 1)) {
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index b810342..15d5373 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -938,7 +938,7 @@ static void r6040_multicast_list(struct net_device *dev)
 	u16 *adrp;
 	u16 reg;
 	unsigned long flags;
-	struct dev_mc_list *dmi = dev->mc_list;
+	struct dev_mc_list *dmi;
 	int i;
 
 	/* MAC Address */
@@ -973,11 +973,9 @@ static void r6040_multicast_list(struct net_device *dev)
 		for (i = 0; i < 4; i++)
 			hash_table[i] = 0;
 
-		for (i = 0; i < netdev_mc_count(dev); i++) {
+		netdev_for_each_mc_addr(dmi, dev) {
 			char *addrs = dmi->dmi_addr;
 
-			dmi = dmi->next;
-
 			if (!(*addrs & 1))
 				continue;
 
@@ -995,17 +993,19 @@ static void r6040_multicast_list(struct net_device *dev)
 		iowrite16(hash_table[3], ioaddr + MAR3);
 	}
 	/* Multicast Address 1~4 case */
-	for (i = 0, dmi; (i < netdev_mc_count(dev)) && (i < MCAST_MAX); i++) {
-		adrp = (u16 *)dmi->dmi_addr;
-		iowrite16(adrp[0], ioaddr + MID_1L + 8*i);
-		iowrite16(adrp[1], ioaddr + MID_1M + 8*i);
-		iowrite16(adrp[2], ioaddr + MID_1H + 8*i);
-		dmi = dmi->next;
-	}
-	for (i = netdev_mc_count(dev); i < MCAST_MAX; i++) {
-		iowrite16(0xffff, ioaddr + MID_0L + 8*i);
-		iowrite16(0xffff, ioaddr + MID_0M + 8*i);
-		iowrite16(0xffff, ioaddr + MID_0H + 8*i);
+	i = 0;
+	netdev_for_each_mc_addr(dmi, dev) {
+		if (i < MCAST_MAX) {
+			adrp = (u16 *) dmi->dmi_addr;
+			iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
+			iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
+			iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
+		} else {
+			iowrite16(0xffff, ioaddr + MID_0L + 8 * i);
+			iowrite16(0xffff, ioaddr + MID_0M + 8 * i);
+			iowrite16(0xffff, ioaddr + MID_0H + 8 * i);
+		}
+		i++;
 	}
 }
 
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 83965ee..dfc3573 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -4732,12 +4732,10 @@ static void rtl_set_rx_mode(struct net_device *dev)
 		mc_filter[1] = mc_filter[0] = 0xffffffff;
 	} else {
 		struct dev_mc_list *mclist;
-		unsigned int i;
 
 		rx_mode = AcceptBroadcast | AcceptMyPhys;
 		mc_filter[1] = mc_filter[0] = 0;
-		for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev);
-		     i++, mclist = mclist->next) {
+		netdev_for_each_mc_addr(mclist, dev) {
 			int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
 			mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
 			rx_mode |= AcceptMulticast;
-- 
1.6.6


^ permalink raw reply related

* Re: [PATCH 1/3] vhost: logging math fix
From: Juan Quintela @ 2010-02-23 19:26 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Rusty Russell, kvm, virtualization, netdev, linux-kernel,
	David Miller, markmc, gleb, herbert.xu, dlaor, avi
In-Reply-To: <51e0f786b06c198ab355abab19f0bd11ac6a167b.1266943453.git.mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> wrote:
> vhost was dong some complex math to get
> offset to log at, and got it wrong by a couple of bytes,
> while in fact it's simple: get address where we write,
> subtract start of buffer, add log base.
>
> Do it this way.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

> ---
>  drivers/vhost/vhost.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 6eb1525..c767279 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1004,10 +1004,12 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
>  	if (unlikely(vq->log_used)) {
>  		/* Make sure data is seen before log. */

We explain what smp_wmb() does.

>  		smp_wmb();
> -		log_write(vq->log_base, vq->log_addr + sizeof *vq->used->ring *
> -			  (vq->last_used_idx % vq->num),
> -			  sizeof *vq->used->ring);
> -		log_write(vq->log_base, vq->log_addr, sizeof *vq->used->ring);
> +		log_write(vq->log_base,
> +			  vq->log_addr + ((void *)used - (void *)vq->used),
> +			  sizeof *used);
> +		log_write(vq->log_base,
> +			  vq->log_addr + offsetof(struct vring_used, idx),
> +			  sizeof vq->used->idx);

Once here, can we add a comment explaining _what_ are we trying to write
to the log?  michael explains that t is the used element and the index,
but nothing states that.

>  		if (vq->log_ctx)
>  			eventfd_signal(vq->log_ctx, 1);
>  	}

^ permalink raw reply

* Re: [PATCH 2/3] vhost: initialize log eventfd context pointer
From: Juan Quintela @ 2010-02-23 19:31 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Rusty Russell, kvm, virtualization, netdev, linux-kernel,
	David Miller, markmc, gleb, herbert.xu, dlaor, avi
In-Reply-To: <f383d82104a04b92fe2953a4d8a98425c1ff6cde.1266943453.git.mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> wrote:
> vq log eventfd context pointer needs to be initialized, otherwise
> operation may fail or oops if log is enabled but log eventfd not set by
> userspace.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

When log_ctx for device is created, it is copied to the vq.  This reset
was missing.

> ---
>  drivers/vhost/vhost.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index c767279..d4f8fdf 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -121,6 +121,7 @@ static void vhost_vq_reset(struct vhost_dev *dev,
>  	vq->kick = NULL;
>  	vq->call_ctx = NULL;
>  	vq->call = NULL;
> +	vq->log_ctx = NULL;
>  }
>  
>  long vhost_dev_init(struct vhost_dev *dev,

^ permalink raw reply

* Re: [net-next-2.6 PATCH] Preserve queue mapping with bonding and VLAN devices
From: "Oleg A. Arkhangelsky" @ 2010-02-23 19:36 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev
In-Reply-To: <1266940741.2109.7.camel@achroite.uk.solarflarecom.com>

23.02.10, 15:59, "Ben Hutchings" <bhutchings@solarflare.com>:

>  The queue mapping will normally be the same, only no longer biased by 1.
>  So I think a better solution would be to maintain that bias on TX as
>  well, or to remove the bias and reserve -1 for unknown RX queue.

Second try. Not tested but looks OK.

Must be applied with "[net-next-2.6 PATCH] Multiqueue support for bonding devices"

Forwarded packet goes through dev_queue_xmit() more that once when using bonding
or 802.1q VLAN devices, so we've lost rx-tx queue mapping index for real devices.
This is because initial queue index value (as it recorded by skb_record_tx_queue())
is overwritten by skb_set_queue_mapping().

Signed-off-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru> 

---
 drivers/net/bnx2.c             |    2 +-
 drivers/net/bnx2x_main.c       |    2 +-
 drivers/net/gianfar.c          |    6 +++---
 drivers/net/igb/igb_main.c     |    2 +-
 drivers/net/ixgbe/ixgbe_main.c |    6 +++---
 drivers/net/mlx4/en_tx.c       |    2 +-
 drivers/net/niu.c              |    2 +-
 drivers/net/qlge/qlge_main.c   |    2 +-
 drivers/net/s2io.c             |    2 +-
 include/linux/skbuff.h         |   14 ++------------
 net/core/dev.c                 |    2 +-
 11 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d3f739a..abbbe40 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3199,7 +3199,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                }

-               skb_record_rx_queue(skb, bnapi - &bp->bnx2_napi[0]);
+               skb_set_queue_mapping(skb, bnapi - &bp->bnx2_napi[0]);

 #ifdef BCM_VLAN
                if (hw_vlan)
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 5adf2a0..6e8e327 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -1681,7 +1681,7 @@ reuse_rx:
                        }
                }

-               skb_record_rx_queue(skb, fp->index);
+               skb_set_queue_mapping(skb, fp->index);

 #ifdef BCM_VLAN
                if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6aa526e..d034f4e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1934,7 +1934,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
        unsigned int nr_frags, length;


-       rq = skb->queue_mapping;
+       rq = skb_get_queue_mapping(skb);
        tx_queue = priv->tx_queue[rq];
        txq = netdev_get_tx_queue(dev, rq);
        base = tx_queue->tx_bd_base;
@@ -2466,7 +2466,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
        /* Remove the FCB from the skb */
        /* Remove the padded bytes, if there are any */
        if (amount_pull) {
-               skb_record_rx_queue(skb, fcb->rq);
+               skb_set_queue_mapping(skb, fcb->rq);
                skb_pull(skb, amount_pull);
        }

@@ -2549,7 +2549,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
                                /* Remove the FCS from the packet length */
                                skb_put(skb, pkt_len);
                                rx_queue->stats.rx_bytes += pkt_len;
-                               skb_record_rx_queue(skb, rx_queue->qindex);
+                               skb_set_queue_mapping(skb, rx_queue->qindex);
                                gfar_process_frame(dev, skb, amount_pull);

                        } else {
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 583a21c..def942c 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3838,7 +3838,7 @@ static netdev_tx_t igb_xmit_frame_adv(struct sk_buff *skb,
                return NETDEV_TX_OK;
        }

-       r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES - 1);
+       r_idx = skb_get_queue_mapping(skb) & (IGB_ABS_MAX_TX_QUEUES - 1);
        tx_ring = adapter->multi_tx_table[r_idx];

        /* This goes back to the question of how to logically map a tx queue
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 3308790..40871d9 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5636,13 +5636,13 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
                tx_flags |= vlan_tx_tag_get(skb);
                if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
                        tx_flags &= ~IXGBE_TX_FLAGS_VLAN_PRIO_MASK;
-                       tx_flags |= ((skb->queue_mapping & 0x7) << 13);
+                       tx_flags |= ((skb_get_queue_mapping(skb) & 0x7) << 13);
                }
                tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
                tx_flags |= IXGBE_TX_FLAGS_VLAN;
        } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
                if (skb->priority != TC_PRIO_CONTROL) {
-                       tx_flags |= ((skb->queue_mapping & 0x7) << 13);
+                       tx_flags |= ((skb_get_queue_mapping(skb) & 0x7) << 13);
                        tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
                        tx_flags |= IXGBE_TX_FLAGS_VLAN;
                } else {
@@ -5651,7 +5651,7 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
                }
        }

-       tx_ring = adapter->tx_ring[skb->queue_mapping];
+       tx_ring = adapter->tx_ring[skb_get_queue_mapping(skb)];

        if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
            (skb->protocol == htons(ETH_P_FCOE))) {
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 3d1396a..c1bca72 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -624,7 +624,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
                goto tx_drop;
        }

-       tx_ind = skb->queue_mapping;
+       tx_ind = skb_get_queue_mapping(skb);
        ring = &priv->tx_ring[tx_ind];
        if (priv->vlgrp && vlan_tx_tag_present(skb))
                vlan_tag = vlan_tx_tag_get(skb);
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 5e604e3..67f33e1 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -3516,7 +3516,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
        rp->rx_bytes += skb->len;

        skb->protocol = eth_type_trans(skb, np->dev);
-       skb_record_rx_queue(skb, rp->rx_channel);
+       skb_set_queue_mapping(skb, rp->rx_channel);
        napi_gro_receive(napi, skb);

        return num_rcr;
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index c170349..e84a988 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2525,7 +2525,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev)
        struct ql_adapter *qdev = netdev_priv(ndev);
        int tso;
        struct tx_ring *tx_ring;
-       u32 tx_ring_idx = (u32) skb->queue_mapping;
+       u32 tx_ring_idx = (u32) skb_get_queue_mapping(skb);

        tx_ring = &qdev->tx_ring[tx_ring_idx];

diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 43bc66a..afdab06 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -7549,7 +7549,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)

        swstats->mem_freed += skb->truesize;
 send_up:
-       skb_record_rx_queue(skb, ring_no);
+       skb_set_queue_mapping(skb, ring_no);
        queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2));
 aggregate:
        sp->mac_control.rings[ring_no].rx_bufs_left -= 1;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ba0f8e3..3e63a83 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2013,12 +2013,12 @@ static inline void skb_init_secmark(struct sk_buff *skb)

 static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
 {
-       skb->queue_mapping = queue_mapping;
+       skb->queue_mapping = queue_mapping + 1;
 }

 static inline u16 skb_get_queue_mapping(const struct sk_buff *skb)
 {
-       return skb->queue_mapping;
+       return skb->queue_mapping - 1;
 }

 static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from)
@@ -2026,16 +2026,6 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
        to->queue_mapping = from->queue_mapping;
 }

-static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue)
-{
-       skb->queue_mapping = rx_queue + 1;
-}
-
-static inline u16 skb_get_rx_queue(const struct sk_buff *skb)
-{
-       return skb->queue_mapping - 1;
-}
-
 static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
 {
        return (skb->queue_mapping != 0);
diff --git a/net/core/dev.c b/net/core/dev.c
index 1968980..363dac8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1916,7 +1916,7 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)
        u32 hash;

        if (skb_rx_queue_recorded(skb)) {
-               hash = skb_get_rx_queue(skb);
+               hash = skb_get_queue_mapping(skb);
                while (unlikely(hash >= dev->real_num_tx_queues))
                        hash -= dev->real_num_tx_queues;
                return hash;
---

-- 
wbr, Oleg.

^ permalink raw reply related

* [net-next-2.6 PATCH] octeon: convert to use netdev_for_each_mc_addr
From: Jiri Pirko @ 2010-02-23 19:54 UTC (permalink / raw)
  To: netdev; +Cc: davem

Hmm so actually my original patch including this bit was correct,
"list = list->next;" confused me :) - will send patch correcting that in a few.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/octeon/octeon_mgmt.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
index 3a0f910..be368e5 100644
--- a/drivers/net/octeon/octeon_mgmt.c
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -467,7 +467,6 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
 {
 	struct octeon_mgmt *p = netdev_priv(netdev);
 	int port = p->port;
-	int i;
 	union cvmx_agl_gmx_rxx_adr_ctl adr_ctl;
 	union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx;
 	unsigned long flags;
@@ -511,12 +510,8 @@ static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
 		}
 	}
 	if (multicast_mode == 0) {
-		i = netdev_mc_count(netdev);
-		list = netdev->mc_list;
-		while (i--) {
+		netdev_for_each_mc_addr(list, netdev)
 			octeon_mgmt_cam_state_add(&cam_state, list->da_addr);
-			list = list->next;
-		}
 	}
 
 
-- 
1.6.6


^ permalink raw reply related

* Re: [PATCH 3/3] vhost: fix get_user_pages_fast error handling
From: Juan Quintela @ 2010-02-23 19:56 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Rusty Russell, kvm, virtualization, netdev, linux-kernel,
	David Miller, markmc, gleb, herbert.xu, dlaor, avi
In-Reply-To: <82ba8c97ce55dd4bf9972ad755961cd14e6a0938.1266943453.git.mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> wrote:
> get_user_pages_fast returns number of pages on success, negative value
> on failure, but never 0. Fix vhost code to match this logic.

It can return 0 if you ask for 0 pages :)
>From the comment:

 * Returns number of pages pinned. This may be fewer than the number
 * requested. If nr_pages is 0 or negative, returns 0. If no pages
 * were pinned, returns -errno.
 */

I agree that code was wrong, but the BUG_ON() is not neccessary
IMHO. The important bit is the change in the comparison.

Reviewed-by: Juan Quintela <quintela@redhat.com>


> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  drivers/vhost/vhost.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index d4f8fdf..d003504 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -646,8 +646,9 @@ static int set_bit_to_user(int nr, void __user *addr)
>  	int bit = nr + (log % PAGE_SIZE) * 8;
>  	int r;
>  	r = get_user_pages_fast(log, 1, 1, &page);
> -	if (r)
> +	if (r < 0)
>  		return r;
> +	BUG_ON(r != 1);
>  	base = kmap_atomic(page, KM_USER0);
>  	set_bit(bit, base);
>  	kunmap_atomic(base, KM_USER0);

^ permalink raw reply

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: Eric W. Biederman @ 2010-02-23 20:00 UTC (permalink / raw)
  To: hadi
  Cc: Daniel Lezcano, Patrick McHardy, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear
In-Reply-To: <1266934817.3973.654.camel@bigi>

jamal <hadi@cyberus.ca> writes:

> Added Daniel to the discussion..
>
> On Tue, 2010-02-23 at 06:07 -0800, Eric W. Biederman wrote:
>> jamal <hadi@cyberus.ca> writes:
>
>> > Does the point after sys_setns(fd) allow me to do io inside
>> > ns <name>? Can i do open() and get a fd from ns <name>?
>> 
>> Yes.  My intention is that current->nsproxy->net_ns be changed.
>> We can already change it in unshare so this is feasible.
>
> I like it if it makes it as easy as it sounds;-> With lxc,
> i essentially have to create a proxy process inside the
> namespace that i use unix domain to open fds inside the ns.
> Do i still need that?

That point of the mount to hold a persistent reference to the
namespace without using a process.

The point of the of the to be written set_ns call is to change
the default network namespace of the process such that all future
open/bind/socket calls happen in the referenced network namespace.

The are a few stray places like sysfs where it is the mount point
not current->nsproxy->net_ns that will determine what we see.

>> > The only problem that i see is events are not as nice. I take it i am 
>> > going to get something like an inotify when a new namespace is created?
>> 
>> Yes.  Inotify would at the very least see that mkdir.  You could also
>> use poll on /proc/mounts to see the set of mounts change.
>
> It is not as nice but livable. I suppose attributes of the specific
> namespace are retrieved somewhere there as well..

Attributes of the specific namespace?

Eric



^ permalink raw reply

* Peer unexpectedly shrunk window
From: Christian Kujau @ 2010-02-23 20:09 UTC (permalink / raw)
  To: LKML; +Cc: netdev


OK, the "Treason uncloaked" messages have been reworded[0][1] to now say 
"Peer [...] unexpectedly shrunk window", but the messages continue to 
appear. On a small Tor node (~100KB/s, ~200 connections) I'm getting ~2000 
or so messages per month in my kernel log (and on the console).

I see that it's logged with KERN_DEBUG, is there anyway to suppress 
those, i.e. some magic tcp specific bootparameter? Or is setting 
loglevel=6 the only way to supress them? But that's a global option :-\

Since the messages always say "repaired", why log them at all? If we can't 
do something about the remote side, I fail to see the point of these 
messages or what one is supposed to do to "fix" them.

Thanks for your insights,
Christian.

[0] http://lkml.org/lkml/2008/12/18/454
[1] http://kerneltrap.org/mailarchive/linux-netdev/2009/4/19/5518144
-- 
BOFH excuse #399:

We are a 100% Microsoft Shop.

^ permalink raw reply

* octeon dev_addrs list usage
From: Jiri Pirko @ 2010-02-23 20:41 UTC (permalink / raw)
  To: ddaney; +Cc: davem, netdev

Hello David.

Lookin at octeon driver, drivers/net/octeon/octeon_mgmt.c,
octeon_mgmt_set_rx_filtering function and following code:

503         if (cam_mode == 1) {
504                 /* Add primary address. */
505                 octeon_mgmt_cam_state_add(&cam_state, netdev->dev_addr);
506                 list_for_each(pos, &netdev->dev_addrs.list) {
507                         struct netdev_hw_addr *hw_addr;
508                         hw_addr = list_entry(pos, struct netdev_hw_addr, list);
509                         octeon_mgmt_cam_state_add(&cam_state, hw_addr->addr);
510                         list = list->next;
511                 }
512         }

besides netdev->dev_addr is first entry in netdev->dev_addrs.list and
"list = list->next;" makes no sense here (I posted a patch correcting
these earlier), are you sure you are traversing the right list? This list is
currently not filled in anywhere (besides ixgbe driver). Don't you want
to traverse through unicast_list instead? Maybe I'm missing something...

Thanks.

Jirka

^ permalink raw reply

* u32 classifier port range calculation error
From: Reinaldo Carvalho @ 2010-02-23 21:22 UTC (permalink / raw)
  To: netdev

== I'am not in netdev, please cc my addresss. ==

U32 classifier have a problem (?) on mask calculation of IP port range value.

To reproduce the problem:

##### MASK CALCULATION FOR PORT RANGE 6880->6911

echo "obase=16;(2^13)-32" | bc
1FE0

Example:

###### TC SAMPLE RULES
tc qdisc del dev eth0 root >/dev/null 2>&1

tc qdisc  add dev eth0 root handle 1: htb default 1100
tc class  add dev eth0 root classid 1:1000 htb rate 1000Mbit ceil 1000Mbit
tc class  add dev eth0 classid 1:1100 parent 1:1000 htb prio 0 rate 999Mbit
ceil 999Mbit
tc class  add dev eth0 classid 1:1200 parent 1:1000 htb prio 0 rate 1Mbit
ceil 1Mbit

tc filter add dev eth0 protocol ip prio 1 parent 1: u32 flowid 1:1200 match ip
dport 6880 0x1FE0

###### STATS CLEAN ** success 0
tc -s filter show dev eth0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:1200  (rule hit 116 success 0)
  match 00001ae0/00001fe0 at 20 (success 0 )

###### SENDING PACKETS I
# nmap example.ufpa.br -p 1-10000

###### STATS I ** success 32 (OK)
# tc -s filter show dev eth0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:1200  (rule hit 12676 success 32)
  match 00001ae0/00001fe0 at 20 (success 32 )

###### SENDING PACKETS II
# nmap example.ufpa.br -p 10000-20000

###### STATS II ** success 64 (ERROR) - should not match

# tc -s filter show dev eth0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:1200  (rule hit 25172 success 64)
  match 00001ae0/00001fe0 at 20 (success 64 )

###### SENDING PACKETS III
# nmap example.ufpa.br -p 20000-30000

###### STATS III ** success 96 (ERROR) - should not match

# tc -s filter show dev eth0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:1200  (rule hit 43131 success 96)
  match 00001ae0/00001fe0 at 20 (success 96 )

### End

Thanks

[]s

-- 
Reinaldo Carvalho

^ permalink raw reply

* Re: [PATCH 2/4] bas_gigaset: collapse CR/LF at end of AT response
From: Simon Horman @ 2010-02-23 21:43 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Karsten Keil, David Miller, Hansjoerg Lipp, Karsten Keil,
	isdn4linux, i4ldeveloper, netdev, linux-kernel
In-Reply-To: <4B83D5D7.3040407@imap.cc>

On Tue, Feb 23, 2010 at 02:19:19PM +0100, Tilman Schmidt wrote:
> Simon Horman schrieb:
> > I am confused about what the value of MAX_RESP_SIZE means.
> > Is it a hw restriction?
> 
> It's an arbitrary limitation in the driver. The hardware specification
> says nothing about the possible length of AT responses from the device,
> so we had to draw a line somewhere. 512 bytes have so far proved to be
> amply sufficient.
> 
> In practice, the limit is only hit with the M10x devices (which transmit
> commands and data over the same channel) when the state machine gets out
> of sync and tries to interpret received payload data as AT responses.

Ok, understood. Thanks for the clarification.

> > It seems that up to MAX_RESP_SIZE of string-data is permitted if the line
> > is terminated by CR. But only MAX_RESP_SIZE -1  bytes if the line is
> > terminated by LF or CR LF.
> 
> Note that when storing the CR in cs->respdata[0] for possible collapsing
> with a subsequent LF, the cbytes counter is left at 0, so the CR gets
> overwritten by the first character of the next response if there's no
> intervening LF.

Yes, I had to look at that for quite a while :-)

^ permalink raw reply

* [PATCH v3] skbuff: align sk_buff::cb to 64 bit and close some potential holes
From: Felix Fietkau @ 2010-02-23 21:45 UTC (permalink / raw)
  To: David Miller; +Cc: ddaney, eric.dumazet, netdev, buytenh
In-Reply-To: <20100212.121306.225788982.davem@davemloft.net>

The alignment requirement for 64-bit load/store instructions on ARM is
implementation defined. Some CPUs (such as Marvell Feroceon) do not
generate an exception, if such an instruction is executed with an
address that is not 64 bit aligned. In such a case, the Feroceon
corrupts adjacent memory, which showed up in my tests as a crash in the
rx path of ath9k that only occured with CONFIG_XFRM set.

This crash happened, because the first field of the mac80211 rx status
info in the cb is an u64, and changing it corrupted the skb->sp field.

This patch also closes some potential pre-existing holes in the sk_buff
struct surrounding the cb[] area.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
---
sorry that it took so long for me to post this, i completely forgot
about it, as I had other things to take care of ;)
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -315,22 +315,23 @@ struct sk_buff {
 	struct sk_buff		*next;
 	struct sk_buff		*prev;
 
-	struct sock		*sk;
 	ktime_t			tstamp;
+
+	struct sock		*sk;
 	struct net_device	*dev;
 
-	unsigned long		_skb_dst;
-#ifdef CONFIG_XFRM
-	struct	sec_path	*sp;
-#endif
 	/*
 	 * This is the control buffer. It is free to use for every
 	 * layer. Please put your private variables there. If you
 	 * want to keep them across layers you have to do a skb_clone()
 	 * first. This is owned by whoever has the skb queued ATM.
 	 */
-	char			cb[48];
+	char			cb[48] __aligned(8);
 
+	unsigned long		_skb_dst;
+#ifdef CONFIG_XFRM
+	struct	sec_path	*sp;
+#endif
 	unsigned int		len,
 				data_len;
 	__u16			mac_len,


^ permalink raw reply

* Re: [PATCH net-next 0/7] cxgb4 patches V2
From: David Miller @ 2010-02-23 22:40 UTC (permalink / raw)
  To: dm; +Cc: netdev
In-Reply-To: <4B842771.9000506@chelsio.com>

From: Dimitris Michailidis <dm@chelsio.com>
Date: Tue, 23 Feb 2010 11:07:29 -0800

> Can you please clarify what exactly you want me to change about the
> macros?  I looked at a few other drivers in the tree and I saw shift
> macros with _SHIFT or _SH suffixes, masks tend to have _MASK or _MSK
> suffixes, etc.  Are you asking me basically to change our S_, V_, etc
> prefixes to _SHIFT, etc suffixes or are we talking about some other
> kind of change?  Please bear with me, I am trying to understand what
> you're asking for exactly.

Yes.  Don't put things at the beginning, start with the register
name then add things at the end for shifts, masks, etc.

^ permalink raw reply

* Re: [PATCH 3/3] vhost: fix get_user_pages_fast error handling
From: David Miller @ 2010-02-23 22:42 UTC (permalink / raw)
  To: gleb
  Cc: mst, rusty, kvm, virtualization, netdev, linux-kernel, markmc,
	herbert.xu, quintela, dlaor, avi
In-Reply-To: <20100223173952.GC9834@redhat.com>


Just for the record I'm generally not interested in vhost
patches.

If it's a specific network one that will be merged via
the networking tree, yes please CC: me.

But if it's a bunch of changes to vhost.c and other pieces
of infrastructure, feel free to leave me out of it.  It just
clutters my already overflowing inbox.

Thanks.

^ permalink raw reply

* [net-next-2.6 PATCH 1/1] xfrm: clone mark when cloning policy
From: jamal @ 2010-02-23 23:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jamal Hadi Salim
In-Reply-To: <sk-mark-clone>

From: Jamal Hadi Salim <hadi@cyberus.ca>

When we clone the SP, we should also clone the mark.
Useful for socket based SPs.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
---
 net/xfrm/xfrm_policy.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 2a6e646..34a5ef8 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1154,6 +1154,7 @@ static struct xfrm_policy *clone_policy(struct xfrm_policy *old, int dir)
 		}
 		newp->lft = old->lft;
 		newp->curlft = old->curlft;
+		newp->mark = old->mark;
 		newp->action = old->action;
 		newp->flags = old->flags;
 		newp->xfrm_nr = old->xfrm_nr;
-- 
1.6.0.4


^ permalink raw reply related

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: jamal @ 2010-02-23 23:09 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Daniel Lezcano, Patrick McHardy, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear
In-Reply-To: <m1r5obbu2w.fsf@fess.ebiederm.org>

On Tue, 2010-02-23 at 12:00 -0800, Eric W. Biederman wrote:

> That point of the mount to hold a persistent reference to the
> namespace without using a process.
> 
> The point of the of the to be written set_ns call is to change
> the default network namespace of the process such that all future
> open/bind/socket calls happen in the referenced network namespace.

Ok, i like it ;-> Patches RSN? Let me if you want someone to test..

> The are a few stray places like sysfs where it is the mount point
> not current->nsproxy->net_ns that will determine what we see.

Is sysfs considered "usable enough" for namespaces?

> Attributes of the specific namespace?

Well, example what is being un/shared etc. 

cheers,
jamal



^ permalink raw reply

* Re: [net-next-2.6 PATCH 1/1] xfrm: clone mark when cloning policy
From: David Miller @ 2010-02-23 23:10 UTC (permalink / raw)
  To: hadi; +Cc: netdev
In-Reply-To: <1266966484-1750-1-git-send-email-hadi@cyberus.ca>

From: jamal <hadi@cyberus.ca>
Date: Tue, 23 Feb 2010 18:08:04 -0500

> From: Jamal Hadi Salim <hadi@cyberus.ca>
> 
> When we clone the SP, we should also clone the mark.
> Useful for socket based SPs.
> 
> Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] tg3: receive packets larger than MTU but smaller than 1500 bytes
From: Matt Carlson @ 2010-02-23 23:15 UTC (permalink / raw)
  To: Szilveszter Ordog
  Cc: Matthew Carlson, Michael Chan, netdev@vger.kernel.org,
	Ben Hutchings, Templin, Fred L
In-Reply-To: <ac67d9131002230356h7d293a5yba011698302f8c4a@mail.gmail.com>

This isn't such a good idea, is it?  The tg3 driver tries very hard to
configure the hardware to the requirements specified by they kernel.  If
you break that link, then you reduce the effectiveness of the hardware's
filtering based on packet size and you interfere with the hardware's
ability to tally oversized frames.

This patch also makes assumptions about how large the driver's internal
buffer sizes are.

I saw the conversation you had with Ben Hutchings and Fred Templin.
Perhaps it is better to first decide if we should decouple the tx MTU
from the rx MTU.  If everyone agrees to that, then we can work on
implementing a proper driver interface to describe our intentions.

On Tue, Feb 23, 2010 at 03:56:26AM -0800, Szilveszter Ordog wrote:
> This allows for proper ICMP needs fragmentation responses on standard Ethernet
> networks.
> 
> Signed-off-by: Szilveszter ?rd?g <slipszi@gmail.com>
> ---
>  drivers/net/tg3.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> index 46a3f86..0c5027b 100644
> --- a/drivers/net/tg3.c
> +++ b/drivers/net/tg3.c
> @@ -93,6 +93,8 @@
>  #define TG3_MIN_MTU			60
>  #define TG3_MAX_MTU(tp)	\
>  	((tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) ? 9000 : 1500)
> +#define TG3_MAX_RX_MTU(tp) \
> +	max(tp->dev->mtu, (unsigned int)ETH_DATA_LEN)
> 
>  /* These numbers seem to be hard coded in the NIC firmware somehow.
>   * You can't change the ring sizes, but you can change where you place
> @@ -4532,7 +4534,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
> 
>  		skb->protocol = eth_type_trans(skb, tp->dev);
> 
> -		if (len > (tp->dev->mtu + ETH_HLEN) &&
> +		if (len > (TG3_MAX_RX_MTU(tp) + ETH_HLEN) &&
>  		    skb->protocol != htons(ETH_P_8021Q)) {
>  			dev_kfree_skb(skb);
>  			goto next_pkt;
> @@ -6979,7 +6981,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
> 
>  	/* MTU + ethernet header + FCS + optional VLAN tag */
>  	tw32(MAC_RX_MTU_SIZE,
> -	     tp->dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
> +	     TG3_MAX_RX_MTU(tp) + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN);
> 
>  	/* The slot time is changed by tg3_setup_phy if we
>  	 * run at gigabit with half duplex.
> -- 
> 1.6.3.3
> 


^ permalink raw reply

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: Matt Helsley @ 2010-02-23 23:49 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: hadi, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear, Daniel Lezcano
In-Reply-To: <m1r5obbu2w.fsf@fess.ebiederm.org>

On Tue, Feb 23, 2010 at 12:00:55PM -0800, Eric W. Biederman wrote:
> jamal <hadi@cyberus.ca> writes:
> 
> > Added Daniel to the discussion..
> >
> > On Tue, 2010-02-23 at 06:07 -0800, Eric W. Biederman wrote:
> >> jamal <hadi@cyberus.ca> writes:
> >
> >> > Does the point after sys_setns(fd) allow me to do io inside
> >> > ns <name>? Can i do open() and get a fd from ns <name>?
> >> 
> >> Yes.  My intention is that current->nsproxy->net_ns be changed.
> >> We can already change it in unshare so this is feasible.
> >
> > I like it if it makes it as easy as it sounds;-> With lxc,
> > i essentially have to create a proxy process inside the
> > namespace that i use unix domain to open fds inside the ns.
> > Do i still need that?
> 
> That point of the mount to hold a persistent reference to the
> namespace without using a process.

I think technicaly it's still held using processes, only now it's
much more indirect:

netns <- mount <- mount namespace(s) <- process(es)

The big difference is we'd be waiting for all the processes
sharing that mount (or dups of it in multiple mount namespaces) to
exit too -- not just those sharing the netns.

Using a mount requires keeping names for the namespaces themselves
in the kernel which is a problem we've largely avoided so far.
The nscgroup is an example of the messes that creates, I think. And it
further complicates c/r -- we'd need to checkpoint and recreate the
names of the namespaces too. So we'll need a namespace for the names of
the namespaces to make restart reliable won't we? Makes my head spin...

Cheers,
	-Matt Helsley

^ permalink raw reply

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: Eric W. Biederman @ 2010-02-24  1:32 UTC (permalink / raw)
  To: Matt Helsley
  Cc: hadi, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear, Daniel Lezcano
In-Reply-To: <20100223234942.GO3604@count0.beaverton.ibm.com>

Matt Helsley <matthltc@us.ibm.com> writes:

> On Tue, Feb 23, 2010 at 12:00:55PM -0800, Eric W. Biederman wrote:
>> jamal <hadi@cyberus.ca> writes:
>> 
>> > Added Daniel to the discussion..
>> >
>> > On Tue, 2010-02-23 at 06:07 -0800, Eric W. Biederman wrote:
>> >> jamal <hadi@cyberus.ca> writes:
>> >
>> >> > Does the point after sys_setns(fd) allow me to do io inside
>> >> > ns <name>? Can i do open() and get a fd from ns <name>?
>> >> 
>> >> Yes.  My intention is that current->nsproxy->net_ns be changed.
>> >> We can already change it in unshare so this is feasible.
>> >
>> > I like it if it makes it as easy as it sounds;-> With lxc,
>> > i essentially have to create a proxy process inside the
>> > namespace that i use unix domain to open fds inside the ns.
>> > Do i still need that?
>> 
>> That point of the mount to hold a persistent reference to the
>> namespace without using a process.
>
> I think technicaly it's still held using processes, only now it's
> much more indirect:
>
> netns <- mount <- mount namespace(s) <- process(es)

True. The practical difference is that it doesn't require a dedicated
process which is a big improvement operationally.

> Using a mount requires keeping names for the namespaces themselves
> in the kernel which is a problem we've largely avoided so far.
> The nscgroup is an example of the messes that creates, I think. And it
> further complicates c/r -- we'd need to checkpoint and recreate the
> names of the namespaces too. So we'll need a namespace for the names of
> the namespaces to make restart reliable won't we? Makes my head spin...

This is strictly different.  It may require a bit of extra support from
checkpoint/restart because it introduces some more user visible objects
but the names themselves are nothing special.  The name that userspace
sees and deals with is the name of the mount point.  No new namespaces
are required.

Eric

^ permalink raw reply

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: Serge E. Hallyn @ 2010-02-24  1:39 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Matt Helsley, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear, Daniel Lezcano
In-Reply-To: <m18waj2zc8.fsf@fess.ebiederm.org>

Quoting Eric W. Biederman (ebiederm@xmission.com):
> Matt Helsley <matthltc@us.ibm.com> writes:
> 
> > On Tue, Feb 23, 2010 at 12:00:55PM -0800, Eric W. Biederman wrote:
> >> jamal <hadi@cyberus.ca> writes:
> >> 
> >> > Added Daniel to the discussion..
> >> >
> >> > On Tue, 2010-02-23 at 06:07 -0800, Eric W. Biederman wrote:
> >> >> jamal <hadi@cyberus.ca> writes:
> >> >
> >> >> > Does the point after sys_setns(fd) allow me to do io inside
> >> >> > ns <name>? Can i do open() and get a fd from ns <name>?
> >> >> 
> >> >> Yes.  My intention is that current->nsproxy->net_ns be changed.
> >> >> We can already change it in unshare so this is feasible.
> >> >
> >> > I like it if it makes it as easy as it sounds;-> With lxc,
> >> > i essentially have to create a proxy process inside the
> >> > namespace that i use unix domain to open fds inside the ns.
> >> > Do i still need that?
> >> 
> >> That point of the mount to hold a persistent reference to the
> >> namespace without using a process.
> >
> > I think technicaly it's still held using processes, only now it's
> > much more indirect:
> >
> > netns <- mount <- mount namespace(s) <- process(es)
> 
> True. The practical difference is that it doesn't require a dedicated
> process which is a big improvement operationally.
> 
> > Using a mount requires keeping names for the namespaces themselves
> > in the kernel which is a problem we've largely avoided so far.
> > The nscgroup is an example of the messes that creates, I think. And it
> > further complicates c/r -- we'd need to checkpoint and recreate the
> > names of the namespaces too. So we'll need a namespace for the names of
> > the namespaces to make restart reliable won't we? Makes my head spin...
> 
> This is strictly different.  It may require a bit of extra support from
> checkpoint/restart because it introduces some more user visible objects
> but the names themselves are nothing special.  The name that userspace
> sees and deals with is the name of the mount point.  No new namespaces
> are required.

Shouldn't be a big deal - assuming the mount is of a special type
for a network ns, we just record the objref for the checkpointed
network ns.  We don't need a namespace for the namespaces - we just
need unique names for the checkpoint image (the objref, which is
unique per netns).

Guess it really is about time that i work on some clean patches
for checkpoint/restart of mounts namespaces and mounts.

-serge

^ permalink raw reply

* Re: RFC: netfilter: nf_conntrack: add support for "conntrack zones"
From: Eric W. Biederman @ 2010-02-24  1:43 UTC (permalink / raw)
  To: hadi
  Cc: Daniel Lezcano, Patrick McHardy, Linux Netdev List, containers,
	Netfilter Development Mailinglist, Ben Greear
In-Reply-To: <1266966581.3973.675.camel@bigi>

jamal <hadi@cyberus.ca> writes:

> On Tue, 2010-02-23 at 12:00 -0800, Eric W. Biederman wrote:
>
>> That point of the mount to hold a persistent reference to the
>> namespace without using a process.
>> 
>> The point of the of the to be written set_ns call is to change
>> the default network namespace of the process such that all future
>> open/bind/socket calls happen in the referenced network namespace.
>
> Ok, i like it ;-> Patches RSN? Let me if you want someone to test..

My target will be 2.6.35.   There is an old prototype implementation
that hit the containers list and I think netdev a year or so ago.

>> The are a few stray places like sysfs where it is the mount point
>> not current->nsproxy->net_ns that will determine what we see.
>
> Is sysfs considered "usable enough" for namespaces?

Mine is ;) I had a bad cold and didn't get through all of the patches
this development cycle, just all the prereqs.  I plan on getting that
final conversation started for as soon as 2.6.34-rc1 hits.

>> Attributes of the specific namespace?
>
> Well, example what is being un/shared etc. 

Got it.  Implementation wise I'm going to stash a pointer
to the namespace in a inode or super block, simple.

Eric

^ permalink raw reply

* Re: [PATCH net-next 0/7] drivers/net conversions to netdev_<level>, etc
From: Jeff Kirsher @ 2010-02-24  2:33 UTC (permalink / raw)
  To: Joe Perches
  Cc: e1000-devel, netdev, Bruce Allan, Jesse Brandeburg, linux-kernel,
	John Ronciak, Brice Goglin, Andrew Gallatin, David Miller
In-Reply-To: <cover.1266893507.git.joe@perches.com>

On Mon, Feb 22, 2010 at 18:56, Joe Perches <joe@perches.com> wrote:
> Some more conversions of drivers to:
>
>    netif_<level>
>    netdev_<level>
>    pr_<level>
>
> with some other minor updates/corrections
> noticed during conversions.
>
> Joe Perches (7):
>  drivers/net/chelsio: Use pr_<level>, netif_msg_<type>
>  drivers/net/myri10ge: Use pr_<level> and netdev_<level>
>  drivers/net/ixgbe: Use pr_<level> and netif_<level>
>  drivers/net/ixgb: Use pr_<level> and netdev_<level>
>  drivers/net/e1000: Use pr_<level> and netif_<level>
>  drivers/net/e1000e: Use pr_<level> and netdev_<level>
>  drivers/net/igb: Use netdev_<level>
>
>  drivers/net/chelsio/common.h      |   24 +--
>  drivers/net/chelsio/cxgb2.c       |   18 +-
>  drivers/net/chelsio/espi.c        |    4 +-
>  drivers/net/chelsio/pm3393.c      |   16 +-
>  drivers/net/chelsio/sge.c         |   10 +-
>  drivers/net/chelsio/subr.c        |   32 ++--
>  drivers/net/chelsio/vsc7326.c     |   24 ++--
>  drivers/net/e1000/e1000.h         |   17 --
>  drivers/net/e1000/e1000_ethtool.c |   38 ++--
>  drivers/net/e1000/e1000_hw.c      |  383 ++++++++++++++++++-------------------
>  drivers/net/e1000/e1000_main.c    |  272 +++++++++++++-------------
>  drivers/net/e1000/e1000_osdep.h   |   14 +--
>  drivers/net/e1000/e1000_param.c   |  121 +++++++------
>  drivers/net/e1000e/82571.c        |   57 ++++--
>  drivers/net/e1000e/e1000.h        |   21 --
>  drivers/net/e1000e/es2lan.c       |   27 ++--
>  drivers/net/e1000e/ethtool.c      |   37 ++--
>  drivers/net/e1000e/ich8lan.c      |   90 +++++----
>  drivers/net/e1000e/lib.c          |  131 +++++++-------
>  drivers/net/e1000e/netdev.c       |   95 +++++-----
>  drivers/net/e1000e/param.c        |   20 +-
>  drivers/net/e1000e/phy.c          |  114 ++++++------
>  drivers/net/igb/e1000_82575.c     |   58 +++---
>  drivers/net/igb/e1000_hw.h        |   12 +-
>  drivers/net/igb/e1000_mac.c       |   84 ++++----
>  drivers/net/igb/e1000_nvm.c       |   22 +-
>  drivers/net/igb/e1000_phy.c       |  104 +++++-----
>  drivers/net/igb/igb.h             |    1 -
>  drivers/net/igb/igb_ethtool.c     |    6 +-
>  drivers/net/igb/igb_main.c        |   43 ++---
>  drivers/net/ixgb/ixgb.h           |    8 +-
>  drivers/net/ixgb/ixgb_ee.c        |   14 +-
>  drivers/net/ixgb/ixgb_hw.c        |  147 ++++++---------
>  drivers/net/ixgb/ixgb_hw.h        |   12 --
>  drivers/net/ixgb/ixgb_main.c      |   33 ++--
>  drivers/net/ixgb/ixgb_osdep.h     |   16 +--
>  drivers/net/ixgb/ixgb_param.c     |   31 ++--
>  drivers/net/ixgbe/ixgbe.h         |    6 -
>  drivers/net/ixgbe/ixgbe_common.h  |   15 +-
>  drivers/net/ixgbe/ixgbe_dcb_nl.c  |    5 +-
>  drivers/net/ixgbe/ixgbe_ethtool.c |   40 +++--
>  drivers/net/ixgbe/ixgbe_fcoe.c    |   25 ++--
>  drivers/net/ixgbe/ixgbe_main.c    |  110 +++++------
>  drivers/net/ixgbe/ixgbe_phy.c     |    2 +
>  drivers/net/ixgbe/ixgbe_sriov.c   |   11 +-
>  drivers/net/myri10ge/myri10ge.c   |  183 +++++++-----------
>  46 files changed, 1202 insertions(+), 1351 deletions(-)
>

I have applied patches 3-7 (the patches to Intel drivers) to my queue
of patches for review and testing.

-- 
Cheers,
Jeff

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply

* [GIT]: Networking
From: David Miller @ 2010-02-24  3:13 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Wireless fixes from Linville and co. in particular an
   iwlwifi tfd freeing issue that many people are likely to hit.

2) GRO handling uses napi->dev when it should use skb->dev,
   breaking VLAN + GRO.  Fix from Ajit Khaparde.

3) Make IPV6 max_addresses sysctl documentation clearer.

4) Add new device ID to cdc_ether, from Torgny Johansson.

5) tc35815 double netif_wake_queue()s, triggering a BUG().
   Fix from Atsushi Nemoto.

6) DMA mapping error handlng on RX in e1000 driver crashes under
   load.  Fix from Anton Blanchard.

7) MAINTAINERS update for mv643xx_eth.

Please pull, thanks a lot!

The following changes since commit be64c970f601d5bb439b6cc88ea2bd208b3422a0:
  Linus Torvalds (1):
        Merge branch 'release' of git://git.kernel.org/.../lenb/linux-acpi-2.6

are available in the git repository at:

  master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master

Ajit Khaparde (1):
      net: bug fix for vlan + gro issue

Anton Blanchard (1):
      e1000: Fix DMA mapping error handling on RX

Atsushi Nemoto (1):
      tc35815: Remove a wrong netif_wake_queue() call which triggers BUG_ON

Brian Haley (1):
      IPv6: better document max_addresses parameter

Dan Halperin (1):
      iwlwifi: set HT flags after channel in rxon

David S. Miller (1):
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6

Lennert Buytenhek (1):
      MAINTAINERS: update mv643xx_eth maintenance status

Stanislaw Gruszka (1):
      iwlwifi: sanity check before counting number of tfds can be free

Torgny Johansson (1):
      cdc_ether: new PID for Ericsson C3607w to the whitelist (resubmit)

Wey-Yi Guy (1):
      iwlwifi: error checking for number of tfds in queue

 Documentation/networking/ip-sysctl.txt  |    8 ++++----
 MAINTAINERS                             |    4 ++--
 drivers/net/e1000/e1000_main.c          |   19 ++++++++++++++++++-
 drivers/net/tc35815.c                   |    1 -
 drivers/net/usb/cdc_ether.c             |    5 +++++
 drivers/net/wireless/iwlwifi/iwl-4965.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c |    8 +++-----
 drivers/net/wireless/iwlwifi/iwl-core.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-core.h |    2 ++
 drivers/net/wireless/iwlwifi/iwl-tx.c   |   22 ++++++++++++++++++++--
 net/core/dev.c                          |    2 +-
 11 files changed, 57 insertions(+), 18 deletions(-)

^ permalink raw reply

* linux-next: manual merge of the trivial tree with the net tree
From: Stephen Rothwell @ 2010-02-24  5:21 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: linux-next, linux-kernel, Adam Buchbinder, Joe Perches,
	David Miller, netdev

Hi Jiri,

Today's linux-next merge of the trivial tree got a conflict in
drivers/net/typhoon.c between commit
0bc88e4af07621bc4b84477374745d01a470e85d ("drivers/net/typhoon.c: Use (pr|
netdev)_<level> macro helpers") from the net tree and commit
a089377f29d3af0f62f3bdc6db0c5042513fc3f3 ("Fix misspelling of "truly" in
a label") from the trivial tree.

Just context changes.  I fixed it up (see below) and can carry the fix as
necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/net/typhoon.c
index 38c2161,d1a8068..0000000
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@@ -2098,8 -2111,9 +2098,8 @@@ typhoon_tx_timeout(struct net_device *d
  	struct typhoon *tp = netdev_priv(dev);
  
  	if(typhoon_reset(tp->ioaddr, WaitNoSleep) < 0) {
 -		printk(KERN_WARNING "%s: could not reset in tx timeout\n",
 -					dev->name);
 +		netdev_warn(dev, "could not reset in tx timeout\n");
- 		goto truely_dead;
+ 		goto truly_dead;
  	}
  
  	/* If we ever start using the Hi ring, it will need cleaning too */
@@@ -2107,8 -2121,9 +2107,8 @@@
  	typhoon_free_rx_rings(tp);
  
  	if(typhoon_start_runtime(tp) < 0) {
 -		printk(KERN_ERR "%s: could not start runtime in tx timeout\n",
 -					dev->name);
 +		netdev_err(dev, "could not start runtime in tx timeout\n");
- 		goto truely_dead;
+ 		goto truly_dead;
          }
  
  	netif_wake_queue(dev);

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox