Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183241
b: refs/heads/master
c: 2d6ddce
h: refs/heads/master
i:
  183239: 0177349
v: v3
  • Loading branch information
Scott Feldman authored and David S. Miller committed Dec 24, 2009
1 parent b85b043 commit 2a0b8f1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3d18d191bb805f3effdfc083c4ce79789470b46
refs/heads/master: 2d6ddced5c99cf79c06b9b6ec1366ab63b970ea9
54 changes: 33 additions & 21 deletions trunk/drivers/net/enic/enic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ static int enic_poll(struct napi_struct *napi, int budget)
unsigned int rq_work_to_do = budget;
unsigned int wq_work_to_do = -1; /* no limit */
unsigned int work_done, rq_work_done, wq_work_done;
int err;

/* Service RQ (first) and WQ
*/
Expand All @@ -1114,16 +1115,19 @@ static int enic_poll(struct napi_struct *napi, int budget)
0 /* don't unmask intr */,
0 /* don't reset intr timer */);

if (rq_work_done > 0) {
err = vnic_rq_fill(&enic->rq[0], enic->rq_alloc_buf);

/* Replenish RQ
*/
/* Buffer allocation failed. Stay in polling
* mode so we can try to fill the ring again.
*/

vnic_rq_fill(&enic->rq[0], enic->rq_alloc_buf);
if (err)
rq_work_done = rq_work_to_do;

} else {
if (rq_work_done < rq_work_to_do) {

/* If no work done, flush all LROs and exit polling
/* Some work done, but not enough to stay in polling,
* flush all LROs and exit polling
*/

if (netdev->features & NETIF_F_LRO)
Expand All @@ -1142,32 +1146,38 @@ static int enic_poll_msix(struct napi_struct *napi, int budget)
struct net_device *netdev = enic->netdev;
unsigned int work_to_do = budget;
unsigned int work_done;
int err;

/* Service RQ
*/

work_done = vnic_cq_service(&enic->cq[ENIC_CQ_RQ],
work_to_do, enic_rq_service, NULL);

if (work_done > 0) {

/* Replenish RQ
*/

vnic_rq_fill(&enic->rq[0], enic->rq_alloc_buf);

/* Return intr event credits for this polling
* cycle. An intr event is the completion of a
* RQ packet.
*/
/* Return intr event credits for this polling
* cycle. An intr event is the completion of a
* RQ packet.
*/

if (work_done > 0)
vnic_intr_return_credits(&enic->intr[ENIC_MSIX_RQ],
work_done,
0 /* don't unmask intr */,
0 /* don't reset intr timer */);
} else {

/* If no work done, flush all LROs and exit polling
err = vnic_rq_fill(&enic->rq[0], enic->rq_alloc_buf);

/* Buffer allocation failed. Stay in polling mode
* so we can try to fill the ring again.
*/

if (err)
work_done = work_to_do;

if (work_done < work_to_do) {

/* Some work done, but not enough to stay in polling,
* flush all LROs and exit polling
*/

if (netdev->features & NETIF_F_LRO)
Expand Down Expand Up @@ -1350,11 +1360,13 @@ static int enic_open(struct net_device *netdev)
}

for (i = 0; i < enic->rq_count; i++) {
err = vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf);
if (err) {
vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf);
/* Need at least one buffer on ring to get going */
if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
printk(KERN_ERR PFX
"%s: Unable to alloc receive buffers.\n",
netdev->name);
err = -ENOMEM;
goto err_out_notify_unset;
}
}
Expand Down

0 comments on commit 2a0b8f1

Please sign in to comment.