On 09/01/2015 06:43 PM, Ahmed Amamou wrote:

rbr_node are used to save distant Rbridges information
they are use by local Rbridge to take routing decision
this patch add get/put/free/find/del  function to rbr_node to
avoid freeing a rbr_node that is still in use for routing

Signed-off-by: Ahmed Amamou <ah...@gandi.net>
Signed-off-by: Kamel Haddadou <ka...@gandi.net>
Signed-off-by: William Dauchy <will...@gandi.net>
---
  net/bridge/rbr.c         | 35 +++++++++++++++++++++++++++++++++++
  net/bridge/rbr_private.h | 23 +++++++++++++++++++++++
  2 files changed, 58 insertions(+)

[...]
diff --git a/net/bridge/rbr_private.h b/net/bridge/rbr_private.h
index 9166a8b..186e454 100644
--- a/net/bridge/rbr_private.h
+++ b/net/bridge/rbr_private.h
@@ -44,7 +44,30 @@ struct rbr {
[...]
+static inline void rbr_node_put(struct rbr_node *rbr_node)
+{
+       if (rbr_node) {
+               if (unlikely(atomic_dec_and_test(&rbr_node->refs)))

   Could fold both 'if's into one and avoid {} altogether.

+                       rbr_node_free(rbr_node);
+       }
+}
+

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to