From: Tariq Toukan <tariqt@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: <netdev@vger.kernel.org>, Saeed Mahameed <saeedm@nvidia.com>,
Gal Pressman <gal@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>, <cjubran@nvidia.com>,
<cratiu@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>
Subject: [PATCH net-next 03/15] net/mlx5: Add parent group support in rate group structure
Date: Sun, 13 Oct 2024 09:45:28 +0300 [thread overview]
Message-ID: <20241013064540.170722-4-tariqt@nvidia.com> (raw)
In-Reply-To: <20241013064540.170722-1-tariqt@nvidia.com>
From: Carolina Jubran <cjubran@nvidia.com>
Introduce a `parent` field in the `mlx5_esw_rate_group` structure to
support hierarchical group relationships.
The `parent` can reference another group or be set to `NULL`,
indicating the group is connected to the root TSAR.
This change enables the ability to manage groups in a hierarchical
structure for future enhancements.
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/esw/qos.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
index b2b60b0b6506..e9ddd7f4ac80 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c
@@ -72,6 +72,8 @@ struct mlx5_esw_rate_group {
u32 min_rate;
/* A computed value indicating relative min_rate between group members. */
u32 bw_share;
+ /* The parent group of this group. */
+ struct mlx5_esw_rate_group *parent;
/* Membership in the parent list. */
struct list_head parent_entry;
/* The type of this group node in the rate hierarchy. */
@@ -505,7 +507,8 @@ static int esw_qos_vport_update_group(struct mlx5_vport *vport,
}
static struct mlx5_esw_rate_group *
-__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type)
+__esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_node_type type,
+ struct mlx5_esw_rate_group *parent)
{
struct mlx5_esw_rate_group *group;
@@ -516,6 +519,7 @@ __esw_qos_alloc_rate_group(struct mlx5_eswitch *esw, u32 tsar_ix, enum sched_nod
group->esw = esw;
group->tsar_ix = tsar_ix;
group->type = type;
+ group->parent = parent;
INIT_LIST_HEAD(&group->members);
list_add_tail(&group->parent_entry, &esw->qos.domain->groups);
return group;
@@ -528,7 +532,8 @@ static void __esw_qos_free_rate_group(struct mlx5_esw_rate_group *group)
}
static struct mlx5_esw_rate_group *
-__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *extack)
+__esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct mlx5_esw_rate_group *parent,
+ struct netlink_ext_ack *extack)
{
struct mlx5_esw_rate_group *group;
u32 tsar_ix, err;
@@ -539,7 +544,7 @@ __esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_
return ERR_PTR(err);
}
- group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR);
+ group = __esw_qos_alloc_rate_group(esw, tsar_ix, SCHED_NODE_TYPE_VPORTS_TSAR, parent);
if (!group) {
NL_SET_ERR_MSG_MOD(extack, "E-Switch alloc group failed");
err = -ENOMEM;
@@ -582,7 +587,7 @@ esw_qos_create_vports_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ac
if (err)
return ERR_PTR(err);
- group = __esw_qos_create_vports_rate_group(esw, extack);
+ group = __esw_qos_create_vports_rate_group(esw, NULL, extack);
if (IS_ERR(group))
esw_qos_put(esw);
@@ -627,13 +632,13 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta
}
if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) {
- esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, extack);
+ esw->qos.group0 = __esw_qos_create_vports_rate_group(esw, NULL, extack);
} else {
/* The eswitch doesn't support scheduling groups.
* Create a software-only group0 using the root TSAR to attach vport QoS to.
*/
if (!__esw_qos_alloc_rate_group(esw, esw->qos.root_tsar_ix,
- SCHED_NODE_TYPE_VPORTS_TSAR))
+ SCHED_NODE_TYPE_VPORTS_TSAR, NULL))
esw->qos.group0 = ERR_PTR(-ENOMEM);
}
if (IS_ERR(esw->qos.group0)) {
--
2.44.0
next prev parent reply other threads:[~2024-10-13 6:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-13 6:45 [PATCH net-next 00/15] net/mlx5: Refactor esw QoS to support generalized operations Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 01/15] net/mlx5: Refactor QoS group scheduling element creation Tariq Toukan
2024-10-14 8:54 ` Daniel Machon
2024-10-14 20:34 ` Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 02/15] net/mlx5: Introduce node type to rate group structure Tariq Toukan
2024-10-13 6:45 ` Tariq Toukan [this message]
2024-10-13 6:45 ` [PATCH net-next 04/15] net/mlx5: Restrict domain list insertion to root TSAR ancestors Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 05/15] net/mlx5: Rename vport QoS group reference to parent Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 06/15] net/mlx5: Introduce node struct and rename group terminology to node Tariq Toukan
2024-10-14 9:17 ` Simon Horman
2024-10-14 20:44 ` Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 07/15] net/mlx5: Refactor vport scheduling element creation function Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 08/15] net/mlx5: Refactor vport QoS to use scheduling node structure Tariq Toukan
2024-10-14 9:33 ` Simon Horman
2024-10-14 20:47 ` Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 09/15] net/mlx5: Remove vport QoS enabled flag Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 10/15] net/mlx5: Simplify QoS scheduling element configuration Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 11/15] net/mlx5: Generalize QoS operations for nodes and vports Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 12/15] net/mlx5: Add sync reset drop mode support Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 13/15] net/mlx5: Only create VEPA flow table when in VEPA mode Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 14/15] net/mlx5: fs, rename packet reformat struct member action Tariq Toukan
2024-10-13 6:45 ` [PATCH net-next 15/15] net/mlx5: fs, rename modify header " Tariq Toukan
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=20241013064540.170722-4-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.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).