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 ABEFAA0C4B for ; Thu, 21 Oct 2021 14:28:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A24614117A; Thu, 21 Oct 2021 14:28:12 +0200 (CEST) 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 1B8AB4117A for ; Thu, 21 Oct 2021 14:28:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634819290; 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=CfHbKz4Ufm5p91GzTDG/TS7nOFL/5JYR3Mii/ceh9UE=; b=Ry5+NP9iQUeBgxiT1Gp2zXTZBrLkIpV20gQV0cmzMvh8DaInE8CcwDkFBSKZng0BAN/pZg Oi269GXLbgF81SXpfoYw/+qcruaiGvNPOPPsxTs4HJNv+i5a7aUCTQIBBmr/IoWotBV5b2 Olm2n9gq9PlYMaiGi2Yve94M6QUG+Ag= 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-522-tDGWepJMM1mS7Z-ZqwfuwA-1; Thu, 21 Oct 2021 08:28:09 -0400 X-MC-Unique: tDGWepJMM1mS7Z-ZqwfuwA-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 DBF4E101B4A1; Thu, 21 Oct 2021 12:28:07 +0000 (UTC) Received: from [10.39.208.27] (unknown [10.39.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7EB05D9DE; Thu, 21 Oct 2021 12:28:05 +0000 (UTC) Message-ID: <8ba65ca6-1661-5f5d-bbcf-d80f46c4e9c1@redhat.com> Date: Thu, 21 Oct 2021 14:28:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Marvin Liu , chenbo.xia@intel.com Cc: dev@dpdk.org, stable@dpdk.org References: <20210926092842.26103-1-yong.liu@intel.com> From: Maxime Coquelin In-Reply-To: <20210926092842.26103-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 Subject: Re: [dpdk-stable] [PATCH] net/virtio: fix vectorized path receive oversized packets 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 Sender: "stable" On 9/26/21 11:28, Marvin Liu wrote: > If packed ring size is not power of two, it is possible that remained > number less than one batch and meanwhile batch operation can pass. > This will cause incorrect remained number calculation and then lead to > receiving oversized packets. The patch fixed the issue by added > remained number check before batch operation. > > Fixes: 77d66da83834 ("net/virtio: add vectorized packed ring Rx") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu > > diff --git a/drivers/net/virtio/virtio_rxtx_packed.c b/drivers/net/virtio/virtio_rxtx_packed.c > index ab489a58af..45cf39df22 100644 > --- a/drivers/net/virtio/virtio_rxtx_packed.c > +++ b/drivers/net/virtio/virtio_rxtx_packed.c > @@ -95,11 +95,13 @@ virtio_recv_pkts_packed_vec(void *rx_queue, > num = num - ((vq->vq_used_cons_idx + num) % PACKED_BATCH_SIZE); > > while (num) { > - if (!virtqueue_dequeue_batch_packed_vec(rxvq, > - &rx_pkts[nb_rx])) { > - nb_rx += PACKED_BATCH_SIZE; > - num -= PACKED_BATCH_SIZE; > - continue; > + if (num >= PACKED_BATCH_SIZE) { > + if (!virtqueue_dequeue_batch_packed_vec(rxvq, > + &rx_pkts[nb_rx])) { > + nb_rx += PACKED_BATCH_SIZE; > + num -= PACKED_BATCH_SIZE; > + continue; > + } > } > if (!virtqueue_dequeue_single_packed_vec(rxvq, > &rx_pkts[nb_rx])) { > Applied to dpdk-next-virtio/main. Thanks, Maxime