From: Jiri Pirko <jiri@resnulli.us>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
roopa@cumulusnetworks.com, shm@cumulusnetworks.com,
jiri@mellanox.com, idosch@mellanox.com,
jakub.kicinski@netronome.com, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH RFC net-next 7/7] netdevsim: Add simple FIB resource controller via devlink
Date: Sat, 24 Mar 2018 08:26:21 +0100 [thread overview]
Message-ID: <20180324072621.GA1891@nanopsycho> (raw)
In-Reply-To: <fe5a4e1f-5681-4d74-b586-0c727eed717e@cumulusnetworks.com>
Fri, Mar 23, 2018 at 04:13:14PM CET, dsa@cumulusnetworks.com wrote:
>On 3/23/18 9:05 AM, Jiri Pirko wrote:
>> Fri, Mar 23, 2018 at 04:03:40PM CET, dsa@cumulusnetworks.com wrote:
>>> On 3/23/18 9:01 AM, Jiri Pirko wrote:
>>>> Fri, Mar 23, 2018 at 03:31:02PM CET, dsa@cumulusnetworks.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.
>>
>> That means one devlink instance for each netdevsim device, doesn't it?
>>
>
>yes.
Still not sure how to handle namespaces in devlink. Originally, I
thought it would be okay to leave all devlink instances in init_ns.
Because what happens if you move netdev to another namespace? Should the
devlink move as well? What if you have multiple ports, each in different
namespace. Can user move devlink instance to another namespace? Etc.
next prev parent reply other threads:[~2018-03-24 7:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 22:57 [PATCH RFC net-next 0/7] net: Allow FIB notifiers to fail add and replace David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 1/7] net: Fix fib notifer to return errno David Ahern
2018-03-25 8:16 ` Ido Schimmel
2018-03-25 14:00 ` David Ahern
2018-03-25 15:37 ` Ido Schimmel
2018-03-22 22:57 ` [PATCH RFC net-next 2/7] net: Move call_fib_rule_notifiers up in fib_nl_newrule David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 3/7] net/ipv4: Move call_fib_entry_notifiers up for new routes David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 4/7] net/ipv4: Allow notifier to fail route repolace David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 5/7] net/ipv6: Move call_fib6_entry_notifiers up for route adds David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 6/7] devlink: Export methods to get and set namespace David Ahern
2018-03-22 22:57 ` [PATCH RFC net-next 7/7] netdevsim: Add simple FIB resource controller via devlink David Ahern
2018-03-23 6:50 ` Jiri Pirko
2018-03-23 14:31 ` David Ahern
2018-03-23 15:01 ` Jiri Pirko
2018-03-23 15:03 ` David Ahern
2018-03-23 15:05 ` Jiri Pirko
2018-03-23 15:13 ` David Ahern
2018-03-24 7:26 ` Jiri Pirko [this message]
2018-03-24 15:05 ` David Ahern
2018-03-24 16:02 ` Jiri Pirko
2018-03-25 14:24 ` David Ahern
2018-03-26 14:33 ` Jiri Pirko
2018-03-24 3:47 ` Jakub Kicinski
2018-03-24 15:02 ` David Ahern
2018-03-25 6:35 ` Jakub Kicinski
2018-03-25 14:27 ` David Ahern
2018-03-25 19:53 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180324072621.GA1891@nanopsycho \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=shm@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox