Netdev List
 help / color / mirror / Atom feed
* [patch 10/10] e1000: fix media_type <-> phy_type thinko
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff; +Cc: linville, netdev, akpm, willy, jesse.brandeburg, john.ronciak


From: Willy TARREAU <willy@w.ods.org>

Recent patch cb764326dff0ee51aca0d450e1a292de65661055 introduced a thinko
in e1000_main.c : e1000_media_type_copper is compared to hw.phy_type
instead of hw.media_type.  Original patch proposed by Jesse Brandeburg was
correct, but what has been merged is not.

Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: "Ronciak, John" <john.ronciak@intel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/e1000/e1000_main.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/net/e1000/e1000_main.c~e1000-fix-media_type-phy_type-thinko drivers/net/e1000/e1000_main.c
--- devel/drivers/net/e1000/e1000_main.c~e1000-fix-media_type-phy_type-thinko	2006-04-17 21:42:32.000000000 -0700
+++ devel-akpm/drivers/net/e1000/e1000_main.c	2006-04-17 21:43:30.000000000 -0700
@@ -4195,7 +4195,7 @@ e1000_mii_ioctl(struct net_device *netde
 			spin_unlock_irqrestore(&adapter->stats_lock, flags);
 			return -EIO;
 		}
-		if (adapter->hw.phy_type == e1000_media_type_copper) {
+		if (adapter->hw.media_type == e1000_media_type_copper) {
 			switch (data->reg_num) {
 			case PHY_CTRL:
 				if (mii_reg & MII_CR_POWER_DOWN)
_

^ permalink raw reply

* [patch 08/10] bcm43xx: sysfs code cleanup
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff; +Cc: linville, netdev, akpm, mb, greg


From: Michael Buesch <mb@bu3sch.de>

This cleans up the bcm43xx sysfs code and makes it compliant with the
unwritten sysfs rules (at least I hope so).

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/wireless/bcm43xx/bcm43xx.h       |   17 ++
 drivers/net/wireless/bcm43xx/bcm43xx_main.c  |    1 
 drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c |  115 +++++++++--------
 drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h |   16 --
 4 files changed, 82 insertions(+), 67 deletions(-)

diff -puN drivers/net/wireless/bcm43xx/bcm43xx.h~bcm43xx-sysfs-code-cleanup drivers/net/wireless/bcm43xx/bcm43xx.h
--- devel/drivers/net/wireless/bcm43xx/bcm43xx.h~bcm43xx-sysfs-code-cleanup	2006-04-12 18:11:12.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx.h	2006-04-12 18:11:12.000000000 -0700
@@ -15,7 +15,6 @@
 
 #include "bcm43xx_debugfs.h"
 #include "bcm43xx_leds.h"
-#include "bcm43xx_sysfs.h"
 
 
 #define PFX				KBUILD_MODNAME ": "
@@ -638,8 +637,6 @@ struct bcm43xx_key {
 };
 
 struct bcm43xx_private {
-	struct bcm43xx_sysfs sysfs;
-
 	struct ieee80211_device *ieee;
 	struct ieee80211softmac_device *softmac;
 
@@ -772,6 +769,20 @@ struct bcm43xx_private * bcm43xx_priv(st
 	return ieee80211softmac_priv(dev);
 }
 
+struct device;
+
+static inline
+struct bcm43xx_private * dev_to_bcm(struct device *dev)
+{
+	struct net_device *net_dev;
+	struct bcm43xx_private *bcm;
+
+	net_dev = dev_get_drvdata(dev);
+	bcm = bcm43xx_priv(net_dev);
+
+	return bcm;
+}
+
 
 /* Helper function, which returns a boolean.
  * TRUE, if PIO is used; FALSE, if DMA is used.
diff -puN drivers/net/wireless/bcm43xx/bcm43xx_main.c~bcm43xx-sysfs-code-cleanup drivers/net/wireless/bcm43xx/bcm43xx_main.c
--- devel/drivers/net/wireless/bcm43xx/bcm43xx_main.c~bcm43xx-sysfs-code-cleanup	2006-04-12 18:11:12.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_main.c	2006-04-12 18:11:12.000000000 -0700
@@ -52,6 +52,7 @@
 #include "bcm43xx_wx.h"
 #include "bcm43xx_ethtool.h"
 #include "bcm43xx_xmit.h"
+#include "bcm43xx_sysfs.h"
 
 
 MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver");
diff -puN drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c~bcm43xx-sysfs-code-cleanup drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
--- devel/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c~bcm43xx-sysfs-code-cleanup	2006-04-12 18:11:12.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c	2006-04-12 18:11:12.000000000 -0700
@@ -71,14 +71,46 @@ static int get_boolean(const char *buf, 
 	return -EINVAL;
 }
 
+static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len)
+{
+	int i, pos = 0;
+
+	for (i = 0; i < BCM43xx_SPROM_SIZE; i++) {
+		pos += snprintf(buf + pos, buf_len - pos - 1,
+				"%04X", swab16(sprom[i]) & 0xFFFF);
+	}
+	pos += snprintf(buf + pos, buf_len - pos - 1, "\n");
+
+	return pos + 1;
+}
+
+static int hex2sprom(u16 *sprom, const char *dump, size_t len)
+{
+	char tmp[5] = { 0 };
+	int cnt = 0;
+	unsigned long parsed;
+
+	if (len < BCM43xx_SPROM_SIZE * sizeof(u16) * 2)
+		return -EINVAL;
+
+	while (cnt < BCM43xx_SPROM_SIZE) {
+		memcpy(tmp, dump, 4);
+		dump += 4;
+		parsed = simple_strtoul(tmp, NULL, 16);
+		sprom[cnt++] = swab16((u16)parsed);
+	}
+
+	return 0;
+}
+
 static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
 				       struct device_attribute *attr,
 				       char *buf)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	u16 *sprom;
 	unsigned long flags;
-	int i, err;
+	int err;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
@@ -91,55 +123,53 @@ static ssize_t bcm43xx_attr_sprom_show(s
 	bcm43xx_lock_mmio(bcm, flags);
 	assert(bcm->initialized);
 	err = bcm43xx_sprom_read(bcm, sprom);
-	if (!err) {
-		for (i = 0; i < BCM43xx_SPROM_SIZE; i++) {
-			buf[i * 2] = sprom[i] & 0x00FF;
-			buf[i * 2 + 1] = (sprom[i] & 0xFF00) >> 8;
-		}
-	}
+	if (!err)
+		err = sprom2hex(sprom, buf, PAGE_SIZE);
 	bcm43xx_unlock_mmio(bcm, flags);
 	kfree(sprom);
 
-	return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16);
+	return err;
 }
 
 static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
 					struct device_attribute *attr,
 					const char *buf, size_t count)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	u16 *sprom;
 	unsigned long flags;
-	int i, err;
+	int err;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
 
-	if (count != BCM43xx_SPROM_SIZE * sizeof(u16))
-		return -EINVAL;
 	sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom),
 			GFP_KERNEL);
 	if (!sprom)
 		return -ENOMEM;
-	for (i = 0; i < BCM43xx_SPROM_SIZE; i++) {
-		sprom[i] = buf[i * 2] & 0xFF;
-		sprom[i] |= ((u16)(buf[i * 2 + 1] & 0xFF)) << 8;
-	}
+	err = hex2sprom(sprom, buf, count);
+	if (err)
+		goto out_kfree;
 	bcm43xx_lock_mmio(bcm, flags);
 	assert(bcm->initialized);
 	err = bcm43xx_sprom_write(bcm, sprom);
 	bcm43xx_unlock_mmio(bcm, flags);
+out_kfree:
 	kfree(sprom);
 
 	return err ? err : count;
 
 }
 
+static DEVICE_ATTR(sprom, 0600,
+		   bcm43xx_attr_sprom_show,
+		   bcm43xx_attr_sprom_store);
+
 static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
 					    struct device_attribute *attr,
 					    char *buf)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	unsigned long flags;
 	int err;
 	ssize_t count = 0;
@@ -175,7 +205,7 @@ static ssize_t bcm43xx_attr_interfmode_s
 					     struct device_attribute *attr,
 					     const char *buf, size_t count)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	unsigned long flags;
 	int err;
 	int mode;
@@ -215,11 +245,15 @@ static ssize_t bcm43xx_attr_interfmode_s
 	return err ? err : count;
 }
 
+static DEVICE_ATTR(interference, 0644,
+		   bcm43xx_attr_interfmode_show,
+		   bcm43xx_attr_interfmode_store);
+
 static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	unsigned long flags;
 	int err;
 	ssize_t count;
@@ -245,7 +279,7 @@ static ssize_t bcm43xx_attr_preamble_sto
 					   struct device_attribute *attr,
 					   const char *buf, size_t count)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	unsigned long flags;
 	int err;
 	int value;
@@ -267,56 +301,41 @@ static ssize_t bcm43xx_attr_preamble_sto
 	return err ? err : count;
 }
 
+static DEVICE_ATTR(shortpreamble, 0644,
+		   bcm43xx_attr_preamble_show,
+		   bcm43xx_attr_preamble_store);
+
 int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
 {
 	struct device *dev = &bcm->pci_dev->dev;
-	struct bcm43xx_sysfs *sysfs = &bcm->sysfs;
 	int err;
 
 	assert(bcm->initialized);
 
-	sysfs->attr_sprom.attr.name = "sprom";
-	sysfs->attr_sprom.attr.owner = THIS_MODULE;
-	sysfs->attr_sprom.attr.mode = 0600;
-	sysfs->attr_sprom.show = bcm43xx_attr_sprom_show;
-	sysfs->attr_sprom.store = bcm43xx_attr_sprom_store;
-	err = device_create_file(dev, &sysfs->attr_sprom);
+	err = device_create_file(dev, &dev_attr_sprom);
 	if (err)
 		goto out;
-
-	sysfs->attr_interfmode.attr.name = "interference";
-	sysfs->attr_interfmode.attr.owner = THIS_MODULE;
-	sysfs->attr_interfmode.attr.mode = 0600;
-	sysfs->attr_interfmode.show = bcm43xx_attr_interfmode_show;
-	sysfs->attr_interfmode.store = bcm43xx_attr_interfmode_store;
-	err = device_create_file(dev, &sysfs->attr_interfmode);
+	err = device_create_file(dev, &dev_attr_interference);
 	if (err)
 		goto err_remove_sprom;
-
-	sysfs->attr_preamble.attr.name = "shortpreamble";
-	sysfs->attr_preamble.attr.owner = THIS_MODULE;
-	sysfs->attr_preamble.attr.mode = 0600;
-	sysfs->attr_preamble.show = bcm43xx_attr_preamble_show;
-	sysfs->attr_preamble.store = bcm43xx_attr_preamble_store;
-	err = device_create_file(dev, &sysfs->attr_preamble);
+	err = device_create_file(dev, &dev_attr_shortpreamble);
 	if (err)
 		goto err_remove_interfmode;
 
 out:
 	return err;
 err_remove_interfmode:
-	device_remove_file(dev, &sysfs->attr_interfmode);
+	device_remove_file(dev, &dev_attr_interference);
 err_remove_sprom:
-	device_remove_file(dev, &sysfs->attr_sprom);
+	device_remove_file(dev, &dev_attr_sprom);
 	goto out;
 }
 
 void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm)
 {
 	struct device *dev = &bcm->pci_dev->dev;
-	struct bcm43xx_sysfs *sysfs = &bcm->sysfs;
 
-	device_remove_file(dev, &sysfs->attr_preamble);
-	device_remove_file(dev, &sysfs->attr_interfmode);
-	device_remove_file(dev, &sysfs->attr_sprom);
+	device_remove_file(dev, &dev_attr_shortpreamble);
+	device_remove_file(dev, &dev_attr_interference);
+	device_remove_file(dev, &dev_attr_sprom);
 }
diff -puN drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h~bcm43xx-sysfs-code-cleanup drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h
--- devel/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h~bcm43xx-sysfs-code-cleanup	2006-04-12 18:11:12.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h	2006-04-12 18:11:12.000000000 -0700
@@ -1,22 +1,6 @@
 #ifndef BCM43xx_SYSFS_H_
 #define BCM43xx_SYSFS_H_
 
-#include <linux/device.h>
-
-
-struct bcm43xx_sysfs {
-	struct device_attribute attr_sprom;
-	struct device_attribute attr_interfmode;
-	struct device_attribute attr_preamble;
-};
-
-#define devattr_to_bcm(attr, attr_name)	({				\
-	struct bcm43xx_sysfs *__s; struct bcm43xx_private *__p;		\
-	__s = container_of((attr), struct bcm43xx_sysfs, attr_name);	\
-	__p = container_of(__s, struct bcm43xx_private, sysfs);		\
-	__p;								\
-					})
-
 struct bcm43xx_private;
 
 int bcm43xx_sysfs_register(struct bcm43xx_private *bcm);
_

^ permalink raw reply

* [patch 06/10] e100: disable interrupts at boot
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff
  Cc: linville, netdev, akpm, bjorn.helgaas, jeffrey.t.kirsher,
	jesse.brandeburg, john.ronciak, nils.rennebarth, stern


From: Bjorn Helgaas <bjorn.helgaas@hp.com>

Apparently the Intel PRO/100 device enables interrupts on reset.  Unless
firmware explicitly disables PRO/100 interrupts, we can get a flood of
interrupts when a driver attaches to an unrelated device that happens to
share the PRO/100 IRQ.

This should resolve this "irq 11: nobody cared" bug report:
    http://bugzilla.kernel.org/show_bug.cgi?id=5918

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: John Ronciak <john.ronciak@intel.com>
Cc: <stern@rowland.harvard.edu>
Cc: <nils.rennebarth@packetalarm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/pci/quirks.c |   57 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+)

diff -puN drivers/pci/quirks.c~e100-disable-interrupts-at-boot drivers/pci/quirks.c
--- devel/drivers/pci/quirks.c~e100-disable-interrupts-at-boot	2006-04-14 23:41:34.000000000 -0700
+++ devel-akpm/drivers/pci/quirks.c	2006-04-14 23:41:34.000000000 -0700
@@ -1374,6 +1374,63 @@ static void __devinit quirk_netmos(struc
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
 
+static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
+{
+	u16 command;
+	u32 bar;
+	u8 __iomem *csr;
+	u8 cmd_hi;
+
+	switch (dev->device) {
+	/* PCI IDs taken from drivers/net/e100.c */
+	case 0x1029:
+	case 0x1030 ... 0x1034:
+	case 0x1038 ... 0x103E:
+	case 0x1050 ... 0x1057:
+	case 0x1059:
+	case 0x1064 ... 0x106B:
+	case 0x1091 ... 0x1095:
+	case 0x1209:
+	case 0x1229:
+	case 0x2449:
+	case 0x2459:
+	case 0x245D:
+	case 0x27DC:
+		break;
+	default:
+		return;
+	}
+
+	/*
+	 * Some firmware hands off the e100 with interrupts enabled,
+	 * which can cause a flood of interrupts if packets are
+	 * received before the driver attaches to the device.  So
+	 * disable all e100 interrupts here.  The driver will
+	 * re-enable them when it's ready.
+	 */
+	pci_read_config_word(dev, PCI_COMMAND, &command);
+	pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar);
+
+	if (!(command & PCI_COMMAND_MEMORY) || !bar)
+		return;
+
+	csr = ioremap(bar, 8);
+	if (!csr) {
+		printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
+			pci_name(dev));
+		return;
+	}
+
+	cmd_hi = readb(csr + 3);
+	if (cmd_hi == 0) {
+		printk(KERN_WARNING "PCI: Firmware left %s e100 interrupts "
+			"enabled, disabling\n", pci_name(dev));
+		writeb(1, csr + 3);
+	}
+
+	iounmap(csr);
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
 
 static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
 {
_

^ permalink raw reply

* [patch 07/10] forcedeth: suggested cleanups
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff; +Cc: linville, netdev, akpm, ioe-lkml, manfred


From: Ingo Oeser <ioe-lkml@rameria.de>

general:
	- endian annotation of the ring descriptors

nv_getlen():
	- use htons() instead of __constant_htons()
          to improvde readability and let the compiler constant fold it.

nv_rx_process():
	- use a real for() loop in processing instead of goto and break
	- consolidate rx_errors increment
	- count detected rx_length_errors

Signed-off-by: Ingo Oeser <ioe-lkml@rameria.de>
Cc: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/forcedeth.c |   59 ++++++++++++++++----------------------
 1 files changed, 26 insertions(+), 33 deletions(-)

diff -puN drivers/net/forcedeth.c~forcedeth-suggested-cleanups drivers/net/forcedeth.c
--- devel/drivers/net/forcedeth.c~forcedeth-suggested-cleanups	2006-04-10 23:21:26.000000000 -0700
+++ devel-akpm/drivers/net/forcedeth.c	2006-04-10 23:21:26.000000000 -0700
@@ -328,17 +328,18 @@ enum {
 	NvRegMSIXIrqStatus = 0x3f0,
 };
 
-/* Big endian: should work, but is untested */
+/* Big endian: should work, but is untested.
+ * So give arch maintainers a hint here. -ioe */
 struct ring_desc {
-	u32 PacketBuffer;
-	u32 FlagLen;
+	__le32 PacketBuffer;
+	__le32 FlagLen;
 };
 
 struct ring_desc_ex {
-	u32 PacketBufferHigh;
-	u32 PacketBufferLow;
-	u32 TxVlan;
-	u32 FlagLen;
+	__le32 PacketBufferHigh;
+	__le32 PacketBufferLow;
+	__le32 TxVlan;
+	__le32 FlagLen;
 };
 
 typedef union _ring_type {
@@ -1403,7 +1404,7 @@ static int nv_getlen(struct net_device *
 	int protolen;	/* length as stored in the proto field */
 
 	/* 1) calculate len according to header */
-	if ( ((struct vlan_ethhdr *)packet)->h_vlan_proto == __constant_htons(ETH_P_8021Q)) {
+	if (((struct vlan_ethhdr *)packet)->h_vlan_proto == htons(ETH_P_8021Q)) {
 		protolen = ntohs( ((struct vlan_ethhdr *)packet)->h_vlan_encapsulated_proto );
 		hdrlen = VLAN_HLEN;
 	} else {
@@ -1453,12 +1454,10 @@ static void nv_rx_process(struct net_dev
 	u32 vlanflags = 0;
 
 
-	for (;;) {
+	for (; np->cur_rx - np->refill_rx < RX_RING; np->cur_rx++) {
 		struct sk_buff *skb;
 		int len;
 		int i;
-		if (np->cur_rx - np->refill_rx >= RX_RING)
-			break;	/* we scanned the whole ring - do not continue */
 
 		i = np->cur_rx % RX_RING;
 		if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
@@ -1498,33 +1497,29 @@ static void nv_rx_process(struct net_dev
 		/* look at what we actually got: */
 		if (np->desc_ver == DESC_VER_1) {
 			if (!(Flags & NV_RX_DESCRIPTORVALID))
-				goto next_pkt;
+				continue;
 
 			if (Flags & NV_RX_ERROR) {
 				if (Flags & NV_RX_MISSEDFRAME) {
 					np->stats.rx_missed_errors++;
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) {
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX_CRCERR) {
 					np->stats.rx_crc_errors++;
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX_OVERFLOW) {
 					np->stats.rx_over_errors++;
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX_ERROR4) {
 					len = nv_getlen(dev, np->rx_skbuff[i]->data, len);
 					if (len < 0) {
-						np->stats.rx_errors++;
-						goto next_pkt;
+						np->stats.rx_length_errors++;
+						goto error_pkt;
 					}
 				}
 				/* framing errors are soft errors. */
@@ -1536,28 +1531,25 @@ static void nv_rx_process(struct net_dev
 			}
 		} else {
 			if (!(Flags & NV_RX2_DESCRIPTORVALID))
-				goto next_pkt;
+				continue;
 
 			if (Flags & NV_RX2_ERROR) {
 				if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) {
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX2_CRCERR) {
 					np->stats.rx_crc_errors++;
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX2_OVERFLOW) {
 					np->stats.rx_over_errors++;
-					np->stats.rx_errors++;
-					goto next_pkt;
+					goto error_pkt;
 				}
 				if (Flags & NV_RX2_ERROR4) {
 					len = nv_getlen(dev, np->rx_skbuff[i]->data, len);
 					if (len < 0) {
-						np->stats.rx_errors++;
-						goto next_pkt;
+						np->stats.rx_length_errors++;
+						goto error_pkt;
 					}
 				}
 				/* framing errors are soft errors */
@@ -1593,8 +1585,9 @@ static void nv_rx_process(struct net_dev
 		dev->last_rx = jiffies;
 		np->stats.rx_packets++;
 		np->stats.rx_bytes += len;
-next_pkt:
-		np->cur_rx++;
+		continue;
+error_pkt:
+		np->stats.rx_errors++;
 	}
 }
 
_

^ permalink raw reply

* [patch 09/10] bcm43xx: fix pctl slowclock limit calculation
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff; +Cc: linville, netdev, akpm, mb


From: Michael Buesch <mb@bu3sch.de>

This fixes coverity bug:
http://marc.theaimsgroup.com/?l=linux-netdev&m=114417628413880&w=2

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/wireless/bcm43xx/bcm43xx_power.c |  115 ++++++++++-------
 drivers/net/wireless/bcm43xx/bcm43xx_power.h |    9 +
 2 files changed, 77 insertions(+), 47 deletions(-)

diff -puN drivers/net/wireless/bcm43xx/bcm43xx_power.c~bcm43xx-fix-pctl-slowclock-limit-calculation drivers/net/wireless/bcm43xx/bcm43xx_power.c
--- devel/drivers/net/wireless/bcm43xx/bcm43xx_power.c~bcm43xx-fix-pctl-slowclock-limit-calculation	2006-04-12 18:12:22.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_power.c	2006-04-12 18:12:22.000000000 -0700
@@ -35,77 +35,101 @@
 #include "bcm43xx_main.h"
 
 
+/* Get the Slow Clock Source */
+static int bcm43xx_pctl_get_slowclksrc(struct bcm43xx_private *bcm)
+{
+	u32 tmp;
+	int err;
+
+	assert(bcm->current_core == &bcm->core_chipcommon);
+	if (bcm->current_core->rev < 6) {
+		if (bcm->bustype == BCM43xx_BUSTYPE_PCMCIA ||
+		    bcm->bustype == BCM43xx_BUSTYPE_SB)
+			return BCM43xx_PCTL_CLKSRC_XTALOS;
+		if (bcm->bustype == BCM43xx_BUSTYPE_PCI) {
+			err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp);
+			assert(!err);
+			if (tmp & 0x10)
+				return BCM43xx_PCTL_CLKSRC_PCI;
+			return BCM43xx_PCTL_CLKSRC_XTALOS;
+		}
+	}
+	if (bcm->current_core->rev < 10) {
+		tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL);
+		tmp &= 0x7;
+		if (tmp == 0)
+			return BCM43xx_PCTL_CLKSRC_LOPWROS;
+		if (tmp == 1)
+			return BCM43xx_PCTL_CLKSRC_XTALOS;
+		if (tmp == 2)
+			return BCM43xx_PCTL_CLKSRC_PCI;
+	}
+
+	return BCM43xx_PCTL_CLKSRC_XTALOS;
+}
+
 /* Get max/min slowclock frequency
  * as described in http://bcm-specs.sipsolutions.net/PowerControl
  */
 static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm,
 				       int get_max)
 {
-	int limit = 0;
+	int limit;
+	int clocksrc;
 	int divisor;
-	int selection;
-	int err;
 	u32 tmp;
-	struct bcm43xx_coreinfo *old_core;
 
-	if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL))
-		goto out;
-	old_core = bcm->current_core;
-	err = bcm43xx_switch_core(bcm, &bcm->core_chipcommon);
-	if (err)
-		goto out;
+	assert(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL);
+	assert(bcm->current_core == &bcm->core_chipcommon);
 
+	clocksrc = bcm43xx_pctl_get_slowclksrc(bcm);
 	if (bcm->current_core->rev < 6) {
-		if ((bcm->bustype == BCM43xx_BUSTYPE_PCMCIA) ||
-			(bcm->bustype == BCM43xx_BUSTYPE_SB)) {
-			selection = 1;
+		switch (clocksrc) {
+		case BCM43xx_PCTL_CLKSRC_PCI:
+			divisor = 64;
+			break;
+		case BCM43xx_PCTL_CLKSRC_XTALOS:
 			divisor = 32;
-		} else {
-			err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp);
-			if (err) {
-				printk(KERN_ERR PFX "clockfreqlimit pcicfg read failure\n");
-				goto out_switchback;
-			}
-			if (tmp & 0x10) {
-				/* PCI */
-				selection = 2;
-				divisor = 64;
-			} else {
-				/* XTAL */
-				selection = 1;
-				divisor = 32;
-			}
+			break;
+		default:
+			assert(0);
+			divisor = 1;
 		}
 	} else if (bcm->current_core->rev < 10) {
-		selection = (tmp & 0x07);
-		if (selection) {
+		switch (clocksrc) {
+		case BCM43xx_PCTL_CLKSRC_LOPWROS:
+			divisor = 1;
+			break;
+		case BCM43xx_PCTL_CLKSRC_XTALOS:
+		case BCM43xx_PCTL_CLKSRC_PCI:
 			tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL);
-			divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16));
-		} else
+			divisor = ((tmp & 0xFFFF0000) >> 16) + 1;
+			divisor *= 4;
+			break;
+		default:
+			assert(0);
 			divisor = 1;
+		}
 	} else {
 		tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL);
-		divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16));
-		selection = 1;
+		divisor = ((tmp & 0xFFFF0000) >> 16) + 1;
+		divisor *= 4;
 	}
-	
-	switch (selection) {
-	case 0:
-		/* LPO */
+
+	switch (clocksrc) {
+	case BCM43xx_PCTL_CLKSRC_LOPWROS:
 		if (get_max)
 			limit = 43000;
 		else
 			limit = 25000;
 		break;
-	case 1:
-		/* XTAL */
+	case BCM43xx_PCTL_CLKSRC_XTALOS:
 		if (get_max)
 			limit = 20200000;
 		else
 			limit = 19800000;
 		break;
-	case 2:
-		/* PCI */
+	case BCM43xx_PCTL_CLKSRC_PCI:
 		if (get_max)
 			limit = 34000000;
 		else
@@ -113,17 +137,14 @@ static int bcm43xx_pctl_clockfreqlimit(s
 		break;
 	default:
 		assert(0);
+		limit = 0;
 	}
 	limit /= divisor;
 
-out_switchback:
-	err = bcm43xx_switch_core(bcm, old_core);
-	assert(err == 0);
-
-out:
 	return limit;
 }
 
+
 /* init power control
  * as described in http://bcm-specs.sipsolutions.net/PowerControl
  */
diff -puN drivers/net/wireless/bcm43xx/bcm43xx_power.h~bcm43xx-fix-pctl-slowclock-limit-calculation drivers/net/wireless/bcm43xx/bcm43xx_power.h
--- devel/drivers/net/wireless/bcm43xx/bcm43xx_power.h~bcm43xx-fix-pctl-slowclock-limit-calculation	2006-04-12 18:12:22.000000000 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_power.h	2006-04-12 18:12:22.000000000 -0700
@@ -33,6 +33,15 @@
 
 #include <linux/types.h>
 
+/* Clock sources */
+enum {
+	/* PCI clock */
+	BCM43xx_PCTL_CLKSRC_PCI,
+	/* Crystal slow clock oscillator */
+	BCM43xx_PCTL_CLKSRC_XTALOS,
+	/* Low power oscillator */
+	BCM43xx_PCTL_CLKSRC_LOPWROS,
+};
 
 struct bcm43xx_private;
 
_

^ permalink raw reply

* [patch 02/10] natsemi: Add support for using MII port with no PHY
From: akpm @ 2006-04-19  4:04 UTC (permalink / raw)
  To: jeff; +Cc: linville, netdev, akpm, broonie, jgarzik, thockin


From: Mark Brown <broonie@sirena.org.uk>

Provide a module option which configures the natsemi driver to use the
external MII port on the chip but ignore any PHYs that may be attached to it. 
The link state will be left as it was when the driver started and can be
configured via ethtool.  Any PHYs that are present can be accessed via the MII
ioctl()s.

This is useful for systems where the device is connected without a PHY or
where either information or actions outside the scope of the driver are
required in order to use the PHYs.

Signed-off-by: Mark Brown <broonie@sirena.org.uk>
Cc: Tim Hockin <thockin@hockin.org>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/natsemi.c |  105 +++++++++++++++++++++++++---------------
 1 files changed, 67 insertions(+), 38 deletions(-)

diff -puN drivers/net/natsemi.c~natsemi-add-support-for-using-mii-port-with-no-phy drivers/net/natsemi.c
--- devel/drivers/net/natsemi.c~natsemi-add-support-for-using-mii-port-with-no-phy	2006-04-10 23:21:19.000000000 -0700
+++ devel-akpm/drivers/net/natsemi.c	2006-04-10 23:21:19.000000000 -0700
@@ -259,7 +259,7 @@ MODULE_PARM_DESC(debug, "DP8381x default
 MODULE_PARM_DESC(rx_copybreak, 
 	"DP8381x copy breakpoint for copy-only-tiny-frames");
 MODULE_PARM_DESC(options, 
-	"DP8381x: Bits 0-3: media type, bit 17: full duplex");
+	"DP8381x: Bits 0-3: media type, bit 17: full duplex, bit 18: ignore PHY");
 MODULE_PARM_DESC(full_duplex, "DP8381x full duplex setting(s) (1)");
 
 /*
@@ -690,6 +690,8 @@ struct netdev_private {
 	u32 intr_status;
 	/* Do not touch the nic registers */
 	int hands_off;
+	/* Don't pay attention to the reported link state. */
+	int ignore_phy;
 	/* external phy that is used: only valid if dev->if_port != PORT_TP */
 	int mii;
 	int phy_addr_external;
@@ -894,7 +896,19 @@ static int __devinit natsemi_probe1 (str
 	np->intr_status = 0;
 	np->eeprom_size = NATSEMI_DEF_EEPROM_SIZE;
 
+	option = find_cnt < MAX_UNITS ? options[find_cnt] : 0;
+	if (dev->mem_start)
+		option = dev->mem_start;
+
+	/* Ignore the PHY status? */
+	if (option & 0x400) {
+		np->ignore_phy = 1;
+	} else {
+		np->ignore_phy = 0;
+	}
+
 	/* Initial port:
+	 * - If configured to ignore the PHY set up for external.
 	 * - If the nic was configured to use an external phy and if find_mii
 	 *   finds a phy: use external port, first phy that replies.
 	 * - Otherwise: internal port.
@@ -902,7 +916,7 @@ static int __devinit natsemi_probe1 (str
 	 * The address would be used to access a phy over the mii bus, but
 	 * the internal phy is accessed through mapped registers.
 	 */
-	if (readl(ioaddr + ChipConfig) & CfgExtPhy)
+	if (np->ignore_phy || readl(ioaddr + ChipConfig) & CfgExtPhy)
 		dev->if_port = PORT_MII;
 	else
 		dev->if_port = PORT_TP;
@@ -912,7 +926,9 @@ static int __devinit natsemi_probe1 (str
 
 	if (dev->if_port != PORT_TP) {
 		np->phy_addr_external = find_mii(dev);
-		if (np->phy_addr_external == PHY_ADDR_NONE) {
+		/* If we're ignoring the PHY it doesn't matter if we can't
+		 * find one. */
+		if (!np->ignore_phy && np->phy_addr_external == PHY_ADDR_NONE) {
 			dev->if_port = PORT_TP;
 			np->phy_addr_external = PHY_ADDR_INTERNAL;
 		}
@@ -920,10 +936,6 @@ static int __devinit natsemi_probe1 (str
 		np->phy_addr_external = PHY_ADDR_INTERNAL;
 	}
 
-	option = find_cnt < MAX_UNITS ? options[find_cnt] : 0;
-	if (dev->mem_start)
-		option = dev->mem_start;
-
 	/* The lower four bits are the media type. */
 	if (option) {
 		if (option & 0x200)
@@ -957,7 +969,10 @@ static int __devinit natsemi_probe1 (str
 	if (mtu)
 		dev->mtu = mtu;
 
-	netif_carrier_off(dev);
+	if (np->ignore_phy)
+		netif_carrier_on(dev);
+	else
+		netif_carrier_off(dev);
 
 	/* get the initial settings from hardware */
 	tmp            = mdio_read(dev, MII_BMCR);
@@ -1005,6 +1020,8 @@ static int __devinit natsemi_probe1 (str
 		printk("%02x, IRQ %d", dev->dev_addr[i], irq);
 		if (dev->if_port == PORT_TP)
 			printk(", port TP.\n");
+		else if (np->ignore_phy)
+			printk(", port MII, ignoring PHY\n");
 		else
 			printk(", port MII, phy ad %d.\n", np->phy_addr_external);
 	}
@@ -1685,42 +1702,44 @@ static void check_link(struct net_device
 {
 	struct netdev_private *np = netdev_priv(dev);
 	void __iomem * ioaddr = ns_ioaddr(dev);
-	int duplex;
+	int duplex = np->full_duplex;
 	u16 bmsr;
-       
-	/* The link status field is latched: it remains low after a temporary
-	 * link failure until it's read. We need the current link status,
-	 * thus read twice.
-	 */
-	mdio_read(dev, MII_BMSR);
-	bmsr = mdio_read(dev, MII_BMSR);
 
-	if (!(bmsr & BMSR_LSTATUS)) {
-		if (netif_carrier_ok(dev)) {
+	/* If we're not paying attention to the PHY status then don't check. */
+	if (!np->ignore_phy) {
+		/* The link status field is latched: it remains low
+		 * after a temporary link failure until it's read. We
+		 * need the current link status, thus read twice.
+		 */
+		mdio_read(dev, MII_BMSR);
+		bmsr = mdio_read(dev, MII_BMSR);
+
+		if (!(bmsr & BMSR_LSTATUS)) {
+			if (netif_carrier_ok(dev)) {
+				if (netif_msg_link(np))
+					printk(KERN_NOTICE "%s: link down.\n",
+					       dev->name);
+				netif_carrier_off(dev);
+				undo_cable_magic(dev);
+			}
+			return;
+		}
+		if (!netif_carrier_ok(dev)) {
 			if (netif_msg_link(np))
-				printk(KERN_NOTICE "%s: link down.\n",
-					dev->name);
-			netif_carrier_off(dev);
-			undo_cable_magic(dev);
+				printk(KERN_NOTICE "%s: link up.\n", dev->name);
+			netif_carrier_on(dev);
+			do_cable_magic(dev);
 		}
-		return;
-	}
-	if (!netif_carrier_ok(dev)) {
-		if (netif_msg_link(np))
-			printk(KERN_NOTICE "%s: link up.\n", dev->name);
-		netif_carrier_on(dev);
-		do_cable_magic(dev);
-	}
 
-	duplex = np->full_duplex;
-	if (!duplex) {
-		if (bmsr & BMSR_ANEGCOMPLETE) {
-			int tmp = mii_nway_result(
-				np->advertising & mdio_read(dev, MII_LPA));
-			if (tmp == LPA_100FULL || tmp == LPA_10FULL)
+		if (!duplex) {
+			if (bmsr & BMSR_ANEGCOMPLETE) {
+				int tmp = mii_nway_result(
+					np->advertising & mdio_read(dev, MII_LPA));
+				if (tmp == LPA_100FULL || tmp == LPA_10FULL)
+					duplex = 1;
+			} else if (mdio_read(dev, MII_BMCR) & BMCR_FULLDPLX)
 				duplex = 1;
-		} else if (mdio_read(dev, MII_BMCR) & BMCR_FULLDPLX)
-			duplex = 1;
+		}
 	}
 
 	/* if duplex is set then bit 28 must be set, too */
@@ -2936,6 +2955,16 @@ static int netdev_set_ecmd(struct net_de
 	}
 
 	/*
+	 * If we're ignoring the PHY then autoneg and the internal
+	 * transciever are really not going to work so don't let the
+	 * user select them.
+	 */
+	if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE ||
+			       ecmd->port == PORT_TP)) {
+		return -EINVAL;
+	}
+
+	/*
 	 * maxtxpkt, maxrxpkt: ignored for now.
 	 *
 	 * transceiver:
_

^ permalink raw reply

* Fwd:
From: Alta Murdock @ 2006-04-19 23:36 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20031002150239.GG32185@asuka.tech.sitadelle.com>

"Cia-lis Sof`tabs" is better than Pfizer V`ia`g`ra
and normal Ci-ialis because:

- Guarantes 40 hours lasting
- Safe to take, no side efects at all
- Boost and increase se-xual performance
- Harder e`rectiiions and quick recharge
- Proven and certified by experts and doctors
- only $1.56 per tabs
- Special offeer! These prices 
- are valid until 30th of April!
 
 Clisk here: http://hoaquynhonline.info









census fidget extreme sooth moisture cookie anther bygone pursue hankel
establish covalent domain backwater well cowslip barnett lamb discernible
knoll koinonia gu leapfrog purgative comfort refrigerate diary metalliferous em inaudible
own thrive anion breadth until vestal chlorate pursue
thermostat participle tilth camille batwing earthmoving oftentimes relic
sibley suggestible compelling troubleshoot hinduism anthem trimester axolotl

^ permalink raw reply

* Re: [PATCH] softmac: report SIOCGIWAP event upon association
From: Johannes Berg @ 2006-04-19  6:02 UTC (permalink / raw)
  To: Daniel Drake; +Cc: netdev, softmac-dev
In-Reply-To: <20060419000231.04C3C87C093@zog.reactivated.net>

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

On Wed, 2006-04-19 at 01:02 +0100, Daniel Drake wrote:
> wpa_supplicant requires some notification when association has completed, and
> this is the way to do it.

Check out the patches I posted earlier:
http://softmac.sipsolutions.net/patches/

Specifically, this one by Dan Williams:
http://softmac.sipsolutions.net/patches/softmac-events.patch

I think that's what you're doing here, but can't do an in-depth check at
the moment.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* Re: [TCP]: Fix truesize underflow
From: Boris B. Zhmurov @ 2006-04-19  6:04 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, kernel, nipsy, jesse.brandeburg, jrlundgren, cat,
	djani22, yoseph.basri, mykleb, olel, michal, chris, netdev,
	jesse.brandeburg, ak, jgarzik
In-Reply-To: <20060418232713.GA11938@gondor.apana.org.au>

Hello, Herbert Xu.

On 19.04.2006 03:27 you said the following:

> On Tue, Apr 18, 2006 at 01:22:56PM -0700, David S. Miller wrote:
> 
>>I think it is deserving of some run time assertions, else these bugs
>>will elude us continually.  Luckily there are only a few places that
>>would need the run time assertion checks on skb->truesize, and I'll
>>try to spend a few cycles on implementing this soon.
> 
> 
> Yes indeed.  One place that comes to mind would be tcp_trim_head just
> before we munge truesize.
> 
> Cheers,


I confirm, finally I don't see messages in dmesg about assertions. Nice 
work :)

-- 
Boris B. Zhmurov
mailto: bb@kernelpanic.ru
"wget http://kernelpanic.ru/bb_public_key.pgp -O - | gpg --import"


^ permalink raw reply

* Re: [TCP]: Fix truesize underflow
From: Herbert Xu @ 2006-04-19  6:40 UTC (permalink / raw)
  To: Boris B. Zhmurov
  Cc: David S. Miller, kernel, nipsy, jesse.brandeburg, jrlundgren, cat,
	djani22, yoseph.basri, mykleb, olel, michal, chris, netdev,
	jesse.brandeburg, ak, jgarzik
In-Reply-To: <4445D305.8080505@kernelpanic.ru>

On Wed, Apr 19, 2006 at 10:04:53AM +0400, Boris B. Zhmurov wrote:
> 
> I confirm, finally I don't see messages in dmesg about assertions. Nice 
> work :)

That's great.  Thanks a lot for your and everyone else's help in
tracking down.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [RESEND][PATCH] ebtables: clean up vmalloc usage in net/bridge/netfilter/ebtables.c
From: Jayachandran C @ 2006-04-19  6:50 UTC (permalink / raw)
  To: bridge, bdschuym; +Cc: netdev, akpm

Second try, added netdev to the cc: list this time.

This cleans up other usages of of vmalloc in ebtables.c. The 
changes are similar to the cleanup done in 
ebtables-fix-allocation-in-net-bridge-netfilter-ebtablesc.patch

Patch Description:

This patch makes all the vmalloc calls in net/bridge/netfilter/ebtables.c
follow the standard convention. Remove unnecessary casts, and use '*object'
instead of 'type'.

Signed-off-by: Jayachandran C. <c.jayachandran at gmail.com>

---

 net/bridge/netfilter/ebtables.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff -ur linux-2.6.16-rc6.clean/net/bridge/netfilter/ebtables.c linux-2.6.16-rc6/net/bridge/netfilter/ebtables.c
--- linux-2.6.16-rc6.clean/net/bridge/netfilter/ebtables.c	2006-04-14 14:00:28.000000000 +0530
+++ linux-2.6.16-rc6/net/bridge/netfilter/ebtables.c	2006-04-14 14:22:36.000000000 +0530
@@ -830,7 +830,7 @@
 			return -ENOMEM;
 		for_each_cpu(i) {
 			newinfo->chainstack[i] =
-			   vmalloc(udc_cnt * sizeof(struct ebt_chainstack));
+			  vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0])));
 			if (!newinfo->chainstack[i]) {
 				while (i)
 					vfree(newinfo->chainstack[--i]);
@@ -840,8 +840,7 @@
 			}
 		}
 
-		cl_s = (struct ebt_cl_stack *)
-		   vmalloc(udc_cnt * sizeof(struct ebt_cl_stack));
+		cl_s = vmalloc(udc_cnt * sizeof(*cl_s));
 		if (!cl_s)
 			return -ENOMEM;
 		i = 0; /* the i'th udc */
@@ -943,8 +942,7 @@
 
 	countersize = COUNTER_OFFSET(tmp.nentries) * 
 					(highest_possible_processor_id()+1);
-	newinfo = (struct ebt_table_info *)
-	   vmalloc(sizeof(struct ebt_table_info) + countersize);
+	newinfo = vmalloc(sizeof(*newinfo) + countersize);
 	if (!newinfo)
 		return -ENOMEM;
 
@@ -966,8 +964,7 @@
 	/* the user wants counters back
 	   the check on the size is done later, when we have the lock */
 	if (tmp.num_counters) {
-		counterstmp = (struct ebt_counter *)
-		   vmalloc(tmp.num_counters * sizeof(struct ebt_counter));
+		counterstmp = vmalloc(tmp.num_counters * sizeof(*counterstmp));
 		if (!counterstmp) {
 			ret = -ENOMEM;
 			goto free_entries;
@@ -1147,8 +1144,7 @@
 
 	countersize = COUNTER_OFFSET(table->table->nentries) *
 					(highest_possible_processor_id()+1);
-	newinfo = (struct ebt_table_info *)
-	   vmalloc(sizeof(struct ebt_table_info) + countersize);
+	newinfo = vmalloc(sizeof(*newinfo) + countersize);
 	ret = -ENOMEM;
 	if (!newinfo)
 		return -ENOMEM;
@@ -1246,8 +1242,7 @@
 	if (hlp.num_counters == 0)
 		return -EINVAL;
 
-	if ( !(tmp = (struct ebt_counter *)
-	   vmalloc(hlp.num_counters * sizeof(struct ebt_counter))) ){
+	if ( !(tmp = vmalloc(hlp.num_counters * sizeof(*tmp))) ){
 		MEMPRINT("Update_counters && nomemory\n");
 		return -ENOMEM;
 	}
@@ -1376,8 +1371,7 @@
 			BUGPRINT("Num_counters wrong\n");
 			return -EINVAL;
 		}
-		counterstmp = (struct ebt_counter *)
-		   vmalloc(nentries * sizeof(struct ebt_counter));
+		counterstmp = vmalloc(nentries * sizeof(*counterstmp));
 		if (!counterstmp) {
 			MEMPRINT("Couldn't copy counters, out of memory\n");
 			return -ENOMEM;

----- End forwarded message -----

^ permalink raw reply

* Re: [PATCH] ip_route_input panic fix
From: Alexey Kuznetsov @ 2006-04-19  9:46 UTC (permalink / raw)
  To: David S. Miller; +Cc: herbert, shemminger, netdev
In-Reply-To: <20060418.205317.18564378.davem@davemloft.net>

Hello!

> ipmr_get_route() is the trouble maker.  If ipmr_cache_find() cannot
> find an entry, it tries to use the netlink SKB to send out an ipv4
> packet, completely mangling it, via ipmr_cache_unresolved().

It just adds dummy IP header to tail of this skb. Nothing illegal.
The skb is not sent out, it is enqueued in an ARP-like queue and
the IP header is submitted to mroute_socket.

When user level mrouter resolves the route, ipmr_cache_resolve()
removes this, completes filling netlink attributes and sends it to netlink.


> Even worse it may even free the skb on us,

Oops, seems, this is a real bug... Need to think how to fix.


> or queue it to mroute_socket.

It is OK, it is the purpose.


> It is pure disaster, this entire code path.

Well, it may be buggy, but esentially there is nothing to simplify.
At least, I do not see.

Alexey

^ permalink raw reply

* Re: [patch] ipv4: initialize arp_tbl rw lock
From: Christian Borntraeger @ 2006-04-19 10:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Heiko Carstens, shemminger, jgarzik, netdev, linux-kernel,
	fpavlic, davem
In-Reply-To: <20060408031235.5d1989df.akpm@osdl.org>

As spinlock debugging still does not work with the qeth driver I want to pick 
up the discussion.

On Saturday 08 April 2006 12:12, Andrew Morton wrote:
> Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
[...]
> >  -vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
> >  +vmlinux-main := $(core-y) $(libs-y) $(net-y) $(drivers-y)
>
> <wonders what this will break>

What about putting this patch into mm and find out?
>
> I have a bad feeling that one day we're going to come unstuck with this
> practice.  Is there anything which dictates that the linker has to lay
> sections out in .o-file-order?
>
> Perhaps net initcalls should be using something higher priority than
> device_initcall().

I agree that the initcall order offers a lot of room for improvement (like 
dependencies). Is anybody aware of any work into this direction?

-- 
Mit freundlichen Grüßen / Best Regards

Christian Borntraeger
Linux Software Engineer zSeries Linux & Virtualization




^ permalink raw reply

* [RFC] Netlink and user-space buffer pointers
From: James Smart @ 2006-04-19 12:57 UTC (permalink / raw)
  To: linux-scsi, netdev, linux-kernel
In-Reply-To: <20060418160121.GA2707@us.ibm.com>

Folks,

To take netlink to where we want to use it within the SCSI subsystem (as
the mechanism of choice to replace ioctls), we're going to need to pass
user-space buffer pointers.

What is the best, portable manner to pass a pointer between user and kernel
space within a netlink message ?  The example I've seen is in the iscsi
target code - and it's passed between user-kernel space as a u64, then
typecast to a void *, and later within the bio_map_xxx functions, as an
unsigned long. I assume we are going to continue with this method ?

-- james s

^ permalink raw reply

* Re: [offlist] Re: [LARTC] how to do probabilistic packet loss in kernel?
From: George Nychis @ 2006-04-19 13:55 UTC (permalink / raw)
  To: Martin A. Brown, lartc, netdev
In-Reply-To: <Pine.LNX.4.61.0604190741260.6853@virgule.wonderfrog.net>

Hey Martin,

I was able to do it with netem and its working great now.

I've actually moved on to another challenge, I would like to drop 
packets at the hardware level such as to see rate control.

Because when netem drops a packet, TCP responds, however the lower level 
card will not interact because it never sees the loss.

What I want to do is somehow cause the card to send a corrupted packet 
based on a probability, or not send the packet but make it think that it 
did.

I'm using madwifi and I've found in the code where it does rate control 
and sends out the data, so i'm hoping to make this happen, but having 
troubles!

So if anyone else has any ideas on how to get rate control interactive 
packet loss, i'd love it.

- George


Martin A. Brown wrote:
> Hello George,
> 
> Unfortunately, I cannot answer your most recent question.  I'm 
> hoping that Stephen Hemminger can answer your question.  He is 
> subscribed to the LARTC list, is also the author of netem and 
> seems to be a smart cookie.
> 
> Good luck,
> 
> -Martin
> 

^ permalink raw reply

* Re: [TCP]: Fix truesize underflow
From: Jesse Brandeburg @ 2006-04-19 16:07 UTC (permalink / raw)
  To: bb
  Cc: Herbert Xu, David S. Miller, kernel, nipsy, jrlundgren, cat,
	djani22, yoseph.basri, mykleb, olel, michal, chris, netdev,
	jesse.brandeburg, ak, jgarzik
In-Reply-To: <4445D305.8080505@kernelpanic.ru>

Boris B. Zhmurov wrote:
> Hello, Herbert Xu.
>
> On 19.04.2006 03:27 you said the following:
>
>> On Tue, Apr 18, 2006 at 01:22:56PM -0700, David S. Miller wrote:
>>
>>> I think it is deserving of some run time assertions, else these bugs
>>> will elude us continually.  Luckily there are only a few places that
>>> would need the run time assertion checks on skb->truesize, and I'll
>>> try to spend a few cycles on implementing this soon.
>>
>>
>> Yes indeed.  One place that comes to mind would be tcp_trim_head just
>> before we munge truesize.
>>
>> Cheers,
>
>
> I confirm, finally I don't see messages in dmesg about assertions. 
> Nice work :)
>
I can also confirm that both machines here had no problems after 
applying this patch. Good work!

^ permalink raw reply

* Re: [RFC] Netlink and user-space buffer pointers
From: Patrick McHardy @ 2006-04-19 16:22 UTC (permalink / raw)
  To: James.Smart; +Cc: linux-scsi, netdev, linux-kernel
In-Reply-To: <444633B5.5030208@emulex.com>

James Smart wrote:
> To take netlink to where we want to use it within the SCSI subsystem (as
> the mechanism of choice to replace ioctls), we're going to need to pass
> user-space buffer pointers.
> 
> What is the best, portable manner to pass a pointer between user and kernel
> space within a netlink message ?  The example I've seen is in the iscsi
> target code - and it's passed between user-kernel space as a u64, then
> typecast to a void *, and later within the bio_map_xxx functions, as an
> unsigned long. I assume we are going to continue with this method ?

This might be problematic, since there is a shared receive-queue in
the kernel netlink message might get processed in the context of
a different process. I didn't find any spots where ISCSI passes
pointers over netlink, can you point me to it?

Besides that, netlink protocols should use fixed size architecture
independant types, so u64 would be the best choice for pointers.

^ permalink raw reply

* Re: [RFC] Netlink and user-space buffer pointers
From: Stephen Hemminger @ 2006-04-19 16:26 UTC (permalink / raw)
  To: James.Smart; +Cc: linux-scsi, netdev, linux-kernel
In-Reply-To: <444633B5.5030208@emulex.com>

On Wed, 19 Apr 2006 08:57:25 -0400
James Smart <James.Smart@Emulex.Com> wrote:

> Folks,
> 
> To take netlink to where we want to use it within the SCSI subsystem (as
> the mechanism of choice to replace ioctls), we're going to need to pass
> user-space buffer pointers.

This changes the design of netlink. It is desired that netlink
can be done remotely over the network as well as queueing.
The current design is message based, not RPC based. By including a
user-space pointer, you are making the message dependent on the
context as it is process.

Please rethink your design.

> What is the best, portable manner to pass a pointer between user and kernel
> space within a netlink message ?  The example I've seen is in the iscsi
> target code - and it's passed between user-kernel space as a u64, then
> typecast to a void *, and later within the bio_map_xxx functions, as an
> unsigned long. I assume we are going to continue with this method ?
> 
> -- james s
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* I/OAT: Call for discussion
From: Grover, Andrew @ 2006-04-19 16:39 UTC (permalink / raw)
  To: netdev

Over the past few months, we (the Intel networking group) have been
working hard, often off-list, to get the I/OAT patches we've posted here
merged into the mainline kernel branch, as well as Red Hat and SuSE.
We've had some success, but not what's really important: getting it into
the mainline kernel releases.

Of course some of this can be blamed on how a corporate culture
approaches the open source community when it thinks it has something
that gives it a competitive advantage in the marketplace. If we acted
like jerks, it's just because we think we have something good here! :) 

But seriously, I know we've had longer turnaround times in releases and
replying to comments than people have liked. All we can say is sorry, we
really have been doing our best. People were kind enough to review our
patches and suggest over 50 improvements, we have fixed the patches
accordingly, and we really do appreciate it.

So OK assume we have a nice pretty patchset. Why should it go in? Since
we have an NDA with Red Hat we've been trying to convince DaveM and Red
Hat of I/OAT's merits off-list, but this kind of change needs a more
public airing of all its pros and cons.

We have posted all the performance data we have gathered so far on the
linux-net wiki: http://linux-net.osdl.org/index.php/I/OAT , and listed
the overall concerns that have been expressed in private. I'm hoping you
will look at the data, re-examine the patches, and then we can talk
about the technical issues here on the list, getting down to the
specifics, so we can hash it out in public and settle on the right path
to take.

Thanks -- Regards -- Andy

^ permalink raw reply

* Re: [TCP]: Fix truesize underflow
From: Stephen Hemminger @ 2006-04-19 16:53 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Boris B. Zhmurov, Phil Oester, Mark Nipper, David S. Miller,
	jesse.brandeburg, jrlundgren, cat, djani22, yoseph.basri, mykleb,
	olel, michal, chris, netdev, jesse.brandeburg, Andi Kleen,
	Jeff Garzik
In-Reply-To: <20060418123204.GA3962@gondor.apana.org.au>

On Tue, 18 Apr 2006 22:32:04 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Hi Dave:
> 
> You're absolutely right about there being a problem with the TSO packet
> trimming code.  The cause of this lies in the tcp_fragment() function.
> 
> When we allocate a fragment for a completely non-linear packet the
> truesize is calculated for a payload length of zero.  This means that
> truesize could in fact be less than the real payload length.
> 
> When that happens the TSO packet trimming can cause truesize to become
> negative.  This in turn can cause sk_forward_alloc to be -n * PAGE_SIZE
> which would trigger the warning.
> 
> I've copied the code you used in tso_fragment which should work here.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> Everyone who's having the sk_forward_alloc warning problem should give
> this patch a go to see if it cures things.
> 
> Just in case this still doesn't fix it, could everyone please also verify
> whether disabling SMP has any effect on reproducing this?
> 
> Thanks,

Please put this in the next -stable load...

^ permalink raw reply

* Re: [RFC] Netlink and user-space buffer pointers
From: James Smart @ 2006-04-19 17:05 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: linux-scsi, netdev, linux-kernel
In-Reply-To: <20060419092645.29cb0420@localhost.localdomain>



Stephen Hemminger wrote:
> On Wed, 19 Apr 2006 08:57:25 -0400
> James Smart <James.Smart@Emulex.Com> wrote:
> 
>> Folks,
>>
>> To take netlink to where we want to use it within the SCSI subsystem (as
>> the mechanism of choice to replace ioctls), we're going to need to pass
>> user-space buffer pointers.
> 
> This changes the design of netlink. It is desired that netlink
> can be done remotely over the network as well as queueing.
> The current design is message based, not RPC based. By including a
> user-space pointer, you are making the message dependent on the
> context as it is process.
> 
> Please rethink your design.

I assume that the message receiver has some way to determine where the
message originated (via the sk_buff), and thus could reject it if it
didn't meet the right criteria.  True ?  You just have to be cognizant
that it is usable from a remote entity - which is a very good thing.

^ permalink raw reply

* Re: [RFC] Netlink and user-space buffer pointers
From: James Smart @ 2006-04-19 17:08 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: linux-scsi, netdev, linux-kernel
In-Reply-To: <444663A9.9020502@trash.net>



Patrick McHardy wrote:
> This might be problematic, since there is a shared receive-queue in
> the kernel netlink message might get processed in the context of
> a different process. I didn't find any spots where ISCSI passes
> pointers over netlink, can you point me to it?

Please explain... Would the pid be set erroneously as well ?  Ignoring
the kernel-user space pointer issue, we're going to have a tight
pid + request_id relationship being maintained across multiple messages.
We'll also be depending on the pid events for clean up if an app dies.
So I hope pid is consistent.

-- james s

^ permalink raw reply

* Re: I/OAT: Call for discussion
From: Stephen Hemminger @ 2006-04-19 17:12 UTC (permalink / raw)
  To: Grover, Andrew; +Cc: netdev
In-Reply-To: <5389061B65D50446B1783B97DFDB392D8E9F0A@orsmsx411.amr.corp.intel.com>

On Wed, 19 Apr 2006 09:39:37 -0700
"Grover, Andrew" <andrew.grover@intel.com> wrote:

> Over the past few months, we (the Intel networking group) have been
> working hard, often off-list, to get the I/OAT patches we've posted here
> merged into the mainline kernel branch, as well as Red Hat and SuSE.
> We've had some success, but not what's really important: getting it into
> the mainline kernel releases.

Vendor kernel support has little or no bearing on eventual inclusion.

> Of course some of this can be blamed on how a corporate culture
> approaches the open source community when it thinks it has something
> that gives it a competitive advantage in the marketplace. If we acted
> like jerks, it's just because we think we have something good here! :) 
> 
> But seriously, I know we've had longer turnaround times in releases and
> replying to comments than people have liked. All we can say is sorry, we
> really have been doing our best. People were kind enough to review our
> patches and suggest over 50 improvements, we have fixed the patches
> accordingly, and we really do appreciate it.
> 
> So OK assume we have a nice pretty patchset. Why should it go in? Since
> we have an NDA with Red Hat we've been trying to convince DaveM and Red
> Hat of I/OAT's merits off-list, but this kind of change needs a more
> public airing of all its pros and cons.

Off list lobbying usually has a negative impact.

> We have posted all the performance data we have gathered so far on the
> linux-net wiki: http://linux-net.osdl.org/index.php/I/OAT , and listed
> the overall concerns that have been expressed in private. I'm hoping you
> will look at the data, re-examine the patches, and then we can talk
> about the technical issues here on the list, getting down to the
> specifics, so we can hash it out in public and settle on the right path
> to take.

The biggest barrier at this point seems to be hardware availability.
People generally don't care unless they use or are going to get that hardware.
Also the big benchmark data, although interesting, is usually only
interesting to vendors.

You probably will have to suffer out of tree for a while until the hardware
becomes more available. When the hardware is more common, then the implementation
details will be sorted out. Also after the 2+ years of getting TSO to work
right, maybe the developers are a little gun shy at this point.

^ permalink raw reply

* [PATCH] softmac: add SIOCSIWMLME
From: Johannes Berg @ 2006-04-19 17:13 UTC (permalink / raw)
  To: netdev; +Cc: softmac-dev, John W. Linville, Jean Tourrilhes

This patch adds the SIOCSIWMLME wext to softmac, this functionality
appears to be used by wpa_supplicant and is softmac-specific.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_priv.h	2006-04-19 18:44:51.710074158 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_priv.h	2006-04-19 18:46:38.000074158 +0200
@@ -150,6 +150,7 @@ int ieee80211softmac_handle_disassoc(str
 int ieee80211softmac_handle_reassoc_req(struct net_device * dev,
 				        struct ieee80211_reassoc_request * reassoc);
 void ieee80211softmac_assoc_timeout(void *d);
+void ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason);
 
 /* some helper functions */
 static inline int ieee80211softmac_scan_handlers_check_self(struct ieee80211softmac_device *sm)
--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_wx.c	2006-04-19 18:44:51.710074158 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_wx.c	2006-04-19 18:48:52.200074158 +0200
@@ -424,3 +424,35 @@ ieee80211softmac_wx_get_genie(struct net
 }
 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_genie);
 
+int
+ieee80211softmac_wx_set_mlme(struct net_device *dev,
+			     struct iw_request_info *info,
+			     union iwreq_data *wrqu,
+			     char *extra)
+{
+	struct ieee80211softmac_device *mac = ieee80211_priv(dev);
+	struct iw_mlme *mlme = (struct iw_mlme *)extra;
+	u16 reason = cpu_to_le16(mlme->reason_code);
+	struct ieee80211softmac_network *net;
+
+	if (memcmp(mac->associnfo.bssid, mlme->addr.sa_data, ETH_ALEN)) {
+		printk(KERN_DEBUG PFX "wx_set_mlme: requested operation on net we don't use\n");
+		return -EINVAL;
+	}
+
+	switch (mlme->cmd) {
+	case IW_MLME_DEAUTH:
+		net = ieee80211softmac_get_network_by_bssid_locked(mac, mlme->addr.sa_data);
+		if (!net) {
+			printk(KERN_DEBUG PFX "wx_set_mlme: we should know the net here...\n");
+			return -EINVAL;
+		}
+		return ieee80211softmac_deauth_req(mac, net, reason);
+	case IW_MLME_DISASSOC:
+		ieee80211softmac_disassoc(mac, reason);
+		return 0;
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+EXPORT_SYMBOL_GPL(ieee80211softmac_wx_set_mlme);
--- wireless-2.6.orig/include/net/ieee80211softmac_wx.h	2006-03-28 16:23:31.000000000 +0200
+++ wireless-2.6/include/net/ieee80211softmac_wx.h	2006-04-19 18:48:30.640074158 +0200
@@ -91,4 +91,9 @@ ieee80211softmac_wx_get_genie(struct net
 			      struct iw_request_info *info,
 			      union iwreq_data *wrqu,
 			      char *extra);
+extern int
+ieee80211softmac_wx_set_mlme(struct net_device *dev,
+			     struct iw_request_info *info,
+			     union iwreq_data *wrqu,
+			     char *extra);
 #endif /* _IEEE80211SOFTMAC_WX */
--- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c	2006-04-19 18:46:29.000000000 +0200
+++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c	2006-04-19 18:46:47.300074158 +0200
@@ -82,7 +82,7 @@ ieee80211softmac_assoc_timeout(void *d)
 }
 
 /* Sends out a disassociation request to the desired AP */
-static void
+void
 ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason)
 {
 	unsigned long flags;



^ permalink raw reply

* Fw: Netpoll checksum issue
From: Stephen Hemminger @ 2006-04-19 17:15 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev



Begin forwarded message:

Date: Thu, 20 Apr 2006 00:22:16 +0800
From: Aubrey <aubreylee@gmail.com>
Newsgroups: linux.dev.kernel
Subject: Netpoll checksum issue


Hi all,
I'm porting my network driver from 2.6.12 to 2.6.16. It almostly work
without any change, except the netpoll mode. When I use kgdb to debug
kernel, gdb client can not establish the connection with gdb server.
Then I digged into the code, and I found in the routine "__netpoll_rx"
in the file "net/core/netpoll.c", the "checksum_udp" call always
failed, but it works on 2.6.12.
Could you please give me some suggestions?
Thanks a lot.

Regards,
-Aubrey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ 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