[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7900c83-3dbd-5e7a-57ec-2647e0371e75@cumulusnetworks.com>
Date: Fri, 23 Mar 2018 09:03:40 -0600
From: David Ahern <dsa@...ulusnetworks.com>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net,
roopa@...ulusnetworks.com, shm@...ulusnetworks.com,
jiri@...lanox.com, idosch@...lanox.com,
jakub.kicinski@...ronome.com, David Ahern <dsahern@...il.com>
Subject: Re: [PATCH RFC net-next 7/7] netdevsim: Add simple FIB resource
controller via devlink
On 3/23/18 9:01 AM, Jiri Pirko wrote:
> Fri, Mar 23, 2018 at 03:31:02PM CET, dsa@...ulusnetworks.com wrote:
>> On 3/23/18 12:50 AM, Jiri Pirko wrote:
>>>> +void nsim_devlink_setup(struct netdevsim *ns)
>>>> +{
>>>> + struct net *net = dev_net(ns->netdev);
>>>> + bool *reg_devlink = net_generic(net, nsim_devlink_id);
>>>> + struct devlink *devlink;
>>>> + int err = -ENOMEM;
>>>> +
>>>> + /* only one device per namespace controls devlink */
>>>> + if (!*reg_devlink) {
>>>> + ns->devlink = NULL;
>>>> + return;
>>>> + }
>>>> +
>>>> + devlink = devlink_alloc(&nsim_devlink_ops, 0);
>>>> + if (!devlink)
>>>> + return;
>>>> +
>>>> + devlink_net_set(devlink, net);
>>>> + err = devlink_register(devlink, &ns->dev);
>>>
>>> This reg_devlink construct looks odd. Why don't you leave the devlink
>>> instance in init_ns?
>>
>> It is a per-network namespace resource controller. Since struct devlink
>
> Wait a second. What do you mean by "per-network namespace"? Devlink
> instance is always associated with one physical device. Like an ASIC.
>
>
>> has a net entry, the simplest design is to put it into the namespace of
>> the controller. Without it, controlling resource sizes in namespace
>> 'foobar' has to be done from init_net, which is just wrong.
you need to look at how netdevsim creates a device per netdevice.
Powered by blists - more mailing lists