cxgb2: rtnl_lock out of loop will be faster
Subsystems (2)
PATCH 1/4 cxgb2: rtnl_lock out of loop will be faster
[PATCH 1/4] [NETDEV] cxgb2: rtnl_lock out of loop will be faster
Before this patch, it gets and releases the lock at each iteration of the loop. Changing unregister_netdev to unregister_netdevice and locking outside of the loop will be faster for this approach.
Signed-off-by Wang Chen <[email protected]>
--- cxgb2.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/chelsio/cxgb2.c +4 -1
@@ -46,6 +46,7 @@#include <linux/mii.h> #include <linux/sockios.h> #include <linux/dma-mapping.h> +#include <linux/rtnetlink.h> #include <asm/uaccess.h> #include "cpl5_cmd.h"
@@ -1387,10 +1388,12 @@ static void __devexit remove_one(structstruct adapter *adapter = dev->priv;int i; +rtnl_lock ();for_each_port (adapter, i) {if (test_bit (i, &adapter->registered_device_map)) -unregister_netdev (adapter->port[i].dev); +unregister_netdevice (adapter->port[i].dev); } +rtnl_unlock ();t1_free_sw_modules (adapter);iounmap (adapter->regs);