From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: brouer@redhat.com, "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@mellanox.com>,
Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [net-next 10/13] net/mlx5e: Add support for XDP_REDIRECT in device-out side
Date: Mon, 30 Jul 2018 14:10:21 +0200 [thread overview]
Message-ID: <20180730141021.78b8260f@redhat.com> (raw)
In-Reply-To: <20180726225647.11926-11-saeedm@mellanox.com>
On Thu, 26 Jul 2018 15:56:44 -0700 Saeed Mahameed <saeedm@mellanox.com> wrote:
> +int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
> + u32 flags)
> +{
> + struct mlx5e_priv *priv = netdev_priv(dev);
> + struct mlx5e_xdpsq *sq;
> + int drops = 0;
> + int sq_num;
> + int i;
> +
> + if (unlikely(!test_bit(MLX5E_STATE_OPENED, &priv->state)))
> + return -ENETDOWN;
> +
> + if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
> + return -EINVAL;
> +
> + sq_num = smp_processor_id();
> +
> + if (unlikely(sq_num >= priv->channels.num))
> + return -ENXIO;
> +
> + sq = &priv->channels.c[sq_num]->xdpsq;
> +
> + if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state)))
> + return -ENETDOWN;
> +
> + for (i = 0; i < n; i++) {
> + struct xdp_frame *xdpf = frames[i];
> + struct mlx5e_xdp_info xdpi;
> +
> + xdpi.dma_addr = dma_map_single(sq->pdev, xdpf->data, xdpf->len,
> + DMA_TO_DEVICE);
> + if (unlikely(dma_mapping_error(sq->pdev, xdpi.dma_addr))) {
> + drops++;
I think you are missing a xdp_return_frame_rx_napi(xdpf) here.
> + continue;
> + }
> +
> + xdpi.xdpf = xdpf;
> +
> + if (unlikely(!mlx5e_xmit_xdp_frame(sq, &xdpi))) {
> + xdp_return_frame_rx_napi(xdpf);
> + drops++;
> + }
> + }
> +
> + if (flags & XDP_XMIT_FLUSH)
> + mlx5e_xmit_xdp_doorbell(sq);
> +
> + return n - drops;
> +}
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2018-07-30 13:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 22:56 [pull request][net-next 00/13] Mellanox, mlx5e updates 2018-07-26 (XDP redirect) Saeed Mahameed
2018-07-26 22:56 ` [net-next 01/13] net/mlx5e: Replace call to MPWQE free with dealloc in interface down flow Saeed Mahameed
2018-07-26 22:56 ` [net-next 02/13] net/mlx5e: Do not recycle RX pages " Saeed Mahameed
2018-07-26 22:56 ` [net-next 03/13] net/mlx5e: Gather all XDP pre-requisite checks in a single function Saeed Mahameed
2018-07-26 22:56 ` [net-next 04/13] net/mlx5e: Restrict the combination of large MTU and XDP Saeed Mahameed
2018-07-26 22:56 ` [net-next 05/13] net/mlx5e: Move XDP related code into new XDP files Saeed Mahameed
2018-07-26 22:56 ` [net-next 06/13] net/mlx5e: Add counter for XDP redirect in RX Saeed Mahameed
2018-07-26 22:56 ` [net-next 07/13] net/mlx5e: Make XDP xmit functions more generic Saeed Mahameed
2018-07-26 22:56 ` [net-next 08/13] net/mlx5e: Refactor XDP counters Saeed Mahameed
2018-07-26 22:56 ` [net-next 09/13] net/mlx5e: Re-order fields of struct mlx5e_xdpsq Saeed Mahameed
2018-07-26 22:56 ` [net-next 10/13] net/mlx5e: Add support for XDP_REDIRECT in device-out side Saeed Mahameed
2018-07-30 12:10 ` Jesper Dangaard Brouer [this message]
2018-07-30 13:05 ` Tariq Toukan
2018-07-30 13:06 ` Jesper Dangaard Brouer
2018-07-30 13:09 ` Tariq Toukan
2018-07-30 16:20 ` Jesper Dangaard Brouer
2018-07-30 17:49 ` [net-next PATCH] mlx5: handle DMA mapping error case for XDP redirect Jesper Dangaard Brouer
2018-07-31 6:35 ` Tariq Toukan
2018-07-31 16:47 ` David Miller
2018-07-26 22:56 ` [net-next 11/13] net/mlx5e: RX, Prefetch the xdp_frame data area Saeed Mahameed
2018-07-26 22:56 ` [net-next 12/13] net/mlx5e: TX, Move DB fields in TXQ-SQ struct Saeed Mahameed
2018-07-26 22:56 ` [net-next 13/13] net/mlx5e: TX, Use function to access sq_dma object in fifo Saeed Mahameed
2018-07-27 4:33 ` [pull request][net-next 00/13] Mellanox, mlx5e updates 2018-07-26 (XDP redirect) David Miller
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=20180730141021.78b8260f@redhat.com \
--to=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=eugenia@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=tariqt@mellanox.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).