[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230805062700.235515-1-xu.xin16@zte.com.cn>
Date: Sat, 5 Aug 2023 06:27:00 +0000
From: xu <xu.xin.sc@...il.com>
To: edumazet@...gle.com
Cc: davem@...emloft.net,
dsahern@...nel.org,
kuba@...nel.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
yang.yang29@....com.cn,
xu.xin16@....com.cn
Subject: Re: [PATCH] udp_tunnel_nic: add net device refcount tracker
>> ---
>> net/ipv4/udp_tunnel_nic.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
>> index 029219749785..ce8f5c82b0a1 100644
>> --- a/net/ipv4/udp_tunnel_nic.c
>> +++ b/net/ipv4/udp_tunnel_nic.c
>> @@ -55,6 +55,9 @@ struct udp_tunnel_nic {
>> */
>> static struct workqueue_struct *udp_tunnel_nic_workqueue;
>>
>> +/* To track netdev_hold and netdev_put */
>> +static netdevice_tracker udp_tunnel_nic_devtracker;
>
>This looks wrong.
>
>> +
>> static const char *udp_tunnel_nic_tunnel_type_name(unsigned int type)
>> {
>> switch (type) {
>> @@ -825,7 +828,7 @@ static int udp_tunnel_nic_register(struct net_device *dev)
>> }
>>
>> utn->dev = dev;
>> - dev_hold(dev);
>> + netdev_hold(dev, &udp_tunnel_nic_devtracker, GFP_KERNEL);
>
>This is wrong. You need a separate netdevice_tracker per netdev_hold()
>
>For instance, this would need to be in "(struct udp_tunnel_nic)->dev_tracker"
Oh, Sorry, I misunderstand the usage of netdev_hold and its netdevice_tracker.
But cound you please add this this useful information into netdev_hold()' comment,
to prevent others from making the same mistakes with me.
Thanks!
Powered by blists - more mailing lists