All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc
@ 2019-05-07  6:58 Kalle Valo
  2019-05-07  6:58 ` [PATCH 2/2] ath11k: qmi: fix frame size warnings Kalle Valo
  2019-05-08  9:46 ` [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Kalle Valo @ 2019-05-07  6:58 UTC (permalink / raw)
  To: ath11k

ath11k_dp_rx_update_peer_stats() assumes that struct hal_rx_mon_ppdu_info::ldpc
contains the value enum hal_rx_su_mu_coding but way it was assigned in
ath11k_hal_rx_parse_mon_status_tlv() was completely broken. Fix that using
FIELD_GET().

Fixes GCC warnings:

drivers/net/wireless/ath/ath11k/hal_rx.c:932:45: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
drivers/net/wireless/ath/ath11k/hal_rx.c:985:50: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
drivers/net/wireless/ath/ath11k/hal_rx.c:1026:46: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
drivers/net/wireless/ath/ath11k/hal_rx.c:1110:51: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
drivers/net/wireless/ath/ath11k/hal_rx.c:1131:51: warning: bitwise comparison always evaluates to false [-Wtautological-compare]

Only compile tested and I didn't check if the firmware interface definitions are correct.

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/hal_rx.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireless/ath/ath11k/hal_rx.c
index 2bdb53287d8e..b8a3e8714fff 100644
--- a/drivers/net/wireless/ath/ath11k/hal_rx.c
+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
@@ -928,9 +928,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		ppdu_info->bw = FIELD_GET(HAL_RX_HT_SIG_INFO_INFO0_BW, info0);
 		ppdu_info->is_stbc = FIELD_GET(HAL_RX_HT_SIG_INFO_INFO1_STBC,
 					       info1);
-		ppdu_info->ldpc = (info1 &
-				   HAL_RX_HT_SIG_INFO_INFO1_FEC_CODING) ==
-					HAL_RX_SU_MU_CODING_LDPC;
+		ppdu_info->ldpc = FIELD_GET(HAL_RX_HT_SIG_INFO_INFO1_FEC_CODING, info1);
 		ppdu_info->gi = info1 & HAL_RX_HT_SIG_INFO_INFO1_GI;
 
 		switch (ppdu_info->mcs) {
@@ -981,9 +979,8 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		info0 = __le32_to_cpu(vht_sig->info0);
 		info1 = __le32_to_cpu(vht_sig->info1);
 
-		ppdu_info->ldpc = (info1 &
-				   HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING) ==
-					HAL_RX_SU_MU_CODING_LDPC;
+		ppdu_info->ldpc = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING,
+					    info0);
 		ppdu_info->mcs = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_MCS,
 					   info1);
 		ppdu_info->gi =
@@ -1022,9 +1019,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		ppdu_info->bw =
 			FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW,
 				  info0);
-		ppdu_info->ldpc = (info1 &
-				   HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING) ==
-					HAL_RX_SU_MU_CODING_LDPC;
+		ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING, info0);
 		ppdu_info->is_stbc = info1 &
 				     HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC;
 		ppdu_info->beamformed = info1 &
@@ -1106,9 +1101,8 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		ppdu_info->nss =
 			FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS,
 				  info0) + 1;
-		ppdu_info->ldpc = (info0 &
-				   HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING) ==
-					HAL_RX_SU_MU_CODING_LDPC;
+		ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING,
+					    info0);
 		break;
 	}
 	case HAL_PHYRX_HE_SIG_B2_OFDMA: {
@@ -1126,10 +1120,8 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		ppdu_info->beamformed =
 			info0 &
 			HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF;
-		ppdu_info->ldpc =
-			(info0 &
-			 HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING) ==
-				HAL_RX_SU_MU_CODING_LDPC;
+		ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING,
+					    info0);
 		ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_MU_OFDMA;
 		break;
 	}
