All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/net/wireless/ath/ath11k/mac.c:1927:27: warning: Although the value stored to 'he_mcs' is used in the enclosing expression, the value is never actually read from 'he_mcs' [clang-analyzer-deadcode.DeadStores]
Date: Sun, 05 Dec 2021 08:40:25 +0800	[thread overview]
Message-ID: <202112050821.X3jKB1bZ-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 30793 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Miles Hu <milehu@codeaurora.org>
CC: Kalle Valo <kvalo@codeaurora.org>
CC: Aloka Dixit <alokad@codeaurora.org>
CC: Lavanya Suresh <lavaks@codeaurora.org>
CC: Pradeep Chitrapu <pradeepc@codeaurora.org>
CC: Venkateswara Naralasetty <vnaralas@codeaurora.org>
CC: Jouni Malinen <jouni@codeaurora.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bbef3c7a63d2a4cb0f3f839db9e767f168c5e348
commit: 61fe43e7216df6e9a912d831aafc7142fa20f280 ath11k: add support for setting fixed HE rate/gi/ltf
date:   10 weeks ago
:::::: branch date: 8 hours ago
:::::: commit date: 10 weeks ago
config: i386-randconfig-c001-20211015 (https://download.01.org/0day-ci/archive/20211205/202112050821.X3jKB1bZ-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6069a6a5049497a32a50a49661c2f4169078bdba)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=61fe43e7216df6e9a912d831aafc7142fa20f280
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 61fe43e7216df6e9a912d831aafc7142fa20f280
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
   16 warnings generated.
   drivers/video/fbdev/nvidia/nv_i2c.c:89:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(chan->adapter.name, name);
           ^~~~~~
   drivers/video/fbdev/nvidia/nv_i2c.c:89:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(chan->adapter.name, name);
           ^~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
   16 warnings generated.
   drivers/video/fbdev/nvidia/nvidia.c:124:4: warning: Value stored to 'tmp' is never read [clang-analyzer-deadcode.DeadStores]
                           tmp = 0;
                           ^     ~
   drivers/video/fbdev/nvidia/nvidia.c:124:4: note: Value stored to 'tmp' is never read
                           tmp = 0;
                           ^     ~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   17 warnings generated.
   drivers/net/wireless/ath/ath11k/wmi.c:890:2: warning: Value stored to 'ptr' is never read [clang-analyzer-deadcode.DeadStores]
           ptr += sizeof(*tlv);
           ^      ~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:890:2: note: Value stored to 'ptr' is never read
           ptr += sizeof(*tlv);
           ^      ~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7111:22: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
           conn_req.service_id = svc_id[pdev_idx];
                               ^
   drivers/net/wireless/ath/ath11k/wmi.c:7227:6: note: Assuming 'wmi_ep_count' is <= field 'max_radios'
           if (wmi_ep_count > ab->hw_params.max_radios)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7227:2: note: Taking false branch
           if (wmi_ep_count > ab->hw_params.max_radios)
           ^
   drivers/net/wireless/ath/ath11k/wmi.c:7230:14: note: Assuming 'i' is < 'wmi_ep_count'
           for (i = 0; i < wmi_ep_count; i++)
                       ^~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7230:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < wmi_ep_count; i++)
           ^
   drivers/net/wireless/ath/ath11k/wmi.c:7230:14: note: Assuming 'i' is < 'wmi_ep_count'
           for (i = 0; i < wmi_ep_count; i++)
                       ^~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7230:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < wmi_ep_count; i++)
           ^
   drivers/net/wireless/ath/ath11k/wmi.c:7230:14: note: Assuming 'i' is < 'wmi_ep_count'
           for (i = 0; i < wmi_ep_count; i++)
                       ^~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7230:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < wmi_ep_count; i++)
           ^
   drivers/net/wireless/ath/ath11k/wmi.c:7230:32: note: The value 3 is assigned to 'i'
           for (i = 0; i < wmi_ep_count; i++)
                                         ^~~
   drivers/net/wireless/ath/ath11k/wmi.c:7230:14: note: Assuming 'i' is < 'wmi_ep_count'
           for (i = 0; i < wmi_ep_count; i++)
                       ^~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7230:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < wmi_ep_count; i++)
           ^
   drivers/net/wireless/ath/ath11k/wmi.c:7231:39: note: Passing the value 3 via 2nd parameter 'pdev_idx'
                   ath11k_connect_pdev_htc_service(ab, i);
                                                       ^
   drivers/net/wireless/ath/ath11k/wmi.c:7231:3: note: Calling 'ath11k_connect_pdev_htc_service'
                   ath11k_connect_pdev_htc_service(ab, i);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/wmi.c:7111:22: note: Assigned value is garbage or undefined
           conn_req.service_id = svc_id[pdev_idx];
                               ^ ~~~~~~~~~~~~~~~~
   Suppressed 15 warnings (15 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   23 warnings generated.
   drivers/net/wireless/ath/ath11k/mac.c:1661:27: warning: Although the value stored to 'vht_mcs' is used in the enclosing expression, the value is never actually read from 'vht_mcs' [clang-analyzer-deadcode.DeadStores]
           for (i = 0, max_nss = 0, vht_mcs = 0; i < NL80211_VHT_NSS_MAX; i++) {
                                    ^         ~
   drivers/net/wireless/ath/ath11k/mac.c:1661:27: note: Although the value stored to 'vht_mcs' is used in the enclosing expression, the value is never actually read from 'vht_mcs'
           for (i = 0, max_nss = 0, vht_mcs = 0; i < NL80211_VHT_NSS_MAX; i++) {
                                    ^         ~
>> drivers/net/wireless/ath/ath11k/mac.c:1927:27: warning: Although the value stored to 'he_mcs' is used in the enclosing expression, the value is never actually read from 'he_mcs' [clang-analyzer-deadcode.DeadStores]
           for (i = 0, max_nss = 0, he_mcs = 0; i < NL80211_HE_NSS_MAX; i++) {
                                    ^        ~
   drivers/net/wireless/ath/ath11k/mac.c:1927:27: note: Although the value stored to 'he_mcs' is used in the enclosing expression, the value is never actually read from 'he_mcs'
           for (i = 0, max_nss = 0, he_mcs = 0; i < NL80211_HE_NSS_MAX; i++) {
                                    ^        ~
   drivers/net/wireless/ath/ath11k/mac.c:3141:3: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
                   kfree(arg.extraie.ptr);
                   ^     ~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:3078:2: note: Control jumps to 'case ATH11K_SCAN_ABORTING:' @line 3089
           switch (ar->scan.state) {
           ^
   drivers/net/wireless/ath/ath11k/mac.c:3091:3: note:  Execution continues on line 3093
                   break;
                   ^
   drivers/net/wireless/ath/ath11k/mac.c:3095:6: note: 'ret' is -16
           if (ret)
               ^~~
   drivers/net/wireless/ath/ath11k/mac.c:3095:2: note: Taking true branch
           if (ret)
           ^
   drivers/net/wireless/ath/ath11k/mac.c:3096:3: note: Control jumps to line 3140
                   goto exit;
                   ^
   drivers/net/wireless/ath/ath11k/mac.c:3140:6: note: Assuming field 'ie_len' is not equal to 0
           if (req->ie_len)
               ^~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:3140:2: note: Taking true branch
           if (req->ie_len)
           ^
   drivers/net/wireless/ath/ath11k/mac.c:3141:3: note: 1st function call argument is an uninitialized value
                   kfree(arg.extraie.ptr);
                   ^     ~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:4091:3: warning: Value stored to 'bw' is never read [clang-analyzer-deadcode.DeadStores]
                   bw = WMI_PEER_CHWIDTH_20MHZ;
                   ^    ~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:4091:3: note: Value stored to 'bw' is never read
                   bw = WMI_PEER_CHWIDTH_20MHZ;
                   ^    ~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:4120:3: warning: Value stored to 'smps' is never read [clang-analyzer-deadcode.DeadStores]
                   smps = WMI_PEER_SMPS_PS_NONE;
                   ^      ~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:4120:3: note: Value stored to 'smps' is never read
                   smps = WMI_PEER_SMPS_PS_NONE;
                   ^      ~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:5684:2: warning: Value stored to 'changed_flags' is never read [clang-analyzer-deadcode.DeadStores]
           changed_flags &= SUPPORTED_FILTERS;
           ^
   drivers/net/wireless/ath/ath11k/mac.c:5684:2: note: Value stored to 'changed_flags' is never read
   drivers/net/wireless/ath/ath11k/mac.c:7312:22: warning: Value stored to 'ab' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct ath11k_base *ab = ar->ab;
                               ^~   ~~~~~~
   drivers/net/wireless/ath/ath11k/mac.c:7312:22: note: Value stored to 'ab' during its initialization is never read
           struct ath11k_base *ab = ar->ab;
                               ^~   ~~~~~~
   Suppressed 16 warnings (15 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   include/linux/hid.h:1007:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input') [clang-analyzer-core.NullDereference]
                                       input->name, c, type);
                                       ^
   drivers/hid/hid-penmount.c:22:6: note: Assuming the condition is true
           if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-penmount.c:22:2: note: Taking true branch
           if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
           ^
   drivers/hid/hid-penmount.c:23:7: note: Assuming the condition is true
                   if (((usage->hid - 1) & HID_USAGE) == 0) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-penmount.c:23:3: note: Taking true branch
                   if (((usage->hid - 1) & HID_USAGE) == 0) {
                   ^
   drivers/hid/hid-penmount.c:24:4: note: Calling 'hid_map_usage'
                           hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:982:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:986:2: note: Control jumps to 'case 1:'  at line 995
           switch (type) {
           ^
   include/linux/hid.h:998:3: note:  Execution continues on line 1005
                   break;
                   ^
   include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:1005:28: note: Assuming 'bmap' is null

vim +1927 drivers/net/wireless/ath/ath11k/mac.c

61fe43e7216df6 Miles Hu            2021-09-24  1761  
d5c65159f28953 Kalle Valo          2019-11-23  1762  static void ath11k_peer_assoc_h_he(struct ath11k *ar,
d5c65159f28953 Kalle Valo          2019-11-23  1763  				   struct ieee80211_vif *vif,
d5c65159f28953 Kalle Valo          2019-11-23  1764  				   struct ieee80211_sta *sta,
d5c65159f28953 Kalle Valo          2019-11-23  1765  				   struct peer_assoc_params *arg)
d5c65159f28953 Kalle Valo          2019-11-23  1766  {
61fe43e7216df6 Miles Hu            2021-09-24  1767  	struct ath11k_vif *arvif = (void *)vif->drv_priv;
61fe43e7216df6 Miles Hu            2021-09-24  1768  	struct cfg80211_chan_def def;
9f056ed8ee01ad John Crispin        2019-11-25  1769  	const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
af6d39db1b046a Tamizh Chelvam      2020-09-08  1770  	u8 ampdu_factor;
61fe43e7216df6 Miles Hu            2021-09-24  1771  	enum nl80211_band band;
61fe43e7216df6 Miles Hu            2021-09-24  1772  	u16 *he_mcs_mask;
61fe43e7216df6 Miles Hu            2021-09-24  1773  	u8 max_nss, he_mcs;
61fe43e7216df6 Miles Hu            2021-09-24  1774  	u16 he_tx_mcs = 0, v = 0;
61fe43e7216df6 Miles Hu            2021-09-24  1775  	int i, he_nss, nss_idx;
61fe43e7216df6 Miles Hu            2021-09-24  1776  	bool user_rate_valid = true;
61fe43e7216df6 Miles Hu            2021-09-24  1777  
61fe43e7216df6 Miles Hu            2021-09-24  1778  	if (WARN_ON(ath11k_mac_vif_chan(vif, &def)))
61fe43e7216df6 Miles Hu            2021-09-24  1779  		return;
9f056ed8ee01ad John Crispin        2019-11-25  1780  
9f056ed8ee01ad John Crispin        2019-11-25  1781  	if (!he_cap->has_he)
9f056ed8ee01ad John Crispin        2019-11-25  1782  		return;
9f056ed8ee01ad John Crispin        2019-11-25  1783  
61fe43e7216df6 Miles Hu            2021-09-24  1784  	band = def.chan->band;
61fe43e7216df6 Miles Hu            2021-09-24  1785  	he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;
61fe43e7216df6 Miles Hu            2021-09-24  1786  
61fe43e7216df6 Miles Hu            2021-09-24  1787  	if (ath11k_peer_assoc_h_he_masked(he_mcs_mask))
61fe43e7216df6 Miles Hu            2021-09-24  1788  		return;
61fe43e7216df6 Miles Hu            2021-09-24  1789  
9f056ed8ee01ad John Crispin        2019-11-25  1790  	arg->he_flag = true;
9f056ed8ee01ad John Crispin        2019-11-25  1791  
c8bcd82a4efd05 Kees Cook           2021-06-16  1792  	memcpy_and_pad(&arg->peer_he_cap_macinfo,
c8bcd82a4efd05 Kees Cook           2021-06-16  1793  		       sizeof(arg->peer_he_cap_macinfo),
c8bcd82a4efd05 Kees Cook           2021-06-16  1794  		       he_cap->he_cap_elem.mac_cap_info,
c8bcd82a4efd05 Kees Cook           2021-06-16  1795  		       sizeof(he_cap->he_cap_elem.mac_cap_info),
c8bcd82a4efd05 Kees Cook           2021-06-16  1796  		       0);
c8bcd82a4efd05 Kees Cook           2021-06-16  1797  	memcpy_and_pad(&arg->peer_he_cap_phyinfo,
c8bcd82a4efd05 Kees Cook           2021-06-16  1798  		       sizeof(arg->peer_he_cap_phyinfo),
c8bcd82a4efd05 Kees Cook           2021-06-16  1799  		       he_cap->he_cap_elem.phy_cap_info,
c8bcd82a4efd05 Kees Cook           2021-06-16  1800  		       sizeof(he_cap->he_cap_elem.phy_cap_info),
c8bcd82a4efd05 Kees Cook           2021-06-16  1801  		       0);
60689de46c7f6a Rajkumar Manoharan  2020-04-24  1802  	arg->peer_he_ops = vif->bss_conf.he_oper.params;
9f056ed8ee01ad John Crispin        2019-11-25  1803  
9f056ed8ee01ad John Crispin        2019-11-25  1804  	/* the top most byte is used to indicate BSS color info */
9f056ed8ee01ad John Crispin        2019-11-25  1805  	arg->peer_he_ops &= 0xffffff;
9f056ed8ee01ad John Crispin        2019-11-25  1806  
af6d39db1b046a Tamizh Chelvam      2020-09-08  1807  	/* As per section 26.6.1 11ax Draft5.0, if the Max AMPDU Exponent Extension
af6d39db1b046a Tamizh Chelvam      2020-09-08  1808  	 * in HE cap is zero, use the arg->peer_max_mpdu as calculated while parsing
af6d39db1b046a Tamizh Chelvam      2020-09-08  1809  	 * VHT caps(if VHT caps is present) or HT caps (if VHT caps is not present).
af6d39db1b046a Tamizh Chelvam      2020-09-08  1810  	 *
af6d39db1b046a Tamizh Chelvam      2020-09-08  1811  	 * For non-zero value of Max AMPDU Extponent Extension in HE MAC caps,
af6d39db1b046a Tamizh Chelvam      2020-09-08  1812  	 * if a HE STA sends VHT cap and HE cap IE in assoc request then, use
af6d39db1b046a Tamizh Chelvam      2020-09-08  1813  	 * MAX_AMPDU_LEN_FACTOR as 20 to calculate max_ampdu length.
af6d39db1b046a Tamizh Chelvam      2020-09-08  1814  	 * If a HE STA that does not send VHT cap, but HE and HT cap in assoc
af6d39db1b046a Tamizh Chelvam      2020-09-08  1815  	 * request, then use MAX_AMPDU_LEN_FACTOR as 16 to calculate max_ampdu
af6d39db1b046a Tamizh Chelvam      2020-09-08  1816  	 * length.
af6d39db1b046a Tamizh Chelvam      2020-09-08  1817  	 */
1f851b8dfd76a0 Johannes Berg       2021-04-09  1818  	ampdu_factor = u8_get_bits(he_cap->he_cap_elem.mac_cap_info[3],
1f851b8dfd76a0 Johannes Berg       2021-04-09  1819  				   IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK);
af6d39db1b046a Tamizh Chelvam      2020-09-08  1820  
af6d39db1b046a Tamizh Chelvam      2020-09-08  1821  	if (ampdu_factor) {
af6d39db1b046a Tamizh Chelvam      2020-09-08  1822  		if (sta->vht_cap.vht_supported)
af6d39db1b046a Tamizh Chelvam      2020-09-08  1823  			arg->peer_max_mpdu = (1 << (IEEE80211_HE_VHT_MAX_AMPDU_FACTOR +
af6d39db1b046a Tamizh Chelvam      2020-09-08  1824  						    ampdu_factor)) - 1;
af6d39db1b046a Tamizh Chelvam      2020-09-08  1825  		else if (sta->ht_cap.ht_supported)
af6d39db1b046a Tamizh Chelvam      2020-09-08  1826  			arg->peer_max_mpdu = (1 << (IEEE80211_HE_HT_MAX_AMPDU_FACTOR +
af6d39db1b046a Tamizh Chelvam      2020-09-08  1827  						    ampdu_factor)) - 1;
af6d39db1b046a Tamizh Chelvam      2020-09-08  1828  	}
af6d39db1b046a Tamizh Chelvam      2020-09-08  1829  
9f056ed8ee01ad John Crispin        2019-11-25  1830  	if (he_cap->he_cap_elem.phy_cap_info[6] &
9f056ed8ee01ad John Crispin        2019-11-25  1831  	    IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) {
9f056ed8ee01ad John Crispin        2019-11-25  1832  		int bit = 7;
9f056ed8ee01ad John Crispin        2019-11-25  1833  		int nss, ru;
9f056ed8ee01ad John Crispin        2019-11-25  1834  
9f056ed8ee01ad John Crispin        2019-11-25  1835  		arg->peer_ppet.numss_m1 = he_cap->ppe_thres[0] &
9f056ed8ee01ad John Crispin        2019-11-25  1836  					  IEEE80211_PPE_THRES_NSS_MASK;
9f056ed8ee01ad John Crispin        2019-11-25  1837  		arg->peer_ppet.ru_bit_mask =
9f056ed8ee01ad John Crispin        2019-11-25  1838  			(he_cap->ppe_thres[0] &
9f056ed8ee01ad John Crispin        2019-11-25  1839  			 IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK) >>
9f056ed8ee01ad John Crispin        2019-11-25  1840  			IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS;
9f056ed8ee01ad John Crispin        2019-11-25  1841  
9f056ed8ee01ad John Crispin        2019-11-25  1842  		for (nss = 0; nss <= arg->peer_ppet.numss_m1; nss++) {
9f056ed8ee01ad John Crispin        2019-11-25  1843  			for (ru = 0; ru < 4; ru++) {
9f056ed8ee01ad John Crispin        2019-11-25  1844  				u32 val = 0;
9f056ed8ee01ad John Crispin        2019-11-25  1845  				int i;
9f056ed8ee01ad John Crispin        2019-11-25  1846  
9f056ed8ee01ad John Crispin        2019-11-25  1847  				if ((arg->peer_ppet.ru_bit_mask & BIT(ru)) == 0)
9f056ed8ee01ad John Crispin        2019-11-25  1848  					continue;
9f056ed8ee01ad John Crispin        2019-11-25  1849  				for (i = 0; i < 6; i++) {
9f056ed8ee01ad John Crispin        2019-11-25  1850  					val >>= 1;
9f056ed8ee01ad John Crispin        2019-11-25  1851  					val |= ((he_cap->ppe_thres[bit / 8] >>
9f056ed8ee01ad John Crispin        2019-11-25  1852  						 (bit % 8)) & 0x1) << 5;
9f056ed8ee01ad John Crispin        2019-11-25  1853  					bit++;
9f056ed8ee01ad John Crispin        2019-11-25  1854  				}
9f056ed8ee01ad John Crispin        2019-11-25  1855  				arg->peer_ppet.ppet16_ppet8_ru3_ru0[nss] |=
9f056ed8ee01ad John Crispin        2019-11-25  1856  								val << (ru * 6);
9f056ed8ee01ad John Crispin        2019-11-25  1857  			}
9f056ed8ee01ad John Crispin        2019-11-25  1858  		}
9f056ed8ee01ad John Crispin        2019-11-25  1859  	}
9f056ed8ee01ad John Crispin        2019-11-25  1860  
6d293d447670da John Crispin        2019-11-25  1861  	if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES)
6d293d447670da John Crispin        2019-11-25  1862  		arg->twt_responder = true;
6d293d447670da John Crispin        2019-11-25  1863  	if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ)
6d293d447670da John Crispin        2019-11-25  1864  		arg->twt_requester = true;
6d293d447670da John Crispin        2019-11-25  1865  
61fe43e7216df6 Miles Hu            2021-09-24  1866  	he_nss =  ath11k_mac_max_he_nss(he_mcs_mask);
61fe43e7216df6 Miles Hu            2021-09-24  1867  
61fe43e7216df6 Miles Hu            2021-09-24  1868  	if (he_nss > sta->rx_nss) {
61fe43e7216df6 Miles Hu            2021-09-24  1869  		user_rate_valid = false;
61fe43e7216df6 Miles Hu            2021-09-24  1870  		for (nss_idx = sta->rx_nss - 1; nss_idx >= 0; nss_idx--) {
61fe43e7216df6 Miles Hu            2021-09-24  1871  			if (he_mcs_mask[nss_idx]) {
61fe43e7216df6 Miles Hu            2021-09-24  1872  				user_rate_valid = true;
61fe43e7216df6 Miles Hu            2021-09-24  1873  				break;
61fe43e7216df6 Miles Hu            2021-09-24  1874  			}
61fe43e7216df6 Miles Hu            2021-09-24  1875  		}
61fe43e7216df6 Miles Hu            2021-09-24  1876  	}
61fe43e7216df6 Miles Hu            2021-09-24  1877  
61fe43e7216df6 Miles Hu            2021-09-24  1878  	if (!user_rate_valid) {
61fe43e7216df6 Miles Hu            2021-09-24  1879  		ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac setting he range mcs value to peer supported nss %d for peer %pM\n",
61fe43e7216df6 Miles Hu            2021-09-24  1880  			   sta->rx_nss, sta->addr);
61fe43e7216df6 Miles Hu            2021-09-24  1881  		he_mcs_mask[sta->rx_nss - 1] = he_mcs_mask[he_nss - 1];
61fe43e7216df6 Miles Hu            2021-09-24  1882  	}
61fe43e7216df6 Miles Hu            2021-09-24  1883  
9f056ed8ee01ad John Crispin        2019-11-25  1884  	switch (sta->bandwidth) {
9f056ed8ee01ad John Crispin        2019-11-25  1885  	case IEEE80211_STA_RX_BW_160:
9f056ed8ee01ad John Crispin        2019-11-25  1886  		if (he_cap->he_cap_elem.phy_cap_info[0] &
9f056ed8ee01ad John Crispin        2019-11-25  1887  		    IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) {
9f056ed8ee01ad John Crispin        2019-11-25  1888  			v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80p80);
61fe43e7216df6 Miles Hu            2021-09-24  1889  			v = ath11k_peer_assoc_h_he_limit(v, he_mcs_mask);
9f056ed8ee01ad John Crispin        2019-11-25  1890  			arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1891  
9f056ed8ee01ad John Crispin        2019-11-25  1892  			v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80p80);
9f056ed8ee01ad John Crispin        2019-11-25  1893  			arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1894  
9f056ed8ee01ad John Crispin        2019-11-25  1895  			arg->peer_he_mcs_count++;
61fe43e7216df6 Miles Hu            2021-09-24  1896  			he_tx_mcs = v;
9f056ed8ee01ad John Crispin        2019-11-25  1897  		}
9f056ed8ee01ad John Crispin        2019-11-25  1898  		v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
9f056ed8ee01ad John Crispin        2019-11-25  1899  		arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1900  
9f056ed8ee01ad John Crispin        2019-11-25  1901  		v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_160);
61fe43e7216df6 Miles Hu            2021-09-24  1902  		v = ath11k_peer_assoc_h_he_limit(v, he_mcs_mask);
9f056ed8ee01ad John Crispin        2019-11-25  1903  		arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1904  
9f056ed8ee01ad John Crispin        2019-11-25  1905  		arg->peer_he_mcs_count++;
61fe43e7216df6 Miles Hu            2021-09-24  1906  		if (!he_tx_mcs)
61fe43e7216df6 Miles Hu            2021-09-24  1907  			he_tx_mcs = v;
0b294aebb6a00b Gustavo A. R. Silva 2020-07-27  1908  		fallthrough;
9f056ed8ee01ad John Crispin        2019-11-25  1909  
9f056ed8ee01ad John Crispin        2019-11-25  1910  	default:
9f056ed8ee01ad John Crispin        2019-11-25  1911  		v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80);
9f056ed8ee01ad John Crispin        2019-11-25  1912  		arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1913  
9f056ed8ee01ad John Crispin        2019-11-25  1914  		v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80);
61fe43e7216df6 Miles Hu            2021-09-24  1915  		v = ath11k_peer_assoc_h_he_limit(v, he_mcs_mask);
9f056ed8ee01ad John Crispin        2019-11-25  1916  		arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v;
9f056ed8ee01ad John Crispin        2019-11-25  1917  
9f056ed8ee01ad John Crispin        2019-11-25  1918  		arg->peer_he_mcs_count++;
61fe43e7216df6 Miles Hu            2021-09-24  1919  		if (!he_tx_mcs)
61fe43e7216df6 Miles Hu            2021-09-24  1920  			he_tx_mcs = v;
9f056ed8ee01ad John Crispin        2019-11-25  1921  		break;
9f056ed8ee01ad John Crispin        2019-11-25  1922  	}
61fe43e7216df6 Miles Hu            2021-09-24  1923  
61fe43e7216df6 Miles Hu            2021-09-24  1924  	/* Calculate peer NSS capability from HE capabilities if STA
61fe43e7216df6 Miles Hu            2021-09-24  1925  	 * supports HE.
61fe43e7216df6 Miles Hu            2021-09-24  1926  	 */
61fe43e7216df6 Miles Hu            2021-09-24 @1927  	for (i = 0, max_nss = 0, he_mcs = 0; i < NL80211_HE_NSS_MAX; i++) {
61fe43e7216df6 Miles Hu            2021-09-24  1928  		he_mcs = he_tx_mcs >> (2 * i) & 3;
61fe43e7216df6 Miles Hu            2021-09-24  1929  
61fe43e7216df6 Miles Hu            2021-09-24  1930  		/* In case of fixed rates, MCS Range in he_tx_mcs might have
61fe43e7216df6 Miles Hu            2021-09-24  1931  		 * unsupported range, with he_mcs_mask set, so check either of them
61fe43e7216df6 Miles Hu            2021-09-24  1932  		 * to find nss.
61fe43e7216df6 Miles Hu            2021-09-24  1933  		 */
61fe43e7216df6 Miles Hu            2021-09-24  1934  		if (he_mcs != IEEE80211_HE_MCS_NOT_SUPPORTED ||
61fe43e7216df6 Miles Hu            2021-09-24  1935  		    he_mcs_mask[i])
61fe43e7216df6 Miles Hu            2021-09-24  1936  			max_nss = i + 1;
61fe43e7216df6 Miles Hu            2021-09-24  1937  	}
61fe43e7216df6 Miles Hu            2021-09-24  1938  	arg->peer_nss = min(sta->rx_nss, max_nss);
61fe43e7216df6 Miles Hu            2021-09-24  1939  
61fe43e7216df6 Miles Hu            2021-09-24  1940  	ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
61fe43e7216df6 Miles Hu            2021-09-24  1941  		   "mac he peer %pM nss %d mcs cnt %d\n",
61fe43e7216df6 Miles Hu            2021-09-24  1942  		   sta->addr, arg->peer_nss, arg->peer_he_mcs_count);
d5c65159f28953 Kalle Valo          2019-11-23  1943  }
d5c65159f28953 Kalle Valo          2019-11-23  1944  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

             reply	other threads:[~2021-12-05  0:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05  0:40 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-01 10:52 drivers/net/wireless/ath/ath11k/mac.c:1927:27: warning: Although the value stored to 'he_mcs' is used in the enclosing expression, the value is never actually read from 'he_mcs' [clang-analyzer-deadcode.DeadStores] kernel test robot
2021-11-28  9:04 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202112050821.X3jKB1bZ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.