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

Commit 2c9593a3 authored by Jiani Liu's avatar Jiani Liu Committed by nshrivas
Browse files

qcacld-3.0: Add PTP timestamp socket options TX support

Host need to fill netbuf with qtime instead of tsf. So
host need to add tsf64 enable/disable related functions
and definitions to sync with FW.

The tsf64_time is new added to fw/host structure, so host
need to add parse functions to get tsf64_time from tx_desc.

Change-Id: Ieea0d8f905eb57629d279f8da0e811857b760b1f
CRs-Fixed: 2444456
parent 1dc185d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ struct cds_config_info {
	bool rps_enabled;
	uint8_t delay_before_vdev_stop;
	bool enable_peer_unmap_conf_support;
	bool enable_tx_compl_tsf64;
};

#ifdef WLAN_FEATURE_FILS_SK
+80 −14
Original line number Diff line number Diff line
@@ -616,21 +616,29 @@ void ol_tx_flow_pool_unlock(struct ol_tx_desc_t *tx_desc)

#ifdef WLAN_FEATURE_TSF_PLUS
static inline struct htt_tx_compl_ind_append_tx_tstamp *ol_tx_get_txtstamps(
		u_int32_t *msg_word, int num_msdus)
		u_int32_t *msg_word_header, u_int32_t **msg_word_payload,
		int num_msdus)
{
	u_int32_t has_tx_tsf;
	u_int32_t has_retry;

	struct htt_tx_compl_ind_append_tx_tstamp *txtstamp_list = NULL;
	struct htt_tx_compl_ind_append_retries *retry_list = NULL;
	int offset_dwords;

	has_tx_tsf = HTT_TX_COMPL_IND_APPEND1_GET(*msg_word);
	if (num_msdus <= 0 || !has_tx_tsf)
	if (num_msdus <= 0)
		return NULL;

	offset_dwords = 1 + ((num_msdus + 1) >> 1);
	has_tx_tsf = HTT_TX_COMPL_IND_APPEND1_GET(*msg_word_header);

	/* skip header and MSDUx ID part*/
	offset_dwords = ((num_msdus + 1) >> 1);
	*msg_word_payload += offset_dwords;

	if (!has_tx_tsf)
		return NULL;

	has_retry = HTT_TX_COMPL_IND_APPEND_GET(*msg_word);
	has_retry = HTT_TX_COMPL_IND_APPEND_GET(*msg_word_header);
	if (has_retry) {
		int retry_index = 0;
		int width_for_each_retry =
@@ -638,19 +646,51 @@ static inline struct htt_tx_compl_ind_append_tx_tstamp *ol_tx_get_txtstamps(
			3) >> 2;

		retry_list = (struct htt_tx_compl_ind_append_retries *)
			(msg_word + offset_dwords);
			(*msg_word_payload + offset_dwords);
		while (retry_list) {
			if (retry_list[retry_index++].flag == 0)
				break;
		}
		offset_dwords += retry_index * width_for_each_retry;
		offset_dwords = retry_index * width_for_each_retry;
	}
	txtstamp_list = (struct htt_tx_compl_ind_append_tx_tstamp *)
		(msg_word + offset_dwords);

	*msg_word_payload +=  offset_dwords;
	txtstamp_list = (struct htt_tx_compl_ind_append_tx_tstamp *)
		(*msg_word_payload);
	return txtstamp_list;
}

static inline
struct htt_tx_compl_ind_append_tx_tsf64 *ol_tx_get_txtstamp64s(
		u_int32_t *msg_word_header, u_int32_t **msg_word_payload,
		int num_msdus)
{
	u_int32_t has_tx_tstamp64;
	u_int32_t has_rssi;
	struct htt_tx_compl_ind_append_tx_tsf64 *txtstamp64_list = NULL;

	int offset_dwords = 0;

	if (num_msdus <= 0)
		return NULL;

	has_tx_tstamp64 = HTT_TX_COMPL_IND_APPEND3_GET(*msg_word_header);
	if (!has_tx_tstamp64)
		return NULL;

	/*skip MSDUx ACK RSSI part*/
	has_rssi = HTT_TX_COMPL_IND_APPEND2_GET(*msg_word_header);
	if (has_rssi)
		offset_dwords = ((num_msdus + 1) >> 1);

	*msg_word_payload = *msg_word_payload + offset_dwords;
	txtstamp64_list =
		(struct htt_tx_compl_ind_append_tx_tsf64 *)
		(*msg_word_payload);

	return txtstamp64_list;
}

static inline void ol_tx_timestamp(ol_txrx_pdev_handle pdev,
				   qdf_nbuf_t netbuf, u_int64_t ts)
{
@@ -662,7 +702,16 @@ static inline void ol_tx_timestamp(ol_txrx_pdev_handle pdev,
}
#else
static inline struct htt_tx_compl_ind_append_tx_tstamp *ol_tx_get_txtstamps(
		u_int32_t *msg_word, int num_msdus)
		u_int32_t *msg_word_header, u_int32_t **msg_word_payload,
		int num_msdus)
{
	return NULL;
}

static inline
struct htt_tx_compl_ind_append_tx_tsf64 *ol_tx_get_txtstamp64s(
		u_int32_t *msg_word_header, u_int32_t **msg_word_payload,
		int num_msdus)
{
	return NULL;
}
@@ -816,17 +865,27 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
	tp_ol_packetdump_cb packetdump_cb;
	uint32_t is_tx_desc_freed = 0;
	struct htt_tx_compl_ind_append_tx_tstamp *txtstamp_list = NULL;
	struct htt_tx_compl_ind_append_tx_tsf64 *txtstamp64_list = NULL;
	u_int32_t *msg_word_header = (u_int32_t *)msg;
	/*msg_word skip header*/
	u_int32_t *msg_word_payload = msg_word_header + 1;
	u_int32_t *msg_word = (u_int32_t *)msg;
	u_int16_t *desc_ids = (u_int16_t *)(msg_word + 1);
	union ol_tx_desc_list_elem_t *lcl_freelist = NULL;
	union ol_tx_desc_list_elem_t *tx_desc_last = NULL;
	ol_tx_desc_list tx_descs;
	uint64_t tx_tsf64;

	TAILQ_INIT(&tx_descs);

	ol_tx_delay_compute(pdev, status, desc_ids, num_msdus);
	if (status == htt_tx_status_ok)
		txtstamp_list = ol_tx_get_txtstamps(msg_word, num_msdus);
	if (status == htt_tx_status_ok) {
		txtstamp_list = ol_tx_get_txtstamps(
			msg_word_header, &msg_word_payload, num_msdus);
		if (pdev->enable_tx_compl_tsf64)
			txtstamp64_list = ol_tx_get_txtstamp64s(
				msg_word_header, &msg_word_payload, num_msdus);
	}

	for (i = 0; i < num_msdus; i++) {
		tx_desc_id = desc_ids[i];
@@ -842,7 +901,13 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
		tx_desc->status = status;
		netbuf = tx_desc->netbuf;

		if (txtstamp_list)
		if (txtstamp64_list) {
			tx_tsf64 =
			(u_int64_t)txtstamp64_list[i].tx_tsf64_high << 32 |
			txtstamp64_list[i].tx_tsf64_low;

			ol_tx_timestamp(pdev, netbuf, tx_tsf64);
		} else if (txtstamp_list)
			ol_tx_timestamp(pdev, netbuf,
					(u_int64_t)txtstamp_list->timestamp[i]
					);
@@ -852,7 +917,8 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev,
		if (QDF_NBUF_CB_GET_PACKET_TYPE(netbuf) ==
		    QDF_NBUF_CB_PACKET_TYPE_ARP) {
			if (qdf_nbuf_data_is_arp_req(netbuf))
				ol_tx_update_arp_stats(tx_desc, netbuf, status);
				ol_tx_update_arp_stats(tx_desc, netbuf,
						       status);
		}

		/* check tx completion notification */
+35 −0
Original line number Diff line number Diff line
@@ -6590,6 +6590,8 @@ static struct cdp_cfg_ops ol_ops_cfg = {
		ol_txrx_set_new_htt_msg_format,
	.set_peer_unmap_conf_support = ol_txrx_set_peer_unmap_conf_support,
	.get_peer_unmap_conf_support = ol_txrx_get_peer_unmap_conf_support,
	.set_tx_compl_tsf64 = ol_txrx_set_tx_compl_tsf64,
	.get_tx_compl_tsf64 = ol_txrx_get_tx_compl_tsf64,
};

static struct cdp_peer_ops ol_ops_peer = {
@@ -6753,3 +6755,36 @@ void ol_txrx_set_peer_unmap_conf_support(bool val)
	}
	pdev->enable_peer_unmap_conf_support = val;
}

#ifdef WLAN_FEATURE_TSF_PLUS
bool ol_txrx_get_tx_compl_tsf64(void)
{
	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);

	if (!pdev) {
		qdf_print("%s: pdev is NULL\n", __func__);
		return false;
	}
	return pdev->enable_tx_compl_tsf64;
}

void ol_txrx_set_tx_compl_tsf64(bool val)
{
	struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX);

	if (!pdev) {
		qdf_print("%s: pdev is NULL\n", __func__);
		return;
	}
	pdev->enable_tx_compl_tsf64 = val;
}
#else
bool ol_txrx_get_tx_compl_tsf64(void)
{
	return false;
}

void ol_txrx_set_tx_compl_tsf64(bool val)
{
}
#endif
+19 −0
Original line number Diff line number Diff line
@@ -186,4 +186,23 @@ void ol_txrx_set_peer_unmap_conf_support(bool val);
 * return true is peer unmap conf feature is enabled else false
 */
bool ol_txrx_get_peer_unmap_conf_support(void);

/**
 * ol_txrx_get_tx_compl_tsf64() - check tx compl tsf64 feature
 *
 * Check if tx compl tsf64 feature is enabled
 *
 * return true is tx compl tsf64 feature is enabled else false
 */
bool ol_txrx_get_tx_compl_tsf64(void);

/**
 * ol_txrx_set_tx_compl_tsf64() - set tx compl tsf64 feature
 * @val - enable or disable tx compl tsf64 feature
 *
 * Set if tx compl tsf64 feature is supported FW
 *
 * return NONE
 */
void ol_txrx_set_tx_compl_tsf64(bool val);
#endif /* _OL_TXRX__H_ */
+1 −0
Original line number Diff line number Diff line
@@ -1049,6 +1049,7 @@ struct ol_txrx_pdev_t {
	bool new_htt_msg_format;
	uint8_t peer_id_unmap_ref_cnt;
	bool enable_peer_unmap_conf_support;
	bool enable_tx_compl_tsf64;
};

struct ol_txrx_vdev_t {
Loading