All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ahmed Amamou <ahmed@gandi.net>
To: netdev@vger.kernel.org
Cc: william@gandi.net, f.cachereul@alphalink.fr,
	Ahmed Amamou <ahmed@gandi.net>, Kamel Haddadou <kamel@gandi.net>
Subject: [RFC PATCH 16/24] net: rbridge: Update forwarding database
Date: Wed, 24 Sep 2014 17:52:12 +0200	[thread overview]
Message-ID: <1411573940-14079-17-git-send-email-ahmed@gandi.net> (raw)
In-Reply-To: <1411573940-14079-1-git-send-email-ahmed@gandi.net>

update forwarding database to include nickname information used
in encapsulation and decapsulation
add functions to get and update nickname

Signed-off-by: Ahmed Amamou <ahmed@gandi.net>
Signed-off-by: Kamel Haddadou <kamel@gandi.net>
Signed-off-by: William Dauchy <william@gandi.net>
---
 net/bridge/br_fdb.c     | 40 ++++++++++++++++++++++++++++++++++++++++
 net/bridge/br_private.h | 11 +++++++++++
 2 files changed, 51 insertions(+)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 6f6c95c..544151f 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -531,8 +531,14 @@ int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 	return ret;
 }
 
+#ifdef CONFIG_TRILL
+void br_fdb_update_nick(struct net_bridge *br, struct net_bridge_port *source,
+			const unsigned char *addr, u16 vid, bool added_by_user,
+			uint16_t nick)
+#else
 void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 		   const unsigned char *addr, u16 vid, bool added_by_user)
+#endif
 {
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
@@ -566,6 +572,10 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 				fdb->added_by_user = 1;
 			if (unlikely(fdb_modified))
 				fdb_notify(br, fdb, RTM_NEWNEIGH);
+#ifdef CONFIG_TRILL
+			if (nick != RBRIDGE_NICKNAME_UNUSED)
+				fdb->nick = nick;
+#endif
 		}
 	} else {
 		spin_lock(&br->hash_lock);
@@ -584,6 +594,17 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
 	}
 }
 
+#ifdef CONFIG_TRILL
+void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
+		   const unsigned char *addr, u16 vid, bool added_by_user)
+{
+	br_fdb_update_nick(br, source, addr, vid, added_by_user,
+			   RBRIDGE_NICKNAME_UNUSED);
+}
+
+#endif
+
+
 static int fdb_to_nud(const struct net_bridge_fdb_entry *fdb)
 {
 	if (fdb->is_local)
@@ -1014,3 +1035,22 @@ void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p)
 		}
 	}
 }
+#ifdef CONFIG_TRILL
+/* get_nick_from_mac: used to get correspondant nick to Mac address
+ * used only on ingress/Egress Rbridge (those how encapsulate
+ * and decapsulate frames)
+ * must be called while encapsulating  to get mac <-> nick correspondance
+ */
+uint16_t get_nick_from_mac(struct net_bridge_port *p, unsigned char *dest,
+			   u16 vid)
+{
+	struct hlist_head *head = &p->br->hash[br_mac_hash(dest, vid)];
+	struct net_bridge_fdb_entry *fdb;
+	if (is_multicast_ether_addr(dest))
+		return RBRIDGE_NICKNAME_NONE;
+	fdb = fdb_find(head, dest, vid);
+	if (likely(fdb))
+		return fdb->nick;
+	return RBRIDGE_NICKNAME_NONE;
+}
+#endif
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 2d15b35..37456cf 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -118,6 +118,9 @@ struct net_bridge_fdb_entry
 	unsigned char			is_static;
 	unsigned char			added_by_user;
 	__u16				vlan_id;
+#ifdef CONFIG_TRILL
+	__u16				nick; /* destination's nickname */
+#endif
 };
 
 struct net_bridge_port_group {
@@ -428,6 +431,14 @@ int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
 		struct net_device *dev, struct net_device *fdev, int idx);
 int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p);
 void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p);
+#ifdef CONFIG_TRILL
+void br_fdb_update_nick(struct net_bridge *br,
+			struct net_bridge_port *source,
+			const unsigned char *addr,
+			u16 vid, bool added_by_user, uint16_t nick);
+uint16_t get_nick_from_mac(struct net_bridge_port *p, unsigned char *dest,
+			   u16 vid);
+#endif
 
 /* br_forward.c */
 void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb);
