]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
virtio_net: implement flush flag for ndo_xdp_xmit
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 31 May 2018 09:00:08 +0000 (11:00 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 3 Jun 2018 15:11:34 +0000 (08:11 -0700)
When passed the XDP_XMIT_FLUSH flag virtnet_xdp_xmit now performs the
same virtqueue_kick as virtnet_xdp_flush.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
drivers/net/virtio_net.c

index 4ed823625953b43c57bb438682cd54d02973b5a0..62ba8aadd8e68f9097eea746c1e1a0de9f888149 100644 (file)
@@ -481,7 +481,7 @@ static int virtnet_xdp_xmit(struct net_device *dev,
        int err;
        int i;
 
-       if (unlikely(flags & ~XDP_XMIT_FLAGS_NONE))
+       if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
                return -EINVAL;
 
        qp = vi->curr_queue_pairs - vi->xdp_queue_pairs + smp_processor_id();
@@ -507,6 +507,10 @@ static int virtnet_xdp_xmit(struct net_device *dev,
                        drops++;
                }
        }
+
+       if (flags & XDP_XMIT_FLUSH)
+               virtqueue_kick(sq->vq);
+
        return n - drops;
 }