1. 17 2月, 2012 2 次提交
  2. 20 11月, 2011 2 次提交
    • A
      batman-adv: create a common substructure for tt_global/local_entry · 48100bac
      Antonio Quartulli 提交于
      Several functions in the translation table management code assume that the
      tt_global_entry and tt_local_entry structures have the same initial fields such
      as 'addr' and 'hash_entry'. To improve the code readability and to avoid
      mistakes in later changes, a common substructure that substitute the shared
      fields has been introduced (struct tt_common_entry).
      
      Thanks to this modification, it has also been possible to slightly reduce the
      code length by merging some functions like compare_ltt/gtt() and
      tt_local/global_hash_find()
      Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      48100bac
    • A
      batman-adv: fixed hash functions type to uint32_t instead of int · c90681b8
      Antonio Quartulli 提交于
      There are two reasons for this fix:
      - the result of choose_orig() and vis_choose() is an index and therefore it can't
        be negative. Hence it is correct to make the return type unsigned too.
      
      - sizeof(int) may not be the same on ALL the architectures. Since we plan to use
        choose_orig() as DHT hash function, we need to guarantee that, given the same
        argument, the result is the same. Then it is correct to explicitly express
        the size of the return type (and the second argument). Since the expected
        length is currently 4, uint32_t is the most convenient choice.
      Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      c90681b8
  3. 08 9月, 2011 1 次提交
  4. 22 8月, 2011 2 次提交
  5. 20 6月, 2011 1 次提交
  6. 30 5月, 2011 4 次提交
  7. 08 5月, 2011 1 次提交
  8. 02 5月, 2011 1 次提交
  9. 18 4月, 2011 1 次提交
  10. 05 3月, 2011 7 次提交
  11. 31 1月, 2011 1 次提交
  12. 30 1月, 2011 3 次提交
    • S
      batman-adv: Make vis info stack traversal threadsafe · 1181e1da
      Sven Eckelmann 提交于
      The batman-adv vis server has to a stack which stores all information
      about packets which should be send later. This stack is protected
      with a spinlock that is used to prevent concurrent write access to it.
      
      The send_vis_packets function has to take all elements from the stack
      and send them to other hosts over the primary interface. The send will
      be initiated without the lock which protects the stack.
      
      The implementation using list_for_each_entry_safe has the problem that
      it stores the next element as "safe ptr" to allow the deletion of the
      current element in the list. The list may be modified during the
      unlock/lock pair in the loop body which may make the safe pointer
      not pointing to correct next element.
      
      It is safer to remove and use the first element from the stack until no
      elements are available. This does not need reduntant information which
      would have to be validated each time the lock was removed.
      Reported-by: NRussell Senior <russell@personaltelco.net>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      1181e1da
    • S
      batman-adv: Remove vis info element in free_info · dda9fc6b
      Sven Eckelmann 提交于
      The free_info function will be called when no reference to the info
      object exists anymore. It must be ensured that the allocated memory
      gets freed and not only the elements which are managed by the info
      object.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      dda9fc6b
    • S
      batman-adv: Remove vis info on hashing errors · 2674c158
      Sven Eckelmann 提交于
      A newly created vis info object must be removed when it couldn't be
      added to the hash. The old_info which has to be replaced was already
      removed and isn't related to the hash anymore.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      2674c158
  13. 26 1月, 2011 1 次提交
  14. 17 12月, 2010 1 次提交
  15. 30 11月, 2010 5 次提交
    • S
      Staging: batman-adv: Use kernel functions to identify broadcasts · 951c44e0
      Sven Eckelmann 提交于
      linux/etherdevice.h already provides functions to classify different
      ethernet addresses. These inlineable functions should be used instead of
      custom functions.
      
      The check for multicast together with multicast can also be replaced
      with a single test for multicast because for every ethernet address x
      following is always true:
      
      is_broadcast_ether_addr(x) => is_multicast_ether_addr(x)
      
      or when looking more at the implementation:
      
      (FF:FF:FF:FF:FF:FF == x) => [(01:00:00:00:00:00 & x) != 00:00:00:00:00:00]
      Reported-by: NTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      951c44e0
    • S
      Staging: batman-adv: Limit spin_locks to spin_lock_bh · 7a18deb7
      Sven Eckelmann 提交于
      spin_lock_irqsave disables the IRQs and stores them inside the flags
      provided by the caller. This is needed to protect a bottom half handler
      or a user context critical section from being interrupted by an
      interrupt handler which also tries to acquire the spinlock and locks
      forever.
      
      The linux device drivers will receive the packets inside an interrupt
      handler and the network infrastructure will process them inside bottom
      half. Thus batman-adv will only run in user context and bottom half
      handlers. We can conclude that batman-adv doesn't share its own
      spinlocks with real interrupt handlers.
      
      This makes it possible to exchange the quite complex spin_lock_irqsave
      with spin_lock_bh which only stops bottom halves from running on the
      current cpu, but allows interrupt handlers to take over to keep the
      interrupt latency low.
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7a18deb7
    • S
      Staging: batman-adv: Rewrite hash using hlist_* · bd204952
      Sven Eckelmann 提交于
      The hash implementation is a complete implementation of a hash using
      buckets as hash entries and overflow buckets attached to them.
      
      The kernel already provides datastructures hlist_head and hlist_node
      which can be used to implement an hash using lists as hash buckets. So
      it is better to implement heavily used functionality on top of those
      instead of providing a full hash implementation.
      
      The rewrite changes the behavior of some functions slightly:
       * hash_add add elements to the front instead of the tail
       * hash_iterate doesn't provide pointer to access bucket->data directly,
         but it can be accessed using hlist_entry
      Reported-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bd204952
    • S
      Staging: batman-adv: Remove hashdata_choose_cb from hash · 6d5e6542
      Sven Eckelmann 提交于
      Function pointers cannot be inlined by a compiler and thus always has
      the overhead of an call. hashdata_choose_cb's are one of the most often
      called function pointers and its overhead must kept relative low.
      
      As first step, every function which uses this function pointer takes it
      as parameter instead of storing it inside the hash abstraction
      structure.
      
      This not generate any performance gain right now. The called functions
      must also be able to be inlined by the calling functions to enable
      inlining of the function pointer.
      Reported-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6d5e6542
    • S
      Staging: batman-adv: Remove hashdata_compare_cb from hash · 51f3d8a2
      Sven Eckelmann 提交于
      Function pointers cannot be inlined by a compiler and thus always has
      the overhead of an call. hashdata_compare_cb's are one of the most often
      called function pointers and its overhead must kept relative low.
      
      As first step, every function which uses this function pointer takes it
      as parameter instead of storing it inside the hash abstraction
      structure.
      
      This not generate any performance gain right now. The called functions
      must also be able to be inlined by the calling functions to enable
      inlining of the function pointer.
      Reported-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      51f3d8a2
  16. 11 11月, 2010 1 次提交
  17. 10 11月, 2010 2 次提交
  18. 21 10月, 2010 1 次提交
  19. 21 9月, 2010 1 次提交
  20. 05 9月, 2010 2 次提交