net: qede: use return from qede_flow_parse_ports()

When calling qede_flow_parse_ports(), then the
return code was only used for a non-zero check,
and then -EINVAL was returned.

qede_flow_parse_ports() can currently fail with:
* -EINVAL

This patch changes qede_flow_parse_v{4,6}_common() to
use the actual return code from qede_flow_parse_ports(),
so it's no longer assumed that all errors are -EINVAL.

Only compile tested.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Asbjørn Sloth Tønnesen 2024-05-03 10:55:03 +00:00 committed by Paolo Abeni
parent e5ed2f0349
commit c0c66eba63

View File

@ -1725,6 +1725,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
struct qede_arfs_tuple *t)
{
struct in6_addr zero_addr, addr;
int err;
memset(&zero_addr, 0, sizeof(addr));
memset(&addr, 0xff, sizeof(addr));
@ -1746,8 +1747,9 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
memcpy(&t->dst_ipv6, &match.key->dst, sizeof(addr));
}
if (qede_flow_parse_ports(edev, rule, t))
return -EINVAL;
err = qede_flow_parse_ports(edev, rule, t);
if (err)
return err;
return qede_set_v6_tuple_to_profile(edev, t, &zero_addr);
}
@ -1756,6 +1758,8 @@ static int
qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
struct qede_arfs_tuple *t)
{
int err;
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
struct flow_match_ipv4_addrs match;
@ -1770,8 +1774,9 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
t->dst_ipv4 = match.key->dst;
}
if (qede_flow_parse_ports(edev, rule, t))
return -EINVAL;
err = qede_flow_parse_ports(edev, rule, t);
if (err)
return err;
return qede_set_v4_tuple_to_profile(edev, t);
}