Browse Source

qcacld-3.0: Featurize DSRC(802.11p) implementation

Featurize DSRC(802.11p) implementation

Change-Id: I64baee9d26b2300b7a7282ad2eff031c0b02b0b2
CRs-Fixed: 2287352
Nirav Shah 6 years ago
parent
commit
575282cd60
5 changed files with 150 additions and 109 deletions
  1. 13 2
      core/dp/htt/htt_tx.c
  2. 121 107
      core/dp/txrx/ol_rx.c
  3. 8 0
      core/dp/txrx/ol_tx_hl.c
  4. 6 0
      core/dp/txrx/ol_txrx.c
  5. 2 0
      core/sme/src/common/sme_api.c

+ 13 - 2
core/dp/htt/htt_tx.c

@@ -1568,10 +1568,12 @@ int htt_get_channel_freq(enum extension_header_type type,
  *
  * Return: none
  */
+#ifdef WLAN_FEATURE_DSRC
 static
 void htt_fill_ocb_ext_header(qdf_nbuf_t msdu,
-	struct htt_tx_msdu_desc_ext_t *local_desc_ext,
-	enum extension_header_type type, void *ext_header_data)
+			     struct htt_tx_msdu_desc_ext_t *local_desc_ext,
+			     enum extension_header_type type,
+			     void *ext_header_data)
 {
 	struct ocb_tx_ctrl_hdr_t *tx_ctrl =
 		(struct ocb_tx_ctrl_hdr_t *)ext_header_data;
@@ -1606,6 +1608,15 @@ void htt_fill_ocb_ext_header(qdf_nbuf_t msdu,
 			sizeof(struct htt_tx_msdu_desc_ext_t));
 	QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_EXT_HEADER(msdu) = 1;
 }
+#else
+static
+void htt_fill_ocb_ext_header(qdf_nbuf_t msdu,
+			     struct htt_tx_msdu_desc_ext_t *local_desc_ext,
+			     enum extension_header_type type,
+			     void *ext_header_data)
+{
+}
+#endif
 
 /**
  * htt_fill_wisa_ext_header() - fill WiSA extension header

+ 121 - 107
core/dp/txrx/ol_rx.c

@@ -471,12 +471,42 @@ static void process_reorder(ol_txrx_pdev_handle pdev,
 	}
 } /* process_reorder */
 
+#ifdef WLAN_FEATURE_DSRC
+static void
+ol_rx_ocb_update_peer(ol_txrx_pdev_handle pdev, qdf_nbuf_t rx_ind_msg,
+		      struct ol_txrx_peer_t *peer)
+{
+	int i;
+
+	htt_rx_ind_legacy_rate(pdev->htt_pdev, rx_ind_msg,
+			       &peer->last_pkt_legacy_rate,
+			       &peer->last_pkt_legacy_rate_sel);
+	peer->last_pkt_rssi_cmb = htt_rx_ind_rssi_dbm(
+				pdev->htt_pdev, rx_ind_msg);
+	for (i = 0; i < 4; i++)
+		peer->last_pkt_rssi[i] =
+		    htt_rx_ind_rssi_dbm_chain(pdev->htt_pdev, rx_ind_msg, i);
+
+	htt_rx_ind_timestamp(pdev->htt_pdev, rx_ind_msg,
+			     &peer->last_pkt_timestamp_microsec,
+			     &peer->last_pkt_timestamp_submicrosec);
+	peer->last_pkt_tsf = htt_rx_ind_tsf32(pdev->htt_pdev, rx_ind_msg);
+	peer->last_pkt_tid = htt_rx_ind_ext_tid(pdev->htt_pdev, rx_ind_msg);
+}
+#else
+static void
+ol_rx_ocb_update_peer(ol_txrx_pdev_handle pdev, qdf_nbuf_t rx_ind_msg,
+		      struct ol_txrx_peer_t *peer)
+{
+}
+#endif
+
 void
 ol_rx_indication_handler(ol_txrx_pdev_handle pdev,
 			 qdf_nbuf_t rx_ind_msg,
 			 uint16_t peer_id, uint8_t tid, int num_mpdu_ranges)
 {
-	int mpdu_range, i;
+	int mpdu_range;
 	unsigned int seq_num_start = 0, seq_num_end = 0;
 	bool rx_ind_release = false;
 	struct ol_txrx_vdev_t *vdev = NULL;
@@ -504,24 +534,8 @@ ol_rx_indication_handler(ol_txrx_pdev_handle pdev,
 		vdev = peer->vdev;
 		ol_rx_ind_rssi_update(peer, rx_ind_msg);
 
-		if (vdev->opmode == wlan_op_mode_ocb) {
-			htt_rx_ind_legacy_rate(pdev->htt_pdev, rx_ind_msg,
-				       &peer->last_pkt_legacy_rate,
-				       &peer->last_pkt_legacy_rate_sel);
-			peer->last_pkt_rssi_cmb = htt_rx_ind_rssi_dbm(
-				pdev->htt_pdev, rx_ind_msg);
-			for (i = 0; i < 4; i++)
-				peer->last_pkt_rssi[i] =
-					htt_rx_ind_rssi_dbm_chain(
-					pdev->htt_pdev, rx_ind_msg, i);
-			htt_rx_ind_timestamp(pdev->htt_pdev, rx_ind_msg,
-					&peer->last_pkt_timestamp_microsec,
-					&peer->last_pkt_timestamp_submicrosec);
-			peer->last_pkt_tsf = htt_rx_ind_tsf32(pdev->htt_pdev,
-							      rx_ind_msg);
-			peer->last_pkt_tid = htt_rx_ind_ext_tid(pdev->htt_pdev,
-								rx_ind_msg);
-		}
+		if (vdev->opmode == wlan_op_mode_ocb)
+			ol_rx_ocb_update_peer(pdev, rx_ind_msg, peer);
 	}
 
 	TXRX_STATS_INCR(pdev, priv.rx.normal.ppdus);
@@ -1187,6 +1201,91 @@ static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
 }
 #endif
 
+#ifdef WLAN_FEATURE_DSRC
+static inline
+void ol_rx_ocb_prepare_rx_stats_header(struct ol_txrx_vdev_t *vdev,
+				       struct ol_txrx_peer_t *peer,
+				       qdf_nbuf_t msdu)
+{
+	int i;
+	struct ol_txrx_ocb_chan_info *chan_info = 0;
+	int packet_freq = peer->last_pkt_center_freq;
+
+	for (i = 0; i < vdev->ocb_channel_count; i++) {
+		if (vdev->ocb_channel_info[i].chan_freq == packet_freq) {
+			chan_info = &vdev->ocb_channel_info[i];
+			break;
+		}
+	}
+
+	if (!chan_info || !chan_info->disable_rx_stats_hdr) {
+		struct ether_header eth_header = { {0} };
+		struct ocb_rx_stats_hdr_t rx_header = {0};
+
+		/*
+		 * Construct the RX stats header and
+		 * push that to the frontof the packet.
+		 */
+		rx_header.version = 1;
+		rx_header.length = sizeof(rx_header);
+		rx_header.channel_freq = peer->last_pkt_center_freq;
+		rx_header.rssi_cmb = peer->last_pkt_rssi_cmb;
+		qdf_mem_copy(rx_header.rssi, peer->last_pkt_rssi,
+			     sizeof(rx_header.rssi));
+
+		if (peer->last_pkt_legacy_rate_sel)
+			rx_header.datarate = 0xFF;
+		else if (peer->last_pkt_legacy_rate == 0x8)
+			rx_header.datarate = 6;
+		else if (peer->last_pkt_legacy_rate == 0x9)
+			rx_header.datarate = 4;
+		else if (peer->last_pkt_legacy_rate == 0xA)
+			rx_header.datarate = 2;
+		else if (peer->last_pkt_legacy_rate == 0xB)
+			rx_header.datarate = 0;
+		else if (peer->last_pkt_legacy_rate == 0xC)
+			rx_header.datarate = 7;
+		else if (peer->last_pkt_legacy_rate == 0xD)
+			rx_header.datarate = 5;
+		else if (peer->last_pkt_legacy_rate == 0xE)
+			rx_header.datarate = 3;
+		else if (peer->last_pkt_legacy_rate == 0xF)
+			rx_header.datarate = 1;
+		else
+			rx_header.datarate = 0xFF;
+
+		rx_header.timestamp_microsec =
+			 peer->last_pkt_timestamp_microsec;
+		rx_header.timestamp_submicrosec =
+			 peer->last_pkt_timestamp_submicrosec;
+		rx_header.tsf32 = peer->last_pkt_tsf;
+		rx_header.ext_tid = peer->last_pkt_tid;
+
+		qdf_nbuf_push_head(msdu, sizeof(rx_header));
+		qdf_mem_copy(qdf_nbuf_data(msdu),
+			     &rx_header, sizeof(rx_header));
+
+		/*
+		 * Construct the ethernet header with
+		 * type 0x8152 and push that to the
+		 * front of the packet to indicate the
+		 * RX stats header.
+		 */
+		eth_header.ether_type = QDF_SWAP_U16(ETHERTYPE_OCB_RX);
+		qdf_nbuf_push_head(msdu, sizeof(eth_header));
+		qdf_mem_copy(qdf_nbuf_data(msdu), &eth_header,
+			     sizeof(eth_header));
+	}
+}
+#else
+static inline
+void ol_rx_ocb_prepare_rx_stats_header(struct ol_txrx_vdev_t *vdev,
+				       struct ol_txrx_peer_t *peer,
+				       qdf_nbuf_t msdu)
+{
+}
+#endif
+
 #ifdef WLAN_PARTIAL_REORDER_OFFLOAD
 void
 ol_rx_deliver(struct ol_txrx_vdev_t *vdev,
@@ -1276,95 +1375,10 @@ DONE:
 			 *  If this is for OCB,
 			 *  then prepend the RX stats header.
 			 */
-			if (vdev->opmode == wlan_op_mode_ocb) {
-				int i;
-				struct ol_txrx_ocb_chan_info *chan_info = 0;
-				int packet_freq = peer->last_pkt_center_freq;
-
-				for (i = 0; i < vdev->ocb_channel_count; i++) {
-					if (vdev->ocb_channel_info[i].
-						chan_freq == packet_freq) {
-						chan_info = &vdev->
-							ocb_channel_info[i];
-						break;
-					}
-				}
-				if (!chan_info || !chan_info->
-					disable_rx_stats_hdr) {
-					struct ether_header eth_header = {
-						{0} };
-					struct ocb_rx_stats_hdr_t rx_header = {
-						0};
+			if (vdev->opmode == wlan_op_mode_ocb)
+				ol_rx_ocb_prepare_rx_stats_header(vdev, peer,
+								  msdu);
 
-					/*
-					 * Construct the RX stats header and
-					 * push that to the frontof the packet.
-					 */
-					rx_header.version = 1;
-					rx_header.length = sizeof(rx_header);
-					rx_header.channel_freq =
-						peer->last_pkt_center_freq;
-					rx_header.rssi_cmb =
-						peer->last_pkt_rssi_cmb;
-					qdf_mem_copy(rx_header.rssi,
-							peer->last_pkt_rssi,
-							sizeof(rx_header.rssi));
-					if (peer->last_pkt_legacy_rate_sel)
-						rx_header.datarate = 0xFF;
-					else if (peer->last_pkt_legacy_rate ==
-						 0x8)
-						rx_header.datarate = 6;
-					else if (peer->last_pkt_legacy_rate ==
-						 0x9)
-						rx_header.datarate = 4;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xA)
-						rx_header.datarate = 2;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xB)
-						rx_header.datarate = 0;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xC)
-						rx_header.datarate = 7;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xD)
-						rx_header.datarate = 5;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xE)
-						rx_header.datarate = 3;
-					else if (peer->last_pkt_legacy_rate ==
-						 0xF)
-						rx_header.datarate = 1;
-					else
-						rx_header.datarate = 0xFF;
-
-					rx_header.timestamp_microsec = peer->
-						last_pkt_timestamp_microsec;
-					rx_header.timestamp_submicrosec = peer->
-						last_pkt_timestamp_submicrosec;
-					rx_header.tsf32 = peer->last_pkt_tsf;
-					rx_header.ext_tid = peer->last_pkt_tid;
-
-					qdf_nbuf_push_head(msdu,
-						sizeof(rx_header));
-					qdf_mem_copy(qdf_nbuf_data(msdu),
-						&rx_header, sizeof(rx_header));
-
-					/*
-					 * Construct the ethernet header with
-					 * type 0x8152 and push that to the
-					 * front of the packet to indicate the
-					 * RX stats header.
-					 */
-					eth_header.ether_type = QDF_SWAP_U16(
-						ETHERTYPE_OCB_RX);
-					qdf_nbuf_push_head(msdu,
-							   sizeof(eth_header));
-					qdf_mem_copy(qdf_nbuf_data(msdu),
-							&eth_header,
-							 sizeof(eth_header));
-				}
-			}
 			OL_RX_PEER_STATS_UPDATE(peer, msdu);
 			OL_RX_ERR_STATISTICS_1(pdev, vdev, peer, rx_desc,
 					       OL_RX_ERR_NONE);

