From: Joshua Roys <roysjosh@gmail.com>
To: netdev@vger.kernel.org
Cc: ast@kernel.org, davem@davemloft.net, hawk@kernel.org,
john.fastabend@gmail.com, daniel@iogearbox.net, kuba@kernel.org,
bpf@vger.kernel.org, tariqt@nvidia.com,
linux-rdma@vger.kernel.org, Joshua Roys <roysjosh@gmail.com>
Subject: Re: [PATCH net-next] net: mlx4: Add support for XDP_REDIRECT
Date: Thu, 23 Sep 2021 13:31:22 -0400 [thread overview]
Message-ID: <CANoNxL_E_+MLu=Re-71J4FfFUcpA0met0AMnjtK2+jw6hGKCJw@mail.gmail.com> (raw)
In-Reply-To: <20210923161034.18975-1-roysjosh@gmail.com>
Adding requested maintainers to CC.
On Thu, Sep 23, 2021 at 12:11 PM Joshua Roys <roysjosh@gmail.com> wrote:
>
> Signed-off-by: Joshua Roys <roysjosh@gmail.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_rx.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> This is a pattern-match commit, based off of the mlx4 XDP_TX and other
> drivers' XDP_REDIRECT enablement patches. The goal was to get AF_XDP
> working in VPP and this was successful. Tested with a CX3.
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index 7f6d3b82c29b..557d7daac2d3 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -669,6 +669,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
> struct bpf_prog *xdp_prog;
> int cq_ring = cq->ring;
> bool doorbell_pending;
> + bool xdp_redir_flush;
> struct mlx4_cqe *cqe;
> struct xdp_buff xdp;
> int polled = 0;
> @@ -682,6 +683,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
> xdp_prog = rcu_dereference_bh(ring->xdp_prog);
> xdp_init_buff(&xdp, priv->frag_info[0].frag_stride, &ring->xdp_rxq);
> doorbell_pending = false;
> + xdp_redir_flush = false;
>
> /* We assume a 1:1 mapping between CQEs and Rx descriptors, so Rx
> * descriptor offset can be deduced from the CQE index instead of
> @@ -790,6 +792,14 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
> switch (act) {
> case XDP_PASS:
> break;
> + case XDP_REDIRECT:
> + if (xdp_do_redirect(dev, &xdp, xdp_prog) >= 0) {
> + xdp_redir_flush = true;
> + frags[0].page = NULL;
> + goto next;
> + }
> + trace_xdp_exception(dev, xdp_prog, act);
> + goto xdp_drop_no_cnt;
> case XDP_TX:
> if (likely(!mlx4_en_xmit_frame(ring, frags, priv,
> length, cq_ring,
> @@ -897,6 +907,9 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
> break;
> }
>
> + if (xdp_redir_flush)
> + xdp_do_flush();
> +
> if (likely(polled)) {
> if (doorbell_pending) {
> priv->tx_cq[TX_XDP][cq_ring]->xdp_busy = true;
> --
> 2.31.1
>
parent reply other threads:[~2021-09-23 17:31 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20210923161034.18975-1-roysjosh@gmail.com>]
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='CANoNxL_E_+MLu=Re-71J4FfFUcpA0met0AMnjtK2+jw6hGKCJw@mail.gmail.com' \
--to=roysjosh@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tariqt@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).