* [dpdk-stable] [PATCH] vhost: fix packed ring dequeue offloading
@ 2021-02-05 7:47 Marvin Liu
2021-02-09 14:52 ` Maxime Coquelin
0 siblings, 1 reply; 3+ messages in thread
From: Marvin Liu @ 2021-02-05 7:47 UTC (permalink / raw)
To: maxime.coquelin, chenbo.xia; +Cc: dev, Marvin Liu, stable
When vhost doing dequeue offloading, will parse ethernet and l3/l4
header of the packet. Then vhost will set corresponded value in mbuf
attributes. Thus mean offloading action should after packet data copy.
Fixes: 75ed51697820 ("vhost: add packed ring batch dequeue")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 730b92e478..0a7d008a91 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -2267,7 +2267,6 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
{
bool wrap = vq->avail_wrap_counter;
struct vring_packed_desc *descs = vq->desc_packed;
- struct virtio_net_hdr *hdr;
uint64_t lens[PACKED_BATCH_SIZE];
uint64_t buf_lens[PACKED_BATCH_SIZE];
uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
@@ -2324,13 +2323,6 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
ids[i] = descs[avail_idx + i].id;
}
- if (virtio_net_with_host_offload(dev)) {
- vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
- hdr = (struct virtio_net_hdr *)(desc_addrs[i]);
- vhost_dequeue_offload(hdr, pkts[i]);
- }
- }
-
return 0;
free_buf:
@@ -2348,6 +2340,7 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,
{
uint16_t avail_idx = vq->last_avail_idx;
uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
+ struct virtio_net_hdr *hdr;
uintptr_t desc_addrs[PACKED_BATCH_SIZE];
uint16_t ids[PACKED_BATCH_SIZE];
uint16_t i;
@@ -2364,6 +2357,13 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,
(void *)(uintptr_t)(desc_addrs[i] + buf_offset),
pkts[i]->pkt_len);
+ if (virtio_net_with_host_offload(dev)) {
+ vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
+ hdr = (struct virtio_net_hdr *)(desc_addrs[i]);
+ vhost_dequeue_offload(hdr, pkts[i]);
+ }
+ }
+
if (virtio_net_is_inorder(dev))
vhost_shadow_dequeue_batch_packed_inorder(vq,
ids[PACKED_BATCH_SIZE - 1]);
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH] vhost: fix packed ring dequeue offloading
2021-02-05 7:47 [dpdk-stable] [PATCH] vhost: fix packed ring dequeue offloading Marvin Liu
@ 2021-02-09 14:52 ` Maxime Coquelin
2021-02-10 21:05 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2021-02-09 14:52 UTC (permalink / raw)
To: Marvin Liu, chenbo.xia; +Cc: dev, stable
On 2/5/21 8:47 AM, Marvin Liu wrote:
> When vhost doing dequeue offloading, will parse ethernet and l3/l4
> header of the packet. Then vhost will set corresponded value in mbuf
corresponding*
> attributes. Thus mean offloading action should after packet data copy.
It means*
>
> Fixes: 75ed51697820 ("vhost: add packed ring batch dequeue")
> Cc: stable@dpdk.org
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
Please check your git patch formatting config, diff stats are missing.
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 730b92e478..0a7d008a91 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -2267,7 +2267,6 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
> {
> bool wrap = vq->avail_wrap_counter;
> struct vring_packed_desc *descs = vq->desc_packed;
> - struct virtio_net_hdr *hdr;
> uint64_t lens[PACKED_BATCH_SIZE];
> uint64_t buf_lens[PACKED_BATCH_SIZE];
> uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
> @@ -2324,13 +2323,6 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
> ids[i] = descs[avail_idx + i].id;
> }
>
> - if (virtio_net_with_host_offload(dev)) {
> - vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
> - hdr = (struct virtio_net_hdr *)(desc_addrs[i]);
> - vhost_dequeue_offload(hdr, pkts[i]);
> - }
> - }
> -
> return 0;
>
> free_buf:
> @@ -2348,6 +2340,7 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,
> {
> uint16_t avail_idx = vq->last_avail_idx;
> uint32_t buf_offset = sizeof(struct virtio_net_hdr_mrg_rxbuf);
> + struct virtio_net_hdr *hdr;
> uintptr_t desc_addrs[PACKED_BATCH_SIZE];
> uint16_t ids[PACKED_BATCH_SIZE];
> uint16_t i;
> @@ -2364,6 +2357,13 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,
> (void *)(uintptr_t)(desc_addrs[i] + buf_offset),
> pkts[i]->pkt_len);
>
> + if (virtio_net_with_host_offload(dev)) {
> + vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
> + hdr = (struct virtio_net_hdr *)(desc_addrs[i]);
> + vhost_dequeue_offload(hdr, pkts[i]);
> + }
> + }
> +
> if (virtio_net_is_inorder(dev))
> vhost_shadow_dequeue_batch_packed_inorder(vq,
> ids[PACKED_BATCH_SIZE - 1]);
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
I'll fixup the commit message while applying.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] vhost: fix packed ring dequeue offloading
2021-02-09 14:52 ` Maxime Coquelin
@ 2021-02-10 21:05 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-02-10 21:05 UTC (permalink / raw)
To: Marvin Liu; +Cc: chenbo.xia, dev, stable, Maxime Coquelin
09/02/2021 15:52, Maxime Coquelin:
>
> On 2/5/21 8:47 AM, Marvin Liu wrote:
> > When vhost doing dequeue offloading, will parse ethernet and l3/l4
> > header of the packet. Then vhost will set corresponded value in mbuf
>
> corresponding*
>
> > attributes. Thus mean offloading action should after packet data copy.
>
> It means*
>
> >
> > Fixes: 75ed51697820 ("vhost: add packed ring batch dequeue")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>
> I'll fixup the commit message while applying.
Fixed english wording and applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-10 21:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 7:47 [dpdk-stable] [PATCH] vhost: fix packed ring dequeue offloading Marvin Liu
2021-02-09 14:52 ` Maxime Coquelin
2021-02-10 21:05 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).