Commit 1836d780 authored by Roi Dayan's avatar Roi Dayan Committed by Saeed Mahameed

net/mlx5e: Use correct return type

modify_header_match_supported() should return type bool but
it returns the value returned by is_action_keys_supported()
which is type int.

is_action_keys_supported() always returns either -EOPNOTSUPP
or 0 and it shouldn't change as the purpose of the function
is checking for support. so just make the function return
a bool type.
Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
Reviewed-by: default avatarMaor Dickman <maord@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 6c2509d4
...@@ -3025,10 +3025,10 @@ struct ipv6_hoplimit_word { ...@@ -3025,10 +3025,10 @@ struct ipv6_hoplimit_word {
__u8 hop_limit; __u8 hop_limit;
}; };
static int is_action_keys_supported(const struct flow_action_entry *act, static bool
bool ct_flow, bool *modify_ip_header, is_action_keys_supported(const struct flow_action_entry *act, bool ct_flow,
bool *modify_tuple, bool *modify_ip_header, bool *modify_tuple,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
u32 mask, offset; u32 mask, offset;
u8 htype; u8 htype;
...@@ -3056,7 +3056,7 @@ static int is_action_keys_supported(const struct flow_action_entry *act, ...@@ -3056,7 +3056,7 @@ static int is_action_keys_supported(const struct flow_action_entry *act,
if (ct_flow && *modify_tuple) { if (ct_flow && *modify_tuple) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"can't offload re-write of ipv4 address with action ct"); "can't offload re-write of ipv4 address with action ct");
return -EOPNOTSUPP; return false;
} }
} else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) { } else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) {
struct ipv6_hoplimit_word *hoplimit_word = struct ipv6_hoplimit_word *hoplimit_word =
...@@ -3074,7 +3074,7 @@ static int is_action_keys_supported(const struct flow_action_entry *act, ...@@ -3074,7 +3074,7 @@ static int is_action_keys_supported(const struct flow_action_entry *act,
if (ct_flow && *modify_tuple) { if (ct_flow && *modify_tuple) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"can't offload re-write of ipv6 address with action ct"); "can't offload re-write of ipv6 address with action ct");
return -EOPNOTSUPP; return false;
} }
} else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_TCP || } else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_TCP ||
htype == FLOW_ACT_MANGLE_HDR_TYPE_UDP) { htype == FLOW_ACT_MANGLE_HDR_TYPE_UDP) {
...@@ -3082,11 +3082,11 @@ static int is_action_keys_supported(const struct flow_action_entry *act, ...@@ -3082,11 +3082,11 @@ static int is_action_keys_supported(const struct flow_action_entry *act,
if (ct_flow) { if (ct_flow) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"can't offload re-write of transport header ports with action ct"); "can't offload re-write of transport header ports with action ct");
return -EOPNOTSUPP; return false;
} }
} }
return 0; return true;
} }
static bool modify_tuple_supported(bool modify_tuple, bool ct_clear, static bool modify_tuple_supported(bool modify_tuple, bool ct_clear,
...@@ -3133,7 +3133,7 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv, ...@@ -3133,7 +3133,7 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv,
void *headers_v; void *headers_v;
u16 ethertype; u16 ethertype;
u8 ip_proto; u8 ip_proto;
int i, err; int i;
headers_c = get_match_headers_criteria(actions, spec); headers_c = get_match_headers_criteria(actions, spec);
headers_v = get_match_headers_value(actions, spec); headers_v = get_match_headers_value(actions, spec);
...@@ -3151,11 +3151,10 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv, ...@@ -3151,11 +3151,10 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv,
act->id != FLOW_ACTION_ADD) act->id != FLOW_ACTION_ADD)
continue; continue;
err = is_action_keys_supported(act, ct_flow, if (!is_action_keys_supported(act, ct_flow,
&modify_ip_header, &modify_ip_header,
&modify_tuple, extack); &modify_tuple, extack))
if (err) return false;
return err;
} }
if (!modify_tuple_supported(modify_tuple, ct_clear, ct_flow, extack, if (!modify_tuple_supported(modify_tuple, ct_clear, ct_flow, extack,
......
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