Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1382177
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 02/18] wcn36xx: Pad TIM PVM if needed |
| Date | 2016-04-19 07:10 +0200 |
| Message-ID | <rpw5d-1sU-29@gated-at.bofh.it> (permalink) |
| References | <rpw5b-1sU-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Pontus Fuchs <pontus.fuchs@gmail.com>
The wcn36xx FW expects a fixed size TIM PVM in the beacon template. If
supplied with a shorter than expected PVM it will overwrite the IE
following the TIM.
Squashed with fix from Jason Mobarak <jam@cozybit.com>:
Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing. The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated. Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Jason Mobarak <jam@cozybit.com>
[bjorn: squashed in Jason's fixup]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
Changes since v1:
- Merged in Jason's patch for skipping the padding in mesh mode.
drivers/net/wireless/ath/wcn36xx/hal.h | 3 +++
drivers/net/wireless/ath/wcn36xx/smd.c | 27 +++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h
index d713204f755d..3af16cba3d12 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -54,6 +54,9 @@
/* Default Beacon template size */
#define BEACON_TEMPLATE_SIZE 0x180
+/* Minimum PVM size that the FW expects. See comment in smd.c for details. */
+#define TIM_MIN_PVM_SIZE 6
+
/* Param Change Bitmap sent to HAL */
#define PARAM_BCN_INTERVAL_CHANGED (1 << 0)
#define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index ff3ed2461a69..089a7e445cd6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1375,12 +1375,19 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
u16 p2p_off)
{
struct wcn36xx_hal_send_beacon_req_msg msg_body;
- int ret = 0;
+ int ret = 0, pad, pvm_len;
mutex_lock(&wcn->hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
- msg_body.beacon_length = skb_beacon->len;
+ pvm_len = skb_beacon->data[tim_off + 1] - 3;
+ pad = TIM_MIN_PVM_SIZE - pvm_len;
+
+ /* Padding is irrelevant to mesh mode since tim_off is always 0. */
+ if (vif->type == NL80211_IFTYPE_MESH_POINT)
+ pad = 0;
+
+ msg_body.beacon_length = skb_beacon->len + pad;
/* TODO need to find out why + 6 is needed */
msg_body.beacon_length6 = msg_body.beacon_length + 6;
@@ -1393,6 +1400,22 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
+ if (pad > 0) {
+ /*
+ * The wcn36xx FW has a fixed size for the PVM in the TIM. If
+ * given the beacon template from mac80211 with a PVM shorter
+ * than the FW expectes it will overwrite the data after the
+ * TIM.
+ */
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "Pad TIM PVM. %d bytes at %d\n",
+ pad, pvm_len);
+ memmove(&msg_body.beacon[tim_off + 5 + pvm_len + pad],
+ &msg_body.beacon[tim_off + 5 + pvm_len],
+ skb_beacon->len - (tim_off + 5 + pvm_len));
+ memset(&msg_body.beacon[tim_off + 5 + pvm_len], 0, pad);
+ msg_body.beacon[tim_off + 1] += pad;
+ }
+
/* TODO need to find out why this is needed? */
if (vif->type == NL80211_IFTYPE_MESH_POINT)
/* mesh beacon don't need this, so push further down */
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/18] wcn36xx fixes Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 08/18] wcn36xx: Remove sta pointer in private vif struct Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 11/18] wcn36xx: Use allocated self sta index instead of hard coded Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 09/18] wcn36xx: Parse trigger_ba response properly Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 05/18] wcn36xx: Use define for invalid index and fix typo Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 18/18] wcn36xx: Fill in capability list Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 07/18] wcn36xx: Fetch private sta data from sta entry instead of from vif Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 16/18] wcn36xx: Delete BSS before idling link Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 06/18] wcn36xx: Add helper macros to cast sta to priv Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
Re: [PATCH v3 06/18] wcn36xx: Add helper macros to cast sta to priv Joe Perches <joe@perches.com> - 2016-04-19 10:50 +0200
[PATCH v3 17/18] wcn36xx: Correct remove bss key response encoding Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 10/18] wcn36xx: Copy all members in config_sta v1 conversion Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 14/18] wcn36xx: Implement multicast filtering Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 02/18] wcn36xx: Pad TIM PVM if needed Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 04/18] wcn36xx: Use consistent name for private vif Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 15/18] wcn36xx: Use correct command struct for EXIT_BMPS_REQ Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 01/18] wcn36xx: Clean up wcn36xx_smd_send_beacon Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 12/18] wcn36xx: Clear encrypt_type when deleting bss key Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
[PATCH v3 13/18] wcn36xx: Track association state Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-04-19 07:10 +0200
Re: [PATCH v3 00/18] wcn36xx fixes Kalle Valo <kvalo@codeaurora.org> - 2016-04-25 20:00 +0200
csiph-web