mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>
To: netdev@vger.kernel.org
Cc: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Manish Chopra" <manishc@marvell.com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel.com>
Subject: [PATCH net-next v2 12/14] net: qede: use faked extack in qede_flow_spec_to_rule()
Date: Wed,  8 May 2024 14:34:00 +0000	[thread overview]
Message-ID: <20240508143404.95901-13-ast@fiberby.net> (raw)
In-Reply-To: <20240508143404.95901-1-ast@fiberby.net>

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.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>

---
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(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index 8c1c15b73125..b83432744a03 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -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;
 
-- 
2.43.0


  parent reply	other threads:[~2024-05-08 14:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 14:33 [PATCH net-next v2 00/14] net: qede: convert filter code to use extack Asbjørn Sloth Tønnesen
2024-05-08 14:33 ` [PATCH net-next v2 01/14] net: qede: use extack in qede_flow_parse_ports() Asbjørn Sloth Tønnesen
2024-05-10 11:26   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 02/14] net: qede: use extack in qede_set_v6_tuple_to_profile() Asbjørn Sloth Tønnesen
2024-05-10 11:26   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 03/14] net: qede: use extack in qede_set_v4_tuple_to_profile() Asbjørn Sloth Tønnesen
2024-05-10 11:27   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 04/14] net: qede: use extack in qede_flow_parse_v6_common() Asbjørn Sloth Tønnesen
2024-05-10 11:27   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 05/14] net: qede: use extack in qede_flow_parse_v4_common() Asbjørn Sloth Tønnesen
2024-05-10 11:27   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 06/14] net: qede: use extack in qede_flow_parse_tcp_v6() Asbjørn Sloth Tønnesen
2024-05-10 11:28   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 07/14] net: qede: use extack in qede_flow_parse_tcp_v4() Asbjørn Sloth Tønnesen
2024-05-10 11:28   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 08/14] net: qede: use extack in qede_flow_parse_udp_v6() Asbjørn Sloth Tønnesen
2024-05-10 11:28   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 09/14] net: qede: use extack in qede_flow_parse_udp_v4() Asbjørn Sloth Tønnesen
2024-05-10 11:29   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 10/14] net: qede: add extack in qede_add_tc_flower_fltr() Asbjørn Sloth Tønnesen
2024-05-10 11:29   ` Simon Horman
2024-05-08 14:33 ` [PATCH net-next v2 11/14] net: qede: use extack in qede_parse_flow_attr() Asbjørn Sloth Tønnesen
2024-05-10 11:29   ` Simon Horman
2024-05-08 14:34 ` Asbjørn Sloth Tønnesen [this message]
2024-05-10 11:30   ` [PATCH net-next v2 12/14] net: qede: use faked extack in qede_flow_spec_to_rule() Simon Horman
2024-05-08 14:34 ` [PATCH net-next v2 13/14] net: qede: propagate extack through qede_flow_spec_validate() Asbjørn Sloth Tønnesen
2024-05-10 11:30   ` Simon Horman
2024-05-08 14:34 ` [PATCH net-next v2 14/14] net: qede: use extack in qede_parse_actions() Asbjørn Sloth Tønnesen
2024-05-10 11:31   ` Simon Horman
2024-05-10 11:25 ` [PATCH net-next v2 00/14] net: qede: convert filter code to use extack Simon Horman
2024-05-11  2:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240508143404.95901-13-ast@fiberby.net \
    --to=ast@fiberby.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®