ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] wifi: ath11k: bug fixes in tx offload and stats
@ 2023-03-08 17:47 Pradeep Kumar Chitrapu
  2023-03-08 17:47 ` [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled Pradeep Kumar Chitrapu
  2023-03-08 17:47 ` [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats Pradeep Kumar Chitrapu
  0 siblings, 2 replies; 8+ messages in thread
From: Pradeep Kumar Chitrapu @ 2023-03-08 17:47 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Pradeep Kumar Chitrapu

Fixes bugs in ath11k in peer stats and TX encapsulation offload
cases.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1

Pradeep Kumar Chitrapu (2):
  wifi: ath11k: fix null ptr dereference when tx offload is enabled
  wifi: ath11k: Fix incorrect update of BCC counters in peer stats

 drivers/net/wireless/ath/ath11k/dp_tx.c  | 26 +++++++++++++++++++++---
 drivers/net/wireless/ath/ath11k/hal_rx.c |  4 ++--
 drivers/net/wireless/ath/ath11k/hal_rx.h |  2 +-
 3 files changed, 26 insertions(+), 6 deletions(-)


base-commit: 1a304987a22c9f383f163f93beb47e89080d1cee
-- 
2.17.1


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

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

* [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled
  2023-03-08 17:47 [PATCH 0/2] wifi: ath11k: bug fixes in tx offload and stats Pradeep Kumar Chitrapu
@ 2023-03-08 17:47 ` Pradeep Kumar Chitrapu
  2023-03-08 18:09   ` Felix Fietkau
  2023-03-09  4:02   ` Vasanthakumar Thiagarajan
  2023-03-08 17:47 ` [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats Pradeep Kumar Chitrapu
  1 sibling, 2 replies; 8+ messages in thread
From: Pradeep Kumar Chitrapu @ 2023-03-08 17:47 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Pradeep Kumar Chitrapu

When tx offload is enabled, info->band from skb cb is 0. This
causes null pointer access at mac80211 when sband is accessed.

In offload case, ndo_hard_start will bypass mac80211 tx and no
function will set info->band in skb cb to correct value.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1

Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/dp_tx.c | 26 ++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c
index 8afbba236935..0f3a32434970 100644
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
@@ -320,6 +320,8 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
 	struct ieee80211_tx_info *info;
 	struct ath11k_skb_cb *skb_cb;
 	struct ath11k *ar;
+	struct ieee80211_vif *vif;
+	u8 flags = 0;
 
 	spin_lock(&tx_ring->tx_idr_lock);
 	msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id);
@@ -341,6 +343,14 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
 
 	dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
 
+	if (!skb_cb->vif) {
+		dev_kfree_skb_any(msdu);
+		return;
+	}
+
+	flags = skb_cb->flags;
+	vif = skb_cb->vif;
+
 	memset(&info->status, 0, sizeof(info->status));
 
 	if (ts->acked) {
@@ -354,8 +364,10 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
 			info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
 		}
 	}
-
-	ieee80211_tx_status(ar->hw, msdu);
+	if (flags & ATH11K_SKB_HW_80211_ENCAP)
+		ieee80211_tx_status_8023(ar->hw, vif, msdu);
+	else
+		ieee80211_tx_status(ar->hw, msdu);
 }
 
 static void
@@ -524,6 +536,8 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 	struct ath11k_peer *peer;
 	struct ath11k_sta *arsta;
 	struct rate_info rate;
+	struct ieee80211_vif *vif;
+	u8 flags = 0;
 
 	if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) {
 		/* Must not happen */
@@ -544,6 +558,9 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 		return;
 	}
 
+	flags = skb_cb->flags;
+	vif = skb_cb->vif;
+
 	info = IEEE80211_SKB_CB(msdu);
 	memset(&info->status, 0, sizeof(info->status));
 
@@ -610,7 +627,10 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 
 	spin_unlock_bh(&ab->base_lock);
 
-	ieee80211_tx_status_ext(ar->hw, &status);
+	if (flags & ATH11K_SKB_HW_80211_ENCAP)
+		ieee80211_tx_status_8023(ar->hw, vif, msdu);
+	else
+		ieee80211_tx_status_ext(ar->hw, &status);
 }
 
 static inline void ath11k_dp_tx_status_parse(struct ath11k_base *ab,
-- 
2.17.1


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

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

* [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats
  2023-03-08 17:47 [PATCH 0/2] wifi: ath11k: bug fixes in tx offload and stats Pradeep Kumar Chitrapu
  2023-03-08 17:47 ` [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled Pradeep Kumar Chitrapu
@ 2023-03-08 17:47 ` Pradeep Kumar Chitrapu
  2023-03-09  4:04   ` Vasanthakumar Thiagarajan
  2023-03-15 10:27   ` Kalle Valo
  1 sibling, 2 replies; 8+ messages in thread
From: Pradeep Kumar Chitrapu @ 2023-03-08 17:47 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Pradeep Kumar Chitrapu

Fix typos causing incorrect update of BCC counters in 11ax mode.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1

Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/hal_rx.c | 4 ++--
 drivers/net/wireless/ath/ath11k/hal_rx.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireless/ath/ath11k/hal_rx.c
index 7f39c6fb7408..d462b36c3cb2 100644
--- a/drivers/net/wireless/ath/ath11k/hal_rx.c
+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
@@ -1023,7 +1023,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		info1 = __le32_to_cpu(vht_sig->info1);
 
 		ppdu_info->ldpc = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING,
-					    info0);
+					    info1);
 		ppdu_info->mcs = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_MCS,
 					   info1);
 		gi_setting = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING,
@@ -1446,7 +1446,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
 		 * PHYRX_OTHER_RECEIVE_INFO TLV.
 		 */
 		ppdu_info->rssi_comb =
-			FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB,
+			FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB,
 				  __le32_to_cpu(rssi->info0));
 
 		if (db2dbm) {
diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.h b/drivers/net/wireless/ath/ath11k/hal_rx.h
index f6bae07abfd3..064796935f9c 100644
--- a/drivers/net/wireless/ath/ath11k/hal_rx.h
+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h
@@ -385,7 +385,7 @@ struct hal_rx_he_sig_b2_ofdma_info {
 	__le32 info0;
 } __packed;
 
-#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB	GENMASK(15, 8)
+#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB	GENMASK(15, 8)
 
 #define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20	GENMASK(7, 0)
 
-- 
2.17.1


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

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

* Re: [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled
  2023-03-08 17:47 ` [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled Pradeep Kumar Chitrapu
@ 2023-03-08 18:09   ` Felix Fietkau
  2023-03-09  4:02   ` Vasanthakumar Thiagarajan
  1 sibling, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2023-03-08 18:09 UTC (permalink / raw)
  To: Pradeep Kumar Chitrapu, ath11k; +Cc: linux-wireless

On 08.03.23 18:47, Pradeep Kumar Chitrapu wrote:
> When tx offload is enabled, info->band from skb cb is 0. This
> causes null pointer access at mac80211 when sband is accessed.
> 
> In offload case, ndo_hard_start will bypass mac80211 tx and no
> function will set info->band in skb cb to correct value.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath11k/dp_tx.c | 26 ++++++++++++++++++++++---
>   1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c
> index 8afbba236935..0f3a32434970 100644
> --- a/drivers/net/wireless/ath/ath11k/dp_tx.c
> +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
> @@ -354,8 +364,10 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
>   			info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
>   		}
>   	}
> -
> -	ieee80211_tx_status(ar->hw, msdu);
> +	if (flags & ATH11K_SKB_HW_80211_ENCAP)
> +		ieee80211_tx_status_8023(ar->hw, vif, msdu);
> +	else
> +		ieee80211_tx_status(ar->hw, msdu);
>   }
>   
>   static void
> @@ -610,7 +627,10 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
>   
>   	spin_unlock_bh(&ab->base_lock);
>   
> -	ieee80211_tx_status_ext(ar->hw, &status);
> +	if (flags & ATH11K_SKB_HW_80211_ENCAP)
> +		ieee80211_tx_status_8023(ar->hw, vif, msdu);
> +	else
> +		ieee80211_tx_status_ext(ar->hw, &status);
>   }
>   
>   static inline void ath11k_dp_tx_status_parse(struct ath11k_base *ab,
I think using ieee80211_tx_status_8023 is a bad idea. It is simply a 
wrapper around ieee80211_tx_status_ext which looks up the sta based on 
the MSDU DA. This means it is incompatible with 4-address mode.
If you can have a sta pointer available, it is much better to just use 
ieee80211_tx_status_ext unconditionally.

In fact, I think we should simply remove ieee80211_tx_status_8023.

- Felix

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

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

* Re: [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled
  2023-03-08 17:47 ` [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled Pradeep Kumar Chitrapu
  2023-03-08 18:09   ` Felix Fietkau
@ 2023-03-09  4:02   ` Vasanthakumar Thiagarajan
  1 sibling, 0 replies; 8+ messages in thread
From: Vasanthakumar Thiagarajan @ 2023-03-09  4:02 UTC (permalink / raw)
  To: Pradeep Kumar Chitrapu, ath11k; +Cc: linux-wireless



On 3/8/2023 11:17 PM, Pradeep Kumar Chitrapu wrote:
> When tx offload is enabled, info->band from skb cb is 0. This
> causes null pointer access at mac80211 when sband is accessed.
> 

More specifically tx encap offload instead of tx offload will be clearer.


> In offload case, ndo_hard_start will bypass mac80211 tx and no
> function will set info->band in skb cb to correct value.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath11k/dp_tx.c | 26 ++++++++++++++++++++++---
>   1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c
> index 8afbba236935..0f3a32434970 100644
> --- a/drivers/net/wireless/ath/ath11k/dp_tx.c
> +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
> @@ -320,6 +320,8 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
>   	struct ieee80211_tx_info *info;
>   	struct ath11k_skb_cb *skb_cb;
>   	struct ath11k *ar;
> +	struct ieee80211_vif *vif;
> +	u8 flags = 0;

Is this initialization needed with the way flags is assigned below?

>   
>   	spin_lock(&tx_ring->tx_idr_lock);
>   	msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id);
> @@ -341,6 +343,14 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
>   
>   	dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
>   
> +	if (!skb_cb->vif) {
> +		dev_kfree_skb_any(msdu);
> +		return;
> +	}
> +
> +	flags = skb_cb->flags;
> +	vif = skb_cb->vif;
> +
>   	memset(&info->status, 0, sizeof(info->status));
>   
>   	if (ts->acked) {
> @@ -354,8 +364,10 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab,
>   			info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
>   		}
>   	}
> -
> -	ieee80211_tx_status(ar->hw, msdu);
> +	if (flags & ATH11K_SKB_HW_80211_ENCAP)
> +		ieee80211_tx_status_8023(ar->hw, vif, msdu);
> +	else
> +		ieee80211_tx_status(ar->hw, msdu);
>   }
>   
>   static void
> @@ -524,6 +536,8 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
>   	struct ath11k_peer *peer;
>   	struct ath11k_sta *arsta;
>   	struct rate_info rate;
> +	struct ieee80211_vif *vif;
> +	u8 flags = 0;
>   

