Re: [PATCH v2 bpf-next 1/2] bpf: Allow bpf_map_lookup_elem() on an xskmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31 May 2019, at 4:49, Björn Töpel wrote:

> On 2019-05-30 20:57, Jonathan Lemon wrote:
>> Currently, the AF_XDP code uses a separate map in order to
>> determine if an xsk is bound to a queue.  Instead of doing this,
>> have bpf_map_lookup_elem() return the queue_id, as a way of
>> indicating that there is a valid entry at the map index.
>>
>> Rearrange some xdp_sock members to eliminate structure holes.
>>
>> Signed-off-by: Jonathan Lemon <jonathan.lemon@xxxxxxxxx>
>> ---
>>   include/net/xdp_sock.h                            |  6 +++---
>>   kernel/bpf/verifier.c                             |  6 +++++-
>>   kernel/bpf/xskmap.c                               |  4 +++-
>>   .../selftests/bpf/verifier/prevent_map_lookup.c   | 15 ---------------
>>   4 files changed, 11 insertions(+), 20 deletions(-)
>>
>> diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
>> index d074b6d60f8a..7d84b1da43d2 100644
>> --- a/include/net/xdp_sock.h
>> +++ b/include/net/xdp_sock.h
>> @@ -57,12 +57,12 @@ struct xdp_sock {
>>   	struct net_device *dev;
>>   	struct xdp_umem *umem;
>>   	struct list_head flush_node;
>> -	u16 queue_id;
>> -	struct xsk_queue *tx ____cacheline_aligned_in_smp;
>> -	struct list_head list;
>> +	u32 queue_id;
>
> Why the increase of size?

Currently xskmaps are defined as size=4, so the returned pointer for
bpf must have that many bytes.  I was kicking around the idea of using
a union and returning { qid, zc }, but Alexei pointed out that doesn't
make a good API.

Besides, queue_index in struct xdp_rxq_info is already a u32.
-- 
Jonathan




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux