Commit 6f07cd83 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge branch 'net-mlx5-refactor-esw-qos-to-support-generalized-operations'

Tariq Toukan says:

====================
net/mlx5: Refactor esw QoS to support generalized operations

This patch series from the team to mlx5 core driver consists of one main
QoS part followed by small misc patches.

This main part (patches 1 to 11) by Carolina refactors the QoS handling
to generalize operations on scheduling groups and vports. These changes
are necessary to support new features that will extend group
functionality, introduce new group types, and support deeper
hierarchies.

Additionally, this refactor updates the terminology from "group" to
"node" to better reflect the hardware’s rate hierarchy and its use
of scheduling element nodes.

Simplify group scheduling element creation:
- net/mlx5: Refactor QoS group scheduling element creation

Refactor to support generalized operations for QoS:
- net/mlx5: Introduce node type to rate group structure
- net/mlx5: Add parent group support in rate group structure
- net/mlx5: Restrict domain list insertion to root TSAR ancestors
- net/mlx5: Rename vport QoS group reference to parent
- net/mlx5: Introduce node struct and rename group terminology to node
- net/mlx5: Refactor vport scheduling element creation function
- net/mlx5: Refactor vport QoS to use scheduling node structure
- net/mlx5: Remove vport QoS enabled flag

Support generalized operations for QoS elements:
- net/mlx5: Simplify QoS scheduling element configuration
- net/mlx5: Generalize QoS operations for nodes and vports

On top, patch 12 by Moshe handles FW request to move to drop mode.

In patch 13, Benjamin Poirier removes an empty eswitch flow table when
not used, which improves packet processing performance.

Patches 14 and 15 by Moshe are small field renamings as preparation for
future fields addition to these structures.

Series generated against:
commit c531f226 ("net: bcmasp: enable SW timestamping")
====================

Link: https://patch.msgid.link/20241016173617.217736-1-tariqt@nvidia.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 7cb08476 7b919caa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ mlx5_ct_fs_smfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec,
	}

	actions[num_actions++] = smfs_rule->count_action;
	actions[num_actions++] = attr->modify_hdr->action.dr_action;
	actions[num_actions++] = attr->modify_hdr->fs_dr_action.dr_action;
	actions[num_actions++] = fs_smfs->fwd_action;

	nat = (attr->ft == fs_smfs->ct_nat);
@@ -379,7 +379,7 @@ static int mlx5_ct_fs_smfs_ct_rule_update(struct mlx5_ct_fs *fs, struct mlx5_ct_
	struct mlx5dr_rule *rule;

	actions[0] = smfs_rule->count_action;
	actions[1] = attr->modify_hdr->action.dr_action;
	actions[1] = attr->modify_hdr->fs_dr_action.dr_action;
	actions[2] = fs_smfs->fwd_action;

	rule = mlx5_smfs_rule_create(smfs_rule->smfs_matcher->dr_matcher, spec,
+1 −1
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ void mlx5_esw_offloads_devlink_port_unregister(struct mlx5_vport *vport)
		return;
	dl_port = vport->dl_port;

	mlx5_esw_qos_vport_update_group(vport, NULL, NULL);
	mlx5_esw_qos_vport_update_node(vport, NULL, NULL);
	devl_rate_leaf_destroy(&dl_port->dl_port);

	devl_port_unregister(&dl_port->dl_port);
+27 −26
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

#include <linux/tracepoint.h>
#include "eswitch.h"
#include "qos.h"

TRACE_EVENT(mlx5_esw_vport_qos_destroy,
	    TP_PROTO(const struct mlx5_core_dev *dev, const struct mlx5_vport *vport),
@@ -19,7 +20,7 @@ TRACE_EVENT(mlx5_esw_vport_qos_destroy,
			     ),
	    TP_fast_assign(__assign_str(devname);
		    __entry->vport_id = vport->vport;
		    __entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
		    __entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport);
	    ),
	    TP_printk("(%s) vport=%hu sched_elem_ix=%u\n",
		      __get_str(devname), __entry->vport_id, __entry->sched_elem_ix
@@ -35,18 +36,18 @@ DECLARE_EVENT_CLASS(mlx5_esw_vport_qos_template,
				     __field(unsigned int, sched_elem_ix)
				     __field(unsigned int, bw_share)
				     __field(unsigned int, max_rate)
				     __field(void *, group)
				     __field(void *, parent)
				     ),
		    TP_fast_assign(__assign_str(devname);
			    __entry->vport_id = vport->vport;
			    __entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
			    __entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport);
			    __entry->bw_share = bw_share;
			    __entry->max_rate = max_rate;
			    __entry->group = vport->qos.group;
			    __entry->parent = mlx5_esw_qos_vport_get_parent(vport);
		    ),
		    TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u group=%p\n",
		    TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u parent=%p\n",
			      __get_str(devname), __entry->vport_id, __entry->sched_elem_ix,
			      __entry->bw_share, __entry->max_rate, __entry->group
			      __entry->bw_share, __entry->max_rate, __entry->parent
			      )
);

