Skip to content

Commit 6f07cd8

Browse files
author
Paolo Abeni
committed
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 c531f22 ("net: bcmasp: enable SW timestamping") ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 7cb0847 + 7b919ca commit 6f07cd8

File tree

11 files changed

+435
-398
lines changed

11 files changed

+435
-398
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ mlx5_ct_fs_smfs_ct_rule_add(struct mlx5_ct_fs *fs, struct mlx5_flow_spec *spec,
318318
}
319319

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

324324
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_
379379
struct mlx5dr_rule *rule;
380380

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

385385
rule = mlx5_smfs_rule_create(smfs_rule->smfs_matcher->dr_matcher, spec,

drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void mlx5_esw_offloads_devlink_port_unregister(struct mlx5_vport *vport)
195195
return;
196196
dl_port = vport->dl_port;
197197

198-
mlx5_esw_qos_vport_update_group(vport, NULL, NULL);
198+
mlx5_esw_qos_vport_update_node(vport, NULL, NULL);
199199
devl_rate_leaf_destroy(&dl_port->dl_port);
200200

201201
devl_port_unregister(&dl_port->dl_port);

drivers/net/ethernet/mellanox/mlx5/core/esw/diag/qos_tracepoint.h

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/tracepoint.h>
1111
#include "eswitch.h"
12+
#include "qos.h"
1213

1314
TRACE_EVENT(mlx5_esw_vport_qos_destroy,
1415
TP_PROTO(const struct mlx5_core_dev *dev, const struct mlx5_vport *vport),
@@ -19,7 +20,7 @@ TRACE_EVENT(mlx5_esw_vport_qos_destroy,
1920
),
2021
TP_fast_assign(__assign_str(devname);
2122
__entry->vport_id = vport->vport;
22-
__entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
23+
__entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport);
2324
),
2425
TP_printk("(%s) vport=%hu sched_elem_ix=%u\n",
2526
__get_str(devname), __entry->vport_id, __entry->sched_elem_ix
@@ -35,18 +36,18 @@ DECLARE_EVENT_CLASS(mlx5_esw_vport_qos_template,
3536
__field(unsigned int, sched_elem_ix)
3637
__field(unsigned int, bw_share)
3738
__field(unsigned int, max_rate)
38-
__field(void *, group)
39+
__field(void *, parent)
3940
),
4041
TP_fast_assign(__assign_str(devname);
4142
__entry->vport_id = vport->vport;
42-
__entry->sched_elem_ix = vport->qos.esw_sched_elem_ix;
43+
__entry->sched_elem_ix = mlx5_esw_qos_vport_get_sched_elem_ix(vport);
4344
__entry->bw_share = bw_share;
4445
__entry->max_rate = max_rate;
45-
__entry->group = vport->qos.group;
46+
__entry->parent = mlx5_esw_qos_vport_get_parent(vport);
4647
),
47-
TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u group=%p\n",
48+
TP_printk("(%s) vport=%hu sched_elem_ix=%u bw_share=%u, max_rate=%u parent=%p\n",
4849
__get_str(devname), __entry->vport_id, __entry->sched_elem_ix,
49-
__entry->bw_share, __entry->max_rate, __entry->group
50+
__entry->bw_share, __entry->max_rate, __entry->parent
5051
)
5152
);
5253

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

65-
DECLARE_EVENT_CLASS(mlx5_esw_group_qos_template,
66+
DECLARE_EVENT_CLASS(mlx5_esw_node_qos_template,
6667
TP_PROTO(const struct mlx5_core_dev *dev,
67-
const struct mlx5_esw_rate_group *group,
68+
const struct mlx5_esw_sched_node *node,
6869
unsigned int tsar_ix),
69-
TP_ARGS(dev, group, tsar_ix),
70+
TP_ARGS(dev, node, tsar_ix),
7071
TP_STRUCT__entry(__string(devname, dev_name(dev->device))
71-
__field(const void *, group)
72+
__field(const void *, node)
7273
__field(unsigned int, tsar_ix)
7374
),
7475
TP_fast_assign(__assign_str(devname);
75-
__entry->group = group;
76+
__entry->node = node;
7677
__entry->tsar_ix = tsar_ix;
7778
),
78-
TP_printk("(%s) group=%p tsar_ix=%u\n",
79-
__get_str(devname), __entry->group, __entry->tsar_ix
79+
TP_printk("(%s) node=%p tsar_ix=%u\n",
80+
__get_str(devname), __entry->node, __entry->tsar_ix
8081
)
8182
);
8283

83-
DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_create,
84+
DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_create,
8485
TP_PROTO(const struct mlx5_core_dev *dev,
85-
const struct mlx5_esw_rate_group *group,
86+
const struct mlx5_esw_sched_node *node,
8687
unsigned int tsar_ix),
87-
TP_ARGS(dev, group, tsar_ix)
88+
TP_ARGS(dev, node, tsar_ix)
8889
);
8990

90-
DEFINE_EVENT(mlx5_esw_group_qos_template, mlx5_esw_group_qos_destroy,
91+
DEFINE_EVENT(mlx5_esw_node_qos_template, mlx5_esw_node_qos_destroy,
9192
TP_PROTO(const struct mlx5_core_dev *dev,
92-
const struct mlx5_esw_rate_group *group,
93+
const struct mlx5_esw_sched_node *node,
9394
unsigned int tsar_ix),
94-
TP_ARGS(dev, group, tsar_ix)
95+
TP_ARGS(dev, node, tsar_ix)
9596
);
9697

97-
TRACE_EVENT(mlx5_esw_group_qos_config,
98+
TRACE_EVENT(mlx5_esw_node_qos_config,
9899
TP_PROTO(const struct mlx5_core_dev *dev,
99-
const struct mlx5_esw_rate_group *group,
100+
const struct mlx5_esw_sched_node *node,
100101
unsigned int tsar_ix, u32 bw_share, u32 max_rate),
101-
TP_ARGS(dev, group, tsar_ix, bw_share, max_rate),
102+
TP_ARGS(dev, node, tsar_ix, bw_share, max_rate),
102103
TP_STRUCT__entry(__string(devname, dev_name(dev->device))
103-
__field(const void *, group)
104+
__field(const void *, node)
104105
__field(unsigned int, tsar_ix)
105106
__field(unsigned int, bw_share)
106107
__field(unsigned int, max_rate)
107108
),
108109
TP_fast_assign(__assign_str(devname);
109-
__entry->group = group;
110+
__entry->node = node;
110111
__entry->tsar_ix = tsar_ix;
111112
__entry->bw_share = bw_share;
112113
__entry->max_rate = max_rate;
113114
),
114-
TP_printk("(%s) group=%p tsar_ix=%u bw_share=%u max_rate=%u\n",
115-
__get_str(devname), __entry->group, __entry->tsar_ix,
115+
TP_printk("(%s) node=%p tsar_ix=%u bw_share=%u max_rate=%u\n",
116+
__get_str(devname), __entry->node, __entry->tsar_ix,
116117
__entry->bw_share, __entry->max_rate
117118
)
118119
);

drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,10 @@ static void esw_destroy_legacy_vepa_table(struct mlx5_eswitch *esw)
176176

177177
static int esw_create_legacy_table(struct mlx5_eswitch *esw)
178178
{
179-
int err;
180-
181179
memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb));
182180
atomic64_set(&esw->user_count, 0);
183181

184-
err = esw_create_legacy_vepa_table(esw);
185-
if (err)
186-
return err;
187-
188-
err = esw_create_legacy_fdb_table(esw);
189-
if (err)
190-
esw_destroy_legacy_vepa_table(esw);
191-
192-
return err;
182+
return esw_create_legacy_fdb_table(esw);
193183
}
194184

195185
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,
259249

260250
if (!setting) {
261251
esw_cleanup_vepa_rules(esw);
252+
esw_destroy_legacy_vepa_table(esw);
262253
return 0;
263254
}
264255

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

259+
err = esw_create_legacy_vepa_table(esw);
260+
if (err)
261+
return err;
262+
268263
spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
269-
if (!spec)
270-
return -ENOMEM;
264+
if (!spec) {
265+
err = -ENOMEM;
266+
goto out;
267+
}
271268

272269
/* Uplink rule forward uplink traffic to FDB */
273270
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,
303300

304301
out:
305302
kvfree(spec);
306-
if (err)
303+
if (err) {
307304
esw_cleanup_vepa_rules(esw);
305+
esw_destroy_legacy_vepa_table(esw);
306+
}
308307
return err;
309308
}
310309

0 commit comments

Comments
 (0)