Skip to contentSkip to conversation

net: qede: convert filter code to use extack

PATCH Applied Asbjørn Sloth Tønnesen 3 participants 31 messages May 8, 2024 – May 11, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover net: qede: convert filter code to use extack

This series converts the filter code in the qede driver to use NL_SET_ERR_MSG_*(extack, ...) for error handling.

Patch 1-12 converts qede_parse_flow_attr() to use extack, along with all it's static helper functions.

qede_parse_flow_attr() is used in two places:
- qede_add_tc_flower_fltr()
- qede_flow_spec_to_rule()

In the latter call site extack is faked in the same way as is done in mlxsw (patch 12).

While the conversion is going on, some error messages are silenced in between patch 1-12. If wanted could squash patch 1-12 in a v3, but I felt that it would be easier to review as 12 more trivial patches.

Patch 13 and 14, finishes up by converting qede_parse_actions(), and ensures that extack is propagated to it, in both call contexts.

---
Changelog:

v2:
- Reworked to always add extack as last argument. (Requested by Przemek)

v1: https://lore.kernel.org/netdev/[email protected]/

Asbjørn Sloth Tønnesen (14):
net: qede: use extack in qede_flow_parse_ports()
net: qede: use extack in qede_set_v6_tuple_to_profile()
net: qede: use extack in qede_set_v4_tuple_to_profile()
net: qede: use extack in qede_flow_parse_v6_common()
net: qede: use extack in qede_flow_parse_v4_common()
net: qede: use extack in qede_flow_parse_tcp_v6()
net: qede: use extack in qede_flow_parse_tcp_v4()
net: qede: use extack in qede_flow_parse_udp_v6()
net: qede: use extack in qede_flow_parse_udp_v4()
net: qede: add extack in qede_add_tc_flower_fltr()
net: qede: use extack in qede_parse_flow_attr()
net: qede: use faked extack in qede_flow_spec_to_rule()
net: qede: propagate extack through qede_flow_spec_validate()
net: qede: use extack in qede_parse_actions()

 .../net/ethernet/qlogic/qede/qede_filter.c    | 114 ++++++++++--------
 1 file changed, 63 insertions(+), 51 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/14 net: qede: use extack in qede_flow_parse_ports()

Convert qede_flow_parse_ports to use extack,
and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_flow_parse_ports(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +6 -5
index ded48523c383..600b7dc7ad56 100644
@@ -1700,8 +1700,8 @@ static int qede_parse_actions(struct qede_dev *edev,
 }
 
 static int
-qede_flow_parse_ports(struct qede_dev *edev, struct flow_rule *rule,
-		      struct qede_arfs_tuple *t)
+qede_flow_parse_ports(struct flow_rule *rule, struct qede_arfs_tuple *t,
+		      struct netlink_ext_ack *extack)
 {
 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_PORTS)) {
 		struct flow_match_ports match;
@@ -1709,7 +1709,8 @@ qede_flow_parse_ports(struct qede_dev *edev, struct flow_rule *rule,
 		flow_rule_match_ports(rule, &match);
 		if ((match.key->src && match.mask->src != htons(U16_MAX)) ||
 		    (match.key->dst && match.mask->dst != htons(U16_MAX))) {
-			DP_NOTICE(edev, "Do not support ports masks\n");
+			NL_SET_ERR_MSG_MOD(extack,
+					   "Do not support ports masks");
 			return -EINVAL;
 		}
 
@@ -1747,7 +1748,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
 		memcpy(&t->dst_ipv6, &match.key->dst, sizeof(addr));
 	}
 
-	err = qede_flow_parse_ports(edev, rule, t);
+	err = qede_flow_parse_ports(rule, t, NULL);
 	if (err)
 		return err;
 
@@ -1774,7 +1775,7 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
 		t->dst_ipv4 = match.key->dst;
 	}
 
-	err = qede_flow_parse_ports(edev, rule, t);
+	err = qede_flow_parse_ports(rule, t, NULL);
 	if (err)
 		return err;
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 1/14
#2 lore raw

