mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net/mlx5e: TC, Reject rules with multiple CT actions
The driver doesn't support multiple CT actions. Multiple CT clear actions are ok as they are redundant also with another CT actions. Signed-off-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Oz Shlomo <ozsh@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
		
							parent
							
								
									ff99316700
								
							
						
					
					
						commit
						3b49a7edec
					
				
					 2 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -16,6 +16,7 @@ struct mlx5e_tc_act_parse_state {
 | 
				
			||||||
	unsigned int num_actions;
 | 
						unsigned int num_actions;
 | 
				
			||||||
	struct mlx5e_tc_flow *flow;
 | 
						struct mlx5e_tc_flow *flow;
 | 
				
			||||||
	struct netlink_ext_ack *extack;
 | 
						struct netlink_ext_ack *extack;
 | 
				
			||||||
 | 
						bool ct;
 | 
				
			||||||
	bool encap;
 | 
						bool encap;
 | 
				
			||||||
	bool decap;
 | 
						bool decap;
 | 
				
			||||||
	bool mpls_push;
 | 
						bool mpls_push;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ tc_act_can_offload_ct(struct mlx5e_tc_act_parse_state *parse_state,
 | 
				
			||||||
		      int act_index,
 | 
							      int act_index,
 | 
				
			||||||
		      struct mlx5_flow_attr *attr)
 | 
							      struct mlx5_flow_attr *attr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR;
 | 
				
			||||||
	struct netlink_ext_ack *extack = parse_state->extack;
 | 
						struct netlink_ext_ack *extack = parse_state->extack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (flow_flag_test(parse_state->flow, SAMPLE)) {
 | 
						if (flow_flag_test(parse_state->flow, SAMPLE)) {
 | 
				
			||||||
| 
						 | 
					@ -19,6 +20,11 @@ tc_act_can_offload_ct(struct mlx5e_tc_act_parse_state *parse_state,
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (parse_state->ct && !clear_action) {
 | 
				
			||||||
 | 
							NL_SET_ERR_MSG_MOD(extack, "Multiple CT actions are not supoported");
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +34,7 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
 | 
				
			||||||
		struct mlx5e_priv *priv,
 | 
							struct mlx5e_priv *priv,
 | 
				
			||||||
		struct mlx5_flow_attr *attr)
 | 
							struct mlx5_flow_attr *attr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = mlx5_tc_ct_parse_action(parse_state->ct_priv, attr,
 | 
						err = mlx5_tc_ct_parse_action(parse_state->ct_priv, attr,
 | 
				
			||||||
| 
						 | 
					@ -41,6 +48,9 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
 | 
				
			||||||
	if (mlx5e_is_eswitch_flow(parse_state->flow))
 | 
						if (mlx5e_is_eswitch_flow(parse_state->flow))
 | 
				
			||||||
		attr->esw_attr->split_count = attr->esw_attr->out_count;
 | 
							attr->esw_attr->split_count = attr->esw_attr->out_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!clear_action)
 | 
				
			||||||
 | 
							parse_state->ct = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue