Browse Source

qcacld-3.0: Fill correct 802.11hdr in rx data pkts in pkt capture mode

All msdu's which are received in single mpdu will have same 802.11
header. Hardware fills header of only first msdu. So copy the
first msdu's header to all msdu's which are received in single
msdu in packet capture mode.

Change-Id: I1c9fd55e571eda77be0ab0863e03cd61b848b842
CRs-Fixed: 2968770
Surabhi Vishnoi 3 years ago
parent
commit
60cebbb9e9
1 changed files with 19 additions and 2 deletions
  1. 19 2
      components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c

+ 19 - 2
components/pkt_capture/core/src/wlan_pkt_capture_data_txrx.c

@@ -419,6 +419,7 @@ pkt_capture_rx_convert8023to80211(hal_soc_handle_t hal_soc_hdl,
 	uint8_t *pwh;
 	uint8_t hdsize, new_hdsize;
 	struct ieee80211_qoscntl *qos_cntl;
+	static uint8_t first_msdu_hdr[sizeof(struct ieee80211_frame)];
 	uint8_t localbuf[sizeof(struct ieee80211_qosframe_htc_addr4) +
 			sizeof(struct llc_snap_hdr_t)];
 	const uint8_t ethernet_II_llc_snap_header_prefix[] = {
@@ -429,13 +430,29 @@ pkt_capture_rx_convert8023to80211(hal_soc_handle_t hal_soc_hdl,
 
 	eth_hdr = (struct ethernet_hdr_t *)qdf_nbuf_data(msdu);
 	hdsize = sizeof(struct ethernet_hdr_t);
-	pwh = hal_rx_desc_get_80211_hdr(hal_soc_hdl, desc);
 
 	wh = (struct ieee80211_frame *)localbuf;
 
 	new_hdsize = sizeof(struct ieee80211_frame);
 
-	qdf_mem_copy(localbuf, pwh, new_hdsize);
+	/*
+	 * Only first msdu in mpdu has rx_tlv_hdr(802.11 hdr) filled by HW, so
+	 * copy the 802.11 hdr to all other msdu's which are received in
+	 * single mpdu from first msdu.
+	 */
+	if (qdf_nbuf_is_rx_chfrag_start(msdu)) {
+		pwh = HAL_RX_DESC_GET_80211_HDR(desc);
+		qdf_mem_copy(first_msdu_hdr, pwh,
+			     sizeof(struct ieee80211_frame));
+	}
+
+	qdf_mem_copy(localbuf, first_msdu_hdr, new_hdsize);
+
+	/* Flush the cached 802.11 hdr once last msdu in mpdu is received */
+	if (qdf_nbuf_is_rx_chfrag_end(msdu))
+		qdf_mem_zero(first_msdu_hdr, sizeof(struct ieee80211_frame));
+
+	wh->i_fc[0] |= IEEE80211_FC0_TYPE_DATA;
 	wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
 
 	if (wh->i_fc[0] & QDF_IEEE80211_FC0_SUBTYPE_QOS) {