Subject: Re: [PATCH bpf-next 2/3] xdp: Refactor devmap allocation code for reuse

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Mon, 08 Jul 2019 17:19:23 +0200

"Jonathan Lemon" <[email-masked]> writes:

> On 5 Jul 2019, at 10:56, Toke Høiland-Jørgensen wrote:
>
>> From: Toke Høiland-Jørgensen <[email-masked]>
>>
>> The subsequent patch to add a new devmap sub-type can re-use much of 
>> the
>> initialisation and allocation code, so refactor it into separate 
>> functions.
>>
>> Signed-off-by: Toke Høiland-Jørgensen <[email-masked]>
>> ---
>>  kernel/bpf/devmap.c |  137 
>> +++++++++++++++++++++++++++++++--------------------
>>  1 file changed, 84 insertions(+), 53 deletions(-)
>>
>> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
>> index d83cf8ccc872..a2fe16362129 100644
>> --- a/kernel/bpf/devmap.c
>> +++ b/kernel/bpf/devmap.c
>> @@ -60,7 +60,7 @@ struct xdp_bulk_queue {
>>  struct bpf_dtab_netdev {
>>  	struct net_device *dev; /* must be first member, due to tracepoint 
>> */
>>  	struct bpf_dtab *dtab;
>> -	unsigned int bit;
>> +	unsigned int idx; /* keep track of map index for tracepoint */
>>  	struct xdp_bulk_queue __percpu *bulkq;
>>  	struct rcu_head rcu;
>>  };
>> @@ -75,28 +75,22 @@ struct bpf_dtab {
>>  static DEFINE_SPINLOCK(dev_map_lock);
>>  static LIST_HEAD(dev_map_list);
>>
>> -static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
>> +static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr 
>> *attr,
>> +			    bool check_memlock)
>
> This check_memlock parameter appears to be unused.

Ah yes, good catch! That was left over from when the patch set also
contained the "default map" stuff. Will fix.

-Toke