aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAmit Kumar Salecha <amit@netxen.com>2009-09-05 13:43:09 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-07 04:53:09 -0400
commitd0725e4d3ccf603c4fcf3589850cb464c927d42a (patch)
treebc7b737bab7b103796fd04479db4f28ced45090b /drivers
parent6a581e93981e8838c85e407303186faf937830d3 (diff)
netxen: fix ip addr hashing after firmware reset
Reprogram local IP addresses after firmware is reset or after resuming from suspend. Signed-off-by: Amit Kumar Salecha <amit@netxen.com> Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 498943601379..7038e1baaf4f 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -86,6 +86,8 @@ static irqreturn_t netxen_intr(int irq, void *data);
86static irqreturn_t netxen_msi_intr(int irq, void *data); 86static irqreturn_t netxen_msi_intr(int irq, void *data);
87static irqreturn_t netxen_msix_intr(int irq, void *data); 87static irqreturn_t netxen_msix_intr(int irq, void *data);
88 88
89static void netxen_config_indev_addr(struct net_device *dev, unsigned long);
90
89/* PCI Device ID Table */ 91/* PCI Device ID Table */
90#define ENTRY(device) \ 92#define ENTRY(device) \
91 {PCI_DEVICE(PCI_VENDOR_ID_NETXEN, (device)), \ 93 {PCI_DEVICE(PCI_VENDOR_ID_NETXEN, (device)), \
@@ -1411,6 +1413,8 @@ netxen_nic_resume(struct pci_dev *pdev)
1411 goto err_out_detach; 1413 goto err_out_detach;
1412 1414
1413 netif_device_attach(netdev); 1415 netif_device_attach(netdev);
1416
1417 netxen_config_indev_addr(netdev, NETDEV_UP);
1414 } 1418 }
1415 1419
1416 netxen_schedule_work(adapter, netxen_fw_poll_work, FW_POLL_DELAY); 1420 netxen_schedule_work(adapter, netxen_fw_poll_work, FW_POLL_DELAY);
@@ -2057,6 +2061,7 @@ netxen_attach_work(struct work_struct *work)
2057 goto done; 2061 goto done;
2058 } 2062 }
2059 2063
2064 netxen_config_indev_addr(netdev, NETDEV_UP);
2060 } 2065 }
2061 2066
2062 netif_device_attach(netdev); 2067 netif_device_attach(netdev);
@@ -2282,12 +2287,43 @@ netxen_destip_supported(struct netxen_adapter *adapter)
2282 return 1; 2287 return 1;
2283} 2288}
2284 2289
2290static void
2291netxen_config_indev_addr(struct net_device *dev, unsigned long event)
2292{
2293 struct in_device *indev;
2294 struct netxen_adapter *adapter = netdev_priv(dev);
2295
2296 if (netxen_destip_supported(adapter))
2297 return;
2298
2299 indev = in_dev_get(dev);
2300 if (!indev)
2301 return;
2302
2303 for_ifa(indev) {
2304 switch (event) {
2305 case NETDEV_UP:
2306 netxen_config_ipaddr(adapter,
2307 ifa->ifa_address, NX_IP_UP);
2308 break;
2309 case NETDEV_DOWN:
2310 netxen_config_ipaddr(adapter,
2311 ifa->ifa_address, NX_IP_DOWN);
2312 break;
2313 default:
2314 break;
2315 }
2316 } endfor_ifa(indev);
2317
2318 in_dev_put(indev);
2319 return;
2320}
2321
2285static int netxen_netdev_event(struct notifier_block *this, 2322static int netxen_netdev_event(struct notifier_block *this,
2286 unsigned long event, void *ptr) 2323 unsigned long event, void *ptr)
2287{ 2324{
2288 struct netxen_adapter *adapter; 2325 struct netxen_adapter *adapter;
2289 struct net_device *dev = (struct net_device *)ptr; 2326 struct net_device *dev = (struct net_device *)ptr;
2290 struct in_device *indev;
2291 2327
2292recheck: 2328recheck:
2293 if (dev == NULL) 2329 if (dev == NULL)
@@ -2303,32 +2339,13 @@ recheck:
2303 2339
2304 adapter = netdev_priv(dev); 2340 adapter = netdev_priv(dev);
2305 2341
2306 if (!adapter || !netxen_destip_supported(adapter)) 2342 if (!adapter)
2307 goto done; 2343 goto done;
2308 2344
2309 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) 2345 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
2310 goto done; 2346 goto done;
2311 2347
2312 indev = in_dev_get(dev); 2348 netxen_config_indev_addr(dev, event);
2313 if (!indev)
2314 goto done;
2315
2316 for_ifa(indev) {
2317 switch (event) {
2318 case NETDEV_UP:
2319 netxen_config_ipaddr(adapter,
2320 ifa->ifa_address, NX_IP_UP);
2321 break;
2322 case NETDEV_DOWN:
2323 netxen_config_ipaddr(adapter,
2324 ifa->ifa_address, NX_IP_DOWN);
2325 break;
2326 default:
2327 break;
2328 }
2329 } endfor_ifa(indev);
2330
2331 in_dev_put(indev);
2332done: 2349done:
2333 return NOTIFY_DONE; 2350 return NOTIFY_DONE;
2334} 2351}