From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AEE91A00C5 for ; Tue, 1 Feb 2022 09:53:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5886740685; Tue, 1 Feb 2022 09:53:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 2E00040685 for ; Tue, 1 Feb 2022 09:53:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643705630; 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=E5rNmmRFX6dwSbIwtj1kRxuWy6TBMUeb3R/f6hMNM+s=; b=a1MN77bkbG4O4CsNGh9ZkeY67NAhDl6UpSuNDLnlvZD1gSLft95FKdKrrPsty1o4dGTbfS 9+z+o3bTY4KU9TElyfEBqAjkwQaUzt2xVPMKd5CGxgFOVxDCgDqfhwOtxoO+1RjXNmsnDB KJU8mGvzLLKQay0qyNfpZHm5HhzVJJw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-168-HNy6P7NxMUiGiuGX06E20w-1; Tue, 01 Feb 2022 03:53:49 -0500 X-MC-Unique: HNy6P7NxMUiGiuGX06E20w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51C8F869EDC; Tue, 1 Feb 2022 08:53:48 +0000 (UTC) Received: from [10.39.208.24] (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E3695ED50; Tue, 1 Feb 2022 08:53:47 +0000 (UTC) Message-ID: <69751a6a-230a-adb2-afea-17daee34d525@redhat.com> Date: Tue, 1 Feb 2022 09:53:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] net/virtio: fix incorrect slots number when indirect feature on To: Marvin Liu , chenbo.xia@intel.com Cc: dev@dpdk.org, stable@dpdk.org References: <20220120122218.25027-1-yong.liu@intel.com> From: Maxime Coquelin In-Reply-To: <20220120122218.25027-1-yong.liu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 1/20/22 13:22, Marvin Liu wrote: > Virtio driver only occupies one slot for enqueuing chained mbufs when > indirect feature is on. Required slots calculation should depend on > indirect feature status at the end. > > Fixes: 0eaf7fc2fe8e ("net/virtio: separate AVX Rx/Tx") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu > > diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h > index d5c259a1f6..536112983c 100644 > --- a/drivers/net/virtio/virtio_rxtx_packed.h > +++ b/drivers/net/virtio/virtio_rxtx_packed.h > @@ -125,13 +125,12 @@ virtqueue_enqueue_single_packed_vec(struct virtnet_tx *txvq, > * any_layout => number of segments > * default => number of segments + 1 > */ > - slots = use_indirect ? 1 : (txm->nb_segs + !can_push); > can_push = rte_mbuf_refcnt_read(txm) == 1 && > RTE_MBUF_DIRECT(txm) && > txm->nb_segs == 1 && > rte_pktmbuf_headroom(txm) >= hdr_size; > > - slots = txm->nb_segs + !can_push; > + slots = use_indirect ? 1 : (txm->nb_segs + !can_push); > need = slots - vq->vq_free_cnt; > > /* Positive value indicates it need free vring descriptors */ Reviewed-by: Maxime Coquelin Thanks, Maxime