lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190228183809.25417-6-sthemmin@microsoft.com>
Date:   Thu, 28 Feb 2019 10:38:08 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     netdev@...r.kernel.org
Cc:     Stephen Hemminger <stephen@...workplumber.org>
Subject: [RFC 5/6] mlx4: report errors through extack

From: Stephen Hemminger <stephen@...workplumber.org>

XDP errors should be reported via extack (back to command)
rather than on console.

Signed-off-by: Stephen Hemminger <stephen@...workplumber.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