netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] enic: add ethtool get_channel support
@ 2024-06-26  0:53 Jon Kohler
  2024-06-27  2:10 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Kohler @ 2024-06-26  0:53 UTC (permalink / raw)
  To: Christian Benvenuti, Satish Kharat, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: Jon Kohler

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.

Signed-off-by: Jon Kohler <jon@nutanix.com>
---
v1
- https://lore.kernel.org/netdev/20240618160146.3900470-1-jon@nutanix.com/T/
v1 -> v2:
- https://lore.kernel.org/netdev/20240624184900.3998084-1-jon@nutanix.com/T/
- Addressed comments from Przemek and Jakub
- Reviewed-by tag for Sai Krishna
v2 -> v3:
- Addressed comment from Jakub to combine MSI and INTX cases
---
 .../net/ethernet/cisco/enic/enic_ethtool.c    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index 241906697019..b4825f2ceed7 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -608,6 +608,27 @@ 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;
+	default:
+		break;
+	}
+}
+
 static const struct ethtool_ops enic_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_USE_ADAPTIVE_RX |
@@ -632,6 +653,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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] enic: add ethtool get_channel support
  2024-06-26  0:53 [PATCH net-next v3] enic: add ethtool get_channel support Jon Kohler
@ 2024-06-27  2:10 ` Jakub Kicinski
  2024-06-27 20:10   ` Jon Kohler
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-06-27  2:10 UTC (permalink / raw)
  To: Jon Kohler
  Cc: Christian Benvenuti, Satish Kharat, David S. Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On Tue, 25 Jun 2024 17:53:38 -0700 Jon Kohler wrote:
> +		channels->combined_count = 1;

clang complains about the lack of break or fallthrough here,
as annoying and pointless of a warning as it is :(

drivers/net/ethernet/cisco/enic/enic_ethtool.c:627:2: note: insert 'break;' to avoid fall-through
  627 |         default:
      |         ^
      |         break; 

> +	default:
> +		break;
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] enic: add ethtool get_channel support
  2024-06-27  2:10 ` Jakub Kicinski
@ 2024-06-27 20:10   ` Jon Kohler
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Kohler @ 2024-06-27 20:10 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Christian Benvenuti, Satish Kharat, David S. Miller, Eric Dumazet,
	Paolo Abeni, netdev@vger.kernel.org, linux-kernel@vger.kernel.org



> On Jun 26, 2024, at 10:10 PM, Jakub Kicinski <kuba@kernel.org> wrote:
> 
> On Tue, 25 Jun 2024 17:53:38 -0700 Jon Kohler wrote:
>> + channels->combined_count = 1;
> 
> clang complains about the lack of break or fallthrough here,
> as annoying and pointless of a warning as it is :(

Ah, right - fixed in v4 just now

> 
> drivers/net/ethernet/cisco/enic/enic_ethtool.c:627:2: note: insert 'break;' to avoid fall-through
>  627 |         default:
>      |         ^
>      |         break; 
> 
>> + default:
>> + break;
> -- 
> pw-bot: cr


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-27 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26  0:53 [PATCH net-next v3] enic: add ethtool get_channel support Jon Kohler
2024-06-27  2:10 ` Jakub Kicinski
2024-06-27 20:10   ` Jon Kohler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).