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: <DM6PR12MB4516B65021D4107188447282D8FA0@DM6PR12MB4516.namprd12.prod.outlook.com>
Date:   Wed, 25 Nov 2020 10:35:35 +0000
From:   Danielle Ratson <danieller@...dia.com>
To:     Michal Kubecek <mkubecek@...e.cz>
CC:     Jiri Pirko <jiri@...nulli.us>, Andrew Lunn <andrew@...n.ch>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Ido Schimmel <idosch@...sch.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        Jiri Pirko <jiri@...dia.com>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        mlxsw <mlxsw@...dia.com>, Ido Schimmel <idosch@...dia.com>,
        "johannes@...solutions.net" <johannes@...solutions.net>
Subject: RE: [PATCH net-next 1/6] ethtool: Extend link modes settings uAPI
 with lanes



> -----Original Message-----
> From: Michal Kubecek <mkubecek@...e.cz>
> Sent: Wednesday, November 25, 2020 12:12 AM
> To: Danielle Ratson <danieller@...dia.com>
> Cc: Jiri Pirko <jiri@...nulli.us>; Andrew Lunn <andrew@...n.ch>; Jakub Kicinski <kuba@...nel.org>; Ido Schimmel
> <idosch@...sch.org>; netdev@...r.kernel.org; davem@...emloft.net; Jiri Pirko <jiri@...dia.com>; f.fainelli@...il.com; mlxsw
> <mlxsw@...dia.com>; Ido Schimmel <idosch@...dia.com>; johannes@...solutions.net
> Subject: Re: [PATCH net-next 1/6] ethtool: Extend link modes settings uAPI with lanes
> 
> On Mon, Nov 23, 2020 at 09:47:53AM +0000, Danielle Ratson wrote:
> >
> >
> > > -----Original Message-----
> > > From: Michal Kubecek <mkubecek@...e.cz>
> > > Sent: Thursday, October 22, 2020 7:28 PM
> > > To: Danielle Ratson <danieller@...dia.com>
> > > Cc: Jiri Pirko <jiri@...nulli.us>; Andrew Lunn <andrew@...n.ch>;
> > > Jakub Kicinski <kuba@...nel.org>; Ido Schimmel <idosch@...sch.org>;
> > > netdev@...r.kernel.org; davem@...emloft.net; Jiri Pirko
> > > <jiri@...dia.com>; f.fainelli@...il.com; mlxsw <mlxsw@...dia.com>;
> > > Ido Schimmel <idosch@...dia.com>; johannes@...solutions.net
> > > Subject: Re: [PATCH net-next 1/6] ethtool: Extend link modes
> > > settings uAPI with lanes
> > >
> > > On Thu, Oct 22, 2020 at 06:15:48AM +0000, Danielle Ratson wrote:
> > > > > -----Original Message-----
> > > > > From: Michal Kubecek <mkubecek@...e.cz>
> > > > > Sent: Wednesday, October 21, 2020 11:48 AM
> > > > >
> > > > > Ah, right, it does. But as you extend struct
> > > > > ethtool_link_ksettings and drivers will need to be updated to
> > > > > provide this information, wouldn't it be more useful to let the
> > > > > driver provide link mode in use instead (and derive number of lanes from it)?
> > > >
> > > > This is the way it is done with the speed parameter, so I have
> > > > aligned it to it. Why the lanes should be done differently
> > > > comparing to the speed?
> > >
> > > Speed and duplex have worked this way since ages and the interface
> > > was probably introduced back in times when combination of speed and
> > > duplex was sufficient to identify the link mode. This is no longer
> > > the case and even adding number of lanes wouldn't make the combination unique. So if we are going to extend the interface now
> and update drivers to provide extra information, I believe it would be more useful to provide full information.
> > >
> > > Michal
> >
> > Hi Michal,
> >
> > What do you think of passing the link modes you have suggested as a
> > bitmask, similar to "supported", that contains only one positive bit?
> > Something like that:

Hi Michal,

Thanks for your response.

Actually what I said is not very accurate. 
In ethtool, for speed 100G and 4 lanes for example, there are few link modes that fits:
ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT
ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT
ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT
ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT

The difference is the media. And in the driver we shrink into one bit.
But maybe that makes passing a bitmask more sense, or am I missing something?

> >
> > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index
> > afae2beacbc3..dd946c88daa3 100644
> > --- a/include/linux/ethtool.h
> > +++ b/include/linux/ethtool.h
> > @@ -127,6 +127,7 @@ struct ethtool_link_ksettings {
> >                 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
> >                 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
> >                 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
> > +               __ETHTOOL_DECLARE_LINK_MODE_MASK(chosen);
> >         } link_modes;
> >         u32     lanes;
> >  };
> >
> > Do you have perhaps a better suggestion?
> 
> Not sure if it's better but as we know there is only one mode, we could simply pass the index. We would still need to reserve a special
> value for none/unknown but getting an index would make lookup easier.
> 
> > And the speed and duplex parameters should be removed from being
> > passed like as well, right?
> 
> We cannot remove them from struct ethtool_link_settings and the ioctl and netlink messages as those are part of UAPI and we have
> to preserve backward compatibility. But drivers which provide link mode would not need to fill speed and duplex in their -
> >get_link_ksettings() as the common code could do that for them.

Yes of course I didn't mean to remove the parameters from the struct, just to not prepare them for passing to ethtool when getting the link settings.

Thanks.

> 
> Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