aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSathya Perla <sathyap@serverengines.com>2009-03-20 02:56:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-20 02:56:20 -0400
commitea1dae11e0baca5d633207fe50fc3cd30a5d68ee (patch)
treee87606f10432ab66dd5d486939f49e1bce299f61 /drivers
parent170ebf85160dd128e1c4206cc197cce7d1424705 (diff)
be2net: replenish when posting to rx-queue is starved in out of mem conditions
This is a patch to replenish the rx-queue when it is in a starved state (due to out-of-mem conditions) Signed-off-by: Sathya Perla <sathyap@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_main.c50
2 files changed, 30 insertions, 21 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..80fe1e055d91 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);
@@ -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;