]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: Optimize memory usage for bgp_static struct
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 29 Jan 2024 14:00:07 +0000 (16:00 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 30 Jan 2024 06:12:59 +0000 (08:12 +0200)
commit0804038916212cf8902595aeab016877e3b08bb2
tree474dd4d861243b93a8ce43189bf2d1a5736f32dc
parent4821e7a0d88ce1a70c1a27398b040817e5941238
bgpd: Optimize memory usage for bgp_static struct

```
struct bgp_static {
        int                        backdoor;             /*     0     4 */
        uint32_t                   label_index;          /*     4     4 */
        uint8_t                    valid;                /*     8     1 */

        /* XXX 1 byte hole, try to pack */

        uint16_t                   encap_tunneltype;     /*    10     2 */
        uint32_t                   igpmetric;            /*    12     4 */
        struct in_addr             igpnexthop;           /*    16     4 */
        uint32_t                   atomic;               /*    20     4 */
        struct {
                char *             name;                 /*    24     8 */
                struct route_map * map;                  /*    32     8 */
        } rmap;                                          /*    24    16 */
        struct prefix_rd           prd __attribute__((__aligned__(8))); /*    40    16 */
        char *                     prd_pretty;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        mpls_label_t               label;                /*    64     4 */

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

        esi_t *                    eth_s_id;             /*    72     8 */
        struct ethaddr *           router_mac;           /*    80     8 */
        struct prefix              gatewayIp __attribute__((__aligned__(8))); /*    88    56 */

        /* size: 144, cachelines: 3, members: 14 */
        /* sum members: 139, holes: 2, sum holes: 5 */
        /* forced alignments: 2 */
        /* last cacheline: 16 bytes */
} __attribute__((__aligned__(8)));   /* saved 8 bytes! */
```

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