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: <20191004062001.GB2264@nanopsycho>
Date:   Fri, 4 Oct 2019 08:20:01 +0200
From:   Jiri Pirko <jiri@...nulli.us>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, idosch@...lanox.com,
        dsahern@...il.com, tariqt@...lanox.com, saeedm@...lanox.com,
        kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org, shuah@...nel.org,
        mlxsw@...lanox.com
Subject: Re: [patch net-next v3 12/15] netdevsim: register port netdevices
 into net of device

Fri, Oct 04, 2019 at 01:21:21AM CEST, jakub.kicinski@...ronome.com wrote:
>On Thu,  3 Oct 2019 11:49:37 +0200, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@...lanox.com>
>> 
>> Register newly created port netdevice into net namespace
>> that the parent device belongs to.
>> 
>> Signed-off-by: Jiri Pirko <jiri@...lanox.com>
>
>Acked-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
>
>> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
>> index 0740940f41b1..2908e0a0d6e1 100644
>> --- a/drivers/net/netdevsim/netdev.c
>> +++ b/drivers/net/netdevsim/netdev.c
>> @@ -290,6 +290,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
>>  	if (!dev)
>>  		return ERR_PTR(-ENOMEM);
>>  
>> +	dev_net_set(dev, nsim_dev_net(nsim_dev));
>>  	ns = netdev_priv(dev);
>>  	ns->netdev = dev;
>>  	ns->nsim_dev = nsim_dev;
>> diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
>> index 702d951fe160..198ca31cec94 100644
>> --- a/drivers/net/netdevsim/netdevsim.h
>> +++ b/drivers/net/netdevsim/netdevsim.h
>> @@ -164,6 +164,11 @@ struct nsim_dev {
>>  	struct devlink_region *dummy_region;
>>  };
>>  
>> +static inline struct net *nsim_dev_net(struct nsim_dev *nsim_dev)
>> +{
>> +	return devlink_net(priv_to_devlink(nsim_dev));
>> +}
>
>Slight overkill to have a single-use helper for this? ;)

I wanted the code to be nice, also it is aligned with what mlxsw is
doing.


>
>>  int nsim_dev_init(void);
>>  void nsim_dev_exit(void);
>>  int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev);
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