All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Tariq Toukan <tariqt@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	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
Subject: Re: [PATCH net-next 08/15] net/mlx5: Refactor vport QoS to use scheduling node structure
Date: Mon, 14 Oct 2024 10:33:37 +0100	[thread overview]
Message-ID: <20241014093337.GR77519@kernel.org> (raw)
In-Reply-To: <20241013064540.170722-9-tariqt@nvidia.com>

On Sun, Oct 13, 2024 at 09:45:33AM +0300, Tariq Toukan wrote:
> From: Carolina Jubran <cjubran@nvidia.com>
> 
> Refactor the vport QoS structure by moving group membership and
> scheduling details into the `mlx5_esw_sched_node` structure.
> 
> This change consolidates the vport into the rate hierarchy by unifying
> the handling of different types of scheduling element nodes.
> 
> In addition, add a direct reference to the mlx5_vport within the
> mlx5_esw_sched_node structure, to ensure that the vport is easily
> accessible when a scheduling node is associated with a vport.
> 
> Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Hi Carolina and Tariq,

Some minor feedback from my side.

...

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

...

> +struct mlx5_esw_sched_node *
> +mlx5_esw_qos_vport_get_parent(const struct mlx5_vport *vport)
>  {
> -	list_del_init(&vport->qos.parent_entry);
> -	vport->qos.parent = parent;
> -	list_add_tail(&vport->qos.parent_entry, &parent->children);
> +	if (!vport->qos.sched_node)
> +		return 0;

As the return type of this function is a pointer,
perhaps returning NULL would be more appropriate.

...

> @@ -718,18 +750,26 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport,
>  		return err;
>  
>  	err = esw_qos_vport_create_sched_element(vport, esw->qos.node0, max_rate, bw_share,
> -						 &vport->qos.esw_sched_elem_ix);
> +						 &sched_elem_ix);
>  	if (err)
>  		goto err_out;
>  
> -	INIT_LIST_HEAD(&vport->qos.parent_entry);
> -	esw_qos_vport_set_parent(vport, esw->qos.node0);
> +	vport->qos.sched_node = __esw_qos_alloc_rate_node(esw, sched_elem_ix, SCHED_NODE_TYPE_VPORT,
> +							  esw->qos.node0);
> +	if (!vport->qos.sched_node)

Should err be set to a negative error value here so that value will be
returned?

> +		goto err_alloc;
>  
>  	vport->qos.enabled = true;
> +	vport->qos.sched_node->vport = vport;
> +
>  	trace_mlx5_esw_vport_qos_create(vport->dev, vport, bw_share, max_rate);
>  
>  	return 0;
>  
> +err_alloc:
> +	if (mlx5_destroy_scheduling_element_cmd(esw->dev,
> +						SCHEDULING_HIERARCHY_E_SWITCH, sched_elem_ix))
> +		esw_warn(esw->dev, "E-Switch destroy vport scheduling element failed.\n");
>  err_out:
>  	esw_qos_put(esw);
>  

...

> @@ -746,20 +787,23 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport)
>  	esw_qos_lock(esw);
>  	if (!vport->qos.enabled)
>  		goto unlock;
> -	WARN(vport->qos.parent != esw->qos.node0,
> +	vport_node = vport->qos.sched_node;
> +	WARN(vport_node->parent != esw->qos.node0,
>  	     "Disabling QoS on port before detaching it from node");
>  
> -	dev = vport->qos.parent->esw->dev;
> +	trace_mlx5_esw_vport_qos_destroy(dev, vport);

dev does not appear to be initialised here.

> +
> +	dev = vport_node->esw->dev;
>  	err = mlx5_destroy_scheduling_element_cmd(dev,
>  						  SCHEDULING_HIERARCHY_E_SWITCH,
> -						  vport->qos.esw_sched_elem_ix);
> +						  vport_node->ix);
>  	if (err)
>  		esw_warn(dev,
>  			 "E-Switch destroy vport scheduling element failed (vport=%d,err=%d)\n",
>  			 vport->vport, err);
>  
> +	__esw_qos_free_node(vport_node);
>  	memset(&vport->qos, 0, sizeof(vport->qos));
> -	trace_mlx5_esw_vport_qos_destroy(dev, vport);
>  
>  	esw_qos_put(esw);
>  unlock:

...

  reply	other threads:[~2024-10-14  9:33 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 ` [PATCH net-next 03/15] net/mlx5: Add parent group support in " Tariq Toukan
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 [this message]
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=20241014093337.GR77519@kernel.org \
    --to=horms@kernel.org \
    --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 \
    --cc=tariqt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.