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: <YoX3AMlBFfDcl69o@lore-desk>
Date:   Thu, 19 May 2022 09:51:28 +0200
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, nbd@....name, john@...ozen.org,
        sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
        davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
        Sam.Shih@...iatek.com, linux-mediatek@...ts.infradead.org,
        devicetree@...r.kernel.org, robh@...nel.org,
        lorenzo.bianconi@...hat.com
Subject: Re: [PATCH v2 net-next 11/15] net: ethernet: mtk_eth_soc: introduce
 device register map

> On Wed, 18 May 2022 11:48:43 +0200 Lorenzo Bianconi wrote:
> > > On Mon, 16 May 2022 18:06:38 +0200 Lorenzo Bianconi wrote:  
> > > >  /* PDMA RX Base Pointer Register */
> > > > -#define MTK_PRX_BASE_PTR0	0x900
> > > > +#define MTK_PRX_BASE_PTR0	(eth->soc->reg_map[MTK_PDMA_BASE] + 0x100)
> > > >  #define MTK_PRX_BASE_PTR_CFG(x)	(MTK_PRX_BASE_PTR0 + (x * 0x10))  
> > > 
> > > Implicit macro arguments are really unpleasant for people doing
> > > tree-wide changes or otherwise unfamiliar with the driver.
> > > 
> > > Nothing we can do to avoid this?  
> > 
> > I used this approach in order to have just few changes in the codebase. I guess the best
> > option would be to explicitly add eth parameter to the register macros, what do you think?
> 
> I don't think there's a best known practice, you'll have to exercise
> your judgment. Taking a look at a random example of MTK_PDMA_INT_STATUS.
> Looks like that one is already assigned to eth->tx_int_status_reg.
> Maybe that can be generalized? Personally I'd forgo the macros
> completely and just use eth->soc->register_name in the code.

I personally think the code is easier to read if we use macros in this case.
Let's consider MTK_LRO_CTRL_DW1_CFG(), it depends on the particular soc based
on the register map and even on the ring index. I guess the best trade-off we
can get is to explicitly pass eth to the macros as parameter when needed.

Regards,
Lorenzo

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