]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: One more attr struct memory optimization
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 1 Feb 2024 15:28:42 +0000 (17:28 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 1 Feb 2024 15:28:42 +0000 (17:28 +0200)
commit0223b98c5c329506500dfd3130ac9ff72314be98
treeab9fb2c955d1885a4fc7f540c3b3e687de753502
parenta2caf2b5e132ad6d50d83348d8efe9cdea72ec6e
bgpd: One more attr struct memory optimization

```
struct attr {
struct aspath *            aspath;               /*     0     8 */
struct community *         community;            /*     8     8 */
long unsigned int          refcnt;               /*    16     8 */
_uint64_t                  flag;                 /*    24     8 */
struct in_addr             nexthop;              /*    32     4 */
uint32_t                   med;                  /*    36     4 */
uint32_t                   local_pref;           /*    40     4 */
ifindex_t                  nh_ifindex;           /*    44     4 */
uint8_t                    nh_flags;             /*    48     1 */
uint8_t                    origin;               /*    49     1 */
uint8_t                    es_flags;             /*    50     1 */
uint8_t                    router_flag;          /*    51     1 */
uint8_t                    distance;             /*    52     1 */
uint8_t                    df_alg;               /*    53     1 */
uint16_t                   df_pref;              /*    54     2 */
enum pta_type              pmsi_tnl_type;        /*    56     4 */
uint32_t                   rmap_change_flags;    /*    60     4 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct in6_addr            mp_nexthop_global;    /*    64    16 */
struct in6_addr            mp_nexthop_local;     /*    80    16 */
ifindex_t                  nh_lla_ifindex;       /*    96     4 */
mpls_label_t               label;                /*   100     4 */
struct ecommunity *        ecommunity;           /*   104     8 */
struct ecommunity *        ipv6_ecommunity;      /*   112     8 */
struct lcommunity *        lcommunity;           /*   120     8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct cluster_list *      cluster1;             /*   128     8 */
struct transit *           transit;              /*   136     8 */
struct in_addr             mp_nexthop_global_in; /*   144     4 */
struct in_addr             aggregator_addr;      /*   148     4 */
struct in_addr             originator_id;        /*   152     4 */
uint32_t                   weight;               /*   156     4 */
as_t                       aggregator_as;        /*   160     4 */
uint8_t                    mp_nexthop_len;       /*   164     1 */
uint8_t                    mp_nexthop_prefer_global; /*   165     1 */
uint8_t                    sticky;               /*   166     1 */
uint8_t                    default_gw;           /*   167     1 */
route_tag_t                tag;                  /*   168     4 */
uint32_t                   label_index;          /*   172     4 */
struct bgp_attr_srv6_vpn * srv6_vpn;             /*   176     8 */
struct bgp_attr_srv6_l3vpn * srv6_l3vpn;         /*   184     8 */
/* --- 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 */
uint32_t                   mm_seqnum;            /*   244     4 */
uint32_t                   mm_sync_seqnum;       /*   248     4 */
struct ethaddr             rmac;                 /*   252     6 */
/* --- cacheline 4 boundary (256 bytes) was 2 bytes ago --- */
uint16_t                   encap_tunneltype;     /*   258     2 */
uint32_t                   rmap_table_id;        /*   260     4 */
uint32_t                   link_bw;              /*   264     4 */
esi_t                      esi;                  /*   268    10 */

/* XXX 2 bytes hole, try to pack */

uint32_t                   srte_color;           /*   280     4 */
enum nexthop_types_t       nh_type;              /*   284     4 */
enum blackhole_type        bh_type;              /*   288     4 */
uint32_t                   otc;                  /*   292     4 */
_uint64_t                  aigp_metric;          /*   296     8 */

/* size: 304, cachelines: 5, members: 54 */
/* sum members: 302, holes: 1, sum holes: 2 */
/* last cacheline: 48 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_attr.h