]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Optimize struct mld_link_info size
authorJouni Malinen <j@w1.fi>
Sun, 21 Jan 2024 20:24:08 +0000 (22:24 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 21 Jan 2024 20:24:08 +0000 (22:24 +0200)
Use smaller variables when possible and reorder the variables to avoid
unnecessary padding. This drops struct mld_link_info size from 64 to 48
bytes and removes 240 bytes from struct sta_info.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/beacon.c
src/ap/ieee802_11_eht.c
src/ap/sta_info.h

index 9fc73e2c3bb415593dcb6d91d8fde0fd672b6b9b..e50f0a0c976e075b8eeef3fe45d1e9e1bc7eeb37 100644 (file)
@@ -1028,7 +1028,7 @@ static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd,
                os_memcpy(link_info->local_addr, link->own_addr, ETH_ALEN);
 
                wpa_printf(MSG_DEBUG,
-                          "MLD: ML probe response includes link sta info for %d: %zu bytes (estimate %zu)",
+                          "MLD: ML probe response includes link sta info for %d: %u bytes (estimate %zu)",
                           mld_link_id, link_info->resp_sta_profile_len,
                           buflen);
        }
index c703017af907cd83fd8210ca9b694c84a11272d1..b599e10433ffa248f367b76ef66174dbb2901fd7 100644 (file)
@@ -1255,7 +1255,7 @@ u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd,
                goto out;
        }
 
-       info->links[hapd->mld_link_id].valid = true;
+       info->links[hapd->mld_link_id].valid = 1;
 
        /* Parse the link info field */
        ml_len -= sizeof(*ml) + common_info_len;
@@ -1382,7 +1382,7 @@ u16 hostapd_process_ml_assoc_req(struct hostapd_data *hapd,
                ml_len -= sub_elem_len;
 
                wpa_printf(MSG_DEBUG, "MLD: link ctrl=0x%x, " MACSTR
-                          ", nstr bitmap len=%lu",
+                          ", nstr bitmap len=%u",
                           control, MAC2STR(link_info->peer_addr),
                           link_info->nstr_bitmap_len);
 
index f459f6278c2b10e839a9638575d7a53322cc4b84..b136ff7bfab8632d9dc1d6084a45d04ca57e2007 100644 (file)
@@ -82,17 +82,17 @@ struct mld_info {
        } common_info;
 
        struct mld_link_info {
-               u8 valid;
+               u8 valid:1;
+               u8 nstr_bitmap_len:2;
                u8 local_addr[ETH_ALEN];
                u8 peer_addr[ETH_ALEN];
 
-               size_t nstr_bitmap_len;
                u8 nstr_bitmap[2];
 
                u16 capability;
 
                u16 status;
-               size_t resp_sta_profile_len;
+               u16 resp_sta_profile_len;
                u8 *resp_sta_profile;
 
                const u8 *rsne, *rsnxe;