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
     

30 Mar, 2020

3 commits

  • Send ETHTOOL_MSG_COALESCE_NTF notification whenever coalescing parameters
    of a network device are modified using ETHTOOL_MSG_COALESCE_SET netlink
    message or ETHTOOL_SCOALESCE ioctl request.

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

    Michal Kubecek
     
  • Implement COALESCE_SET netlink request to set coalescing parameters of
    a network device. These are traditionally set with ETHTOOL_SCOALESCE ioctl
    request. This commit adds only support for device coalescing parameters,
    not per queue coalescing parameters.

    Like the ioctl implementation, the generic ethtool code checks if only
    supported parameters are modified; if not, first offending attribute is
    reported using extack.

    v2: fix alignment (whitespace only)

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

    Michal Kubecek
     
  • Implement COALESCE_GET request to get coalescing parameters of a network
    device. These are traditionally available via ETHTOOL_GCOALESCE ioctl
    request. This commit adds only support for device coalescing parameters,
    not per queue coalescing parameters.

    Omit attributes with zero values unless they are declared as supported
    (i.e. the corresponding bit in ethtool_ops::supported_coalesce_params is
    set).

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

    Michal Kubecek