Merge "qca-wifi: Support extended multi-vdev restart cmd"
diff --git a/configs/wlan_cfg/ap_wlan_cfg.config b/configs/wlan_cfg/ap_wlan_cfg.config
index b3751f5..3c2d0d3 100644
--- a/configs/wlan_cfg/ap_wlan_cfg.config
+++ b/configs/wlan_cfg/ap_wlan_cfg.config
@@ -22,9 +22,15 @@
 EXTRA_CFLAGS += -DCONFIG_PROCESS_RX_STATUS=0
 EXTRA_CFLAGS += -DCONFIG_PROCESS_TX_STATUS=0
 EXTRA_CFLAGS += -DWLAN_CFG_MAC_PER_TARGET=3
-ifeq ($(strip ${QCA_WIFI_QCA8074_VP}),1)
+ifeq ($(strip ${CONFIG_WIFI_EMULATION_WIFI_3_0}),1)
 EXTRA_CFLAGS += -DWLAN_CFG_NUM_TX_DESC=0x2000
 else
 EXTRA_CFLAGS += -DWLAN_CFG_NUM_TX_DESC=0x320000
 endif
 
+ifdef NO_RX_PKT_HDR_TLV
+#RX_BUFFER_SIZE = 1536 data bytes + 256 RX TLV bytes. We are avoiding
+#128 bytes of RX_PKT_HEADER_TLV.
+EXTRA_CFLAGS += -DRX_DATA_BUFFER_SIZE=1792
+EXTRA_CFLAGS += -DRX_DATA_BUFFER_ALIGNMENT=0
+endif
diff --git a/dp/wifi3.0/dp_tx_capture.c b/dp/wifi3.0/dp_tx_capture.c
index 264b3e1..8d2ac96 100644
--- a/dp/wifi3.0/dp_tx_capture.c
+++ b/dp/wifi3.0/dp_tx_capture.c
@@ -2198,6 +2198,16 @@
 		subtype = 0;
 	}
 
+	switch (ppdu_desc->htt_frame_type) {
+	case HTT_STATS_FTYPE_TIDQ_DATA_SU:
+	case HTT_STATS_FTYPE_TIDQ_DATA_MU:
+		is_sgen_pkt = false;
+	break;
+	default:
+		is_sgen_pkt = true;
+	break;
+	}
+
 	retries_q = &pdev->tx_capture.retries_ctl_mgmt_q[type][subtype];
 get_mgmt_pkt_from_queue:
 	qdf_spin_lock_bh(
@@ -2256,6 +2266,11 @@
 				}
 			}
 
+			/*
+			 * only for the packets send over the air are handled
+			 * packets drop by firmware is not handled in this
+			 * feature
+			 */
 			if (ppdu_desc->user[0].completion_status ==
 			    HTT_PPDU_STATS_USER_STATUS_FILTERED) {
 				qdf_nbuf_free(nbuf_ppdu_desc);
@@ -2286,6 +2301,11 @@
 			uint16_t frame_ctrl_le;
 			struct ieee80211_frame *wh;
 
+			/*
+			 * only for the packets send over the air are handled
+			 * packets drop by firmware is not handled in this
+			 * feature
+			 */
 			if (ppdu_desc->user[0].completion_status ==
 			    HTT_PPDU_STATS_USER_STATUS_FILTERED) {
 				qdf_nbuf_free(nbuf_ppdu_desc);
@@ -2372,10 +2392,32 @@
 						   &tx_capture_info,
 						   mgmt_ctl_nbuf, true);
 		}
