DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Marvin Liu <yong.liu@intel.com>, chenbo.xia@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix vectorized path receive oversized packets
Date: Fri, 15 Oct 2021 14:20:06 +0200	[thread overview]
Message-ID: <e66d5796-b2d5-9b4e-d173-d85794445870@redhat.com> (raw)
In-Reply-To: <20210926092842.26103-1-yong.liu@intel.com>



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 <yong.liu@intel.com>
> 
> 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])) {
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


  reply	other threads:[~2021-10-15 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  9:28 Marvin Liu
2021-10-15 12:20 ` Maxime Coquelin [this message]
2021-10-21 12:28 ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e66d5796-b2d5-9b4e-d173-d85794445870@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=yong.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).