Skip to content

Commit ffcdd11

Browse files
teadavem330
authored andcommitted
vmxnet3: Implement ethtool's get_channels command
Some tools (e.g. libxdp) use that information. Signed-off-by: Andrey Turkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 50ad649 commit ffcdd11

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

drivers/net/vmxnet3/vmxnet3_ethtool.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,34 @@ static int vmxnet3_set_coalesce(struct net_device *netdev,
12921292
return 0;
12931293
}
12941294

1295+
static void vmxnet3_get_channels(struct net_device *netdev,
1296+
struct ethtool_channels *ec)
1297+
{
1298+
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1299+
1300+
if (IS_ENABLED(CONFIG_PCI_MSI) && adapter->intr.type == VMXNET3_IT_MSIX) {
1301+
if (adapter->share_intr == VMXNET3_INTR_BUDDYSHARE) {
1302+
ec->combined_count = adapter->num_tx_queues;
1303+
} else {
1304+
ec->rx_count = adapter->num_rx_queues;
1305+
ec->tx_count =
1306+
adapter->share_intr == VMXNET3_INTR_TXSHARE ?
1307+
1 : adapter->num_tx_queues;
1308+
}
1309+
} else {
1310+
ec->combined_count = 1;
1311+
}
1312+
1313+
ec->other_count = 1;
1314+
1315+
/* Number of interrupts cannot be changed on the fly */
1316+
/* Just set maximums to actual values */
1317+
ec->max_rx = ec->rx_count;
1318+
ec->max_tx = ec->tx_count;
1319+
ec->max_combined = ec->combined_count;
1320+
ec->max_other = ec->other_count;
1321+
}
1322+
12951323
static const struct ethtool_ops vmxnet3_ethtool_ops = {
12961324
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS |
12971325
ETHTOOL_COALESCE_MAX_FRAMES |
@@ -1317,6 +1345,7 @@ static const struct ethtool_ops vmxnet3_ethtool_ops = {
13171345
.set_rxfh = vmxnet3_set_rss,
13181346
#endif
13191347
.get_link_ksettings = vmxnet3_get_link_ksettings,
1348+
.get_channels = vmxnet3_get_channels,
13201349
};
13211350

13221351
void vmxnet3_set_ethtool_ops(struct net_device *netdev)

0 commit comments

Comments
 (0)