OSDN Git Service
Merge branch 'devlink-allow-devlink-instances-to-change-network-namespace'
Jiri Pirko says:
====================
devlink: allow devlink instances to change network namespace
Devlink from the beginning counts with network namespaces, but the
instances has been fixed to init_net.
Implement change of network namespace as part of "devlink reload"
procedure like this:
$ ip netns add testns1
$ devlink/devlink dev reload netdevsim/netdevsim10 netns testns1
This command reloads device "netdevsim10" into network
namespace "testns1".
Note that "devlink reload" reinstantiates driver objects, effectively it
reloads the driver instance, including possible hw reset etc. Newly
created netdevices respect the network namespace of the parent devlink
instance and according to that, they are created in target network
namespace.
Driver is able to refuse to be reloaded into different namespace. That
is the case of mlx4 right now.
FIB entries and rules are replayed during FIB notifier registration
which is triggered during reload (driver instance init). FIB notifier
is also registered to the target network namespace, that allows user
to use netdevsim devlink resources to setup per-namespace limits of FIB
entries and FIB rules. In fact, with multiple netdevsim instances
in each network namespace, user might setup different limits.
This maintains and extends current netdevsim resources behaviour.
Patch 1 prepares netdevsim code for the follow-up changes in the
patchset. It does not change the behaviour, only moves pet-init_netns
accounting to netdevsim instance, which is also in init_netns.
Patches 2-5 prepare the FIB notifier making it per-netns and to behave
correctly upon error conditions.
Patch 6 just exports a devlink_net helper so it can be used in drivers.
Patches 7-9 do preparations in mlxsw driver.
Patches 10-13 do preparations in netdevsim driver, namely patch 12
implements proper devlink reload where the driver instance objects are
actually re-created as they should be.
Patch 14 actually implements the possibility to reload into a different
network namespace.
Patch 15 adds needed selftests for devlink reload into namespace for
netdevsim driver.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>