From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Petr Machata <petrm@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH net-next 3/6] net: dsa: add more extack messages in dsa_user_add_cls_matchall_mirred()
Date: Fri, 13 Sep 2024 18:29:12 +0300 [thread overview]
Message-ID: <20240913152915.2981126-4-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20240913152915.2981126-1-vladimir.oltean@nxp.com>
Do not leave -EOPNOTSUPP errors without an explanation. It is confusing
for the user to figure out what is wrong otherwise.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
net/dsa/user.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/net/dsa/user.c b/net/dsa/user.c
index 143e566e26b9..42ff3415c808 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -1377,11 +1377,17 @@ dsa_user_add_cls_matchall_mirred(struct net_device *dev,
struct dsa_port *to_dp;
int err;
- if (cls->common.protocol != htons(ETH_P_ALL))
+ if (cls->common.protocol != htons(ETH_P_ALL)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Can only offload \"protocol all\" matchall filter");
return -EOPNOTSUPP;
+ }
- if (!ds->ops->port_mirror_add)
+ if (!ds->ops->port_mirror_add) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Switch does not support mirroring operation");
return -EOPNOTSUPP;
+ }
if (!flow_action_basic_hw_stats_check(&cls->rule->action,
cls->common.extack))
@@ -1485,9 +1491,13 @@ static int dsa_user_add_cls_matchall(struct net_device *dev,
bool ingress)
{
const struct flow_action *action = &cls->rule->action;
+ struct netlink_ext_ack *extack = cls->common.extack;
- if (!flow_offload_has_one_action(action))
+ if (!flow_offload_has_one_action(action)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Cannot offload matchall filter with more than one action");
return -EOPNOTSUPP;
+ }
switch (action->entries[0].id) {
case FLOW_ACTION_MIRRED:
@@ -1495,6 +1505,7 @@ static int dsa_user_add_cls_matchall(struct net_device *dev,
case FLOW_ACTION_POLICE:
return dsa_user_add_cls_matchall_police(dev, cls, ingress);
default:
+ NL_SET_ERR_MSG_MOD(extack, "Unknown action");
break;
}
--
2.34.1
next prev parent reply other threads:[~2024-09-13 15:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-13 15:29 [RFC PATCH net-next 0/6] Mirroring to DSA CPU port Vladimir Oltean
2024-09-13 15:29 ` [RFC PATCH net-next 1/6] net: sched: propagate "skip_sw" flag to offload for flower and matchall Vladimir Oltean
2024-09-13 15:29 ` [RFC PATCH net-next 2/6] net: dsa: clean up dsa_user_add_cls_matchall() Vladimir Oltean
2024-09-13 15:29 ` Vladimir Oltean [this message]
2024-09-13 15:29 ` [RFC PATCH net-next 4/6] net: dsa: refuse cross-chip mirroring operations Vladimir Oltean
2024-09-13 15:29 ` [RFC PATCH net-next 5/6] net: dsa: allow matchall mirroring rules towards the CPU Vladimir Oltean
2024-09-13 15:29 ` [RFC PATCH net-next 6/6] net: mscc: ocelot: allow tc-flower mirred action towards foreign interfaces Vladimir Oltean
2024-10-04 11:13 ` [RFC PATCH net-next 0/6] Mirroring to DSA CPU port Vladimir Oltean
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=20240913152915.2981126-4-vladimir.oltean@nxp.com \
--to=vladimir.oltean@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@nvidia.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=xiyou.wangcong@gmail.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