From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2089EA0548;
	Tue,  9 Feb 2021 15:52:32 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0630D4014E;
	Tue,  9 Feb 2021 15:52:32 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [63.128.21.124])
 by mails.dpdk.org (Postfix) with ESMTP id D9DBC40147
 for <dev@dpdk.org>; Tue,  9 Feb 2021 15:52:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1612882350;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=DNkcIsK6rs0Xq2tD10vKBPfnbY1ZW5sjeVLLrpcPjkw=;
 b=P+UPTMB2CwElr8Xd+mYOc/buiNF7tnd5la9lGwMb6CFocljF0ZQCcMd26w1Y8ZObMjk1Dj
 bJwHbztYrYg0JM+/8i662rmtnp2IvRR52TkJeVgUSISrgmts1G/Y2+Y63qhXcV1AsIL/LN
 D0lnGeLm8oAz37ZtF7HNB8cQ1RvHkEY=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-184-WnhSbH0vMruFMFEjdamxLA-1; Tue, 09 Feb 2021 09:52:28 -0500
X-MC-Unique: WnhSbH0vMruFMFEjdamxLA-1
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
 [10.5.11.23])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5872C192CC40;
 Tue,  9 Feb 2021 14:52:27 +0000 (UTC)
Received: from [10.36.110.29] (unknown [10.36.110.29])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 78A8419C59;
 Tue,  9 Feb 2021 14:52:25 +0000 (UTC)
To: Marvin Liu <yong.liu@intel.com>, chenbo.xia@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
References: <20210205074758.28278-1-yong.liu@intel.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <877091a6-d59d-1bd4-82df-fcd1e99c9d3b@redhat.com>
Date: Tue, 9 Feb 2021 15:52:23 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.7.0
MIME-Version: 1.0
In-Reply-To: <20210205074758.28278-1-yong.liu@intel.com>
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] vhost: fix packed ring dequeue offloading
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>



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