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: <fcb582a7d4a396e19b9f6b62e743ce9666f3d371.camel@microchip.com>
Date:   Thu, 3 Nov 2022 08:44:51 +0000
From:   <Rakesh.Sankaranarayanan@...rochip.com>
To:     <netdev@...r.kernel.org>, <f.fainelli@...il.com>,
        <linux-kernel@...r.kernel.org>
CC:     <andrew@...n.ch>, <olteanv@...il.com>, <davem@...emloft.net>,
        <vivien.didelot@...il.com>, <Woojung.Huh@...rochip.com>,
        <kuba@...nel.org>, <pabeni@...hat.com>, <edumazet@...gle.com>,
        <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap
 range validation

On Wed, 2022-11-02 at 10:15 -0700, Florian Fainelli wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On 11/1/22 21:10, Rakesh Sankaranarayanan wrote:
> > Add regmap_range and regmap_access_table to define valid
> > register range for LAN937x switch family. LAN937x family
> > have sku id's LAN9370, LAN9371, LAN9372, LAN9373 and
> > LAN9374. regmap_range structure is arranged as Global
> > Registers followed by Port Registers but they are distributed
> > as Global Registers, T1 PHY Port Registers, Tx PHY Port Registers,
> > RGMII Port Registers, SGMII Port Registers. On 16 bit addressing,
> > most significant 4 bits are used for representing port number.
> > So valid range of two different T1 PHY ports within a sku
> > will differ on upper nibble only.
> > 
> > Signed-off-by: Rakesh Sankaranarayanan
> > <rakesh.sankaranarayanan@...rochip.com>
> > ---
> >   drivers/net/dsa/microchip/ksz_common.c | 1760
> > ++++++++++++++++++++++++
> >   1 file changed, 1760 insertions(+)
> > 
> > diff --git a/drivers/net/dsa/microchip/ksz_common.c
> > b/drivers/net/dsa/microchip/ksz_common.c
> > index d612181b3226..b0905c5b701d 100644
> > --- a/drivers/net/dsa/microchip/ksz_common.c
> > +++ b/drivers/net/dsa/microchip/ksz_common.c
> > @@ -1030,6 +1030,1756 @@ static const struct regmap_access_table
> > ksz9896_register_set = {
> >       .n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs),
> >   };
> > 
> > +static const struct regmap_range lan9370_valid_regs[] = {
> 
> Suggest you employ some macros for generating the valid register
> ranges
> for ports since there is a lot of repetition, and chances are that
> new
> registers may have to be added in the future, or corrected.
> 
> Between the fact that regmap makes you pull an entire subsystem into
> the
> kernel image thus adding to code sections, plus these big tables of
> register ranges adding to read-only data sections, this really makes
> me
> wonder what benefit there is just to expose a debugfs interface for
> dumping registers... value proposition does not seem so great to me.
> --
> Florian
> 

Thanks for the comment, Florian.

Changes added to have register range validation for lan937x series, I
tried adding common MACRO's instead of individual tables. It will
reduce lines of code and make it easier for any future modifications.
But anyway, finally it is going to expand as individual tables.
Considering this, I will remove this patch from series from next
revision.

But out of curiosity, I have seen usage of regmap_range tables in
kernel for the register range validation. Do you think that, is it
really required to have this check? or any other better approach?

Thanks,
Rakesh S

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