]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: change the L2 NHG id format to co-exist with the L3NHG ids
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 15 May 2020 00:00:10 +0000 (17:00 -0700)
committerAnuradha Karuppiah <anuradhak@nvidia.com>
Tue, 1 Dec 2020 17:46:28 +0000 (09:46 -0800)
It is now 4bits of type and 28bits of value -
1. type=0 is for L3 NHG
2. type=1 is for L2 NH
3. type=2 is for L2 NHG

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
zebra/zebra_evpn_mh.h
zebra/zebra_nhg.h

index acdd2862b0909c701ba074a42f9b08ca6ed4452a..dc2c299cf23fddf0983b217c1847c5cd477df2b0 100644 (file)
@@ -27,6 +27,7 @@
 #include "bitfield.h"
 #include "zebra_vxlan.h"
 #include "zebra_vxlan_private.h"
+#include "zebra_nhg.h"
 
 #define EVPN_MH_VTY_STR "Multihoming\n"
 
@@ -205,18 +206,17 @@ struct zebra_evpn_mh_info {
        struct in_addr es_originator_ip;
 
        /* L2 NH and NHG ids -
-        * Most significant 8 bits is type. Lower 24 bits is the value
+        * Most significant 4 bits is type. Lower 28 bits is the value
         * allocated from the nh_id_bitmap.
         */
        bitfield_t nh_id_bitmap;
 #define EVPN_NH_ID_MAX       (16*1024)
 #define EVPN_NH_ID_VAL_MASK  0xffffff
-#define EVPN_NH_ID_TYPE_POS  24
 /* The purpose of using different types for NHG and NH is NOT to manage the
  * id space separately. It is simply to make debugging easier.
  */
-#define EVPN_NH_ID_TYPE_BIT  (1 << EVPN_NH_ID_TYPE_POS)
-#define EVPN_NHG_ID_TYPE_BIT (2 << EVPN_NH_ID_TYPE_POS)
+#define EVPN_NH_ID_TYPE_BIT (NHG_TYPE_L2_NH << NHG_ID_TYPE_POS)
+#define EVPN_NHG_ID_TYPE_BIT (NHG_TYPE_L2 << NHG_ID_TYPE_POS)
        /* L2-NHG table - key: nhg_id, data: zebra_evpn_es */
        struct hash *nhg_table;
        /* L2-NH table - key: vtep_up, data: zebra_evpn_nh */
index b2ef88bb61a0d4006adcbd96db26685d2fef720d..9382b8c65d11229b53b7f002b7da0251c30a36b4 100644 (file)
@@ -126,6 +126,14 @@ struct nhg_hash_entry {
 #define NEXTHOP_GROUP_FPM (1 << 6)
 };
 
+/* Upper 4 bits of the NHG are reserved for indicating the NHG type */
+#define NHG_ID_TYPE_POS 28
+enum nhg_type {
+       NHG_TYPE_L3 = 0,
+       NHG_TYPE_L2_NH, /* NHs in a L2 NHG used as a MAC/FDB dest */
+       NHG_TYPE_L2,    /* L2 NHG used as a MAC/FDB dest */
+};
+
 /* Was this one we created, either this session or previously? */
 #define ZEBRA_NHG_CREATED(NHE)                                                 \
        (((NHE->type) <= ZEBRA_ROUTE_MAX) && (NHE->type != ZEBRA_ROUTE_KERNEL))