Commit Graph

13 Commits

Author SHA1 Message Date
Michal Schmidt ddc035fbf4 ethtool: rss: support skipping contexts during dump
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit 3d50c66c0609c8b64fb22e9c188fca88f34e7c98
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:26 2024 -0700

    ethtool: rss: support skipping contexts during dump

    Applications may want to deal with dynamic RSS contexts only.
    So dumping context 0 will be counter-productive for them.
    Support starting the dump from a given context ID.

    Alternative would be to implement a dump flag to skip just
    context 0, not sure which is better...

    Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:36:13 +01:00
Michal Schmidt 8537fa48af ethtool: rss: support dumping RSS contexts
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit f6122900f4e28bfcb8abc76e1f7b83a1e0d8afd3
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:25 2024 -0700

    ethtool: rss: support dumping RSS contexts

    Now that we track RSS contexts in the core we can easily dump
    them. This is a major introspection improvement, as previously
    the only way to find all contexts would be to try all ids
    (of which there may be 2^32 - 1).

    Don't use the XArray iterators (like xa_for_each_start()) as they
    do not move the index past the end of the array once done, which
    caused multiple bugs in Netlink dumps in the past.

    Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:36:12 +01:00
Michal Schmidt d4c49812f6 ethtool: rss: report info about additional contexts from XArray
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit bb87f2c7968eaebafa130f0618dea554700bb74b
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:24 2024 -0700

    ethtool: rss: report info about additional contexts from XArray

    IOCTL already uses the XArray when reporting info about additional
    contexts. Do the same thing in netlink code.

    Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:36:12 +01:00
Michal Schmidt 8d9b4bb5e8 ethtool: rss: move the device op invocation out of rss_prepare_data()
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit a7ddfd5d57036caaaf2e1e896ff7aeed6530a0ca
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:23 2024 -0700

    ethtool: rss: move the device op invocation out of rss_prepare_data()

    Factor calling device ops out of rss_prepare_data().
    Next patch will add alternative path using xarray.
    No functional changes.

    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:36:12 +01:00
Michal Schmidt 0af8434394 ethtool: rss: don't report key if device doesn't support it
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit ec6e57beaf8bc64ea0c2dc0cc360afcc7f504425
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:22 2024 -0700

    ethtool: rss: don't report key if device doesn't support it

    marvell/otx2 and mvpp2 do not support setting different
    keys for different RSS contexts. Contexts have separate
    indirection tables but key is shared with all other contexts.
    This is likely fine, indirection table is the most important
    piece.

    Don't report the key-related parameters from such drivers.
    This prevents driver-errors, e.g. otx2 always writes
    the main key, even when user asks to change per-context key.
    The second reason is that without this change tracking
    the keys by the core gets complicated. Even if the driver
    correctly reject setting key with rss_context != 0,
    change of the main key would have to be reflected in
    the XArray for all additional contexts.

    Since the additional contexts don't have their own keys
    not including the attributes (in Netlink speak) seems
    intuitive. ethtool CLI seems to deal with it just fine.

    Having to set the flag in majority of the drivers is
    a bit tedious but not reporting the key is a safer
    default.

    Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Conflicts:
	drivers/net/ethernet/sfc/ef100_ethtool.c
	drivers/net/ethernet/sfc/ethtool.c
	- Because commit a9ee8d4a97d8 ("sfc: use new rxfh_context API")
          has not been backported yet.
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-05 11:21:58 +01:00
Michal Schmidt fa1328ac74 ethtool: make ethtool_ops::cap_rss_ctx_supported optional
JIRA: https://issues.redhat.com/browse/RHEL-57751

