@@ -1864,6 +1864,55 @@ ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata,
1864
1864
ieee80211_fragment_element (skb , ml_elem_len , WLAN_EID_FRAGMENT );
1865
1865
}
1866
1866
1867
+ static int
1868
+ ieee80211_link_common_elems_size (struct ieee80211_sub_if_data * sdata ,
1869
+ enum nl80211_iftype iftype ,
1870
+ struct cfg80211_bss * cbss ,
1871
+ size_t elems_len )
1872
+ {
1873
+ struct ieee80211_local * local = sdata -> local ;
1874
+ const struct ieee80211_sband_iftype_data * iftd ;
1875
+ struct ieee80211_supported_band * sband ;
1876
+ size_t size = 0 ;
1877
+
1878
+ if (!cbss )
1879
+ return size ;
1880
+
1881
+ sband = local -> hw .wiphy -> bands [cbss -> channel -> band ];
1882
+
1883
+ /* add STA profile elements length */
1884
+ size += elems_len ;
1885
+
1886
+ /* and supported rates length */
1887
+ size += 4 + sband -> n_bitrates ;
1888
+
1889
+ /* supported channels */
1890
+ size += 2 + 2 * sband -> n_channels ;
1891
+
1892
+ iftd = ieee80211_get_sband_iftype_data (sband , iftype );
1893
+ if (iftd )
1894
+ size += iftd -> vendor_elems .len ;
1895
+
1896
+ /* power capability */
1897
+ size += 4 ;
1898
+
1899
+ /* HT, VHT, HE, EHT */
1900
+ size += 2 + sizeof (struct ieee80211_ht_cap );
1901
+ size += 2 + sizeof (struct ieee80211_vht_cap );
1902
+ size += 2 + 1 + sizeof (struct ieee80211_he_cap_elem ) +
1903
+ sizeof (struct ieee80211_he_mcs_nss_supp ) +
1904
+ IEEE80211_HE_PPE_THRES_MAX_LEN ;
1905
+
1906
+ if (sband -> band == NL80211_BAND_6GHZ )
1907
+ size += 2 + 1 + sizeof (struct ieee80211_he_6ghz_capa );
1908
+
1909
+ size += 2 + 1 + sizeof (struct ieee80211_eht_cap_elem ) +
1910
+ sizeof (struct ieee80211_eht_mcs_nss_supp ) +
1911
+ IEEE80211_EHT_PPE_THRES_MAX_LEN ;
1912
+
1913
+ return size ;
1914
+ }
1915
+
1867
1916
static int ieee80211_send_assoc (struct ieee80211_sub_if_data * sdata )
1868
1917
{
1869
1918
struct ieee80211_local * local = sdata -> local ;
@@ -1902,42 +1951,15 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
1902
1951
1903
1952
for (link_id = 0 ; link_id < IEEE80211_MLD_MAX_NUM_LINKS ; link_id ++ ) {
1904
1953
struct cfg80211_bss * cbss = assoc_data -> link [link_id ].bss ;
1905
- const struct ieee80211_sband_iftype_data * iftd ;
1906
- struct ieee80211_supported_band * sband ;
1954
+ size_t elems_len = assoc_data -> link [link_id ].elems_len ;
1907
1955
1908
1956
if (!cbss )
1909
1957
continue ;
1910
1958
1911
- sband = local -> hw .wiphy -> bands [cbss -> channel -> band ];
1912
-
1913
1959
n_links ++ ;
1914
- /* add STA profile elements length */
1915
- size += assoc_data -> link [link_id ].elems_len ;
1916
- /* and supported rates length */
1917
- size += 4 + sband -> n_bitrates ;
1918
- /* supported channels */
1919
- size += 2 + 2 * sband -> n_channels ;
1920
-
1921
- iftd = ieee80211_get_sband_iftype_data (sband , iftype );
1922
- if (iftd )
1923
- size += iftd -> vendor_elems .len ;
1924
-
1925
- /* power capability */
1926
- size += 4 ;
1927
-
1928
- /* HT, VHT, HE, EHT */
1929
- size += 2 + sizeof (struct ieee80211_ht_cap );
1930
- size += 2 + sizeof (struct ieee80211_vht_cap );
1931
- size += 2 + 1 + sizeof (struct ieee80211_he_cap_elem ) +
1932
- sizeof (struct ieee80211_he_mcs_nss_supp ) +
1933
- IEEE80211_HE_PPE_THRES_MAX_LEN ;
1934
-
1935
- if (sband -> band == NL80211_BAND_6GHZ )
1936
- size += 2 + 1 + sizeof (struct ieee80211_he_6ghz_capa );
1937
-
1938
- size += 2 + 1 + sizeof (struct ieee80211_eht_cap_elem ) +
1939
- sizeof (struct ieee80211_eht_mcs_nss_supp ) +
1940
- IEEE80211_EHT_PPE_THRES_MAX_LEN ;
1960
+
1961
+ size += ieee80211_link_common_elems_size (sdata , iftype , cbss ,
1962
+ elems_len );
1941
1963
1942
1964
/* non-inheritance element */
1943
1965
size += 2 + 2 + PRESENT_ELEMS_MAX ;
0 commit comments