diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2018-05-24 10:46:07 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-05-24 21:36:15 -0400 |
commit | 389ab7f01af988c2a1ec5617eb0c7e220df1ef1c (patch) | |
tree | 3d21a2d33a7587b4db4841332117916f0f238246 /kernel/bpf/devmap.c | |
parent | 9940fbf633e8714c7c885f8d3848f508b8612069 (diff) |
xdp: introduce xdp_return_frame_rx_napi
When sending an xdp_frame through xdp_do_redirect call, then error
cases can happen where the xdp_frame needs to be dropped, and
returning an -errno code isn't sufficient/possible any-longer
(e.g. for cpumap case). This is already fully supported, by simply
calling xdp_return_frame.
This patch is an optimization, which provides xdp_return_frame_rx_napi,
which is a faster variant for these error cases. It take advantage of
the protection provided by XDP RX running under NAPI protection.
This change is mostly relevant for drivers using the page_pool
allocator as it can take advantage of this. (Tested with mlx5).
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/devmap.c')
-rw-r--r-- | kernel/bpf/devmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index ff2f3bf59f2f..a9cd5c93dd2b 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c | |||
@@ -239,7 +239,7 @@ static int bq_xmit_all(struct bpf_dtab_netdev *obj, | |||
239 | err = dev->netdev_ops->ndo_xdp_xmit(dev, xdpf); | 239 | err = dev->netdev_ops->ndo_xdp_xmit(dev, xdpf); |
240 | if (err) { | 240 | if (err) { |
241 | drops++; | 241 | drops++; |
242 | xdp_return_frame(xdpf); | 242 | xdp_return_frame_rx_napi(xdpf); |
243 | } else { | 243 | } else { |
244 | sent++; | 244 | sent++; |
245 | } | 245 | } |