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: <CAKOOJTxG2_fV3kSuTpeVLOwSXBug==zaEzQVnn6O3Tsy=Hh9AQ@mail.gmail.com>
Date:   Wed, 20 Jan 2021 14:35:39 -0800
From:   Edwin Peer <edwin.peer@...adcom.com>
To:     Danielle Ratson <danieller@...dia.com>
Cc:     netdev <netdev@...r.kernel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Jiri Pirko <jiri@...dia.com>,
        Andrew Lunn <andrew@...n.ch>, f.fainelli@...il.com,
        Michal Kubecek <mkubecek@...e.cz>, mlxsw <mlxsw@...dia.com>,
        Ido Schimmel <idosch@...dia.com>
Subject: Re: [PATCH net-next v3 1/7] ethtool: Extend link modes settings uAPI
 with lanes

On Wed, Jan 20, 2021 at 3:21 AM Danielle Ratson <danieller@...dia.com> wrote:

> -#define __DEFINE_LINK_MODE_PARAMS(_speed, _type, _duplex) \
> +#define __DEFINE_LINK_MODE_PARAMS(_speed, _type, _lanes, _duplex) \
>         [ETHTOOL_LINK_MODE(_speed, _type, _duplex)] = { \
>                 .speed  = SPEED_ ## _speed, \
> +               .lanes  = _lanes, \
>                 .duplex = __DUPLEX_ ## _duplex \
>         }

What about:

#define __DECLARE_LINK_MODE_LANES(_type, _lanes)        \
static const u32 __LINK_MODE_LANES_ ## _type = _lanes;

