Commit 0840c9f7 authored by Paul Blakey's avatar Paul Blakey Committed by Saeed Mahameed

net/mlx5e: Set default can_offload action

Many parsers of tc actions just return true on their can_offload()
implementation, without checking the input flow/action.
Set the default can_offload action to true (allow), and avoid
having many can_offload implementations that do just that.

This patch doesn't change any functionality.
Signed-off-by: default avatarPaul Blakey <paulb@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 8b0f2565
...@@ -4,15 +4,6 @@ ...@@ -4,15 +4,6 @@
#include "act.h" #include "act.h"
#include "en/tc_priv.h" #include "en/tc_priv.h"
static bool
tc_act_can_offload_accept(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_accept(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_accept(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -26,7 +17,6 @@ tc_act_parse_accept(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -26,7 +17,6 @@ tc_act_parse_accept(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_accept = { struct mlx5e_tc_act mlx5e_tc_act_accept = {
.can_offload = tc_act_can_offload_accept,
.parse_action = tc_act_parse_accept, .parse_action = tc_act_parse_accept,
.is_terminating_action = true, .is_terminating_action = true,
}; };
...@@ -4,15 +4,6 @@ ...@@ -4,15 +4,6 @@
#include "act.h" #include "act.h"
#include "en/tc_priv.h" #include "en/tc_priv.h"
static bool
tc_act_can_offload_drop(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_drop(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_drop(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -25,7 +16,6 @@ tc_act_parse_drop(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -25,7 +16,6 @@ tc_act_parse_drop(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_drop = { struct mlx5e_tc_act mlx5e_tc_act_drop = {
.can_offload = tc_act_can_offload_drop,
.parse_action = tc_act_parse_drop, .parse_action = tc_act_parse_drop,
.is_terminating_action = true, .is_terminating_action = true,
}; };
...@@ -78,15 +78,6 @@ mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv, ...@@ -78,15 +78,6 @@ mlx5e_tc_act_pedit_parse_action(struct mlx5e_priv *priv,
return err; return err;
} }
static bool
tc_act_can_offload_pedit(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -114,6 +105,5 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -114,6 +105,5 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_pedit = { struct mlx5e_tc_act mlx5e_tc_act_pedit = {
.can_offload = tc_act_can_offload_pedit,
.parse_action = tc_act_parse_pedit, .parse_action = tc_act_parse_pedit,
}; };
...@@ -4,15 +4,6 @@ ...@@ -4,15 +4,6 @@
#include "act.h" #include "act.h"
#include "en/tc_priv.h" #include "en/tc_priv.h"
static bool
tc_act_can_offload_ptype(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -31,6 +22,5 @@ tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -31,6 +22,5 @@ tc_act_parse_ptype(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_ptype = { struct mlx5e_tc_act mlx5e_tc_act_ptype = {
.can_offload = tc_act_can_offload_ptype,
.parse_action = tc_act_parse_ptype, .parse_action = tc_act_parse_ptype,
}; };
...@@ -5,15 +5,6 @@ ...@@ -5,15 +5,6 @@
#include "en/tc_priv.h" #include "en/tc_priv.h"
#include "eswitch.h" #include "eswitch.h"
static bool
tc_act_can_offload_trap(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -27,6 +18,5 @@ tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -27,6 +18,5 @@ tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_trap = { struct mlx5e_tc_act mlx5e_tc_act_trap = {
.can_offload = tc_act_can_offload_trap,
.parse_action = tc_act_parse_trap, .parse_action = tc_act_parse_trap,
}; };
...@@ -32,15 +32,6 @@ tc_act_parse_tun_encap(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -32,15 +32,6 @@ tc_act_parse_tun_encap(struct mlx5e_tc_act_parse_state *parse_state,
return 0; return 0;
} }
static bool
tc_act_can_offload_tun_decap(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_tun_decap(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_tun_decap(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -58,6 +49,5 @@ struct mlx5e_tc_act mlx5e_tc_act_tun_encap = { ...@@ -58,6 +49,5 @@ struct mlx5e_tc_act mlx5e_tc_act_tun_encap = {
}; };
struct mlx5e_tc_act mlx5e_tc_act_tun_decap = { struct mlx5e_tc_act mlx5e_tc_act_tun_decap = {
.can_offload = tc_act_can_offload_tun_decap,
.parse_action = tc_act_parse_tun_decap, .parse_action = tc_act_parse_tun_decap,
}; };
...@@ -141,15 +141,6 @@ mlx5e_tc_act_vlan_add_pop_action(struct mlx5e_priv *priv, ...@@ -141,15 +141,6 @@ mlx5e_tc_act_vlan_add_pop_action(struct mlx5e_priv *priv,
return err; return err;
} }
static bool
tc_act_can_offload_vlan(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -205,7 +196,6 @@ tc_act_post_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -205,7 +196,6 @@ tc_act_post_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_vlan = { struct mlx5e_tc_act mlx5e_tc_act_vlan = {
.can_offload = tc_act_can_offload_vlan,
.parse_action = tc_act_parse_vlan, .parse_action = tc_act_parse_vlan,
.post_parse = tc_act_post_parse_vlan, .post_parse = tc_act_post_parse_vlan,
}; };
...@@ -50,15 +50,6 @@ mlx5e_tc_act_vlan_add_rewrite_action(struct mlx5e_priv *priv, int namespace, ...@@ -50,15 +50,6 @@ mlx5e_tc_act_vlan_add_rewrite_action(struct mlx5e_priv *priv, int namespace,
return err; return err;
} }
static bool
tc_act_can_offload_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act,
int act_index,
struct mlx5_flow_attr *attr)
{
return true;
}
static int static int
tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state, tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,
const struct flow_action_entry *act, const struct flow_action_entry *act,
...@@ -81,6 +72,5 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -81,6 +72,5 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,
} }
struct mlx5e_tc_act mlx5e_tc_act_vlan_mangle = { struct mlx5e_tc_act mlx5e_tc_act_vlan_mangle = {
.can_offload = tc_act_can_offload_vlan_mangle,
.parse_action = tc_act_parse_vlan_mangle, .parse_action = tc_act_parse_vlan_mangle,
}; };
...@@ -4096,7 +4096,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -4096,7 +4096,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
goto out_free; goto out_free;
} }
if (!tc_act->can_offload(parse_state, act, i, attr)) { if (tc_act->can_offload && !tc_act->can_offload(parse_state, act, i, attr)) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out_free; goto out_free;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment