Commit 25010156 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'net-qede-don-t-restrict-error-codes'

 says:

====================
net: qede: don't restrict error codes

This series fixes the qede driver, so that when a helper function fails,
then the callee should return the returned error code, instead just
assuming that the error is eg. -EINVAL.

The patches in this series, reduces the change of future bugs, so new
error codes can be returned from the helpers, without having to update
the call sites.

This is a follow-up to my recent series "net: qede: avoid overruling
error codes", which fixed the cases where the implicit assumption of
failing with specific error codes had been broken.
https://lore.kernel.org/netdev/20240426091227.78060-1-ast@fiberby.net/

Asbjørn Sloth Tønnesen (3):
  net: qede: use return from qede_parse_actions() for flow_spec
  net: qede: use return from qede_flow_spec_validate_unused()
  net: qede: use return from qede_flow_parse_ports()

 .../net/ethernet/qlogic/qede/qede_filter.c    | 27 ++++++++++++-------
 1 file changed, 18 insertions(+), 9 deletions(-)
====================

Link: https://lore.kernel.org/r/20240503105505.839342-1-ast@fiberby.netSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 179a6f5d c0c66eba
...@@ -1725,6 +1725,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule, ...@@ -1725,6 +1725,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
struct qede_arfs_tuple *t) struct qede_arfs_tuple *t)
{ {
struct in6_addr zero_addr, addr; struct in6_addr zero_addr, addr;
int err;
memset(&zero_addr, 0, sizeof(addr)); memset(&zero_addr, 0, sizeof(addr));
memset(&addr, 0xff, sizeof(addr)); memset(&addr, 0xff, sizeof(addr));
...@@ -1746,8 +1747,9 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule, ...@@ -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)); memcpy(&t->dst_ipv6, &match.key->dst, sizeof(addr));
} }
if (qede_flow_parse_ports(edev, rule, t)) err = qede_flow_parse_ports(edev, rule, t);
return -EINVAL; if (err)
return err;
return qede_set_v6_tuple_to_profile(edev, t, &zero_addr); return qede_set_v6_tuple_to_profile(edev, t, &zero_addr);
} }
...@@ -1756,6 +1758,8 @@ static int ...@@ -1756,6 +1758,8 @@ static int
qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule, qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
struct qede_arfs_tuple *t) struct qede_arfs_tuple *t)
{ {
int err;
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) { if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
struct flow_match_ipv4_addrs match; struct flow_match_ipv4_addrs match;
...@@ -1770,8 +1774,9 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule, ...@@ -1770,8 +1774,9 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
t->dst_ipv4 = match.key->dst; t->dst_ipv4 = match.key->dst;
} }
if (qede_flow_parse_ports(edev, rule, t)) err = qede_flow_parse_ports(edev, rule, t);
return -EINVAL; if (err)
return err;
return qede_set_v4_tuple_to_profile(edev, t); return qede_set_v4_tuple_to_profile(edev, t);
} }
...@@ -1943,6 +1948,8 @@ static int qede_flow_spec_validate(struct qede_dev *edev, ...@@ -1943,6 +1948,8 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
struct qede_arfs_tuple *t, struct qede_arfs_tuple *t,
__u32 location) __u32 location)
{ {
int err;
if (location >= QEDE_RFS_MAX_FLTR) { if (location >= QEDE_RFS_MAX_FLTR) {
DP_INFO(edev, "Location out-of-bounds\n"); DP_INFO(edev, "Location out-of-bounds\n");
return -EINVAL; return -EINVAL;
...@@ -1963,8 +1970,9 @@ static int qede_flow_spec_validate(struct qede_dev *edev, ...@@ -1963,8 +1970,9 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
return -EINVAL; return -EINVAL;
} }
if (qede_parse_actions(edev, flow_action, NULL)) err = qede_parse_actions(edev, flow_action, NULL);
return -EINVAL; if (err)
return err;
return 0; return 0;
} }
...@@ -1976,10 +1984,11 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev, ...@@ -1976,10 +1984,11 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
struct ethtool_rx_flow_spec_input input = {}; struct ethtool_rx_flow_spec_input input = {};
struct ethtool_rx_flow_rule *flow; struct ethtool_rx_flow_rule *flow;
__be16 proto; __be16 proto;
int err = 0; int err;
if (qede_flow_spec_validate_unused(edev, fs)) err = qede_flow_spec_validate_unused(edev, fs);
return -EOPNOTSUPP; if (err)
return err;
switch ((fs->flow_type & ~FLOW_EXT)) { switch ((fs->flow_type & ~FLOW_EXT)) {
case TCP_V4_FLOW: case TCP_V4_FLOW:
......
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