* Re: [PATCH 0/3] brcmfmac: sdio: Deal better w/ transmission errors waking from sleep
From: Arend Van Spriel @ 2019-05-20 8:55 UTC (permalink / raw)
To: Douglas Anderson, Ulf Hansson, Kalle Valo, Adrian Hunter
Cc: linux-rockchip, Double Lo, briannorris, Madhan Mohan R, mka,
Wright Feng, Chi-Hsien Lin, linux-mmc, Shawn Lin,
brcm80211-dev-list, YueHaibing, Hante Meuleman, Martin Hicks,
Ritesh Harjani, Michael Trimarchi, Wolfram Sang, Franky Lin,
Jiong Wu, brcm80211-dev-list.pdl, David S. Miller, netdev,
linux-wireless, linux-kernel, Naveen Gupta, Avri Altman
In-Reply-To: <20190517225420.176893-1-dianders@chromium.org>
On 5/18/2019 12:54 AM, Douglas Anderson wrote:
> This series attempts to deal better with the expected transmission
> errors that we get when waking up the SDIO-based WiFi on
> rk3288-veyron-minnie, rk3288-veyron-speedy, and rk3288-veyron-mickey.
>
> Some details about those errors can be found in
> <https://crbug.com/960222>, but to summarize it here: if we try to
> send the wakeup command to the WiFi card at the same time it has
> decided to wake up itself then it will behave badly on the SDIO bus.
> This can cause timeouts or CRC errors.
>
> When I tested on 4.19 and 4.20 these CRC errors can be seen to cause
> re-tuning. Since I am currently developing on 4.19 this was the
> original problem I attempted to solve.
>
> On mainline it turns out that you don't see the retuning errors but
> you see tons of spam about timeouts trying to wakeup from sleep. I
> tracked down the commit that was causing that and have partially
> reverted it here. I have no real knowledge about Broadcom WiFi, but
> the commit that was causing problems sounds (from the descriptioin) to
> be a hack commit penalizing all Broadcom WiFi users because of a bug
> in a Cypress SD controller. I will let others comment if this is
> truly the case and, if so, what the right solution should be.
Let me give a bit of background. The brcmfmac driver implements its own
runtime-pm like functionality, ie. if the driver is idle for some time
it will put the device in a low-power state. When it does that it powers
down several cores in the chip among which the SDIO core. However, the
SDIO bus used be very bad at handling devices that do that so instead it
has the Always-On-Station (AOS) block take over the SDIO core in
handling the bus. Default is will send a R1 response, but only for CMD52
(and CMD14 but no host is using that cruft). In noCmdDecode it does not
respond and simply wakes up the SDIO core, which takes over again.
Because it does not respond timeouts (-110) are kinda expected in this mode.
Regards,
Arend
^ permalink raw reply
* [PATCH] iw: print HE capabilities
From: John Crispin @ 2019-05-20 10:54 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
Print the HE MAC/PHY capabilities and MCS/NSS sets.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
info.c | 6 ++
iw.h | 1 +
util.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 238 insertions(+)
diff --git a/info.c b/info.c
index 92c7d1d..e6270c8 100644
--- a/info.c
+++ b/info.c
@@ -162,7 +162,13 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
+ if (tb_band[NL80211_BAND_ATTR_IFTYPE_DATA]) {
+ struct nlattr *nl_iftype;
+ int rem_band;
+ nla_for_each_nested(nl_iftype, tb_band[NL80211_BAND_ATTR_IFTYPE_DATA], rem_band)
+ print_he_info(nl_iftype);
+ }
if (tb_band[NL80211_BAND_ATTR_FREQS]) {
if (!band_had_freq) {
printf("\t\tFrequencies:\n");
diff --git a/iw.h b/iw.h
index ca8a0ff..bc0b3ac 100644
--- a/iw.h
+++ b/iw.h
@@ -197,6 +197,7 @@ void print_ampdu_length(__u8 exponent);
void print_ampdu_spacing(__u8 spacing);
void print_ht_capability(__u16 cap);
void print_vht_info(__u32 capa, const __u8 *mcs);
+void print_he_info(struct nlattr *nl_iftype);
char *channel_width_name(enum nl80211_chan_width width);
const char *iftype_name(enum nl80211_iftype iftype);
diff --git a/util.c b/util.c
index 2fa0b74..1b5aae1 100644
--- a/util.c
+++ b/util.c
@@ -1101,6 +1101,237 @@ void print_vht_info(__u32 capa, const __u8 *mcs)
printf("\t\tVHT TX highest supported: %d Mbps\n", tmp & 0x1fff);
}
+void print_he_info(struct nlattr *nl_iftype)
+{
+ struct nlattr *tb[NL80211_BAND_IFTYPE_ATTR_MAX + 1];
+ struct nlattr *tb_flags[NL80211_IFTYPE_MAX + 1];
+ char *iftypes[NUM_NL80211_IFTYPES] = {
+ "Unspec", "Adhoc", "Station", "AP", "AP/VLAN", "WDS", "Monitor"
+ "Mesh", "P2P/Client", "P2P/Go", "P2P/Device", "OCB", "NAN",
+ };
+ __u16 mac_cap[3] = { 0 };
+ __u16 phy_cap[6] = { 0 };
+ __u16 mcs_set[6] = { 0 };
+ __u8 ppet[25] = { 0 };
+ size_t len;
+ int i;
+
+ #define PRINT_HE_CAP(_var, _idx, _bit, _str) \
+ do { \
+ if (_var[_idx] & BIT(_bit)) \
+ printf("\t\t\t\t" _str "\n"); \
+ } while (0)
+
+ #define PRINT_HE_CAP_MASK(_var, _idx, _shift, _mask, _str) \
+ do { \
+ if ((_var[_idx] >> _shift) & _mask) \
+ printf("\t\t\t\t" _str ": %d\n", (_var[_idx] >> _shift) & _mask); \
+ } while (0)
+
+ #define PRINT_HE_MAC_CAP(...) PRINT_HE_CAP(mac_cap, __VA_ARGS__)
+ #define PRINT_HE_MAC_CAP_MASK(...) PRINT_HE_CAP_MASK(mac_cap, __VA_ARGS__)
+ #define PRINT_HE_PHY_CAP(...) PRINT_HE_CAP(phy_cap, __VA_ARGS__)
+ #define PRINT_HE_PHY_CAP0(_idx, _bit, ...) PRINT_HE_CAP(phy_cap, _idx, _bit + 8, __VA_ARGS__)
+ #define PRINT_HE_PHY_CAP_MASK(...) PRINT_HE_CAP_MASK(phy_cap, __VA_ARGS__)
+
+ nla_parse(tb, NL80211_BAND_IFTYPE_ATTR_MAX,
+ nla_data(nl_iftype), nla_len(nl_iftype), NULL);
+
+ if (!tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES])
+ return;
+
+ if (nla_parse_nested(tb_flags, NL80211_IFTYPE_MAX,
+ tb[NL80211_BAND_IFTYPE_ATTR_IFTYPES], NULL))
+ return;
+
+ printf("\t\tHE Iftypes:");
+ for (i = 0; i < NUM_NL80211_IFTYPES; i++)
+ if (nla_get_flag(tb_flags[i]) && iftypes[i])
+ printf(" %s", iftypes[i]);
+ printf("\n");
+
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC]) {
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC]);
+ if (len > sizeof(mac_cap))
+ len = sizeof(mac_cap);
+ memcpy(mac_cap,
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC]),
+ len);
+ }
+ printf("\t\t\tHE MAC Capabilities (0x");
+ for (i = 0; i < 3; i++)
+ printf("%04x", mac_cap[i]);
+ printf("):\n");
+
+ PRINT_HE_MAC_CAP(0, 0, "+HTC HE Supported");
+ PRINT_HE_MAC_CAP(0, 1, "TWT Requester");
+ PRINT_HE_MAC_CAP(0, 2, "TWT Responder");
+ PRINT_HE_MAC_CAP_MASK(0, 3, 0x3, "Dynamic BA Fragementation Level");
+ PRINT_HE_MAC_CAP_MASK(0, 5, 0x7, "Maximum number of MSDUS Fragments");
+ PRINT_HE_MAC_CAP_MASK(0, 8, 0x3, "Minimum Payload size of 128 bytes");
+ PRINT_HE_MAC_CAP_MASK(0, 10, 0x3, "Trigger Frame MAC Padding Duration");
+ PRINT_HE_MAC_CAP_MASK(0, 12, 0x7, "Multi-TID Aggregation Support");
+
+ PRINT_HE_MAC_CAP(1, 1, "All Ack");
+ PRINT_HE_MAC_CAP(1, 2, "TRS");
+ PRINT_HE_MAC_CAP(1, 3, "BSR");
+ PRINT_HE_MAC_CAP(1, 4, "Broadcast TWT");
+ PRINT_HE_MAC_CAP(1, 5, "32-bit BA Bitmap");
+ PRINT_HE_MAC_CAP(1, 6, "MU Cascading");
+ PRINT_HE_MAC_CAP(1, 7, "Ack-Enabled Aggregation");
+ PRINT_HE_MAC_CAP(1, 9, "OM Control");
+ PRINT_HE_MAC_CAP(1, 10, "OFDMA RA");
+ PRINT_HE_MAC_CAP_MASK(1, 11, 0x3, "Maximum A-MPDU Length Exponent");
+ PRINT_HE_MAC_CAP(1, 13, "A-MSDU Fragmentation");
+ PRINT_HE_MAC_CAP(1, 14, "Flexible TWT Scheduling");
+ PRINT_HE_MAC_CAP(1, 15, "RX Control Frame to MultiBSS");
+
+ PRINT_HE_MAC_CAP(2, 0, "BSRP BQRP A-MPDU Aggregation");
+ PRINT_HE_MAC_CAP(2, 1, "QTP");
+ PRINT_HE_MAC_CAP(2, 2, "BQR");
+ PRINT_HE_MAC_CAP(2, 3, "SRP Responder Role");
+ PRINT_HE_MAC_CAP(2, 4, "NDP Feedback Report");
+ PRINT_HE_MAC_CAP(2, 5, "OPS");
+ PRINT_HE_MAC_CAP(2, 6, "A-MSDU in A-MPDU");
+ PRINT_HE_MAC_CAP_MASK(2, 7, 7, "Multi-TID Aggregation TX");
+ PRINT_HE_MAC_CAP(2, 10, "HE Subchannel Selective Transmission");
+ PRINT_HE_MAC_CAP(2, 11, "UL 2x996-Tone RU");
+ PRINT_HE_MAC_CAP(2, 12, "OM Control UL MU Data Disable RX");
+
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]) {
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]);
+
+ if (len > sizeof(phy_cap) - 1)
+ len = sizeof(phy_cap) - 1;
+ memcpy(&((__u8 *)phy_cap)[1],
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY]),
+ len);
+ }
+ printf("\t\t\tHE PHY Capabilities: (0x");
+ for (i = 0; i < 11; i++)
+ printf("%02x", ((__u8 *)phy_cap)[i + 1]);
+ printf("):\n");
+
+ PRINT_HE_PHY_CAP0(0, 1, "HE40/2.4GHz");
+ PRINT_HE_PHY_CAP0(0, 2, "HE40/HE80/5GHz");
+ PRINT_HE_PHY_CAP0(0, 3, "HE160/5GHz");
+ PRINT_HE_PHY_CAP0(0, 4, "HE160/HE80+80/5GHz");
+ PRINT_HE_PHY_CAP0(0, 5, "242 tone RUs/2.4GHz");
+ PRINT_HE_PHY_CAP0(0, 6, "242 tone RUs/5GHz");
+
+ PRINT_HE_PHY_CAP_MASK(1, 0, 0xf, "Punctured Preamble RX");
+ PRINT_HE_PHY_CAP_MASK(1, 4, 0x1, "Device Class");
+ PRINT_HE_PHY_CAP(1, 5, "LDPC Coding in Payload");
+ PRINT_HE_PHY_CAP(1, 6, "HE SU PPDU with 1x HE-LTF and 0.8us GI");
+ PRINT_HE_PHY_CAP_MASK(1, 7, 0x3, "Midamble Rx Max NSTS");
+ PRINT_HE_PHY_CAP(1, 9, "NDP with 4x HE-LTF and 3.2us GI");
+ PRINT_HE_PHY_CAP(1, 10, "STBC Tx <= 80MHz");
+ PRINT_HE_PHY_CAP(1, 11, "STBC Rx <= 80MHz");
+ PRINT_HE_PHY_CAP(1, 12, "Doppler Tx");
+ PRINT_HE_PHY_CAP(1, 13, "Doppler Rx");
+ PRINT_HE_PHY_CAP(1, 14, "Full Bandwidth UL MU-MIMO");
+ PRINT_HE_PHY_CAP(1, 15, "Partial Bandwidth UL MU-MIMO");
+
+ PRINT_HE_PHY_CAP_MASK(2, 0, 0x3, "DCM Max Constellation");
+ PRINT_HE_PHY_CAP_MASK(2, 2, 0x1, "DCM Max NSS Tx");
+ PRINT_HE_PHY_CAP_MASK(2, 3, 0x3, "DCM Max Constellation Rx");
+ PRINT_HE_PHY_CAP_MASK(2, 5, 0x1, "DCM Max NSS Rx");
+ PRINT_HE_PHY_CAP(2, 6, "Rx HE MU PPDU from Non-AP STA");
+ PRINT_HE_PHY_CAP(2, 7, "SU Beamformer");
+ PRINT_HE_PHY_CAP(2, 8, "SU Beamformee");
+ PRINT_HE_PHY_CAP(2, 9, "MU Beamformer");
+ PRINT_HE_PHY_CAP_MASK(2, 10, 0x7, "Beamformee STS <= 80Mhz");
+ PRINT_HE_PHY_CAP_MASK(2, 13, 0x7, "Beamformee STS > 80Mhz");
+
+ PRINT_HE_PHY_CAP_MASK(3, 0, 0x7, "Sounding Dimensions <= 80Mhz");
+ PRINT_HE_PHY_CAP_MASK(3, 3, 0x7, "Sounding Dimensions > 80Mhz");
+ PRINT_HE_PHY_CAP(3, 6, "Ng = 16 SU Feedback");
+ PRINT_HE_PHY_CAP(3, 7, "Ng = 16 MU Feedback");
+ PRINT_HE_PHY_CAP(3, 8, "Codebook Size SU Feedback");
+ PRINT_HE_PHY_CAP(3, 9, "Codebook Size MU Feedback");
+ PRINT_HE_PHY_CAP(3, 10, "Triggered SU Beamforming Feedback");
+ PRINT_HE_PHY_CAP(3, 11, "Triggered MU Beamforming Feedback");
+ PRINT_HE_PHY_CAP(3, 12, "Triggered CQI Feedback");
+ PRINT_HE_PHY_CAP(3, 13, "Partial Bandwidth Extended Range");
+ PRINT_HE_PHY_CAP(3, 14, "Partial Bandwidth DL MU-MIMO");
+ PRINT_HE_PHY_CAP(3, 15, "PPE Threshold Present");
+
+ PRINT_HE_PHY_CAP(4, 0, "SRP-based SR");
+ PRINT_HE_PHY_CAP(4, 1, "Power Boost Factor ar");
+ PRINT_HE_PHY_CAP(4, 2, "HE SU PPDU & HE PPDU 4x HE-LTF 0.8us GI");
+ PRINT_HE_PHY_CAP_MASK(4, 3, 0x7, "Max NC");
+ PRINT_HE_PHY_CAP(4, 6, "STBC Tx > 80MHz");
+ PRINT_HE_PHY_CAP(4, 7, "STBC Rx > 80MHz");
+ PRINT_HE_PHY_CAP(4, 8, "HE ER SU PPDU 4x HE-LTF 0.8us GI");
+ PRINT_HE_PHY_CAP(4, 9, "20MHz in 40MHz HE PPDU 2.4GHz");
+ PRINT_HE_PHY_CAP(4, 10, "20MHz in 160/80+80MHz HE PPDU");
+ PRINT_HE_PHY_CAP(4, 11, "80MHz in 160/80+80MHz HE PPDU");
+ PRINT_HE_PHY_CAP(4, 12, "HE ER SU PPDU 1x HE-LTF 0.8us GI");
+ PRINT_HE_PHY_CAP(4, 13, "Midamble Rx 2x & 1x HE-LTF");
+ PRINT_HE_PHY_CAP_MASK(4, 14, 0x3, "DCM Max BW");
+
+ PRINT_HE_PHY_CAP(5, 0, "Longer Than 16HE SIG-B OFDM Symbols");
+ PRINT_HE_PHY_CAP(5, 1, "Non-Triggered CQI Feedback");
+ PRINT_HE_PHY_CAP(5, 2, "TX 1024-QAM");
+ PRINT_HE_PHY_CAP(5, 3, "RX 1024-QAM");
+ PRINT_HE_PHY_CAP(5, 4, "RX Full BW SU Using HE MU PPDU with Compression SIGB");
+ PRINT_HE_PHY_CAP(5, 5, "RX Full BW SU Using HE MU PPDU with Non-Compression SIGB");
+
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET]) {
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET]);
+ if (len > sizeof(mcs_set))
+ len = sizeof(mcs_set);
+ memcpy(mcs_set,
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET]),
+ len);
+ }
+
+ for (i = 0; i < 3; i++) {
+ __u8 phy_cap_support[] = { BIT(1) | BIT(2), BIT(3), BIT(4) };
+ char *bw[] = { "<= 80", "160", "80+80" };
+ int j;
+
+ if ((phy_cap[0] & (phy_cap_support[i] << 8)) == 0)
+ continue;
+
+ for (j = 0; j < 2; j++) {
+ int k;
+ printf("\t\t\tHE %s MCS and NSS set %s MHz\n", j ? "TX" : "RX", bw[i]);
+ for (k = 0; k < 8; k++) {
+ __u16 mcs = mcs_set[(i * 2) + j];
+ mcs >>= k * 2;
+ mcs &= 0x3;
+ printf("\t\t\t\t\t %d streams: ", k + 1);
+ if (mcs == 3)
+ printf("not supported\n");
+ else
+ printf("MCS 0-%d\n", 7 + (mcs * 2));
+ }
+
+ }
+ }
+
+ len = 0;
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE]) {
+ len = nla_len(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE]);
+ if (len > sizeof(ppet))
+ len = sizeof(ppet);
+ memcpy(ppet,
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE]),
+ len);
+ }
+
+ if (len && (phy_cap[3] & BIT(15))) {
+ size_t i;
+
+ printf("\t\t\tPPE Threshold ");
+ for (i = 0; i < len; i++)
+ if (ppet[i])
+ printf("0x%02x ", ppet[i]);
+ printf("\n");
+ }
+}
+
void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
{
size_t i;
--
2.20.1
^ permalink raw reply related
* [PATCH 0/7] mac80211: HE: add TWT and SPR/OBSSPD support
From: John Crispin @ 2019-05-20 11:01 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo; +Cc: ath11k, linux-wireless, John Crispin
This series adds support for propagating the TWT and OBSS PD information
from userland/assocs to a wireless driver. The patches for making use of
these features inside ath11k are also included.
I already have the hostapd patches ready and will send them once these
changes are inside nl80211.h.
John Crispin (7):
mac80211: dynamically enable the TWT requester support on STA
interfaces
mac80211: allow turning TWT responder support on and off via netlink
ath11k: add TWT support
mac80211: HE: add Spatial Reuse IE parsing support
mac80211: allow setting spatial reuse parameters when bringing up an
AP
mac80211: propagate spatial reuse info into ieee80211_sta
ath11k: add spatial reuse support
drivers/net/wireless/ath/ath11k/mac.c | 22 +++++
drivers/net/wireless/ath/ath11k/wmi.c | 126 ++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 87 ++++++++++++++++++
include/linux/ieee80211.h | 49 ++++++++++
include/net/cfg80211.h | 17 ++++
include/net/mac80211.h | 10 ++
include/uapi/linux/nl80211.h | 31 +++++++
net/mac80211/cfg.c | 7 +-
net/mac80211/he.c | 24 +++++
net/mac80211/ieee80211_i.h | 5 +
net/mac80211/mlme.c | 19 +++-
net/mac80211/util.c | 4 +
net/wireless/nl80211.c | 47 ++++++++++
13 files changed, 445 insertions(+), 3 deletions(-)
--
2.20.1
^ permalink raw reply
* [PATCH 4/7] mac80211: HE: add Spatial Reuse IE parsing support
From: John Crispin @ 2019-05-20 11:02 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Add support to mac80211 for parsing SPR IEs.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/linux/ieee80211.h | 49 ++++++++++++++++++++++++++++++++++++++
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/util.c | 4 ++++
3 files changed, 54 insertions(+)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 48703ec60d06..6109aa4024ad 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1628,6 +1628,18 @@ struct ieee80211_he_operation {
u8 optional[0];
} __packed;
+/**
+ * struct ieee80211_he_spr - HE spatial reuse element
+ *
+ * This structure is the "HE spatial reuse element" element as
+ * described in P802.11ax_D3.0 section 9.4.2.241
+ */
+struct ieee80211_he_spr {
+ u8 he_sr_control;
+ /* Optional 0 to 19 bytes: depends on @he_sr_control */
+ u8 optional[0];
+} __packed;
+
/**
* struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
*
@@ -2063,6 +2075,42 @@ ieee80211_he_oper_size(const u8 *he_oper_ie)
return oper_len;
}
+/* HE Spatial Reuse defines */
+#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT 0x4
+#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT 0x8
+
+/*
+ * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
+ * @he_spr_ie: byte data of the He Spatial Reuse IE, stating from the the byte
+ * after the ext ID byte. It is assumed that he_spr_ie has at least
+ * sizeof(struct ieee80211_he_spr) bytes, checked already in
+ * ieee802_11_parse_elems_crc()
+ * @return the actual size of the IE data (not including header), or 0 on error
+ */
+static inline u8
+ieee80211_he_spr_size(const u8 *he_spr_ie)
+{
+ struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
+ u8 spr_len = sizeof(struct ieee80211_he_spr);
+ u32 he_spr_params;
+
+ /* Make sure the input is not NULL */
+ if (!he_spr_ie)
+ return 0;
+
+ /* Calc required length */
+ he_spr_params = le32_to_cpu(he_spr->he_sr_control);
+ if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
+ spr_len++;
+ if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
+ spr_len += 18;
+
+ /* Add the first byte (extension ID) to the total length */
+ spr_len++;
+
+ return spr_len;
+}
+
/* Authentication algorithms */
#define WLAN_AUTH_OPEN 0
#define WLAN_AUTH_SHARED_KEY 1
@@ -2485,6 +2533,7 @@ enum ieee80211_eid_ext {
WLAN_EID_EXT_HE_OPERATION = 36,
WLAN_EID_EXT_UORA = 37,
WLAN_EID_EXT_HE_MU_EDCA = 38,
+ WLAN_EID_EXT_HE_SPR = 39,
WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME = 52,
WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION = 55,
};
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 11bc1778bfd5..e931e114fba4 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1482,6 +1482,7 @@ struct ieee802_11_elems {
const struct ieee80211_meshconf_ie *mesh_config;
const u8 *he_cap;
const struct ieee80211_he_operation *he_operation;
+ const struct ieee80211_he_spr *he_spr;
const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
const u8 *uora_element;
const u8 *mesh_id;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 4c1655972565..1b7076d24c18 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1282,6 +1282,10 @@ _ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION &&
elen == 3) {
elems->mbssid_config_ie = (void *)&pos[1];
+ } else if (pos[0] == WLAN_EID_EXT_HE_SPR &&
+ elen >= sizeof(*elems->he_spr) &&
+ elen >= ieee80211_he_spr_size(&pos[1])) {
+ elems->he_spr = (void *)&pos[1];
}
break;
default:
--
2.20.1
^ permalink raw reply related
* [PATCH 2/7] mac80211: HE: allow turning TWT responder support on and off via netlink
From: John Crispin @ 2019-05-20 11:01 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Allow the userland daemon to en/disable TWT support for an AP.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/cfg80211.h | 2 ++
include/net/mac80211.h | 3 +++
include/uapi/linux/nl80211.h | 4 ++++
net/mac80211/cfg.c | 4 +++-
net/wireless/nl80211.c | 5 +++++
5 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 13bfeb712d36..044c519a008f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -876,6 +876,7 @@ enum cfg80211_ap_settings_flags {
* @he_cap: HE capabilities (or %NULL if HE isn't enabled)
* @ht_required: stations must support HT
* @vht_required: stations must support VHT
+ * @twt_responder: Enable Target Wait Time
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
*/
struct cfg80211_ap_settings {
@@ -902,6 +903,7 @@ struct cfg80211_ap_settings {
const struct ieee80211_vht_cap *vht_cap;
const struct ieee80211_he_cap_elem *he_cap;
bool ht_required, vht_required;
+ bool twt_responder;
u32 flags;
};
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 689dc597281c..a8e2381c9954 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -506,6 +506,8 @@ struct ieee80211_ftm_responder_params {
* @he_support: does this BSS support HE
* @twt_requester: does this BSS support TWT requester (relevant for managed
* mode only, set if the AP advertises TWT responder role)
+ * @twt_responder: does this BSS support TWT requester (relevant for managed
+ * mode only, set if the AP advertises TWT responder role)
* @assoc: association status
* @ibss_joined: indicates whether this station is part of an IBSS
* or not
@@ -613,6 +615,7 @@ struct ieee80211_bss_conf {
u16 frame_time_rts_th;
bool he_support;
bool twt_requester;
+ bool twt_responder;
/* association related data */
bool assoc, ibss_joined;
bool ibss_creator;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b6e29161ec8b..07d3f1949f96 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2308,6 +2308,8 @@ enum nl80211_commands {
* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
* scheduler.
*
+ * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2759,6 +2761,8 @@ enum nl80211_attrs {
NL80211_ATTR_AIRTIME_WEIGHT,
+ NL80211_ATTR_TWT_RESPONDER,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 09dd1c2860fc..8be2f32fedfc 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -939,7 +939,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
BSS_CHANGED_BEACON |
BSS_CHANGED_SSID |
BSS_CHANGED_P2P_PS |
- BSS_CHANGED_TXPOWER;
+ BSS_CHANGED_TXPOWER |
+ BSS_CHANGED_TWT;
int err;
int prev_beacon_int;
@@ -1009,6 +1010,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->vif.bss_conf.dtim_period = params->dtim_period;
sdata->vif.bss_conf.enable_beacon = true;
sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
+ sdata->vif.bss_conf.twt_responder = params->twt_responder;
sdata->vif.bss_conf.ssid_len = params->ssid_len;
if (params->ssid_len)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 47e30a58566c..b4dbb6b56853 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -541,6 +541,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_PEER_MEASUREMENTS] =
NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
+ [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -4531,6 +4532,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(params.acl);
}
+ if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
+ params.twt_responder =
+ nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
+
nl80211_calculate_ap_params(¶ms);
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
--
2.20.1
^ permalink raw reply related
* [PATCH 5/7] mac80211: HE: allow setting spatial reuse parameters when bringing up an AP
From: John Crispin @ 2019-05-20 11:02 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/cfg80211.h | 15 +++++++++++++
include/net/mac80211.h | 4 ++++
include/uapi/linux/nl80211.h | 27 +++++++++++++++++++++++
net/mac80211/cfg.c | 5 ++++-
net/wireless/nl80211.c | 42 ++++++++++++++++++++++++++++++++++++
5 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 044c519a008f..3f67f01b5f7a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -249,6 +249,19 @@ struct ieee80211_rate {
u16 hw_value, hw_value_short;
};
+/**
+ * struct ieee80211_he_obss_pd - AP settings for spatial reuse
+ *
+ * @enable: is the feature enabled.
+ * @min_offset: minimal tx power offset an associated station shall use
+ * @max_offset: maximum tx power offset an associated station shall use
+ */
+struct ieee80211_he_obss_pd {
+ bool enable;
+ u32 min_offset;
+ u32 max_offset;
+};
+
/**
* struct ieee80211_sta_ht_cap - STA's HT capabilities
*
@@ -878,6 +891,7 @@ enum cfg80211_ap_settings_flags {
* @vht_required: stations must support VHT
* @twt_responder: Enable Target Wait Time
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
+ * @he_obss_pd: OBSS Packet Detection settings
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
@@ -905,6 +919,7 @@ struct cfg80211_ap_settings {
bool ht_required, vht_required;
bool twt_responder;
u32 flags;
+ struct ieee80211_he_obss_pd he_obss_pd;
};
/**
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a8e2381c9954..d81eea9140e5 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -318,6 +318,7 @@ struct ieee80211_vif_chanctx_switch {
* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder
* functionality changed for this BSS (AP mode).
* @BSS_CHANGED_TWT: TWT status changed
+ * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
*
*/
enum ieee80211_bss_change {
@@ -349,6 +350,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_MCAST_RATE = 1<<25,
BSS_CHANGED_FTM_RESPONDER = 1<<26,
BSS_CHANGED_TWT = 1<<27,
+ BSS_CHANGED_HE_OBSS_PD = 1<<28,
/* when adding here, make sure to change ieee80211_reconfig */
};
@@ -603,6 +605,7 @@ struct ieee80211_ftm_responder_params {
* nontransmitted BSSIDs
* @profile_periodicity: the least number of beacon frames need to be received
* in order to discover all the nontransmitted BSSIDs in the set.
+ * @he_obss_pd: OBSS Packet Detection parameters.
*/
struct ieee80211_bss_conf {
const u8 *bssid;
@@ -664,6 +667,7 @@ struct ieee80211_bss_conf {
u8 bssid_indicator;
bool ema_ap;
u8 profile_periodicity;
+ struct ieee80211_he_obss_pd he_obss_pd;
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 07d3f1949f96..78f3326ae0ea 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2310,6 +2310,9 @@ enum nl80211_commands {
*
* @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
*
+ * @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection
+ * functionality.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2763,6 +2766,8 @@ enum nl80211_attrs {
NL80211_ATTR_TWT_RESPONDER,
+ NL80211_ATTR_HE_OBSS_PD,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -6390,4 +6395,26 @@ enum nl80211_peer_measurement_ftm_resp {
NL80211_PMSR_FTM_RESP_ATTR_MAX = NUM_NL80211_PMSR_FTM_RESP_ATTR - 1
};
+/**
+ * enum nl80211_he_spr - spatial reuse attributes
+ * @__NL80211_HE_OBSS_PD_ATTR_INVALID: Invalid
+ *
+ * @NL80211_ATTR_HE_OBSS_PD_MIN_OFFSET: the OBSS PD minimum tx power offset.
+ * @NL80211_ATTR_HE_OBSS_PD_MAX_OFFSET: the OBSS PD maximum tx power offset.
+ *
+ * @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal
+ * @NL80211_HE_OBSS_PD_ATTR_MAX: highest spiatl reuse attribute.
+ */
+enum nl80211_he_spr_attributes {
+ __NL80211_HE_OBSS_PD_ATTR_INVALID,
+
+ NL80211_ATTR_HE_OBSS_PD_MIN_OFFSET,
+ NL80211_ATTR_HE_OBSS_PD_MAX_OFFSET,
+
+ /* keep last */
+ __NL80211_ATTR_HE_OBSS_PD_LAST,
+ NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_ATTR_HE_OBSS_PD_LAST - 1,
+};
+
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8be2f32fedfc..742b62187a4c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -940,7 +940,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
BSS_CHANGED_SSID |
BSS_CHANGED_P2P_PS |
BSS_CHANGED_TXPOWER |
- BSS_CHANGED_TWT;
+ BSS_CHANGED_TWT |
+ BSS_CHANGED_HE_OBSS_PD;
int err;
int prev_beacon_int;
@@ -1011,6 +1012,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->vif.bss_conf.enable_beacon = true;
sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
sdata->vif.bss_conf.twt_responder = params->twt_responder;
+ memcpy(&sdata->vif.bss_conf.he_obss_pd, ¶ms->he_obss_pd,
+ sizeof(struct ieee80211_he_obss_pd));
sdata->vif.bss_conf.ssid_len = params->ssid_len;
if (params->ssid_len)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b4dbb6b56853..266636ce3803 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -542,6 +542,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
[NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG },
+ [NL80211_ATTR_HE_OBSS_PD] = { .type = NLA_NESTED },
};
/* policy for the key attributes */
@@ -4253,6 +4254,40 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev,
return 0;
}
+static const struct nla_policy
+ he_spr_policy[NL80211_HE_OBSS_PD_ATTR_MAX + 1] = {
+ [NL80211_ATTR_HE_OBSS_PD_MIN_OFFSET] = { .type = NLA_U32 },
+ [NL80211_ATTR_HE_OBSS_PD_MAX_OFFSET] = { .type = NLA_U32 },
+};
+
+static int nl80211_parse_he_obss_pd(struct nlattr *attrs,
+ struct ieee80211_he_obss_pd *he_obss_pd)
+{
+ struct nlattr *tb[NL80211_HE_OBSS_PD_ATTR_MAX + 1];
+ int err;
+
+ err = nla_parse_nested(tb, NL80211_HE_OBSS_PD_ATTR_MAX, attrs,
+ he_spr_policy, NULL);
+ if (err)
+ return err;
+
+ if (!tb[NL80211_ATTR_HE_OBSS_PD_MIN_OFFSET] ||
+ !tb[NL80211_ATTR_HE_OBSS_PD_MAX_OFFSET])
+ return -EINVAL;
+
+ he_obss_pd->min_offset =
+ nla_get_u32(tb[NL80211_ATTR_HE_OBSS_PD_MIN_OFFSET]);
+ he_obss_pd->max_offset =
+ nla_get_u32(tb[NL80211_ATTR_HE_OBSS_PD_MAX_OFFSET]);
+
+ if (he_obss_pd->min_offset >= he_obss_pd->max_offset)
+ return -EINVAL;
+
+ he_obss_pd->enable = true;
+
+ return 0;
+}
+
static void nl80211_check_ap_rate_selectors(struct cfg80211_ap_settings *params,
const u8 *rates)
{
@@ -4536,6 +4571,13 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
params.twt_responder =
nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
+ if (info->attrs[NL80211_ATTR_HE_OBSS_PD]) {
+ err = nl80211_parse_he_obss_pd(info->attrs[NL80211_ATTR_HE_OBSS_PD],
+ ¶ms.he_obss_pd);
+ if (err)
+ return err;
+ }
+
nl80211_calculate_ap_params(¶ms);
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
--
2.20.1
^ permalink raw reply related
* [PATCH 3/7] ath11k: add TWT support
From: John Crispin @ 2019-05-20 11:02 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Add target wait time wmi calls to the driver. En/disable the support
from when the bss_config changes. We ignore the cmd completion events.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/mac.c | 12 ++++
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++
3 files changed, 174 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index b436e90f627a..ead546a33726 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1325,6 +1325,11 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar,
}
}
+ if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES)
+ arg->twt_responder = true;
+ if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ)
+ arg->twt_requester = true;
+
switch (sta->bandwidth) {
case IEEE80211_STA_RX_BW_160:
if (he_cap->he_cap_elem.phy_cap_info[0] &
@@ -1893,6 +1898,13 @@ static void ath11k_bss_info_changed(struct ieee80211_hw *hw,
ath11k_mac_txpower_recalc(ar);
}
+ if (changed & BSS_CHANGED_TWT) {
+ if (info->twt_requester || info->twt_responder)
+ ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev_idx);
+ else
+ ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
+ }
+
mutex_unlock(&ar->conf_mutex);
}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 05b955a9749f..8fb45e9c1175 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -1670,6 +1670,10 @@ ath11k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
cmd->peer_flags |= WMI_PEER_VHT;
if (param->he_flag)
cmd->peer_flags |= WMI_PEER_HE;
+ if (param->twt_requester)
+ cmd->peer_flags |= WMI_PEER_TWT_REQ;
+ if (param->twt_responder)
+ cmd->peer_flags |= WMI_PEER_TWT_RESP;
}
/* Suppress authorization for all AUTH modes that need 4-way handshake
@@ -2500,6 +2504,86 @@ int ath11k_wmi_pdev_pktlog_disable(struct ath11k *ar)
return ret;
}
+int
+ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_enable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_ENABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+ cmd->sta_cong_timer_ms = ATH11K_TWT_DEF_STA_CONG_TIMER_MS;
+ cmd->default_slot_size = ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE;
+ cmd->congestion_thresh_setup = ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP;
+ cmd->congestion_thresh_teardown =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN;
+ cmd->congestion_thresh_critical =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL;
+ cmd->interference_thresh_teardown =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN;
+ cmd->interference_thresh_setup =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP;
+ cmd->min_no_sta_setup = ATH11K_TWT_DEF_MIN_NO_STA_SETUP;
+ cmd->min_no_sta_teardown = ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN;
+ cmd->no_of_bcast_mcast_slots = ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS;
+ cmd->min_no_twt_slots = ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS;
+ cmd->max_no_sta_twt = ATH11K_TWT_DEF_MAX_NO_STA_TWT;
+ cmd->mode_check_interval = ATH11K_TWT_DEF_MODE_CHECK_INTERVAL;
+ cmd->add_sta_slot_interval = ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL;
+ cmd->remove_sta_slot_interval =
+ ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL;
+ /* TODO add MBSSID support */
+ cmd->mbss_support = 0;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_ENABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_ENABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_disable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_DISABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_DISABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_DIeABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
static inline void ath11k_fill_band_to_mac_param(struct ath11k_base *soc,
struct wmi_host_pdev_band_to_mac *band_to_mac)
{
@@ -2590,6 +2674,9 @@ ath11k_wmi_copy_resource_config(struct wmi_resource_config *wmi_cfg,
wmi_cfg->use_pdev_id = tg_cfg->use_pdev_id;
wmi_cfg->flag1 = tg_cfg->atf_config;
wmi_cfg->peer_map_unmap_v2_support = tg_cfg->peer_map_unmap_v2_support;
+ wmi_cfg->sched_params = tg_cfg->sched_params;
+ wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count;
+ wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count;
}
static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
@@ -2781,6 +2868,8 @@ int ath11k_wmi_cmd_init(struct ath11k_base *sc)
config.beacon_tx_offload_max_vdev = sc->num_radios * TARGET_MAX_BCN_OFFLD;
config.rx_batchmode = TARGET_RX_BATCHMODE;
config.peer_map_unmap_v2_support = 1;
+ config.twt_ap_pdev_count = 2;
+ config.twt_ap_sta_count = 1000;
memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
@@ -5626,6 +5715,8 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_VDEV_DELETE_RESP_EVENTID:
+ case WMI_TWT_ENABLE_EVENTID:
+ case WMI_TWT_DISABLE_EVENTID:
ath11k_dbg(ab, ATH11K_DBG_WMI,
"ignoring unsupported event 0x%x\n", id);
break;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 2e3e0cf866e9..c74aa98439ca 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -169,6 +169,10 @@ enum wmi_cmd_group {
WMI_GRP_MONITOR, /* 0x39 */
WMI_GRP_REGULATORY, /* 0x3a */
WMI_GRP_HW_DATA_FILTER, /* 0x3b */
+ WMI_GRP_WLM, /* 0x3c */
+ WMI_GRP_11K_OFFLOAD, /* 0x3d */
+ WMI_GRP_TWT, /* 0x3e */
+
};
#define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
@@ -531,6 +535,12 @@ enum wmi_tlv_cmd_id {
WMI_NDP_RESPONDER_REQ_CMDID,
WMI_NDP_END_REQ_CMDID,
WMI_HW_DATA_FILTER_CMDID = WMI_TLV_CMD(WMI_GRP_HW_DATA_FILTER),
+ WMI_TWT_ENABLE_CMDID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_CMDID,
+ WMI_TWT_ADD_DIALOG_CMDID,
+ WMI_TWT_DEL_DIALOG_CMDID,
+ WMI_TWT_PAUSE_DIALOG_CMDID,
+ WMI_TWT_RESUME_DIALOG_CMDID,
};
enum wmi_tlv_event_id {
@@ -713,6 +723,13 @@ enum wmi_tlv_event_id {
WMI_NDP_INDICATION_EVENTID,
WMI_NDP_CONFIRM_EVENTID,
WMI_NDP_END_INDICATION_EVENTID,
+
+ WMI_TWT_ENABLE_EVENTID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_EVENTID,
+ WMI_TWT_ADD_DIALOG_EVENTID,
+ WMI_TWT_DEL_DIALOG_EVENTID,
+ WMI_TWT_PAUSE_DIALOG_EVENTID,
+ WMI_TWT_RESUME_DIALOG_EVENTID,
};
enum wmi_tlv_pdev_param {
@@ -2736,6 +2753,9 @@ struct wmi_resource_config {
u32 max_num_dbs_scan_duty_cycle;
u32 max_num_group_keys;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
} __packed;
struct wmi_service_ready_event {
@@ -3907,6 +3927,8 @@ struct peer_assoc_params {
u32 peer_he_mcs_count;
u32 peer_he_rx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
u32 peer_he_tx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
+ bool twt_responder;
+ bool twt_requester;
struct ath11k_ppe_threshold peer_ppet;
};
@@ -4156,6 +4178,8 @@ struct wmi_unit_test_cmd {
#define WMI_PEER_DYN_MIMOPS 0x00020000
#define WMI_PEER_STATIC_MIMOPS 0x00040000
#define WMI_PEER_SPATIAL_MUX 0x00200000
+#define WMI_PEER_TWT_REQ 0x00400000
+#define WMI_PEER_TWT_RESP 0x00800000
#define WMI_PEER_VHT 0x02000000
#define WMI_PEER_80MHZ 0x04000000
#define WMI_PEER_PMF 0x08000000
@@ -5048,6 +5072,48 @@ struct wmi_wmm_params_all_arg {
struct wmi_wmm_params_arg ac_vo;
};
+#define ATH11K_TWT_DEF_STA_CONG_TIMER_MS 5000
+#define ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE 10
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN 20
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL 100
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN 80
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_MIN_NO_STA_SETUP 10
+#define ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN 2
+#define ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS 2
+#define ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS 2
+#define ATH11K_TWT_DEF_MAX_NO_STA_TWT 500
+#define ATH11K_TWT_DEF_MODE_CHECK_INTERVAL 10000
+#define ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL 1000
+#define ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL 5000
+
+struct wmi_twt_enable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+ u32 sta_cong_timer_ms;
+ u32 mbss_support;
+ u32 default_slot_size;
+ u32 congestion_thresh_setup;
+ u32 congestion_thresh_teardown;
+ u32 congestion_thresh_critical;
+ u32 interference_thresh_teardown;
+ u32 interference_thresh_setup;
+ u32 min_no_sta_setup;
+ u32 min_no_sta_teardown;
+ u32 no_of_bcast_mcast_slots;
+ u32 min_no_twt_slots;
+ u32 max_no_sta_twt;
+ u32 mode_check_interval;
+ u32 add_sta_slot_interval;
+ u32 remove_sta_slot_interval;
+};
+
+struct wmi_twt_disable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+};
+
struct target_resource_config {
u32 num_vdevs;
u32 num_peers;
@@ -5108,6 +5174,9 @@ struct target_resource_config {
u32 max_bssid_rx_filters;
u32 use_pdev_id;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
};
#define WMI_MAX_MEM_REQS 32
@@ -5234,4 +5303,6 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
struct ath11k_fw_stats *fw_stats, u32 stats_id,
char *buf);
int ath11k_wmi_simulate_radar(struct ath11k *ar);
+int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
#endif
--
2.20.1
^ permalink raw reply related
* [PATCH 7/7] ath11k: add spatial reuse support
From: John Crispin @ 2019-05-20 11:02 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Trigger the WMI call en/disabling OBSS PD when the bss config changes or we
assoc to an AP that broadcasts the IE.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/mac.c | 10 ++++++++
drivers/net/wireless/ath/ath11k/wmi.c | 35 +++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 16 ++++++++++++
3 files changed, 61 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index ead546a33726..1f92a8c9baa3 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1714,6 +1714,12 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw,
1);
if (ret)
ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret);
+
+ ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
+ &ap_sta->he_obss_pd);
+ if (ret)
+ ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n",
+ arvif->vdev_id, ret);
}
static void ath11k_bss_disassoc(struct ieee80211_hw *hw,
@@ -1905,6 +1911,10 @@ static void ath11k_bss_info_changed(struct ieee80211_hw *hw,
ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
}
+ if (changed & BSS_CHANGED_HE_OBSS_PD)
+ ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
+ &info->he_obss_pd);
+
mutex_unlock(&ar->conf_mutex);
}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 8fb45e9c1175..50c84f9e9cbf 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -2584,6 +2584,41 @@ ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
return ret;
}
+int
+ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
+ struct ieee80211_he_obss_pd *he_obss_pd)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_obss_spatial_reuse_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+ WMI_TAG_OBSS_SPATIAL_REUSE_SET_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->vdev_id = vdev_id;
+ cmd->enable = he_obss_pd->enable;
+ cmd->obss_min = he_obss_pd->min_offset;
+ cmd->obss_max = he_obss_pd->max_offset;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID);
+ if (ret) {
+ ath11k_warn(ab,
+ "Failed to send WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
static inline void ath11k_fill_band_to_mac_param(struct ath11k_base *soc,
struct wmi_host_pdev_band_to_mac *band_to_mac)
{
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index c74aa98439ca..10f2a83db327 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -172,6 +172,8 @@ enum wmi_cmd_group {
WMI_GRP_WLM, /* 0x3c */
WMI_GRP_11K_OFFLOAD, /* 0x3d */
WMI_GRP_TWT, /* 0x3e */
+ WMI_GRP_MOTION_DET, /* 0x3f */
+ WMI_GRP_SPATIAL_REUSE, /* 0x40 */
};
@@ -541,6 +543,9 @@ enum wmi_tlv_cmd_id {
WMI_TWT_DEL_DIALOG_CMDID,
WMI_TWT_PAUSE_DIALOG_CMDID,
WMI_TWT_RESUME_DIALOG_CMDID,
+ WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID =
+ WMI_TLV_CMD(WMI_GRP_SPATIAL_REUSE),
+ WMI_PDEV_OBSS_PD_SPATIAL_REUSE_SET_DEF_OBSS_THRESH_CMDID,
};
enum wmi_tlv_event_id {
@@ -5114,6 +5119,15 @@ struct wmi_twt_disable_params_cmd {
u32 pdev_id;
};
+struct wmi_obss_spatial_reuse_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+ u32 enable;
+ s32 obss_min;
+ s32 obss_max;
+ u32 vdev_id;
+};
+
struct target_resource_config {
u32 num_vdevs;
u32 num_peers;
@@ -5305,4 +5319,6 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
int ath11k_wmi_simulate_radar(struct ath11k *ar);
int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
+ struct ieee80211_he_obss_pd *he_obss_pd);
#endif
--
2.20.1
^ permalink raw reply related
* [PATCH 6/7] mac80211: propagate spatial reuse info into ieee80211_sta
From: John Crispin @ 2019-05-20 11:02 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Upon a successful assoc a station shall store the content of the SPR
element inside ieee80211_sta so that the driver can setup the hardware
accordingly.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/mac80211.h | 1 +
net/mac80211/he.c | 24 ++++++++++++++++++++++++
net/mac80211/ieee80211_i.h | 4 ++++
net/mac80211/mlme.c | 1 +
4 files changed, 30 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d81eea9140e5..f73a210b122b 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1952,6 +1952,7 @@ struct ieee80211_sta {
struct ieee80211_sta_vht_cap vht_cap;
struct ieee80211_sta_he_cap he_cap;
struct ieee80211_he_operation he_operation;
+ struct ieee80211_he_obss_pd he_obss_pd;
u16 max_rx_aggregation_subframes;
bool wme;
u8 uapsd_queues;
diff --git a/net/mac80211/he.c b/net/mac80211/he.c
index 62ef029e5c48..e41ee4a29257 100644
--- a/net/mac80211/he.c
+++ b/net/mac80211/he.c
@@ -67,3 +67,27 @@ ieee80211_he_op_ie_to_sta_he_op(struct ieee80211_sub_if_data *sdata,
}
memcpy(he_operation, he_op_ie_elem, sizeof(*he_operation));
}
+
+void
+ieee80211_he_spr_ie_to_sta_he_obss_pd(struct ieee80211_sub_if_data *sdata,
+ const struct ieee80211_he_spr *he_spr_ie_elem,
+ struct sta_info *sta)
+{
+ struct ieee80211_he_obss_pd *he_obss_pd = &sta->sta.he_obss_pd;
+ const u8 *data = he_spr_ie_elem->optional;
+
+ memset(he_obss_pd, 0, sizeof(*he_obss_pd));
+
+ if (!he_spr_ie_elem)
+ return;
+
+ if (he_spr_ie_elem->he_sr_control &
+ IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
+ data++;
+ if (he_spr_ie_elem->he_sr_control &
+ IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) {
+ he_obss_pd->max_offset = *data++;
+ he_obss_pd->min_offset = *data++;
+ he_obss_pd->enable = true;
+ }
+}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e931e114fba4..d82469754d34 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1870,6 +1870,10 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_supported_band *sband,
const u8 *he_cap_ie, u8 he_cap_len,
struct sta_info *sta);
+void
+ieee80211_he_spr_ie_to_sta_he_obss_pd(struct ieee80211_sub_if_data *sdata,
+ const struct ieee80211_he_spr *he_spr_ie_elem,
+ struct sta_info *sta);
void
ieee80211_he_op_ie_to_sta_he_op(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 996439a288c0..098335f34aa3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3377,6 +3377,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
bss_conf->uora_ocw_range = elems.uora_element[0];
ieee80211_he_op_ie_to_sta_he_op(sdata, elems.he_operation, sta);
+ ieee80211_he_spr_ie_to_sta_he_obss_pd(sdata, elems.he_spr, sta);
/* TODO: OPEN: what happens if BSS color disable is set? */
}
--
2.20.1
^ permalink raw reply related
* [PATCH 1/7] mac80211: HE: dynamically enable the TWT requester support on STA interfaces
From: John Crispin @ 2019-05-20 11:01 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: ath11k, linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190520110204.27588-1-john@phrozen.org>
Turn TWT for STA interfaces when they associate and/or receive a
beacon where the twt_responder bit has changed.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/mac80211.h | 2 ++
net/mac80211/mlme.c | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ba4a16f87364..689dc597281c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -317,6 +317,7 @@ struct ieee80211_vif_chanctx_switch {
* @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder
* functionality changed for this BSS (AP mode).
+ * @BSS_CHANGED_TWT: TWT status changed
*
*/
enum ieee80211_bss_change {
@@ -347,6 +348,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_KEEP_ALIVE = 1<<24,
BSS_CHANGED_MCAST_RATE = 1<<25,
BSS_CHANGED_FTM_RESPONDER = 1<<26,
+ BSS_CHANGED_TWT = 1<<27,
/* when adding here, make sure to change ieee80211_reconfig */
};
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5d8a8a0feaf9..996439a288c0 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3151,6 +3151,19 @@ static bool ieee80211_twt_req_supported(const struct sta_info *sta,
IEEE80211_HE_MAC_CAP0_TWT_RES;
}
+static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata,
+ struct sta_info *sta,
+ struct ieee802_11_elems *elems)
+{
+ bool twt = ieee80211_twt_req_supported(sta, elems);
+
+ if (sdata->vif.bss_conf.twt_requester != twt) {
+ sdata->vif.bss_conf.twt_requester = twt;
+ return BSS_CHANGED_TWT;
+ }
+ return 0;
+}
+
static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss,
struct ieee80211_mgmt *mgmt, size_t len)
@@ -3333,8 +3346,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
sta);
bss_conf->he_support = sta->sta.he_cap.has_he;
- bss_conf->twt_requester =
- ieee80211_twt_req_supported(sta, &elems);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
} else {
bss_conf->he_support = false;
bss_conf->twt_requester = false;
@@ -3995,6 +4007,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, bssid);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
+
if (ieee80211_config_bw(sdata, sta,
elems.ht_cap_elem, elems.ht_operation,
elems.vht_operation, elems.he_operation,
--
2.20.1
^ permalink raw reply related
* [RFC 2/8] cfg80211: add 6GHz UNII band definitions
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
For the new 6GHz there are new UNII band definitions as listed
in the FCC notice [1].
[1] https://docs.fcc.gov/public/attachments/FCC-18-147A1_Rcd.pdf
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/reg.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4831ad74..646107a 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -3806,8 +3806,9 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy)
}
/*
- * See http://www.fcc.gov/document/5-ghz-unlicensed-spectrum-unii, for
- * UNII band definitions
+ * See FCC notices for UNII band definitions
+ * 5GHz: https://www.fcc.gov/document/5-ghz-unlicensed-spectrum-unii
+ * 6GHz: https://www.fcc.gov/document/fcc-proposes-more-spectrum-unlicensed-use-0
*/
int cfg80211_get_unii(int freq)
{
@@ -3831,6 +3832,22 @@ int cfg80211_get_unii(int freq)
if (freq > 5725 && freq <= 5825)
return 4;
+ /* UNII-5 */
+ if (freq > 5925 && freq <= 6425)
+ return 5;
+
+ /* UNII-6 */
+ if (freq > 6425 && freq <= 6525)
+ return 6;
+
+ /* UNII-7 */
+ if (freq > 6525 && freq <= 6875)
+ return 7;
+
+ /* UNII-8 */
+ if (freq > 6875 && freq <= 7125)
+ return 8;
+
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related
* [RFC 0/8] nl80211: add 6GHz band support
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In 802.11ax D4.0 a new band has been proposed. This series contains
changes to cfg80211 for supporting this band. With 2GHz and 5GHz there
was no overlap in channel number. However, this new band has channel
numbers with a range from 1 up to 253. The only place I could find an
issue with this is in cfg80211_wext_freq(). Not sure how to deal with
that so it is not part of this series.
The series applies to the master branch of the mac80211-next repository.
Arend van Spriel (8):
nl80211: add 6GHz band definition to enum nl80211_band
cfg80211: add 6GHz UNII band definitions
cfg80211: util: add 6GHz channel to freq conversion and vice versa
cfg80211: extend ieee80211_operating_class_to_band() for 6GHz
cfg80211: add 6GHz in code handling array with NUM_NL80211_BANDS
entries
cfg80211: use same IR permissive rules for 6GHz band
cfg80211: ibss: use 11a mandatory rates for 6GHz band operation
cfg80211: apply same mandatory rate flags for 5GHz and 6GHz
include/uapi/linux/nl80211.h | 2 ++
net/wireless/chan.c | 3 ++-
net/wireless/ibss.c | 16 +++++++++++-----
net/wireless/nl80211.c | 1 +
net/wireless/reg.c | 21 +++++++++++++++++++--
net/wireless/trace.h | 3 ++-
net/wireless/util.c | 14 +++++++++++++-
7 files changed, 50 insertions(+), 10 deletions(-)
--
1.9.1
^ permalink raw reply
* [RFC 8/8] cfg80211: apply same mandatory rate flags for 5GHz and 6GHz
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
For the new 6GHz band the same rules apply for mandatory rates so
add it to set_mandatory_flags_band() function.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 03e7176..fd90c86 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -156,6 +156,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
switch (sband->band) {
case NL80211_BAND_5GHZ:
+ case NL80211_BAND_6GHZ:
want = 3;
for (i = 0; i < sband->n_bitrates; i++) {
if (sband->bitrates[i].bitrate == 60 ||
--
1.9.1
^ permalink raw reply related
* [RFC 7/8] cfg80211: ibss: use 11a mandatory rates for 6GHz band operation
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
The default mandatory rates, ie. when not specified by user-space, is
determined by the band. Select 11a rateset for 6GHz band.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/ibss.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index d1743e6..ae8fe66 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -104,13 +104,19 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
* use the mandatory rate set for 11b or
* 11a for maximum compatibility.
*/
- struct ieee80211_supported_band *sband =
- rdev->wiphy.bands[params->chandef.chan->band];
+ struct ieee80211_supported_band *sband;
+ enum nl80211_band band;
+ u32 flag;
int j;
- u32 flag = params->chandef.chan->band == NL80211_BAND_5GHZ ?
- IEEE80211_RATE_MANDATORY_A :
- IEEE80211_RATE_MANDATORY_B;
+ band = params->chandef.chan->band;
+ if (band == NL80211_BAND_5GHZ ||
+ band == NL80211_BAND_6GHZ)
+ flag = IEEE80211_RATE_MANDATORY_A;
+ else
+ flag = IEEE80211_RATE_MANDATORY_B;
+
+ sband = rdev->wiphy.bands[band];
for (j = 0; j < sband->n_bitrates; j++) {
if (sband->bitrates[j].flags & flag)
params->basic_rates |= BIT(j);
--
1.9.1
^ permalink raw reply related
* [RFC 4/8] cfg80211: extend ieee80211_operating_class_to_band() for 6GHz
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
Add 6GHz operating class range as defined in 802.11ax D4.1 Annex E.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/util.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 081637e..03e7176 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1474,6 +1474,9 @@ bool ieee80211_operating_class_to_band(u8 operating_class,
case 128 ... 130:
*band = NL80211_BAND_5GHZ;
return true;
+ case 131 ... 135:
+ *band = NL80211_BAND_6GHZ;
+ return true;
case 81:
case 82:
case 83:
--
1.9.1
^ permalink raw reply related
* [RFC 5/8] cfg80211: add 6GHz in code handling array with NUM_NL80211_BANDS entries
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
In nl80211.c there is a policy for all bands in NUM_NL80211_BANDS and
in trace.h there is a callback trace for multicast rates which is per
band in NUM_NL80211_BANDS. Both need to be extended for the new
NL80211_BAND_6GHZ.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/nl80211.c | 1 +
net/wireless/trace.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fffe4b3..c0224fc 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -627,6 +627,7 @@ static int validate_ie_attr(const struct nlattr *attr,
nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = {
[NL80211_BAND_2GHZ] = { .type = NLA_S32 },
[NL80211_BAND_5GHZ] = { .type = NLA_S32 },
+ [NL80211_BAND_6GHZ] = { .type = NLA_S32 },
[NL80211_BAND_60GHZ] = { .type = NLA_S32 },
};
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 2abfff9..a7f39a8 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2446,10 +2446,11 @@
sizeof(int) * NUM_NL80211_BANDS);
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", "
- "mcast_rates [2.4GHz=0x%x, 5.2GHz=0x%x, 60GHz=0x%x]",
+ "mcast_rates [2.4GHz=0x%x, 5.2GHz=0x%x, 6GHz=0x%x, 60GHz=0x%x]",
WIPHY_PR_ARG, NETDEV_PR_ARG,
__entry->mcast_rate[NL80211_BAND_2GHZ],
__entry->mcast_rate[NL80211_BAND_5GHZ],
+ __entry->mcast_rate[NL80211_BAND_6GHZ],
__entry->mcast_rate[NL80211_BAND_60GHZ])
);
--
1.9.1
^ permalink raw reply related
* [RFC 3/8] cfg80211: util: add 6GHz channel to freq conversion and vice versa
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
Extend the functions ieee80211_channel_to_frequency() and
ieee80211_frequency_to_channel() to support 6GHz band according
specification in 802.11ax D4.1 27.3.22.2.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/util.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index cf63b63..081637e 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -91,6 +91,11 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
else
return 5000 + chan * 5;
break;
+ case NL80211_BAND_6GHZ:
+ /* see 802.11ax D4.1 27.3.22.2 */
+ if (chan <= 253)
+ return 5940 + chan * 5;
+ break;
case NL80211_BAND_60GHZ:
if (chan < 7)
return 56160 + chan * 2160;
@@ -111,8 +116,11 @@ int ieee80211_frequency_to_channel(int freq)
return (freq - 2407) / 5;
else if (freq >= 4910 && freq <= 4980)
return (freq - 4000) / 5;
- else if (freq <= 45000) /* DMG band lower limit */
+ else if (freq < 5940)
return (freq - 5000) / 5;
+ else if (freq <= 45000) /* DMG band lower limit */
+ /* see 802.11ax D4.1 27.3.22.2 */
+ return (freq - 5940) / 5;
else if (freq >= 58320 && freq <= 70200)
return (freq - 56160) / 2160;
else
--
1.9.1
^ permalink raw reply related
* [RFC 1/8] nl80211: add 6GHz band definition to enum nl80211_band
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
In the 802.11ax specification a new band is introduced, which
is also proposed by FCC for unlicensed use. This band is referred
to as 6GHz spanning frequency range from 5925 to 7125 MHz.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
include/uapi/linux/nl80211.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6f09d1500..5ea3c8c 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4515,6 +4515,7 @@ enum nl80211_txrate_gi {
* enum nl80211_band - Frequency band
* @NL80211_BAND_2GHZ: 2.4 GHz ISM band
* @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
+ * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz)
* @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz)
* @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
* since newer kernel versions may support more bands
@@ -4522,6 +4523,7 @@ enum nl80211_txrate_gi {
enum nl80211_band {
NL80211_BAND_2GHZ,
NL80211_BAND_5GHZ,
+ NL80211_BAND_6GHZ,
NL80211_BAND_60GHZ,
NUM_NL80211_BANDS,
--
1.9.1
^ permalink raw reply related
* [RFC 6/8] cfg80211: use same IR permissive rules for 6GHz band
From: Arend van Spriel @ 2019-05-20 12:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Arend van Spriel
In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com>
The function cfg80211_ir_permissive_chan() is applicable for
6GHz band as well so make sure it is handled.
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Leon Zegers <leon.zegers@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
net/wireless/chan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 7dc1bbd..7c9d204 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -894,7 +894,8 @@ static bool cfg80211_ir_permissive_chan(struct wiphy *wiphy,
if (chan == other_chan)
return true;
- if (chan->band != NL80211_BAND_5GHZ)
+ if (chan->band != NL80211_BAND_5GHZ &&
+ chan->band != NL80211_BAND_6GHZ)
continue;
r1 = cfg80211_get_unii(chan->center_freq);
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] wireless: fix typos in code comments
From: Rafał Miłecki @ 2019-05-20 11:53 UTC (permalink / raw)
To: Weitao Hou
Cc: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
wright.feng, kvalo, davem, linux-wireless, brcm80211-dev-list.pdl,
brcm80211-dev-list, netdev, linux-kernel
In-Reply-To: <20190519032256.19346-1-houweitaoo@gmail.com>
On 2019-05-19 05:22, Weitao Hou wrote:
> fix lengh to length
>
> Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Please use:
git log --oneline drivers/net/wireless/broadcom/brcm80211/brcmfmac/
to see how patches for this drivers were subjected in the past.
Please resend V2 with a proper prefix instead of "wireless: ".
^ permalink raw reply
* [PATCH v2] brcmfmac: fix typos in code comments
From: Weitao Hou @ 2019-05-20 12:28 UTC (permalink / raw)
To: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
wright.feng, kvalo, davem, houweitaoo, rafal
Cc: linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
netdev, linux-kernel
fix lengh to length
Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
---
- fix prefix
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
index 8ea27489734e..edd2f09613d8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
@@ -314,7 +314,7 @@ brcmf_create_bsscfg(s32 bsscfgidx, char *name, char *data, u32 datalen,
return brcmf_create_iovar(name, data, datalen, buf, buflen);
prefixlen = strlen(prefix);
- namelen = strlen(name) + 1; /* lengh of iovar name + null */
+ namelen = strlen(name) + 1; /* length of iovar name + null */
iolen = prefixlen + namelen + sizeof(bsscfgidx_le) + datalen;
if (buflen < iolen) {
--
2.18.0
^ permalink raw reply related
* Re: [PATCH v2 1/2] nl80211: Add support for EDMG channels
From: Kalle Valo @ 2019-05-20 13:03 UTC (permalink / raw)
To: Alexei Avshalom Lazar; +Cc: Johannes Berg, linux-wireless, wil6210
In-Reply-To: <1557758554-18907-2-git-send-email-ailizaro@codeaurora.org>
Alexei Avshalom Lazar <ailizaro@codeaurora.org> writes:
> 802.11ay specification defines Enhanced Directional Multi-Gigabit
> (EDMG) STA and AP which allow channel bonding of 2 channels and more.
> Introduce NL80211_ATTR_WIPHY_EDMG_CHANNELS,
> NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, NL80211_BAND_ATTR_EDMG_CHANNELS,
> NL80211_BAND_ATTR_EDMG_BW_CONFIG and RATE_INFO_FLAGS_EDMG
> that needed for enabling and configuring EDMG support.
> Driver is expected to report its EDMG capabilities: whether EDMG
> is supported and the supported EDMG channels.
> Bitrate calculation is enhanced to take into account EDMG support
> according to the 802.11ay specification.
> The kernel uses NL80211_BAND_ATTR_EDMG_CHANNELS and
> NL80211_BAND_ATTR_EDMG_BW_CONFIG attributes in order to publish
> the EDMG capabilities to the userspace.
> NL80211_BAND_ATTR_EDMG_CHANNELS is a bitmap field that indicates
> the 2.16 GHz channel(s) that are allowed to be used for transmissions
> in the BSS.
> If NL80211_BAND_ATTR_EDMG_CHANNELS is not set then EDMG not
> supported. NL80211_BAND_ATTR_EDMG_BW_CONFIG represent the allowed
> channel bandwidth configurations.
> NL80211_ATTR_WIPHY_EDMG_CHANNELS and NL80211_ATTR_WIPHY_EDMG_BW_CONFIG
> will be used by the userspace for AP configuration and connect command.
>
> Change-Id: I534f4a750354a4b0baad28c47dc29afb9cbc36ac
No Change-Id in upstream patches. And please read:
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v2] mac80211: remove warning message
From: Yibo Zhao @ 2019-05-20 13:56 UTC (permalink / raw)
To: Johannes Berg; +Cc: Ben Greear, linux-wireless, ath10k, Zhi Chen
In-Reply-To: <ea87337c24666355059488b42d97ee22711ce7b8.camel@sipsolutions.net>
On 2019-05-15 02:57, Johannes Berg wrote:
> On Tue, 2019-05-14 at 11:54 -0700, Ben Greear wrote:
>>
>> Here is the info I have in my commit that changed this to
>> WARN_ON_ONCE.
>> I never posted it because I had to hack ath10k to get to this state,
>> so maybe
>> this is not a valid case to debug.
>>
>>
>> Maybe Yibo Zhao has a better example.
>>
>> mac80211: don't spam kernel logs when chantx is null.
>>
>> I set up ath10k to be chandef based again in order to test
>> WDS. My WDS stations are not very functional yet, and
>> when ethtool stats are queried, there is a WARN_ON splat
>> generated. Change this to WARN_ON_ONCE so that there is
>> less kernel spam.
>
> I'm totally fine with WARN_ON_ONCE, FWIW.
>
> Sounds like different bugs though. You're talking about WDS here, and
> Yibo was talking about something with AP interfaces prematurely
> accepting frames or so.
Yes, they might be different bugs that hit the same point. Looks like
others found this too many warnings issue as well. Then I believe
WARN_ON_ONCE() seems to be our solution for now.
>
> johannes
--
Yibo
^ permalink raw reply
* [PATCH] network: wireless: p54u: Fix race between disconnect and firmware loading
From: Alan Stern @ 2019-05-20 14:44 UTC (permalink / raw)
To: Christian Lamparter
Cc: syzbot, kvalo, davem, andreyknvl, syzkaller-bugs,
Kernel development list, USB list, linux-wireless, netdev
In-Reply-To: <5014675.0cgHOJIxtM@debian64>
The syzbot fuzzer found a bug in the p54 USB wireless driver. The
issue involves a race between disconnect and the firmware-loader
callback routine, and it has several aspects.
One big problem is that when the firmware can't be loaded, the
callback routine tries to unbind the driver from the USB _device_ (by
calling device_release_driver) instead of from the USB _interface_ to
which it is actually bound (by calling usb_driver_release_interface).
The race involves access to the private data structure. The driver's
disconnect handler waits for a completion that is signalled by the
firmware-loader callback routine. As soon as the completion is
signalled, you have to assume that the private data structure may have
been deallocated by the disconnect handler -- even if the firmware was
loaded without errors. However, the callback routine does access the
private data several times after that point.
Another problem is that, in order to ensure that the USB device
structure hasn't been freed when the callback routine runs, the driver
takes a reference to it. This isn't good enough any more, because now
that the callback routine calls usb_driver_release_interface, it has
to ensure that the interface structure hasn't been freed.
Finally, the driver takes an unnecessary reference to the USB device
structure in the probe function and drops the reference in the
disconnect handler. This extra reference doesn't accomplish anything,
because the USB core already guarantees that a device structure won't
be deallocated while a driver is still bound to any of its interfaces.
To fix these problems, this patch makes the following changes:
Call usb_driver_release_interface() rather than
device_release_driver().
Don't signal the completion until after the important
information has been copied out of the private data structure,
and don't refer to the private data at all thereafter.
Lock udev (the interface's parent) before unbinding the driver
instead of locking udev->parent.
During the firmware loading process, take a reference to the
USB interface instead of the USB device.
Don't take an unnecessary reference to the device during probe
(and then don't drop it during disconnect).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com
CC: <stable@vger.kernel.org>
---
[as1899]
drivers/net/wireless/intersil/p54/p54usb.c | 43 ++++++++++++-----------------
1 file changed, 18 insertions(+), 25 deletions(-)
Index: usb-devel/drivers/net/wireless/intersil/p54/p54usb.c
===================================================================
--- usb-devel.orig/drivers/net/wireless/intersil/p54/p54usb.c
+++ usb-devel/drivers/net/wireless/intersil/p54/p54usb.c
@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb");
MODULE_FIRMWARE("isl3886usb");
MODULE_FIRMWARE("isl3887usb");
+static struct usb_driver p54u_driver;
+
/*
* Note:
*
@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const
{
struct p54u_priv *priv = context;
struct usb_device *udev = priv->udev;
+ struct usb_interface *intf = priv->intf;
int err;
- complete(&priv->fw_wait_load);
if (firmware) {
priv->fw = firmware;
err = p54u_start_ops(priv);
@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(const
dev_err(&udev->dev, "Firmware not found.\n");
}
- if (err) {
- struct device *parent = priv->udev->dev.parent;
-
- dev_err(&udev->dev, "failed to initialize device (%d)\n", err);
-
- if (parent)
- device_lock(parent);
+ complete(&priv->fw_wait_load);
+ /*
+ * At this point p54u_disconnect may have already freed
+ * the "priv" context. Do not use it anymore!
+ */
+ priv = NULL;
- device_release_driver(&udev->dev);
- /*
- * At this point p54u_disconnect has already freed
- * the "priv" context. Do not use it anymore!
- */
- priv = NULL;
+ if (err) {
+ dev_err(&intf->dev, "failed to initialize device (%d)\n", err);
- if (parent)
- device_unlock(parent);
+ usb_lock_device(udev);
+ usb_driver_release_interface(&p54u_driver, intf);
+ usb_unlock_device(udev);
}
- usb_put_dev(udev);
+ usb_put_intf(intf);
}
static int p54u_load_firmware(struct ieee80211_hw *dev,
@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct iee
dev_info(&priv->udev->dev, "Loading firmware file %s\n",
p54u_fwlist[i].fw);
- usb_get_dev(udev);
+ usb_get_intf(intf);
err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw,
device, GFP_KERNEL, priv,
p54u_load_firmware_cb);
if (err) {
dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s "
"(%d)!\n", p54u_fwlist[i].fw, err);
- usb_put_dev(udev);
+ usb_put_intf(intf);
}
return err;
@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interfa
skb_queue_head_init(&priv->rx_queue);
init_usb_anchor(&priv->submitted);
- usb_get_dev(udev);
-
/* really lazy and simple way of figuring out if we're a 3887 */
/* TODO: should just stick the identification in the device table */
i = intf->altsetting->desc.bNumEndpoints;
@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interfa
priv->upload_fw = p54u_upload_firmware_net2280;
}
err = p54u_load_firmware(dev, intf);
- if (err) {
- usb_put_dev(udev);
+ if (err)
p54_free_common(dev);
- }
return err;
}
@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_i
wait_for_completion(&priv->fw_wait_load);
p54_unregister_common(dev);
- usb_put_dev(interface_to_usbdev(intf));
release_firmware(priv->fw);
p54_free_common(dev);
}
^ permalink raw reply
* Re: [PATCH v2 1/2] nl80211: Add support for EDMG channels
From: Alexei Avshalom Lazar @ 2019-05-20 14:50 UTC (permalink / raw)
To: Kalle Valo; +Cc: Johannes Berg, linux-wireless, wil6210
In-Reply-To: <87k1eluvlg.fsf@purkki.adurom.net>
On 5/20/2019 4:03 PM, Kalle Valo wrote:
> Alexei Avshalom Lazar <ailizaro@codeaurora.org> writes:
>
>> 802.11ay specification defines Enhanced Directional Multi-Gigabit
>> (EDMG) STA and AP which allow channel bonding of 2 channels and more.
>> Introduce NL80211_ATTR_WIPHY_EDMG_CHANNELS,
>> NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, NL80211_BAND_ATTR_EDMG_CHANNELS,
>> NL80211_BAND_ATTR_EDMG_BW_CONFIG and RATE_INFO_FLAGS_EDMG
>> that needed for enabling and configuring EDMG support.
>> Driver is expected to report its EDMG capabilities: whether EDMG
>> is supported and the supported EDMG channels.
>> Bitrate calculation is enhanced to take into account EDMG support
>> according to the 802.11ay specification.
>> The kernel uses NL80211_BAND_ATTR_EDMG_CHANNELS and
>> NL80211_BAND_ATTR_EDMG_BW_CONFIG attributes in order to publish
>> the EDMG capabilities to the userspace.
>> NL80211_BAND_ATTR_EDMG_CHANNELS is a bitmap field that indicates
>> the 2.16 GHz channel(s) that are allowed to be used for transmissions
>> in the BSS.
>> If NL80211_BAND_ATTR_EDMG_CHANNELS is not set then EDMG not
>> supported. NL80211_BAND_ATTR_EDMG_BW_CONFIG represent the allowed
>> channel bandwidth configurations.
>> NL80211_ATTR_WIPHY_EDMG_CHANNELS and NL80211_ATTR_WIPHY_EDMG_BW_CONFIG
>> will be used by the userspace for AP configuration and connect command.
>>
>> Change-Id: I534f4a750354a4b0baad28c47dc29afb9cbc36ac
>
> No Change-Id in upstream patches. And please read:
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#signed-off-by_missing
>
Hi Kalle,
Thanks for sharing the Wiki page, I will raise updated patches.
--
Alexei Lazar
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum a
Linux Foundation Collaborative Project
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox