wifi: mac80211: add strict mode disabling workarounds
[ Upstream commit 3ad4fce66e4f9d82abfc366707757e29cc14a9d2 ] Add a strict mode where we disable certain workarounds and have additional checks such as, for now, that VHT capabilities from association response match those from beacon/probe response. We can extend the checks in the future. Make it an opt-in setting by the driver so it can be set there in some driver-specific way, for example. Also allow setting this one hw flag through the hwflags debugfs, by writing a new strict=0 or strict=1 value. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250205110958.5cecb0469479.I4a69617dc60ba0d6308416ffbc3102cfd08ba068@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c6e50cb8bf
commit
cca16fbd17
@@ -2826,6 +2826,11 @@ struct ieee80211_txq {
|
|||||||
* implements MLO, so operation can continue on other links when one
|
* implements MLO, so operation can continue on other links when one
|
||||||
* link is switching.
|
* link is switching.
|
||||||
*
|
*
|
||||||
|
* @IEEE80211_HW_STRICT: strictly enforce certain things mandated by the spec
|
||||||
|
* but otherwise ignored/worked around for interoperability. This is a
|
||||||
|
* HW flag so drivers can opt in according to their own control, e.g. in
|
||||||
|
* testing.
|
||||||
|
*
|
||||||
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
|
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
|
||||||
*/
|
*/
|
||||||
enum ieee80211_hw_flags {
|
enum ieee80211_hw_flags {
|
||||||
@@ -2885,6 +2890,7 @@ enum ieee80211_hw_flags {
|
|||||||
IEEE80211_HW_DISALLOW_PUNCTURING,
|
IEEE80211_HW_DISALLOW_PUNCTURING,
|
||||||
IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
|
IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
|
||||||
IEEE80211_HW_HANDLES_QUIET_CSA,
|
IEEE80211_HW_HANDLES_QUIET_CSA,
|
||||||
|
IEEE80211_HW_STRICT,
|
||||||
|
|
||||||
/* keep last, obviously */
|
/* keep last, obviously */
|
||||||
NUM_IEEE80211_HW_FLAGS
|
NUM_IEEE80211_HW_FLAGS
|
||||||
|
|||||||
+42
-2
@@ -499,6 +499,7 @@ static const char *hw_flag_names[] = {
|
|||||||
FLAG(DISALLOW_PUNCTURING),
|
FLAG(DISALLOW_PUNCTURING),
|
||||||
FLAG(DISALLOW_PUNCTURING_5GHZ),
|
FLAG(DISALLOW_PUNCTURING_5GHZ),
|
||||||
FLAG(HANDLES_QUIET_CSA),
|
FLAG(HANDLES_QUIET_CSA),
|
||||||
|
FLAG(STRICT),
|
||||||
#undef FLAG
|
#undef FLAG
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -531,6 +532,46 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t hwflags_write(struct file *file, const char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ieee80211_local *local = file->private_data;
|
||||||
|
char buf[100];
|
||||||
|
int val;
|
||||||
|
|
||||||
|
if (count >= sizeof(buf))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (copy_from_user(buf, user_buf, count))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (count && buf[count - 1] == '\n')
|
||||||
|
buf[count - 1] = '\0';
|
||||||
|
else
|
||||||
|
buf[count] = '\0';
|
||||||
|
|
||||||
|
if (sscanf(buf, "strict=%d", &val) == 1) {
|
||||||
|
switch (val) {
|
||||||
|
case 0:
|
||||||
|
ieee80211_hw_set(&local->hw, STRICT);
|
||||||
|
return count;
|
||||||
|
case 1:
|
||||||
|
__clear_bit(IEEE80211_HW_STRICT, local->hw.flags);
|
||||||
|
return count;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations hwflags_ops = {
|
||||||
|
.open = simple_open,
|
||||||
|
.read = hwflags_read,
|
||||||
|
.write = hwflags_write,
|
||||||
|
};
|
||||||
|
|
||||||
static ssize_t misc_read(struct file *file, char __user *user_buf,
|
static ssize_t misc_read(struct file *file, char __user *user_buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
@@ -581,7 +622,6 @@ static ssize_t queues_read(struct file *file, char __user *user_buf,
|
|||||||
return simple_read_from_buffer(user_buf, count, ppos, buf, res);
|
return simple_read_from_buffer(user_buf, count, ppos, buf, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUGFS_READONLY_FILE_OPS(hwflags);
|
|
||||||
DEBUGFS_READONLY_FILE_OPS(queues);
|
DEBUGFS_READONLY_FILE_OPS(queues);
|
||||||
DEBUGFS_READONLY_FILE_OPS(misc);
|
DEBUGFS_READONLY_FILE_OPS(misc);
|
||||||
|
|
||||||
@@ -659,7 +699,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
|
|||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
DEBUGFS_ADD_MODE(reset, 0200);
|
DEBUGFS_ADD_MODE(reset, 0200);
|
||||||
#endif
|
#endif
|
||||||
DEBUGFS_ADD(hwflags);
|
DEBUGFS_ADD_MODE(hwflags, 0600);
|
||||||
DEBUGFS_ADD(user_power);
|
DEBUGFS_ADD(user_power);
|
||||||
DEBUGFS_ADD(power);
|
DEBUGFS_ADD(power);
|
||||||
DEBUGFS_ADD(hw_conf);
|
DEBUGFS_ADD(hw_conf);
|
||||||
|
|||||||
+31
-14
@@ -166,6 +166,9 @@ ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,
|
|||||||
bool no_vht = false;
|
bool no_vht = false;
|
||||||
u32 ht_cfreq;
|
u32 ht_cfreq;
|
||||||
|
|
||||||
|
if (ieee80211_hw_check(&sdata->local->hw, STRICT))
|
||||||
|
ignore_ht_channel_mismatch = false;
|
||||||
|
|
||||||
*chandef = (struct cfg80211_chan_def) {
|
*chandef = (struct cfg80211_chan_def) {
|
||||||
.chan = channel,
|
.chan = channel,
|
||||||
.width = NL80211_CHAN_WIDTH_20_NOHT,
|
.width = NL80211_CHAN_WIDTH_20_NOHT,
|
||||||
@@ -385,7 +388,7 @@ ieee80211_verify_peer_he_mcs_support(struct ieee80211_sub_if_data *sdata,
|
|||||||
* zeroes, which is nonsense, and completely inconsistent with itself
|
* zeroes, which is nonsense, and completely inconsistent with itself
|
||||||
* (it doesn't have 8 streams). Accept the settings in this case anyway.
|
* (it doesn't have 8 streams). Accept the settings in this case anyway.
|
||||||
*/
|
*/
|
||||||
if (!ap_min_req_set)
|
if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* make sure the AP is consistent with itself
|
/* make sure the AP is consistent with itself
|
||||||
@@ -445,7 +448,7 @@ ieee80211_verify_sta_he_mcs_support(struct ieee80211_sub_if_data *sdata,
|
|||||||
* zeroes, which is nonsense, and completely inconsistent with itself
|
* zeroes, which is nonsense, and completely inconsistent with itself
|
||||||
* (it doesn't have 8 streams). Accept the settings in this case anyway.
|
* (it doesn't have 8 streams). Accept the settings in this case anyway.
|
||||||
*/
|
*/
|
||||||
if (!ap_min_req_set)
|
if (!ieee80211_hw_check(&sdata->local->hw, STRICT) && !ap_min_req_set)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Need to go over for 80MHz, 160MHz and for 80+80 */
|
/* Need to go over for 80MHz, 160MHz and for 80+80 */
|
||||||
@@ -1212,13 +1215,15 @@ static bool ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata,
|
|||||||
* Some APs apparently get confused if our capabilities are better
|
* Some APs apparently get confused if our capabilities are better
|
||||||
* than theirs, so restrict what we advertise in the assoc request.
|
* than theirs, so restrict what we advertise in the assoc request.
|
||||||
*/
|
*/
|
||||||
if (!(ap_vht_cap->vht_cap_info &
|
if (!ieee80211_hw_check(&local->hw, STRICT)) {
|
||||||
cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)))
|
if (!(ap_vht_cap->vht_cap_info &
|
||||||
cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
|
cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)))
|
||||||
IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
|
cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
|
||||||
else if (!(ap_vht_cap->vht_cap_info &
|
IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
|
||||||
cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)))
|
else if (!(ap_vht_cap->vht_cap_info &
|
||||||
cap &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
|
cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE)))
|
||||||
|
cap &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If some other vif is using the MU-MIMO capability we cannot associate
|
* If some other vif is using the MU-MIMO capability we cannot associate
|
||||||
@@ -1260,14 +1265,16 @@ static bool ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata,
|
|||||||
return mu_mimo_owner;
|
return mu_mimo_owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ieee80211_assoc_add_rates(struct sk_buff *skb,
|
static void ieee80211_assoc_add_rates(struct ieee80211_local *local,
|
||||||
|
struct sk_buff *skb,
|
||||||
enum nl80211_chan_width width,
|
enum nl80211_chan_width width,
|
||||||
struct ieee80211_supported_band *sband,
|
struct ieee80211_supported_band *sband,
|
||||||
struct ieee80211_mgd_assoc_data *assoc_data)
|
struct ieee80211_mgd_assoc_data *assoc_data)
|
||||||
{
|
{
|
||||||
u32 rates;
|
u32 rates;
|
||||||
|
|
||||||
if (assoc_data->supp_rates_len) {
|
if (assoc_data->supp_rates_len &&
|
||||||
|
!ieee80211_hw_check(&local->hw, STRICT)) {
|
||||||
/*
|
/*
|
||||||
* Get all rates supported by the device and the AP as
|
* Get all rates supported by the device and the AP as
|
||||||
* some APs don't like getting a superset of their rates
|
* some APs don't like getting a superset of their rates
|
||||||
@@ -1481,7 +1488,7 @@ static size_t ieee80211_assoc_link_elems(struct ieee80211_sub_if_data *sdata,
|
|||||||
*capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
|
*capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
|
||||||
|
|
||||||
if (sband->band != NL80211_BAND_S1GHZ)
|
if (sband->band != NL80211_BAND_S1GHZ)
|
||||||
ieee80211_assoc_add_rates(skb, width, sband, assoc_data);
|
ieee80211_assoc_add_rates(local, skb, width, sband, assoc_data);
|
||||||
|
|
||||||
if (*capab & WLAN_CAPABILITY_SPECTRUM_MGMT ||
|
if (*capab & WLAN_CAPABILITY_SPECTRUM_MGMT ||
|
||||||
*capab & WLAN_CAPABILITY_RADIO_MEASURE) {
|
*capab & WLAN_CAPABILITY_RADIO_MEASURE) {
|
||||||
@@ -1925,7 +1932,8 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
|
|||||||
* for some reason check it and want it to be set, set the bit for all
|
* for some reason check it and want it to be set, set the bit for all
|
||||||
* pre-EHT connections as we used to do.
|
* pre-EHT connections as we used to do.
|
||||||
*/
|
*/
|
||||||
if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT)
|
if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT &&
|
||||||
|
!ieee80211_hw_check(&local->hw, STRICT))
|
||||||
capab |= WLAN_CAPABILITY_ESS;
|
capab |= WLAN_CAPABILITY_ESS;
|
||||||
|
|
||||||
/* add the elements for the assoc (main) link */
|
/* add the elements for the assoc (main) link */
|
||||||
@@ -4710,7 +4718,7 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
|
|||||||
* 2G/3G/4G wifi routers, reported models include the "Onda PN51T",
|
* 2G/3G/4G wifi routers, reported models include the "Onda PN51T",
|
||||||
* "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device.
|
* "Vodafone PocketWiFi 2", "ZTE MF60" and a similar T-Mobile device.
|
||||||
*/
|
*/
|
||||||
if (!is_6ghz &&
|
if (!ieee80211_hw_check(&local->hw, STRICT) && !is_6ghz &&
|
||||||
((assoc_data->wmm && !elems->wmm_param) ||
|
((assoc_data->wmm && !elems->wmm_param) ||
|
||||||
(link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT &&
|
(link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HT &&
|
||||||
(!elems->ht_cap_elem || !elems->ht_operation)) ||
|
(!elems->ht_cap_elem || !elems->ht_operation)) ||
|
||||||
@@ -4846,6 +4854,15 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
|
|||||||
bss_vht_cap = (const void *)elem->data;
|
bss_vht_cap = (const void *)elem->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ieee80211_hw_check(&local->hw, STRICT) &&
|
||||||
|
(!bss_vht_cap || memcmp(bss_vht_cap, elems->vht_cap_elem,
|
||||||
|
sizeof(*bss_vht_cap)))) {
|
||||||
|
rcu_read_unlock();
|
||||||
|
ret = false;
|
||||||
|
link_info(link, "VHT capabilities mismatch\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
|
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
|
||||||
elems->vht_cap_elem,
|
elems->vht_cap_elem,
|
||||||
bss_vht_cap, link_sta);
|
bss_vht_cap, link_sta);
|
||||||
|
|||||||
Reference in New Issue
Block a user