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 CC6E2A0C45; Mon, 13 Sep 2021 21:46:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 568D640151; Mon, 13 Sep 2021 21:46:30 +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 E4E5B4014F for ; Mon, 13 Sep 2021 21:46:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631562388; 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=JV5JJpjVdhe8aKusGKMJvNFwIMCVU+ewrfUxYnj9B5w=; b=VBidYu/jhTBnFy2ISGmqTungXmJbO4DRyOBmusDjtnPIjDnLKVd5W5ai//3kEvJ7Bpmzyt h1EYfoiCRXXB1800a8BC2t2H+mRtxLdutpbDRki202ueKtqaO098eSYoXUK+XPk77LZBBo 8s4OdKxMCUc0dNjPUb26C2gPwuNIzbA= 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-177-IkhAqDs3Nni_4uWvXe3KHw-1; Mon, 13 Sep 2021 15:46:27 -0400 X-MC-Unique: IkhAqDs3Nni_4uWvXe3KHw-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 8CAF91084681; Mon, 13 Sep 2021 19:46:25 +0000 (UTC) Received: from [10.39.208.12] (unknown [10.39.208.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E05521972E; Mon, 13 Sep 2021 19:46:23 +0000 (UTC) To: Andrew Rybchenko , Chenbo Xia , Jianfeng Tan , Huawei Xie Cc: dev@dpdk.org, Ivan Ilchenko , stable@dpdk.org References: <20210820124752.3522683-1-andrew.rybchenko@oktetlabs.ru> From: Maxime Coquelin Message-ID: <878c9de0-3842-7cff-98f1-be83b7abca1c@redhat.com> Date: Mon, 13 Sep 2021 21:46:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210820124752.3522683-1-andrew.rybchenko@oktetlabs.ru> 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: 8bit Subject: Re: [dpdk-dev] [PATCH] net/virtio: turn SW RxQ size to that of split vec. virtqueue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 8/20/21 2:47 PM, Andrew Rybchenko wrote: > From: Ivan Ilchenko > > Descriptors number may be set less than queue size for split queue > vectorized Rx path. Pointers to mbufs for received packets are > obtained from SW ring, that is initially filled with them in the end > of queue setup in virtio_dev_rx_queue_setup_finish(). The begin of the > SW ring filled up to the size of descriptors number. At queue size > offset from the begin of the SW ring pointers to some fake mbuf are also > set for wrapping purpose. So the ring may contains the hole of invalid > pointers from descriptors number offset to queue size offset, and split > vectorized Rx routines could write to the invalid addresses since they > use the ring up to the queue size. Fix this by setting descriptors > number to queue size on Rx queue setup. > > Fixes: fc3d66212fed ("virtio: add vector Rx") > Cc: stable@dpdk.org > > Signed-off-by: Ivan Ilchenko > Signed-off-by: Andrew Rybchenko > --- > drivers/net/virtio/virtio_rxtx.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c > index 18f03c9fc9..97ed69596a 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -706,8 +706,14 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev, > } > vq->vq_free_thresh = rx_free_thresh; > > - if (nb_desc > vq->vq_nentries) > + /* > + * For split ring vectorized path descriptors number must be > + * equal to the ring size. > + */ > + if (nb_desc > vq->vq_nentries || > + (!virtio_with_packed_queue(hw) && hw->use_vec_rx)) { > nb_desc = vq->vq_nentries; > + } > vq->vq_free_cnt = RTE_MIN(vq->vq_free_cnt, nb_desc); > > rxvq = &vq->rxq; > Reviewed-by: Maxime Coquelin Thanks, Maxime