Skip to content

Commit 9153da4

Browse files
Jianbo LiuSaeed Mahameed
authored andcommitted
net/mlx5e: configure meter in flow action
After police action is parsed, set meter data in flow action, so they can be used when adding FTE. Signed-off-by: Jianbo Liu <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent bbf0b42 commit 9153da4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,20 @@ esw_cleanup_dests(struct mlx5_eswitch *esw,
512512
}
513513
}
514514

515+
static void
516+
esw_setup_meter(struct mlx5_flow_attr *attr, struct mlx5_flow_act *flow_act)
517+
{
518+
struct mlx5e_flow_meter_handle *meter;
519+
520+
meter = attr->meter_attr.meter;
521+
flow_act->exe_aso.type = attr->exe_aso_type;
522+
flow_act->exe_aso.object_id = meter->obj_id;
523+
flow_act->exe_aso.flow_meter.meter_idx = meter->idx;
524+
flow_act->exe_aso.flow_meter.init_color = MLX5_FLOW_METER_COLOR_GREEN;
525+
/* use metadata reg 5 for packet color */
526+
flow_act->exe_aso.return_reg_id = 5;
527+
}
528+
515529
struct mlx5_flow_handle *
516530
mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
517531
struct mlx5_flow_spec *spec,
@@ -579,6 +593,10 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
579593
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
580594
flow_act.modify_hdr = attr->modify_hdr;
581595

596+
if ((flow_act.action & MLX5_FLOW_CONTEXT_ACTION_EXECUTE_ASO) &&
597+
attr->exe_aso_type == MLX5_EXE_ASO_FLOW_METER)
598+
esw_setup_meter(attr, &flow_act);
599+
582600
if (split) {
583601
fwd_attr.chain = attr->chain;
584602
fwd_attr.prio = attr->prio;

0 commit comments

Comments
 (0)