-- 
2.7.4


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ath11k: qmi: fix frame size warnings
  2019-05-07  6:58 [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo
@ 2019-05-07  6:58 ` Kalle Valo
  2019-05-08  9:46 ` [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-05-07  6:58 UTC (permalink / raw)
  To: ath11k

GCC warned:

drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_respond_fw_mem_request':
drivers/net/wireless/ath/ath11k/qmi.c:1678:1: warning: the frame size of 1096 bytes is larger than 1024 bytes [-Wframe-larger-than=]
drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_wlanfw_wlan_cfg_send':
drivers/net/wireless/ath/ath11k/qmi.c:2094:1: warning: the frame size of 1136 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Fix that by allocating bigger structures dynamically.  Compile tested only.

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/qmi.c | 67 ++++++++++++++++++++---------------
 1 file changed, 38 insertions(+), 29 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index aca717ca1955..b862fa93bba8 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1624,37 +1624,40 @@ static int ath11k_qmi_fw_ind_register_send(struct ath11k_base *ab)
 
 static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab)
 {
-	struct qmi_wlanfw_respond_mem_req_msg_v01 req;
+	struct qmi_wlanfw_respond_mem_req_msg_v01 *req;
 	struct qmi_wlanfw_respond_mem_resp_msg_v01 resp;
 	struct qmi_txn txn = {};
 	int ret = 0, i;
 
-	memset(&req, 0, sizeof(req));
+	req = kzalloc(sizeof(*req), GFP_KERNEL);
+	if (!req)
+		return -ENOMEM;
+
 	memset(&resp, 0, sizeof(resp));
 
-	req.mem_seg_len = ab->qmi.mem_seg_count;
+	req->mem_seg_len = ab->qmi.mem_seg_count;
 
 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
 			   qmi_wlanfw_respond_mem_resp_msg_v01_ei, &resp);
 	if (ret < 0)
 		goto out;
 
-	for (i = 0; i < req.mem_seg_len ; i++) {
+	for (i = 0; i < req->mem_seg_len ; i++) {
 		if (!ab->qmi.target_mem[i].paddr || !ab->qmi.target_mem[i].size) {
 			ath11k_warn(ab, "qmi invalid mem request for target\n");
 			ret = -EINVAL;
 			goto out;
 		}
 
-		req.mem_seg[i].addr = ab->qmi.target_mem[i].paddr;
-		req.mem_seg[i].size = ab->qmi.target_mem[i].size;
-		req.mem_seg[i].type = ab->qmi.target_mem[i].type;
+		req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr;
+		req->mem_seg[i].size = ab->qmi.target_mem[i].size;
+		req->mem_seg[i].type = ab->qmi.target_mem[i].type;
 	}
 
 	ret = qmi_send_request(&ab->qmi.handle, NULL, &txn,
 			       QMI_WLANFW_RESPOND_MEM_REQ_V01,
 			       QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN,
-			       qmi_wlanfw_respond_mem_req_msg_v01_ei, &req);
+			       qmi_wlanfw_respond_mem_req_msg_v01_ei, req);
 	if (ret < 0) {
 		ath11k_warn(ab, "qmi failed to respond memory request, err = %d\n",
 			    ret);
@@ -1674,6 +1677,7 @@ static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab)
 		goto out;
 	}
 out:
+	kfree(req);
 	return ret;
 }
 