Same here on the initialization part.

>   	if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) {
>   		/* Must not happen */
> @@ -544,6 +558,9 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
>   		return;
>   	}
>   
> +	flags = skb_cb->flags;
> +	vif = skb_cb->vif;
> +
>   	info = IEEE80211_SKB_CB(msdu);
>   	memset(&info->status, 0, sizeof(info->status));
>   
> @@ -610,7 +627,10 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
>   
>   	spin_unlock_bh(&ab->base_lock);
>   
> -	ieee80211_tx_status_ext(ar->hw, &status);
> +	if (flags & ATH11K_SKB_HW_80211_ENCAP)
> +		ieee80211_tx_status_8023(ar->hw, vif, msdu);
> +	else
> +		ieee80211_tx_status_ext(ar->hw, &status);
>   }
>   
>   static inline void ath11k_dp_tx_status_parse(struct ath11k_base *ab,


Vasanth

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

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

* Re: [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats
  2023-03-08 17:47 ` [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats Pradeep Kumar Chitrapu
@ 2023-03-09  4:04   ` Vasanthakumar Thiagarajan
  2023-03-15 10:27   ` Kalle Valo
  1 sibling, 0 replies; 8+ messages in thread
From: Vasanthakumar Thiagarajan @ 2023-03-09  4:04 UTC (permalink / raw)
  To: Pradeep Kumar Chitrapu, ath11k; +Cc: linux-wireless



On 3/8/2023 11:17 PM, Pradeep Kumar Chitrapu wrote:
> Fix typos causing incorrect update of BCC counters in 11ax mode.

Not sure all these will come under typos. They seem to be bugs no?

Vasanth

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

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

* Re: [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats
  2023-03-08 17:47 ` [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats Pradeep Kumar Chitrapu
  2023-03-09  4:04   ` Vasanthakumar Thiagarajan
@ 2023-03-15 10:27   ` Kalle Valo
  2023-03-15 16:13     ` Pradeep Kumar Chitrapu
  1 sibling, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2023-03-15 10:27 UTC (permalink / raw)
  To: Pradeep Kumar Chitrapu; +Cc: ath11k, linux-wireless

Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com> writes:

> Fix typos causing incorrect update of BCC counters in 11ax mode.
>
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>

What are BCC counters?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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] 8+ messages in thread

* Re: [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats
  2023-03-15 10:27   ` Kalle Valo
@ 2023-03-15 16:13     ` Pradeep Kumar Chitrapu
  0 siblings, 0 replies; 8+ messages in thread
From: Pradeep Kumar Chitrapu @ 2023-03-15 16:13 UTC (permalink / raw)
  To: Kalle Valo, Vasanthakumar Thiagarajan; +Cc: ath11k, linux-wireless


On 3/15/2023 3:27 AM, Kalle Valo wrote:
> Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com> writes:
>
>> Fix typos causing incorrect update of BCC counters in 11ax mode.
>>
>> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01725-QCAHKSWPL_SILICONZ-1
>>
>> Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
> What are BCC counters?
Thanks Kalle and Vasanth for review..will address the comments in next 
revision.

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

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

end of thread, other threads:[~2023-03-15 16:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 17:47 [PATCH 0/2] wifi: ath11k: bug fixes in tx offload and stats Pradeep Kumar Chitrapu
2023-03-08 17:47 ` [PATCH 1/2] wifi: ath11k: fix null ptr dereference when tx offload is enabled Pradeep Kumar Chitrapu
2023-03-08 18:09   ` Felix Fietkau
2023-03-09  4:02   ` Vasanthakumar Thiagarajan
2023-03-08 17:47 ` [PATCH 2/2] wifi: ath11k: Fix incorrect update of BCC counters in peer stats Pradeep Kumar Chitrapu
2023-03-09  4:04   ` Vasanthakumar Thiagarajan
2023-03-15 10:27   ` Kalle Valo
2023-03-15 16:13     ` Pradeep Kumar Chitrapu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).