aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-02-04 23:49:57 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-02-04 07:49:58 -0500
commit18445c4d501b9ab4336f66ef46b092661ddaf336 (patch)
tree9d23185f207d912942890cf047d1d3200806b401 /drivers/net/virtio_net.c
parenta586d4f6016f7139d8c26df0e6927131168d3b5b (diff)
virtio: explicit enable_cb/disable_cb rather than callback return.
It seems that virtio_net wants to disable callbacks (interrupts) before calling netif_rx_schedule(), so we can't use the return value to do so. Rename "restart" to "cb_enable" and introduce "cb_disable" hook: callback now returns void, rather than a boolean. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4b8138312750..7b0059f0f5d4 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -52,13 +52,12 @@ static inline void vnet_hdr_to_sg(struct scatterlist *sg, struct sk_buff *skb)
52 sg_init_one(sg, skb_vnet_hdr(skb), sizeof(struct virtio_net_hdr)); 52 sg_init_one(sg, skb_vnet_hdr(skb), sizeof(struct virtio_net_hdr));
53} 53}
54 54
55static bool skb_xmit_done(struct virtqueue *rvq) 55static void skb_xmit_done(struct virtqueue *rvq)
56{ 56{
57 struct virtnet_info *vi = rvq->vdev->priv; 57 struct virtnet_info *vi = rvq->vdev->priv;
58 58
59 /* In case we were waiting for output buffers. */ 59 /* In case we were waiting for output buffers. */
60 netif_wake_queue(vi->dev); 60 netif_wake_queue(vi->dev);
61 return true;
62} 61}
63 62
64static void receive_skb(struct net_device *dev, struct sk_buff *skb, 63static void receive_skb(struct net_device *dev, struct sk_buff *skb,
@@ -161,12 +160,14 @@ static void try_fill_recv(struct virtnet_info *vi)
161 vi->rvq->vq_ops->kick(vi->rvq); 160 vi->rvq->vq_ops->kick(vi->rvq);
162} 161}
163 162
164static bool skb_recv_done(struct virtqueue *rvq) 163static void skb_recv_done(struct virtqueue *rvq)
165{ 164{
166 struct virtnet_info *vi = rvq->vdev->priv; 165 struct virtnet_info *vi = rvq->vdev->priv;
167 netif_rx_schedule(vi->dev, &vi->napi); 166 /* Schedule NAPI, Suppress further interrupts if successful. */
168 /* Suppress further interrupts. */ 167 if (netif_rx_schedule_prep(vi->dev, &vi->napi)) {
169 return false; 168 rvq->vq_ops->disable_cb(rvq);
169 __netif_rx_schedule(vi->dev, &vi->napi);
170 }
170} 171}
171 172
172static int virtnet_poll(struct napi_struct *napi, int budget) 173static int virtnet_poll(struct napi_struct *napi, int budget)
@@ -192,7 +193,7 @@ again:
192 /* Out of packets? */ 193 /* Out of packets? */
193 if (received < budget) { 194 if (received < budget) {
194 netif_rx_complete(vi->dev, napi); 195 netif_rx_complete(vi->dev, napi);
195 if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) 196 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
196 && netif_rx_reschedule(vi->dev, napi)) 197 && netif_rx_reschedule(vi->dev, napi))
197 goto again; 198 goto again;
198 } 199 }