-- 
1.9.1

  parent reply	other threads:[~2014-09-24 16:03 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 15:51 [RFC PATCH 00/24] TRILL implementation Ahmed Amamou
2014-09-24 15:51 ` [RFC PATCH 01/24] net: rbridge: add trill frame description Ahmed Amamou
2014-09-24 16:38   ` Stephen Hemminger
2014-09-24 16:48     ` William Dauchy
2014-09-24 17:26       ` Cong Wang
2014-09-24 17:34         ` William Dauchy
2014-09-24 17:01   ` Cong Wang
2014-09-24 15:51 ` [RFC PATCH 02/24] net: rbridge: Add layer 2 IS-IS Ethertype Ahmed Amamou
2014-09-24 15:51 ` [RFC PATCH 03/24] net: rbridge: Add RBridge structure Ahmed Amamou
2014-09-24 16:40   ` Stephen Hemminger
2014-09-24 16:55     ` William Dauchy
2014-09-24 17:18   ` Cong Wang
2014-09-24 15:52 ` [RFC PATCH 04/24] net: rbridge: Add CONFIG_TRILL Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 05/24] net: rbridge: Adapt Bridge structure Ahmed Amamou
2014-09-24 20:56   ` Francois Romieu
2014-09-24 15:52 ` [RFC PATCH 06/24] net: rbridge: Enable/disable TRILL capability Ahmed Amamou
2014-09-24 17:46   ` Vlad Yasevich
2014-09-24 15:52 ` [RFC PATCH 07/24] net: rbridge: Add sysfs for trill_state Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 08/24] net: rbridge: Add Rbridge netlink message skeleton Ahmed Amamou
2014-09-24 17:52   ` Vlad Yasevich
2014-09-24 15:52 ` [RFC PATCH 09/24] net: rbridge: Get Rbridge nickname from daemon Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 10/24] net: rbridge: Add elected dtroot Ahmed Amamou
2014-09-25 11:30   ` Sergei Shtylyov
2014-09-24 15:52 ` [RFC PATCH 11/24] net: rbridge: Add rbr_node management function Ahmed Amamou
2014-09-25 11:24   ` Sergei Shtylyov
2014-09-24 15:52 ` [RFC PATCH 12/24] net: rbridge: Clean up rbr_node on rbridge stop Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 13/24] net: rbridge: Add set_node function Ahmed Amamou
2014-09-25 11:34   ` Sergei Shtylyov
2014-09-24 15:52 ` [RFC PATCH 14/24] net: rbridge: Add get_node function Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 15/24] net: rbridge: Add basic trill frame handling function Ahmed Amamou
2014-09-24 19:23   ` Francois Romieu
2014-09-24 15:52 ` Ahmed Amamou [this message]
2014-09-24 15:52 ` [RFC PATCH 17/24] net: rbridge: Add test on trill flag before flood Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 18/24] net: rbridge: Add encapsulation process Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 19/24] net: rbridge: Add receive function Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 20/24] net: rbridge: Add multicast recv handling Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 21/24] net: rbridge: Add decapsulation function Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 22/24] net: rbridge: Add rbr_fwd Ahmed Amamou
2014-09-25 11:43   ` Sergei Shtylyov
2014-09-24 15:52 ` [RFC PATCH 23/24] net: rbridge: Add rbr_multidest_fwd Ahmed Amamou
2014-09-24 15:52 ` [RFC PATCH 24/24] net: rbridge: replace net_port rx_handler Ahmed Amamou
2014-09-24 16:44 ` [RFC PATCH 00/24] TRILL implementation Stephen Hemminger
2014-09-24 16:54   ` William Dauchy
2014-09-24 17:24     ` Cong Wang
2014-09-24 17:33       ` William Dauchy
2014-09-24 20:57     ` Francois Romieu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411573940-14079-17-git-send-email-ahmed@gandi.net \
    --to=ahmed@gandi.net \
    --cc=f.cachereul@alphalink.fr \
    --cc=kamel@gandi.net \
    --cc=netdev@vger.kernel.org \
    --cc=william@gandi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.