Skip to contentSkip to conversation

enic: add ethtool get_channel support

PATCH Applied Jon Kohler 2 participants 2 messages Jun 27, 2024 – Jun 29, 2024

Subsystems (3)
lore
Share & tools
lore

Jon Kohler

author
#0 lore raw

PATCH v4 1/1 enic: add ethtool get_channel support

Add .get_channel to enic_ethtool_ops to enable basic ethtool -l support to get the current channel configuration.

Note that the driver does not support dynamically changing queue configuration, so .set_channel is intentionally unused. Instead, users should use Cisco's hardware management tools (UCSM/IMC) to modify virtual interface card configuration out of band.

---
v1
- https://lore.kernel.org/netdev/[email protected]/T/
v1 -> v2:
- https://lore.kernel.org/netdev/[email protected]/T/
- Addressed comments from Przemek and Jakub
- Reviewed-by tag for Sai Krishna
v2 -> v3:
- https://lore.kernel.org/netdev/[email protected]/T/#m17016f5f4cde7ed145393773fd8c7a0850860fae
- Addressed comment from Jakub to combine MSI and INTX cases
v3 -> v4:
- Added missing break

---
 .../net/ethernet/cisco/enic/enic_ethtool.c    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/net/ethernet/cisco/enic/enic_ethtool.c +23 -0
index 241906697019..a42f3f280f3e 100644
@@ -608,6 +608,28 @@ static int enic_get_ts_info(struct net_device *netdev,
 	return 0;
 }
 
+static void enic_get_channels(struct net_device *netdev,
+			      struct ethtool_channels *channels)
+{
+	struct enic *enic = netdev_priv(netdev);
+
+	switch (vnic_dev_get_intr_mode(enic->vdev)) {
+	case VNIC_DEV_INTR_MODE_MSIX:
+		channels->max_rx = ENIC_RQ_MAX;
+		channels->max_tx = ENIC_WQ_MAX;
+		channels->rx_count = enic->rq_count;
+		channels->tx_count = enic->wq_count;
+		break;
+	case VNIC_DEV_INTR_MODE_MSI:
+	case VNIC_DEV_INTR_MODE_INTX:
+		channels->max_combined = 1;
+		channels->combined_count = 1;
+		break;
+	default:
+		break;
+	}
+}
+
 static const struct ethtool_ops enic_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE_RX |
@@ -632,6 +654,7 @@ static const struct ethtool_ops enic_ethtool_ops = {
 	.set_rxfh = enic_set_rxfh,
 	.get_link_ksettings = enic_get_ksettings,
 	.get_ts_info = enic_get_ts_info,
+	.get_channels = enic_get_channels,
 };
 
 void enic_set_ethtool_ops(struct net_device *netdev)
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 27 Jun 2024 13:20:13 -0700 you wrote:

Add .get_channel to enic_ethtool_ops to enable basic ethtool -l support to get the current channel configuration.

Note that the driver does not support dynamically changing queue configuration, so .set_channel is intentionally unused. Instead, users should use Cisco's hardware management tools (UCSM/IMC) to modify virtual interface card configuration out of band.

[...]

Here is the summary with links:
- [net-next,v4] enic: add ethtool get_channel support

    https://git.kernel.org/netdev/net-next/c/bf7bb7b43097

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html