Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233097
b: refs/heads/master
c: 3e9d08e
h: refs/heads/master
i:
  233095: 2eb8cc3
v: v3
  • Loading branch information
Bruce Rogers authored and David S. Miller committed Feb 10, 2011
1 parent 0ee46dc commit 9a04848
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 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: 96642d42f076101ba98866363d908cab706d156c
refs/heads/master: 3e9d08ec0a68f6faf718d5a7e050fe5ca0ba004f
27 changes: 16 additions & 11 deletions trunk/drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq)
}
}

static void virtnet_napi_enable(struct virtnet_info *vi)
{
napi_enable(&vi->napi);

/* If all buffers were filled by other side before we napi_enabled, we
* won't get another interrupt, so process any outstanding packets
* now. virtnet_poll wants re-enable the queue, so we disable here.
* We synchronize against interrupts via NAPI_STATE_SCHED */
if (napi_schedule_prep(&vi->napi)) {
virtqueue_disable_cb(vi->rvq);
__napi_schedule(&vi->napi);
}
}

static void refill_work(struct work_struct *work)
{
struct virtnet_info *vi;
Expand All @@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work)
vi = container_of(work, struct virtnet_info, refill.work);
napi_disable(&vi->napi);
still_empty = !try_fill_recv(vi, GFP_KERNEL);
napi_enable(&vi->napi);
virtnet_napi_enable(vi);

/* In theory, this can happen: if we don't get any buffers in
* we will *never* try to fill again. */
Expand Down Expand Up @@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);

napi_enable(&vi->napi);

/* If all buffers were filled by other side before we napi_enabled, we
* won't get another interrupt, so process any outstanding packets
* now. virtnet_poll wants re-enable the queue, so we disable here.
* We synchronize against interrupts via NAPI_STATE_SCHED */
if (napi_schedule_prep(&vi->napi)) {
virtqueue_disable_cb(vi->rvq);
__napi_schedule(&vi->napi);
}
virtnet_napi_enable(vi);
return 0;
}

Expand Down

0 comments on commit 9a04848

Please sign in to comment.