net: ethtool: only allow set_rxnfc with rss + ring_cookie if driver opts in
BugLink: https://bugs.launchpad.net/bugs/2111953 [ Upstream commit 9e43ad7a1edef268acac603e1975c8f50a20d02f ] Ethtool ntuple filters with FLOW_RSS were originally defined as adding the base queue ID (ring_cookie) to the value from the indirection table, so that the same table could distribute over more than one set of queues when used by different filters. However, some drivers / hardware ignore the ring_cookie, and simply use the indirection table entries as queue IDs directly. Thus, for drivers which have not opted in by setting ethtool_ops.cap_rss_rxnfc_adds to declare that they support the original (addition) semantics, reject in ethtool_set_rxnfc any filter which combines FLOW_RSS and a nonzero ring. (For a ring_cookie of zero, both behaviours are equivalent.) Set the cap bit in sfc, as it is known to support this feature. Signed-off-by: Edward Cree <ecree.xilinx@gmail.com> Reviewed-by: Martin Habets <habetsm.xilinx@gmail.com> Link: https://patch.msgid.link/cc3da0844083b0e301a33092a6299e4042b65221.1731499022.git.ecree.xilinx@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 4f5a52adeb1a ("ethtool: Fix set RXNFC command with symmetric RSS hash") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
360df2180a
commit
236a10a07b
@@ -59,6 +59,7 @@ const struct ethtool_ops ef100_ethtool_ops = {
|
||||
|
||||
.get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = efx_ethtool_get_rxfh_key_size,
|
||||
.cap_rss_rxnfc_adds = true,
|
||||
.get_rxfh = efx_ethtool_get_rxfh,
|
||||
.set_rxfh = efx_ethtool_set_rxfh,
|
||||
|
||||
|
||||
@@ -268,6 +268,7 @@ const struct ethtool_ops efx_ethtool_ops = {
|
||||
.set_rxnfc = efx_ethtool_set_rxnfc,
|
||||
.get_rxfh_indir_size = efx_ethtool_get_rxfh_indir_size,
|
||||
.get_rxfh_key_size = efx_ethtool_get_rxfh_key_size,
|
||||
.cap_rss_rxnfc_adds = true,
|
||||
.get_rxfh = efx_ethtool_get_rxfh,
|
||||
.set_rxfh = efx_ethtool_set_rxfh,
|
||||
.get_ts_info = efx_ethtool_get_ts_info,
|
||||
|
||||
@@ -639,6 +639,9 @@ struct ethtool_rxfh_param {
|
||||
* contexts.
|
||||
* @cap_rss_sym_xor_supported: indicates if the driver supports symmetric-xor
|
||||
* RSS.
|
||||
* @cap_rss_rxnfc_adds: device supports nonzero ring_cookie in filters with
|
||||
* %FLOW_RSS flag; the queue ID from the filter is added to the value from
|
||||
* the indirection table to determine the delivery queue.
|
||||
* @supported_coalesce_params: supported types of interrupt coalescing.
|
||||
* @supported_ring_params: supported ring params.
|
||||
* @get_drvinfo: Report driver/device information. Modern drivers no
|
||||
@@ -819,6 +822,7 @@ struct ethtool_ops {
|
||||
u32 cap_link_lanes_supported:1;
|
||||
u32 cap_rss_ctx_supported:1;
|
||||
u32 cap_rss_sym_xor_supported:1;
|
||||
u32 cap_rss_rxnfc_adds:1;
|
||||
u32 supported_coalesce_params;
|
||||
u32 supported_ring_params;
|
||||
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
|
||||
|
||||
@@ -987,6 +987,11 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
/* Nonzero ring with RSS only makes sense if NIC adds them together */
|
||||
if (info.flow_type & FLOW_RSS && !ops->cap_rss_rxnfc_adds &&
|
||||
ethtool_get_flow_spec_ring(info.fs.ring_cookie))
|
||||
return -EINVAL;
|
||||
|
||||
if (ops->get_rxfh) {
|
||||
struct ethtool_rxfh_param rxfh = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user