From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f194.google.com (mail-io0-f194.google.com [209.85.223.194]) by dpdk.org (Postfix) with ESMTP id 2A3092BB0 for ; Mon, 10 Apr 2017 12:06:05 +0200 (CEST) Received: by mail-io0-f194.google.com with SMTP id t68so2654806iof.2 for ; Mon, 10 Apr 2017 03:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hsOSlKkZ5B+ybL+zLKQxhccM9NQn0KCO6Cv6vw3rG9Y=; b=u+ktpx9eLUYW4TYaCKfZc/z1lcqCPlYLpKpDL31sAGhTpAD01Du3vvg9Cshu0ougp7 1lM270AJTMaGJDEsz2hz8gr5z0zOWaBO/yuLN76rAz1hr8zjfHhHMWOSObnXwQ1wBcYy n2Id2FyoGhKxSZEEOHq3r8l7PMf29nj3mFfUvKkR8yKyy96enh0SWUGP+TyIGdi+xZYA Xn72mUlu24q7VcAN3GldpoEg7i0+GRChH2Em8MXxSxgYXnvd6uWFkTkCyu5/f3DmAanD injCqsuDxaS7598qcfv16ErJsOuYNhbMRozXQIHBFIN1mLKZX6cQiTq6bVbXcu3dN7Hd Rb4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hsOSlKkZ5B+ybL+zLKQxhccM9NQn0KCO6Cv6vw3rG9Y=; b=JINsVaBoGCzTMsDEkFZHysqOZU2dF3Vn+qe4hZtcsBWUtk52JgozvO2AQaBDMzma3z HNVjZ/QMkNMMNUobQsBEsWzLc9VW7ULCrvVnJtOnts0XCg/6IH0+8E3A9k2h84+WazeS CU1+iMTM+fz6a/hn0D1x01PpczF82zt7pVnKV9H4Q2uZqCrarOobJoa4toByY8VT3AZb +aC1ceT1+btxoAnQrgn+1kZJJL1a1TeVJEu7+F/ALdbKZP6P1Z2Bleg7jcxysaDknXc9 bbEsSJgnCIJz3mxDAt/CaI2gh/g6f1qbXwyKvpAwlfoN1azQjUGdNqfoZjjYE+j+f04E OuGQ== X-Gm-Message-State: AFeK/H3OSW//XSCz4aLOt4hN7YlVpp3Y0J5wRleMkBeFclXpsVCeq2z6+WNqrEpnqf/BSF090eTcfih/1N0sUw== X-Received: by 10.107.30.213 with SMTP id e204mr53737097ioe.203.1491818764527; Mon, 10 Apr 2017 03:06:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.30.67 with HTTP; Mon, 10 Apr 2017 03:05:43 -0700 (PDT) In-Reply-To: <1491562138-2178-3-git-send-email-mw@semihalf.com> References: <1491562138-2178-1-git-send-email-mw@semihalf.com> <1491562138-2178-3-git-send-email-mw@semihalf.com> From: Jakub Palider Date: Mon, 10 Apr 2017 12:05:43 +0200 Message-ID: To: Marcin Wojtas Cc: dev@dpdk.org, =?UTF-8?Q?Jan_M=C4=99dala?= , netanel@amazon.com, evgenys@amazon.com, matua@amazon.com, gtzalik@amazon.com, mk@semihalf.com X-Mailman-Approved-At: Wed, 12 Apr 2017 09:13:05 +0200 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 2/4] net/ena: fix delayed cleanup of Rx descriptors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2017 10:06:05 -0000 On Fri, Apr 7, 2017 at 12:48 PM, Marcin Wojtas wrote: > From: Michal Krawczyk > > 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 > --- > 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 =3D rxq->next_to_use - rxq->next_to_clean; > - ena_assert_msg(((in_use + count) <=3D ring_size), "bad ring state= "); > + ena_assert_msg(((in_use + count) < ring_size), "bad ring state"); > > count =3D 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 =3D rx_ring->ring_size; > unsigned int ring_mask =3D ring_size - 1; > uint16_t next_to_clean =3D rx_ring->next_to_clean; > - uint16_t desc_in_use =3D 0; > + uint16_t desc_in_use, desc_to_refill; > unsigned int recv_idx =3D 0; > struct rte_mbuf *mbuf =3D NULL; > struct rte_mbuf *mbuf_head =3D 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 interva= l > */ > - 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 =3D next_to_clean; > > + desc_to_refill =3D ring_size - desc_in_use + completed - 1; > + /* Burst refill to save doorbells, memory barriers, const interva= l > */ > + 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 > > =E2=80=8B 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 -=3D 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 =E2=80=8B