diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-08-11 13:59:13 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-08-11 13:59:13 +0300 |
| commit | 4ace11d0101450d6e3ae6be26cdb07313e171a46 (patch) | |
| tree | 44544b114005c47e5d1f911abe88b4c002896d6a /bgpd/bgp_attr_evpn.c | |
| parent | 423e8076b53fe359f83575c5f2d8b80741d592b5 (diff) | |
bgpd: Move evpn_overlay to a pointer
Before this convertion:
```
/* --- cacheline 3 boundary (192 bytes) --- */
struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */
struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */
struct bgp_route_evpn evpn_overlay; /* 208 36 */
```
After this convertion:
```
/* --- cacheline 3 boundary (192 bytes) --- */
struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */
struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */
struct bgp_route_evpn * evpn_overlay; /* 208 8 */
```
Saving 28 bytes when EVPN is not used.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_attr_evpn.c')
| -rw-r--r-- | bgpd/bgp_attr_evpn.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c index 086c36f36c..fc7548d9bf 100644 --- a/bgpd/bgp_attr_evpn.c +++ b/bgpd/bgp_attr_evpn.c @@ -24,6 +24,13 @@ bool bgp_route_evpn_same(const struct bgp_route_evpn *e1, const struct bgp_route_evpn *e2) { + if (!e1 && e2) + return false; + if (!e2 && e1) + return false; + if (!e1 && !e2) + return true; + return (e1->type == e2->type && !memcmp(&(e1->eth_s_id), &(e2->eth_s_id), sizeof(esi_t)) && !ipaddr_cmp(&(e1->gw_ip), &(e2->gw_ip))); |