Re: [PATCH net-next v2 01/14] net: qede: use extack in qede_flow_parse_ports()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_ports to use extack,
and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_flow_parse_ports(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#3 lore raw

PATCH v2 2/14 net: qede: use extack in qede_set_v6_tuple_to_profile()

In reply to Asbjørn Sloth Tønnesen

Convert qede_set_v6_tuple_to_profile() to take extack, and drop the edev argument.

Convert DP_INFO call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_set_v6_tuple_to_profile(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +5 -5
index 600b7dc7ad56..0f951d00b10e 100644
@@ -1549,9 +1549,9 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
 	return 0;
 }
 
-static int qede_set_v6_tuple_to_profile(struct qede_dev *edev,
-					struct qede_arfs_tuple *t,
-					struct in6_addr *zaddr)
+static int qede_set_v6_tuple_to_profile(struct qede_arfs_tuple *t,
+					struct in6_addr *zaddr,
+					struct netlink_ext_ack *extack)
 {
 	/* We must have Only 4-tuples/l4 port/src ip/dst ip
 	 * as an input.
@@ -1573,7 +1573,7 @@ static int qede_set_v6_tuple_to_profile(struct qede_dev *edev,
 		   !memcmp(&t->src_ipv6, zaddr, sizeof(struct in6_addr))) {
 		t->mode = QED_FILTER_CONFIG_MODE_IP_DEST;
 	} else {
-		DP_INFO(edev, "Invalid N-tuple\n");
+		NL_SET_ERR_MSG_MOD(extack, "Invalid N-tuple");
 		return -EOPNOTSUPP;
 	}
 
@@ -1752,7 +1752,7 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
 	if (err)
 		return err;
 
-	return qede_set_v6_tuple_to_profile(edev, t, &zero_addr);
+	return qede_set_v6_tuple_to_profile(t, &zero_addr, NULL);
 }
 
 static int
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 2/14
#4 lore raw

Re: [PATCH net-next v2 02/14] net: qede: use extack in qede_set_v6_tuple_to_profile()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_set_v6_tuple_to_profile() to take extack, and drop the edev argument.

Convert DP_INFO call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_set_v6_tuple_to_profile(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#5 lore raw

PATCH v2 3/14 net: qede: use extack in qede_set_v4_tuple_to_profile()

In reply to Asbjørn Sloth Tønnesen

Convert qede_set_v4_tuple_to_profile() to take extack, and drop the edev argument.

Convert DP_INFO call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_set_v4_tuple_to_profile(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
index 0f951d00b10e..6f4c4a5d6c77 100644
@@ -1520,8 +1520,8 @@ static int qede_flow_spec_validate_unused(struct qede_dev *edev,
 	return 0;
 }
 
-static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
-					struct qede_arfs_tuple *t)
+static int qede_set_v4_tuple_to_profile(struct qede_arfs_tuple *t,
+					struct netlink_ext_ack *extack)
 {
 	/* We must have Only 4-tuples/l4 port/src ip/dst ip
 	 * as an input.
@@ -1538,7 +1538,7 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
 		   t->dst_ipv4 && !t->src_ipv4) {
 		t->mode = QED_FILTER_CONFIG_MODE_IP_DEST;
 	} else {
-		DP_INFO(edev, "Invalid N-tuple\n");
+		NL_SET_ERR_MSG_MOD(extack, "Invalid N-tuple");
 		return -EOPNOTSUPP;
 	}
 
@@ -1779,7 +1779,7 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
 	if (err)
 		return err;
 
-	return qede_set_v4_tuple_to_profile(edev, t);
+	return qede_set_v4_tuple_to_profile(t, NULL);
 }
 
 static int
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 3/14
#6 lore raw

Re: [PATCH net-next v2 03/14] net: qede: use extack in qede_set_v4_tuple_to_profile()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_set_v4_tuple_to_profile() to take extack, and drop the edev argument.

Convert DP_INFO call to use NL_SET_ERR_MSG_MOD instead.

In calls to qede_set_v4_tuple_to_profile(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#7 lore raw

PATCH v2 4/14 net: qede: use extack in qede_flow_parse_v6_common()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_v6_common() to take extack, and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

Pass extack in calls to qede_flow_parse_ports() and qede_set_v6_tuple_to_profile().

In calls to qede_flow_parse_v6_common(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +9 -8
index 6f4c4a5d6c77..f5f8bbe8a64c 100644
@@ -1722,8 +1722,9 @@ qede_flow_parse_ports(struct flow_rule *rule, struct qede_arfs_tuple *t,
 }
 
 static int
-qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
-			  struct qede_arfs_tuple *t)
+qede_flow_parse_v6_common(struct flow_rule *rule,
+			  struct qede_arfs_tuple *t,
+			  struct netlink_ext_ack *extack)
 {
 	struct in6_addr zero_addr, addr;
 	int err;
@@ -1739,8 +1740,8 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
 		     memcmp(&match.mask->src, &addr, sizeof(addr))) ||
 		    (memcmp(&match.key->dst, &zero_addr, sizeof(addr)) &&
 		     memcmp(&match.mask->dst, &addr, sizeof(addr)))) {
-			DP_NOTICE(edev,
-				  "Do not support IPv6 address prefix/mask\n");
+			NL_SET_ERR_MSG_MOD(extack,
+					   "Do not support IPv6 address prefix/mask");
 			return -EINVAL;
 		}
 
@@ -1748,11 +1749,11 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
 		memcpy(&t->dst_ipv6, &match.key->dst, sizeof(addr));
 	}
 
-	err = qede_flow_parse_ports(rule, t, NULL);
+	err = qede_flow_parse_ports(rule, t, extack);
 	if (err)
 		return err;
 
-	return qede_set_v6_tuple_to_profile(t, &zero_addr, NULL);
+	return qede_set_v6_tuple_to_profile(t, &zero_addr, extack);
 }
 
 static int
@@ -1789,7 +1790,7 @@ qede_flow_parse_tcp_v6(struct qede_dev *edev, struct flow_rule *rule,
 	tuple->ip_proto = IPPROTO_TCP;
 	tuple->eth_proto = htons(ETH_P_IPV6);
 
-	return qede_flow_parse_v6_common(edev, rule, tuple);
+	return qede_flow_parse_v6_common(rule, tuple, NULL);
 }
 
 static int
@@ -1809,7 +1810,7 @@ qede_flow_parse_udp_v6(struct qede_dev *edev, struct flow_rule *rule,
 	tuple->ip_proto = IPPROTO_UDP;
 	tuple->eth_proto = htons(ETH_P_IPV6);
 
-	return qede_flow_parse_v6_common(edev, rule, tuple);
+	return qede_flow_parse_v6_common(rule, tuple, NULL);
 }
 
 static int
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 4/14
#8 lore raw

Re: [PATCH net-next v2 04/14] net: qede: use extack in qede_flow_parse_v6_common()

Quoted 8 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_v6_common() to take extack, and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

Pass extack in calls to qede_flow_parse_ports() and qede_set_v6_tuple_to_profile().

Quoted 6 lines

In calls to qede_flow_parse_v6_common(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#9 lore raw

PATCH v2 5/14 net: qede: use extack in qede_flow_parse_v4_common()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_v4_common() to take extack, and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

Pass extack in calls to qede_flow_parse_ports() and qede_set_v4_tuple_to_profile().

In calls to qede_flow_parse_v4_common(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +9 -7
index f5f8bbe8a64c..28e4d54dbca1 100644
@@ -1757,8 +1757,9 @@ qede_flow_parse_v6_common(struct flow_rule *rule,
 }
 
 static int
-qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
-			struct qede_arfs_tuple *t)
+qede_flow_parse_v4_common(struct flow_rule *rule,
+			  struct qede_arfs_tuple *t,
+			  struct netlink_ext_ack *extack)
 {
 	int err;
 
@@ -1768,7 +1769,8 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
 		flow_rule_match_ipv4_addrs(rule, &match);
 		if ((match.key->src && match.mask->src != htonl(U32_MAX)) ||
 		    (match.key->dst && match.mask->dst != htonl(U32_MAX))) {
-			DP_NOTICE(edev, "Do not support ipv4 prefix/masks\n");
+			NL_SET_ERR_MSG_MOD(extack,
+					   "Do not support ipv4 prefix/masks");
 			return -EINVAL;
 		}
 
@@ -1776,11 +1778,11 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
 		t->dst_ipv4 = match.key->dst;
 	}
 
-	err = qede_flow_parse_ports(rule, t, NULL);
+	err = qede_flow_parse_ports(rule, t, extack);
 	if (err)
 		return err;
 
-	return qede_set_v4_tuple_to_profile(t, NULL);
+	return qede_set_v4_tuple_to_profile(t, extack);
 }
 
 static int
@@ -1800,7 +1802,7 @@ qede_flow_parse_tcp_v4(struct qede_dev *edev, struct flow_rule *rule,
 	tuple->ip_proto = IPPROTO_TCP;
 	tuple->eth_proto = htons(ETH_P_IP);
 
-	return qede_flow_parse_v4_common(edev, rule, tuple);
+	return qede_flow_parse_v4_common(rule, tuple, NULL);
 }
 
 static int
@@ -1820,7 +1822,7 @@ qede_flow_parse_udp_v4(struct qede_dev *edev, struct flow_rule *rule,
 	tuple->ip_proto = IPPROTO_UDP;
 	tuple->eth_proto = htons(ETH_P_IP);
 
-	return qede_flow_parse_v4_common(edev, rule, tuple);
+	return qede_flow_parse_v4_common(rule, tuple, NULL);
 }
 
 static int
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 5/14
#10 lore raw

Re: [PATCH net-next v2 05/14] net: qede: use extack in qede_flow_parse_v4_common()

Quoted 8 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_v4_common() to take extack, and drop the edev argument.

Convert DP_NOTICE call to use NL_SET_ERR_MSG_MOD instead.

Pass extack in calls to qede_flow_parse_ports() and qede_set_v4_tuple_to_profile().

Quoted 6 lines

In calls to qede_flow_parse_v4_common(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#11 lore raw

PATCH v2 6/14 net: qede: use extack in qede_flow_parse_tcp_v6()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_tcp_v6() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v6_common().

In call to qede_flow_parse_tcp_v6(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
index 28e4d54dbca1..ddf1d6b0fc83 100644
@@ -1786,13 +1786,13 @@ qede_flow_parse_v4_common(struct flow_rule *rule,
 }
 
 static int
-qede_flow_parse_tcp_v6(struct qede_dev *edev, struct flow_rule *rule,
-		     struct qede_arfs_tuple *tuple)
+qede_flow_parse_tcp_v6(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
+		       struct netlink_ext_ack *extack)
 {
 	tuple->ip_proto = IPPROTO_TCP;
 	tuple->eth_proto = htons(ETH_P_IPV6);
 
-	return qede_flow_parse_v6_common(rule, tuple, NULL);
+	return qede_flow_parse_v6_common(rule, tuple, extack);
 }
 
 static int
@@ -1862,7 +1862,7 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IP))
 		rc = qede_flow_parse_tcp_v4(edev, rule, tuple);
 	else if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IPV6))
-		rc = qede_flow_parse_tcp_v6(edev, rule, tuple);
+		rc = qede_flow_parse_tcp_v6(rule, tuple, NULL);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IP))
 		rc = qede_flow_parse_udp_v4(edev, rule, tuple);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IPV6))
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 6/14
#12 lore raw

Re: [PATCH net-next v2 06/14] net: qede: use extack in qede_flow_parse_tcp_v6()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_tcp_v6() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v6_common().

In call to qede_flow_parse_tcp_v6(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#13 lore raw

PATCH v2 7/14 net: qede: use extack in qede_flow_parse_tcp_v4()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_tcp_v4() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v4_common().

In call to qede_flow_parse_tcp_v4(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
index ddf1d6b0fc83..9fd08ee252ae 100644
@@ -1796,13 +1796,13 @@ qede_flow_parse_tcp_v6(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
 }
 
 static int
-qede_flow_parse_tcp_v4(struct qede_dev *edev, struct flow_rule *rule,
-		     struct qede_arfs_tuple *tuple)
+qede_flow_parse_tcp_v4(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
+		       struct netlink_ext_ack *extack)
 {
 	tuple->ip_proto = IPPROTO_TCP;
 	tuple->eth_proto = htons(ETH_P_IP);
 
-	return qede_flow_parse_v4_common(rule, tuple, NULL);
+	return qede_flow_parse_v4_common(rule, tuple, extack);
 }
 
 static int
@@ -1860,7 +1860,7 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	}
 
 	if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IP))
-		rc = qede_flow_parse_tcp_v4(edev, rule, tuple);
+		rc = qede_flow_parse_tcp_v4(rule, tuple, NULL);
 	else if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IPV6))
 		rc = qede_flow_parse_tcp_v6(rule, tuple, NULL);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IP))
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 7/14
#14 lore raw

Re: [PATCH net-next v2 07/14] net: qede: use extack in qede_flow_parse_tcp_v4()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_tcp_v4() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v4_common().

In call to qede_flow_parse_tcp_v4(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#15 lore raw

PATCH v2 8/14 net: qede: use extack in qede_flow_parse_udp_v6()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_udp_v6() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v6_common().

In call to qede_flow_parse_udp_v6(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
index 9fd08ee252ae..abeb873f58f3 100644
@@ -1806,13 +1806,13 @@ qede_flow_parse_tcp_v4(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
 }
 
 static int
-qede_flow_parse_udp_v6(struct qede_dev *edev, struct flow_rule *rule,
-		     struct qede_arfs_tuple *tuple)
+qede_flow_parse_udp_v6(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
+		       struct netlink_ext_ack *extack)
 {
 	tuple->ip_proto = IPPROTO_UDP;
 	tuple->eth_proto = htons(ETH_P_IPV6);
 
-	return qede_flow_parse_v6_common(rule, tuple, NULL);
+	return qede_flow_parse_v6_common(rule, tuple, extack);
 }
 
 static int
@@ -1866,7 +1866,7 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IP))
 		rc = qede_flow_parse_udp_v4(edev, rule, tuple);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IPV6))
-		rc = qede_flow_parse_udp_v6(edev, rule, tuple);
+		rc = qede_flow_parse_udp_v6(rule, tuple, NULL);
 	else
 		DP_NOTICE(edev, "Invalid protocol request\n");
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 8/14
#16 lore raw

Re: [PATCH net-next v2 08/14] net: qede: use extack in qede_flow_parse_udp_v6()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_udp_v6() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v6_common().

In call to qede_flow_parse_udp_v6(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#17 lore raw

PATCH v2 9/14 net: qede: use extack in qede_flow_parse_udp_v4()

In reply to Asbjørn Sloth Tønnesen

Convert qede_flow_parse_udp_v4() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v4_common().

In call to qede_flow_parse_udp_v4(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -4
index abeb873f58f3..69dbd615b653 100644
@@ -1816,13 +1816,13 @@ qede_flow_parse_udp_v6(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
 }
 
 static int
-qede_flow_parse_udp_v4(struct qede_dev *edev, struct flow_rule *rule,
-		     struct qede_arfs_tuple *tuple)
+qede_flow_parse_udp_v4(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
+		       struct netlink_ext_ack *extack)
 {
 	tuple->ip_proto = IPPROTO_UDP;
 	tuple->eth_proto = htons(ETH_P_IP);
 
-	return qede_flow_parse_v4_common(rule, tuple, NULL);
+	return qede_flow_parse_v4_common(rule, tuple, extack);
 }
 
 static int
@@ -1864,7 +1864,7 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	else if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IPV6))
 		rc = qede_flow_parse_tcp_v6(rule, tuple, NULL);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IP))
-		rc = qede_flow_parse_udp_v4(edev, rule, tuple);
+		rc = qede_flow_parse_udp_v4(rule, tuple, NULL);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IPV6))
 		rc = qede_flow_parse_udp_v6(rule, tuple, NULL);
 	else
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 9/14
#18 lore raw

Re: [PATCH net-next v2 09/14] net: qede: use extack in qede_flow_parse_udp_v4()

Quoted 11 lines · Asbjørn Sloth Tønnesen

Convert qede_flow_parse_udp_v4() to take extack,
and drop the edev argument.

Pass extack in call to qede_flow_parse_v4_common().

In call to qede_flow_parse_udp_v4(), use NULL as extack for now, until a subsequent patch makes extack available.

Only compile tested.

#19 lore raw

PATCH v2 10/14 net: qede: add extack in qede_add_tc_flower_fltr()

In reply to Asbjørn Sloth Tønnesen

Define extack locally, to reduce line lengths and aid future users.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +2 -1
index 69dbd615b653..09ffcb86924b 100644
@@ -1876,6 +1876,7 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 			    struct flow_cls_offload *f)
 {
+	struct netlink_ext_ack *extack = f->common.extack;
 	struct qede_arfs_fltr_node *n;
 	struct qede_arfs_tuple t;
 	int min_hlen, rc;
@@ -1903,7 +1904,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 	}
 
 	/* parse tc actions and get the vf_id */
-	rc = qede_parse_actions(edev, &f->rule->action, f->common.extack);
+	rc = qede_parse_actions(edev, &f->rule->action, extack);
 	if (rc)
 		goto unlock;
 
Signature · 1 line
2.43.0
#21 lore raw

PATCH v2 11/14 net: qede: use extack in qede_parse_flow_attr()

In reply to Asbjørn Sloth Tønnesen

Convert qede_parse_flow_attr() to take extack, and drop the edev argument.

Convert DP_NOTICE calls to use NL_SET_ERR_MSG_* instead.

Pass extack in calls to qede_flow_parse_{tcp,udp}_v{4,6}().

In calls to qede_parse_flow_attr(), if extack is unavailable, then use NULL for now, until a subsequent patch makes extack available.

Only compile tested.

---
 .../net/ethernet/qlogic/qede/qede_filter.c    | 26 ++++++++++---------
 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +14 -12
index 09ffcb86924b..8c1c15b73125 100644
@@ -1826,8 +1826,9 @@ qede_flow_parse_udp_v4(struct flow_rule *rule, struct qede_arfs_tuple *tuple,
 }
 
 static int
-qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
-		     struct flow_rule *rule, struct qede_arfs_tuple *tuple)
+qede_parse_flow_attr(__be16 proto, struct flow_rule *rule,
+		     struct qede_arfs_tuple *tuple,
+		     struct netlink_ext_ack *extack)
 {
 	struct flow_dissector *dissector = rule->match.dissector;
 	int rc = -EINVAL;
@@ -1841,14 +1842,15 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	      BIT_ULL(FLOW_DISSECTOR_KEY_BASIC) |
 	      BIT_ULL(FLOW_DISSECTOR_KEY_IPV6_ADDRS) |
 	      BIT_ULL(FLOW_DISSECTOR_KEY_PORTS))) {
-		DP_NOTICE(edev, "Unsupported key set:0x%llx\n",
-			  dissector->used_keys);
+		NL_SET_ERR_MSG_FMT_MOD(extack, "Unsupported key used: 0x%llx",
+				       dissector->used_keys);
 		return -EOPNOTSUPP;
 	}
 
 	if (proto != htons(ETH_P_IP) &&
 	    proto != htons(ETH_P_IPV6)) {
-		DP_NOTICE(edev, "Unsupported proto=0x%x\n", proto);
+		NL_SET_ERR_MSG_FMT_MOD(extack, "Unsupported proto=0x%x",
+				       proto);
 		return -EPROTONOSUPPORT;
 	}
 
