> -----Original Message----- > From: Maxime Coquelin <[email protected]> > Sent: Thursday, October 1, 2020 6:12 PM > To: [email protected]; Xia, Chenbo <[email protected]>; Liu, Yong > <[email protected]> > Cc: Maxime Coquelin <[email protected]>; [email protected] > 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: [email protected] > > Reported-by: Marvin Liu <[email protected]> > Signed-off-by: Maxime Coquelin <[email protected]> > --- > 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 <[email protected]>

