[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180730141021.78b8260f@redhat.com>
Date: Mon, 30 Jul 2018 14:10:21 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Saeed Mahameed <saeedm@...lanox.com>
Cc: brouer@...hat.com, "David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org, Tariq Toukan <tariqt@...lanox.com>,
Eugenia Emantayev <eugenia@...lanox.com>
Subject: Re: [net-next 10/13] net/mlx5e: Add support for XDP_REDIRECT in
device-out side
On Thu, 26 Jul 2018 15:56:44 -0700 Saeed Mahameed <saeedm@...lanox.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
Powered by blists - more mailing lists