浏览代码

qcacld-3.0: add build flag for network package timestamping

Network package timestamping is optional for TSF feature,
to make it configurable, add a new build flag
WLAN_FEATURE_TSF_PLUS_SOCK_TS.
This flag will be set only when CONFIG_WLAN_SYNC_TSF_PLUS
is enabled and CONFIG_WLAN_SYNC_TSF_PLUS_DISABLE_SOCK_TS
is not.

Change-Id: I413e85fadf93264cd41c2739b6d870aa08d60efb
CRs-Fixed: 3027378
Yu Wang 3 年之前
父节点
当前提交
a4791d8279

+ 10 - 1
Kbuild

@@ -3484,7 +3484,16 @@ cppflags-$(CONFIG_LINUX_QCMBR) += -DLINUX_QCMBR
 
 # Enable feature sync tsf between multi devices
 cppflags-$(CONFIG_WLAN_SYNC_TSF) += -DWLAN_FEATURE_TSF
-cppflags-$(CONFIG_WLAN_SYNC_TSF_PLUS) += -DWLAN_FEATURE_TSF_PLUS
+
+ifeq ($(CONFIG_WLAN_SYNC_TSF_PLUS), y)
+cppflags-y += -DWLAN_FEATURE_TSF_PLUS
+
+ifneq ($(CONFIG_WLAN_SYNC_TSF_PLUS_DISABLE_SOCK_TS), y)
+cppflags-y += -DWLAN_FEATURE_TSF_PLUS_SOCK_TS
+endif
+
+endif
+
 # Enable feature sync tsf for chips based on Adrastea arch
 cppflags-$(CONFIG_WLAN_SYNC_TSF_PLUS_NOIRQ) += -DWLAN_FEATURE_TSF_PLUS_NOIRQ
 

+ 1 - 1
core/cds/inc/cds_api.h

@@ -456,7 +456,7 @@ void cds_get_and_reset_log_completion(uint32_t *is_fatal,
 bool cds_is_log_report_in_progress(void);
 bool cds_is_fatal_event_enabled(void);
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 bool cds_is_ptp_rx_opt_enabled(void);
 bool cds_is_ptp_tx_opt_enabled(void);
 #else

+ 1 - 1
core/cds/src/cds_api.c

@@ -2355,7 +2355,7 @@ bool cds_is_fatal_event_enabled(void)
 	return p_cds_context->enable_fatal_event;
 }
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 bool cds_is_ptp_rx_opt_enabled(void)
 {
 	struct hdd_context *hdd_ctx;

+ 2 - 2
core/dp/ol/inc/ol_txrx_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014,2016-2017,2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2014,2016-2017,2019,2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -51,7 +51,7 @@ enum ol_sec_type {
 	ol_sec_type_types
 };
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 typedef int (*tp_ol_timestamp_cb)(qdf_nbuf_t netbuf, uint64_t target_time);
 
 /**

+ 2 - 2
core/dp/txrx/ol_tx_send.c

@@ -750,7 +750,7 @@ ol_tx_pkt_capture_tx_completion_process(
 }
 #endif /* WLAN_FEATURE_PKT_CAPTURE */
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 static inline struct htt_tx_compl_ind_append_tx_tstamp *ol_tx_get_txtstamps(
 		u_int32_t *msg_word_header, u_int32_t **msg_word_payload,
 		int num_msdus)
@@ -1792,7 +1792,7 @@ ol_tx_delay_compute(struct ol_txrx_pdev_t *pdev,
 
 #endif /* QCA_COMPUTE_TX_DELAY */
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 void ol_register_timestamp_callback(tp_ol_timestamp_cb ol_tx_timestamp_cb)
 {
 	struct ol_txrx_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);

+ 1 - 1
core/dp/txrx/ol_txrx_types.h

@@ -785,7 +785,7 @@ struct ol_txrx_pdev_t {
 	ol_txrx_pktdump_cb ol_tx_packetdump_cb;
 	ol_txrx_pktdump_cb ol_rx_packetdump_cb;
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 	tp_ol_timestamp_cb ol_tx_timestamp_cb;
 #endif
 

+ 15 - 37
core/hdd/inc/wlan_hdd_tsf.h

@@ -232,31 +232,6 @@ int hdd_start_tsf_sync(struct hdd_adapter *adapter);
  */
 int hdd_stop_tsf_sync(struct hdd_adapter *adapter);
 
-/**
- * hdd_tx_timestamp() - time stamp TX netbuf
- *
- * @netbuf: pointer to a TX netbuf
- * @target_time: TX time for the netbuf
- *
- * This function  get corresponding host time from target time,
- * and time stamp the TX netbuf with this time
- *
- * Return: Describe the execute result of this routine
- */
-int hdd_tx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time);
-
-/**
- * hdd_rx_timestamp() - time stamp RX netbuf
- *
- * @netbuf: pointer to a RX netbuf
- * @target_time: RX time for the netbuf
- *
- * This function get corresponding host time from target time,
- * and time stamp the RX netbuf with this time
- *
- * Return: Describe the execute result of this routine
- */
-int hdd_rx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time);
 /**
  * hdd_capture_req_timer_expired_handler() - capture req timer handler
  * @arg: pointer to a adapter
@@ -277,6 +252,21 @@ void hdd_capture_req_timer_expired_handler(void *arg);
  * Return: true on enable, false on disable
  */
 bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd);
