1. 25 6月, 2020 3 次提交
  2. 05 11月, 2019 1 次提交
    • N
      net: bridge: fdb: eliminate extra port state tests from fast-path · 5d1fcaf3
      Nikolay Aleksandrov 提交于
      When commit df1c0b84 ("[BRIDGE]: Packets leaking out of
      disabled/blocked ports.") introduced the port state tests in
      br_fdb_update() it was to avoid learning/refreshing from STP BPDUs, it was
      also used to avoid learning/refreshing from user-space with NTF_USE. Those
      two tests are done for every packet entering the bridge if it's learning,
      but for the fast-path we already have them checked in br_handle_frame() and
      is unnecessary to do it again. Thus push the checks to the unlikely cases
      and drop them from br_fdb_update(), the new nbp_state_should_learn() helper
      is used to determine if the port state allows br_fdb_update() to be called.
      The two places which need to do it manually are:
       - user-space add call with NTF_USE set
       - link-local packet learning done in __br_handle_local_finish()
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d1fcaf3
  3. 02 11月, 2019 3 次提交
  4. 30 10月, 2019 7 次提交
  5. 31 5月, 2019 1 次提交
  6. 08 4月, 2019 1 次提交
    • N
      rhashtable: use bit_spin_locks to protect hash bucket. · 8f0db018
      NeilBrown 提交于
      This patch changes rhashtables to use a bit_spin_lock on BIT(1) of the
      bucket pointer to lock the hash chain for that bucket.
      
      The benefits of a bit spin_lock are:
       - no need to allocate a separate array of locks.
       - no need to have a configuration option to guide the
         choice of the size of this array
       - locking cost is often a single test-and-set in a cache line
         that will have to be loaded anyway.  When inserting at, or removing
         from, the head of the chain, the unlock is free - writing the new
         address in the bucket head implicitly clears the lock bit.
         For __rhashtable_insert_fast() we ensure this always happens
         when adding a new key.
       - even when lockings costs 2 updates (lock and unlock), they are
         in a cacheline that needs to be read anyway.
      
      The cost of using a bit spin_lock is a little bit of code complexity,
      which I think is quite manageable.
      
      Bit spin_locks are sometimes inappropriate because they are not fair -
      if multiple CPUs repeatedly contend of the same lock, one CPU can
      easily be starved.  This is not a credible situation with rhashtable.
      Multiple CPUs may want to repeatedly add or remove objects, but they
      will typically do so at different buckets, so they will attempt to
      acquire different locks.
      
      As we have more bit-locks than we previously had spinlocks (by at
      least a factor of two) we can expect slightly less contention to
      go with the slightly better cache behavior and reduced memory
      consumption.
      
      To enhance type checking, a new struct is introduced to represent the
        pointer plus lock-bit
      that is stored in the bucket-table.  This is "struct rhash_lock_head"
      and is empty.  A pointer to this needs to be cast to either an
      unsigned lock, or a "struct rhash_head *" to be useful.
      Variables of this type are most often called "bkt".
      
      Previously "pprev" would sometimes point to a bucket, and sometimes a
      ->next pointer in an rhash_head.  As these are now different types,
      pprev is NULL when it would have pointed to the bucket. In that case,
      'blk' is used, together with correct locking protocol.
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8f0db018
  7. 19 1月, 2019 1 次提交
  8. 18 1月, 2019 1 次提交
    • P
      net: Add extack argument to ndo_fdb_add() · 87b0984e
      Petr Machata 提交于
      Drivers may not be able to support certain FDB entries, and an error
      code is insufficient to give clear hints as to the reasons of rejection.
      
      In order to make it possible to communicate the rejection reason, extend
      ndo_fdb_add() with an extack argument. Adapt the existing
      implementations of ndo_fdb_add() to take the parameter (and ignore it).
      Pass the extack parameter when invoking ndo_fdb_add() from rtnl_fdb_add().
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      87b0984e
  9. 17 12月, 2018 1 次提交
  10. 08 12月, 2018 1 次提交
  11. 18 10月, 2018 1 次提交
  12. 29 9月, 2018 1 次提交
  13. 13 9月, 2018 1 次提交
  14. 09 6月, 2018 1 次提交
  15. 04 5月, 2018 1 次提交
  16. 01 5月, 2018 1 次提交
  17. 01 2月, 2018 1 次提交
  18. 14 12月, 2017 1 次提交
    • N
      net: bridge: use rhashtable for fdbs · eb793583
      Nikolay Aleksandrov 提交于
      Before this patch the bridge used a fixed 256 element hash table which
      was fine for small use cases (in my tests it starts to degrade
      above 1000 entries), but it wasn't enough for medium or large
      scale deployments. Modern setups have thousands of participants in a
      single bridge, even only enabling vlans and adding a few thousand vlan
      entries will cause a few thousand fdbs to be automatically inserted per
      participating port. So we need to scale the fdb table considerably to
      cope with modern workloads, and this patch converts it to use a
      rhashtable for its operations thus improving the bridge scalability.
      Tests show the following results (10 runs each), at up to 1000 entries
      rhashtable is ~3% slower, at 2000 rhashtable is 30% faster, at 3000 it
      is 2 times faster and at 30000 it is 50 times faster.
      Obviously this happens because of the properties of the two constructs
      and is expected, rhashtable keeps pretty much a constant time even with
      10000000 entries (tested), while the fixed hash table struggles
      considerably even above 10000.
      As a side effect this also reduces the net_bridge struct size from 3248
      bytes to 1344 bytes. Also note that the key struct is 8 bytes.
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eb793583
  19. 01 9月, 2017 1 次提交
  20. 30 8月, 2017 1 次提交
  21. 08 8月, 2017 1 次提交
  22. 04 7月, 2017 1 次提交
  23. 09 6月, 2017 3 次提交
  24. 01 5月, 2017 1 次提交
  25. 18 4月, 2017 1 次提交
  26. 25 3月, 2017 2 次提交
  27. 17 3月, 2017 1 次提交