On Thu, 26 Jul 2018 15:56:44 -0700 Saeed Mahameed <sae...@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