From d13abf1180fed6a04088680cf0708e7eae720265 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 9 Feb 2024 17:21:23 +0200 Subject: [PATCH] bgpd: Optimize memory for ecommunity struct ``` struct ecommunity { long unsigned int refcnt; /* 0 8 */ uint8_t unit_size; /* 8 1 */ _Bool disable_ieee_floating; /* 9 1 */ /* XXX 2 bytes hole, try to pack */ uint32_t size; /* 12 4 */ uint8_t * val; /* 16 8 */ char * str; /* 24 8 */ /* size: 32, cachelines: 1, members: 6 */ /* sum members: 30, holes: 1, sum holes: 2 */ /* last cacheline: 32 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis --- bgpd/bgp_ecommunity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index f12d0dd3ee..62e0430c96 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -117,6 +117,9 @@ struct ecommunity { */ uint8_t unit_size; + /* Disable IEEE floating-point encoding for extended community */ + bool disable_ieee_floating; + /* Size of Extended Communities attribute. */ uint32_t size; @@ -125,9 +128,6 @@ struct ecommunity { /* Human readable format string. */ char *str; - - /* Disable IEEE floating-point encoding for extended community */ - bool disable_ieee_floating; }; struct ecommunity_as {