diff mbox series

[bpf-next] virtio_net: update xdp_features with xdp multi-buff

Message ID 60c76cd63a0246db785606e8891b925fd5c9bf06.1675763384.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Commit 30bbf891f1b8fd92db271c7198609a076d7fbf14
Delegated to: BPF
Headers show
Series [bpf-next] virtio_net: update xdp_features with xdp multi-buff | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lorenzo Bianconi Feb. 7, 2023, 9:53 a.m. UTC
Now virtio-net supports xdp multi-buffer so add it to xdp_features

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/virtio_net.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael S. Tsirkin Feb. 7, 2023, 2:31 p.m. UTC | #1
On Tue, Feb 07, 2023 at 10:53:40AM +0100, Lorenzo Bianconi wrote:
> Now virtio-net supports xdp multi-buffer so add it to xdp_features
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

makes sense


Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 692dff071782..ddc3dc7ea73c 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3281,7 +3281,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog,
>  				virtnet_clear_guest_offloads(vi);
>  		}
>  		if (!old_prog)
> -			xdp_features_set_redirect_target(dev, false);
> +			xdp_features_set_redirect_target(dev, true);
>  	} else {
>  		xdp_features_clear_redirect_target(dev);
>  		vi->xdp_enabled = false;
> @@ -3940,8 +3940,10 @@ static int virtnet_probe(struct virtio_device *vdev)
>  	INIT_WORK(&vi->config_work, virtnet_config_changed_work);
>  	spin_lock_init(&vi->refill_lock);
>  
> -	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
> +	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) {
>  		vi->mergeable_rx_bufs = true;
> +		dev->xdp_features |= NETDEV_XDP_ACT_RX_SG;
> +	}
>  
>  	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) {
>  		vi->rx_usecs = 0;
> -- 
> 2.39.1
patchwork-bot+netdevbpf@kernel.org Feb. 7, 2023, 10:20 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue,  7 Feb 2023 10:53:40 +0100 you wrote:
> Now virtio-net supports xdp multi-buffer so add it to xdp_features
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/virtio_net.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [bpf-next] virtio_net: update xdp_features with xdp multi-buff
    https://git.kernel.org/bpf/bpf-next/c/30bbf891f1b8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 692dff071782..ddc3dc7ea73c 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3281,7 +3281,7 @@  static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog,
 				virtnet_clear_guest_offloads(vi);
 		}
 		if (!old_prog)
-			xdp_features_set_redirect_target(dev, false);
+			xdp_features_set_redirect_target(dev, true);
 	} else {
 		xdp_features_clear_redirect_target(dev);
 		vi->xdp_enabled = false;
@@ -3940,8 +3940,10 @@  static int virtnet_probe(struct virtio_device *vdev)
 	INIT_WORK(&vi->config_work, virtnet_config_changed_work);
 	spin_lock_init(&vi->refill_lock);
 
-	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
+	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) {
 		vi->mergeable_rx_bufs = true;
+		dev->xdp_features |= NETDEV_XDP_ACT_RX_SG;
+	}
 
 	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_NOTF_COAL)) {
 		vi->rx_usecs = 0;