[bug report] wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices

Dan Carpenter
2023-02-16T11:44:17Z

drivers/net/wireless/ath/ath12k/mac.c:1658 ath12k_peer_assoc_h_he()
warn: mask and shift to zero

drivers/net/wireless/ath/ath12k/mac.c
1642 /* the top most byte is used to indicate BSS color info */
1643 arg->peer_he_ops &= 0xffffff;
1644
1645 /* As per section 26.6.1 IEEE Std 802.11ax‐2022, if the Max AMPDU
1646 * Exponent Extension in HE cap is zero, use the arg->peer_max_mpdu
1647 * as calculated while parsing VHT caps(if VHT caps is present)
1648 * or HT caps (if VHT caps is not present).
1649 *
1650 * For non-zero value of Max AMPDU Exponent Extension in HE MAC caps,
1651 * if a HE STA sends VHT cap and HE cap IE in assoc request then, use
1652 * MAX_AMPDU_LEN_FACTOR as 20 to calculate max_ampdu length.
1653 * If a HE STA that does not send VHT cap, but HE and HT cap in assoc
1654 * request, then use MAX_AMPDU_LEN_FACTOR as 16 to calculate max_ampdu
1655 * length.
1656 */
1657 ampdu_factor = (he_cap->he_cap_elem.mac_cap_info[3] &
--> 1658 IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK) >>
1659 IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK;
^^^^^
This likely should be shifting by a shift define instead of a _MASK
value.

1660
1661 if (ampdu_factor) {
^^^^^^^^^^^^

Never going to be true.

1662 if (sta->deflink.vht_cap.vht_supported)
1663 arg->peer_max_mpdu = (1 << (IEEE80211_HE_VHT_MAX_AMPDU_FACTOR +
1664 ampdu_factor)) - 1;
1665 else if (sta->deflink.ht_cap.ht_supported)
1666 arg->peer_max_mpdu = (1 << (IEEE80211_HE_HT_MAX_AMPDU_FACTOR +
1667 ampdu_factor)) - 1;
1668 }
1669