+	} else if (!is_sgen_pkt) {
+		/*
+		 * only for the packets send over the air are handled
+		 * packets drop by firmware is not handled in this
+		 * feature
+		 */
+		if (ppdu_desc->user[0].completion_status ==
+		    HTT_PPDU_STATS_USER_STATUS_FILTERED) {
+			qdf_nbuf_free(nbuf_ppdu_desc);
+			status = 0;
+			goto free_ppdu_desc;
+		}
+		/*
+		 * add the ppdu_desc into retry queue
+		 */
+		qdf_nbuf_queue_add(retries_q, nbuf_ppdu_desc);
+		status = 0;
 	} else if ((ppdu_desc->frame_ctrl &
 		   IEEE80211_FC0_TYPE_MASK) ==
 		   IEEE80211_FC0_TYPE_CTL) {
 
+		/*
+		 * only for the packets send over the air are handled
+		 * packets drop by firmware is not handled in this
+		 * feature
+		 */
 		if (ppdu_desc->user[0].completion_status ==
 		    HTT_PPDU_STATS_USER_STATUS_FILTERED) {
 			qdf_nbuf_free(nbuf_ppdu_desc);
@@ -3113,6 +3155,8 @@
 		mpdu_info->preamble = DOT11_B;
 	else
 		mpdu_info->preamble = DOT11_A;
+
+	mpdu_info->mcs = CDP_LEGACY_MCS3;
 }
 
 static void dp_gen_ack_frame(struct hal_rx_ppdu_info *ppdu_info,
@@ -3144,13 +3188,36 @@
 
 static void dp_gen_block_ack_frame(
 	struct mon_rx_user_status *rx_user_status,
+	struct mon_rx_user_info *rx_user_info,
 	struct dp_peer *peer,
 	qdf_nbuf_t mpdu_nbuf)
 {
 	struct dp_vdev *vdev = NULL;
+	uint32_t tid;
+	struct dp_tx_tid *tx_tid;
 	struct ieee80211_ctlframe_addr2 *wh_addr2;
 	uint8_t *frm;
 
+	tid = rx_user_status->tid;
+	tx_tid = &peer->tx_capture.tx_tid[tid];
+	if (!rx_user_info->bar_frame) {
+		tx_tid->first_data_seq_ctrl =
+			rx_user_status->first_data_seq_ctrl;
+		tx_tid->mpdu_cnt = rx_user_status->mpdu_cnt_fcs_ok +
+			rx_user_status->mpdu_cnt_fcs_err;
+		if (tx_tid->mpdu_cnt > DP_MAX_MPDU_64)
+			qdf_mem_copy(tx_tid->mpdu_fcs_ok_bitmap,
+				     rx_user_status->mpdu_fcs_ok_bitmap,
+				     HAL_RX_NUM_WORDS_PER_PPDU_BITMAP * sizeof(
+				     rx_user_status->mpdu_fcs_ok_bitmap[0]));
+		else
+			qdf_mem_copy(tx_tid->mpdu_fcs_ok_bitmap,
+				     rx_user_status->mpdu_fcs_ok_bitmap,
+				     DP_NUM_WORDS_PER_PPDU_BITMAP_64 * sizeof(
+				     rx_user_status->mpdu_fcs_ok_bitmap[0]));
+	}
+
+
 	wh_addr2 = (struct ieee80211_ctlframe_addr2 *)
 			qdf_nbuf_data(mpdu_nbuf);
 
@@ -3177,19 +3244,17 @@
 		DP_IEEE80211_BAR_CTL_COMBA);
 	frm += 2;
 	*((uint16_t *)frm) =
-		rx_user_status->first_data_seq_ctrl;
+		tx_tid->first_data_seq_ctrl;
 	frm += 2;
-	if ((rx_user_status->mpdu_cnt_fcs_ok +
-		rx_user_status->mpdu_cnt_fcs_err)
-		> DP_MAX_MPDU_64) {
+	if (tx_tid->mpdu_cnt > DP_MAX_MPDU_64) {
 		qdf_mem_copy(frm,
-			     rx_user_status->mpdu_fcs_ok_bitmap,
+			     tx_tid->mpdu_fcs_ok_bitmap,
 			     HAL_RX_NUM_WORDS_PER_PPDU_BITMAP *
 			     sizeof(rx_user_status->mpdu_fcs_ok_bitmap[0]));
 		frm += DP_NUM_BYTES_PER_PPDU_BITMAP;
 	} else {
 		qdf_mem_copy(frm,
-			     rx_user_status->mpdu_fcs_ok_bitmap,
+			     tx_tid->mpdu_fcs_ok_bitmap,
 			     DP_NUM_WORDS_PER_PPDU_BITMAP_64 *
 			     sizeof(rx_user_status->mpdu_fcs_ok_bitmap[0]));
 		frm += DP_NUM_BYTES_PER_PPDU_BITMAP_64;
@@ -3217,8 +3282,10 @@
 	uint32_t peer_id;
 	struct mon_rx_status *rx_status;
 	struct mon_rx_user_status *rx_user_status;
+	struct mon_rx_user_info *rx_user_info;
 	uint32_t ast_index;
 	uint32_t i;
+	bool bar_frame;
 
 	rx_status = &ppdu_info->rx_status;
 
@@ -3229,11 +3296,30 @@
 	    HAL_MPDU_SW_FRAME_GROUP_MGMT_BEACON)
 		return QDF_STATUS_SUCCESS;
 
+	if (ppdu_info->sw_frame_group_id == HAL_MPDU_SW_FRAME_GROUP_MGMT_PROBE_REQ &&
+	    (ppdu_info->rx_info.mac_addr1[0] & 1)) {
+		return QDF_STATUS_SUCCESS;
+	}
+
+	if (ppdu_info->sw_frame_group_id == HAL_MPDU_SW_FRAME_GROUP_CTRL_BAR)
+		bar_frame = true;
+	else
+		bar_frame = false;
+
 	for (i = 0; i < ppdu_info->com_info.num_users; i++) {
 		if (i > OFDMA_NUM_USERS)
 			return QDF_STATUS_E_FAULT;
 
 		rx_user_status =  &ppdu_info->rx_user_status[i];
+		rx_user_info = &ppdu_info->rx_user_info[i];
+
+		rx_user_info->bar_frame = bar_frame;
+
+		if (rx_user_info->qos_control_info_valid &&
+		    ((rx_user_info->qos_control &
+		    IEEE80211_QOS_ACKPOLICY) >> IEEE80211_QOS_ACKPOLICY_S)
+		    == IEEE80211_BAR_CTL_NOACK)
+			continue;
 
 		ast_index = rx_user_status->ast_index;
 		if (ast_index >=
@@ -3296,9 +3382,11 @@
 			return QDF_STATUS_E_NOMEM;
 		}
 
-		if (rx_status->rs_flags & IEEE80211_AMPDU_FLAG) {
-			dp_gen_block_ack_frame(
-					       rx_user_status, peer,
+		if (peer->rx_tid[rx_user_status->tid].ba_status ==
+		     DP_RX_BA_ACTIVE) {
+			dp_gen_block_ack_frame(rx_user_status,
+					       rx_user_info,
+					       peer,
 					       tx_capture_info.mpdu_nbuf);
 			tx_capture_info.mpdu_info.tid = rx_user_status->tid;
 
diff --git a/dp/wifi3.0/dp_tx_capture.h b/dp/wifi3.0/dp_tx_capture.h
index 605c42e..6f85eaf 100644
--- a/dp/wifi3.0/dp_tx_capture.h
+++ b/dp/wifi3.0/dp_tx_capture.h
@@ -73,6 +73,9 @@
 	qdf_nbuf_queue_t msdu_comp_q;
 	qdf_nbuf_queue_t pending_ppdu_q;
 	struct cdp_tx_completion_ppdu xretry_ppdu;
+	uint16_t first_data_seq_ctrl;
+	uint32_t mpdu_cnt;
+	uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS];
 };
 
 struct dp_peer_tx_capture {
diff --git a/umac/dfs/core/src/misc/dfs_zero_cac.c b/umac/dfs/core/src/misc/dfs_zero_cac.c
index 5671466..02dd68f 100644
--- a/umac/dfs/core/src/misc/dfs_zero_cac.c
+++ b/umac/dfs/core/src/misc/dfs_zero_cac.c
@@ -4599,6 +4599,7 @@
  * dfs_get_precac_intermediate_chan() - Get interCAC channel.
  * @dfs: Pointer to wlan_dfs.
  */
+#ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
 #ifdef CONFIG_CHAN_FREQ_API
 uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs)
 {
@@ -4612,6 +4613,7 @@
 }
 #endif
 #endif
+#endif
 
 #ifdef QCA_SUPPORT_AGILE_DFS
 void dfs_reset_agile_config(struct dfs_soc_priv_obj *dfs_soc)