1 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2 // Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 
4 #include "act.h"
5 #include "en/tc_priv.h"
6 
7 static int
tc_act_parse_ptype(struct mlx5e_tc_act_parse_state * parse_state,const struct flow_action_entry * act,struct mlx5e_priv * priv,struct mlx5_flow_attr * attr)8 tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state,
9 		   const struct flow_action_entry *act,
10 		   struct mlx5e_priv *priv,
11 		   struct mlx5_flow_attr *attr)
12 {
13 	struct netlink_ext_ack *extack = parse_state->extack;
14 
15 	if (act->ptype != PACKET_HOST) {
16 		NL_SET_ERR_MSG_MOD(extack, "skbedit ptype is only supported with type host");
17 		return -EOPNOTSUPP;
18 	}
19 
20 	parse_state->ptype_host = true;
21 	return 0;
22 }
23 
24 struct mlx5e_tc_act mlx5e_tc_act_ptype = {
25 	.parse_action = tc_act_parse_ptype,
26 };
27