diff mbox series

[v7,07/12] wifi: mwifiex: fixed TLV error for station add cmd.

Message ID 20231128083115.613235-8-yu-hao.lin@nxp.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: mwifiex: added code to support host mlme. | expand

Commit Message

David Lin Nov. 28, 2023, 8:31 a.m. UTC
TLV commands setting for host command HostCmd_CMD_ADD_NEW_STATION is
not correct. This issue will set wrong station information to firmware.

Without this patch, transmission will get 50-70% low throughput for host
mlme AP mode.

Signed-off-by: David Lin <yu-hao.lin@nxp.com>
---
 .../net/wireless/marvell/mwifiex/uap_cmd.c    | 52 +++++++++----------
 1 file changed, 25 insertions(+), 27 deletions(-)

Comments

Francesco Dolcini Dec. 1, 2023, 10:36 a.m. UTC | #1
On Tue, Nov 28, 2023 at 04:31:10PM +0800, David Lin wrote:
> TLV commands setting for host command HostCmd_CMD_ADD_NEW_STATION is
> not correct. This issue will set wrong station information to firmware.
> 
> Without this patch, transmission will get 50-70% low throughput for host
> mlme AP mode.

Is this an issue affecting also the existing code, or it depends on the
host MLE one?

From the commit message to me it looks like it should be a dedicated and
separated patch, therefore should probably be before the other patch (or
maybe even a separated one, maybe is easier to get it done this way?)

Francesco
David Lin Dec. 1, 2023, 10:52 p.m. UTC | #2
> From: Francesco Dolcini <francesco@dolcini.it>
> Sent: Friday, December 1, 2023 6:37 PM
> To: David Lin <yu-hao.lin@nxp.com>
> Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> briannorris@chromium.org; kvalo@kernel.org; francesco@dolcini.it; Pete
> Hsieh <tsung-hsien.hsieh@nxp.com>
> Subject: [EXT] Re: [PATCH v7 07/12] wifi: mwifiex: fixed TLV error for station
> add cmd.
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On Tue, Nov 28, 2023 at 04:31:10PM +0800, David Lin wrote:
> > TLV commands setting for host command
> HostCmd_CMD_ADD_NEW_STATION is
> > not correct. This issue will set wrong station information to firmware.
> >
> > Without this patch, transmission will get 50-70% low throughput for
> > host mlme AP mode.
> 
> Is this an issue affecting also the existing code, or it depends on the host
> MLE one?

This is related to host mlme for AP mode.

> 
> From the commit message to me it looks like it should be a dedicated and
> separated patch, therefore should probably be before the other patch (or
> maybe even a separated one, maybe is easier to get it done this way?)

No, this patch is related to host mlme. It won't affect original existed code.
> 
> Francesco
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index c1133da28bc6..eb7e39146b8a 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -809,7 +809,7 @@  static int mwifiex_cmd_uap_add_station(struct mwifiex_private *priv,
 	u8 qos_capa;
 	u16 header_len = sizeof(struct mwifiex_ie_types_header);
 	u16 tlv_len;
-	struct mwifiex_ie_types_header *tlv;
+	struct mwifiex_ie_types_data *tlv;
 	struct mwifiex_ie_types_sta_flag *sta_flag;
 	int i;
 
@@ -846,45 +846,44 @@  static int mwifiex_cmd_uap_add_station(struct mwifiex_private *priv,
 	cmd->size += sizeof(struct mwifiex_ie_types_sta_flag);
 
 	if (params->ext_capab_len) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY);
 		tlv_len = params->ext_capab_len;
-		tlv->len = cpu_to_le16(tlv_len);
-		memcpy(tlv + header_len, params->ext_capab, tlv_len);
+		tlv->header.len = cpu_to_le16(tlv_len);
+		memcpy(tlv->data, params->ext_capab, tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);
 	}
 
 	if (params->link_sta_params.supported_rates_len) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_SUPP_RATES);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_SUPP_RATES);
 		tlv_len = params->link_sta_params.supported_rates_len;
-		tlv->len = cpu_to_le16(tlv_len);
-		memcpy(tlv + header_len,
+		tlv->header.len = cpu_to_le16(tlv_len);
+		memcpy(tlv->data,
 		       params->link_sta_params.supported_rates, tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);
 	}
 
 	if (params->uapsd_queues || params->max_sp) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_QOS_CAPA);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_QOS_CAPA);
 		tlv_len = sizeof(qos_capa);
-		tlv->len = cpu_to_le16(tlv_len);
+		tlv->header.len = cpu_to_le16(tlv_len);
 		qos_capa = params->uapsd_queues | (params->max_sp << 5);
-		memcpy(tlv + header_len, &qos_capa, tlv_len);
+		memcpy(tlv->data, &qos_capa, tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);
 		sta_ptr->is_wmm_enabled = 1;
 	}
 
 	if (params->link_sta_params.ht_capa) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_HT_CAPABILITY);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY);
 		tlv_len = sizeof(struct ieee80211_ht_cap);
-		tlv->len = cpu_to_le16(tlv_len);
-		memcpy(tlv + header_len, params->link_sta_params.ht_capa,
-		       tlv_len);
+		tlv->header.len = cpu_to_le16(tlv_len);
+		memcpy(tlv->data, params->link_sta_params.ht_capa, tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);
 		sta_ptr->is_11n_enabled = 1;
@@ -896,23 +895,22 @@  static int mwifiex_cmd_uap_add_station(struct mwifiex_private *priv,
 	}
 
 	if (params->link_sta_params.vht_capa) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY);
 		tlv_len = sizeof(struct ieee80211_vht_cap);
-		tlv->len = cpu_to_le16(tlv_len);
-		memcpy(tlv + header_len, params->link_sta_params.vht_capa,
-		       tlv_len);
+		tlv->header.len = cpu_to_le16(tlv_len);
+		memcpy(tlv->data, params->link_sta_params.vht_capa, tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);
 		sta_ptr->is_11ac_enabled = 1;
 	}
 
 	if (params->link_sta_params.opmode_notif_used) {
-		tlv = (struct mwifiex_ie_types_header *)pos;
-		tlv->type = cpu_to_le16(WLAN_EID_OPMODE_NOTIF);
+		tlv = (struct mwifiex_ie_types_data *)pos;
+		tlv->header.type = cpu_to_le16(WLAN_EID_OPMODE_NOTIF);
 		tlv_len = sizeof(u8);
-		tlv->len = cpu_to_le16(tlv_len);
-		memcpy(tlv + header_len, params->link_sta_params.opmode_notif,
+		tlv->header.len = cpu_to_le16(tlv_len);
+		memcpy(tlv->data, params->link_sta_params.opmode_notif,
 		       tlv_len);
 		pos += (header_len + tlv_len);
 		cmd->size += (header_len + tlv_len);