mbox series

[SRU,F:linux-bluefield,0/4] Allow devlink instances to change network namespace

Message ID 20230113180915.426904-1-bodong@nvidia.com
Headers show
Series Allow devlink instances to change network namespace | expand

Message

Bodong Wang Jan. 13, 2023, 6:09 p.m. UTC
Some drivers, like mlxsw, are not interested in notifications coming in
for netdevices from other network namespaces. So introduce per-netns
notifiers and allow to reduce overhead by listening only for
notifications from the same netns. This is done by first two patches.

After we have per-net notifier, which allows to get only
notifications relevant to particular network namespace. That is enough
for drivers that have netdevs local in a particular namespace (cannot
move elsewhere).

However if netdev can change namespace, per-net notifier cannot be used.
Introduce dev_net variant that is basically per-net notifier with an
extension that re-registers the per-net notifier upon netdev namespace
change. Basically the per-net notifier follows the netdev into
namespace. This is done by the last two patches.

Jiri Pirko (4):
  net: push loops and nb calls into helper functions
  net: introduce per-netns netdevice notifiers
  net: push code from net notifier reg/unreg into helpers
  net: introduce dev_net notifier register/unregister variants

 include/linux/netdevice.h   |  23 ++++
 include/net/net_namespace.h |   5 +-
 net/core/dev.c              | 238 +++++++++++++++++++++++++++++++-----
 3 files changed, 237 insertions(+), 29 deletions(-)

Comments

Tim Gardner Jan. 16, 2023, 3:19 p.m. UTC | #1
On 1/13/23 11:09 AM, Bodong Wang wrote:
> Some drivers, like mlxsw, are not interested in notifications coming in
> for netdevices from other network namespaces. So introduce per-netns
> notifiers and allow to reduce overhead by listening only for
> notifications from the same netns. This is done by first two patches.
> 
> After we have per-net notifier, which allows to get only
> notifications relevant to particular network namespace. That is enough
> for drivers that have netdevs local in a particular namespace (cannot
> move elsewhere).
> 
> However if netdev can change namespace, per-net notifier cannot be used.
> Introduce dev_net variant that is basically per-net notifier with an
> extension that re-registers the per-net notifier upon netdev namespace
> change. Basically the per-net notifier follows the netdev into
> namespace. This is done by the last two patches.
> 
> Jiri Pirko (4):
>    net: push loops and nb calls into helper functions
>    net: introduce per-netns netdevice notifiers
>    net: push code from net notifier reg/unreg into helpers
>    net: introduce dev_net notifier register/unregister variants
> 
>   include/linux/netdevice.h   |  23 ++++
>   include/net/net_namespace.h |   5 +-
>   net/core/dev.c              | 238 +++++++++++++++++++++++++++++++-----
>   3 files changed, 237 insertions(+), 29 deletions(-)
> 
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Bartlomiej Zolnierkiewicz Jan. 19, 2023, 9:07 a.m. UTC | #2
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

On Fri, Jan 13, 2023 at 7:10 PM Bodong Wang <bodong@nvidia.com> wrote:
>
> Some drivers, like mlxsw, are not interested in notifications coming in
> for netdevices from other network namespaces. So introduce per-netns
> notifiers and allow to reduce overhead by listening only for
> notifications from the same netns. This is done by first two patches.
>
> After we have per-net notifier, which allows to get only
> notifications relevant to particular network namespace. That is enough
> for drivers that have netdevs local in a particular namespace (cannot
> move elsewhere).
>
> However if netdev can change namespace, per-net notifier cannot be used.
> Introduce dev_net variant that is basically per-net notifier with an
> extension that re-registers the per-net notifier upon netdev namespace
> change. Basically the per-net notifier follows the netdev into
> namespace. This is done by the last two patches.
>
> Jiri Pirko (4):
>   net: push loops and nb calls into helper functions
>   net: introduce per-netns netdevice notifiers
>   net: push code from net notifier reg/unreg into helpers
>   net: introduce dev_net notifier register/unregister variants
>
>  include/linux/netdevice.h   |  23 ++++
>  include/net/net_namespace.h |   5 +-
>  net/core/dev.c              | 238 +++++++++++++++++++++++++++++++-----
>  3 files changed, 237 insertions(+), 29 deletions(-)
>
Bartlomiej Zolnierkiewicz Jan. 19, 2023, 9:11 a.m. UTC | #3
Applied to focal:linux-bluefield/master-next. Thanks.

--
Best regards,
Bartlomiej

On Fri, Jan 13, 2023 at 7:10 PM Bodong Wang <bodong@nvidia.com> wrote:
>
> Some drivers, like mlxsw, are not interested in notifications coming in
> for netdevices from other network namespaces. So introduce per-netns
> notifiers and allow to reduce overhead by listening only for
> notifications from the same netns. This is done by first two patches.
>
> After we have per-net notifier, which allows to get only
> notifications relevant to particular network namespace. That is enough
> for drivers that have netdevs local in a particular namespace (cannot
> move elsewhere).
>
> However if netdev can change namespace, per-net notifier cannot be used.
> Introduce dev_net variant that is basically per-net notifier with an
> extension that re-registers the per-net notifier upon netdev namespace
> change. Basically the per-net notifier follows the netdev into
> namespace. This is done by the last two patches.
>
> Jiri Pirko (4):
>   net: push loops and nb calls into helper functions
>   net: introduce per-netns netdevice notifiers
>   net: push code from net notifier reg/unreg into helpers
>   net: introduce dev_net notifier register/unregister variants
>
>  include/linux/netdevice.h   |  23 ++++
>  include/net/net_namespace.h |   5 +-
>  net/core/dev.c              | 238 +++++++++++++++++++++++++++++++-----
>  3 files changed, 237 insertions(+), 29 deletions(-)
>