enic: add ethtool get_channel support
Subsystems (3)
PATCH v3 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:
- Addressed comment from Jakub to combine MSI and INTX cases
--- .../net/ethernet/cisco/enic/enic_ethtool.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/net/ethernet/cisco/enic/enic_ethtool.c +22 -0
@@ -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)
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerdrivers/net/ethernet/cisco/enic/enic_ethtool.c static int enic_get_ts_info(struct net_device *netdev, · line 626
Quoted 1 line · On Tue, 25 Jun 2024 17:53:38 -0700 Jon Kohler wrote:
drivers/net/ethernet/cisco/enic/enic_ethtool.c +1
-0+ 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; Quoted 2 lines
drivers/net/ethernet/cisco/enic/enic_ethtool.c +2
-0+default : +break ;
Signature · 1 line
pw-bot: cr
Quoted 9 lines · Jakub Kicinski
Quoted 1 line · 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
Quoted 10 lines
drivers/net/ethernet/cisco/enic/enic_ethtool.c:627:2: note: insert 'break;' to avoid fall-through627 | default: | ^ | break;Quoted 2 lines
+ default:
+ break;Signature · 1 line
pw-bot: cr