1. 19 9月, 2020 2 次提交
    • S
      devlink: add timeout information to status_notify · f92970c6
      Shannon Nelson 提交于
      Add a timeout element to the DEVLINK_CMD_FLASH_UPDATE_STATUS
      netlink message for use by a userland utility to show that
      a particular firmware flash activity may take a long but
      bounded time to finish.  Also add a handy helper for drivers
      to make use of the new timeout value.
      
      UI usage hints:
       - if non-zero, add timeout display to the end of the status line
       	[component] status_msg  ( Xm Ys : Am Bs )
           using the timeout value for Am Bs and updating the Xm Ys
           every second
       - if the timeout expires while awaiting the next update,
         display something like
       	[component] status_msg  ( timeout reached : Am Bs )
       - if new status notify messages are received, remove
         the timeout and start over
      Signed-off-by: NShannon Nelson <snelson@pensando.io>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f92970c6
    • F
      net: use exponential backoff in netdev_wait_allrefs · 0e4be9e5
      Francesco Ruggeri 提交于
      The combination of aca_free_rcu, introduced in commit 2384d025
      ("net/ipv6: Add anycast addresses to a global hashtable"), and
      fib6_info_destroy_rcu, introduced in commit 9b0a8da8 ("net/ipv6:
      respect rcu grace period before freeing fib6_info"), can result in
      an extra rcu grace period being needed when deleting an interface,
      with the result that netdev_wait_allrefs ends up hitting the msleep(250),
      which is considerably longer than the required grace period.
      This can result in long delays when deleting a large number of interfaces,
      and it can be observed with this script:
      
      ns=dummy-ns
      NIFS=100
      
      ip netns add $ns
      ip netns exec $ns ip link set lo up
      ip netns exec $ns sysctl net.ipv6.conf.default.disable_ipv6=0
      ip netns exec $ns sysctl net.ipv6.conf.default.forwarding=1
      
      for ((i=0; i<$NIFS; i++))
      do
              if=eth$i
              ip netns exec $ns ip link add $if type dummy
              ip netns exec $ns ip link set $if up
              ip netns exec $ns ip -6 addr add 2021:$i::1/120 dev $if
      done
      
      for ((i=0; i<$NIFS; i++))
      do
              if=eth$i
              ip netns exec $ns ip link del $if
      done
      
      ip netns del $ns
      
      Instead of using a fixed msleep(250), this patch tries an extra
      rcu_barrier() followed by an exponential backoff.
      
      Time with this patch on a 5.4 kernel:
      
      real	0m7.704s
      user	0m0.385s
      sys	0m1.230s
      
      Time without this patch:
      
      real    0m31.522s
      user    0m0.438s
      sys     0m1.156s
      
      v2: use exponential backoff instead of trying to wake up
          netdev_wait_allrefs.
      v3: preserve reverse christmas tree ordering of local variables
      v4: try an extra rcu_barrier before the backoff, plus some
          cosmetic changes.
      Signed-off-by: NFrancesco Ruggeri <fruggeri@arista.com>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0e4be9e5
  2. 18 9月, 2020 6 次提交
  3. 17 9月, 2020 2 次提交
  4. 16 9月, 2020 5 次提交
  5. 15 9月, 2020 18 次提交
  6. 14 9月, 2020 4 次提交
    • D
      rxrpc: Fix an overget of the conn bundle when setting up a client conn · f1b44974
      David Howells 提交于
      When setting up a client connection, a second ref is accidentally obtained
      on the connection bundle (we get one when allocating the conn and a second
      one when adding the conn to the bundle).
      
      Fix it to only use the ref obtained by rxrpc_alloc_client_connection() and
      not to add a second when adding the candidate conn to the bundle.
      
      Fixes: 245500d8 ("rxrpc: Rewrite the client connection manager")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      f1b44974
    • D
      rxrpc: Fix conn bundle leak in net-namespace exit · 546a4241
      David Howells 提交于
      When the network namespace exits, rxrpc_clean_up_local_conns() needs to
      unbundle each client connection it evicts.  Fix it to do this.
      
      kernel BUG at net/rxrpc/conn_object.c:481!
      RIP: 0010:rxrpc_destroy_all_connections.cold+0x11/0x13 net/rxrpc/conn_object.c:481
      Call Trace:
       rxrpc_exit_net+0x1a4/0x2e0 net/rxrpc/net_ns.c:119
       ops_exit_list+0xb0/0x160 net/core/net_namespace.c:186
       cleanup_net+0x4ea/0xa00 net/core/net_namespace.c:603
       process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
       worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
       kthread+0x3b5/0x4a0 kernel/kthread.c:292
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
      
      Fixes: 245500d8 ("rxrpc: Rewrite the client connection manager")
      Reported-by: syzbot+52071f826a617b9c76ed@syzkaller.appspotmail.com
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      546a4241
    • D
      rxrpc: Fix rxrpc_bundle::alloc_error to be signed · 8806245a
      David Howells 提交于
      The alloc_error field in the rxrpc_bundle struct should be signed as it has
      negative error codes assigned to it.  Checks directly on it may then fail,
      and may produce a warning like this:
      
      	net/rxrpc/conn_client.c:662 rxrpc_wait_for_channel()
      	warn: 'bundle->alloc_error' is unsigned
      
      Fixes: 245500d8 ("rxrpc: Rewrite the client connection manager")
      Reported-by Dan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      8806245a
    • D
      rxrpc: Fix an error goto in rxrpc_connect_call() · 456b2f2d
      David Howells 提交于
      Fix an error-handling goto in rxrpc_connect_call() whereby it will jump to
      free the bundle it failed to allocate.
      
      Fixes: 245500d8 ("rxrpc: Rewrite the client connection manager")
      Reported-by: Nkernel test robot <lkp@intel.com>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      456b2f2d
  7. 12 9月, 2020 3 次提交
    • V
      Revert "net: dsa: Add more convenient functions for installing port VLANs" · 88236591
      Vladimir Oltean 提交于
      This reverts commit 314f76d7.
      
      Citing that commit message, the call graph was:
      
          dsa_slave_vlan_rx_add_vid   dsa_port_setup_8021q_tagging
                      |                        |
                      |                        |
                      |          +-------------+
                      |          |
                      v          v
                     dsa_port_vid_add      dsa_slave_port_obj_add
                            |                         |
                            +-------+         +-------+
                                    |         |
                                    v         v
                                 dsa_port_vlan_add
      
      Now that tag_8021q has its own ops structure, it no longer relies on
      dsa_port_vid_add, and therefore on the dsa_switch_ops to install its
      VLANs.
      
      So dsa_port_vid_add now only has one single caller. So we can simplify
      the call graph to what it was before, aka:
      
              dsa_slave_vlan_rx_add_vid     dsa_slave_port_obj_add
                            |                         |
                            +-------+         +-------+
                                    |         |
                                    v         v
                                 dsa_port_vlan_add
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88236591
    • V
      net: dsa: tag_8021q: add a context structure · 5899ee36
      Vladimir Oltean 提交于
      While working on another tag_8021q driver implementation, some things
      became apparent:
      
      - It is not mandatory for a DSA driver to offload the tag_8021q VLANs by
        using the VLAN table per se. For example, it can add custom TCAM rules
        that simply encapsulate RX traffic, and redirect & decapsulate rules
        for TX traffic. For such a driver, it makes no sense to receive the
        tag_8021q configuration through the same callback as it receives the
        VLAN configuration from the bridge and the 8021q modules.
      
      - Currently, sja1105 (the only tag_8021q user) sets a
        priv->expect_dsa_8021q variable to distinguish between the bridge
        calling, and tag_8021q calling. That can be improved, to say the
        least.
      
      - The crosschip bridging operations are, in fact, stateful already. The
        list of crosschip_links must be kept by the caller and passed to the
        relevant tag_8021q functions.
      
      So it would be nice if the tag_8021q configuration was more
      self-contained. This patch attempts to do that.
      
      Create a struct dsa_8021q_context which encapsulates a struct
      dsa_switch, and has 2 function pointers for adding and deleting a VLAN.
      These will replace the previous channel to the driver, which was through
      the .port_vlan_add and .port_vlan_del callbacks of dsa_switch_ops.
      
      Also put the list of crosschip_links into this dsa_8021q_context.
      Drivers that don't support cross-chip bridging can simply omit to
      initialize this list, as long as they dont call any cross-chip function.
      
      The sja1105_vlan_add and sja1105_vlan_del functions are refactored into
      a smaller sja1105_vlan_add_one, which now has 2 entry points:
      - sja1105_vlan_add, from struct dsa_switch_ops
      - sja1105_dsa_8021q_vlan_add, from the tag_8021q ops
      But even this change is fairly trivial. It just reflects the fact that
      for sja1105, the VLANs from these 2 channels end up in the same hardware
      table. However that is not necessarily true in the general sense (and
      that's the reason for making this change).
      
      The rest of the patch is mostly plain refactoring of "ds" -> "ctx". The
      dsa_8021q_context structure needs to be propagated because adding a VLAN
      is now done through the ops function pointers inside of it.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5899ee36
    • V
      net: dsa: tag_8021q: setup tagging via a single function call · 7e092af2
      Vladimir Oltean 提交于
      There is no point in calling dsa_port_setup_8021q_tagging for each
      individual port. Additionally, it will become more difficult to do that
      when we'll have a context structure to tag_8021q (next patch). So
      refactor this now.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e092af2