netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, jacob.e.keller@intel.com,
	michal.kubiak@intel.com, maciej.fijalkowski@intel.com,
	sridhar.samudrala@intel.com, przemyslaw.kitszel@intel.com,
	wojciech.drewek@intel.com, pio.raczynski@gmail.com,
	jiri@nvidia.com, mateusz.polchlopek@intel.com, shayd@nvidia.com
Subject: [iwl-next v2 13/15] ice: support subfunction devlink Tx topology
Date: Mon, 13 May 2024 10:37:33 +0200	[thread overview]
Message-ID: <20240513083735.54791-14-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20240513083735.54791-1-michal.swiatkowski@linux.intel.com>

Flow for creating Tx topology is the same as for VF port representors,
but the devlink port is stored in different place (sf->devlink_port).

When creating VF devlink lock isn't taken, when creating subfunction it
is. Setting Tx topology function needs to take this lock, check if it
was taken before to not do it twice.

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/devlink/devlink.c     | 12 ++++++++++++
 .../net/ethernet/intel/ice/devlink/devlink_port.c    |  3 ++-
 drivers/net/ethernet/intel/ice/ice_repr.c            | 12 +++++++-----
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index c1fe3726f6c0..22aa19c3c784 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -746,6 +746,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
 				 struct ice_sched_node *tc_node, struct ice_pf *pf)
 {
 	struct devlink_rate *rate_node = NULL;
+	struct ice_dynamic_port *sf;
 	struct ice_vf *vf;
 	int i;
 
@@ -757,6 +758,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
 		/* create root node */
 		rate_node = devl_rate_node_create(devlink, node, node->name, NULL);
 	} else if (node->vsi_handle &&
+		   pf->vsi[node->vsi_handle]->type == ICE_VSI_VF &&
 		   pf->vsi[node->vsi_handle]->vf) {
 		vf = pf->vsi[node->vsi_handle]->vf;
 		if (!vf->devlink_port.devlink_rate)
@@ -765,6 +767,16 @@ static void ice_traverse_tx_tree(struct devlink *devlink, struct ice_sched_node
 			 */
 			devl_rate_leaf_create(&vf->devlink_port, node,
 					      node->parent->rate_node);
+	} else if (node->vsi_handle &&
+		   pf->vsi[node->vsi_handle]->type == ICE_VSI_SF &&
+		   pf->vsi[node->vsi_handle]->sf) {
+		sf = pf->vsi[node->vsi_handle]->sf;
+		if (!sf->devlink_port.devlink_rate)
+			/* leaf nodes doesn't have children
+			 * so we don't set rate_node
+			 */
+			devl_rate_leaf_create(&sf->devlink_port, node,
+					      node->parent->rate_node);
 	} else if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF &&
 		   node->parent->rate_node) {
 		rate_node = devl_rate_node_create(devlink, node, node->name,
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c
index 78b5ec6941b4..5db284ef0f94 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c
@@ -673,7 +673,8 @@ int ice_devlink_create_sf_port(struct ice_dynamic_port *dyn_port)
  */
 void ice_devlink_destroy_sf_port(struct ice_dynamic_port *dyn_port)
 {
-       devl_port_unregister(&dyn_port->devlink_port);
+	devl_rate_leaf_destroy(&dyn_port->devlink_port);
+	devl_port_unregister(&dyn_port->devlink_port);
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c
index 78abfdf5d47b..00d4a9125dfa 100644
--- a/drivers/net/ethernet/intel/ice/ice_repr.c
+++ b/drivers/net/ethernet/intel/ice/ice_repr.c
@@ -347,16 +347,13 @@ static void ice_repr_rem_sf(struct ice_repr *repr)
 	ice_devlink_destroy_sf_port(repr->sf);
 }
 
-static void ice_repr_set_tx_topology(struct ice_pf *pf)
+static void ice_repr_set_tx_topology(struct ice_pf *pf, struct devlink *devlink)
 {
-	struct devlink *devlink;
-
 	/* only export if ADQ and DCB disabled and eswitch enabled*/
 	if (ice_is_adq_active(pf) || ice_is_dcb_active(pf) ||
 	    !ice_is_switchdev_running(pf))
 		return;
 
-	devlink = priv_to_devlink(pf);
 	ice_devlink_rate_init_tx_topology(devlink, ice_get_main_vsi(pf));
 }
 
@@ -408,6 +405,7 @@ static struct ice_repr *ice_repr_create(struct ice_vsi *src_vsi)
 static int ice_repr_add_vf(struct ice_repr *repr)
 {
 	struct ice_vf *vf = repr->vf;
+	struct devlink *devlink;
 	int err;
 
 	err = ice_devlink_create_vf_port(vf);
@@ -424,7 +422,9 @@ static int ice_repr_add_vf(struct ice_repr *repr)
 		goto err_cfg_vsi;
 
 	ice_virtchnl_set_repr_ops(vf);
-	ice_repr_set_tx_topology(vf->pf);
+
+	devlink = priv_to_devlink(vf->pf);
+	ice_repr_set_tx_topology(vf->pf, devlink);
 
 	return 0;
 
@@ -480,6 +480,8 @@ static int ice_repr_add_sf(struct ice_repr *repr)
 	if (err)
 		goto err_netdev;
 
+	ice_repr_set_tx_topology(sf->vsi->back, priv_to_devlink(sf->vsi->back));
+
 	return 0;
 
 err_netdev:
-- 
2.42.0


  parent reply	other threads:[~2024-05-13  8:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13  8:37 [iwl-next v2 00/15] ice: support devlink subfunction Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 01/15] ice: add new VSI type for subfunctions Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 02/15] ice: export ice ndo_ops functions Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 03/15] ice: add basic devlink subfunctions support Michal Swiatkowski
2024-05-13 11:04   ` Jiri Pirko
2024-05-13 11:44     ` Michal Swiatkowski
2024-05-13 21:40       ` Keller, Jacob E
2024-05-14  8:09       ` Jiri Pirko
2024-05-13 16:05   ` Simon Horman
2024-05-14  6:27     ` Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 04/15] ice: treat subfunction VSI the same as PF VSI Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 05/15] ice: allocate devlink for subfunction Michal Swiatkowski
2024-05-13  9:25   ` Kalesh Anakkur Purayil
2024-05-13 10:22     ` [Intel-wired-lan] " Michal Swiatkowski
2024-05-13 12:01       ` Kalesh Anakkur Purayil
2024-05-13 21:37       ` Keller, Jacob E
2024-05-14  6:36         ` Przemek Kitszel
2024-05-13  8:37 ` [iwl-next v2 06/15] ice: base subfunction aux driver Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 07/15] ice: implement netdev for subfunction Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 08/15] ice: make reprresentor code generic Michal Swiatkowski
2024-05-13 16:09   ` Simon Horman
2024-05-14  6:27     ` Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 09/15] ice: create port representor for SF Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 10/15] ice: don't set target VSI for subfunction Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 11/15] ice: check if SF is ready in ethtool ops Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 12/15] ice: implement netdevice ops for SF representor Michal Swiatkowski
2024-05-13  8:37 ` Michal Swiatkowski [this message]
2024-05-13  8:37 ` [iwl-next v2 14/15] ice: basic support for VLAN in subfunctions Michal Swiatkowski
2024-05-13  8:37 ` [iwl-next v2 15/15] ice: allow to activate and deactivate subfunction 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=20240513083735.54791-14-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=jiri@nvidia.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=mateusz.polchlopek@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pio.raczynski@gmail.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shayd@nvidia.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;
as well as URLs for NNTP newsgroup(s).