@@ -62,57 +63,57 @@ DEFINE_EVENT(mlx5_esw_vport_qos_template, mlx5_esw_vport_qos_config,
	     TP_ARGS(dev, vport, bw_share, max_rate)
	     );

DECLARE_EVENT_CLASS(mlx5_esw_group_qos_template,
DECLARE_EVENT_CLASS(mlx5_esw_node_qos_template,
		    TP_PROTO(const struct mlx5_core_dev *dev,
			     const struct mlx5_esw_rate_group *group,
			     const struct mlx5_esw_sched_node *node,
			     unsigned int tsar_ix),
		    TP_ARGS(dev, group, tsar_ix),
		    TP_ARGS(dev, node, tsar_ix),
		    TP_STRUCT__entry(__string(devname, dev_name(dev->device))
				     __field(const void *, group)
				     __field(const void *, node)
				     __field(unsigned int, tsar_ix)
				     ),
		    TP_fast_assign(__assign_str(devname);
			    __entry->group = group;
			    __entry->node = node;
			    __entry->tsar_ix = tsar_ix;
		    ),
		    TP_printk("(%s) group=%p tsar_ix=%u\n",
			      __get_str(devname), __entry->group, __entry->tsar_ix
		    TP_printk("(%s) node=%p tsar_ix=%u\n",
			      __get_str(devname), __entry->node, __entry->tsar_ix
			      )
);

DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_create,
DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_create,
	     TP_PROTO(const struct mlx5_core_dev *dev,
		      const struct mlx5_esw_rate_group *group,
		      const struct mlx5_esw_sched_node *node,
		      unsigned int tsar_ix),
	     TP_ARGS(dev, group, tsar_ix)
	     TP_ARGS(dev, node, tsar_ix)
	     );

DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_destroy,
DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_destroy,
	     TP_PROTO(const struct mlx5_core_dev *dev,
		      const struct mlx5_esw_rate_group *group,
		      const struct mlx5_esw_sched_node *node,
		      unsigned int tsar_ix),
	     TP_ARGS(dev, group, tsar_ix)
	     TP_ARGS(dev, node, tsar_ix)
	     );

TRACE_EVENT(mlx5_esw_group_qos_config,
TRACE_EVENT(mlx5_esw_node_qos_config,
	    TP_PROTO(const struct mlx5_core_dev *dev,
		     const struct mlx5_esw_rate_group *group,
		     const struct mlx5_esw_sched_node *node,
		     unsigned int tsar_ix, u32 bw_share, u32 max_rate),
	    TP_ARGS(dev, group, tsar_ix, bw_share, max_rate),
	    TP_ARGS(dev, node, tsar_ix, bw_share, max_rate),
	    TP_STRUCT__entry(__string(devname, dev_name(dev->device))
			     __field(const void *, group)
			     __field(const void *, node)
			     __field(unsigned int, tsar_ix)
			     __field(unsigned int, bw_share)
			     __field(unsigned int, max_rate)
			     ),
	    TP_fast_assign(__assign_str(devname);
		    __entry->group = group;
		    __entry->node = node;
		    __entry->tsar_ix = tsar_ix;
		    __entry->bw_share = bw_share;
		    __entry->max_rate = max_rate;
	    ),
	    TP_printk("(%s) group=%p tsar_ix=%u bw_share=%u max_rate=%u\n",
		      __get_str(devname), __entry->group, __entry->tsar_ix,
	    TP_printk("(%s) node=%p tsar_ix=%u bw_share=%u max_rate=%u\n",
		      __get_str(devname), __entry->node, __entry->tsar_ix,
		      __entry->bw_share, __entry->max_rate
		      )
);
+13 −14
Original line number Diff line number Diff line
@@ -176,20 +176,10 @@ static void esw_destroy_legacy_vepa_table(struct mlx5_eswitch *esw)

static int esw_create_legacy_table(struct mlx5_eswitch *esw)
{
	int err;

	memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb));
	atomic64_set(&esw->user_count, 0);

	err = esw_create_legacy_vepa_table(esw);
	if (err)
		return err;

	err = esw_create_legacy_fdb_table(esw);
	if (err)
		esw_destroy_legacy_vepa_table(esw);

	return err;
	return esw_create_legacy_fdb_table(esw);
}

static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw)
@@ -259,15 +249,22 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw,

	if (!setting) {
		esw_cleanup_vepa_rules(esw);
		esw_destroy_legacy_vepa_table(esw);
		return 0;
	}

	if (esw->fdb_table.legacy.vepa_uplink_rule)
		return 0;

	err = esw_create_legacy_vepa_table(esw);
	if (err)
		return err;

	spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
	if (!spec)
		return -ENOMEM;
	if (!spec) {
		err = -ENOMEM;
		goto out;
	}

	/* Uplink rule forward uplink traffic to FDB */
	misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
@@ -303,8 +300,10 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw,

out:
	kvfree(spec);
	if (err)
	if (err) {
		esw_cleanup_vepa_rules(esw);
		esw_destroy_legacy_vepa_table(esw);
	}
	return err;
}

+348 −321

File changed.

Preview size limit exceeded, changes collapsed.

Loading