@@ -1860,15 +1862,15 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
 	}
 
 	if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IP))
-		rc = qede_flow_parse_tcp_v4(rule, tuple, NULL);
+		rc = qede_flow_parse_tcp_v4(rule, tuple, extack);
 	else if (ip_proto == IPPROTO_TCP && proto == htons(ETH_P_IPV6))
-		rc = qede_flow_parse_tcp_v6(rule, tuple, NULL);
+		rc = qede_flow_parse_tcp_v6(rule, tuple, extack);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IP))
-		rc = qede_flow_parse_udp_v4(rule, tuple, NULL);
+		rc = qede_flow_parse_udp_v4(rule, tuple, extack);
 	else if (ip_proto == IPPROTO_UDP && proto == htons(ETH_P_IPV6))
-		rc = qede_flow_parse_udp_v6(rule, tuple, NULL);
+		rc = qede_flow_parse_udp_v6(rule, tuple, extack);
 	else
-		DP_NOTICE(edev, "Invalid protocol request\n");
+		NL_SET_ERR_MSG_MOD(extack, "Invalid protocol request");
 
 	return rc;
 }
@@ -1889,7 +1891,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 	}
 
 	/* parse flower attribute and prepare filter */
-	rc = qede_parse_flow_attr(edev, proto, f->rule, &t);
+	rc = qede_parse_flow_attr(proto, f->rule, &t, extack);
 	if (rc)
 		goto unlock;
 
