]> www.infradead.org Git - users/willy/xarray.git/commit
net: ethtool: fix off-by-one error in max RSS context IDs
authorEdward Cree <ecree.xilinx@gmail.com>
Wed, 7 Aug 2024 16:06:12 +0000 (17:06 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Aug 2024 15:54:33 +0000 (08:54 -0700)
commitb54de55990b0467538c6bb33523b28816384958a
tree22dfd137cf6326d2af9e6386baad788cb3b41e9f
parenta70b637db15b4de25af3c5946c4399144b3bc241
net: ethtool: fix off-by-one error in max RSS context IDs

Both ethtool_ops.rxfh_max_context_id and the default value used when
 it's not specified are supposed to be exclusive maxima (the former
 is documented as such; the latter, U32_MAX, cannot be used as an ID
 since it equals ETH_RXFH_CONTEXT_ALLOC), but xa_alloc() expects an
 inclusive maximum.
Subtract one from 'limit' to produce an inclusive maximum, and pass
 that to xa_alloc().
Increase bnxt's max by one to prevent a (very minor) regression, as
 BNXT_MAX_ETH_RSS_CTX is an inclusive max.  This is safe since bnxt
 is not actually hard-limited; BNXT_MAX_ETH_RSS_CTX is just a
 leftover from old driver code that managed context IDs itself.
Rename rxfh_max_context_id to rxfh_max_num_contexts to make its
 semantics (hopefully) more obvious.

Fixes: 847a8ab18676 ("net: ethtool: let the core choose RSS context IDs")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/5a2d11a599aa5b0cc6141072c01accfb7758650c.1723045898.git.ecree.xilinx@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
include/linux/ethtool.h
net/ethtool/ioctl.c