diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ethtool/ioctl.c | 27 | ||||
-rw-r--r-- | net/ethtool/rss.c | 9 |
2 files changed, 13 insertions, 23 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 5f49a105fc73..86e5fc64b711 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1201,7 +1201,7 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev, if (rxfh.rsvd8[0] || rxfh.rsvd8[1] || rxfh.rsvd8[2] || rxfh.rsvd32) return -EINVAL; /* Most drivers don't handle rss_context, check it's 0 as well */ - if (rxfh.rss_context && !ops->get_rxfh_context) + if (rxfh.rss_context && !ops->cap_rss_ctx_supported) return -EOPNOTSUPP; rxfh.indir_size = rxfh_dev.indir_size; @@ -1225,11 +1225,9 @@ static noinline_for_stack int ethtool_get_rxfh(struct net_device *dev, if (user_key_size) rxfh_dev.key = rss_config + indir_bytes; - if (rxfh.rss_context) - ret = dev->ethtool_ops->get_rxfh_context(dev, &rxfh_dev, - rxfh.rss_context); - else - ret = dev->ethtool_ops->get_rxfh(dev, &rxfh_dev); + rxfh_dev.rss_context = rxfh.rss_context; + + ret = dev->ethtool_ops->get_rxfh(dev, &rxfh_dev); if (ret) goto out; @@ -1257,7 +1255,6 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, struct netlink_ext_ack *extack = NULL; struct ethtool_rxnfc rx_rings; struct ethtool_rxfh rxfh; - bool delete = false; u32 indir_bytes = 0; u8 *rss_config; int ret; @@ -1277,7 +1274,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, if (rxfh.rsvd8[0] || rxfh.rsvd8[1] || rxfh.rsvd8[2] || rxfh.rsvd32) return -EINVAL; /* Most drivers don't handle rss_context, check it's 0 as well */ - if (rxfh.rss_context && !ops->set_rxfh_context) + if (rxfh.rss_context && !ops->cap_rss_ctx_supported) return -EOPNOTSUPP; /* If either indir, hash key or function is valid, proceed further. @@ -1327,7 +1324,7 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, for (i = 0; i < dev_indir_size; i++) indir[i] = ethtool_rxfh_indir_default(i, rx_rings.data); } else { - delete = true; + rxfh_dev.rss_delete = true; } } @@ -1343,21 +1340,17 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev, } rxfh_dev.hfunc = rxfh.hfunc; + rxfh_dev.rss_context = rxfh.rss_context; - if (rxfh.rss_context) - ret = ops->set_rxfh_context(dev, &rxfh_dev, - &rxfh.rss_context, delete); - else - ret = ops->set_rxfh(dev, &rxfh_dev, extack); - + ret = ops->set_rxfh(dev, &rxfh_dev, extack); if (ret) goto out; if (copy_to_user(useraddr + offsetof(struct ethtool_rxfh, rss_context), - &rxfh.rss_context, sizeof(rxfh.rss_context))) + &rxfh_dev.rss_context, sizeof(rxfh_dev.rss_context))) ret = -EFAULT; - if (!rxfh.rss_context) { + if (!rxfh_dev.rss_context) { /* indicate whether rxfh was set to default */ if (rxfh.indir_size == 0) dev->priv_flags &= ~IFF_RXFH_CONFIGURED; diff --git a/net/ethtool/rss.c b/net/ethtool/rss.c index 56fae7d5c0f7..efc9f4409e40 100644 --- a/net/ethtool/rss.c +++ b/net/ethtool/rss.c @@ -59,7 +59,7 @@ rss_prepare_data(const struct ethnl_req_info *req_base, return -EOPNOTSUPP; /* Some drivers don't handle rss_context */ - if (request->rss_context && !ops->get_rxfh_context) + if (request->rss_context && !ops->cap_rss_ctx_supported) return -EOPNOTSUPP; ret = ethnl_ops_begin(dev); @@ -90,12 +90,9 @@ rss_prepare_data(const struct ethnl_req_info *req_base, rxfh.indir = data->indir_table; rxfh.key_size = data->hkey_size; rxfh.key = data->hkey; + rxfh.rss_context = request->rss_context; - if (request->rss_context) - ret = ops->get_rxfh_context(dev, &rxfh, request->rss_context); - else - ret = ops->get_rxfh(dev, &rxfh); - + ret = ops->get_rxfh(dev, &rxfh); if (ret) goto out_ops; |