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 A1A03A0524;
	Tue, 13 Apr 2021 13:36:41 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 77743160E5F;
	Tue, 13 Apr 2021 13:36:41 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [216.205.24.124])
 by mails.dpdk.org (Postfix) with ESMTP id 1FF4D160E59
 for <dev@dpdk.org>; Tue, 13 Apr 2021 13:36:39 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1618313799;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=hIUwwwC7xoU8W7sVmAQQhCJyjrKES7uCmAitmjjp7RI=;
 b=ep0ICt3XEWolkCqnJV2QYKYD0N2j1E5UeYcpqQHYWKsSQ5k/kn+4qcBF1X01pMnkcKKTzv
 PAr3mpYpNX1tItzR8a4ik362lqkHK7JUxoNYgDX6I7aEZEtnHmU0uR5tJiRz/MwNYR2xfn
 teER1OBnlsyraX7jNBWs/bBXVCPyMy8=
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-417-N-tZibnBOhicZd46n_5y3w-1; Tue, 13 Apr 2021 07:36:36 -0400
X-MC-Unique: N-tZibnBOhicZd46n_5y3w-1
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
 [10.5.11.22])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCBA2107ACC7
 for <dev@dpdk.org>; Tue, 13 Apr 2021 11:36:35 +0000 (UTC)
Received: from [10.36.110.28] (unknown [10.36.110.28])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 413DE101E5AF;
 Tue, 13 Apr 2021 11:36:35 +0000 (UTC)
To: Balazs Nemeth <bnemeth@redhat.com>, dev@dpdk.org
References: <5ef3d4c29927ed241c7128819fe35ac1d95d8f24.1617892982.git.bnemeth@redhat.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <27fe657d-54af-36e9-a949-89bb49f84cd5@redhat.com>
Date: Tue, 13 Apr 2021 13:36:33 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.8.1
MIME-Version: 1.0
In-Reply-To: <5ef3d4c29927ed241c7128819fe35ac1d95d8f24.1617892982.git.bnemeth@redhat.com>
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
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: don't track remaining packets
 separately
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>

Hi Balazs,

Your patch does not apply, it needs to be rebased:
http://patches.dpdk.org/project/dpdk/patch/5ef3d4c29927ed241c7128819fe35ac1d95d8f24.1617892982.git.bnemeth@redhat.com/

Can you please send a rebased version.

Thanks,
Maxime

On 4/8/21 4:44 PM, Balazs Nemeth wrote:
> The remained variable stores the same information as the difference
> between count and pkt_idx. Remove the remained variable to simplify.
> 
> Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
> ---
>  lib/librte_vhost/virtio_net.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index e8cc5f659..cfd52360d 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1353,16 +1353,14 @@ virtio_dev_rx_packed(struct virtio_net *dev,
>  		     uint32_t count)
>  {
>  	uint32_t pkt_idx = 0;
> -	uint32_t remained = count;
>  
>  	do {
>  		rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]);
>  
> -		if (remained >= PACKED_BATCH_SIZE) {
> +		if (count - pkt_idx >= PACKED_BATCH_SIZE) {
>  			if (!virtio_dev_rx_batch_packed(dev, vq,
>  							&pkts[pkt_idx])) {
>  				pkt_idx += PACKED_BATCH_SIZE;
> -				remained -= PACKED_BATCH_SIZE;
>  				continue;
>  			}
>  		}
> @@ -1370,7 +1368,6 @@ virtio_dev_rx_packed(struct virtio_net *dev,
>  		if (virtio_dev_rx_single_packed(dev, vq, pkts[pkt_idx]))
>  			break;
>  		pkt_idx++;
> -		remained--;
>  
>  	} while (pkt_idx < count);
>  
> @@ -2480,12 +2477,11 @@ virtio_dev_tx_packed(struct virtio_net *dev,
>  	do {
>  		rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]);
>  
> -		if (remained >= PACKED_BATCH_SIZE) {
> +		if (count - pkt_idx >= PACKED_BATCH_SIZE) {
>  
>  			if (!virtio_dev_tx_batch_packed(dev, vq,
>  							&pkts[pkt_idx])) {
>  				pkt_idx += PACKED_BATCH_SIZE;
> -				remained -= PACKED_BATCH_SIZE;
>  
>  				continue;
>  			}
> @@ -2496,9 +2492,7 @@ virtio_dev_tx_packed(struct virtio_net *dev,
>  			break;
>  		}
>  		pkt_idx++;
> -		remained--;
> -
> -	} while (remained);
> +	} while (pkt_idx < count);
>  
>  	if (pkt_idx != count) {
>  		rte_pktmbuf_free_bulk(&pkts[pkt_idx], count - pkt_idx);
>