lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <920e5088-ace7-365c-4ef2-19cdedd6a625@mellanox.com>
Date:   Mon, 30 Jul 2018 16:05:11 +0300
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>,
        Saeed Mahameed <saeedm@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Eugenia Emantayev <eugenia@...lanox.com>
Subject: Re: [net-next 10/13] net/mlx5e: Add support for XDP_REDIRECT in
 device-out side



On 30/07/2018 3:10 PM, Jesper Dangaard Brouer wrote:
> 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.
> 

Thanks for spotting this!
I'll fix.

>> +			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;
>> +}
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