aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-15 03:13:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-15 03:13:44 -0400
commite308a5d806c852f56590ffdd3834d0df0cbed8d7 (patch)
tree294ff654e90950f5162737c26f4799b0b710b748 /drivers/net/forcedeth.c
parentf1f28aa3510ddb84c966bac65611bb866c77a092 (diff)
netdev: Add netdev->addr_list_lock protection.
Add netif_addr_{lock,unlock}{,_bh}() helpers. Use them to protect operations that operate on or read the network device unicast and multicast address lists. Also use them in cases where the code simply wants to block calls into the driver's ->set_rx_mode() and ->set_multicast_list() methods. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 786d668c612e..4ed89fa9ae46 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2831,6 +2831,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
2831 */ 2831 */
2832 nv_disable_irq(dev); 2832 nv_disable_irq(dev);
2833 netif_tx_lock_bh(dev); 2833 netif_tx_lock_bh(dev);
2834 netif_addr_lock(dev);
2834 spin_lock(&np->lock); 2835 spin_lock(&np->lock);
2835 /* stop engines */ 2836 /* stop engines */
2836 nv_stop_rxtx(dev); 2837 nv_stop_rxtx(dev);
@@ -2855,6 +2856,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu)
2855 /* restart rx engine */ 2856 /* restart rx engine */
2856 nv_start_rxtx(dev); 2857 nv_start_rxtx(dev);
2857 spin_unlock(&np->lock); 2858 spin_unlock(&np->lock);
2859 netif_addr_unlock(dev);
2858 netif_tx_unlock_bh(dev); 2860 netif_tx_unlock_bh(dev);
2859 nv_enable_irq(dev); 2861 nv_enable_irq(dev);
2860 } 2862 }
@@ -2891,6 +2893,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
2891 2893
2892 if (netif_running(dev)) { 2894 if (netif_running(dev)) {
2893 netif_tx_lock_bh(dev); 2895 netif_tx_lock_bh(dev);
2896 netif_addr_lock(dev);
2894 spin_lock_irq(&np->lock); 2897 spin_lock_irq(&np->lock);
2895 2898
2896 /* stop rx engine */ 2899 /* stop rx engine */
@@ -2902,6 +2905,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr)
2902 /* restart rx engine */ 2905 /* restart rx engine */
2903 nv_start_rx(dev); 2906 nv_start_rx(dev);
2904 spin_unlock_irq(&np->lock); 2907 spin_unlock_irq(&np->lock);
2908 netif_addr_unlock(dev);
2905 netif_tx_unlock_bh(dev); 2909 netif_tx_unlock_bh(dev);
2906 } else { 2910 } else {
2907 nv_copy_mac_to_hw(dev); 2911 nv_copy_mac_to_hw(dev);
@@ -3971,6 +3975,7 @@ static void nv_do_nic_poll(unsigned long data)
3971 printk(KERN_INFO "forcedeth: MAC in recoverable error state\n"); 3975 printk(KERN_INFO "forcedeth: MAC in recoverable error state\n");
3972 if (netif_running(dev)) { 3976 if (netif_running(dev)) {
3973 netif_tx_lock_bh(dev); 3977 netif_tx_lock_bh(dev);
3978 netif_addr_lock(dev);
3974 spin_lock(&np->lock); 3979 spin_lock(&np->lock);
3975 /* stop engines */ 3980 /* stop engines */
3976 nv_stop_rxtx(dev); 3981 nv_stop_rxtx(dev);
@@ -3995,6 +4000,7 @@ static void nv_do_nic_poll(unsigned long data)
3995 /* restart rx engine */ 4000 /* restart rx engine */
3996 nv_start_rxtx(dev); 4001 nv_start_rxtx(dev);
3997 spin_unlock(&np->lock); 4002 spin_unlock(&np->lock);
4003 netif_addr_unlock(dev);
3998 netif_tx_unlock_bh(dev); 4004 netif_tx_unlock_bh(dev);
3999 } 4005 }
4000 } 4006 }
@@ -4202,6 +4208,7 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
4202 4208
4203 nv_disable_irq(dev); 4209 nv_disable_irq(dev);
4204 netif_tx_lock_bh(dev); 4210 netif_tx_lock_bh(dev);
4211 netif_addr_lock(dev);
4205 /* with plain spinlock lockdep complains */ 4212 /* with plain spinlock lockdep complains */
4206 spin_lock_irqsave(&np->lock, flags); 4213 spin_lock_irqsave(&np->lock, flags);
4207 /* stop engines */ 4214 /* stop engines */
@@ -4215,6 +4222,7 @@ static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
4215 */ 4222 */
4216 nv_stop_rxtx(dev); 4223 nv_stop_rxtx(dev);
4217 spin_unlock_irqrestore(&np->lock, flags); 4224 spin_unlock_irqrestore(&np->lock, flags);
4225 netif_addr_unlock(dev);
4218 netif_tx_unlock_bh(dev); 4226 netif_tx_unlock_bh(dev);
4219 } 4227 }
4220 4228
@@ -4360,10 +4368,12 @@ static int nv_nway_reset(struct net_device *dev)
4360 if (netif_running(dev)) { 4368 if (netif_running(dev)) {
4361 nv_disable_irq(dev); 4369 nv_disable_irq(dev);
4362 netif_tx_lock_bh(dev); 4370 netif_tx_lock_bh(dev);
4371 netif_addr_lock(dev);
4363 spin_lock(&np->lock); 4372 spin_lock(&np->lock);
4364 /* stop engines */ 4373 /* stop engines */
4365 nv_stop_rxtx(dev); 4374 nv_stop_rxtx(dev);
4366 spin_unlock(&np->lock); 4375 spin_unlock(&np->lock);
4376 netif_addr_unlock(dev);
4367 netif_tx_unlock_bh(dev); 4377 netif_tx_unlock_bh(dev);
4368 printk(KERN_INFO "%s: link down.\n", dev->name); 4378 printk(KERN_INFO "%s: link down.\n", dev->name);
4369 } 4379 }
@@ -4471,6 +4481,7 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ri
4471 if (netif_running(dev)) { 4481 if (netif_running(dev)) {
4472 nv_disable_irq(dev); 4482 nv_disable_irq(dev);
4473 netif_tx_lock_bh(dev); 4483 netif_tx_lock_bh(dev);
4484 netif_addr_lock(dev);
4474 spin_lock(&np->lock); 4485 spin_lock(&np->lock);
4475 /* stop engines */ 4486 /* stop engines */
4476 nv_stop_rxtx(dev); 4487 nv_stop_rxtx(dev);
@@ -4519,6 +4530,7 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ri
4519 /* restart engines */ 4530 /* restart engines */
4520 nv_start_rxtx(dev); 4531 nv_start_rxtx(dev);
4521 spin_unlock(&np->lock); 4532 spin_unlock(&np->lock);
4533 netif_addr_unlock(dev);
4522 netif_tx_unlock_bh(dev); 4534 netif_tx_unlock_bh(dev);
4523 nv_enable_irq(dev); 4535 nv_enable_irq(dev);
4524 } 4536 }
@@ -4556,10 +4568,12 @@ static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam*
4556 if (netif_running(dev)) { 4568 if (netif_running(dev)) {
4557 nv_disable_irq(dev); 4569 nv_disable_irq(dev);
4558 netif_tx_lock_bh(dev); 4570 netif_tx_lock_bh(dev);
4571 netif_addr_lock(dev);
4559 spin_lock(&np->lock); 4572 spin_lock(&np->lock);
4560 /* stop engines */ 4573 /* stop engines */
4561 nv_stop_rxtx(dev); 4574 nv_stop_rxtx(dev);
4562 spin_unlock(&np->lock); 4575 spin_unlock(&np->lock);
4576 netif_addr_unlock(dev);
4563 netif_tx_unlock_bh(dev); 4577 netif_tx_unlock_bh(dev);
4564 } 4578 }
4565 4579
@@ -4946,6 +4960,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
4946 napi_disable(&np->napi); 4960 napi_disable(&np->napi);
4947#endif 4961#endif
4948 netif_tx_lock_bh(dev); 4962 netif_tx_lock_bh(dev);
4963 netif_addr_lock(dev);
4949 spin_lock_irq(&np->lock); 4964 spin_lock_irq(&np->lock);
4950 nv_disable_hw_interrupts(dev, np->irqmask); 4965 nv_disable_hw_interrupts(dev, np->irqmask);
4951 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { 4966 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
@@ -4959,6 +4974,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
4959 /* drain rx queue */ 4974 /* drain rx queue */
4960 nv_drain_rxtx(dev); 4975 nv_drain_rxtx(dev);
4961 spin_unlock_irq(&np->lock); 4976 spin_unlock_irq(&np->lock);
4977 netif_addr_unlock(dev);
4962 netif_tx_unlock_bh(dev); 4978 netif_tx_unlock_bh(dev);
4963 } 4979 }
4964 4980