@@ -2015,7 +2017,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
 	if (IS_ERR(flow))
 		return PTR_ERR(flow);
 
-	err = qede_parse_flow_attr(edev, proto, flow->rule, t);
+	err = qede_parse_flow_attr(proto, flow->rule, t, NULL);
 	if (err)
 		goto err_out;
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 11/14
#22 lore raw

Re: [PATCH net-next v2 11/14] net: qede: use extack in qede_parse_flow_attr()

Quoted 7 lines · Asbjørn Sloth Tønnesen

Convert qede_parse_flow_attr() to take extack, and drop the edev argument.

Convert DP_NOTICE calls to use NL_SET_ERR_MSG_* instead.

Pass extack in calls to qede_flow_parse_{tcp,udp}_v{4,6}().

Quoted 7 lines

In calls to qede_parse_flow_attr(), if extack is unavailable, then use NULL for now, until a subsequent patch makes extack available.

Only compile tested.

#23 lore raw

PATCH v2 12/14 net: qede: use faked extack in qede_flow_spec_to_rule()

In reply to Asbjørn Sloth Tønnesen

Since qede_parse_flow_attr() now does error reporting through extack, then give it a fake extack and extract the error message afterwards if one was set.

The extracted error message is then passed on through DP_NOTICE(), including messages that was earlier issued with DP_INFO().

