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]
Date:   Thu, 30 Apr 2020 20:12:11 +0300
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>, sameehj@...zon.com
Cc:     Saeed Mahameed <saeedm@...lanox.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, zorik@...zon.com, akiyano@...zon.com,
        gtzalik@...zon.com,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Daniel Borkmann <borkmann@...earbox.net>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        John Fastabend <john.fastabend@...il.com>,
        Alexander Duyck <alexander.duyck@...il.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        David Ahern <dsahern@...il.com>,
        Willem de Bruijn <willemdebruijn.kernel@...il.com>,
        Ilias Apalodimas <ilias.apalodimas@...aro.org>,
        Lorenzo Bianconi <lorenzo@...nel.org>,
        steffen.klassert@...unet.com
Subject: Re: [PATCH net-next v2 28/33] mlx5: rx queue setup time determine
 frame_sz for XDP



On 4/30/2020 8:07 PM, Tariq Toukan wrote:
> 
> 
> On 4/30/2020 2:22 PM, Jesper Dangaard Brouer wrote:
>> The mlx5 driver have multiple memory models, which are also changed
>> according to whether a XDP bpf_prog is attached.
>>
>> The 'rx_striding_rq' setting is adjusted via ethtool priv-flags e.g.:
>>   # ethtool --set-priv-flags mlx5p2 rx_striding_rq off
>>
>> On the general case with 4K page_size and regular MTU packet, then
>> the frame_sz is 2048 and 4096 when XDP is enabled, in both modes.
>>
>> The info on the given frame size is stored differently depending on the
>> RQ-mode and encoded in a union in struct mlx5e_rq union wqe/mpwqe.
>> In rx striding mode rq->mpwqe.log_stride_sz is either 11 or 12, which
>> corresponds to 2048 or 4096 (MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ).
>> In non-striding mode (MLX5_WQ_TYPE_CYCLIC) the frag_stride is stored
>> in rq->wqe.info.arr[0].frag_stride, for the first fragment, which is
>> what the XDP case cares about.
>>
>> To reduce effect on fast-path, this patch determine the frame_sz at
>> setup time, to avoid determining the memory model runtime. Variable
>> is named first_frame_sz to make it clear that this is only the frame
>> size of the first fragment.
>>
>> This mlx5 driver does a DMA-sync on XDP_TX action, but grow is safe
>> as it have done a DMA-map on the entire PAGE_SIZE. The driver also
>> already does a XDP length check against sq->hw_mtu on the possible
>> XDP xmit paths mlx5e_xmit_xdp_frame() + mlx5e_xmit_xdp_frame_mpwqe().
>>
>> V2: Fix that frag_size need to be recalc before creating SKB.
>>
>> Cc: Tariq Toukan <tariqt@...lanox.com>
>> Cc: Saeed Mahameed <saeedm@...lanox.com>
>> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
>> ---
>>   drivers/net/ethernet/mellanox/mlx5/core/en.h      |    1 +
>>   drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c  |    1 +
>>   drivers/net/ethernet/mellanox/mlx5/core/en_main.c |    6 ++++++
>>   drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   |    2 ++
>>   4 files changed, 10 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
>> b/drivers/net/ethernet/mellanox/mlx5/core/en.h
>> index 23701c0e36ec..ba6a0ee297c6 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
>> @@ -652,6 +652,7 @@ struct mlx5e_rq {
>>       struct {
>>           u16            umem_headroom;
>>           u16            headroom;
>> +        u32            first_frame_sz;

I also think that a better name would be: frame0_sz, or frag0_sz.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