[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190228183809.25417-5-sthemmin@microsoft.com>
Date: Thu, 28 Feb 2019 10:38:07 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [RFC 4/6] ixgebvf: report xdp errors through extack
From: Stephen Hemminger <stephen@...workplumber.org>
In case of XDP errors report error string through extack.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 49e23afa05a2..2a3d96a20329 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -4436,7 +4436,8 @@ ixgbevf_features_check(struct sk_buff *skb, struct net_device *dev,
return features;
}
-static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
+static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
+ struct netlink_ext_ack *extack)
{
int i, frame_size = dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
struct ixgbevf_adapter *adapter = netdev_priv(dev);
@@ -4446,8 +4447,11 @@ static int ixgbevf_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
for (i = 0; i < adapter->num_rx_queues; i++) {
struct ixgbevf_ring *ring = adapter->rx_ring[i];
- if (frame_size > ixgbevf_rx_bufsz(ring))
+ if (frame_size > ixgbevf_rx_bufsz(ring)) {
+ NL_SET_ERR_MSG(extack,
+ "XDP does not support multiple buffers");
return -EINVAL;
+ }
}
old_prog = xchg(&adapter->xdp_prog, prog);
@@ -4483,12 +4487,13 @@ static int ixgbevf_xdp(struct net_device *dev, struct netdev_bpf *xdp)
switch (xdp->command) {
case XDP_SETUP_PROG:
- return ixgbevf_xdp_setup(dev, xdp->prog);
+ return ixgbevf_xdp_setup(dev, xdp->prog, xdp->extack);
case XDP_QUERY_PROG:
xdp->prog_id = adapter->xdp_prog ?
adapter->xdp_prog->aux->id : 0;
return 0;
default:
+ NL_SET_ERR_MSG(xdp->extack, "Unsupported XDP command");
return -EINVAL;
}
}
--
2.17.1
Powered by blists - more mailing lists