Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] irda-usb: use NULL instead of 0
From: Randy.Dunlap @ 2006-05-01 22:31 UTC (permalink / raw)
  To: Ivo van Doorn; +Cc: netdev, jgarzik
In-Reply-To: <200605020019.25382.IvDoorn@gmail.com>


> I could be mistaken, but wasn't the usb_control_msg timeout type changed in kernel 2.6.12?
> The timeout value is no longer in jiffies but in msecs.

ugh, correct.  Here's a new patch.
Thanks.

---
From: Randy Dunlap <rdunlap@xenotime.net>

Use NULL instead of 0 for a null pointer value (sparse warning):
drivers/net/irda/irda-usb.c:1781:30: warning: Using plain integer as NULL pointer

Correct timeout argument to use milliseconds instead of jiffies.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
 drivers/net/irda/irda-usb.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2617-rc3.orig/drivers/net/irda/irda-usb.c
+++ linux-2617-rc3/drivers/net/irda/irda-usb.c
@@ -1778,7 +1778,7 @@ static int irda_usb_probe(struct usb_int
 
 	if (self->needspatch) {
 		ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
-				       0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
+				       0x02, 0x40, 0, 0, NULL, 0, 500);
 		if (ret < 0) {
 			IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
 			goto err_out_3;

^ permalink raw reply

* [PATCH 1/3] ipg: removal of unreachable code
From: Francois Romieu @ 2006-05-01 23:10 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>

map/unmap is done in ipg_{probe/remove}

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

---

 drivers/net/ipg.c |   18 ------------------
 1 files changed, 0 insertions(+), 18 deletions(-)

2b14ddef0c29f43c07ffd33c3d1d9e652db3a571
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 5d4d023..42396ca 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1790,24 +1790,6 @@ static int ipg_nic_stop(struct net_devic
 	/* Release interrupt line. */
 	free_irq(dev->irq, dev);
 	return 0;
-
-#ifdef USE_IO_OPS
-
-	/* Release I/O range reserved for IPG registers. */
-	release_region(dev->base_addr, IPG_IO_REG_RANGE);
-
-#else				/* Not using I/O space. */
-
-	/* Unmap memory used for IPG registers. */
-
-	/* The following line produces strange results unless
-	 * unregister_netdev precedes it.
-	 */
-	iounmap(sp->ioaddr);
-
-#endif
-
-	return 0;
 }
 
 static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-- 
1.3.1


^ permalink raw reply related

* [PATCH 2/3] ipg: leaks in ipg_probe
From: Francois Romieu @ 2006-05-01 23:10 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>

The error paths are badly broken.

Bonus:
- remove duplicate initialization of sp;
- remove useless NULL initialization of dev;
- USE_IO_OPS is not used (and the driver does not seem to care about
  posted writes, rejoice).

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

---

 drivers/net/ipg.c |   93 ++++++++++++++++++++++++-----------------------------
 1 files changed, 42 insertions(+), 51 deletions(-)

5ea54e95a2319311aaae857ecf2adb7fbe068c92
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 42396ca..da0fa22 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -2914,11 +2914,8 @@ static void ipg_remove(struct pci_dev *p
 	/* Un-register Ethernet device. */
 	unregister_netdev(dev);
 
-#ifdef USE_IO_OPS
-	ioport_unmap(ioaddr);
-#else
-	iounmap(sp->ioaddr);
-#endif
+	pci_iounmap(pdev, sp->ioaddr);
+
 	pci_release_regions(pdev);
 
 	free_netdev(dev);
@@ -2929,19 +2926,15 @@ #endif
 static int __devinit ipg_probe(struct pci_dev *pdev,
 			       const struct pci_device_id *id)
 {
-	int err, i;
-	struct net_device *dev = NULL;
+	unsigned int i = id->driver_data;
 	struct ipg_nic_private *sp;
+	struct net_device *dev;
 	void __iomem *ioaddr;
-	unsigned long pio_start, pio_len;
-	unsigned long mmio_start;
+	int rc;
 
-	err = pci_enable_device(pdev);
-	if (err)
-		return err;
-
-	/* Get the index for the driver description string. */
-	i = id->driver_data;
+	rc = pci_enable_device(pdev);
+	if (rc < 0)
+		goto out;
 
 	printk(KERN_INFO "%s found.\n", nics_supported[i].NICname);
 	printk(KERN_INFO "Bus %x Slot %x\n",
@@ -2949,10 +2942,14 @@ static int __devinit ipg_probe(struct pc
 
 	pci_set_master(pdev);
 
-	if (!pci_dma_supported(pdev, 0xFFFFFFFF)) {
-		printk(KERN_INFO "pci_dma_supported out.\n");
-		err = -ENODEV;
-		goto out;
+	rc = pci_set_dma_mask(pdev, DMA_40BIT_MASK);
+	if (rc < 0) {
+		rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+		if (rc < 0) {
+			printk(KERN_ERR "%s: DMA config failed.\n",
+			       pci_name(pdev));
+			goto err_disable_0;
+		}
 	}
 
 	/*
@@ -2960,9 +2957,9 @@ static int __devinit ipg_probe(struct pc
 	 */
 	dev = alloc_etherdev(sizeof(struct ipg_nic_private));
 	if (!dev) {
-		printk(KERN_ERR "ipg: alloc_etherdev failed\n");
-		err = -ENOMEM;
-		goto out;
+		printk(KERN_ERR "%s: alloc_etherdev failed\n", pci_name(pdev));
+		rc = -ENOMEM;
+		goto err_disable_0;
 	}
 
 	sp = netdev_priv(dev);
@@ -2981,50 +2978,44 @@ static int __devinit ipg_probe(struct pc
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
-	err = pci_request_regions(pdev, DRV_NAME);
-	if (err)
-		goto out;
-
-	pio_start = pci_resource_start(pdev, 0) & 0xffffff80;
-	pio_len = pci_resource_len(pdev, 0);
-	mmio_start = pci_resource_start(pdev, 1) & 0xffffff80;
+	rc = pci_request_regions(pdev, DRV_NAME);
+	if (rc)
+		goto err_free_dev_1;
 
-#ifdef USE_IO_OPS
-	ioaddr = ioport_map(pio_start, pio_len);
-	if (!ioaddr) {
-		printk(KERN_ERR "%s cannot map PIO\n", pci_name(pdev));
-		err = -EIO;
-		goto out;
-	}
-#else
-	ioaddr = ioremap(mmio_start, netdev_io_size);
+	ioaddr = pci_iomap(pdev, 1, pci_resource_len(pdev, 1));
 	if (!ioaddr) {
 		printk(KERN_ERR "%s cannot map MMIO\n", pci_name(pdev));
-		err = -EIO;
-		goto out;
+		rc = -EIO;
+		goto err_release_regions_2;
 	}
-#endif
-	sp = netdev_priv(dev);
+
 	/* Save the pointer to the PCI device information. */
 	sp->ioaddr = ioaddr;
 	sp->pdev = pdev;
 
 	pci_set_drvdata(pdev, dev);
 
-	err = ipg_hw_init(dev);
-	if (err)
-		goto out;
+	rc = ipg_hw_init(dev);
+	if (rc < 0)
+		goto err_unmap_3;
 
-	err = register_netdev(dev);
-	if (err)
-		goto out;
+	rc = register_netdev(dev);
+	if (rc < 0)
+		goto err_unmap_3;
 
 	printk(KERN_INFO "Ethernet device registered as: %s\n", dev->name);
-	return 0;
+out:
+	return rc;
 
-      out:
+err_unmap_3:
+	pci_iounmap(pdev, ioaddr);
+err_release_regions_2:
+	pci_release_regions(pdev);
+err_free_dev_1:
+	free_netdev(dev);
+err_disable_0:
 	pci_disable_device(pdev);
-	return err;
+	goto out;
 }
 
 static void ipg_set_phy_default_param(unsigned char rev,
-- 
1.3.1


^ permalink raw reply related

* [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open
From: Francois Romieu @ 2006-05-01 23:12 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>

Added ipg_{rx/tx}_clear() to factor out some code.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

---

 drivers/net/ipg.c |  161 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 93 insertions(+), 68 deletions(-)

96f29e9d57f503f1275757f4bbec76c0f7f421fc
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index da0fa22..393b617 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -16,6 +16,9 @@
  */
 #include <linux/crc32.h>
 
+#define IPG_RX_RING_BYTES	(sizeof(struct RFD) * IPG_RFDLIST_LENGTH)
+#define IPG_TX_RING_BYTES	(sizeof(struct TFD) * IPG_TFDLIST_LENGTH)
+
 #define JUMBO_FRAME_4k_ONLY
 enum {
 	netdev_io_size = 128
@@ -1485,15 +1488,46 @@ static void ipg_nic_txfree(struct net_de
 	} while (maxtfdcount != 0);
 }
 
-static int ipg_nic_open(struct net_device *dev)
+static void ipg_rx_clear(struct ipg_nic_private *sp)
 {
-	/* The IPG NIC Ethernet interface is opened when activated
-	 * by ifconfig.
-	 */
+	struct pci_dev *pdev = sp->pdev;
+	unsigned int i;
 
-	int error = 0;
-	void __iomem *ioaddr = ipg_ioaddr(dev);
+	for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
+		if (sp->RxBuff[i]) {
+			struct ipg_dmabuff *desc = sp->RxBuffDMAhandle + i;
+
+			IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
+			sp->RxBuff[i] = NULL;
+			pci_unmap_single(pdev, desc->dmahandle, desc->len,
+					 PCI_DMA_FROMDEVICE);
+		}
+	}
+}
+
+static void ipg_tx_clear(struct ipg_nic_private *sp)
+{
+	struct pci_dev *pdev = sp->pdev;
+	unsigned int i;
+
+	for (i = 0; i < IPG_TFDLIST_LENGTH; i++) {
+		if (sp->TxBuff[i]) {
+			struct ipg_dmabuff *desc = sp->TxBuffDMAhandle + i;
+
+			IPG_DEV_KFREE_SKB(sp->TxBuff[i]);
+			sp->TxBuff[i] = NULL;
+			pci_unmap_single(pdev, desc->dmahandle, desc->len,
+					 PCI_DMA_TODEVICE);
+		}
+	}
+}
+
+static int ipg_nic_open(struct net_device *dev)
+{
 	struct ipg_nic_private *sp = netdev_priv(dev);
+	void __iomem *ioaddr = ipg_ioaddr(dev);
+	struct pci_dev *pdev = sp->pdev;
+	int rc;
 
 	IPG_DEBUG_MSG("_nic_open\n");
 
@@ -1508,59 +1542,53 @@ static int ipg_nic_open(struct net_devic
 	/* Register the interrupt line to be used by the IPG within
 	 * the Linux system.
 	 */
-	if ((error = request_irq(sp->pdev->irq,
-				 &ipg_interrupt_handler,
-				 SA_SHIRQ, dev->name, dev)) < 0) {
+	rc = request_irq(pdev->irq, &ipg_interrupt_handler, SA_SHIRQ,
+			 dev->name, dev);
+	if (rc < 0) {
 		printk(KERN_INFO "%s: Error when requesting interrupt.\n",
 		       dev->name);
-		return error;
+		goto out;
 	}
 
-	dev->irq = sp->pdev->irq;
+	dev->irq = pdev->irq;
 
-	sp->RFDList = pci_alloc_consistent(sp->pdev,
-					   (sizeof(struct RFD) *
-					    IPG_RFDLIST_LENGTH),
+	rc = -ENOMEM;
+
+	sp->RFDList = pci_alloc_consistent(pdev, IPG_RX_RING_BYTES,
 					   &sp->RFDListDMAhandle);
+	if (!sp->RFDList)
+		goto err_free_irq_0;
 
-	sp->TFDList = pci_alloc_consistent(sp->pdev,
-					   (sizeof(struct TFD) *
-					    IPG_TFDLIST_LENGTH),
+	sp->TFDList = pci_alloc_consistent(pdev, IPG_TX_RING_BYTES,
 					   &sp->TFDListDMAhandle);
+	if (!sp->TFDList)
+		goto err_free_rx_1;
 
-	if ((sp->RFDList == NULL) || (sp->TFDList == NULL)) {
-		printk(KERN_INFO
-		       "%s: No memory available for IP1000 RFD and/or TFD lists.\n",
-		       dev->name);
-		return -ENOMEM;
-	}
-
-	error = init_rfdlist(dev);
-	if (error < 0) {
+	rc = init_rfdlist(dev);
+	if (rc < 0) {
 		printk(KERN_INFO "%s: Error during configuration.\n",
 		       dev->name);
-		return error;
+		goto err_free_tx_2;
 	}
 
-	error = init_tfdlist(dev);
-	if (error < 0) {
+	rc = init_tfdlist(dev);
+	if (rc < 0) {
 		printk(KERN_INFO "%s: Error during configuration.\n",
 		       dev->name);
-		return error;
+		goto err_release_rfdlist_3;
 	}
 
-	/* Configure IPG I/O registers. */
-	error = ipg_io_config(dev);
-	if (error < 0) {
+	rc = ipg_io_config(dev);
+	if (rc < 0) {
 		printk(KERN_INFO "%s: Error during configuration.\n",
 		       dev->name);
-		return error;
+		goto err_release_tfdlist_4;
 	}
 
 	/* Resolve autonegotiation. */
-	if (ipg_config_autoneg(dev) < 0) {
+	if (ipg_config_autoneg(dev) < 0)
 		printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name);
-	}
+
 #ifdef JUMBO_FRAME
 	/* initialize JUMBO Frame control variable */
 	sp->Jumbo.FoundStart = 0;
@@ -1575,8 +1603,22 @@ #endif
 		   IPG_MC_TX_ENABLE), ioaddr + IPG_MACCTRL);
 
 	netif_start_queue(dev);
+out:
+	return rc;
 
-	return 0;
+err_release_tfdlist_4:
+	ipg_tx_clear(sp);
+err_release_rfdlist_3:
+	ipg_rx_clear(sp);
+err_free_tx_2:
+	pci_free_consistent(pdev, IPG_TX_RING_BYTES, sp->TFDList,
+			    sp->TFDListDMAhandle);
+err_free_rx_1:
+	pci_free_consistent(pdev, IPG_RX_RING_BYTES, sp->RFDList,
+			    sp->RFDListDMAhandle);
+err_free_irq_0:
+	free_irq(pdev->irq, dev);
+	goto out;
 }
 
 static int init_rfdlist(struct net_device *dev)
@@ -1593,13 +1635,16 @@ static int init_rfdlist(struct net_devic
 	sp->RxBuffNotReady = 0;
 
 	for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
+		if (!sp->RxBuff[i])
+			continue;
+
 		/* Free any allocated receive buffers. */
 		pci_unmap_single(sp->pdev,
 				 sp->RxBuffDMAhandle[i].dmahandle,
 				 sp->RxBuffDMAhandle[i].len,
 				 PCI_DMA_FROMDEVICE);
-		if (sp->RxBuff[i] != NULL)
-			IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
+
+		IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
 		sp->RxBuff[i] = NULL;
 
 		/* Clear out the RFS field. */
@@ -1727,11 +1772,11 @@ static int ipg_get_rxbuff(struct net_dev
 
 static int ipg_nic_stop(struct net_device *dev)
 {
-	/* Release resources requested by driver open function. */
+	struct ipg_nic_private *sp = netdev_priv(dev);
+	struct pci_dev *pdev = sp->pdev;
 
 	int i;
 	int error;
-	struct ipg_nic_private *sp = netdev_priv(dev);
 
 	IPG_DEBUG_MSG("_nic_stop\n");
 
@@ -1752,40 +1797,20 @@ static int ipg_nic_stop(struct net_devic
 
 	error = ipg_reset(dev, i);
 	if (error < 0) {
+		// FIXME FIXME FIXME: giant leak alert
 		return error;
 	}
 
-	/* Free all receive buffers. */
-	for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
-		pci_unmap_single(sp->pdev,
-				 sp->RxBuffDMAhandle[i].dmahandle,
-				 sp->RxBuffDMAhandle[i].len,
-				 PCI_DMA_FROMDEVICE);
-		if (sp->RxBuff[i] != NULL)
-			IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
-		sp->RxBuff[i] = NULL;
-	}
+	ipg_rx_clear(sp);
 
-	/* Free all transmit buffers. */
-	for (i = 0; i < IPG_TFDLIST_LENGTH; i++) {
-		if (sp->TxBuff[i] != NULL)
-			IPG_DEV_KFREE_SKB(sp->TxBuff[i]);
-		sp->TxBuff[i] = NULL;
-	}
+	ipg_tx_clear(sp);
 
 	netif_stop_queue(dev);
 
-	/* Free memory associated with the RFDList. */
-	pci_free_consistent(sp->pdev,
-			    (sizeof(struct RFD) *
-			     IPG_RFDLIST_LENGTH),
-			    sp->RFDList, sp->RFDListDMAhandle);
-
-	/* Free memory associated with the TFDList. */
-	pci_free_consistent(sp->pdev,
-			    (sizeof(struct TFD) *
-			     IPG_TFDLIST_LENGTH),
-			    sp->TFDList, sp->TFDListDMAhandle);
+	pci_free_consistent(pdev, IPG_RX_RING_BYTES, sp->RFDList,
+			    sp->RFDListDMAhandle);
+	pci_free_consistent(pdev, IPG_TX_RING_BYTES, sp->TFDList,
+			    sp->TFDListDMAhandle);
 
 	/* Release interrupt line. */
 	free_irq(dev->irq, dev);
-- 
1.3.1


^ permalink raw reply related

* [PATCH] vlan: sysfs support
From: Stephen Hemminger @ 2006-05-01 23:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Ben Greear, David S. Miller, netdev, vlan
In-Reply-To: <20060501140834.43a006fd@localhost.localdomain>

Here is a more complete version of vlan sysfs support. Sysfs support is
good because it means scripts don't have to depend on parsing interface
names that may change.

Assuming there is a vlan 5 added to eth0 then the following links are added:

/sys/class/net/eth0/vlan_group/5 -> ../../../../class/net/eth0.5
/sys/class/net/eth0.5/vlan_device -> ../../../class/net/eth0
and one file /sys/class/net/eth0/vlan_id  that contains "5\n"

It handles the reference counts on the vlan_groups properly, but still
has a race between hotplug and creating these sysfs objects because
of the chicken/egg problem with register_netdevice interface.


Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

--- vlan.orig/net/8021q/Makefile	2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/Makefile	2006-05-01 15:27:55.000000000 -0700
@@ -4,9 +4,7 @@
 
 obj-$(CONFIG_VLAN_8021Q) += 8021q.o
 
-8021q-objs := vlan.o vlan_dev.o
-
-ifeq ($(CONFIG_PROC_FS),y)
-8021q-objs += vlanproc.o
-endif
+8021q-y := vlan.o vlan_dev.o
 
+8021q-$(CONFIG_PROC_FS) += vlanproc.o
+8021q-$(CONFIG_SYSFS) += vlan_sysfs.o
--- vlan.orig/net/8021q/vlan.c	2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/vlan.c	2006-05-01 16:17:12.000000000 -0700
@@ -193,9 +193,21 @@
 	return NULL;
 }
 
+/* Callback after last packet and any open sysfs handles are gone. */
+static void vlan_grp_release(struct kobject *kobj)
+{
+	kfree(container_of(kobj, struct vlan_group, kobj));
+}
+
+static struct kobj_type vlan_grp_ktype = {
+	.release = vlan_grp_release,
+};
+
+/* Callback after last packet in flight has passed. */
 static void vlan_rcu_free(struct rcu_head *rcu)
 {
-	kfree(container_of(rcu, struct vlan_group, rcu));
+	struct vlan_group *grp = container_of(rcu, struct vlan_group, rcu);
+	kobject_put(&grp->kobj);
 }
 
 
@@ -232,6 +244,8 @@
 			/* Remove proc entry */
 			vlan_proc_rem_dev(dev);
 
+			vlan_sysfs_remove(dev, real_dev,  grp, vlan_id);
+
 			/* Take it out of our own structures, but be sure to
 			 * interlock with HW accelerating devices or SW vlan
 			 * input packet processing.
@@ -265,6 +279,8 @@
 				hlist_del_rcu(&grp->hlist);
 
 				/* Free the group, after all cpu's are done. */
+				kobject_uevent(&grp->kobj, KOBJ_REMOVE);
+				kobject_del(&grp->kobj);
 				call_rcu(&grp->rcu, vlan_rcu_free);
 
 				grp = NULL;
@@ -531,13 +547,17 @@
 	 * so it cannot "appear" on us.
 	 */
 	if (!grp) { /* need to add a new group */
-		grp = kmalloc(sizeof(struct vlan_group), GFP_KERNEL);
+		grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
 		if (!grp)
 			goto out_free_unregister;
 					
 		/* printk(KERN_ALERT "VLAN REGISTER:  Allocated new group.\n"); */
-		memset(grp, 0, sizeof(struct vlan_group));
 		grp->real_dev_ifindex = real_dev->ifindex;
+		kobject_init(&grp->kobj);
+		kobject_set_name(&grp->kobj, "vlan_group");
+		grp->kobj.parent = &real_dev->class_dev.kobj;
+		grp->kobj.ktype = &vlan_grp_ktype;
+		kobject_register(&grp->kobj);
 
 		hlist_add_head_rcu(&grp->hlist, 
 				   &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]);
@@ -557,6 +577,9 @@
 
 	rtnl_unlock();
 
+	if (vlan_sysfs_add(new_dev, real_dev, grp, VLAN_ID))
+		printk(KERN_WARNING "VLAN: failed to create sysfs entry for %s\n",
+		       new_dev->name);
 
 #ifdef VLAN_DEBUG
 	printk(VLAN_DBG "Allocated new device successfully, returning.\n");
--- vlan.orig/net/8021q/vlan.h	2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/vlan.h	2006-05-01 16:08:18.000000000 -0700
@@ -69,4 +69,15 @@
 int vlan_dev_get_vid(const char* dev_name, unsigned short* result);
 void vlan_dev_set_multicast_list(struct net_device *vlan_dev);
 
+#ifdef CONFIG_SYSFS
+int vlan_sysfs_add(struct net_device *dev, struct net_device *real_dev,
+		   struct vlan_group *grp, unsigned short tag);
+void vlan_sysfs_remove(struct net_device *dev, struct net_device *real_dev,
+		       struct vlan_group *grp, unsigned short tag);
+#else
+#define vlan_sysfs_add(dev, realdev, grp, tag)	(0)
+#define vlan_sysfs_remove(dev, realdev, grp, tag)  do { } while (0)
+#endif
+
+
 #endif /* !(__BEN_VLAN_802_1Q_INC__) */
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ vlan/net/8021q/vlan_sysfs.c	2006-05-01 16:08:18.000000000 -0700
@@ -0,0 +1,59 @@
+/*
+ * VLAN sysfs interface.
+ *
+ * Basic access to vlan information via sysfs.
+ * Authors:
+ * Stephen Hemminger		<shemminger@osdl.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include "vlan.h"
+
+static ssize_t show_vlan_id(struct class_device *cd, char *buf)
+{
+	struct net_device *vlandev = container_of(cd, struct net_device, class_dev);
+
+	return sprintf(buf, "%d\n", VLAN_DEV_INFO(vlandev)->vlan_id);
+}
+
+static CLASS_DEVICE_ATTR(vlan_id, S_IRUGO, show_vlan_id, NULL);
+
+int vlan_sysfs_add(struct net_device *dev, struct net_device *real_dev,
+		   struct vlan_group *grp, unsigned short tag)
+{
+	int ret;
+	char buf[IFNAMSIZ];
+
+	ret = sysfs_create_link(&dev->class_dev.kobj,
+				&real_dev->class_dev.kobj, "vlan_device");
+	if (ret)
+		goto out;
+
+	sprintf(buf, "%d", tag);
+	ret = sysfs_create_link(&grp->kobj, &dev->class_dev.kobj, buf);
+	if (ret)
+		goto out;
+
+	ret = class_device_create_file(&dev->class_dev, &class_device_attr_vlan_id);
+ out:
+	return ret;
+}
+
+void vlan_sysfs_remove(struct net_device *dev, struct net_device *real_dev,
+		       struct vlan_group *grp, unsigned short id)
+{
+	char buf[IFNAMSIZ];
+
+	sprintf(buf, "%d", id);
+	sysfs_remove_link(&grp->kobj, buf);
+	sysfs_remove_link(&dev->class_dev.kobj, "vlan_device");
+
+	return class_device_remove_file(&dev->class_dev,
+					&class_device_attr_vlan_id);
+}
--- vlan.orig/include/linux/if_vlan.h	2006-05-01 16:07:16.000000000 -0700
+++ vlan/include/linux/if_vlan.h	2006-05-01 16:08:18.000000000 -0700
@@ -77,6 +77,7 @@
 	struct hlist_node	hlist;	/* linked list */
 	struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN];
 	struct rcu_head		rcu;
+	struct kobject 	        kobj;
 };
 
 struct vlan_priority_tci_mapping {

^ permalink raw reply

* Re: [PATCH 2/3] Eleminate HZ from NET/ROM kernel interfaces
From: Ralf Baechle @ 2006-05-01 23:52 UTC (permalink / raw)
  To: David S. Miller; +Cc: pidoux, netdev, linux-hams
In-Reply-To: <20060430.172136.99531184.davem@davemloft.net>

On Sun, Apr 30, 2006 at 05:21:36PM -0700, David S. Miller wrote:

> > With such extensive patches for netrom and rose modules that will go 
> > into a future 2.6.x kernel, I think it would be justified to update the 
> > following banners in af_rose.c and af_netrom.c respectively for they 
> > appear during boot :
> 
> It might be worthwhile to remove the messages altogether.
> 
> IPV4 and the core networking used to output similar initialization
> log messages and it really doesn't really add anything but pollute
> the already voluminous kernel log.
> 
> So I say we just remove it.

Agreed, patch to remove the messages is below.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 net/netrom/af_netrom.c |    3 ---
 net/rose/af_rose.c     |    3 ---
 2 files changed, 6 deletions(-)

Index: linux-net.git/net/netrom/af_netrom.c
===================================================================
--- linux-net.git.orig/net/netrom/af_netrom.c	2006-04-30 10:28:32.000000000 +0100
+++ linux-net.git/net/netrom/af_netrom.c	2006-05-02 00:48:59.000000000 +0100
@@ -1370,8 +1370,6 @@ static struct notifier_block nr_dev_noti
 
 static struct net_device **dev_nr;
 
-static char banner[] __initdata = KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n";
-
 static int __init nr_proto_init(void)
 {
 	int i;
@@ -1419,7 +1417,6 @@ static int __init nr_proto_init(void)
 	}
 		
 	register_netdevice_notifier(&nr_dev_notifier);
-	printk(banner);
 
 	ax25_protocol_register(AX25_P_NETROM, nr_route_frame);
 	ax25_linkfail_register(nr_link_failed);
Index: linux-net.git/net/rose/af_rose.c
===================================================================
--- linux-net.git.orig/net/rose/af_rose.c	2006-04-30 13:29:58.000000000 +0100
+++ linux-net.git/net/rose/af_rose.c	2006-05-02 00:48:28.000000000 +0100
@@ -1469,8 +1469,6 @@ static struct notifier_block rose_dev_no
 
 static struct net_device **dev_rose;
 
-static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n";
-
 static int __init rose_proto_init(void)
 {
 	int i;
@@ -1519,7 +1517,6 @@ static int __init rose_proto_init(void)
 
 	sock_register(&rose_family_ops);
 	register_netdevice_notifier(&rose_dev_notifier);
-	printk(banner);
 
 	ax25_protocol_register(AX25_P_ROSE, rose_route_frame);
 	ax25_linkfail_register(rose_link_failed);

^ permalink raw reply

* Net driver maintenance through May 12
From: Jeff Garzik @ 2006-05-02  0:16 UTC (permalink / raw)
  To: Netdev List
  Cc: Linux Kernel, Stephen Hemminger, Andrew Morton, Linus Torvalds


Stephen Hemminger has agreed to help out with net driver maintenance 
through May 12, when I return from honeymoon.  Thanks, Stephen!

I've got a few patches for 2.6.17-rc that I'll push in the next 24 
hours, then I'm unplugged until May 12.  Already unsubscribed from LKML, 
even <sniff>.

netdev-2.6.git#upstream is what I have queued for 2.6.18 so far.

	Jeff




^ permalink raw reply

* Re: IP1000 gigabit nic driver
From: David Vrabel @ 2006-05-02  0:36 UTC (permalink / raw)
  To: Lennert Buytenhek
  Cc: Francois Romieu, Pekka Enberg, linux-kernel, netdev, david
In-Reply-To: <20060501204150.GC1450@xi.wantstofly.org>

Lennert Buytenhek wrote:
> On Mon, May 01, 2006 at 10:38:47PM +0200, Francois Romieu wrote:
> 
> 
>>>-/* Minimum number of miliseconds used to toggle MDC clock during
>>>+/* Minimum number of nanoseconds used to toggle MDC clock during
>>>  * MII/GMII register access.
>>>  */
>>>-#define         IPG_PC_PHYCTRLWAIT           0x01
>>>+#define		IPG_PC_PHYCTRLWAIT_NS		200
>>
>>I would have expected a cycle of 400 ns (p.72/77 of the datasheet)
>>for a 2.5 MHz clock. Why is it cut by a two factor ?
> 
> 
> 200 ns high + 200 ns low = 400 ns clock period?

Yes.

David

^ permalink raw reply

* [Patch 4/8] Utilities for genetlink usage
From: Balbir Singh @ 2006-05-02  6:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: lse-tech, jlan, Jamal, Thomas Graf, netdev


genetlink-utils.patch

Two utilities for simplifying usage of NETLINK_GENERIC
interface.

Signed-off-by: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
---

 include/net/genetlink.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

diff -puN include/net/genetlink.h~genetlink-utils include/net/genetlink.h
--- linux-2.6.17-rc3/include/net/genetlink.h~genetlink-utils	2006-05-02 07:35:15.000000000 +0530
+++ linux-2.6.17-rc3-balbir/include/net/genetlink.h	2006-05-02 07:35:52.000000000 +0530
@@ -150,4 +150,24 @@ static inline int genlmsg_unicast(struct
 	return nlmsg_unicast(genl_sock, skb, pid);
 }
 
+/**
+ * gennlmsg_data - head of message payload
+ * @gnlh: genetlink messsage header
+ */
+static inline void *genlmsg_data(const struct genlmsghdr *gnlh)
+{
+	return ((unsigned char *) gnlh + GENL_HDRLEN);
+}
+
+/**
+ * genlmsg_len - length of message payload
+ * @gnlh: genetlink message header
+ */
+static inline int genlmsg_len(const struct genlmsghdr *gnlh)
+{
+	struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh -
+							NLMSG_HDRLEN);
+	return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
+}
+
 #endif	/* __NET_GENERIC_NETLINK_H */
_

^ permalink raw reply

* Re: [PATCH 1/3] ipg: removal of unreachable code
From: Pekka J Enberg @ 2006-05-02  6:36 UTC (permalink / raw)
  To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231007.GB7419@electric-eye.fr.zoreil.com>

On Tue, 2 May 2006, Francois Romieu wrote:
> map/unmap is done in ipg_{probe/remove}

Applied. Thanks!

				Pekka

^ permalink raw reply

* Re: [PATCH 2/3] ipg: leaks in ipg_probe
From: Pekka J Enberg @ 2006-05-02  6:41 UTC (permalink / raw)
  To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231050.GC7419@electric-eye.fr.zoreil.com>

On Tue, 2 May 2006, Francois Romieu wrote:
> The error paths are badly broken.
> 
> Bonus:
> - remove duplicate initialization of sp;
> - remove useless NULL initialization of dev;
> - USE_IO_OPS is not used (and the driver does not seem to care about
>   posted writes, rejoice).
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

Applied. Thanks! One comment below.

On Tue, 2 May 2006, Francois Romieu wrote:
> -	err = pci_request_regions(pdev, DRV_NAME);
> -	if (err)
> -		goto out;
> -
> -	pio_start = pci_resource_start(pdev, 0) & 0xffffff80;
> -	pio_len = pci_resource_len(pdev, 0);
> -	mmio_start = pci_resource_start(pdev, 1) & 0xffffff80;
> +	rc = pci_request_regions(pdev, DRV_NAME);
> +	if (rc)
> +		goto err_free_dev_1;

Is this tested with hardware? Alignment of the start address looks bogus 
for sure, but any idea why they had it in the first place?

				Pekka

^ permalink raw reply

* Re: [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open
From: Pekka J Enberg @ 2006-05-02  6:45 UTC (permalink / raw)
  To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231206.GD7419@electric-eye.fr.zoreil.com>

On Tue, 2 May 2006, Francois Romieu wrote:
> Added ipg_{rx/tx}_clear() to factor out some code.
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

Applied. Thanks!

			Pekka

^ permalink raw reply

* Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch
From: Evgeniy Polyakov @ 2006-05-02  7:08 UTC (permalink / raw)
  To: David S. Miller; +Cc: shemminger, caitlinb, kelly, rusty, netdev
In-Reply-To: <20060501.143246.112559350.davem@davemloft.net>

On Mon, May 01, 2006 at 02:32:46PM -0700, David S. Miller (davem@davemloft.net) wrote:
> From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> Date: Sat, 29 Apr 2006 16:44:51 +0400
> 
> > Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> 
> I understand how in some ways this is work in progress,
> but direct calls into ext3 from the kevent code?  I'd
> like stuff like that cleaned up before reviewing :-)

Well, this only requires per address space ->get_block() callback,
which is what ext3_get_block() is.

I will update and resend patchset today.

Thank you.

-- 
	Evgeniy Polyakov

^ permalink raw reply

* [1/1] Kevent subsystem.
From: Evgeniy Polyakov @ 2006-05-02  8:10 UTC (permalink / raw)
  To: David S. Miller; +Cc: shemminger, caitlinb, kelly, rusty, netdev
In-Reply-To: <20060501.143246.112559350.davem@davemloft.net>

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

Kevent subsystem incorporates several AIO/kqueue design notes and
ideas. Kevent can be used both for edge and level triggered notifications.

It supports:
o socket notifications (accept, receiving and sending)
o network AIO (aio_send(), aio_recv() and aio_sendfile()) [3]
o inode notifications (create/remove)
o generic poll()/select() notifications
o timer notifications

More info, design notes, benchmarks (web server based on epoll, kevent, 
kevent_poll; naio_send() vs. send(), naio_recv() vs. recv() with different number 
of sending/receiving users) can be found on project's homepage [1].

Userspace interface was greatly described in LWN article [2].

1. kevent homepage.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=kevent

2. LWN article about kevent.
http://lwn.net/Articles/172844/

3. Network AIO (aio_send(), aio_recv(), aio_sendfile()).
http://tservice.net.ru/~s0mbre/old/?section=projects&item=naio

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>

-- 
	Evgeniy Polyakov

[-- Attachment #2: kevent_full.diff.3.gz --]
[-- Type: application/x-gunzip, Size: 24072 bytes --]

^ permalink raw reply

* Re: [PATCH] bcm43xx-d80211: proper implementation of virtual interface support
From: Jiri Benc @ 2006-05-02 11:20 UTC (permalink / raw)
  To: Michael Buesch; +Cc: John W. Linville, bcm43xx-dev, netdev
In-Reply-To: <200605012135.00895.mb@bu3sch.de>

On Mon, 1 May 2006 21:35:00 +0200, Michael Buesch wrote:
> --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h	2006-04-28 16:13:40.000000000 +0200
> +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h	2006-05-01 20:25:31.000000000 +0200
> @@ -626,10 +626,34 @@
>  	u8 algorithm;
>  };
>  
> +struct bcm43xx_interface {
> +	struct list_head list;
> +	/* Interface type (IEEE80211_IF_TYPE_XXX). */
> +	int type;
> +	/* Opaque ID from the ieee80211 subsystem. Do not modify. */
> +	int if_id;
> +	/* MAC address for this interface. */
> +	u8 *mac_addr;
> +	/* BSSID (if any). */
> +	u8 *bssid;
> +};
> +
> +struct bcm43xx_interface_list {
> +	/* Linked list of active interfaces. */
> +	struct list_head list;
> +	/* Shortcut pointer to the AP interface (if any). */
> +	struct bcm43xx_interface *ap_if;
> +
> +	/* Usage counters of the internal operation modes. */
> +	u16 opmode_ap;
> +	u16 opmode_adhoc;
> +	u16 opmode_monitor;
> +	u16 opmode_promisc;
> +};
> +

This is unnecessary. AFAIK bcm43xx hardware doesn't support more than one
interface at a time (not counting monitor interfaces as those are somewhat
special). There is no need for the linked list.

Instead of those structures above, use something like this:

struct bcm43xx_interface {
	/* Interface type (IEEE80211_IF_TYPE_XXX). */
	int type;
	/* MAC address for this interface. */
	u8 *mac_addr;
	/* BSSID (if any). */
	u8 *bssid;
	/* Number of monitor interfaces. */
	int monitors;
	/* STA, IBSS, AP or WDS running? */
	int oper;
}

You need this structure just once per hw card.

In add_interface callback:
- If conf->type is MNTR:
	- If bcm43xx_interface->oper is FALSE and
	  bcm43xx_interface->monitors is 0, initialize the card.
	- If bcm43xx_interface->monitors is 0, switch the card to monitor
	  mode (enable promisc mode, enable receiving of control frames,
	  etc.)
	- Increase bcm43xx_interface->monitors.
- If conf->type != MNTR:
	- If bcm43xx_interface->oper is TRUE, return error.
	- Set bcm43xx_interface->oper to TRUE.
	- Set bcm43xx_interface->type to conf->type.
	- Set hw MAC address according to conf->mac_addr.
	- If bcm43xx_interface->monitors is 0, initialize the card.

In remove_interface callback:
- If conf->type is MNTR:
	- Decrease bcm43xx_interface->monitors.
	- If bcm43xx_interface->monitors is 0, switch the card from monitor
	  mode (disable promisc mode if not forced by set_multicast_list,
	  disable receiving of control frames, etc.)
	- If bcm43xx_interface->oper is FALSE and
	  bcm43xx_interface->monitors is 0, deinitialize the card.
- If conf->type != MNTR:
	- Set bcm43xx_interface->oper to FALSE.
	- If bcm43xx_interface->monitors is 0, deinitialize the card.

In config_interface callback:
- If conf->type is MNTR, please report a bug :-)
- Assume you are configuring the only interface you have running.

> [...]
> +	iface = kzalloc(sizeof(*iface), GFP_KERNEL);
> +	if (!iface)
> +		return -ENOMEM;
> +	INIT_LIST_HEAD(&iface->list);
> +	iface->type = conf->type;
> +	iface->if_id = conf->if_id;
> +	iface->mac_addr = conf->mac_addr;
> +
> +	bcm43xx_lock_mmio(bcm, flags);
> +	switch (conf->type) {
> +	case IEEE80211_IF_TYPE_AP:
> +		/* Cannot run more than one AP or concurrently
> +		 * with IBSS mode.
> +		 */
> +		if (bcm->interfaces.opmode_ap)
> +			break;
> +		if (bcm->interfaces.opmode_adhoc)
> +			break;
> +		bcm->interfaces.opmode_ap++;
> +		bcm->interfaces.ap_if = iface;
> +		err = 0;
> +		break;
> +	case IEEE80211_IF_TYPE_STA:
> +		/* Cannot run STA and AP or IBSS mode concurrently. */
> +		if (bcm->interfaces.opmode_ap)
> +			break;
> +		if (bcm->interfaces.opmode_adhoc)
> +			break;
> +		err = 0;
> +		break;

"ifconfig ap up ; ifconfig sta up" will succeed, while
"ifconfig sta up ; ifconfig ap up" won't.

Also, you cannot allow multiple STA interfaces, unless you can configure the
card to ack frames destined to several MAC addresses.

Nevertheless, this is all addressed by the solution suggested above.

> +	case IEEE80211_IF_TYPE_IBSS:
> +		/* Cannot run more than one IBSS or concurrently
> +		 * with AP mode.
> +		 */
> +		if (bcm->interfaces.opmode_ap)
> +			break;
> +		if (bcm->interfaces.opmode_adhoc)
> +			break;
> +		bcm->interfaces.opmode_adhoc++;
> +		err = 0;
> +		break;
> +	case IEEE80211_IF_TYPE_MNTR:
> +		bcm->interfaces.opmode_monitor++;
> +		err = 0;
> +		break;
> +	case IEEE80211_IF_TYPE_WDS:
> +		//TODO: Uhm..., well.
> +		break;

Please return more appropriate error code (-EINVAL perhaps?).

> +	default:
> +		assert(0);
>  	}

Thanks,

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply

* Re: Van Jacobson's net channels and real-time
From: Vojtech Pavlik @ 2006-05-02 12:41 UTC (permalink / raw)
  To: linux-os (Dick Johnson)
  Cc: Auke Kok, Auke Kok, Ingo Oeser, Jörn Engel, Ingo Oeser,
	David S. Miller, simlo, linux-kernel, mingo, netdev
In-Reply-To: <Pine.LNX.4.61.0604250717590.28279@chaos.analogic.com>

On Tue, Apr 25, 2006 at 07:29:40AM -0400, linux-os (Dick Johnson) wrote:

> >> Message signaled interrupts are just a kudge to save a trace on a
> >> PC board (read make junk cheaper still).
> >
> > yes. Also in PCI-Express there is no physical interrupt line anymore due to
> > the architecture, so even classical interrupts are sent as "message" over the bus.
> >
> >> They are not faster and may even be slower.
> >
> > thus in the case of PCI-Express, MSI interrupts are just as fast as the
> > ordinary ones. I have no numbers on whether MSI is faster or not then e.g.
> > interrupts on PCI-X, but generally speaking, the PCI-Express bus is not
> > designed to be "low latency" at all, at best it gives you X latency, where X
> > is something like microseconds. The MSI message itself only takes 10-20
> > nanoseconds though, but all the handling probably adds a large factor to that
> > (1000 or so). No clue on classical interrupt line latency - anyone?
> 
> About 9 nanosecond per foot of FR-4 (G10) trace, plus the access time
> through the gate-arrays (about 20 ns) so, from the time a device needs
> the CPU, until it hits the interrupt pin, you have typically 30 to
> 50 nanoseconds. Of course the CPU is __much__ slower. However, these
> physical latencies are in series, cannot be compensated for because
> the CPU can't see into the future.
 
You seem to be missing the fact that most of todays interrupts are
delivered through the APIC bus, which isn't fast at all.

-- 
Vojtech Pavlik
Director SuSE Labs

^ permalink raw reply

* [Bug 6480] Transmitter of CK804 hangs hard, needs power cycle to recover
From: Ingo Oeser @ 2006-05-02 13:49 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Stephen Hemminger, netdev, bugme-daemon

Hi Manfred,

I filed BUG 6480 describing the problem and providing lots
of info. If you need more info, just ask.

At the moment I have no idea about the reasons.
Except Crossover-Cabling vs. using a switch.

The machine is a production machine, so I cannot test
kernels and patches. 

But I have several machines with identical hardware where
I can test this.

Once we can reproduce it without a Sonicwall, I can build a 
test setup using any kernel hackery required to resolve the issue :-)

Could you please contact the right nVIDIA people, if needed?

PS: Stephen, you are not CC'ed from bugzilla and 
      "agreed to help out with net driver maintenance" 
       so I CC'ed you here manually.

Regards

Ingo Oeser

^ permalink raw reply

* Re: [PATCH] au1000_eth.c Power Management, driver registration and module support
From: Rodolfo Giometti @ 2006-05-02 15:09 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: jgarzik, netdev, Linux-MIPS
In-Reply-To: <4446857D.90507@ru.mvista.com>

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

Hello,

here:

   http://ftp.enneenne.com/pub/misc/au1100-patches/linux/patch-au1000_eth-pm-and-registration

the new version of my patch for au1000_eth.c who should implement:

* Module support.

   -	bool "MIPS AU1000 Ethernet support"
   +	tristate "MIPS AU1000 Ethernet support"

* Driver registration.

   +static int __init au1000_eth_init(void)
   +{
   +	return driver_register(&au1000_driver);
   +}
   +
   +static void __exit au1000_eth_cleanup(void)
   +{
   +	driver_unregister(&au1000_driver);
   +}      

* Power Management.

   +#ifdef CONFIG_PM
   +	.suspend        = au1000_drv_suspend,
   +	.resume         = au1000_drv_resume,
   +#endif

Also, as suggested by Sergei it:

* uses physical addresses and not KSEG1-based virtual anymore and
  claims/releases the 4-byte MAC enable registers:

   wwpc:~# cat /proc/iomem
   10500000-1050ffff : eth-base
   10520000-10520003 : eth-mac
      
* assigns to the Ethernet ports two consecutive MAC addresses:

   -		dev->dev_addr[4] += 0x10;
   +				((unsigned long) macen_addr);
   +		memcpy(ndev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
   +		ndev->dev_addr[5] += 0x01;
      
Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Disabling "TCP Treason uncloaked"
From: Just Marc @ 2006-05-02 16:19 UTC (permalink / raw)
  To: netdev

Hi everyone,

Looking at mailing list archives there has been much talk of this print 
in the past, given the fact that this check/print is surrounded by an 
#ifdef TCP_DEBUG

#ifdef TCP_DEBUG
       if (net_ratelimit()) {
           struct inet_sock *inet = inet_sk(sk);
           printk(KERN_DEBUG "TCP: Treason uncloaked! Peer 
%u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
                  NIPQUAD(inet->daddr), htons(inet->dport),
                  inet->num, tp->snd_una, tp->snd_nxt);
       }
#endif

I thought that maybe it's time to either set TCP_DEBUG to 0 or 
alternatively allow an admin to toggle the printing of this message 
off/on?  On a few busy web servers running usually latest versions of 
2.6 I have this message displaying hundreds (if not more) times a day, 
completely clogging the kernel log and making it harder to see if there 
are more interesting messages being printed.   TCP_DEBUG is being used 
in one more place that may also not require it anymore and or have it 
always enabled.

So, is it time to disable this print altogether? Is it time to allow an 
admin to toggle printing of this thing off?

Thanks for your time

^ permalink raw reply

* Re: Disabling "TCP Treason uncloaked"
From: Andi Kleen @ 2006-05-02 16:02 UTC (permalink / raw)
  To: Just Marc; +Cc: netdev
In-Reply-To: <44578691.4020402@corky.net>

On Tuesday 02 May 2006 18:19, Just Marc wrote:

> I thought that maybe it's time to either set TCP_DEBUG to 0 or 
> alternatively allow an admin to toggle the printing of this message 
> off/on?  On a few busy web servers running usually latest versions of 
> 2.6 I have this message displaying hundreds (if not more) times a day, 

You're talking to a lot of broken TCP clients then.

> completely clogging the kernel log and making it harder to see if there 
> are more interesting messages being printed.   TCP_DEBUG is being used 
> in one more place that may also not require it anymore and or have it 
> always enabled.

It's better to use run time switches for these kind of things.

> So, is it time to disable this print altogether? Is it time to allow an 
> admin to toggle printing of this thing off?

If it's disabled there should be probably a netstat counter for the condition instead.

It might be a reasonable simple beginner project for someone:

- Convert all NETDEBUGs/TCP_DEBUG to a single netdebug sysctl
- Then perhaps make a CONFIG to change its default: 0 or 1
- Add statistics counters for all of these conditions

-Andi

^ permalink raw reply

* Re: Van Jacobson's net channels and real-time
From: Andi Kleen @ 2006-05-02 15:58 UTC (permalink / raw)
  To: Vojtech Pavlik
  Cc: linux-os (Dick Johnson), Auke Kok, Auke Kok, Ingo Oeser,
	Jörn Engel, Ingo Oeser, David S. Miller, simlo, linux-kernel,
	mingo, netdev
In-Reply-To: <20060502124131.GA13160@suse.cz>

On Tuesday 02 May 2006 14:41, Vojtech Pavlik wrote:
 
> You seem to be missing the fact that most of todays interrupts are
> delivered through the APIC bus, which isn't fast at all.

You mean slow right?  Modern x86s (anything newer than a P3) generally don't 
have an separate APIC bus anymore but just send messages over their main
processor connection.

-Andi

^ permalink raw reply

* Re: [PATCH 001/100] TCP congestion module: add TCP-LP supporting for 2.6.16
From: Stephen Hemminger @ 2006-05-02 17:16 UTC (permalink / raw)
  To: Wong Edison; +Cc: netdev
In-Reply-To: <3feffd230605010305o6e3b1511of1f75b17f2797e66@mail.gmail.com>

On Mon, 1 May 2006 18:05:52 +0800
"Wong Edison" <hswong3i@gmail.com> wrote:

> TCP Low Priority is a distributed algorithm whose goal is to utilize only
> the excess network bandwidth as compared to the ``fair share`` of
> bandwidth as targeted by TCP. Available from:
>   http://www.ece.rice.edu/~akuzma/Doc/akuzma/TCP-LP.pdf
> 
> See http://www-ece.rice.edu/networks/TCP-LP/ for their implementation.
> Our group take the following changes from
> the original TCP-LP implementation:
>   o We use newReno in most core CA handling. Only add some checking
>     within cong_avoid.
>   o Error correcting in remote HZ, therefore remote HZ will be keeped
>     on checking and updating.
>   o Handling calculation of One-Way-Delay (OWD) within rtt_sample, sicne
>     OWD have a similar meaning as RTT. Also correct the buggy formular.
>   o Handle reaction for Early Congestion Indication (ECI) within
>     pkts_acked, as mentioned within pseudo code.
>   o OWD is handled in relative format, where local time stamp will in
>     tcp_time_stamp format.
> 
> Port from 2.4.19 to 2.6.16 as module by:
>   Wong Hoi Sing Edison <hswong3i@gmail.com>
>   Hung Hing Lun <hlhung3i@gmail.com>
> 
> Signed-off-by: Wong Hoi Sing Edison <hswong3i@gmail.com>
> 

Is this all of it?  Your subject line says there are a 99 more pieces.
That seems huge.

^ permalink raw reply

* Re: [PATCH 001/100] TCP congestion module: add TCP-LP supporting for 2.6.16
From: Stephen Hemminger @ 2006-05-02 17:23 UTC (permalink / raw)
  To: Wong Edison; +Cc: netdev, linux-kernel
In-Reply-To: <3feffd230605010305o6e3b1511of1f75b17f2797e66@mail.gmail.com>


> +/**
> + * struct lp
> + * @flag: TCP-LP state flag
> + * @sowd: smoothed OWD << 3
> + * @owd_min: min OWD
> + * @owd_max: max OWD
> + * @owd_max_rsv: resrved max owd
> + * @RHZ: estimated remote HZ
> + * @remote_ref_time: remote reference time
> + * @local_ref_time: local reference time
> + * @last_drop: time for last active drop
> + * @inference: current inference
> + *
> + * TCP-LP's private struct.
> + * We get the idea from original TCP-LP implementation where only left those we
> + * found are really useful.
> + */
> +struct lp {
> +	u32 flag;
> +	u32 sowd;
> +	u32 owd_min;
> +	u32 owd_max;
> +	u32 owd_max_rsv;
> +	u32 RHZ;
> +	u32 remote_ref_time;
> +	u32 local_ref_time;
> +	u32 last_drop;
> +	u32 inference;
> +};

It is best to keep structure element names lower case.
s/RHZ/rhz/

or use remote_hz


^ permalink raw reply

* Re: [PATCH 2/3] ipg: leaks in ipg_probe
From: Francois Romieu @ 2006-05-02 18:33 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <Pine.LNX.4.58.0605020936420.4066@sbz-30.cs.Helsinki.FI>

Pekka J Enberg <penberg@cs.Helsinki.FI> :
[...]
> Is this tested with hardware?

No.

> Alignment of the start address looks bogus for sure, but any idea
> why they had it in the first place?

No clear idea but it matches the significant part of the BAR register
for the 256 bytes of I/O space that the device uses.

-- 
Ueimor

^ permalink raw reply

* net/d80211 and management interface (wmaster0ap)
From: Jouni Malinen @ 2006-05-02 18:39 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev

It looks like one of your patches in wireless-dev.git broke management
interface. I'm not completely sure about how this was supposed to work,
but are the low-level drivers now expected to accept
IEEE80211_IF_TYPE_MGMT in add_interface handler or should ieee80211.c be
modified to accept wmaster0ap to be set UP without asking the low-level
driver? The patch below does the former by modifying bcm43xx_main.c to
have a special case for IEEE80211_IF_TYPE_MGMT. This interface itself
does not require additional functionality from the low-level driver.

In addition to this, it looked like sending packets from wmaster0ap did
not work. The packets were being dropped since originating device
(wmaster0ap) did not match in is_ieee80211_device(). This function
seemed to use wireless_handlers pointer for recognizing interfaces which
(like to comment says) is not that nice. wireless_handlers were not set
for apdev, so the patch below adds it to make TX work through
wmaster0ap.

Does these match with your understanding of how the management interface
is supposed to work now after your patches went in?



Allow management interface (wmaster0ap) to be set UP with bcm43xx and
allow frames to be sent through it by making sure that
is_ieee80211_device(apdev) returns 1.

Signed-off-by: Jouni Malinen <jkm@devicescape.com>


Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211.c
+++ wireless-dev/net/d80211/ieee80211.c
@@ -4115,6 +4115,8 @@ struct net_device *ieee80211_alloc_hw(si
 	ether_setup(apdev);
 	apdev->priv = local;
 	apdev->hard_start_xmit = ieee80211_mgmt_start_xmit;
+	apdev->wireless_handlers =
+		(struct iw_handler_def *) &ieee80211_iw_handler_def;
 	apdev->change_mtu = ieee80211_change_mtu_apdev;
 	apdev->get_stats = ieee80211_get_stats;
         apdev->open = ieee80211_open;
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -4195,6 +4195,9 @@ static int bcm43xx_add_interface(struct 
 {
 	struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
 
+	if (conf->type == IEEE80211_IF_TYPE_MGMT)
+		return 0;
+
 	if (bcm->interfaces > 0)
 		return -ENOBUFS;
 	if (conf->type == IEEE80211_IF_TYPE_MNTR) {

-- 
Jouni Malinen                                            PGP id EFC895FA

^ 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