+ 8 - 0
core/dp/txrx/ol_tx_hl.c

@@ -352,6 +352,7 @@ static inline int ol_tx_encap_wrapper(struct ol_txrx_pdev_t *pdev,
  *
  * Return: true if ocb parsing is successful
  */
+#ifdef WLAN_FEATURE_DSRC
 #define OCB_HEADER_VERSION     1
 static bool parse_ocb_tx_header(qdf_nbuf_t msdu,
 				struct ocb_tx_ctrl_hdr_t *tx_ctrl)
@@ -384,6 +385,13 @@ static bool parse_ocb_tx_header(qdf_nbuf_t msdu,
 	qdf_nbuf_pull_head(msdu, tx_ctrl_hdr->length);
 	return true;
 }
+#else
+static bool parse_ocb_tx_header(qdf_nbuf_t msdu,
+				struct ocb_tx_ctrl_hdr_t *tx_ctrl)
+{
+	return true;
+}
+#endif
 
 /**
  * ol_txrx_mgmt_tx_desc_alloc() - Allocate and initialize a tx descriptor

+ 6 - 0
core/dp/txrx/ol_txrx.c

@@ -2556,6 +2556,7 @@ ol_txrx_remove_peers_for_vdev_no_lock(struct cdp_vdev *pvdev,
 	}
 }
 
+#ifdef WLAN_FEATURE_DSRC
 /**
  * ol_txrx_set_ocb_chan_info() - set OCB channel info to vdev.
  * @vdev: vdev handle
@@ -2585,6 +2586,7 @@ ol_txrx_get_ocb_chan_info(struct cdp_vdev *pvdev)
 
 	return vdev->ocb_channel_info;
 }
+#endif
 
 /**
  * @brief specify the peer's authentication state
@@ -5563,10 +5565,12 @@ static struct cdp_bus_ops ol_ops_bus = {
 	.bus_resume = ol_txrx_bus_resume
 };
 
+#ifdef WLAN_FEATURE_DSRC
 static struct cdp_ocb_ops ol_ops_ocb = {
 	.set_ocb_chan_info = ol_txrx_set_ocb_chan_info,
 	.get_ocb_chan_info = ol_txrx_get_ocb_chan_info
 };
+#endif
 
 static struct cdp_throttle_ops ol_ops_throttle = {
 #ifdef QCA_SUPPORT_TX_THROTTLE
@@ -5684,7 +5688,9 @@ static struct cdp_ops ol_txrx_ops = {
 	.rx_offld_ops = &ol_rx_offld_ops,
 #endif
 	.bus_ops = &ol_ops_bus,
+#ifdef WLAN_FEATURE_DSRC
 	.ocb_ops = &ol_ops_ocb,
+#endif
 	.peer_ops = &ol_ops_peer,
 	.throttle_ops = &ol_ops_throttle,
 	.mob_stats_ops = &ol_ops_mob_stats,

+ 2 - 0
core/sme/src/common/sme_api.c

@@ -2255,6 +2255,7 @@ QDF_STATUS sme_process_msg(tpAniSirGlobal pMac, struct scheduler_msg *pMsg)
 			sme_err("Empty message for: %d", pMsg->type);
 		}
 		break;
+#ifdef WLAN_FEATURE_DSRC
 	case eWNI_SME_OCB_SET_CONFIG_RSP:
 		if (pMac->sme.ocb_set_config_callback)
 			pMac->sme.ocb_set_config_callback(
@@ -2308,6 +2309,7 @@ QDF_STATUS sme_process_msg(tpAniSirGlobal pMac, struct scheduler_msg *pMsg)
 			sme_err("No callback for Msg type: %d", pMsg->type);
 		qdf_mem_free(pMsg->bodyptr);
 		break;
+#endif
 	case eWNI_SME_SET_DUAL_MAC_CFG_RESP:
 		if (pMsg->bodyptr) {
 			status = sme_process_dual_mac_config_resp(pMac,