@@ -2021,7 +2025,7 @@ static int ath11k_qmi_wlanfw_mode_send(struct ath11k_base *ab,
 
 static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab)
 {
-	struct qmi_wlanfw_wlan_cfg_req_msg_v01 req;
+	struct qmi_wlanfw_wlan_cfg_req_msg_v01 *req;
 	struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp;
 	struct ce_pipe_config *ce_cfg;
 	struct service_to_pipe *svc_cfg;
@@ -2030,36 +2034,40 @@ static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab)
 
 	ce_cfg	= (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce;
 	svc_cfg	= (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map;
-	memset(&req, 0, sizeof(req));
+
+	req = kzalloc(sizeof(*req), GFP_KERNEL);
+	if (!req)
+		return -ENOMEM;
+
 	memset(&resp, 0, sizeof(resp));
 
-	req.host_version_valid = 1;
-	strlcpy(req.host_version, ATH11K_HOST_VERSION_STRING,
-		sizeof(req.host_version));
+	req->host_version_valid = 1;
+	strlcpy(req->host_version, ATH11K_HOST_VERSION_STRING,
+		sizeof(req->host_version));
 
-	req.tgt_cfg_valid = 1;
+	req->tgt_cfg_valid = 1;
 	/* This is number of CE configs */
-	req.tgt_cfg_len = ((ab->qmi.ce_cfg.tgt_ce_len) /
+	req->tgt_cfg_len = ((ab->qmi.ce_cfg.tgt_ce_len) /
 				(sizeof(struct ce_pipe_config))) - 1;
-	for (ret = 0; ret <= req.tgt_cfg_len ; ret++) {
-		req.tgt_cfg[ret].pipe_num = ce_cfg[ret].pipenum;
-		req.tgt_cfg[ret].pipe_dir = ce_cfg[ret].pipedir;
-		req.tgt_cfg[ret].nentries = ce_cfg[ret].nentries;
-		req.tgt_cfg[ret].nbytes_max = ce_cfg[ret].nbytes_max;
-		req.tgt_cfg[ret].flags = ce_cfg[ret].flags;
+	for (ret = 0; ret <= req->tgt_cfg_len ; ret++) {
+		req->tgt_cfg[ret].pipe_num = ce_cfg[ret].pipenum;
+		req->tgt_cfg[ret].pipe_dir = ce_cfg[ret].pipedir;
+		req->tgt_cfg[ret].nentries = ce_cfg[ret].nentries;
+		req->tgt_cfg[ret].nbytes_max = ce_cfg[ret].nbytes_max;
+		req->tgt_cfg[ret].flags = ce_cfg[ret].flags;
 	}
 
-	req.svc_cfg_valid = 1;
+	req->svc_cfg_valid = 1;
 	/* This is number of Service/CE configs */
-	req.svc_cfg_len = (ab->qmi.ce_cfg.svc_to_ce_map_len) /
+	req->svc_cfg_len = (ab->qmi.ce_cfg.svc_to_ce_map_len) /
 				(sizeof(struct service_to_pipe));
-	for (ret = 0; ret < req.svc_cfg_len; ret++) {
-		req.svc_cfg[ret].service_id = svc_cfg[ret].service_id;
-		req.svc_cfg[ret].pipe_dir = svc_cfg[ret].pipedir;
-		req.svc_cfg[ret].pipe_num = svc_cfg[ret].pipenum;
+	for (ret = 0; ret < req->svc_cfg_len; ret++) {
+		req->svc_cfg[ret].service_id = svc_cfg[ret].service_id;
+		req->svc_cfg[ret].pipe_dir = svc_cfg[ret].pipedir;
+		req->svc_cfg[ret].pipe_num = svc_cfg[ret].pipenum;
 	}
-	req.shadow_reg_valid = 0;
-	req.shadow_reg_v2_valid = 0;
+	req->shadow_reg_valid = 0;
+	req->shadow_reg_v2_valid = 0;
 
 	ret = qmi_txn_init(&ab->qmi.handle, &txn,
 			   qmi_wlanfw_wlan_cfg_resp_msg_v01_ei, &resp);
@@ -2090,6 +2098,7 @@ static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base *ab)
 	}
 
 out:
+	kfree(req);
 	return ret;
 }
 
-- 
2.7.4


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc
  2019-05-07  6:58 [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo
  2019-05-07  6:58 ` [PATCH 2/2] ath11k: qmi: fix frame size warnings Kalle Valo
@ 2019-05-08  9:46 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-05-08  9:46 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k

Kalle Valo <kvalo@codeaurora.org> wrote:

> ath11k_dp_rx_update_peer_stats() assumes that struct hal_rx_mon_ppdu_info::ldpc
> contains the value enum hal_rx_su_mu_coding but way it was assigned in
> ath11k_hal_rx_parse_mon_status_tlv() was completely broken. Fix that using
> FIELD_GET().
> 
> Fixes GCC warnings:
> 
> drivers/net/wireless/ath/ath11k/hal_rx.c:932:45: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
> drivers/net/wireless/ath/ath11k/hal_rx.c:985:50: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
> drivers/net/wireless/ath/ath11k/hal_rx.c:1026:46: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
> drivers/net/wireless/ath/ath11k/hal_rx.c:1110:51: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
> drivers/net/wireless/ath/ath11k/hal_rx.c:1131:51: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
> 
> Only compile tested and I didn't check if the firmware interface definitions are correct.
> 
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

2 patches applied to ath.git, thanks.

2c5fefcb949e ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc
1e3e4fdc27c6 ath11k: qmi: fix frame size warnings

-- 
https://patchwork.kernel.org/patch/10932359/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-08  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07  6:58 [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo
2019-05-07  6:58 ` [PATCH 2/2] ath11k: qmi: fix frame size warnings Kalle Valo
2019-05-08  9:46 ` [PATCH 1/2] ath11k: fix assignment of struct hal_rx_mon_ppdu_info::ldpc Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.