From: Anuradha Karuppiah Date: Fri, 15 May 2020 00:00:10 +0000 (-0700) Subject: zebra: change the L2 NHG id format to co-exist with the L3NHG ids X-Git-Tag: base_7.6~165^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4f9bb78eca97fdb86e80b11f9234ac9b9786e235;p=matthieu%2Ffrr.git zebra: change the L2 NHG id format to co-exist with the L3NHG ids 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 --- diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h index acdd2862b0..dc2c299cf2 100644 --- a/zebra/zebra_evpn_mh.h +++ b/zebra/zebra_evpn_mh.h @@ -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 */ diff --git a/zebra/zebra_nhg.h b/zebra/zebra_nhg.h index b2ef88bb61..9382b8c65d 100644 --- a/zebra/zebra_nhg.h +++ b/zebra/zebra_nhg.h @@ -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))