patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] vhost: fix Virtio-net header len with packed ring
       [not found] <20201001101155.206237-1-maxime.coquelin@redhat.com>
@ 2020-10-01 10:11 ` Maxime Coquelin
  2020-10-09  6:33   ` Xia, Chenbo
  0 siblings, 1 reply; 2+ messages in thread
From: Maxime Coquelin @ 2020-10-01 10:11 UTC (permalink / raw)
  To: dev, chenbo.xia, yong.liu; +Cc: Maxime Coquelin, stable

In case packed ring layout has been negotiated, but neither
Version 1 nor mergeable buffers, the Virtio-net header len
is assigned to the legacy devices value, which is wrong.

This patch fixes this with using the proper len as devices
using packed ring are not legacy devices.

Fixes: a922401f35cc ("vhost: add Rx support for packed ring")
Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
Cc: stable@dpdk.org

Reported-by: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 4deceb3e00..5d1fb9e863 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -341,7 +341,9 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg,
 
 	dev->features = features;
 	if (dev->features &
-		((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) {
+		((1ULL << VIRTIO_NET_F_MRG_RXBUF) |
+		 (1ULL << VIRTIO_F_VERSION_1) |
+		 (1ULL << VIRTIO_F_RING_PACKED))) {
 		dev->vhost_hlen = sizeof(struct virtio_net_hdr_mrg_rxbuf);
 	} else {
 		dev->vhost_hlen = sizeof(struct virtio_net_hdr);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] vhost: fix Virtio-net header len with packed ring
  2020-10-01 10:11 ` [dpdk-stable] [PATCH 1/2] vhost: fix Virtio-net header len with packed ring Maxime Coquelin
@ 2020-10-09  6:33   ` Xia, Chenbo
  0 siblings, 0 replies; 2+ messages in thread
From: Xia, Chenbo @ 2020-10-09  6:33 UTC (permalink / raw)
  To: Maxime Coquelin, dev, Liu, Yong; +Cc: stable

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Thursday, October 1, 2020 6:12 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; Liu, Yong
> <yong.liu@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org
> Subject: [PATCH 1/2] vhost: fix Virtio-net header len with packed ring
> 
> In case packed ring layout has been negotiated, but neither
> Version 1 nor mergeable buffers, the Virtio-net header len
> is assigned to the legacy devices value, which is wrong.
> 
> This patch fixes this with using the proper len as devices
> using packed ring are not legacy devices.
> 
> Fixes: a922401f35cc ("vhost: add Rx support for packed ring")
> Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
> Cc: stable@dpdk.org
> 
> Reported-by: Marvin Liu <yong.liu@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/librte_vhost/vhost_user.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 4deceb3e00..5d1fb9e863 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -341,7 +341,9 @@ vhost_user_set_features(struct virtio_net **pdev,
> struct VhostUserMsg *msg,
> 
>  	dev->features = features;
>  	if (dev->features &
> -		((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1)))
> {
> +		((1ULL << VIRTIO_NET_F_MRG_RXBUF) |
> +		 (1ULL << VIRTIO_F_VERSION_1) |
> +		 (1ULL << VIRTIO_F_RING_PACKED))) {
>  		dev->vhost_hlen = sizeof(struct virtio_net_hdr_mrg_rxbuf);
>  	} else {
>  		dev->vhost_hlen = sizeof(struct virtio_net_hdr);
> --
> 2.26.2

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-09  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201001101155.206237-1-maxime.coquelin@redhat.com>
2020-10-01 10:11 ` [dpdk-stable] [PATCH 1/2] vhost: fix Virtio-net header len with packed ring Maxime Coquelin
2020-10-09  6:33   ` Xia, Chenbo

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git