aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-23 12:25:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-23 12:25:58 -0400
commitd56ffd38a93841a07c839a375049a56b51e9567c (patch)
treeac668709aa6f973de26e993f21adcf98626bed46 /drivers/net/benet/be_main.c
parent12a37b5e2c93f6550b82490c3de6d4eedc509c39 (diff)
parent61fa9dcf9329cb92c220f7b656410fbe5e72f933 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (32 commits) ucc_geth: Fix oops when using fixed-link support dm9000: locking bugfix net: update dnet.c for bus_id removal dnet: DNET should depend on HAS_IOMEM dca: add missing copyright/license headers nl80211: Check that function pointer != NULL before using it sungem: missing net_device_ops be2net: fix to restore vlan ids into BE2 during a IF DOWN->UP cycle be2net: replenish when posting to rx-queue is starved in out of mem conditions bas_gigaset: correctly allocate USB interrupt transfer buffer smsc911x: reset last known duplex and carrier on open sh_eth: Fix mistake of the address of SH7763 sh_eth: Change handling of IRQ netns: oops in ip[6]_frag_reasm incrementing stats net: kfree(napi->skb) => kfree_skb net: fix sctp breakage ipv6: fix display of local and remote sit endpoints net: Document /proc/sys/net/core/netdev_budget tulip: fix crash on iface up with shirq debug virtio_net: Make virtio_net support carrier detection ...
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r--drivers/net/benet/be_main.c60
1 files changed, 34 insertions, 26 deletions
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
276static 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
296static struct net_device_stats *be_get_stats(struct net_device *dev) 276static 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 */
496static void be_vids_config(struct net_device *netdev) 476static 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
542static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) 522static 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
553static void be_set_multicast_filter(struct net_device *netdev) 533static 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
1291static 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
1308static void be_msix_enable(struct be_adapter *adapter) 1316static 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);