Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	maciej.fijalkowski@intel.com, sridhar.samudrala@intel.com,
	netdev@vger.kernel.org,
	Pawel Chmielewski <pawel.chmielewski@intel.com>,
	michal.kubiak@intel.com, pio.raczynski@gmail.com,
	przemyslaw.kitszel@intel.com, jacob.e.keller@intel.com,
	wojciech.drewek@intel.com
Subject: [Intel-wired-lan] [iwl-next v1 05/15] ice: add subfunctions ethtool ops
Date: Tue, 13 Feb 2024 08:27:14 +0100	[thread overview]
Message-ID: <20240213072724.77275-6-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20240213072724.77275-1-michal.swiatkowski@linux.intel.com>

From: Pawel Chmielewski <pawel.chmielewski@intel.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@intel.com>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.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


  parent reply	other threads:[~2024-02-13  7:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  7:27 [Intel-wired-lan] [iwl-next v1 00/15] ice: support devlink subfunctions Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 01/15] ice: move devlink port code to a separate file Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 02/15] ice: add new VSI type for subfunctions Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 03/15] ice: export ice ndo_ops functions Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 04/15] ice: add basic devlink subfunctions support Michal Swiatkowski
2024-02-13  8:55   ` Jiri Pirko
2024-02-13  9:39     ` Michal Swiatkowski
2024-02-13 11:27       ` Jiri Pirko
2024-02-13 12:02         ` Michal Swiatkowski
2024-02-13 14:57           ` Jiri Pirko
2024-02-14  6:26             ` Michal Swiatkowski
2024-02-14 19:45     ` Jacob Keller
2024-02-13  7:27 ` Michal Swiatkowski [this message]
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 06/15] ice: add subfunction aux driver support Michal Swiatkowski
2024-02-13  8:57   ` Jiri Pirko
2024-02-13  9:43     ` Michal Swiatkowski
2024-02-13 11:28       ` Jiri Pirko
2024-02-13 12:03         ` Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 07/15] ice: add auxiliary device sfnum attribute Michal Swiatkowski
2024-02-13  8:59   ` Jiri Pirko
2024-02-13  9:53     ` Michal Swiatkowski
2024-02-13 11:29       ` Jiri Pirko
2024-02-13 11:55         ` Michal Swiatkowski
2024-02-13 22:04           ` Jacob Keller
2024-02-14  8:45             ` Jiri Pirko
2024-02-14 19:41               ` Keller, Jacob E
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 08/15] ice: store SF data in VSI struct Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 09/15] ice: store representor ID in bridge port Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 10/15] ice: create port representor for SF Michal Swiatkowski
2024-02-13  9:00   ` Jiri Pirko
2024-02-13  9:55     ` Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 11/15] ice: check if SF is ready in ethtool ops Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 12/15] ice: netdevice ops for SF representor Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 13/15] ice: support subfunction devlink Tx topology Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 14/15] ice: basic support for VLAN in subfunctions Michal Swiatkowski
2024-02-13  7:27 ` [Intel-wired-lan] [iwl-next v1 15/15] ice: move ice_devlink.[ch] to devlink folder Michal Swiatkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240213072724.77275-6-michal.swiatkowski@linux.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pawel.chmielewski@intel.com \
    --cc=pio.raczynski@gmail.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=wojciech.drewek@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox