On Thu, May 30, 2019 at 08:06:16PM +0200, Andrew Lunn wrote:
> The kernel can now indicate if the PHY supports operating over a
> single pair at 100Mbps or 1000Mbps.
> 
> Signed-off-by: Andrew Lunn <and...@lunn.ch>
> ---
>  ethtool.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 66a907edd97b..35158939e04c 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -494,8 +494,10 @@ static void init_global_link_mode_masks(void)
>               ETHTOOL_LINK_MODE_10baseT_Full_BIT,
>               ETHTOOL_LINK_MODE_100baseT_Half_BIT,
>               ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> +             ETHTOOL_LINK_MODE_100baseT1_Full_BIT,
>               ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
>               ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
> +             ETHTOOL_LINK_MODE_1000baseT1_Full_BIT,
>               ETHTOOL_LINK_MODE_1000baseKX_Full_BIT,
>               ETHTOOL_LINK_MODE_2500baseX_Full_BIT,
>               ETHTOOL_LINK_MODE_10000baseT_Full_BIT,

The only place where the all_advertised_modes_bits[] array is used is

        ethtool_link_mode_zero(all_advertised_modes);
        ethtool_link_mode_zero(all_advertised_flags);
        for (i = 0; i < ARRAY_SIZE(all_advertised_modes_bits); ++i) {
                ethtool_link_mode_set_bit(all_advertised_modes_bits[i],
                                          all_advertised_modes);
                ethtool_link_mode_set_bit(all_advertised_modes_bits[i],
                                          all_advertised_flags);
        }

so the order does not really matter. I would prefer to have the elements
ordered the same way as in enum ethtool_link_mode_bit_indices so that
it's easier to check if something is missing.

> @@ -634,10 +636,14 @@ static void dump_link_caps(const char *prefix, const 
> char *an_prefix,
>                 "100baseT/Half" },
>               { 1, ETHTOOL_LINK_MODE_100baseT_Full_BIT,
>                 "100baseT/Full" },
> +             { 1, ETHTOOL_LINK_MODE_100baseT1_Full_BIT,
> +               "100baseT1/Full" },
>               { 0, ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
>                 "1000baseT/Half" },
>               { 1, ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
>                 "1000baseT/Full" },
> +             { 1, ETHTOOL_LINK_MODE_1000baseT1_Full_BIT,
> +               "1000baseT1/Full" },
>               { 0, ETHTOOL_LINK_MODE_1000baseKX_Full_BIT,
>                 "1000baseKX/Full" },
>               { 0, ETHTOOL_LINK_MODE_2500baseX_Full_BIT,

Does it mean that we could end up with lines like

                                100baseT/Half 100baseT/Full 100baseT1/Full
                                1000baseT/Full 1000baseT1/Full

if there is a NIC supporting both T and T1? (I'm not sure if it's
possible - but if not, there is no need for setting same_line.) It would
be probably confusing for users as modes on the same line always were
half/full duplex variants of the same.

You should also add the new modes to ethtool.8.in.

Michal

Reply via email to