~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mac80211/eht.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * EHT handling
  4  *
  5  * Copyright(c) 2021-2023 Intel Corporation
  6  */
  7 
  8 #include "ieee80211_i.h"
  9 
 10 void
 11 ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
 12                                     struct ieee80211_supported_band *sband,
 13                                     const u8 *he_cap_ie, u8 he_cap_len,
 14                                     const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
 15                                     u8 eht_cap_len,
 16                                     struct link_sta_info *link_sta)
 17 {
 18         struct ieee80211_sta_eht_cap *eht_cap = &link_sta->pub->eht_cap;
 19         struct ieee80211_he_cap_elem *he_cap_ie_elem = (void *)he_cap_ie;
 20         u8 eht_ppe_size = 0;
 21         u8 mcs_nss_size;
 22         u8 eht_total_size = sizeof(eht_cap->eht_cap_elem);
 23         u8 *pos = (u8 *)eht_cap_ie_elem;
 24 
 25         memset(eht_cap, 0, sizeof(*eht_cap));
 26 
 27         if (!eht_cap_ie_elem ||
 28             !ieee80211_get_eht_iftype_cap_vif(sband, &sdata->vif))
 29                 return;
 30 
 31         mcs_nss_size = ieee80211_eht_mcs_nss_size(he_cap_ie_elem,
 32                                                   &eht_cap_ie_elem->fixed,
 33                                                   sdata->vif.type ==
 34                                                         NL80211_IFTYPE_STATION);
 35 
 36         eht_total_size += mcs_nss_size;
 37 
 38         /* Calculate the PPE thresholds length only if the header is present */
 39         if (eht_cap_ie_elem->fixed.phy_cap_info[5] &
 40                         IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT) {
 41                 u16 eht_ppe_hdr;
 42 
 43                 if (eht_cap_len < eht_total_size + sizeof(u16))
 44                         return;
 45 
 46                 eht_ppe_hdr = get_unaligned_le16(eht_cap_ie_elem->optional + mcs_nss_size);
 47                 eht_ppe_size =
 48                         ieee80211_eht_ppe_size(eht_ppe_hdr,
 49                                                eht_cap_ie_elem->fixed.phy_cap_info);
 50                 eht_total_size += eht_ppe_size;
 51 
 52                 /* we calculate as if NSS > 8 are valid, but don't handle that */
 53                 if (eht_ppe_size > sizeof(eht_cap->eht_ppe_thres))
 54                         return;
 55         }
 56 
 57         if (eht_cap_len < eht_total_size)
 58                 return;
 59 
 60         /* Copy the static portion of the EHT capabilities */
 61         memcpy(&eht_cap->eht_cap_elem, pos, sizeof(eht_cap->eht_cap_elem));
 62         pos += sizeof(eht_cap->eht_cap_elem);
 63 
 64         /* Copy MCS/NSS which depends on the peer capabilities */
 65         memset(&eht_cap->eht_mcs_nss_supp, 0,
 66                sizeof(eht_cap->eht_mcs_nss_supp));
 67         memcpy(&eht_cap->eht_mcs_nss_supp, pos, mcs_nss_size);
 68 
 69         if (eht_ppe_size)
 70                 memcpy(eht_cap->eht_ppe_thres,
 71                        &eht_cap_ie_elem->optional[mcs_nss_size],
 72                        eht_ppe_size);
 73 
 74         eht_cap->has_eht = true;
 75 
 76         link_sta->cur_max_bandwidth = ieee80211_sta_cap_rx_bw(link_sta);
 77         link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);
 78 }
 79 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php