This fake extack approach is already used by
mlxsw_env_linecard_modules_power_mode_apply() in
drivers/net/ethernet/mellanox/mlxsw/core_env.c

Only compile tested.

---
Note:
Even through _msg is marked in include/linux/netlink.h as "don't access directly, use NL_SET_ERR_MSG", then the comment above NL_SET_ERR_MSG, seams to indicate that it should be fine to access it directly if for reading, as is done other places. I could also add a NL_GET_ERR_MSG but I would rather not do that in this series.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -1
index 8c1c15b73125..b83432744a03 100644
@@ -1990,6 +1990,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
 {
 	struct ethtool_rx_flow_spec_input input = {};
 	struct ethtool_rx_flow_rule *flow;
+	struct netlink_ext_ack extack;
 	__be16 proto;
 	int err;
 
@@ -2017,7 +2018,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
 	if (IS_ERR(flow))
 		return PTR_ERR(flow);
 
-	err = qede_parse_flow_attr(proto, flow->rule, t, NULL);
+	err = qede_parse_flow_attr(proto, flow->rule, t, &extack);
 	if (err)
 		goto err_out;
 
@@ -2025,6 +2026,8 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
 	err = qede_flow_spec_validate(edev, &flow->rule->action, t,
 				      fs->location);
 err_out:
+	if (extack._msg)
+		DP_NOTICE(edev, "%s\n", extack._msg);
 	ethtool_rx_flow_rule_destroy(flow);
 	return err;
 
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 12/14
#24 lore raw

Re: [PATCH net-next v2 12/14] net: qede: use faked extack in qede_flow_spec_to_rule()

Quoted 16 lines · Asbjørn Sloth Tønnesen

Since qede_parse_flow_attr() now does error reporting through extack, then give it a fake extack and extract the error message afterwards if one was set.

The extracted error message is then passed on through DP_NOTICE(), including messages that was earlier issued with DP_INFO().

This fake extack approach is already used by
mlxsw_env_linecard_modules_power_mode_apply() in
drivers/net/ethernet/mellanox/mlxsw/core_env.c

Only compile tested.

Quoted 8 lines

---
Note:
Even through _msg is marked in include/linux/netlink.h as "don't access directly, use NL_SET_ERR_MSG", then the comment above NL_SET_ERR_MSG, seams to indicate that it should be fine to access it directly if for reading, as is done other places. I could also add a NL_GET_ERR_MSG but I would rather not do that in this series.

#25 lore raw

PATCH v2 13/14 net: qede: propagate extack through qede_flow_spec_validate()

In reply to Asbjørn Sloth Tønnesen

Pass extack to qede_flow_spec_validate() when called in qede_flow_spec_to_rule().

Pass extack to qede_parse_actions().

Not converting qede_flow_spec_validate() to use extack for errors, as it's only called from qede_flow_spec_to_rule(), where extack is faked into a DP_NOTICE anyway, so opting to keep DP_VERBOSE/DP_NOTICE usage.

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +4 -3
index b83432744a03..e616855d8891 100644
@@ -1953,7 +1953,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 static int qede_flow_spec_validate(struct qede_dev *edev,
 				   struct flow_action *flow_action,
 				   struct qede_arfs_tuple *t,
-				   __u32 location)
+				   __u32 location,
+				   struct netlink_ext_ack *extack)
 {
 	int err;
 
@@ -1977,7 +1978,7 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
 		return -EINVAL;
 	}
 
-	err = qede_parse_actions(edev, flow_action, NULL);
+	err = qede_parse_actions(edev, flow_action, extack);
 	if (err)
 		return err;
 
@@ -2024,7 +2025,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
 
 	/* Make sure location is valid and filter isn't already set */
 	err = qede_flow_spec_validate(edev, &flow->rule->action, t,
-				      fs->location);
+				      fs->location, &extack);
 err_out:
 	if (extack._msg)
 		DP_NOTICE(edev, "%s\n", extack._msg);
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 13/14
#26 lore raw

Re: [PATCH net-next v2 13/14] net: qede: propagate extack through qede_flow_spec_validate()

Quoted 5 lines · Asbjørn Sloth Tønnesen

Pass extack to qede_flow_spec_validate() when called in qede_flow_spec_to_rule().

Pass extack to qede_parse_actions().

Quoted 8 lines

Not converting qede_flow_spec_validate() to use extack for errors, as it's only called from qede_flow_spec_to_rule(), where extack is faked into a DP_NOTICE anyway, so opting to keep DP_VERBOSE/DP_NOTICE usage.

Only compile tested.

#27 lore raw

PATCH v2 14/14 net: qede: use extack in qede_parse_actions()

In reply to Asbjørn Sloth Tønnesen

Convert DP_NOTICE/DP_INFO to NL_SET_ERR_MSG_MOD.

