lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <TYVPR01MB11279EBEB12BC80D1D572249C86B9A@TYVPR01MB11279.jpnprd01.prod.outlook.com>
Date: Thu, 23 Nov 2023 17:02:51 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Sergey Shtylyov <s.shtylyov@....ru>, Claudiu.Beznea
	<claudiu.beznea@...on.dev>, "davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
	<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>, Yoshihiro Shimoda
	<yoshihiro.shimoda.uh@...esas.com>, "geert+renesas@...der.be"
	<geert+renesas@...der.be>, "wsa+renesas@...g-engineering.com"
	<wsa+renesas@...g-engineering.com>, Prabhakar Mahadev Lad
	<prabhakar.mahadev-lad.rj@...renesas.com>,
	"sergei.shtylyov@...entembedded.com" <sergei.shtylyov@...entembedded.com>,
	Mitsuhiro Kimura <mitsuhiro.kimura.kc@...esas.com>, Masaru Nagai
	<masaru.nagai.vx@...esas.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Claudiu Beznea
	<claudiu.beznea.uj@...renesas.com>
Subject: RE: [PATCH 06/13] net: ravb: Let IP specific receive function to
 interrogate descriptors

Hi Sergey Shtylyov,

> Subject: Re: [PATCH 06/13] net: ravb: Let IP specific receive function to
> interrogate descriptors
> 
> On 11/23/23 7:48 PM, Biju Das wrote:
> [...]
> 
> >>> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> >>>
> >>> ravb_poll() initial code used to interrogate the first descriptor of
> >>> the RX queue in case gptp is false to know if ravb_rx() should be
> >> called.
> >>> This is done for non GPTP IPs. For GPTP IPs the driver PTP specific
> >>
> >>    It's called gPTP, AFAIK.
> >>
> >>> information was used to know if receive function should be called.
> >>> As every IP has it's own receive function that interrogates the RX
> >>> descriptor
> >>
> >>    Its own.
> >>
> >>> list in the same way the ravb_poll() was doing there is no need to
> >>> double check this in ravb_poll(). Removing the code form ravb_poll()
> >>> and
> >>
> >>    From ravb_poll().
> >>
> >>> adjusting ravb_rx_gbeth() leads to a cleaner code.
> >>>
> >>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> >>> ---
> >>>  drivers/net/ethernet/renesas/ravb_main.c | 18 ++++++------------
> >>>  1 file changed, 6 insertions(+), 12 deletions(-)
> >>>
> >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> >>> b/drivers/net/ethernet/renesas/ravb_main.c
> >>> index 588e3be692d3..0fc9810c5e78 100644
> >>> --- a/drivers/net/ethernet/renesas/ravb_main.c
> >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> >>> @@ -771,12 +771,15 @@ static bool ravb_rx_gbeth(struct net_device
> >>> *ndev,
> >> int *quota, int q)
> >>>     int limit;
> >>>
> >>>     entry = priv->cur_rx[q] % priv->num_rx_ring[q];
> >>> +   desc = &priv->gbeth_rx_ring[entry];
> >>> +   if (desc->die_dt == DT_FEMPTY)
> >>> +           return false;
> >>> +
> >>
> >>    I don't understand what this buys us, the following *while* loop
> >> will be skipped anyway, and the *for* loop as well, I think... And
> >> ravb_rx_rcar() doesn't have that anyway...
> >>
> >>> @@ -1279,25 +1282,16 @@ static int ravb_poll(struct napi_struct
> >>> *napi,
> >> int budget)
> >>>     struct net_device *ndev = napi->dev;
> >>>     struct ravb_private *priv = netdev_priv(ndev);
> >>>     const struct ravb_hw_info *info = priv->info;
> >>> -   bool gptp = info->gptp || info->ccc_gac;
> >>> -   struct ravb_rx_desc *desc;
> >>>     unsigned long flags;
> >>>     int q = napi - priv->napi;
> >>>     int mask = BIT(q);
> >>>     int quota = budget;
> >>> -   unsigned int entry;
> >>>
> >>> -   if (!gptp) {
> >>> -           entry = priv->cur_rx[q] % priv->num_rx_ring[q];
> >>> -           desc = &priv->gbeth_rx_ring[entry];
> >>> -   }
> >>>     /* Processing RX Descriptor Ring */
> >>>     /* Clear RX interrupt */
> >>>     ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
> >>> -   if (gptp || desc->die_dt != DT_FEMPTY) {
> >>> -           if (ravb_rx(ndev, &quota, q))
> >>> -                   goto out;
> >>> -   }
> >>
> >>   I don't really understand this code (despite I've AKCed it)...
> >> Biju, could you explain this (well, you tried already but I don't buy
> >> it anymore)?
> >
> > It was initial version of the driver. Now Claudiu optimized.
> 
>    I fail to understand why you had (GBEth-specific) pre-conditions here
> to call ravb_rx()... and involving gPTP only further confused things...

Initial driver is based on a reference code/bsp driver and that code has this preconditions.
Maybe they have faced some race condition in rx path involving ring buffer/descriptor.
But so far we are not able to reproduce any race condition here. So it is safe to remove now.

Cheers,
Biju

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