diff options
author | Mina Almasry <almasrymina@google.com> | 2024-08-08 23:53:45 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-10 07:52:13 +0300 |
commit | 916b7d31f7eef81fe20f86ef52c36938fa971872 (patch) | |
tree | 0454e847e1fdc1d3e1decf55b930a28e166be920 /net/ethtool/common.h | |
parent | 600a91931057bfec0afd665759c5574ed137cbea (diff) | |
download | linux-916b7d31f7eef81fe20f86ef52c36938fa971872.tar.xz |
ethtool: refactor checking max channels
Currently ethtool_set_channel calls separate functions to check whether
the new channel number violates rss configuration or flow steering
configuration.
Very soon we need to check whether the new channel number violates
memory provider configuration as well.
To do all 3 checks cleanly, add a wrapper around
ethtool_get_max_rxnfc_channel() and ethtool_get_max_rxfh_channel(),
which does both checks. We can later extend this wrapper to add the
memory provider check in one place.
Note that in the current code, we put a descriptive genl error message
when we run into issues. To preserve the error message, we pass the
genl_info* to the common helper. The ioctl calls can pass NULL instead.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20240808205345.2141858-1-almasrymina@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ethtool/common.h')
-rw-r--r-- | net/ethtool/common.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ethtool/common.h b/net/ethtool/common.h index 863806fcf01a..d55d5201b085 100644 --- a/net/ethtool/common.h +++ b/net/ethtool/common.h @@ -20,6 +20,8 @@ struct link_mode_info { u8 duplex; }; +struct genl_info; + extern const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]; extern const char @@ -42,8 +44,9 @@ int __ethtool_get_link(struct net_device *dev); bool convert_legacy_settings_to_link_ksettings( struct ethtool_link_ksettings *link_ksettings, const struct ethtool_cmd *legacy_settings); -u32 ethtool_get_max_rxfh_channel(struct net_device *dev); -int ethtool_get_max_rxnfc_channel(struct net_device *dev, u64 *max); +int ethtool_check_max_channel(struct net_device *dev, + struct ethtool_channels channels, + struct genl_info *info); int __ethtool_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info); extern const struct ethtool_phy_ops *ethtool_phy_ops; |