From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [RFC 5/6] mlx4: report errors through extack
Date: Thu, 28 Feb 2019 10:38:08 -0800 [thread overview]
Message-ID: <20190228183809.25417-6-sthemmin@microsoft.com> (raw)
In-Reply-To: <20190228183809.25417-1-sthemmin@microsoft.com>
From: Stephen Hemminger <stephen@networkplumber.org>
XDP errors should be reported via extack (back to command)
rather than on console.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index c1438ae52a11..72fb5570df20 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2779,7 +2779,8 @@ static int mlx4_en_set_tx_maxrate(struct net_device *dev, int queue_index, u32 m
return err;
}
-static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
+static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog,
+ struct netlink_ext_ack *extack)
{
struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = priv->mdev;
@@ -2816,8 +2817,10 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
return 0;
}
- if (!mlx4_en_check_xdp_mtu(dev, dev->mtu))
+ if (!mlx4_en_check_xdp_mtu(dev, dev->mtu)) {
+ NL_SET_ERR_MSG(extack, "MTU exceeds support XDP maximum");
return -EOPNOTSUPP;
+ }
tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
if (!tmp)
@@ -2870,8 +2873,8 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
if (port_up) {
err = mlx4_en_start_port(dev);
if (err) {
- en_err(priv, "Failed starting port %d for XDP change\n",
- priv->port);
+ NL_SET_ERR_MSG(extack,
+ "Failed starting port for XDP change");
queue_work(mdev->workqueue, &priv->watchdog_task);
}
}
@@ -2908,11 +2911,12 @@ static int mlx4_xdp(struct net_device *dev, struct netdev_bpf *xdp)
{
switch (xdp->command) {
case XDP_SETUP_PROG:
- return mlx4_xdp_set(dev, xdp->prog);
+ return mlx4_xdp_set(dev, xdp->prog, xdp->extack);
case XDP_QUERY_PROG:
xdp->prog_id = mlx4_xdp_query(dev);
return 0;
default:
+ NL_SET_ERR_MSG(xdp->extack, "Unsupported XDP command");
return -EINVAL;
}
}
--
2.17.1
next prev parent reply other threads:[~2019-02-28 18:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-28 18:38 [RFC 0/7] ndo_bpf error reporting Stephen Hemminger
2019-02-28 18:38 ` [RFC 1/6] bnxt: use extack for xdp error messages Stephen Hemminger
2019-02-28 18:43 ` Jakub Kicinski
2019-02-28 18:38 ` [RFC 2/6] ixgbe: use extack for xdp errors Stephen Hemminger
2019-02-28 19:04 ` Dan Williams
2019-02-28 18:38 ` [RFC 3/6] i40e: use extack for bpf errors Stephen Hemminger
2019-02-28 18:38 ` [RFC 4/6] ixgebvf: report xdp errors through extack Stephen Hemminger
2019-02-28 18:38 ` Stephen Hemminger [this message]
2019-02-28 18:38 ` [RFC 6/6] mlx5: report XDP " Stephen Hemminger
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=20190228183809.25417-6-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.