Keep edev around for use with QEDE_RSS_COUNT().

Only compile tested.

---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +3 -2
index e616855d8891..9c72febc6a42 100644
@@ -1671,7 +1671,7 @@ static int qede_parse_actions(struct qede_dev *edev,
 	int i;
 
 	if (!flow_action_has_entries(flow_action)) {
-		DP_NOTICE(edev, "No actions received\n");
+		NL_SET_ERR_MSG_MOD(extack, "No actions received");
 		return -EINVAL;
 	}
 
@@ -1687,7 +1687,8 @@ static int qede_parse_actions(struct qede_dev *edev,
 				break;
 
 			if (act->queue.index >= QEDE_RSS_COUNT(edev)) {
-				DP_INFO(edev, "Queue out-of-bounds\n");
+				NL_SET_ERR_MSG_MOD(extack,
+						   "Queue out-of-bounds");
 				return -EINVAL;
 			}
 			break;
Signature · 1 line
2.43.0
reviewer
#29 lore raw
In reply to Asbjørn Sloth Tønnesen
Quoted 10 lines · Asbjørn Sloth Tønnesen

This series converts the filter code in the qede driver to use NL_SET_ERR_MSG_*(extack, ...) for error handling.

Patch 1-12 converts qede_parse_flow_attr() to use extack, along with all it's static helper functions.

qede_parse_flow_attr() is used in two places:
- qede_add_tc_flower_fltr()
- qede_flow_spec_to_rule()

Quoted 6 lines

In the latter call site extack is faked in the same way as is done in mlxsw (patch 12).

While the conversion is going on, some error messages are silenced in between patch 1-12. If wanted could squash patch 1-12 in a v3, but I felt that it would be easier to review as 12 more trivial patches.

FWIIW, I like the easy to review approach taken here :)

Quoted 2 lines

Patch 13 and 14, finishes up by converting qede_parse_actions(), and ensures that extack is propagated to it, in both call contexts.

...

#30 lore raw
In reply to Asbjørn Sloth Tønnesen
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Wed, 8 May 2024 14:33:48 +0000 you wrote:

This series converts the filter code in the qede driver to use NL_SET_ERR_MSG_*(extack, ...) for error handling.

Patch 1-12 converts qede_parse_flow_attr() to use extack, along with all it's static helper functions.

qede_parse_flow_attr() is used in two places:
- qede_add_tc_flower_fltr()
- qede_flow_spec_to_rule()

[...]

Here is the summary with links:
- [net-next,v2,01/14] net: qede: use extack in qede_flow_parse_ports()

    https://git.kernel.org/netdev/net-next/c/a7c9540e967b
  - [net-next,v2,02/14] net: qede: use extack in qede_set_v6_tuple_to_profile()
    https://git.kernel.org/netdev/net-next/c/6f88f1257a40
  - [net-next,v2,03/14] net: qede: use extack in qede_set_v4_tuple_to_profile()
    https://git.kernel.org/netdev/net-next/c/f63a9dc507f9
  - [net-next,v2,04/14] net: qede: use extack in qede_flow_parse_v6_common()
    https://git.kernel.org/netdev/net-next/c/a62944d11ae1
  - [net-next,v2,05/14] net: qede: use extack in qede_flow_parse_v4_common()
    https://git.kernel.org/netdev/net-next/c/f2f993835b26
  - [net-next,v2,06/14] net: qede: use extack in qede_flow_parse_tcp_v6()
    https://git.kernel.org/netdev/net-next/c/b1a18d5781d4
  - [net-next,v2,07/14] net: qede: use extack in qede_flow_parse_tcp_v4()
    https://git.kernel.org/netdev/net-next/c/f84d52776ccf
  - [net-next,v2,08/14] net: qede: use extack in qede_flow_parse_udp_v6()
    https://git.kernel.org/netdev/net-next/c/b73ad5c7a72e
  - [net-next,v2,09/14] net: qede: use extack in qede_flow_parse_udp_v4()
    https://git.kernel.org/netdev/net-next/c/9c8f5ed8849c
  - [net-next,v2,10/14] net: qede: add extack in qede_add_tc_flower_fltr()
    https://git.kernel.org/netdev/net-next/c/f833a6555e9e
  - [net-next,v2,11/14] net: qede: use extack in qede_parse_flow_attr()
    https://git.kernel.org/netdev/net-next/c/d6883bceb254
  - [net-next,v2,12/14] net: qede: use faked extack in qede_flow_spec_to_rule()
    https://git.kernel.org/netdev/net-next/c/eb705d734525
  - [net-next,v2,13/14] net: qede: propagate extack through qede_flow_spec_validate()
    https://git.kernel.org/netdev/net-next/c/d2a437efd017
  - [net-next,v2,14/14] net: qede: use extack in qede_parse_actions()
    https://git.kernel.org/netdev/net-next/c/841548793bd6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html