Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2505

kernel-2.6.18-238.el5.src.rpm

From: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Fri, 30 Apr 2010 08:02:16 -0400
Subject: [net] bxn2x: add dynamic lro disable support
Message-id: <20100430080216.GB2664@dhcp-lab-161.englab.brq.redhat.com>
Patchwork-id: 24701
O-Subject: [RHEL5.6 PATCH 2/5 v2] implement dynamic lro disable for network
	device drivers: bnx2x (bz 582367)
Bugzilla: 582367
RH-Acked-by: Neil Horman <nhorman@redhat.com>
RH-Acked-by: Andy Gospodarek <gospo@redhat.com>

Modify bnx2x to register a lro_disable method

v1 -> v2
- use bp->flags to actual disable LRO
- unregister LRO before netdev

diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 6a96d9c..b68c9d8 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -12182,6 +12182,23 @@ request_firmware_exit:
 	return rc;
 }
 
+static int bnx2x_disable_lro(struct net_device *dev)
+{
+	struct bnx2x *bp = netdev_priv(dev);
+
+	if (!(bp->flags & TPA_ENABLE_FLAG))
+		return 0;
+
+	bp->flags &= ~TPA_ENABLE_FLAG;
+
+	if (netif_running(dev)) {
+		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
+		bnx2x_nic_load(bp, LOAD_NORMAL);
+	}
+
+	return 0;
+}
+
 
 static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 				    const struct pci_device_id *ent)
@@ -12229,6 +12246,13 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
 		goto init_one_exit;
 	}
 
+	rc = register_lro_netdev(dev, bnx2x_disable_lro);
+	if (rc) {
+		dev_err(&pdev->dev, "Cannot register lro disable function\n");
+		unregister_netdev(dev);
+		goto init_one_exit;
+	}
+
 	bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed);
 	printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
 	       " IRQ %d, ", dev->name, board_info[ent->driver_data].name,
@@ -12271,6 +12295,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
 	}
 	bp = netdev_priv(dev);
 
+	unregister_lro_netdev(dev);
 	unregister_netdev(dev);
 
 	kfree(bp->init_ops_offsets);