[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240213072724.77275-6-michal.swiatkowski@linux.intel.com>
Date: Tue, 13 Feb 2024 08:27:14 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: intel-wired-lan@...ts.osuosl.org
Cc: netdev@...r.kernel.org,
jacob.e.keller@...el.com,
michal.kubiak@...el.com,
maciej.fijalkowski@...el.com,
sridhar.samudrala@...el.com,
przemyslaw.kitszel@...el.com,
wojciech.drewek@...el.com,
pio.raczynski@...il.com,
Pawel Chmielewski <pawel.chmielewski@...el.com>,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Subject: [iwl-next v1 05/15] ice: add subfunctions ethtool ops
From: Pawel Chmielewski <pawel.chmielewski@...el.com>
Add only limited number of ethtools ops. Also, stats set for a
subfunction is different than a regular netdev since there are
not port stats, show only related VSI statistics.
Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@...el.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 36 ++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_sf_eth.c | 1 +
2 files changed, 37 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 3cc364a4d682..c862b21bad9f 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1564,6 +1564,22 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)
return ret;
}
+/**
+ * ice_get_sf_sset_count - get number of stats to display for specified netdev
+ * of subfunction flavor
+ * @netdev: network interface device structure
+ * @sset: set of statistics to display
+ */
+static int ice_get_sf_sset_count(struct net_device *netdev, int sset)
+{
+ switch (sset) {
+ case ETH_SS_STATS:
+ return ICE_VSI_STATS_LEN + ice_q_stats_len(netdev);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
static int ice_get_sset_count(struct net_device *netdev, int sset)
{
switch (sset) {
@@ -4290,6 +4306,17 @@ static const struct ethtool_ops ice_ethtool_safe_mode_ops = {
.get_channels = ice_get_channels,
};
+static const struct ethtool_ops ice_sf_ethtool_ops = {
+ .get_drvinfo = ice_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_strings = ice_get_strings,
+ .get_ethtool_stats = ice_get_ethtool_stats,
+ .get_sset_count = ice_get_sf_sset_count,
+ .get_ringparam = ice_get_ringparam,
+ .set_ringparam = ice_set_ringparam,
+ .get_channels = ice_get_channels,
+};
+
/**
* ice_set_ethtool_safe_mode_ops - setup safe mode ethtool ops
* @netdev: network interface device structure
@@ -4326,3 +4353,12 @@ void ice_set_ethtool_ops(struct net_device *netdev)
{
netdev->ethtool_ops = &ice_ethtool_ops;
}
+
+/**
+ * ice_set_ethtool_sf_ops - setup subfunction ethtool ops
+ * @netdev: network interface device structure
+ */
+void ice_set_ethtool_sf_ops(struct net_device *netdev)
+{
+ netdev->ethtool_ops = &ice_sf_ethtool_ops;
+}
diff --git a/drivers/net/ethernet/intel/ice/ice_sf_eth.c b/drivers/net/ethernet/intel/ice/ice_sf_eth.c
index f569f176f29f..f45ac76f0f43 100644
--- a/drivers/net/ethernet/intel/ice/ice_sf_eth.c
+++ b/drivers/net/ethernet/intel/ice/ice_sf_eth.c
@@ -55,6 +55,7 @@ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port)
eth_hw_addr_set(netdev, dyn_port->hw_addr);
ether_addr_copy(netdev->perm_addr, dyn_port->hw_addr);
netdev->netdev_ops = &ice_sf_netdev_ops;
+ ice_set_ethtool_sf_ops(netdev);
SET_NETDEV_DEVLINK_PORT(netdev, &dyn_port->devlink_port);
err = register_netdev(netdev);
--
2.42.0
Powered by blists - more mailing lists