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]
Date:   Fri, 30 Jul 2021 06:54:43 +0000
From:   Biju Das <biju.das.jz@...renesas.com>
To:     Sergei Shtylyov <sergei.shtylyov@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
CC:     Geert Uytterhoeven <geert+renesas@...der.be>,
        Sergey Shtylyov <s.shtylyov@...russia.ru>,
        Adam Ford <aford173@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Yuusuke Ashizuka <ashiduka@...itsu.com>,
        Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>,
        Chris Paterson <Chris.Paterson2@...esas.com>,
        Biju Das <biju.das@...renesas.com>,
        Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: RE: [PATCH net-next 11/18] ravb: Factorise ravb_ring_init function

Hi Sergei,

Thanks for the feedback.

> Subject: Re: [PATCH net-next 11/18] ravb: Factorise ravb_ring_init
> function
> 
> On 7/22/21 5:13 PM, Biju Das wrote:
> 
> > The ravb_ring_init function uses extended descriptor in rx for R-Car
> > and normal descriptor for RZ/G2L. Factorise rx ring buffer allocation
> > so that it can support later SoC.
> 
>    In this case I think you factored out the function in question... but
> my ENglish is possibly too weak. :-)

OK. I meant add a helper function for rx ring buffer allocation.

> 
> > Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> > ---
> >  drivers/net/ethernet/renesas/ravb.h      |  1 +
> >  drivers/net/ethernet/renesas/ravb_main.c | 20 +++++++++++++++-----
> >  2 files changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/ravb.h
> > b/drivers/net/ethernet/renesas/ravb.h
> > index a3258c5d0c3d..d82bfa6e57c1 100644
> > --- a/drivers/net/ethernet/renesas/ravb.h
> > +++ b/drivers/net/ethernet/renesas/ravb.h
> > @@ -991,6 +991,7 @@ enum ravb_chip_id {  struct ravb_ops {
> >  	void (*ring_free)(struct net_device *ndev, int q);
> >  	void (*ring_format)(struct net_device *ndev, int q);
> > +	bool (*alloc_rx_desc)(struct net_device *ndev, int q);
> 
>   Aha, rx_ appears at last! :-)
> 
> 
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index c23f0d420c70..3d0f6598b936 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -384,6 +384,19 @@ static void ravb_ring_format(struct net_device
> > *ndev, int q)  }
> >
> >  /* Init skb and descriptor buffer for Ethernet AVB */
> > +static bool ravb_alloc_rx_desc(struct net_device *ndev, int q)
> 
>     Why *bool*? I think we shold just return a pointer allocated.

Ah OK.

Cheers,
Biju

> 
> > +{
> > +	struct ravb_private *priv = netdev_priv(ndev);
> > +	int ring_size;
> > +
> > +	ring_size = sizeof(struct ravb_ex_rx_desc) * (priv->num_rx_ring[q] +
> > +1);
> > +
> > +	priv->rx_ring[q] = dma_alloc_coherent(ndev->dev.parent, ring_size,
> > +					      &priv->rx_desc_dma[q],
> > +					      GFP_KERNEL);
> > +	return priv->rx_ring[q];
> > +}
> > +
> >  static int ravb_ring_init(struct net_device *ndev, int q)  {
> >  	struct ravb_private *priv = netdev_priv(ndev); @@ -418,11 +431,7 @@
> > static int ravb_ring_init(struct net_device *ndev, int q)
> >  	}
> >
> >  	/* Allocate all RX descriptors. */
> > -	ring_size = sizeof(struct ravb_ex_rx_desc) * (priv->num_rx_ring[q] +
> 1);
> > -	priv->rx_ring[q] = dma_alloc_coherent(ndev->dev.parent, ring_size,
> > -					      &priv->rx_desc_dma[q],
> > -					      GFP_KERNEL);
> > -	if (!priv->rx_ring[q])
> > +	if (!info->ravb_ops->alloc_rx_desc(ndev, q))
> >  		goto error;
> >
> >  	priv->dirty_rx[q] = 0;
> > @@ -2008,6 +2017,7 @@ static int ravb_mdio_release(struct ravb_private
> > *priv)  static const struct ravb_ops ravb_gen3_ops = {
> >  	.ring_free = ravb_ring_free_rx,
> >  	.ring_format = ravb_ring_format_rx,
> > +	.alloc_rx_desc = ravb_alloc_rx_desc,
> >  };
> >
> >  static const struct ravb_drv_data ravb_gen3_data = {
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