11 Jul, 2020

1 commit

  • Add an interface to report offloaded UDP ports via ethtool netlink.

    Now that core takes care of tracking which UDP tunnel ports the NICs
    are aware of we can quite easily export this information out to
    user space.

    The responsibility of writing the netlink dumps is split between
    ethtool code and udp_tunnel_nic.c - since udp_tunnel module may
    not always be loaded, yet we should always report the capabilities
    of the NIC.

    $ ethtool --show-tunnels eth0
    Tunnel information for eth0:
    UDP port table 0:
    Size: 4
    Types: vxlan
    No entries
    UDP port table 1:
    Size: 4
    Types: geneve, vxlan-gpe
    Entries (1):
    port 1230, vxlan-gpe

    v4:
    - back to v2, build fix is now directly in udp_tunnel.h
    v3:
    - don't compile ETHTOOL_MSG_TUNNEL_INFO_GET in if CONFIG_INET
    not set.
    v2:
    - fix string set count,
    - reorder enums in the uAPI,
    - fix type of ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES to bitset
    in docs and comments.

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

    Jakub Kicinski
     

08 Jul, 2020

1 commit

  • In order to decouple ethtool from its PHY library dependency, define an
    ethtool_phy_ops singleton which can be overriden by the PHY library when
    it loads with an appropriate set of function pointers.

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

30 Mar, 2020

2 commits

  • Implement TSINFO_GET request to get timestamping information for a network
    device. This is traditionally available via ETHTOOL_GET_TS_INFO ioctl
    request.

    Move part of ethtool_get_ts_info() into common.c so that ioctl and netlink
    code use the same logic to get timestamping information from the device.

    v3: use "TSINFO" rather than "TIMESTAMP", suggested by Richard Cochran

    Signed-off-by: Michal Kubecek
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Add three string sets related to timestamping information:

    ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags
    ETH_SS_TS_TX_TYPES: timestamping Tx types
    ETH_SS_TS_RX_FILTERS: timestamping Rx filters

    These will be used for TIMESTAMP_GET request.

    v2: avoid compiler warning ("enumeration value not handled in switch")
    in net_hwtstamp_validate()

    v3: omit dash in Tx type names ("one-step-*" -> "onestep-*"), suggested by
    Richard Cochran

    Signed-off-by: Michal Kubecek
    Acked-by: Richard Cochran
    Signed-off-by: David S. Miller

    Michal Kubecek
     

13 Mar, 2020

2 commits

  • Implement CHANNELS_SET netlink request to set channel counts of a network
    device. These are traditionally set with ETHTOOL_SCHANNELS ioctl request.

    Like the ioctl implementation, the generic ethtool code checks if supplied
    values do not exceed driver defined limits; if they do, first offending
    attribute is reported using extack. Checks preventing removing channels
    used for RX indirection table or zerocopy AF_XDP socket are also
    implemented.

    Move ethtool_get_max_rxfh_channel() helper into common.c so that it can be
    used by both ioctl and netlink code.

    v2:
    - fix netdev reference leak in error path (found by Jakub Kicinsky)

    Signed-off-by: Michal Kubecek
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Implement FEATURES_GET request to get network device features. These are
    traditionally available via ETHTOOL_GFEATURES ioctl request.

    v2:
    - style cleanup suggested by Jakub Kicinski

    Signed-off-by: Michal Kubecek
    Reviewed-by: Jakub Kicinski
    Signed-off-by: David S. Miller

    Michal Kubecek
     

27 Jan, 2020

2 commits

  • Implement WOL_GET request to get wake-on-lan settings for a device,
    traditionally available via ETHTOOL_GWOL ioctl request.

    As part of the implementation, provide symbolic names for wake-on-line
    modes as ETH_SS_WOL_MODES string set.

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

    Michal Kubecek
     
  • Implement DEBUG_GET request to get debugging settings for a device. At the
    moment, only message mask corresponding to message level as reported by
    ETHTOOL_GMSGLVL ioctl request is provided. (It is called message level in
    ioctl interface but almost all drivers interpret it as a bit mask.)

    As part of the implementation, provide symbolic names for message mask bits
    as ETH_SS_MSG_CLASSES string set.

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

    Michal Kubecek
     

28 Dec, 2019

2 commits

  • Implement LINKSTATE_GET netlink request to get link state information.

    At the moment, only link up flag as provided by ETHTOOL_GLINK ioctl command
    is returned.

    LINKSTATE_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
     
  • Implement LINKINFO_GET netlink request to get basic link settings provided
    by ETHTOOL_GLINKSETTINGS and ETHTOOL_GSET ioctl commands.

    This request provides settings not directly related to autonegotiation and
    link mode selection: physical port, phy MDIO address, MDI(-X) status,
    MDI(-X) control and transceiver.

    LINKINFO_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
     

13 Dec, 2019

2 commits

  • Unlike e.g. netdev features, the ethtool ioctl interface requires link mode
    table to be in sync between kernel and userspace for userspace to be able
    to display and set all link modes supported by kernel. The way arbitrary
    length bitsets are implemented in netlink interface, this will be no longer
    needed.

    To allow userspace to access all link modes running kernel supports, add
    table of ethernet link mode names and make it available as a string set to
    userspace GET_STRSET requests. Add build time check to make sure names
    are defined for all modes declared in enum ethtool_link_mode_bit_indices.

    Once the string set is available, make it also accessible via ioctl.

    Signed-off-by: Michal Kubecek
    Reviewed-by: Andrew Lunn
    Reviewed-by: Jiri Pirko
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Michal Kubecek
     
  • Introduce file net/ethtool/common.c for code shared by ioctl and netlink
    ethtool interface. Move name tables of features, RSS hash functions,
    tunables and PHY tunables into this file.

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

    Michal Kubecek