]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
took simpler queue-6.1/net-move-altnames-together-with-the-netdevice.patch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Oct 2023 07:40:47 +0000 (09:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Oct 2023 07:40:47 +0000 (09:40 +0200)
queue-6.1/net-devlink-convert-devlink-port-type-specific-point.patch [deleted file]
queue-6.1/net-devlink-move-port_type_netdev_checks-call-to-__d.patch [deleted file]
queue-6.1/net-devlink-move-port_type_warn_schedule-call-to-__d.patch [deleted file]
queue-6.1/net-devlink-take-rtnl-in-port_fill-function-only-if-.patch [deleted file]
queue-6.1/net-devlink-track-netdev-with-devlink_port-assigned.patch [deleted file]
queue-6.1/net-make-sure-we-never-create-ifindex-0.patch [deleted file]
queue-6.1/net-move-altnames-together-with-the-netdevice.patch
queue-6.1/net-store-netdevs-in-an-xarray.patch [deleted file]
queue-6.1/series

diff --git a/queue-6.1/net-devlink-convert-devlink-port-type-specific-point.patch b/queue-6.1/net-devlink-convert-devlink-port-type-specific-point.patch
deleted file mode 100644 (file)
index 8346247..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-From fd9da306627bdf1e29c96bd84e2ad5ed5772797b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 2 Nov 2022 17:01:59 +0100
-Subject: net: devlink: convert devlink port type-specific pointers to union
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit 3830c5719af66fac9849cf5fb04b03d4e4bb46ff ]
-
-Instead of storing type_dev as a void pointer, convert it to union and
-use it to store either struct net_device or struct ib_device pointer.
-
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/devlink.h  | 13 ++++++++++---
- net/devlink/leftover.c | 17 +++++++++++++----
- 2 files changed, 23 insertions(+), 7 deletions(-)
-
-diff --git a/include/net/devlink.h b/include/net/devlink.h
-index ba6b8b0949432..6c55aabaedf19 100644
---- a/include/net/devlink.h
-+++ b/include/net/devlink.h
-@@ -121,12 +121,19 @@ struct devlink_port {
-       struct list_head region_list;
-       struct devlink *devlink;
-       unsigned int index;
--      spinlock_t type_lock; /* Protects type and type_dev
--                             * pointer consistency.
-+      spinlock_t type_lock; /* Protects type and type_eth/ib
-+                             * structures consistency.
-                              */
-       enum devlink_port_type type;
-       enum devlink_port_type desired_type;
--      void *type_dev;
-+      union {
-+              struct {
-+                      struct net_device *netdev;
-+              } type_eth;
-+              struct {
-+                      struct ib_device *ibdev;
-+              } type_ib;
-+      };
-       struct devlink_port_attrs attrs;
-       u8 attrs_set:1,
-          switch_port:1,
-diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
-index 032c7af065cd9..6fee4ce6724b7 100644
---- a/net/devlink/leftover.c
-+++ b/net/devlink/leftover.c
-@@ -1303,7 +1303,7 @@ static int devlink_nl_port_fill(struct sk_buff *msg,
-               goto nla_put_failure_type_locked;
-       if (devlink_port->type == DEVLINK_PORT_TYPE_ETH) {
-               struct net *net = devlink_net(devlink_port->devlink);
--              struct net_device *netdev = devlink_port->type_dev;
-+              struct net_device *netdev = devlink_port->type_eth.netdev;
-               if (netdev && net_eq(net, dev_net(netdev)) &&
-                   (nla_put_u32(msg, DEVLINK_ATTR_PORT_NETDEV_IFINDEX,
-@@ -1313,7 +1313,7 @@ static int devlink_nl_port_fill(struct sk_buff *msg,
-                       goto nla_put_failure_type_locked;
-       }
-       if (devlink_port->type == DEVLINK_PORT_TYPE_IB) {
--              struct ib_device *ibdev = devlink_port->type_dev;
-+              struct ib_device *ibdev = devlink_port->type_ib.ibdev;
-               if (ibdev &&
-                   nla_put_string(msg, DEVLINK_ATTR_PORT_IBDEV_NAME,
-@@ -10012,7 +10012,16 @@ static void __devlink_port_type_set(struct devlink_port *devlink_port,
-       devlink_port_type_warn_cancel(devlink_port);
-       spin_lock_bh(&devlink_port->type_lock);
-       devlink_port->type = type;
--      devlink_port->type_dev = type_dev;
-+      switch (type) {
-+      case DEVLINK_PORT_TYPE_ETH:
-+              devlink_port->type_eth.netdev = type_dev;
-+              break;
-+      case DEVLINK_PORT_TYPE_IB:
-+              devlink_port->type_ib.ibdev = type_dev;
-+              break;
-+      default:
-+              break;
-+      }
-       spin_unlock_bh(&devlink_port->type_lock);
-       devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
- }
-@@ -12027,7 +12036,7 @@ devlink_trap_report_metadata_set(struct devlink_trap_metadata *metadata,
-       spin_lock(&in_devlink_port->type_lock);
-       if (in_devlink_port->type == DEVLINK_PORT_TYPE_ETH)
--              metadata->input_dev = in_devlink_port->type_dev;
-+              metadata->input_dev = in_devlink_port->type_eth.netdev;
-       spin_unlock(&in_devlink_port->type_lock);
- }
--- 
-2.40.1
-
diff --git a/queue-6.1/net-devlink-move-port_type_netdev_checks-call-to-__d.patch b/queue-6.1/net-devlink-move-port_type_netdev_checks-call-to-__d.patch
deleted file mode 100644 (file)
index 5a6125c..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-From 879f3378cd4d13d9048f7fc13aa5ec49504819f6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 2 Nov 2022 17:02:01 +0100
-Subject: net: devlink: move port_type_netdev_checks() call to
- __devlink_port_type_set()
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit 45791e0d00c445936bb19535fe847083b1edd26d ]
-
-As __devlink_port_type_set() is going to be called directly from netdevice
-notifier event handle in one of the follow-up patches, move the
-port_type_netdev_checks() call there.
-
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/devlink/leftover.c | 63 ++++++++++++++++++++++--------------------
- 1 file changed, 33 insertions(+), 30 deletions(-)
-
-diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
-index 53dde50c5d6e2..e06fe0fad5d7d 100644
---- a/net/devlink/leftover.c
-+++ b/net/devlink/leftover.c
-@@ -10003,33 +10003,6 @@ void devlink_port_unregister(struct devlink_port *devlink_port)
- }
- EXPORT_SYMBOL_GPL(devlink_port_unregister);
--static void __devlink_port_type_set(struct devlink_port *devlink_port,
--                                  enum devlink_port_type type,
--                                  void *type_dev)
--{
--      ASSERT_DEVLINK_PORT_REGISTERED(devlink_port);
--
--      if (type == DEVLINK_PORT_TYPE_NOTSET)
--              devlink_port_type_warn_schedule(devlink_port);
--      else
--              devlink_port_type_warn_cancel(devlink_port);
--
--      spin_lock_bh(&devlink_port->type_lock);
--      devlink_port->type = type;
--      switch (type) {
--      case DEVLINK_PORT_TYPE_ETH:
--              devlink_port->type_eth.netdev = type_dev;
--              break;
--      case DEVLINK_PORT_TYPE_IB:
--              devlink_port->type_ib.ibdev = type_dev;
--              break;
--      default:
--              break;
--      }
--      spin_unlock_bh(&devlink_port->type_lock);
--      devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
--}
--
- static void devlink_port_type_netdev_checks(struct devlink_port *devlink_port,
-                                           struct net_device *netdev)
- {
-@@ -10067,6 +10040,38 @@ static void devlink_port_type_netdev_checks(struct devlink_port *devlink_port,
-       }
- }
-+static void __devlink_port_type_set(struct devlink_port *devlink_port,
-+                                  enum devlink_port_type type,
-+                                  void *type_dev)
-+{
-+      struct net_device *netdev = type_dev;
-+
-+      ASSERT_DEVLINK_PORT_REGISTERED(devlink_port);
-+
-+      if (type == DEVLINK_PORT_TYPE_NOTSET) {
-+              devlink_port_type_warn_schedule(devlink_port);
-+      } else {
-+              devlink_port_type_warn_cancel(devlink_port);
-+              if (type == DEVLINK_PORT_TYPE_ETH && netdev)
-+                      devlink_port_type_netdev_checks(devlink_port, netdev);
-+      }
-+
-+      spin_lock_bh(&devlink_port->type_lock);
-+      devlink_port->type = type;
-+      switch (type) {
-+      case DEVLINK_PORT_TYPE_ETH:
-+              devlink_port->type_eth.netdev = netdev;
-+              break;
-+      case DEVLINK_PORT_TYPE_IB:
-+              devlink_port->type_ib.ibdev = type_dev;
-+              break;
-+      default:
-+              break;
-+      }
-+      spin_unlock_bh(&devlink_port->type_lock);
-+      devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
-+}
-+
- /**
-  *    devlink_port_type_eth_set - Set port type to Ethernet
-  *
-@@ -10076,9 +10081,7 @@ static void devlink_port_type_netdev_checks(struct devlink_port *devlink_port,
- void devlink_port_type_eth_set(struct devlink_port *devlink_port,
-                              struct net_device *netdev)
- {
--      if (netdev)
--              devlink_port_type_netdev_checks(devlink_port, netdev);
--      else
-+      if (!netdev)
-               dev_warn(devlink_port->devlink->dev,
-                        "devlink port type for port %d set to Ethernet without a software interface reference, device type not supported by the kernel?\n",
-                        devlink_port->index);
--- 
-2.40.1
-
diff --git a/queue-6.1/net-devlink-move-port_type_warn_schedule-call-to-__d.patch b/queue-6.1/net-devlink-move-port_type_warn_schedule-call-to-__d.patch
deleted file mode 100644 (file)
index 947c864..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From fcd7c13e3f519e3effc607cab19cf65613c7f7bf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 2 Nov 2022 17:02:00 +0100
-Subject: net: devlink: move port_type_warn_schedule() call to
- __devlink_port_type_set()
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit 8573a04404ddacb2d966eef09bf38b2ad6dbe86f ]
-
-As __devlink_port_type_set() is going to be called directly from netdevice
-notifier event handle in one of the follow-up patches, move the
-port_type_warn_schedule() call there.
-
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/devlink/leftover.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
-index 6fee4ce6724b7..53dde50c5d6e2 100644
---- a/net/devlink/leftover.c
-+++ b/net/devlink/leftover.c
-@@ -10009,7 +10009,11 @@ static void __devlink_port_type_set(struct devlink_port *devlink_port,
- {
-       ASSERT_DEVLINK_PORT_REGISTERED(devlink_port);
--      devlink_port_type_warn_cancel(devlink_port);
-+      if (type == DEVLINK_PORT_TYPE_NOTSET)
-+              devlink_port_type_warn_schedule(devlink_port);
-+      else
-+              devlink_port_type_warn_cancel(devlink_port);
-+
-       spin_lock_bh(&devlink_port->type_lock);
-       devlink_port->type = type;
-       switch (type) {
-@@ -10104,7 +10108,6 @@ EXPORT_SYMBOL_GPL(devlink_port_type_ib_set);
- void devlink_port_type_clear(struct devlink_port *devlink_port)
- {
-       __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_NOTSET, NULL);
--      devlink_port_type_warn_schedule(devlink_port);
- }
- EXPORT_SYMBOL_GPL(devlink_port_type_clear);
--- 
-2.40.1
-
diff --git a/queue-6.1/net-devlink-take-rtnl-in-port_fill-function-only-if-.patch b/queue-6.1/net-devlink-take-rtnl-in-port_fill-function-only-if-.patch
deleted file mode 100644 (file)
index 23a7bec..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-From 4dce0f9fdd80044edf6ad75b9906aab98d573553 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 2 Nov 2022 17:02:02 +0100
-Subject: net: devlink: take RTNL in port_fill() function only if it is not
- held
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit d41c9dbd12745cfc1cb2946cd99016d83c2c5364 ]
-
-Follow-up patch is going to introduce a netdevice notifier event
-processing which is called with RTNL mutex held. Processing of this will
-eventually lead to call to port_notity() and port_fill() which currently
-takes RTNL mutex internally. So as a temporary solution, propagate a
-bool indicating if the mutex is already held. This will go away in one
-of the follow-up patches.
-
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/devlink/leftover.c | 46 ++++++++++++++++++++++++++++--------------
- 1 file changed, 31 insertions(+), 15 deletions(-)
-
-diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
-index e06fe0fad5d7d..b077acc255890 100644
---- a/net/devlink/leftover.c
-+++ b/net/devlink/leftover.c
-@@ -1278,7 +1278,8 @@ devlink_nl_port_function_attrs_put(struct sk_buff *msg, struct devlink_port *por
- static int devlink_nl_port_fill(struct sk_buff *msg,
-                               struct devlink_port *devlink_port,
-                               enum devlink_command cmd, u32 portid, u32 seq,
--                              int flags, struct netlink_ext_ack *extack)
-+                              int flags, struct netlink_ext_ack *extack,
-+                              bool rtnl_held)
- {
-       struct devlink *devlink = devlink_port->devlink;
-       void *hdr;
-@@ -1293,7 +1294,8 @@ static int devlink_nl_port_fill(struct sk_buff *msg,
-               goto nla_put_failure;
-       /* Hold rtnl lock while accessing port's netdev attributes. */
--      rtnl_lock();
-+      if (!rtnl_held)
-+              rtnl_lock();
-       spin_lock_bh(&devlink_port->type_lock);
-       if (nla_put_u16(msg, DEVLINK_ATTR_PORT_TYPE, devlink_port->type))
-               goto nla_put_failure_type_locked;
-@@ -1321,7 +1323,8 @@ static int devlink_nl_port_fill(struct sk_buff *msg,
-                       goto nla_put_failure_type_locked;
-       }
-       spin_unlock_bh(&devlink_port->type_lock);
--      rtnl_unlock();
-+      if (!rtnl_held)
-+              rtnl_unlock();
-       if (devlink_nl_port_attrs_put(msg, devlink_port))
-               goto nla_put_failure;
-       if (devlink_nl_port_function_attrs_put(msg, devlink_port, extack))
-@@ -1336,14 +1339,15 @@ static int devlink_nl_port_fill(struct sk_buff *msg,
- nla_put_failure_type_locked:
-       spin_unlock_bh(&devlink_port->type_lock);
--      rtnl_unlock();
-+      if (!rtnl_held)
-+              rtnl_unlock();
- nla_put_failure:
-       genlmsg_cancel(msg, hdr);
-       return -EMSGSIZE;
- }
--static void devlink_port_notify(struct devlink_port *devlink_port,
--                              enum devlink_command cmd)
-+static void __devlink_port_notify(struct devlink_port *devlink_port,
-+                                enum devlink_command cmd, bool rtnl_held)
- {
-       struct devlink *devlink = devlink_port->devlink;
-       struct sk_buff *msg;
-@@ -1358,7 +1362,8 @@ static void devlink_port_notify(struct devlink_port *devlink_port,
-       if (!msg)
-               return;
--      err = devlink_nl_port_fill(msg, devlink_port, cmd, 0, 0, 0, NULL);
-+      err = devlink_nl_port_fill(msg, devlink_port, cmd, 0, 0, 0, NULL,
-+                                 rtnl_held);
-       if (err) {
-               nlmsg_free(msg);
-               return;
-@@ -1368,6 +1373,12 @@ static void devlink_port_notify(struct devlink_port *devlink_port,
-                               0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
- }
-+static void devlink_port_notify(struct devlink_port *devlink_port,
-+                              enum devlink_command cmd)
-+{
-+      __devlink_port_notify(devlink_port, cmd, false);
-+}
-+
- static void devlink_rate_notify(struct devlink_rate *devlink_rate,
-                               enum devlink_command cmd)
- {
-@@ -1534,7 +1545,7 @@ static int devlink_nl_cmd_port_get_doit(struct sk_buff *skb,
-       err = devlink_nl_port_fill(msg, devlink_port, DEVLINK_CMD_PORT_NEW,
-                                  info->snd_portid, info->snd_seq, 0,
--                                 info->extack);
-+                                 info->extack, false);
-       if (err) {
-               nlmsg_free(msg);
-               return err;
-@@ -1564,7 +1575,8 @@ static int devlink_nl_cmd_port_get_dumpit(struct sk_buff *msg,
-                                                  DEVLINK_CMD_NEW,
-                                                  NETLINK_CB(cb->skb).portid,
-                                                  cb->nlh->nlmsg_seq,
--                                                 NLM_F_MULTI, cb->extack);
-+                                                 NLM_F_MULTI, cb->extack,
-+                                                 false);
-                       if (err) {
-                               devl_unlock(devlink);
-                               devlink_put(devlink);
-@@ -1776,7 +1788,8 @@ static int devlink_port_new_notify(struct devlink *devlink,
-       }
-       err = devlink_nl_port_fill(msg, devlink_port, DEVLINK_CMD_NEW,
--                                 info->snd_portid, info->snd_seq, 0, NULL);
-+                                 info->snd_portid, info->snd_seq, 0, NULL,
-+                                 false);
-       if (err)
-               goto out;
-@@ -10042,7 +10055,7 @@ static void devlink_port_type_netdev_checks(struct devlink_port *devlink_port,
- static void __devlink_port_type_set(struct devlink_port *devlink_port,
-                                   enum devlink_port_type type,
--                                  void *type_dev)
-+                                  void *type_dev, bool rtnl_held)
- {
-       struct net_device *netdev = type_dev;
-@@ -10069,7 +10082,7 @@ static void __devlink_port_type_set(struct devlink_port *devlink_port,
-               break;
-       }
-       spin_unlock_bh(&devlink_port->type_lock);
--      devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW);
-+      __devlink_port_notify(devlink_port, DEVLINK_CMD_PORT_NEW, rtnl_held);
- }
- /**
-@@ -10086,7 +10099,8 @@ void devlink_port_type_eth_set(struct devlink_port *devlink_port,
-                        "devlink port type for port %d set to Ethernet without a software interface reference, device type not supported by the kernel?\n",
-                        devlink_port->index);
--      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_ETH, netdev);
-+      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_ETH, netdev,
-+                              false);
- }
- EXPORT_SYMBOL_GPL(devlink_port_type_eth_set);
-@@ -10099,7 +10113,8 @@ EXPORT_SYMBOL_GPL(devlink_port_type_eth_set);
- void devlink_port_type_ib_set(struct devlink_port *devlink_port,
-                             struct ib_device *ibdev)
- {
--      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_IB, ibdev);
-+      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_IB, ibdev,
-+                              false);
- }
- EXPORT_SYMBOL_GPL(devlink_port_type_ib_set);
-@@ -10110,7 +10125,8 @@ EXPORT_SYMBOL_GPL(devlink_port_type_ib_set);
-  */
- void devlink_port_type_clear(struct devlink_port *devlink_port)
- {
--      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_NOTSET, NULL);
-+      __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_NOTSET, NULL,
-+                              false);
- }
- EXPORT_SYMBOL_GPL(devlink_port_type_clear);
--- 
-2.40.1
-
diff --git a/queue-6.1/net-devlink-track-netdev-with-devlink_port-assigned.patch b/queue-6.1/net-devlink-track-netdev-with-devlink_port-assigned.patch
deleted file mode 100644 (file)
index 324065c..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-From d9a5b96d376231439213984dddf5b0b0ccccfc75 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 2 Nov 2022 17:02:03 +0100
-Subject: net: devlink: track netdev with devlink_port assigned
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit 02a68a47eadedf95748facfca6ced31fb0181d52 ]
-
-Currently, ethernet drivers are using devlink_port_type_eth_set() and
-devlink_port_type_clear() to set devlink port type and link to related
-netdev.
-
-Instead of calling them directly, let the driver use
-SET_NETDEV_DEVLINK_PORT macro to assign devlink_port pointer and let
-devlink to track it. Note the devlink port pointer is static during
-the time netdevice is registered.
-
-In devlink code, use per-namespace netdev notifier to track
-the netdevices with devlink_port assigned and change the internal
-devlink_port type and related type pointer accordingly.
-
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/netdevice.h | 19 ++++++++++
- net/core/dev.c            | 14 +++++---
- net/devlink/leftover.c    | 75 ++++++++++++++++++++++++++++++++++++---
- 3 files changed, 99 insertions(+), 9 deletions(-)
-
-diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 5a04fbf724768..2b8646c39dcdd 100644
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -2011,6 +2011,11 @@ enum netdev_ml_priv_type {
-  *                                    registered
-  *    @offload_xstats_l3:     L3 HW stats for this netdevice.
-  *
-+ *    @devlink_port:  Pointer to related devlink port structure.
-+ *                    Assigned by a driver before netdev registration using
-+ *                    SET_NETDEV_DEVLINK_PORT macro. This pointer is static
-+ *                    during the time netdevice is registered.
-+ *
-  *    FIXME: cleanup struct net_device such that network protocol info
-  *    moves out.
-  */
-@@ -2361,9 +2366,22 @@ struct net_device {
-       netdevice_tracker       watchdog_dev_tracker;
-       netdevice_tracker       dev_registered_tracker;
-       struct rtnl_hw_stats64  *offload_xstats_l3;
-+
-+      struct devlink_port     *devlink_port;
- };
- #define to_net_dev(d) container_of(d, struct net_device, dev)
-+/*
-+ * Driver should use this to assign devlink port instance to a netdevice
-+ * before it registers the netdevice. Therefore devlink_port is static
-+ * during the netdev lifetime after it is registered.
-+ */
-+#define SET_NETDEV_DEVLINK_PORT(dev, port)                    \
-+({                                                            \
-+      WARN_ON((dev)->reg_state != NETREG_UNINITIALIZED);      \
-+      ((dev)->devlink_port = (port));                         \
-+})
-+
- static inline bool netif_elide_gro(const struct net_device *dev)
- {
-       if (!(dev->features & NETIF_F_GRO) || dev->xdp_prog)
-@@ -2798,6 +2816,7 @@ enum netdev_cmd {
-       NETDEV_PRE_TYPE_CHANGE,
-       NETDEV_POST_TYPE_CHANGE,
-       NETDEV_POST_INIT,
-+      NETDEV_PRE_UNINIT,
-       NETDEV_RELEASE,
-       NETDEV_NOTIFY_PEERS,
-       NETDEV_JOIN,
-diff --git a/net/core/dev.c b/net/core/dev.c
-index 9cacd17feeaae..9bf10c9c4735a 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -1637,10 +1637,10 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd)
-       N(UP) N(DOWN) N(REBOOT) N(CHANGE) N(REGISTER) N(UNREGISTER)
-       N(CHANGEMTU) N(CHANGEADDR) N(GOING_DOWN) N(CHANGENAME) N(FEAT_CHANGE)
-       N(BONDING_FAILOVER) N(PRE_UP) N(PRE_TYPE_CHANGE) N(POST_TYPE_CHANGE)
--      N(POST_INIT) N(RELEASE) N(NOTIFY_PEERS) N(JOIN) N(CHANGEUPPER)
--      N(RESEND_IGMP) N(PRECHANGEMTU) N(CHANGEINFODATA) N(BONDING_INFO)
--      N(PRECHANGEUPPER) N(CHANGELOWERSTATE) N(UDP_TUNNEL_PUSH_INFO)
--      N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
-+      N(POST_INIT) N(PRE_UNINIT) N(RELEASE) N(NOTIFY_PEERS) N(JOIN)
-+      N(CHANGEUPPER) N(RESEND_IGMP) N(PRECHANGEMTU) N(CHANGEINFODATA)
-+      N(BONDING_INFO) N(PRECHANGEUPPER) N(CHANGELOWERSTATE)
-+      N(UDP_TUNNEL_PUSH_INFO) N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
-       N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO)
-       N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO)
-       N(PRE_CHANGEADDR) N(OFFLOAD_XSTATS_ENABLE) N(OFFLOAD_XSTATS_DISABLE)
-@@ -10086,7 +10086,7 @@ int register_netdevice(struct net_device *dev)
-       dev->reg_state = ret ? NETREG_UNREGISTERED : NETREG_REGISTERED;
-       write_unlock(&dev_base_lock);
-       if (ret)
--              goto err_uninit;
-+              goto err_uninit_notify;
-       __netdev_update_features(dev);
-@@ -10133,6 +10133,8 @@ int register_netdevice(struct net_device *dev)
- out:
-       return ret;
-+err_uninit_notify:
-+      call_netdevice_notifiers(NETDEV_PRE_UNINIT, dev);
- err_uninit:
-       if (dev->netdev_ops->ndo_uninit)
-               dev->netdev_ops->ndo_uninit(dev);
-@@ -10883,6 +10885,8 @@ void unregister_netdevice_many(struct list_head *head)
-               netdev_name_node_alt_flush(dev);
-               netdev_name_node_free(dev->name_node);
-+              call_netdevice_notifiers(NETDEV_PRE_UNINIT, dev);
-+
-               if (dev->netdev_ops->ndo_uninit)
-                       dev->netdev_ops->ndo_uninit(dev);
-diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
-index b077acc255890..7ccfe69afd4b6 100644
---- a/net/devlink/leftover.c
-+++ b/net/devlink/leftover.c
-@@ -71,6 +71,7 @@ struct devlink {
-       refcount_t refcount;
-       struct completion comp;
-       struct rcu_head rcu;
-+      struct notifier_block netdevice_nb;
-       char priv[] __aligned(NETDEV_ALIGN);
- };
-@@ -9618,6 +9619,9 @@ void devlink_set_features(struct devlink *devlink, u64 features)
- }
- EXPORT_SYMBOL_GPL(devlink_set_features);
-+static int devlink_netdevice_event(struct notifier_block *nb,
-+                                 unsigned long event, void *ptr);
-+
- /**
-  *    devlink_alloc_ns - Allocate new devlink instance resources
-  *    in specific namespace
-@@ -9648,10 +9652,13 @@ struct devlink *devlink_alloc_ns(const struct devlink_ops *ops,
-       ret = xa_alloc_cyclic(&devlinks, &devlink->index, devlink, xa_limit_31b,
-                             &last_id, GFP_KERNEL);
--      if (ret < 0) {
--              kfree(devlink);
--              return NULL;
--      }
-+      if (ret < 0)
-+              goto err_xa_alloc;
-+
-+      devlink->netdevice_nb.notifier_call = devlink_netdevice_event;
-+      ret = register_netdevice_notifier_net(net, &devlink->netdevice_nb);
-+      if (ret)
-+              goto err_register_netdevice_notifier;
-       devlink->dev = dev;
-       devlink->ops = ops;
-@@ -9678,6 +9685,12 @@ struct devlink *devlink_alloc_ns(const struct devlink_ops *ops,
-       init_completion(&devlink->comp);
-       return devlink;
-+
-+err_register_netdevice_notifier:
-+      xa_erase(&devlinks, devlink->index);
-+err_xa_alloc:
-+      kfree(devlink);
-+      return NULL;
- }
- EXPORT_SYMBOL_GPL(devlink_alloc_ns);
-@@ -9834,6 +9847,10 @@ void devlink_free(struct devlink *devlink)
-       WARN_ON(!list_empty(&devlink->port_list));
-       xa_destroy(&devlink->snapshot_ids);
-+
-+      unregister_netdevice_notifier_net(devlink_net(devlink),
-+                                        &devlink->netdevice_nb);
-+
-       xa_erase(&devlinks, devlink->index);
-       kfree(devlink);
-@@ -10130,6 +10147,56 @@ void devlink_port_type_clear(struct devlink_port *devlink_port)
- }
- EXPORT_SYMBOL_GPL(devlink_port_type_clear);
-+static int devlink_netdevice_event(struct notifier_block *nb,
-+                                 unsigned long event, void *ptr)
-+{
-+      struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
-+      struct devlink_port *devlink_port = netdev->devlink_port;
-+      struct devlink *devlink;
-+
-+      devlink = container_of(nb, struct devlink, netdevice_nb);
-+
-+      if (!devlink_port || devlink_port->devlink != devlink)
-+              return NOTIFY_OK;
-+
-+      switch (event) {
-+      case NETDEV_POST_INIT:
-+              /* Set the type but not netdev pointer. It is going to be set
-+               * later on by NETDEV_REGISTER event. Happens once during
-+               * netdevice register
-+               */
-+              __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_ETH,
-+                                      NULL, true);
-+              break;
-+      case NETDEV_REGISTER:
-+              /* Set the netdev on top of previously set type. Note this
-+               * event happens also during net namespace change so here
-+               * we take into account netdev pointer appearing in this
-+               * namespace.
-+               */
-+              __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_ETH,
-+                                      netdev, true);
-+              break;
-+      case NETDEV_UNREGISTER:
-+              /* Clear netdev pointer, but not the type. This event happens
-+               * also during net namespace change so we need to clear
-+               * pointer to netdev that is going to another net namespace.
-+               */
-+              __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_ETH,
-+                                      NULL, true);
-+              break;
-+      case NETDEV_PRE_UNINIT:
-+              /* Clear the type and the netdev pointer. Happens one during
-+               * netdevice unregister.
-+               */
-+              __devlink_port_type_set(devlink_port, DEVLINK_PORT_TYPE_NOTSET,
-+                                      NULL, true);
-+              break;
-+      }
-+
-+      return NOTIFY_OK;
-+}
-+
- static int __devlink_port_attrs_set(struct devlink_port *devlink_port,
-                                   enum devlink_port_flavour flavour)
- {
--- 
-2.40.1
-
diff --git a/queue-6.1/net-make-sure-we-never-create-ifindex-0.patch b/queue-6.1/net-make-sure-we-never-create-ifindex-0.patch
deleted file mode 100644 (file)
index a6e550b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From ceaac91dcd065db781d1ed5dfaef0686b8ec44dc Mon Sep 17 00:00:00 2001
-From: Jakub Kicinski <kuba@kernel.org>
-Date: Mon, 31 Jul 2023 10:11:58 -0700
-Subject: net: make sure we never create ifindex = 0
-
-From: Jakub Kicinski <kuba@kernel.org>
-
-commit ceaac91dcd065db781d1ed5dfaef0686b8ec44dc upstream.
-
-Instead of allocating from 1 use proper xa_init flag,
-to protect ourselves from IDs wrapping back to 0.
-
-Fixes: 759ab1edb56c ("net: store netdevs in an xarray")
-Reported-by: Stephen Hemminger <stephen@networkplumber.org>
-Link: https://lore.kernel.org/all/20230728162350.2a6d4979@hermes.local/
-Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
-Link: https://lore.kernel.org/r/20230731171159.988962-1-kuba@kernel.org
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- net/core/dev.c |    3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -11238,8 +11238,7 @@ static int __net_init netdev_init(struct
-       if (net->dev_index_head == NULL)
-               goto err_idx;
--      net->ifindex = 1;
--      xa_init_flags(&net->dev_by_index, XA_FLAGS_ALLOC);
-+      xa_init_flags(&net->dev_by_index, XA_FLAGS_ALLOC1);
-       RAW_INIT_NOTIFIER_HEAD(&net->netdev_chain);
index 8ec7b8eed5471857e147663da8b9163c96b62d76..24d335308ef35bd4873ee141a12206b47ad9f969 100644 (file)
@@ -1,11 +1,11 @@
-From 8f55e12b5b35ebb31ca91026b62ab165c32080ae Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
+From 8e15aee621618a3ee3abecaf1fd8c1428098b7ef Mon Sep 17 00:00:00 2001
+From: Jakub Kicinski <kuba@kernel.org>
 Date: Tue, 17 Oct 2023 18:38:16 -0700
 Subject: net: move altnames together with the netdevice
 
 From: Jakub Kicinski <kuba@kernel.org>
 
-[ Upstream commit 8e15aee621618a3ee3abecaf1fd8c1428098b7ef ]
+commit 8e15aee621618a3ee3abecaf1fd8c1428098b7ef upstream.
 
 The altname nodes are currently not moved to the new netns
 when netdevice itself moves:
@@ -33,16 +33,14 @@ Fixes: 36fbf1e52bd3 ("net: rtnetlink: add linkprop commands to add and delete al
 Reviewed-by: Jiri Pirko <jiri@nvidia.com>
 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- net/core/dev.c | 13 +++++++++----
+ net/core/dev.c |   13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
 
-diff --git a/net/core/dev.c b/net/core/dev.c
-index 14066030cb1dc..ed2484f5e54e4 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
-@@ -381,6 +381,7 @@ static void netdev_name_node_alt_flush(struct net_device *dev)
+@@ -381,6 +381,7 @@ static void netdev_name_node_alt_flush(s
  /* Device list insertion */
  static void list_netdevice(struct net_device *dev)
  {
@@ -50,35 +48,31 @@ index 14066030cb1dc..ed2484f5e54e4 100644
        struct net *net = dev_net(dev);
  
        ASSERT_RTNL();
-@@ -391,6 +392,10 @@ static void list_netdevice(struct net_device *dev)
-       hlist_add_head_rcu(&dev->index_hlist,
+@@ -392,6 +393,9 @@ static void list_netdevice(struct net_de
                           dev_index_hash(net, dev->ifindex));
        write_unlock(&dev_base_lock);
-+
 +      netdev_for_each_altname(dev, name_node)
 +              netdev_name_node_add(net, name_node);
 +
-       /* We reserved the ifindex, this can't fail */
-       WARN_ON(xa_store(&net->dev_by_index, dev->ifindex, dev, GFP_KERNEL));
+       dev_base_seq_inc(net);
+ }
  
-@@ -402,12 +407,16 @@ static void list_netdevice(struct net_device *dev)
+@@ -400,8 +404,13 @@ static void list_netdevice(struct net_de
   */
  static void unlist_netdevice(struct net_device *dev, bool lock)
  {
 +      struct netdev_name_node *name_node;
-       struct net *net = dev_net(dev);
++
        ASSERT_RTNL();
  
-       xa_erase(&net->dev_by_index, dev->ifindex);
 +      netdev_for_each_altname(dev, name_node)
 +              netdev_name_node_del(name_node);
 +
        /* Unlink dev from the device chain */
        if (lock)
                write_lock(&dev_base_lock);
-@@ -10872,7 +10881,6 @@ void unregister_netdevice_many(struct list_head *head)
+@@ -10851,7 +10860,6 @@ void unregister_netdevice_many(struct li
        synchronize_net();
  
        list_for_each_entry(dev, head, unreg_list) {
@@ -86,7 +80,7 @@ index 14066030cb1dc..ed2484f5e54e4 100644
                struct sk_buff *skb = NULL;
  
                /* Shutdown queueing discipline. */
-@@ -10898,9 +10906,6 @@ void unregister_netdevice_many(struct list_head *head)
+@@ -10877,9 +10885,6 @@ void unregister_netdevice_many(struct li
                dev_uc_flush(dev);
                dev_mc_flush(dev);
  
@@ -96,6 +90,3 @@ index 14066030cb1dc..ed2484f5e54e4 100644
                netdev_name_node_alt_flush(dev);
                netdev_name_node_free(dev->name_node);
  
--- 
-2.40.1
-
diff --git a/queue-6.1/net-store-netdevs-in-an-xarray.patch b/queue-6.1/net-store-netdevs-in-an-xarray.patch
deleted file mode 100644 (file)
index 08eab43..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-From eb90504709ba5fd1ccd141d303e4e61e940ac3fd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 26 Jul 2023 11:55:29 -0700
-Subject: net: store netdevs in an xarray
-
-From: Jakub Kicinski <kuba@kernel.org>
-
-[ Upstream commit 759ab1edb56c88906830fd6b2e7b12514dd32758 ]
-
-Iterating over the netdev hash table for netlink dumps is hard.
-Dumps are done in "chunks" so we need to save the position
-after each chunk, so we know where to restart from. Because
-netdevs are stored in a hash table we remember which bucket
-we were in and how many devices we dumped.
-
-Since we don't hold any locks across the "chunks" - devices may
-come and go while we're dumping. If that happens we may miss
-a device (if device is deleted from the bucket we were in).
-We indicate to user space that this may have happened by setting
-NLM_F_DUMP_INTR. User space is supposed to dump again (I think)
-if it sees that. Somehow I doubt most user space gets this right..
-
-To illustrate let's look at an example:
-
-               System state:
-  start:       # [A, B, C]
-  del:  B      # [A, C]
-
-with the hash table we may dump [A, B], missing C completely even
-tho it existed both before and after the "del B".
-
-Add an xarray and use it to allocate ifindexes. This way we
-can iterate ifindexes in order, without the worry that we'll
-skip one. We may still generate a dump of a state which "never
-existed", for example for a set of values and sequence of ops:
-
-               System state:
-  start:       # [A, B]
-  add:  C      # [A, C, B]
-  del:  B      # [A, C]
-
-we may generate a dump of [A], if C got an index between A and B.
-System has never been in such state. But I'm 90% sure that's perfectly
-fine, important part is that we can't _miss_ devices which exist before
-and after. User space which wants to mirror kernel's state subscribes
-to notifications and does periodic dumps so it will know that C exists
-from the notification about its creation or from the next dump
-(next dump is _guaranteed_ to include C, if it doesn't get removed).
-
-To avoid any perf regressions keep the hash table for now. Most
-net namespaces have very few devices and microbenchmarking 1M lookups
-on Skylake I get the following results (not counting loopback
-to number of devs):
-
- #devs | hash |  xa  | delta
-    2  | 18.3 | 20.1 | + 9.8%
-   16  | 18.3 | 20.1 | + 9.5%
-   64  | 18.3 | 26.3 | +43.8%
-  128  | 20.4 | 26.3 | +28.6%
-  256  | 20.0 | 26.4 | +32.1%
- 1024  | 26.6 | 26.7 | + 0.2%
- 8192  |541.3 | 33.5 | -93.8%
-
-No surprises since the hash table has 256 entries.
-The microbenchmark scans indexes in order, if the pattern is more
-random xa starts to win at 512 devices already. But that's a lot
-of devices, in practice.
-
-Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
-Link: https://lore.kernel.org/r/20230726185530.2247698-2-kuba@kernel.org
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 8e15aee62161 ("net: move altnames together with the netdevice")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/net_namespace.h |  4 +-
- net/core/dev.c              | 82 ++++++++++++++++++++++++-------------
- 2 files changed, 57 insertions(+), 29 deletions(-)
-
-diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
-index 8c3587d5c308f..3f66f32b88edd 100644
---- a/include/net/net_namespace.h
-+++ b/include/net/net_namespace.h
-@@ -42,6 +42,7 @@
- #include <linux/idr.h>
- #include <linux/skbuff.h>
- #include <linux/notifier.h>
-+#include <linux/xarray.h>
- struct user_namespace;
- struct proc_dir_entry;
-@@ -69,7 +70,7 @@ struct net {
-       atomic_t                dev_unreg_count;
-       unsigned int            dev_base_seq;   /* protected by rtnl_mutex */
--      int                     ifindex;
-+      u32                     ifindex;
-       spinlock_t              nsid_lock;
-       atomic_t                fnhe_genid;
-@@ -108,6 +109,7 @@ struct net {
-       struct hlist_head       *dev_name_head;
-       struct hlist_head       *dev_index_head;
-+      struct xarray           dev_by_index;
-       struct raw_notifier_head        netdev_chain;
-       /* Note that @hash_mix can be read millions times per second,
-diff --git a/net/core/dev.c b/net/core/dev.c
-index 9bf10c9c4735a..14066030cb1dc 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -391,6 +391,8 @@ static void list_netdevice(struct net_device *dev)
-       hlist_add_head_rcu(&dev->index_hlist,
-                          dev_index_hash(net, dev->ifindex));
-       write_unlock(&dev_base_lock);
-+      /* We reserved the ifindex, this can't fail */
-+      WARN_ON(xa_store(&net->dev_by_index, dev->ifindex, dev, GFP_KERNEL));
-       dev_base_seq_inc(net);
- }
-@@ -400,8 +402,12 @@ static void list_netdevice(struct net_device *dev)
-  */
- static void unlist_netdevice(struct net_device *dev, bool lock)
- {
-+      struct net *net = dev_net(dev);
-+
-       ASSERT_RTNL();
-+      xa_erase(&net->dev_by_index, dev->ifindex);
-+
-       /* Unlink dev from the device chain */
-       if (lock)
-               write_lock(&dev_base_lock);
-@@ -9542,23 +9548,35 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
- }
- /**
-- *    dev_new_index   -       allocate an ifindex
-- *    @net: the applicable net namespace
-+ * dev_index_reserve() - allocate an ifindex in a namespace
-+ * @net: the applicable net namespace
-+ * @ifindex: requested ifindex, pass %0 to get one allocated
-+ *
-+ * Allocate a ifindex for a new device. Caller must either use the ifindex
-+ * to store the device (via list_netdevice()) or call dev_index_release()
-+ * to give the index up.
-  *
-- *    Returns a suitable unique value for a new device interface
-- *    number.  The caller must hold the rtnl semaphore or the
-- *    dev_base_lock to be sure it remains unique.
-+ * Return: a suitable unique value for a new device interface number or -errno.
-  */
--static int dev_new_index(struct net *net)
-+static int dev_index_reserve(struct net *net, u32 ifindex)
- {
--      int ifindex = net->ifindex;
-+      int err;
--      for (;;) {
--              if (++ifindex <= 0)
--                      ifindex = 1;
--              if (!__dev_get_by_index(net, ifindex))
--                      return net->ifindex = ifindex;
--      }
-+      if (!ifindex)
-+              err = xa_alloc_cyclic(&net->dev_by_index, &ifindex, NULL,
-+                                    xa_limit_31b, &net->ifindex, GFP_KERNEL);
-+      else
-+              err = xa_insert(&net->dev_by_index, ifindex, NULL, GFP_KERNEL);
-+      if (err < 0)
-+              return err;
-+
-+      return ifindex;
-+}
-+
-+static void dev_index_release(struct net *net, int ifindex)
-+{
-+      /* Expect only unused indexes, unlist_netdevice() removes the used */
-+      WARN_ON(xa_erase(&net->dev_by_index, ifindex));
- }
- /* Delayed registration/unregisteration */
-@@ -10028,11 +10046,10 @@ int register_netdevice(struct net_device *dev)
-               goto err_uninit;
-       }
--      ret = -EBUSY;
--      if (!dev->ifindex)
--              dev->ifindex = dev_new_index(net);
--      else if (__dev_get_by_index(net, dev->ifindex))
-+      ret = dev_index_reserve(net, dev->ifindex);
-+      if (ret < 0)
-               goto err_uninit;
-+      dev->ifindex = ret;
-       /* Transfer changeable features to wanted_features and enable
-        * software offloads (GSO and GRO).
-@@ -10079,7 +10096,7 @@ int register_netdevice(struct net_device *dev)
-       ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
-       ret = notifier_to_errno(ret);
-       if (ret)
--              goto err_uninit;
-+              goto err_ifindex_release;
-       ret = netdev_register_kobject(dev);
-       write_lock(&dev_base_lock);
-@@ -10135,6 +10152,8 @@ int register_netdevice(struct net_device *dev)
- err_uninit_notify:
-       call_netdevice_notifiers(NETDEV_PRE_UNINIT, dev);
-+err_ifindex_release:
-+      dev_index_release(net, dev->ifindex);
- err_uninit:
-       if (dev->netdev_ops->ndo_uninit)
-               dev->netdev_ops->ndo_uninit(dev);
-@@ -10994,9 +11013,19 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
-                       goto out;
-       /* Check that new_ifindex isn't used yet. */
--      err = -EBUSY;
--      if (new_ifindex && __dev_get_by_index(net, new_ifindex))
--              goto out;
-+      if (new_ifindex) {
-+              err = dev_index_reserve(net, new_ifindex);
-+              if (err < 0)
-+                      goto out;
-+      } else {
-+              /* If there is an ifindex conflict assign a new one */
-+              err = dev_index_reserve(net, dev->ifindex);
-+              if (err == -EBUSY)
-+                      err = dev_index_reserve(net, 0);
-+              if (err < 0)
-+                      goto out;
-+              new_ifindex = err;
-+      }
-       /*
-        * And now a mini version of register_netdevice unregister_netdevice.
-@@ -11024,13 +11053,6 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
-       rcu_barrier();
-       new_nsid = peernet2id_alloc(dev_net(dev), net, GFP_KERNEL);
--      /* If there is an ifindex conflict assign a new one */
--      if (!new_ifindex) {
--              if (__dev_get_by_index(net, dev->ifindex))
--                      new_ifindex = dev_new_index(net);
--              else
--                      new_ifindex = dev->ifindex;
--      }
-       rtmsg_ifinfo_newnet(RTM_DELLINK, dev, ~0U, GFP_KERNEL, &new_nsid,
-                           new_ifindex);
-@@ -11211,6 +11233,9 @@ static int __net_init netdev_init(struct net *net)
-       if (net->dev_index_head == NULL)
-               goto err_idx;
-+      net->ifindex = 1;
-+      xa_init_flags(&net->dev_by_index, XA_FLAGS_ALLOC);
-+
-       RAW_INIT_NOTIFIER_HEAD(&net->netdev_chain);
-       return 0;
-@@ -11308,6 +11333,7 @@ static void __net_exit netdev_exit(struct net *net)
- {
-       kfree(net->dev_name_head);
-       kfree(net->dev_index_head);
-+      xa_destroy(&net->dev_by_index);
-       if (net != &init_net)
-               WARN_ON_ONCE(!list_empty(&net->dev_base_head));
- }
--- 
-2.40.1
-
index e2f8915354f30462537929554438fa126539cac6..18429a3ceb9ea8011b5900db992998990c66d4d6 100644 (file)
@@ -147,13 +147,6 @@ ice-remove-redundant-pci_enable_pcie_error_reporting.patch
 bluetooth-hci_event-fix-using-memcmp-when-comparing-.patch
 selftests-openvswitch-add-version-check-for-pyroute2.patch
 tcp_bpf-properly-release-resources-on-error-paths.patch
-net-devlink-convert-devlink-port-type-specific-point.patch
-net-devlink-move-port_type_warn_schedule-call-to-__d.patch
-net-devlink-move-port_type_netdev_checks-call-to-__d.patch
-net-devlink-take-rtnl-in-port_fill-function-only-if-.patch
-net-devlink-track-netdev-with-devlink_port-assigned.patch
-net-store-netdevs-in-an-xarray.patch
-net-move-altnames-together-with-the-netdevice.patch
 net-smc-fix-smc-clc-failed-issue-when-netdevice-not-.patch
 mtd-rawnand-qcom-unmap-the-right-resource-upon-probe-failure.patch
 mtd-rawnand-pl353-ensure-program-page-operations-are-successful.patch
@@ -194,7 +187,6 @@ gpio-vf610-set-value-before-the-direction-to-avoid-a-glitch.patch
 asoc-pxa-fix-a-memory-leak-in-probe.patch
 drm-bridge-ti-sn65dsi86-associate-dsi-device-lifetim.patch
 drm-panel-move-aux-b116xw03-out-of-panel-edp-back-to.patch
-net-make-sure-we-never-create-ifindex-0.patch
 serial-8250-omap-move-uart_write-inside-pm-section.patch
 serial-8250-omap-convert-to-modern-pm-ops.patch
 kallsyms-reduce-the-memory-occupied-by-kallsyms_seqs.patch
@@ -205,3 +197,4 @@ gpio-vf610-mask-the-gpio-irq-in-system-suspend-and-s.patch
 phy-mapphone-mdm6600-fix-runtime-disable-on-probe.patch
 phy-mapphone-mdm6600-fix-runtime-pm-for-remove.patch
 phy-mapphone-mdm6600-fix-pinctrl_pm-handling-for-sle.patch
+net-move-altnames-together-with-the-netdevice.patch