Commit fe1f4335 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ethtool-rss-driver-tweaks'

Jakub Kicinski says:

====================
ethtool: rss: driver tweaks and netlink context dumps

This series is a semi-related collection of RSS patches.
Main point is supporting dumping RSS contexts via ethtool netlink.
At present additional RSS contexts can be queried one by one, and
assuming user know the right IDs. This series uses the XArray
added by Ed to provide netlink dump support for ETHTOOL_GET_RSS.

Patch 1 is a trivial selftest debug patch.
Patch 2 coverts mvpp2 for no real reason other than that I had
	a grand plan of converting all drivers at some stage.
Patch 3 removes a now moot check from mlx5 so that all tests
	can pass.
Patch 4 and 5 make a bit used for context support optional,
	for easier grepping of drivers which need converting
	if nothing else.
Patch 6 OTOH adds a new cap bit; some devices don't support
	using a different key per context and currently act
	in surprising ways.
Patch 7 and 8 update the RSS netlink code to use XArray.
Patch 9 and 10 add support for dumping contexts.
Patch 11 and 12 are small adjustments to spec and a new test.

I'm getting distracted with other work, so probably won't have
the time soon to complete next steps, but things which are missing
are (and some of these may be bad ideas):

 - better discovery

   Some sort of API to tell the user who many contexts the device
   can create. Upper bound, devices often share contexts between
   ports etc. so it's hard to tell exactly and upfront number of
   contexts for a netdev. But order of magnitude (4 vs 10s) may
   be enough for container management system to know whether to bother.

 - create/modify/delete via netlink

   The only question here is how to handle all the tricky IOCTL
   legacy. "No change" maps trivially to attribute not present.
   "reset" (indir_size = 0) probably needs to be a new NLA_FLAG?

 - better table size handling

   The current API assumes the LUT has fixed size, which isn't
   true for modern devices. We should have better APIs for the
   drivers to resize the tables, and in user facing API -
   the ability to specify pattern and min size rather than
   exact table expected (sort of like ethtool CLI already does).

 - recounted / socket-bound contexts

   Support for contexts which get "cleaned up" when their parent
   netlink socket gets closed. The major catch is that ntuple
   filters (which we don't currently track) depend on the context,
   so we need auto-removal for both.

v5:
 - fix build
v4: https://lore.kernel.org/20240809031827.2373341-1-kuba@kernel.org
 - adjust to the meaning of max context from net
v3: https://lore.kernel.org/20240806193317.1491822-1-kuba@kernel.org
 - quite a few code comments and commit message changes
 - mvpp2: fix interpretation of max_context_id (I'll take care of
   the net -> net-next merge as needed)
 - filter by ifindex in the selftest
v2: https://lore.kernel.org/20240803042624.970352-1-kuba@kernel.org
 - fix bugs and build in mvpp2
v1: https://lore.kernel.org/20240802001801.565176-1-kuba@kernel.org


====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6b8a024d c1ad8ef8
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -1022,12 +1022,16 @@ attribute-sets:
      -
        name: indir
        type: binary
        sub-type: u32
      -
        name: hkey
        type: binary
      -
        name: input_xfrm
        type: u32
      -
        name: start-context
        type: u32
  -
    name: plca
    attributes:
@@ -1749,12 +1753,12 @@ operations:

      attribute-set: rss

      do: &rss-get-op
      do:
        request:
          attributes:
            - header
            - context
        reply:
        reply: &rss-reply
          attributes:
            - header
            - context
@@ -1762,6 +1766,12 @@ operations:
            - indir
            - hkey
            - input_xfrm
      dump:
        request:
          attributes:
            - header
            - start-context
        reply: *rss-reply
    -
      name: plca-get-cfg
      doc: Get PLCA params.
+10 −2
Original line number Diff line number Diff line
@@ -1866,10 +1866,18 @@ RSS context of an interface similar to ``ETHTOOL_GRSSH`` ioctl request.

Request contents:

=====================================  ======  ==========================
=====================================  ======  ============================
  ``ETHTOOL_A_RSS_HEADER``             nested  request header
  ``ETHTOOL_A_RSS_CONTEXT``            u32     context number
=====================================  ======  ==========================
  ``ETHTOOL_A_RSS_START_CONTEXT``      u32     start context number (dumps)
=====================================  ======  ============================

``ETHTOOL_A_RSS_CONTEXT`` specifies which RSS context number to query,
if not set context 0 (the main context) is queried. Dumps can be filtered
by device (only listing contexts of a given netdev). Filtering single
context number is not supported but ``ETHTOOL_A_RSS_START_CONTEXT``
can be used to start dumping context from the given number (primarily
used to ignore context 0s and only dump additional contexts).

Kernel response contents:

+1 −1
Original line number Diff line number Diff line
@@ -5289,7 +5289,7 @@ void bnxt_ethtool_free(struct bnxt *bp)

const struct ethtool_ops bnxt_ethtool_ops = {
	.cap_link_lanes_supported	= 1,
	.cap_rss_ctx_supported		= 1,
	.rxfh_per_ctx_key		= 1,
	.rxfh_max_num_contexts		= BNXT_MAX_ETH_RSS_CTX + 1,
	.rxfh_indir_space		= BNXT_MAX_RSS_TABLE_ENTRIES_P5,
	.rxfh_priv_size			= sizeof(struct bnxt_rss_ctx),
+1 −0
Original line number Diff line number Diff line
@@ -4725,6 +4725,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
				     ETHTOOL_COALESCE_USE_ADAPTIVE |
				     ETHTOOL_COALESCE_RX_USECS_HIGH,
	.cap_rss_sym_xor_supported = true,
	.rxfh_per_ctx_key	= true,
	.get_link_ksettings	= ice_get_link_ksettings,
	.set_link_ksettings	= ice_set_link_ksettings,
	.get_fec_stats		= ice_get_fec_stats,
+4 −14
Original line number Diff line number Diff line
@@ -1522,29 +1522,19 @@ static int mvpp22_rss_context_create(struct mvpp2_port *port, u32 *rss_ctx)
	return 0;
}

int mvpp22_port_rss_ctx_create(struct mvpp2_port *port, u32 *port_ctx)
int mvpp22_port_rss_ctx_create(struct mvpp2_port *port, u32 port_ctx)
{
	u32 rss_ctx;
	int ret, i;
	int ret;

	ret = mvpp22_rss_context_create(port, &rss_ctx);
	if (ret)
		return ret;

	/* Find the first available context number in the port, starting from 1.
	 * Context 0 on each port is reserved for the default context.
	 */
	for (i = 1; i < MVPP22_N_RSS_TABLES; i++) {
		if (port->rss_ctx[i] < 0)
			break;
	}

	if (i == MVPP22_N_RSS_TABLES)
	if (WARN_ON_ONCE(port->rss_ctx[port_ctx] >= 0))
		return -EINVAL;

	port->rss_ctx[i] = rss_ctx;
	*port_ctx = i;

	port->rss_ctx[port_ctx] = rss_ctx;
	return 0;
}

Loading