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, 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 13/15] ice: support subfunction devlink Tx topology
Date: Tue, 13 Feb 2024 08:27:22 +0100 [thread overview]
Message-ID: <20240213072724.77275-14-michal.swiatkowski@linux.intel.com> (raw)
In-Reply-To: <20240213072724.77275-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/ice_devlink.c | 14 ++++++++++++--
drivers/net/ethernet/intel/ice/ice_repr.c | 14 +++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
index 6278ff3eb7c9..503e175140ad 100644
--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
@@ -595,6 +595,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;
@@ -606,6 +607,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)
@@ -614,6 +616,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,
@@ -645,10 +657,8 @@ int ice_devlink_rate_init_tx_topology(struct devlink *devlink, struct ice_vsi *v
tc_node = pi->root->children[0];
mutex_lock(&pi->sched_lock);
- devl_lock(devlink);
for (i = 0; i < tc_node->num_children; i++)
ice_traverse_tx_tree(devlink, tc_node->children[i], tc_node, pf);
- devl_unlock(devlink);
mutex_unlock(&pi->sched_lock);
return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_repr.c b/drivers/net/ethernet/intel/ice/ice_repr.c
index 125bcf2e4c00..fb0171afa43e 100644
--- a/drivers/net/ethernet/intel/ice/ice_repr.c
+++ b/drivers/net/ethernet/intel/ice/ice_repr.c
@@ -380,19 +380,17 @@ static void ice_repr_rem_vf(struct ice_repr *repr)
static void ice_repr_rem_sf(struct ice_repr *repr)
{
+ devl_rate_leaf_destroy(&repr->sf->devlink_port);
unregister_netdev(repr->netdev);
}
-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));
}
@@ -444,6 +442,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);
@@ -456,7 +455,9 @@ static int ice_repr_add_vf(struct ice_repr *repr)
goto err_netdev;
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;
@@ -493,6 +494,9 @@ static int ice_repr_add_sf(struct ice_repr *repr)
struct ice_dynamic_port *sf = repr->sf;
SET_NETDEV_DEVLINK_PORT(repr->netdev, &sf->devlink_port);
+
+ ice_repr_set_tx_topology(sf->vsi->back, priv_to_devlink(sf->vsi->back));
+
return ice_repr_reg_netdev(repr->netdev, &ice_repr_sf_netdev_ops);
}
--
2.42.0
next prev 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 ` [Intel-wired-lan] [iwl-next v1 05/15] ice: add subfunctions ethtool ops Michal Swiatkowski
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 ` Michal Swiatkowski [this message]
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-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=maciej.fijalkowski@intel.com \
--cc=michal.kubiak@intel.com \
--cc=netdev@vger.kernel.org \
--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