765-2-net-next-net-dsa-merge-rtnl_lock-sections-in-dsa_slave_create.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From e31dbd3b6aba585231cd84a87adeb22e7c6a8c19 Mon Sep 17 00:00:00 2001
  2. From: Vladimir Oltean <[email protected]>
  3. Date: Thu, 6 Jan 2022 01:11:13 +0200
  4. Subject: [PATCH 2/6] net: dsa: merge rtnl_lock sections in dsa_slave_create
  5. Currently dsa_slave_create() has two sequences of rtnl_lock/rtnl_unlock
  6. in a row. Remove the rtnl_unlock() and rtnl_lock() in between, such that
  7. the operation can execute slighly faster.
  8. Signed-off-by: Vladimir Oltean <[email protected]>
  9. Reviewed-by: Florian Fainelli <[email protected]>
  10. Signed-off-by: David S. Miller <[email protected]>
  11. ---
  12. net/dsa/slave.c | 4 +---
  13. 1 file changed, 1 insertion(+), 3 deletions(-)
  14. --- a/net/dsa/slave.c
  15. +++ b/net/dsa/slave.c
  16. @@ -1988,14 +1988,12 @@ int dsa_slave_create(struct dsa_port *po
  17. }
  18. rtnl_lock();
  19. +
  20. ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
  21. - rtnl_unlock();
  22. if (ret && ret != -EOPNOTSUPP)
  23. dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
  24. ret, ETH_DATA_LEN, port->index);
  25. - rtnl_lock();
  26. -
  27. ret = register_netdevice(slave_dev);
  28. if (ret) {
  29. netdev_err(master, "error %d registering interface %s\n",