Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27a626ea authored by Jiani Liu's avatar Jiani Liu
Browse files

qcacld-3.0: Add PTP timestamp socket options RX support

Host need to fill netbuf with qtime instead of tsf. So host first
need to set enable_ppdu_end to 1, so that FW will pass ppdu_end
contents to host, and host can translate tsf64_time into qtime.
The tsf64_time is new added to fw struture, so host will need
add it accordingly to struct hdd_adapter, and keep it updated
in time synchronization function <hdd_update_timestamp>.

Change-Id: Ib19ac1411c4e17624c012f188297c9f2122642d2
CRs-Fixed: 2444456
parent f2c5ae77
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@

#include <htt_internal.h>
#include <wlan_policy_mgr_api.h>
#include <ol_htt_rx_api.h>

#define HTT_MSG_BUF_SIZE(msg_bytes) \
	((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
@@ -526,6 +527,7 @@ QDF_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev)
			  __func__, __LINE__);
	}

	htt_rx_enable_ppdu_end(&enable_ppdu_end);
	HTT_RX_RING_CFG_ENABLED_802_11_HDR_SET(*msg_word, enable_hdr);
	HTT_RX_RING_CFG_ENABLED_MSDU_PAYLD_SET(*msg_word, 1);
	HTT_RX_RING_CFG_ENABLED_PPDU_START_SET(*msg_word, enable_ppdu_start);
+7 −0
Original line number Diff line number Diff line
@@ -3272,3 +3272,10 @@ QDF_STATUS htt_rx_update_smmu_map(struct htt_pdev_t *pdev, bool map)
	return status;
}
#endif

#ifdef WLAN_FEATURE_TSF_PLUS
void htt_rx_enable_ppdu_end(int *enable_ppdu_end)
{
	*enable_ppdu_end = 1;
}
#endif
+14 −0
Original line number Diff line number Diff line
@@ -904,4 +904,18 @@ uint32_t htt_rx_amsdu_rx_in_order_get_pktlog(qdf_nbuf_t rx_ind_msg);
 * Return: QDF_STATUS
 */
QDF_STATUS htt_rx_update_smmu_map(struct htt_pdev_t *pdev, bool map);

/** htt_tx_enable_ppdu_end
 * @enable_ppdu_end - set it to 1 if WLAN_FEATURE_TSF_PLUS is defined,
 *                    else do nothing
 */
#ifdef WLAN_FEATURE_TSF_PLUS
void htt_rx_enable_ppdu_end(int *enable_ppdu_end);
#else
static inline
void htt_rx_enable_ppdu_end(int *enable_ppdu_end)
{
}
#endif

#endif /* _OL_HTT_RX_API__H_ */
+39 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "pktlog_ac_fmt.h"
#include <cdp_txrx_handle.h>
#include <pld_common.h>
#include <htt_internal.h>

#ifndef OL_RX_INDICATION_MAX_RECORDS
#define OL_RX_INDICATION_MAX_RECORDS 2048
@@ -1157,6 +1158,7 @@ ol_rx_filter(struct ol_txrx_vdev_t *vdev,
}

#ifdef WLAN_FEATURE_TSF_PLUS
#ifdef CONFIG_HL_SUPPORT
static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
				   void *rx_desc, qdf_nbuf_t msdu)
{
@@ -1174,6 +1176,32 @@ static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
				   NSEC_PER_USEC);
}
#else
static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
				   void *rx_desc, qdf_nbuf_t msdu)
{
	struct htt_host_rx_desc_base *rx_mpdu_desc = rx_desc;
	uint32_t tsf64_low32, tsf64_high32;
	uint64_t tsf64, tsf64_ns;

	if (!ol_cfg_is_ptp_rx_opt_enabled(cfg_pdev))
		return;

	if (!rx_mpdu_desc || !msdu)
		return;

	tsf64_low32 = rx_mpdu_desc->ppdu_end.wb_timestamp_lower_32;
	tsf64_high32 = rx_mpdu_desc->ppdu_end.wb_timestamp_upper_32;

	tsf64 = (uint64_t)tsf64_high32 << 32 | tsf64_low32;
	if (tsf64 * NSEC_PER_USEC < tsf64)
		tsf64_ns = 0;
	else
		tsf64_ns = tsf64 * NSEC_PER_USEC;

	msdu->tstamp = ns_to_ktime(tsf64_ns);
}
#endif
#else
static inline void ol_rx_timestamp(struct cdp_cfg *cfg_pdev,
				   void *rx_desc, qdf_nbuf_t msdu)
{
@@ -1468,6 +1496,8 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
	uint32_t msdu_count;
	uint8_t pktlog_bit;
	uint32_t filled = 0;
	struct htt_host_rx_desc_base *rx_desc;
	qdf_nbuf_t loop_msdu;

	if (tid >= OL_TXRX_NUM_EXT_TIDS) {
		ol_txrx_err("%s:  invalid tid, %u\n", __FUNCTION__, tid);
@@ -1554,6 +1584,15 @@ ol_rx_in_order_indication_handler(ol_txrx_pdev_handle pdev,
		}
		return;
	}
	/*Loop msdu to fill tstamp with tsf64 time in ol_rx_timestamp*/
	loop_msdu = head_msdu;
	while (loop_msdu) {
		qdf_nbuf_t msdu = head_msdu;

		rx_desc = htt_rx_msdu_desc_retrieve(pdev->htt_pdev, loop_msdu);
		ol_rx_timestamp(pdev->ctrl_pdev, rx_desc, msdu);
		loop_msdu = qdf_nbuf_next(loop_msdu);
	}

	peer->rx_opt_proc(vdev, peer, tid, head_msdu);
}
+2 −0
Original line number Diff line number Diff line
@@ -1360,6 +1360,8 @@ struct hdd_adapter {
	uint64_t cur_target_time;
	uint64_t cur_tsf_sync_soc_time;
	uint64_t last_tsf_sync_soc_time;
	uint64_t cur_target_global_tsf_time;
	uint64_t last_target_global_tsf_time;
	qdf_mc_timer_t host_capture_req_timer;
#ifdef WLAN_FEATURE_TSF_PLUS
	/* spin lock for read/write timestamps */
Loading