+
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
+/**
+ * hdd_rx_timestamp() - time stamp RX netbuf
+ *
+ * @netbuf: pointer to a RX netbuf
+ * @target_time: RX time for the netbuf
+ *
+ * This function get corresponding host time from target time,
+ * and time stamp the RX netbuf with this time
+ *
+ * Return: Describe the execute result of this routine
+ */
+int hdd_rx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time);
+#endif
 #else
 static inline int hdd_start_tsf_sync(struct hdd_adapter *adapter)
 {
@@ -288,18 +278,6 @@ static inline int hdd_stop_tsf_sync(struct hdd_adapter *adapter)
 	return -ENOTSUPP;
 }
 
-static inline
-int hdd_tx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time)
-{
-	return -ENOTSUPP;
-}
-
-static inline
-int hdd_rx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time)
-{
-	return -ENOTSUPP;
-}
-
 static inline
 void hdd_capture_req_timer_expired_handler(void *arg)
 {

+ 1 - 1
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -1050,7 +1050,7 @@ QDF_STATUS hdd_softap_init_tx_rx_sta(struct hdd_adapter *adapter,
  *
  * Return: None
  */
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 static inline void hdd_softap_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
 					       qdf_nbuf_t netbuf)
 {

+ 105 - 80
core/hdd/src/wlan_hdd_tsf.c

@@ -1520,6 +1520,77 @@ static enum hdd_tsf_op_result hdd_tsf_sync_deinit(struct hdd_adapter *adapter)
 	return HDD_TSF_OP_SUCC;
 }
 
+int hdd_start_tsf_sync(struct hdd_adapter *adapter)
+{
+	enum hdd_tsf_op_result ret;
+
+	if (!adapter)
+		return -EINVAL;
+
+	ret = hdd_tsf_sync_init(adapter);
+	if (ret != HDD_TSF_OP_SUCC) {
+		hdd_err("Failed to init tsf sync, ret: %d", ret);
+		return -EINVAL;
+	}
+
+	return (__hdd_start_tsf_sync(adapter) ==
+		HDD_TSF_OP_SUCC) ? 0 : -EINVAL;
+}
+
+int hdd_stop_tsf_sync(struct hdd_adapter *adapter)
+{
+	enum hdd_tsf_op_result ret;
+
+	if (!adapter)
+		return -EINVAL;
+
+	ret = __hdd_stop_tsf_sync(adapter);
+	if (ret != HDD_TSF_OP_SUCC)
+		return -EINVAL;
+
+	ret = hdd_tsf_sync_deinit(adapter);
+	if (ret != HDD_TSF_OP_SUCC) {
+		hdd_err("Failed to deinit tsf sync, ret: %d", ret);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static inline int __hdd_capture_tsf(struct hdd_adapter *adapter,
+				    uint32_t *buf, int len)
+{
+	if (!adapter || !buf) {
+		hdd_err("invalid pointer");
+		return -EINVAL;
+	}
+
+	if (len != 1)
+		return -EINVAL;
+
+	buf[0] = TSF_DISABLED_BY_TSFPLUS;
+
+	return 0;
+}
+
+static inline int __hdd_indicate_tsf(struct hdd_adapter *adapter,
+				     uint32_t *buf, int len)
+{
+	if (!adapter || !buf) {
+		hdd_err("invalid pointer");
+		return -EINVAL;
+	}
+
+	if (len != 3)
+		return -EINVAL;
+
+	buf[0] = TSF_DISABLED_BY_TSFPLUS;
+	buf[1] = 0;
+	buf[2] = 0;
+
+	return 0;
+}
+
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 #ifdef CONFIG_HL_SUPPORT
 static inline
 enum hdd_tsf_op_result hdd_netbuf_timestamp(qdf_nbuf_t netbuf,
@@ -1577,43 +1648,18 @@ enum hdd_tsf_op_result hdd_netbuf_timestamp(qdf_nbuf_t netbuf,
 }
 #endif
 
-int hdd_start_tsf_sync(struct hdd_adapter *adapter)
-{
-	enum hdd_tsf_op_result ret;
-
-	if (!adapter)
-		return -EINVAL;
-
-	ret = hdd_tsf_sync_init(adapter);
-	if (ret != HDD_TSF_OP_SUCC) {
-		hdd_err("Failed to init tsf sync, ret: %d", ret);
-		return -EINVAL;
-	}
-
-	return (__hdd_start_tsf_sync(adapter) ==
-		HDD_TSF_OP_SUCC) ? 0 : -EINVAL;
-}
-
-int hdd_stop_tsf_sync(struct hdd_adapter *adapter)
-{
-	enum hdd_tsf_op_result ret;
-
-	if (!adapter)
-		return -EINVAL;
-
-	ret = __hdd_stop_tsf_sync(adapter);
-	if (ret != HDD_TSF_OP_SUCC)
-		return -EINVAL;
-
-	ret = hdd_tsf_sync_deinit(adapter);
-	if (ret != HDD_TSF_OP_SUCC) {
-		hdd_err("Failed to deinit tsf sync, ret: %d", ret);
-		return -EINVAL;
-	}
-	return 0;
-}
-
-int hdd_tx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time)
+/**
+ * hdd_tx_timestamp() - time stamp TX netbuf
+ *
+ * @netbuf: pointer to a TX netbuf
+ * @target_time: TX time for the netbuf
+ *
+ * This function  get corresponding host time from target time,
+ * and time stamp the TX netbuf with this time
+ *
+ * Return: Describe the execute result of this routine
+ */
+static int hdd_tx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time)
 {
 	struct sock *sk = netbuf->sk;
 
@@ -1661,47 +1707,33 @@ int hdd_rx_timestamp(qdf_nbuf_t netbuf, uint64_t target_time)
 	return -EINVAL;
 }
 
-static inline int __hdd_capture_tsf(struct hdd_adapter *adapter,
-				    uint32_t *buf, int len)
+static inline void wlan_hdd_tsf_plus_sock_ts_init(struct hdd_context *hdd_ctx)
 {
-	if (!adapter || !buf) {
-		hdd_err("invalid pointer");
-		return -EINVAL;
-	}
-
-	if (len != 1)
-		return -EINVAL;
-
-	buf[0] = TSF_DISABLED_BY_TSFPLUS;
-
-	return 0;
+	if (hdd_tsf_is_tx_set(hdd_ctx))
+		ol_register_timestamp_callback(hdd_tx_timestamp);
 }
 
-static inline int __hdd_indicate_tsf(struct hdd_adapter *adapter,
-				     uint32_t *buf, int len)
+static inline void wlan_hdd_tsf_plus_sock_ts_deinit(struct hdd_context *hdd_ctx)
 {
-	if (!adapter || !buf) {
-		hdd_err("invalid pointer");
-		return -EINVAL;
-	}
-
-	if (len != 3)
-		return -EINVAL;
-
-	buf[0] = TSF_DISABLED_BY_TSFPLUS;
-	buf[1] = 0;
-	buf[2] = 0;
+	if (hdd_tsf_is_tx_set(hdd_ctx))
+		ol_deregister_timestamp_callback();
+}
+#else
+static inline void wlan_hdd_tsf_plus_sock_ts_init(struct hdd_context *hdd_ctx)
+{
+}
 
-	return 0;
+static inline void wlan_hdd_tsf_plus_sock_ts_deinit(struct hdd_context *hdd_ctx)
+{
 }
+#endif /* WLAN_FEATURE_TSF_PLUS_SOCK_TS */
 
 #if defined(WLAN_FEATURE_TSF_PLUS_NOIRQ)
 static inline
 enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
 {
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_register_timestamp_callback(hdd_tx_timestamp);
+	wlan_hdd_tsf_plus_sock_ts_init(hdd_ctx);
 	return HDD_TSF_OP_SUCC;
 }
 
@@ -1713,8 +1745,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx)
 	qdf_mc_timer_t *cap_timer;
 	struct hdd_adapter *adapter, *adapternode_ptr, *next_ptr;
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_deregister_timestamp_callback();
+	wlan_hdd_tsf_plus_sock_ts_deinit(hdd_ctx);
 
 	status = hdd_get_front_adapter(hdd_ctx, &adapternode_ptr);
 
@@ -1773,8 +1804,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
 		goto fail_free_gpio;
 	}
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_register_timestamp_callback(hdd_tx_timestamp);
+	wlan_hdd_tsf_plus_sock_ts_init(hdd_ctx);
 
 	return HDD_TSF_OP_SUCC;
 
@@ -1798,8 +1828,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx)
 	if (tsf_sync_gpio_pin == TSF_GPIO_PIN_INVALID)
 		return QDF_STATUS_E_INVAL;
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_deregister_timestamp_callback();
+	wlan_hdd_tsf_plus_sock_ts_deinit(hdd_ctx);
 
 	gpio_free(tsf_sync_gpio_pin);
 	return HDD_TSF_OP_SUCC;
@@ -1852,8 +1881,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
 		goto fail_free_gpio;
 	}
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_register_timestamp_callback(hdd_tx_timestamp);
+	wlan_hdd_tsf_plus_sock_ts_init(hdd_ctx);
 
 	return HDD_TSF_OP_SUCC;
 
@@ -1878,8 +1906,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx)
 	if (tsf_irq_gpio_pin == TSF_GPIO_PIN_INVALID)
 		return QDF_STATUS_E_INVAL;
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_deregister_timestamp_callback();
+	wlan_hdd_tsf_plus_sock_ts_deinit(hdd_ctx);
 
 	if (tsf_gpio_irq_num >= 0) {
 		free_irq(tsf_gpio_irq_num, hdd_ctx);
@@ -1944,8 +1971,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_init(struct hdd_context *hdd_ctx)
 		return HDD_TSF_OP_FAIL;
 	}
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_register_timestamp_callback(hdd_tx_timestamp);
+	wlan_hdd_tsf_plus_sock_ts_init(hdd_ctx);
 	return HDD_TSF_OP_SUCC;
 }
 
@@ -1954,8 +1980,7 @@ enum hdd_tsf_op_result wlan_hdd_tsf_plus_deinit(struct hdd_context *hdd_ctx)
 {
 	int ret;
 
-	if (hdd_tsf_is_tx_set(hdd_ctx))
-		ol_deregister_timestamp_callback();
+	wlan_hdd_tsf_plus_sock_ts_deinit(hdd_ctx);
 
 	ret = cnss_common_unregister_tsf_captured_handler(
 				hdd_ctx->parent_dev,

+ 1 - 1
core/hdd/src/wlan_hdd_tx_rx.c

@@ -2079,7 +2079,7 @@ void hdd_disable_rx_ol_for_low_tput(struct hdd_context *hdd_ctx, bool disable)
 }
 #endif /* RECEIVE_OFFLOAD */
 
-#ifdef WLAN_FEATURE_TSF_PLUS
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
 static inline void hdd_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
 					qdf_nbuf_t netbuf,
 					uint64_t target_time)