mirror of https://github.com/torvalds/linux.git
net: hyperv: convert to use .get_rx_ring_count
Convert the hyperv netvsc driver to use the new .get_rx_ring_count ethtool operation instead of implementing .get_rxnfc solely for handling ETHTOOL_GRXRINGS command. This simplifies the code by replacing the switch statement with a direct return of the queue count. The new callback provides the same functionality in a more direct way, following the ongoing ethtool API modernization. Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20251121-hyperv_gxrings-v1-1-31293104953b@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ec1e48e97f
commit
a8ff4842da
|
|
@ -1624,22 +1624,15 @@ netvsc_get_rxfh_fields(struct net_device *ndev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static u32 netvsc_get_rx_ring_count(struct net_device *dev)
|
||||||
netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
|
|
||||||
u32 *rules)
|
|
||||||
{
|
{
|
||||||
struct net_device_context *ndc = netdev_priv(dev);
|
struct net_device_context *ndc = netdev_priv(dev);
|
||||||
struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
|
struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev);
|
||||||
|
|
||||||
if (!nvdev)
|
if (!nvdev)
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
switch (info->cmd) {
|
|
||||||
case ETHTOOL_GRXRINGS:
|
|
||||||
info->data = nvdev->num_chn;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return -EOPNOTSUPP;
|
return nvdev->num_chn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -1969,7 +1962,7 @@ static const struct ethtool_ops ethtool_ops = {
|
||||||
.get_channels = netvsc_get_channels,
|
.get_channels = netvsc_get_channels,
|
||||||
.set_channels = netvsc_set_channels,
|
.set_channels = netvsc_set_channels,
|
||||||
.get_ts_info = ethtool_op_get_ts_info,
|
.get_ts_info = ethtool_op_get_ts_info,
|
||||||
.get_rxnfc = netvsc_get_rxnfc,
|
.get_rx_ring_count = netvsc_get_rx_ring_count,
|
||||||
.get_rxfh_key_size = netvsc_get_rxfh_key_size,
|
.get_rxfh_key_size = netvsc_get_rxfh_key_size,
|
||||||
.get_rxfh_indir_size = netvsc_rss_indir_size,
|
.get_rxfh_indir_size = netvsc_rss_indir_size,
|
||||||
.get_rxfh = netvsc_get_rxfh,
|
.get_rxfh = netvsc_get_rxfh,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue