diff options
Diffstat (limited to 'drivers/net/benet')
-rw-r--r-- | drivers/net/benet/be.h | 1 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 60 |
2 files changed, 35 insertions, 26 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 63d593d53153..f327be57ca96 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -194,6 +194,7 @@ struct be_adapter { | |||
194 | struct be_eq_obj rx_eq; | 194 | struct be_eq_obj rx_eq; |
195 | struct be_rx_obj rx_obj; | 195 | struct be_rx_obj rx_obj; |
196 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ | 196 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ |
197 | bool rx_post_starved; /* Zero rx frags have been posted to BE */ | ||
197 | 198 | ||
198 | struct vlan_group *vlan_grp; | 199 | struct vlan_group *vlan_grp; |
199 | u16 num_vlans; | 200 | u16 num_vlans; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 897a63de5bdb..0ecaffb70e58 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -273,26 +273,6 @@ static void be_rx_eqd_update(struct be_adapter *adapter) | |||
273 | rx_eq->cur_eqd = eqd; | 273 | rx_eq->cur_eqd = eqd; |
274 | } | 274 | } |
275 | 275 | ||
276 | static void be_worker(struct work_struct *work) | ||
277 | { | ||
278 | struct be_adapter *adapter = | ||
279 | container_of(work, struct be_adapter, work.work); | ||
280 | int status; | ||
281 | |||
282 | /* Check link */ | ||
283 | be_link_status_update(adapter); | ||
284 | |||
285 | /* Get Stats */ | ||
286 | status = be_cmd_get_stats(&adapter->ctrl, &adapter->stats.cmd); | ||
287 | if (!status) | ||
288 | netdev_stats_update(adapter); | ||
289 | |||
290 | /* Set EQ delay */ | ||
291 | be_rx_eqd_update(adapter); | ||
292 | |||
293 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); | ||
294 | } | ||
295 | |||
296 | static struct net_device_stats *be_get_stats(struct net_device *dev) | 276 | static struct net_device_stats *be_get_stats(struct net_device *dev) |
297 | { | 277 | { |
298 | struct be_adapter *adapter = netdev_priv(dev); | 278 | struct be_adapter *adapter = netdev_priv(dev); |
@@ -493,7 +473,7 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu) | |||
493 | * program them in BE. If more than BE_NUM_VLANS_SUPPORTED are configured, | 473 | * program them in BE. If more than BE_NUM_VLANS_SUPPORTED are configured, |
494 | * set the BE in promiscuous VLAN mode. | 474 | * set the BE in promiscuous VLAN mode. |
495 | */ | 475 | */ |
496 | static void be_vids_config(struct net_device *netdev) | 476 | static void be_vid_config(struct net_device *netdev) |
497 | { | 477 | { |
498 | struct be_adapter *adapter = netdev_priv(netdev); | 478 | struct be_adapter *adapter = netdev_priv(netdev); |
499 | u16 vtag[BE_NUM_VLANS_SUPPORTED]; | 479 | u16 vtag[BE_NUM_VLANS_SUPPORTED]; |
@@ -536,7 +516,7 @@ static void be_vlan_add_vid(struct net_device *netdev, u16 vid) | |||
536 | adapter->num_vlans++; | 516 | adapter->num_vlans++; |
537 | adapter->vlan_tag[vid] = 1; | 517 | adapter->vlan_tag[vid] = 1; |
538 | 518 | ||
539 | be_vids_config(netdev); | 519 | be_vid_config(netdev); |
540 | } | 520 | } |
541 | 521 | ||
542 | static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) | 522 | static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) |
@@ -547,7 +527,7 @@ static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) | |||
547 | adapter->vlan_tag[vid] = 0; | 527 | adapter->vlan_tag[vid] = 0; |
548 | 528 | ||
549 | vlan_group_set_device(adapter->vlan_grp, vid, NULL); | 529 | vlan_group_set_device(adapter->vlan_grp, vid, NULL); |
550 | be_vids_config(netdev); | 530 | be_vid_config(netdev); |
551 | } | 531 | } |
552 | 532 | ||
553 | static void be_set_multicast_filter(struct net_device *netdev) | 533 | static void be_set_multicast_filter(struct net_device *netdev) |
@@ -900,8 +880,11 @@ static void be_post_rx_frags(struct be_adapter *adapter) | |||
900 | page_info->last_page_user = true; | 880 | page_info->last_page_user = true; |
901 | 881 | ||
902 | if (posted) { | 882 | if (posted) { |
903 | be_rxq_notify(&adapter->ctrl, rxq->id, posted); | ||
904 | atomic_add(posted, &rxq->used); | 883 | atomic_add(posted, &rxq->used); |
884 | be_rxq_notify(&adapter->ctrl, rxq->id, posted); | ||
885 | } else if (atomic_read(&rxq->used) == 0) { | ||
886 | /* Let be_worker replenish when memory is available */ | ||
887 | adapter->rx_post_starved = true; | ||
905 | } | 888 | } |
906 | 889 | ||
907 | return; | 890 | return; |
@@ -1305,6 +1288,31 @@ int be_poll_tx(struct napi_struct *napi, int budget) | |||
1305 | return 1; | 1288 | return 1; |
1306 | } | 1289 | } |
1307 | 1290 | ||
1291 | static void be_worker(struct work_struct *work) | ||
1292 | { | ||
1293 | struct be_adapter *adapter = | ||
1294 | container_of(work, struct be_adapter, work.work); | ||
1295 | int status; | ||
1296 | |||
1297 | /* Check link */ | ||
1298 | be_link_status_update(adapter); | ||
1299 | |||
1300 | /* Get Stats */ | ||
1301 | status = be_cmd_get_stats(&adapter->ctrl, &adapter->stats.cmd); | ||
1302 | if (!status) | ||
1303 | netdev_stats_update(adapter); | ||
1304 | |||
1305 | /* Set EQ delay */ | ||
1306 | be_rx_eqd_update(adapter); | ||
1307 | |||
1308 | if (adapter->rx_post_starved) { | ||
1309 | adapter->rx_post_starved = false; | ||
1310 | be_post_rx_frags(adapter); | ||
1311 | } | ||
1312 | |||
1313 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); | ||
1314 | } | ||
1315 | |||
1308 | static void be_msix_enable(struct be_adapter *adapter) | 1316 | static void be_msix_enable(struct be_adapter *adapter) |
1309 | { | 1317 | { |
1310 | int i, status; | 1318 | int i, status; |
@@ -1422,6 +1430,8 @@ static int be_open(struct net_device *netdev) | |||
1422 | if (status != 0) | 1430 | if (status != 0) |
1423 | goto do_none; | 1431 | goto do_none; |
1424 | 1432 | ||
1433 | be_vid_config(netdev); | ||
1434 | |||
1425 | status = be_cmd_set_flow_control(ctrl, true, true); | 1435 | status = be_cmd_set_flow_control(ctrl, true, true); |
1426 | if (status != 0) | 1436 | if (status != 0) |
1427 | goto if_destroy; | 1437 | goto if_destroy; |
@@ -1856,8 +1866,6 @@ static int be_resume(struct pci_dev *pdev) | |||
1856 | pci_set_power_state(pdev, 0); | 1866 | pci_set_power_state(pdev, 0); |
1857 | pci_restore_state(pdev); | 1867 | pci_restore_state(pdev); |
1858 | 1868 | ||
1859 | be_vids_config(netdev); | ||
1860 | |||
1861 | if (netif_running(netdev)) { | 1869 | if (netif_running(netdev)) { |
1862 | rtnl_lock(); | 1870 | rtnl_lock(); |
1863 | be_open(netdev); | 1871 | be_open(netdev); |