Commit 34829eec authored by Maciej Fijalkowski's avatar Maciej Fijalkowski Committed by Alexei Starovoitov

veth: Implement ethtool's get_channels() callback

Libbpf's xsk part calls get_channels() API to retrieve the queue count
of the underlying driver so that XSKMAP is sized accordingly.

Implement that in veth so multi queue scenarios can work properly.
Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210329224316.17793-14-maciej.fijalkowski@intel.com
parent 0464b1ed
...@@ -218,6 +218,17 @@ static void veth_get_ethtool_stats(struct net_device *dev, ...@@ -218,6 +218,17 @@ static void veth_get_ethtool_stats(struct net_device *dev,
} }
} }
static void veth_get_channels(struct net_device *dev,
struct ethtool_channels *channels)
{
channels->tx_count = dev->real_num_tx_queues;
channels->rx_count = dev->real_num_rx_queues;
channels->max_tx = dev->real_num_tx_queues;
channels->max_rx = dev->real_num_rx_queues;
channels->combined_count = min(dev->real_num_rx_queues, dev->real_num_tx_queues);
channels->max_combined = min(dev->real_num_rx_queues, dev->real_num_tx_queues);
}
static const struct ethtool_ops veth_ethtool_ops = { static const struct ethtool_ops veth_ethtool_ops = {
.get_drvinfo = veth_get_drvinfo, .get_drvinfo = veth_get_drvinfo,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
...@@ -226,6 +237,7 @@ static const struct ethtool_ops veth_ethtool_ops = { ...@@ -226,6 +237,7 @@ static const struct ethtool_ops veth_ethtool_ops = {
.get_ethtool_stats = veth_get_ethtool_stats, .get_ethtool_stats = veth_get_ethtool_stats,
.get_link_ksettings = veth_get_link_ksettings, .get_link_ksettings = veth_get_link_ksettings,
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.get_channels = veth_get_channels,
}; };
/* general routines */ /* general routines */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment