[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191123071226.6501-7-bjorn.topel@gmail.com>
Date: Sat, 23 Nov 2019 08:12:25 +0100
From: Björn Töpel <bjorn.topel@...il.com>
To: netdev@...r.kernel.org, ast@...nel.org, daniel@...earbox.net
Cc: Björn Töpel <bjorn.topel@...el.com>,
bpf@...r.kernel.org, magnus.karlsson@...il.com,
magnus.karlsson@...el.com, jonathan.lemon@...il.com,
ecree@...arflare.com, thoiland@...hat.com,
andrii.nakryiko@...il.com, tariqt@...lanox.com,
saeedm@...lanox.com, maximmi@...lanox.com
Subject: [PATCH bpf-next v2 6/6] net/mlx5e: Start using xdp_call.h
From: Björn Töpel <bjorn.topel@...el.com>
This commit starts using xdp_call.h and the BPF dispatcher to avoid
the retpoline overhead.
Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 5 ++++-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
index f049e0ac308a..cc11b0db950e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
@@ -32,6 +32,7 @@
#include <linux/bpf_trace.h>
#include <net/xdp_sock.h>
+#include <linux/xdp_call.h>
#include "en/xdp.h"
#include "en/params.h"
@@ -117,6 +118,8 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq,
return sq->xmit_xdp_frame(sq, &xdptxd, &xdpi, 0);
}
+DECLARE_XDP_CALL(mlx5e_xdp_call);
+
/* returns true if packet was consumed by xdp */
bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
void *va, u16 *rx_headroom, u32 *len, bool xsk)
@@ -138,7 +141,7 @@ bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
xdp.handle = di->xsk.handle;
xdp.rxq = &rq->xdp_rxq;
- act = bpf_prog_run_xdp(prog, &xdp);
+ act = xdp_call_run(mlx5e_xdp_call, prog, &xdp);
if (xsk) {
u64 off = xdp.data - xdp.data_hard_start;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index e8d799c0dfda..0b26f9d7a968 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -39,6 +39,7 @@
#include <linux/if_bridge.h>
#include <net/page_pool.h>
#include <net/xdp_sock.h>
+#include <linux/xdp_call.h>
#include "eswitch.h"
#include "en.h"
#include "en/txrx.h"
@@ -4384,6 +4385,8 @@ static int mlx5e_xdp_update_state(struct mlx5e_priv *priv)
return 0;
}
+DEFINE_XDP_CALL(mlx5e_xdp_call);
+
static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
{
struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4428,6 +4431,8 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
old_prog = xchg(&priv->channels.params.xdp_prog, prog);
}
+ xdp_call_update(mlx5e_xdp_call, old_prog, prog);
+
if (old_prog)
bpf_prog_put(old_prog);
--
2.20.1
Powered by blists - more mailing lists