#define __DECLARE_LINK_MODE_LANES_ALL(_type)            \
__DECLARE_LINK_MODE_LANES(_type, 1)             \
__DECLARE_LINK_MODE_LANES(_type ## 2, 2)        \
__DECLARE_LINK_MODE_LANES(_type ## 4, 4)        \
__DECLARE_LINK_MODE_LANES(_type ## 8, 8)

__DECLARE_LINK_MODE_LANES_ALL(CR)
__DECLARE_LINK_MODE_LANES_ALL(DR)
__DECLARE_LINK_MODE_LANES_ALL(ER)
__DECLARE_LINK_MODE_LANES_ALL(KR)
__DECLARE_LINK_MODE_LANES(KX, 1)
__DECLARE_LINK_MODE_LANES(KX4, 4)
__DECLARE_LINK_MODE_LANES_ALL(LR)
__DECLARE_LINK_MODE_LANES(LR_ER_FR, 1)
__DECLARE_LINK_MODE_LANES(LR2_ER2_FR2, 2)
__DECLARE_LINK_MODE_LANES(LR4_ER4_FR4, 4)
__DECLARE_LINK_MODE_LANES(LR8_ER8_FR8, 8)
__DECLARE_LINK_MODE_LANES(LRM, 1)
__DECLARE_LINK_MODE_LANES(MLD2, 2);
__DECLARE_LINK_MODE_LANES_ALL(SR);
__DECLARE_LINK_MODE_LANES(T, 1)
__DECLARE_LINK_MODE_LANES(X, 1)

#define __DEFINE_LINK_MODE_PARAMS(_speed, _type, _duplex)
         [ETHTOOL_LINK_MODE(_speed, _type, _duplex)] = { \
                 .speed  = SPEED_ ## _speed, \
                 .lanes  = __LINK_MODE_LANES ## _type, \

instead of specifying lanes for each link mode defined below?

Regards,
Edwin Peer

>  static const struct link_mode_info link_mode_params[] = {
> -       __DEFINE_LINK_MODE_PARAMS(10, T, Half),
> -       __DEFINE_LINK_MODE_PARAMS(10, T, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100, T, Half),
> -       __DEFINE_LINK_MODE_PARAMS(100, T, Full),
> -       __DEFINE_LINK_MODE_PARAMS(1000, T, Half),
> -       __DEFINE_LINK_MODE_PARAMS(1000, T, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10, T, 1, Half),
> +       __DEFINE_LINK_MODE_PARAMS(10, T, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100, T, 1, Half),
> +       __DEFINE_LINK_MODE_PARAMS(100, T, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(1000, T, 1, Half),
> +       __DEFINE_LINK_MODE_PARAMS(1000, T, 1, Full),
>         __DEFINE_SPECIAL_MODE_PARAMS(Autoneg),
>         __DEFINE_SPECIAL_MODE_PARAMS(TP),
>         __DEFINE_SPECIAL_MODE_PARAMS(AUI),
>         __DEFINE_SPECIAL_MODE_PARAMS(MII),
>         __DEFINE_SPECIAL_MODE_PARAMS(FIBRE),
>         __DEFINE_SPECIAL_MODE_PARAMS(BNC),
> -       __DEFINE_LINK_MODE_PARAMS(10000, T, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, T, 1, Full),
>         __DEFINE_SPECIAL_MODE_PARAMS(Pause),
>         __DEFINE_SPECIAL_MODE_PARAMS(Asym_Pause),
> -       __DEFINE_LINK_MODE_PARAMS(2500, X, Full),
> +       __DEFINE_LINK_MODE_PARAMS(2500, X, 1, Full),
>         __DEFINE_SPECIAL_MODE_PARAMS(Backplane),
> -       __DEFINE_LINK_MODE_PARAMS(1000, KX, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, KX4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, KR, Full),
> +       __DEFINE_LINK_MODE_PARAMS(1000, KX, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, KX4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, KR, 1, Full),
>         [ETHTOOL_LINK_MODE_10000baseR_FEC_BIT] = {
>                 .speed  = SPEED_10000,
>                 .duplex = DUPLEX_FULL,
>         },
> -       __DEFINE_LINK_MODE_PARAMS(20000, MLD2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(20000, KR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(40000, KR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(40000, CR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(40000, SR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(40000, LR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(56000, KR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(56000, CR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(56000, SR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(56000, LR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(25000, CR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(25000, KR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(25000, SR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, CR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, KR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, KR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, SR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, CR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, LR4_ER4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, SR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(1000, X, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, CR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, SR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, LR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, LRM, Full),
> -       __DEFINE_LINK_MODE_PARAMS(10000, ER, Full),
> -       __DEFINE_LINK_MODE_PARAMS(2500, T, Full),
> -       __DEFINE_LINK_MODE_PARAMS(5000, T, Full),
> +       __DEFINE_LINK_MODE_PARAMS(20000, MLD2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(20000, KR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(40000, KR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(40000, CR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(40000, SR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(40000, LR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(56000, KR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(56000, CR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(56000, SR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(56000, LR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(25000, CR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(25000, KR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(25000, SR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, CR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, KR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, KR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, SR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, CR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, LR4_ER4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, SR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(1000, X, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, CR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, SR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, LR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, LRM, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(10000, ER, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(2500, T, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(5000, T, 1, Full),
>         __DEFINE_SPECIAL_MODE_PARAMS(FEC_NONE),
>         __DEFINE_SPECIAL_MODE_PARAMS(FEC_RS),
>         __DEFINE_SPECIAL_MODE_PARAMS(FEC_BASER),
> -       __DEFINE_LINK_MODE_PARAMS(50000, KR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, SR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, CR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, LR_ER_FR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(50000, DR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, KR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, SR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, CR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, LR2_ER2_FR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, DR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, KR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, SR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, LR4_ER4_FR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, DR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, CR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100, T1, Full),
> -       __DEFINE_LINK_MODE_PARAMS(1000, T1, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, KR8, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, SR8, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, LR8_ER8_FR8, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, DR8, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, CR8, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, KR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, SR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, CR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, LR_ER_FR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(50000, DR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, KR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, SR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, CR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, LR2_ER2_FR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, DR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, KR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, SR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, LR4_ER4_FR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, DR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, CR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100, T1, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(1000, T1, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, KR8, 8, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, SR8, 8, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, LR8_ER8_FR8, 8, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, DR8, 8, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, CR8, 8, Full),
>         __DEFINE_SPECIAL_MODE_PARAMS(FEC_LLRS),
> -       __DEFINE_LINK_MODE_PARAMS(100000, KR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, SR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, LR_ER_FR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, DR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100000, CR, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, KR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, SR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, LR2_ER2_FR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, DR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(200000, CR2, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, KR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, SR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, LR4_ER4_FR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, DR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(400000, CR4, Full),
> -       __DEFINE_LINK_MODE_PARAMS(100, FX, Half),
> -       __DEFINE_LINK_MODE_PARAMS(100, FX, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, KR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, SR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, LR_ER_FR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, DR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100000, CR, 1, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, KR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, SR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, LR2_ER2_FR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, DR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(200000, CR2, 2, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, KR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, SR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, LR4_ER4_FR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, DR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(400000, CR4, 4, Full),
> +       __DEFINE_LINK_MODE_PARAMS(100, FX, 1, Half),
> +       __DEFINE_LINK_MODE_PARAMS(100, FX, 1, Full),
>  };

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4160 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