Commit ddda6326 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'mlx5-Support-tc-police-jump-conform-exceed-attribute'

Saeed Mahameed says:

====================
Support tc police jump conform-exceed attribute

The tc police action conform-exceed option defines how to handle
packets which exceed or conform to the configured bandwidth limit.
One of the possible conform-exceed values is jump, which skips over
a specified number of actions.
This series adds support for conform-exceed jump action.

The series adds platform support for branching actions by providing
true/false flow attributes to the branching action.
This is necessary for supporting police jump, as each branch may
execute a different action list.

The first five patches are preparation patches:
- Patches 1 and 2 add support for actions with no destinations (e.g. drop)
- Patch 3 refactor the code for subsequent function reuse
- Patch 4 defines an abstract way for identifying terminating actions
- Patch 5 updates action list validations logic considering branching actions

The following three patches introduce an interface for abstracting branching
actions:
- Patch 6 introduces an abstract api for defining branching actions
- Patch 7 generically instantiates the branching flow attributes using
  the abstract API

Patch 8 adds the platform support for jump actions, by executing the following
sequence:
  a. Store the jumping flow attr
  b. Identify the jump target action while iterating the actions list.
  c. Instantiate a new flow attribute after the jump target action.
     This is the flow attribute that the branching action should jump to.
  d. Set the target post action id on:
    d.1. The jumping attribute, thus realizing the jump functionality.
    d.2. The attribute preceding the target jump attr, if not terminating.

The next patches apply the platform's branching attributes to the police
action:
- Patch 9 is a refactor patch
- Patch 10 initializes the post meter table with the red/green flow attributes,
           as were initialized by the platform
- Patch 11 enables the offload of meter actions using jump conform-exceed
           value.
====================

Link: https://lore.kernel.org/all/20221203221337.29267-1-saeed@kernel.org/


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bde55dd9 3603f266
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,4 +28,5 @@ tc_act_parse_accept(struct mlx5e_tc_act_parse_state *parse_state,
struct mlx5e_tc_act mlx5e_tc_act_accept = {
	.can_offload = tc_act_can_offload_accept,
	.parse_action = tc_act_parse_accept,
	.is_terminating_action = true,
};
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = {
	[FLOW_ACTION_DROP] = &mlx5e_tc_act_drop,
	[FLOW_ACTION_TRAP] = &mlx5e_tc_act_trap,
	[FLOW_ACTION_GOTO] = &mlx5e_tc_act_goto,
	[FLOW_ACTION_REDIRECT] = &mlx5e_tc_act_mirred,
	[FLOW_ACTION_REDIRECT] = &mlx5e_tc_act_redirect,
	[FLOW_ACTION_MIRRED] = &mlx5e_tc_act_mirred,
	[FLOW_ACTION_REDIRECT_INGRESS] = &mlx5e_tc_act_redirect_ingress,
	[FLOW_ACTION_VLAN_PUSH] = &mlx5e_tc_act_vlan,
+12 −0
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@ struct mlx5e_tc_act_parse_state {
	struct mlx5_tc_ct_priv *ct_priv;
};

struct mlx5e_tc_act_branch_ctrl {
	enum flow_action_id act_id;
	u32 extval;
};

struct mlx5e_tc_act {
	bool (*can_offload)(struct mlx5e_tc_act_parse_state *parse_state,
			    const struct flow_action_entry *act,
@@ -60,6 +65,12 @@ struct mlx5e_tc_act {

	int (*stats_action)(struct mlx5e_priv *priv,
			    struct flow_offload_action *fl_act);

	bool (*get_branch_ctrl)(const struct flow_action_entry *act,
				struct mlx5e_tc_act_branch_ctrl *cond_true,
				struct mlx5e_tc_act_branch_ctrl *cond_false);

	bool is_terminating_action;
};

struct mlx5e_tc_flow_action {
@@ -81,6 +92,7 @@ extern struct mlx5e_tc_act mlx5e_tc_act_vlan_mangle;
extern struct mlx5e_tc_act mlx5e_tc_act_mpls_push;
extern struct mlx5e_tc_act mlx5e_tc_act_mpls_pop;
extern struct mlx5e_tc_act mlx5e_tc_act_mirred;
extern struct mlx5e_tc_act mlx5e_tc_act_redirect;
extern struct mlx5e_tc_act mlx5e_tc_act_mirred_nic;
extern struct mlx5e_tc_act mlx5e_tc_act_ct;
extern struct mlx5e_tc_act mlx5e_tc_act_sample;
+1 −0
Original line number Diff line number Diff line
@@ -27,4 +27,5 @@ tc_act_parse_drop(struct mlx5e_tc_act_parse_state *parse_state,
struct mlx5e_tc_act mlx5e_tc_act_drop = {
	.can_offload = tc_act_can_offload_drop,
	.parse_action = tc_act_parse_drop,
	.is_terminating_action = true,
};
+1 −0
Original line number Diff line number Diff line
@@ -121,4 +121,5 @@ struct mlx5e_tc_act mlx5e_tc_act_goto = {
	.can_offload = tc_act_can_offload_goto,
	.parse_action = tc_act_parse_goto,
	.post_parse = tc_act_post_parse_goto,
	.is_terminating_action = true,
};
Loading