Skip to content

Commit

Permalink
virtio_net: implement flush flag for ndo_xdp_xmit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesper Dangaard Brouer authored and Alexei Starovoitov committed Jun 3, 2018
1 parent 0c9d917 commit 5d274cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}

Expand Down

0 comments on commit 5d274cb

Please sign in to comment.