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] [day] [month] [year] [list]
Message-ID: <CAJq09z4AeASQWH-pq_rQbtGHFfpYPqd3+LmnUK9gOtZQ-zgMKA@mail.gmail.com>
Date:   Fri, 18 Feb 2022 02:38:56 -0300
From:   Luiz Angelo Daros de Luca <luizluca@...il.com>
To:     Vladimir Oltean <olteanv@...il.com>
Cc:     "open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Alvin Šipraga <alsi@...g-olufsen.dk>,
        Arınç ÜNAL <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 2/2] net: dsa: realtek: rtl8365mb: add support
 for rtl8_4t

> >  rtl8365mb_get_tag_protocol(struct dsa_switch *ds, int port,
> >                          enum dsa_tag_protocol mp)
> >  {
> > +     struct realtek_priv *priv = ds->priv;
> > +     u32 val;
> > +
> > +     /* No way to return error */
> > +     regmap_read(priv->map, RTL8365MB_CPU_CTRL_REG, &val);
> > +
> > +     switch (FIELD_GET(RTL8365MB_CPU_CTRL_TAG_FORMAT_MASK, val)) {
> > +     case RTL8365MB_CPU_FORMAT_4BYTES:
> > +             /* Similar to DSA_TAG_PROTO_RTL4_A but with 1-byte version
> > +              * To CPU: [0x88 0x99 0x04 portnum]. Not supported yet.
> > +              */
> > +             break;
> > +     case RTL8365MB_CPU_FORMAT_8BYTES:
> > +             switch (FIELD_GET(RTL8365MB_CPU_CTRL_TAG_POSITION_MASK, val)) {
> > +             case RTL8365MB_CPU_POS_BEFORE_CRC:
> > +                     return DSA_TAG_PROTO_RTL8_4T;
> > +             case RTL8365MB_CPU_POS_AFTER_SA:
> > +             default:
> > +                     return DSA_TAG_PROTO_RTL8_4;
> > +             }
> > +             break;
> > +     }
> > +
> >       return DSA_TAG_PROTO_RTL8_4;
>
> Not great. dsa_get_tag_protocol gets called from dsa_port_parse_cpu,
> which is earlier than rtl8365mb_cpu_config, so you may temporarily
> report a tagging protocol which you don't expect (depending on what is
> in hardware at the time). Can you not keep the current tagging protocol
> in a variable? You could then avoid the need to return an error on
> regmap_read too.

Thanks Vladimir.

Sure. I added the variable to the chip_data struct. With that, I can
also remove the tag-related code and variables from
rtl8365mb_cpu_config() and rtl8365mb_cpu. Now I simply call the same
rtl8365mb_change_tag_protocol() during setup. I believe it is better
to have a single place that touches that config.

Regards,

Luiz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