DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jakub Palider <jpalider@gmail.com>
To: Marcin Wojtas <mw@semihalf.com>
Cc: dev@dpdk.org, "Jan Mędala" <jan.medala@outlook.com>,
	netanel@amazon.com, evgenys@amazon.com, matua@amazon.com,
	gtzalik@amazon.com, mk@semihalf.com
Subject: Re: [dpdk-dev] [PATCH 2/4] net/ena: fix delayed cleanup of Rx descriptors
Date: Mon, 10 Apr 2017 12:05:43 +0200	[thread overview]
Message-ID: <CAO-cEe=pRDCoSMnr=4Jog8CPFG+B+WkWF=ZaQN=UOi2+CWmVxA@mail.gmail.com> (raw)
In-Reply-To: <1491562138-2178-3-git-send-email-mw@semihalf.com>

On Fri, Apr 7, 2017 at 12:48 PM, Marcin Wojtas <mw@semihalf.com> wrote:

> From: Michal Krawczyk <mk@semihalf.com>
>
> On RX path, after receiving bunch of packets, variable tracking
> available descriptors in HW queue was not updated.
>
> To fix this issue, additional variable was added which is storing number
> of depleted descriptors updated by number of descriptors used in this
> cycle.
>
> Finally whole number is substracted by one to do not refill all
> descriptors what is required by the driver.
>
> Fixes: 1daff5260ff8 ("net/ena: use unmasked head and tail")
>
> Signed-off-by: Michal Krawczyk <mk@semihalf.com>
> ---
>  drivers/net/ena/ena_ethdev.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
> index 2345bab..d875a2b 100644
> --- a/drivers/net/ena/ena_ethdev.c
> +++ b/drivers/net/ena/ena_ethdev.c
> @@ -1144,7 +1144,7 @@ static int ena_populate_rx_queue(struct ena_ring
> *rxq, unsigned int count)
>                 return 0;
>
>         in_use = rxq->next_to_use - rxq->next_to_clean;
> -       ena_assert_msg(((in_use + count) <= ring_size), "bad ring state");
> +       ena_assert_msg(((in_use + count) < ring_size), "bad ring state");
>
>         count = RTE_MIN(count,
>                         (uint16_t)(ring_size - (next_to_use & ring_mask)));
> @@ -1504,7 +1504,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue,
> struct rte_mbuf **rx_pkts,
>         unsigned int ring_size = rx_ring->ring_size;
>         unsigned int ring_mask = ring_size - 1;
>         uint16_t next_to_clean = rx_ring->next_to_clean;
> -       uint16_t desc_in_use = 0;
> +       uint16_t desc_in_use, desc_to_refill;
>         unsigned int recv_idx = 0;
>         struct rte_mbuf *mbuf = NULL;
>         struct rte_mbuf *mbuf_head = NULL;
> @@ -1575,12 +1575,13 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue,
> struct rte_mbuf **rx_pkts,
>                 recv_idx++;
>         }
>
> -       /* Burst refill to save doorbells, memory barriers, const interval
> */
> -       if (ring_size - desc_in_use > ENA_RING_DESCS_RATIO(ring_size))
> -               ena_populate_rx_queue(rx_ring, ring_size - desc_in_use);
> -
>         rx_ring->next_to_clean = next_to_clean;
>
> +       desc_to_refill = ring_size - desc_in_use + completed - 1;
> +       /* Burst refill to save doorbells, memory barriers, const interval
> */
> +       if (desc_to_refill > ENA_RING_DESCS_RATIO(ring_size))
> +               ena_populate_rx_queue(rx_ring, desc_to_refill);
> +
>         return recv_idx;
>  }
>
> --
> 1.8.3.1
>
>
​
Good catch! I would suggest, however, to slightly rework this this way:
adjust the desc_in_use to reflect the actual state:
desc_in_use -= completed;
so that it would be the only change in this patch, and should do the trick.
As for the adjustment "-1" I will refer to 1/4 separately.

Jakub


​

  reply	other threads:[~2017-04-10 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 10:48 [dpdk-dev] [PATCH 0/4] Ena PMD fixes Marcin Wojtas
2017-04-07 10:48 ` [dpdk-dev] [PATCH 1/4] net/ena: fix incorrect Rx descriptors allocation Marcin Wojtas
2017-04-10 10:10   ` Jakub Palider
2017-04-07 10:48 ` [dpdk-dev] [PATCH 2/4] net/ena: fix delayed cleanup of Rx descriptors Marcin Wojtas
2017-04-10 10:05   ` Jakub Palider [this message]
2017-04-07 10:48 ` [dpdk-dev] [PATCH 3/4] net/ena: cleanup if refilling of Rx descriptors fails Marcin Wojtas
2017-04-07 10:48 ` [dpdk-dev] [PATCH 4/4] net/ena: calculate partial checksum if DF bit is disabled Marcin Wojtas
2017-04-10 11:05   ` Jan Mędala

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='CAO-cEe=pRDCoSMnr=4Jog8CPFG+B+WkWF=ZaQN=UOi2+CWmVxA@mail.gmail.com' \
    --to=jpalider@gmail.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=gtzalik@amazon.com \
    --cc=jan.medala@outlook.com \
    --cc=matua@amazon.com \
    --cc=mk@semihalf.com \
    --cc=mw@semihalf.com \
    --cc=netanel@amazon.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).