Skip to content

Commit 2fc9956

Browse files
committed
Merge branch 'ethtool-rss-minor-fixes-for-recent-rss-changes'
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>
2 parents 0e6dc66 + c3da585 commit 2fc9956

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

net/ethtool/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
993993
return rc;
994994

995995
/* Nonzero ring with RSS only makes sense if NIC adds them together */
996-
if (cmd == ETHTOOL_SRXCLSRLINS && info.flow_type & FLOW_RSS &&
996+
if (cmd == ETHTOOL_SRXCLSRLINS && info.fs.flow_type & FLOW_RSS &&
997997
!ops->cap_rss_rxnfc_adds &&
998998
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
999999
return -EINVAL;

net/ethtool/rss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ rss_prepare_ctx(const struct rss_req_info *request, struct net_device *dev,
107107
u32 total_size, indir_bytes;
108108
u8 *rss_config;
109109

110+
data->no_key_fields = !dev->ethtool_ops->rxfh_per_ctx_key;
111+
110112
ctx = xa_load(&dev->ethtool->rss_ctx, request->rss_context);
111113
if (!ctx)
112114
return -ENOENT;
@@ -153,7 +155,6 @@ rss_prepare_data(const struct ethnl_req_info *req_base,
153155
if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context)
154156
return -EOPNOTSUPP;
155157

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

tools/testing/selftests/drivers/net/hw/rss_ctx.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,21 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True):
252252
try:
253253
# this targets queue 4, which doesn't exist
254254
ntuple2 = ethtool_create(cfg, "-N", flow)
255+
defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}")
255256
except CmdExitFailure:
256257
pass
257258
else:
258259
raise Exception(f"Driver didn't prevent us from targeting a nonexistent queue (context {ctx_id})")
259260
# change the table to target queues 0 and 2
260261
ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0")
261262
# ntuple rule therefore targets queues 1 and 3
262-
ntuple2 = ethtool_create(cfg, "-N", flow)
263+
try:
264+
ntuple2 = ethtool_create(cfg, "-N", flow)
265+
except CmdExitFailure:
266+
ksft_pr("Driver does not support rss + queue offset")
267+
return
268+
269+
defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}")
263270
# should replace existing filter
264271
ksft_eq(ntuple, ntuple2)
265272
_send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3),

0 commit comments

Comments
 (0)