mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
virtio_net: Add schedule check to napi_enable call
commit 3e9d08ec0a upstream.
Under harsh testing conditions, including low memory, the guest would
stop receiving packets. With this patch applied we no longer see any
problems in the driver while performing these tests for extended periods
of time.
Make sure napi is scheduled subsequent to each napi_enable.
Signed-off-by: Bruce Rogers <brogers@novell.com>
Signed-off-by: Olaf Kirch <okir@suse.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[bwh: Adjust for 2.6.32]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
25f60b72ea
commit
f32cd617fe
@@ -391,6 +391,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)) {
|
||||
vi->rvq->vq_ops->disable_cb(vi->rvq);
|
||||
__napi_schedule(&vi->napi);
|
||||
}
|
||||
}
|
||||
|
||||
static void refill_work(struct work_struct *work)
|
||||
{
|
||||
struct virtnet_info *vi;
|
||||
@@ -399,7 +413,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. */
|
||||
@@ -591,16 +605,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)) {
|
||||
vi->rvq->vq_ops->disable_cb(vi->rvq);
|
||||
__napi_schedule(&vi->napi);
|
||||
}
|
||||
virtnet_napi_enable(vi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user