aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-06-11 07:59:42 -0700
committerJakub Kicinski <kuba@kernel.org>2025-06-12 17:16:19 -0700
commit2a644c5cecc028c4fcd6545dd736b4dee949b090 (patch)
tree5318318e9ff1ae9fb488a4b42ffc0c1d06517d28
parentnet: ethtool: copy the rxfh flow handling (diff)
downloadwireguard-linux-2a644c5cecc028c4fcd6545dd736b4dee949b090.tar.xz
wireguard-linux-2a644c5cecc028c4fcd6545dd736b4dee949b090.zip
net: ethtool: remove the duplicated handling from rxfh and rxnfc
Now that the handles have been separated - remove the RX Flow Hash handling from rxnfc functions and vice versa. Reviewed-by: Joe Damato <joe@dama.to> Link: https://patch.msgid.link/20250611145949.2674086-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/ethtool/ioctl.c57
1 files changed, 5 insertions, 52 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index e65da428615a..33892099cdad 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1075,19 +1075,7 @@ ethtool_set_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)
if (rc)
return rc;
- if (cmd == ETHTOOL_SRXCLSRLINS && info.fs.flow_type & FLOW_RSS) {
- /* Nonzero ring with RSS only makes sense
- * if NIC adds them together
- */
- if (!ops->cap_rss_rxnfc_adds &&
- ethtool_get_flow_spec_ring(info.fs.ring_cookie))
- return -EINVAL;
-
- if (!xa_load(&dev->ethtool->rss_ctx, info.rss_context))
- return -EINVAL;
- }
-
- if (cmd == ETHTOOL_SRXFH && ops->get_rxfh) {
+ if (ops->get_rxfh) {
struct ethtool_rxfh_param rxfh = {};
rc = ops->get_rxfh(dev, &rxfh);
@@ -1099,15 +1087,7 @@ ethtool_set_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)
return rc;
}
- rc = ops->set_rxnfc(dev, &info);
- if (rc)
- return rc;
-
- if (cmd == ETHTOOL_SRXCLSRLINS &&
- ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, NULL))
- return -EFAULT;
-
- return 0;
+ return ops->set_rxnfc(dev, &info);
}
static noinline_for_stack int
@@ -1117,7 +1097,6 @@ ethtool_get_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)
size_t info_size = sizeof(info);
const struct ethtool_ops *ops = dev->ethtool_ops;
int ret;
- void *rule_buf = NULL;
if (!ops->get_rxnfc)
return -EOPNOTSUPP;
@@ -1126,25 +1105,11 @@ ethtool_get_rxfh_fields(struct net_device *dev, u32 cmd, void __user *useraddr)
if (ret)
return ret;
- if (info.cmd == ETHTOOL_GRXCLSRLALL) {
- if (info.rule_cnt > 0) {
- if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32))
- rule_buf = kcalloc(info.rule_cnt, sizeof(u32),
- GFP_USER);
- if (!rule_buf)
- return -ENOMEM;
- }
- }
-
- ret = ops->get_rxnfc(dev, &info, rule_buf);
+ ret = ops->get_rxnfc(dev, &info, NULL);
if (ret < 0)
- goto err_out;
-
- ret = ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, rule_buf);
-err_out:
- kfree(rule_buf);
+ return ret;
- return ret;
+ return ethtool_rxnfc_copy_to_user(useraddr, &info, info_size, NULL);
}
static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
@@ -1175,18 +1140,6 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
return -EINVAL;
}
- if (cmd == ETHTOOL_SRXFH && ops->get_rxfh) {
- struct ethtool_rxfh_param rxfh = {};
-
- rc = ops->get_rxfh(dev, &rxfh);
- if (rc)
- return rc;
-
- rc = ethtool_check_xfrm_rxfh(rxfh.input_xfrm, info.data);
- if (rc)
- return rc;
- }
-
rc = ops->set_rxnfc(dev, &info);
if (rc)
return rc;