commit ce056504e2e53b22c1f789cff2ad6a0a135dc24d
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Fri Aug 9 22:37:20 2024 -0700

    ethtool: make ethtool_ops::cap_rss_ctx_supported optional

    cap_rss_ctx_supported was created because the API for creating
    and configuring additional contexts is mux'ed with the normal
    RSS API. Presence of ops does not imply driver can actually
    support rss_context != 0 (in fact drivers mostly ignore that
    field). cap_rss_ctx_supported lets core check that the driver
    is context-aware before calling it.

    Now that we have .create_rxfh_context, there is no such
    ambiguity. We can depend on presence of the op.
    Make setting the bit optional.

    Reviewed-by: Gal Pressman <gal@nvidia.com>
    Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-11-04 19:42:48 +01:00
Michal Schmidt 1e0691816c ethtool: rss: echo the context number back
JIRA: https://issues.redhat.com/browse/RHEL-57750

commit f96aae91b0d260f682e630e092ef70a05a718a43
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Wed Jul 24 16:42:49 2024 -0700

    ethtool: rss: echo the context number back

    The response to a GET request in Netlink should fully identify
    the queried object. RSS_GET accepts context id as an input,
    so it must echo that attribute back to the response.

    After (assuming context 1 has been created):

      $ ./cli.py --spec netlink/specs/ethtool.yaml \
                 --do rss-get \
                 --json '{"header": {"dev-index": 2}, "context": 1}'
      {'context': 1,
       'header': {'dev-index': 2, 'dev-name': 'eth0'},
      [...]

    Fixes: 7112a04664bf ("ethtool: add netlink based get rss support")
    Acked-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Joe Damato <jdamato@fastly.com>
    Link: https://patch.msgid.link/20240724234249.2621109-3-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-10-01 12:19:15 +02:00
Ivan Vecera a1c6339cb2 net: ethtool: add support for symmetric-xor RSS hash
JIRA: https://issues.redhat.com/browse/RHEL-31889

commit 13e59344fb9d3c9d3acd138ae320b5b67b658694
Author: Ahmed Zaki <ahmed.zaki@intel.com>
Date:   Tue Dec 12 17:33:16 2023 -0700

    net: ethtool: add support for symmetric-xor RSS hash

    Symmetric RSS hash functions are beneficial in applications that monitor
    both Tx and Rx packets of the same flow (IDS, software firewalls, ..etc).
    Getting all traffic of the same flow on the same RX queue results in
    higher CPU cache efficiency.

    A NIC that supports "symmetric-xor" can achieve this RSS hash symmetry
    by XORing the source and destination fields and pass the values to the
    RSS hash algorithm.

    The user may request RSS hash symmetry for a specific algorithm, via:

        # ethtool -X eth0 hfunc <hash_alg> symmetric-xor

    or turn symmetry off (asymmetric) by:

        # ethtool -X eth0 hfunc <hash_alg>

    The specific fields for each flow type should then be specified as usual
    via:
        # ethtool -N|-U eth0 rx-flow-hash <flow_type> s|d|f|n

    Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
    Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
    Link: https://lore.kernel.org/r/20231213003321.605376-4-ahmed.zaki@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:30:56 +02:00
Ivan Vecera 5e22f83eae net: ethtool: get rid of get/set_rxfh_context functions
JIRA: https://issues.redhat.com/browse/RHEL-31889

commit dcd8dbf9e734eb334113ea43186c1c26e9f497bb
Author: Ahmed Zaki <ahmed.zaki@intel.com>
Date:   Tue Dec 12 17:33:15 2023 -0700

    net: ethtool: get rid of get/set_rxfh_context functions

    Add the RSS context parameters to struct ethtool_rxfh_param and use the
    get/set_rxfh to handle the RSS contexts as well.

    This is part 2/2 of the fix suggested in [1]:

     - Add a rss_context member to the argument struct and a capability
       like cap_link_lanes_supported to indicate whether driver supports
       rss contexts, then you can remove *et_rxfh_context functions,
       and instead call *et_rxfh() with a non-zero rss_context.

    Link: https://lore.kernel.org/netdev/20231121152906.2dd5f487@kernel.org/ [1]
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
    Link: https://lore.kernel.org/r/20231213003321.605376-3-ahmed.zaki@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:30:49 +02:00
Ivan Vecera 6555e8128e net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops
JIRA: https://issues.redhat.com/browse/RHEL-31889

Conflicts:
- drivers/net/ethernet/fungible/funeth/funeth_ethtool.c
  hunk removed as the file does not exist in RHEL

commit fb6e30a72539ce28c1323aef4190d35aac106f6f
Author: Ahmed Zaki <ahmed.zaki@intel.com>
Date:   Tue Dec 12 17:33:14 2023 -0700

    net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops

    The get/set_rxfh ethtool ops currently takes the rxfh (RSS) parameters
    as direct function arguments. This will force us to change the API (and
    all drivers' functions) every time some new parameters are added.

    This is part 1/2 of the fix, as suggested in [1]:

    - First simplify the code by always providing a pointer to all params
       (indir, key and func); the fact that some of them may be NULL seems
       like a weird historic thing or a premature optimization.
       It will simplify the drivers if all pointers are always present.

     - Then make the functions take a dev pointer, and a pointer to a
       single struct wrapping all arguments. The set_* should also take
       an extack.

    Link: https://lore.kernel.org/netdev/20231121152906.2dd5f487@kernel.org/ [1]
    Suggested-by: Jakub Kicinski <kuba@kernel.org>
    Suggested-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
    Link: https://lore.kernel.org/r/20231213003321.605376-2-ahmed.zaki@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:30:33 +02:00
Ivan Vecera b0d7e2a017 ethtool: netlink: always pass genl_info to .prepare_data
JIRA: https://issues.redhat.com/browse/RHEL-30656

commit f946270d05c26044c67511ef5a9d91e06962d79f
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Mon Aug 14 14:47:23 2023 -0700

    ethtool: netlink: always pass genl_info to .prepare_data

    We had a number of bugs in the past because developers forgot
    to fully test dumps, which pass NULL as info to .prepare_data.
    .prepare_data implementations would try to access info->extack
    leading to a null-deref.

    Now that dumps and notifications can access struct genl_info
    we can pass it in, and remove the info null checks.

    Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # pause
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Link: https://lore.kernel.org/r/20230814214723.2924989-11-kuba@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2024-04-10 09:19:31 +02:00
Ivan Vecera 9e345e0240 ethtool: add netlink attr in rss get reply only if value is not null
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175237

commit ea22f4319c3409d847d70eaaf149cc480a73220d
Author: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Date:   Wed Jan 11 15:56:07 2023 -0800

    ethtool: add netlink attr in rss get reply only if value is not null

    Current code for RSS_GET ethtool command includes netlink attributes
    in reply message to user space even if they are null. Added checks
    to include netlink attribute in reply message only if a value is
    received from driver. Drivers might return null for RSS indirection
    table or hash key. Instead of including attributes with empty value
    in the reply message, add netlink attribute only if there is content.

    Fixes: 7112a04664bf ("ethtool: add netlink based get rss support")
    Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
    Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
    Link: https://lore.kernel.org/r/20230111235607.85509-1-sudheer.mogilappagari@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2023-03-31 18:02:51 +02:00
Ivan Vecera fed6409bc5 ethtool: add netlink based get rss support
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175237

commit 7112a04664bfc10ae4709b2079fe3991cbd1fe18
Author: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Date:   Thu Dec 1 16:25:55 2022 -0800

    ethtool: add netlink based get rss support

    Add netlink based support for "ethtool -x <dev> [context x]"
    command by implementing ETHTOOL_MSG_RSS_GET netlink message.
    This is equivalent to functionality provided via ETHTOOL_GRSSH
    in ioctl path. It sends RSS table, hash key and hash function
    of an interface to user space.

    This patch implements existing functionality available
    in ioctl path and enables addition of new RSS context
    based parameters in future.

    Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
    Link: https://lore.kernel.org/r/20221202002555.241580-1-sudheer.mogilappagari@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2023-03-31 18:02:50 +02:00