Skip to content

Commit

Permalink
Merge branch 'ethtool-rss-minor-fixes-for-recent-rss-changes'
Browse files Browse the repository at this point in the history
Jakub Kicinski says:

====================
ethtool: rss: minor fixes for recent RSS changes

Make sure RSS_GET messages are consistent in do and dump.
Fix up a recently added safety check for RSS + queue offset.
Adjust related tests so that they pass on devices which
don't support RSS + queue offset.
====================

Link: https://patch.msgid.link/20250201013040.725123-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Feb 4, 2025
2 parents 0e6dc66 + c3da585 commit 2fc9956
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion net/ethtool/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
return rc;

/* Nonzero ring with RSS only makes sense if NIC adds them together */
if (cmd == ETHTOOL_SRXCLSRLINS && info.flow_type & FLOW_RSS &&
if (cmd == ETHTOOL_SRXCLSRLINS && info.fs.flow_type & FLOW_RSS &&
!ops->cap_rss_rxnfc_adds &&
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
return -EINVAL;
Expand Down
3 changes: 2 additions & 1 deletion net/ethtool/rss.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ rss_prepare_ctx(const struct rss_req_info *request, struct net_device *dev,
u32 total_size, indir_bytes;
u8 *rss_config;

data->no_key_fields = !dev->ethtool_ops->rxfh_per_ctx_key;

ctx = xa_load(&dev->ethtool->rss_ctx, request->rss_context);
if (!ctx)
return -ENOENT;
Expand Down Expand Up @@ -153,7 +155,6 @@ rss_prepare_data(const struct ethnl_req_info *req_base,
if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context)
return -EOPNOTSUPP;

data->no_key_fields = !ops->rxfh_per_ctx_key;
return rss_prepare_ctx(request, dev, data, info);
}

Expand Down
9 changes: 8 additions & 1 deletion tools/testing/selftests/drivers/net/hw/rss_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,21 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True):
try:
# this targets queue 4, which doesn't exist
ntuple2 = ethtool_create(cfg, "-N", flow)
defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}")
except CmdExitFailure:
pass
else:
raise Exception(f"Driver didn't prevent us from targeting a nonexistent queue (context {ctx_id})")
# change the table to target queues 0 and 2
ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0")
# ntuple rule therefore targets queues 1 and 3
ntuple2 = ethtool_create(cfg, "-N", flow)
try:
ntuple2 = ethtool_create(cfg, "-N", flow)
except CmdExitFailure:
ksft_pr("Driver does not support rss + queue offset")
return

defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}")
# should replace existing filter
ksft_eq(ntuple, ntuple2)
_send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3),
Expand Down

0 comments on commit 2fc9956

Please sign in to comment.