06 Oct, 2020

4 commits

  • To get the most out of parsing by the core, and to allow dumping
    full policies we need to specify which policy applies to nested
    attrs. For headers it's ethnl_header_policy.

    $ sed -i 's@\(ETHTOOL_A_.*HEADER\].*=\) { .type = NLA_NESTED },@\1\n\t\tNLA_POLICY_NESTED(ethnl_header_policy),@' net/ethtool/*

    Signed-off-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Since ethtool uses strict attribute validation there's no need
    to initialize all attributes in policy tables. 0 is NLA_UNSPEC
    which is going to be rejected. Remove the NLA_REJECTs.

    Similarly attributes above maxattrs are rejected, so there's
    no need to always size the policy tables to ETHTOOL_A_..._MAX.

    v2: - new patch

    Suggested-by: Johannes Berg
    Signed-off-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Similarly to get commands wire up the policies of set commands
    to get parsing by the core and policy dumps.

    Signed-off-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jakub Kicinski
     
  • Wire up policies for get commands in struct nla_policy of the ethtool
    family. Make use of genetlink code attr validation and parsing, as well
    as allow dumping policies to user space.

    For every ETHTOOL_MSG_*_GET:
    - add 'ethnl_' prefix to policy name
    - add extern declaration in net/ethtool/netlink.h
    - wire up the policy & attr in ethtool_genl_ops[].
    - remove .request_policy and .max_attr from ethnl_request_ops.

    Obviously core only records the first "layer" of parsed attrs
    so we still need to parse the sub-attrs of the nested header
    attribute.

    v2:
    - merge of patches 1 and 2 from v1
    - remove stray empty lines in ops
    - also remove .max_attr

    Signed-off-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Jakub Kicinski
     

20 Sep, 2020

1 commit

  • Add entries for the 100base-FX full and half duplex supported modes.

    $ ethtool eth0
    Supported ports: [ FIBRE ]
    Supported link modes: 100baseFX/Half 100baseFX/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: No
    Supported FEC modes: Not reported
    Advertised link modes: 100baseFX/Half 100baseFX/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Advertised FEC modes: Not reported
    Speed: 100Mb/s
    Duplex: Full
    Auto-negotiation: off
    Port: MII
    PHYAD: 1
    Transceiver: external
    Supports Wake-on: gs
    Wake-on: d
    SecureOn password: 00:00:00:00:00:00
    Current message level: 0x00000000 (0)

    Link detected: yes

    Signed-off-by: Dan Murphy
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Dan Murphy
     

04 Aug, 2020

1 commit


09 Jul, 2020

1 commit

  • Define 100G, 200G and 400G link modes using 100Gbps per lane

    LR, ER and FR are defined as a single link mode because they are
    using same technology and by design are fully interoperable.
    EEPROM content indicates if the module is LR, ER, or FR, and the
    user space ethtool decoder is planned to support decoding these
    modes in the EEPROM.

    Signed-off-by: Meir Lichtinger
    CC: Andrew Lunn
    Reviewed-by: Aya Levin
    Signed-off-by: Saeed Mahameed
    Signed-off-by: David S. Miller

    Meir Lichtinger
     

07 May, 2020

1 commit

  • This UAPI is needed for BroadR-Reach 100BASE-T1 devices. Due to lack of
    auto-negotiation support, we needed to be able to configure the
    MASTER-SLAVE role of the port manually or from an application in user
    space.

    The same UAPI can be used for 1000BASE-T or MultiGBASE-T devices to
    force MASTER or SLAVE role. See IEEE 802.3-2018:
    22.2.4.3.7 MASTER-SLAVE control register (Register 9)
    22.2.4.3.8 MASTER-SLAVE status register (Register 10)
    40.5.2 MASTER-SLAVE configuration resolution
    45.2.1.185.1 MASTER-SLAVE config value (1.2100.14)
    45.2.7.10 MultiGBASE-T AN control 1 register (Register 7.32)

    The MASTER-SLAVE role affects the clock configuration:

    -------------------------------------------------------------------------------
    When the PHY is configured as MASTER, the PMA Transmit function shall
    source TX_TCLK from a local clock source. When configured as SLAVE, the
    PMA Transmit function shall source TX_TCLK from the clock recovered from
    data stream provided by MASTER.

    iMX6Q KSZ9031 XXX
    ------\ /-----------\ /------------\
    | | | | |
    MAC || PHY Slave || PHY Master |
    |
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Oleksij Rempel
     

26 Mar, 2020

1 commit


24 Mar, 2020

1 commit

  • Andrew noticed that some handlers for *_SET commands leak a netdev
    reference if required ethtool_ops callbacks do not exist. A simple
    reproducer would be e.g.

    ip link add veth1 type veth peer name veth2
    ethtool -s veth1 wol g
    ip link del veth1

    Make sure dev_put() is called when ethtool_ops check fails.

    v2: add Fixes tags

    Fixes: a53f3d41e4d3 ("ethtool: set link settings with LINKINFO_SET request")
    Fixes: bfbcfe2032e7 ("ethtool: set link modes related data with LINKMODES_SET request")
    Fixes: e54d04e3afea ("ethtool: set message mask with DEBUG_SET request")
    Fixes: 8d425b19b305 ("ethtool: set wake-on-lan settings with WOL_SET request")
    Reported-by: Andrew Lunn
    Signed-off-by: Michal Kubecek
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Michal Kubecek
     

13 Mar, 2020

1 commit

  • Andrew Lunn pointed out that even if it's documented that
    ethnl_parse_header() takes reference to network device if it fills it
    into the target structure, its name doesn't make it apparent so that
    corresponding dev_put() looks like mismatched.

    Rename the function ethnl_parse_header_dev_get() to indicate that it
    takes a reference.

    Suggested-by: Andrew Lunn
    Signed-off-by: Michal Kubecek
    Signed-off-by: David S. Miller

    Michal Kubecek
     

19 Feb, 2020

1 commit

  • Add support for low latency Reed Solomon FEC as LLRS.

    The LL-FEC is defined by the 25G/50G ethernet consortium,
    in the document titled "Low Latency Reed Solomon Forward Error Correction"

    Signed-off-by: Aya Levin
    Reviewed-by: Eran Ben Elisha
    CC: Andrew Lunn
    Signed-off-by: Saeed Mahameed
    Reviewed-by: Andrew Lunn

    Aya Levin
     

04 Jan, 2020

1 commit

  • Fixes gcc '-Wunused-but-set-variable' warning:

    net/ethtool/linkmodes.c: In function 'ethnl_set_linkmodes':
    net/ethtool/linkmodes.c:326:32: warning:
    variable 'lsettings' set but not used [-Wunused-but-set-variable]
    struct ethtool_link_settings *lsettings;
    ^
    It is never used, so remove it.

    Reported-by: Hulk Robot
    Signed-off-by: YueHaibing
    Reviewed-by: Michal Kubecek
    Reviewed-by: Simon Horman
    Signed-off-by: David S. Miller

    YueHaibing
     

28 Dec, 2019

3 commits

  • Send ETHTOOL_MSG_LINKMODES_NTF notification message whenever device link
    settings or advertised modes are modified using ETHTOOL_MSG_LINKMODES_SET
    netlink message or ETHTOOL_SLINKSETTINGS or ETHTOOL_SSET ioctl commands.

    The notification message has the same format as reply to LINKMODES_GET
    request. ETHTOOL_MSG_LINKMODES_SET netlink request only triggers the
    notification if there is a change but the ioctl command handlers do not
    check if there is an actual change and trigger the notification whenever
    the commands are executed.

    As all work is done by ethnl_default_notify() handler and callback
    functions introduced to handle LINKMODES_GET requests, all that remains is
    adding entries for ETHTOOL_MSG_LINKMODES_NTF into ethnl_notify_handlers and
    ethnl_default_notify_ops lookup tables and calls to ethtool_notify() where
    needed.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Implement LINKMODES_SET netlink request to set advertised linkmodes and
    related attributes as ETHTOOL_SLINKSETTINGS and ETHTOOL_SSET commands do.

    The request allows setting autonegotiation flag, speed, duplex and
    advertised link modes.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Implement LINKMODES_GET netlink request to get link modes related
    information provided by ETHTOOL_GLINKSETTINGS and ETHTOOL_GSET ioctl
    commands.

    This request provides supported, advertised and peer advertised link modes,
    autonegotiation flag, speed and duplex.

    LINKMODES_GET request can be used with NLM_F_DUMP (without device
    identification) to request the information for all devices in current
    network namespace providing the data.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek