Browse Source

qcacld-3.0: Add HDD callback API for DP component

Add and register HDD callback APIs with DP component.
With this changes DP component will be able to call
HDD APIs which cannot be moved to DP component,
and to get information from HDD.

Change-Id: I393a12dc44b0c38a84a2c0245653c477ac6f2faa
CRs-Fixed: 3172463
Amit Mehta 3 years ago
parent
commit
6517e529b8

+ 21 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -121,6 +121,7 @@
 #include "wlan_hdd_bus_bandwidth.h"
 #include <wlan_hdd_cm_api.h>
 #include "wlan_hdd_mlo.h"
+#include "wlan_dp_public_struct.h"
 
 /*
  * Preprocessor definitions and constants
@@ -3825,8 +3826,27 @@ int hdd_wlan_clear_stats(struct hdd_adapter *adapter, int stats_id);
 void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
 void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
 
+/**
+ * hdd_cb_handle_to_context() - turn an HDD handle into an HDD context
+ * @hdd_handle: HDD handle to be converted
+ *
+ * Return: HDD context referenced by @hdd_cb_handle
+ */
+static inline
+struct hdd_context *hdd_cb_handle_to_context(hdd_cb_handle hdd_handle)
+{
+	return (struct hdd_context *)hdd_handle;
+}
+
+/**
+ * wlan_hdd_display_netif_queue_history() - display netif queue history
+ * @context: opaque handle to hdd context
+ * @verb_lvl: Verbosity levels for stats
+ *
+ * Return: none
+ */
 void
-wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
+wlan_hdd_display_netif_queue_history(hdd_cb_handle context,
 				     enum qdf_stats_verbosity_level verb_lvl);
 
 /**

+ 59 - 9
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -33,6 +33,7 @@
 #include "cdp_txrx_flow_ctrl_legacy.h"
 #include <qdf_tracepoint.h>
 #include <qdf_pkt_add_timestamp.h>
+#include "wlan_dp_public_struct.h"
 
 struct hdd_netif_queue_history;
 struct hdd_context;
@@ -191,6 +192,45 @@ static inline QDF_STATUS hdd_rx_fisa_flush_by_vdev_id(void *dp_soc,
 QDF_STATUS hdd_rx_deliver_to_stack(struct hdd_adapter *adapter,
 				   struct sk_buff *skb);
 
+#ifdef WLAN_FEATURE_TSF_PLUS_SOCK_TS
+/**
+ * hdd_tsf_timestamp_rx() - HDD function to set rx packet timestamp
+ * @ctx: pointer to HDD context
+ * @nbuf: pointer to skb
+ *
+ * Return: None
+ */
+void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf);
+
+/**
+ * hdd_get_tsf_time_cb() - HDD helper function to get TSF time
+ * @vdev_id: vdev id mapped to adapter
+ * @input_time: Input time
+ * @tsf_time: time from TFS module
+ *
+ * Return: None
+ */
+void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
+			 uint64_t *tsf_time);
+#else
+static inline
+void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf) { }
+
+static inline
+void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
+			 uint64_t *tsf_time) { }
+#endif
+
+/**
+ * hdd_legacy_gro_get_napi() - HDD function to get napi in legacy gro case
+ * @nbuf: n/w buffer pointer
+ * @enabled_rxthread: Rx thread enabled/disabled
+ *
+ * Return: qdf napi struct on success, NULL on failure
+ */
+qdf_napi_struct
+*hdd_legacy_gro_get_napi(qdf_nbuf_t nbuf, bool enable_rxthread);
+
 /**
  * hdd_rx_thread_gro_flush_ind_cbk() - receive handler to flush GRO packets
  * @adapter: pointer to HDD adapter
@@ -306,15 +346,23 @@ void hdd_deregister_tx_flow_control(struct hdd_adapter *adapter);
 
 /**
  * hdd_get_tx_resource() - check tx resources and take action
- * @adapter: adapter handle
+ * @vdev_id: vdev id mapped to HDD adapter
  * @mac_addr: mac address
- * @timer_value: timer value
  *
  * Return: none
  */
-void hdd_get_tx_resource(struct hdd_adapter *adapter,
-			 struct qdf_mac_addr *mac_addr, uint16_t timer_value);
+void hdd_get_tx_resource(uint8_t vdev_id,
+			 struct qdf_mac_addr *mac_addr);
 
+/**
+ * hdd_get_tx_flow_low_watermark() - Get TX flow low watermark info
+ * @hdd_cb_handle: HDD opaque ctx
+ * @intf_id: HDD adapter id
+ *
+ * Return: flow low watermark value
+ */
+unsigned int
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id);
 #else
 static inline void hdd_tx_resume_cb(void *adapter_context, bool tx_resume)
 {
@@ -333,19 +381,21 @@ static inline void hdd_deregister_tx_flow_control(struct hdd_adapter *adapter)
 {
 }
 
-
 /**
  * hdd_get_tx_resource() - check tx resources and take action
- * @adapter: adapter handle
+ * @vdev_id: vdev id mapped to HDD adapter
  * @mac_addr: mac address
- * @timer_value: timer value
  *
  * Return: none
  */
 static inline
-void hdd_get_tx_resource(struct hdd_adapter *adapter,
-			 struct qdf_mac_addr *mac_addr, uint16_t timer_value)
+void hdd_get_tx_resource(uint8_t vdev_id,
+			 struct qdf_mac_addr *mac_addr) { }
+
+static inline unsigned int
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id)
 {
+	return 0;
 }
 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
 

+ 517 - 2
core/hdd/src/wlan_hdd_main.c

@@ -432,6 +432,8 @@ struct sock *cesium_nl_srv_sock;
 static void wlan_hdd_auto_shutdown_cb(void);
 #endif
 
+static void hdd_dp_register_callbacks(struct hdd_context *hdd_ctx);
+
 bool hdd_adapter_is_ap(struct hdd_adapter *adapter)
 {
 	if (!adapter) {
@@ -4654,6 +4656,8 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
 
 		hdd_update_cds_ac_specs_params(hdd_ctx);
 
+		hdd_dp_register_callbacks(hdd_ctx);
+
 		status = hdd_component_psoc_open(hdd_ctx->psoc);
 		if (QDF_IS_STATUS_ERROR(status)) {
 			hdd_err("Failed to Open legacy components; status: %d",
@@ -5298,12 +5302,50 @@ hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
 		memcpy(&adapter->mld_addr, mac_addr, ETH_ALEN);
 	}
 }
+
+static QDF_STATUS
+hdd_get_nw_adapter_mac_by_vdev_mac(struct qdf_mac_addr *mac_addr,
+				   struct qdf_mac_addr *adapter_mac)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+	struct hdd_adapter *ml_adapter;
+
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (!hdd_ctx) {
+		hdd_err("Invalid HDD context");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	adapter = hdd_get_adapter_by_macaddr(hdd_ctx, mac_addr->bytes);
+	if (!adapter) {
+		hdd_err("Invalid Adapter context");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (adapter->mlo_adapter_info.is_link_adapter) {
+		ml_adapter = adapter->mlo_adapter_info.ml_adapter;
+		qdf_copy_macaddr(adapter_mac, &ml_adapter->mac_addr);
+	} else {
+		qdf_copy_macaddr(adapter_mac, &adapter->mac_addr);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
 #else
 static void
 hdd_set_mld_address(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx,
 		    struct qdf_mac_addr *mac_addr)
 {
 }
+
+static QDF_STATUS
+hdd_get_nw_adapter_mac_by_vdev_mac(struct qdf_mac_addr *mac_addr,
+				   struct qdf_mac_addr *adapter_mac)
+{
+	qdf_copy_macaddr(adapter_mac, mac_addr);
+	return QDF_STATUS_SUCCESS;
+}
 #endif
 
 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
@@ -11416,6 +11458,473 @@ void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx)
 }
 #endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
 
+/**
+ * wlan_hdd_sta_get_dot11mode() - GET AP client count
+ * @context: HDD context
+ * @vdev_id : vdev ID
+ * @dot11_mode: variable in which mode need to update.
+ *
+ * Return: true on success else false
+ */
+static inline
+bool wlan_hdd_sta_get_dot11mode(hdd_cb_handle context, uint8_t vdev_id,
+				enum qca_wlan_802_11_mode *dot11_mode)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+	struct hdd_station_ctx *sta_ctx;
+	enum csr_cfgdot11mode mode;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx)
+		return false;
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return false;
+	}
+	if (!hdd_cm_is_vdev_associated(adapter)) {
+		hdd_err("vdev not associated ");
+		return false;
+	}
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	mode = sta_ctx->conn_info.dot11mode;
+	*dot11_mode = hdd_convert_cfgdot11mode_to_80211mode(mode);
+	return true;
+}
+
+/**
+ * wlan_hdd_get_ap_client_count() - GET AP client count
+ * @context: HDD context
+ * @vdev_id : vdev ID
+ * @client_count: variable in which number of client need to update.
+ *
+ * Return: true on success else false
+ */
+static inline
+bool wlan_hdd_get_ap_client_count(hdd_cb_handle context, uint8_t vdev_id,
+				  uint16_t *client_count)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+	struct hdd_ap_ctx *ap_ctx;
+	enum qca_wlan_802_11_mode i;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd ctx is null");
+		return false;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return false;
+	}
+
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
+	if (!ap_ctx->ap_active)
+		return false;
+	for (i = QCA_WLAN_802_11_MODE_11B; i < QCA_WLAN_802_11_MODE_INVALID;
+	     i++)
+		client_count[i] = ap_ctx->client_count[i];
+	return true;
+}
+
+/**
+ * wlan_hdd_sta_ndi_connected() - Check if NDI connected
+ * @context: HDD context
+ * @vdev_id : vdev ID
+ *
+ * Return: true if NDI connected else false
+ */
+static inline
+bool wlan_hdd_sta_ndi_connected(hdd_cb_handle context, uint8_t vdev_id)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return false;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+	return false;
+	}
+	if (WLAN_HDD_GET_STATION_CTX_PTR(adapter)->conn_info.conn_state !=
+					 eConnectionState_NdiConnected)
+		return false;
+	return true;
+}
+
+/**
+ * hdd_pktlog_enable_disable() - Enable/Disable packet logging
+ * @context: HDD context
+ * @enable_disable_flag: Flag to enable/disable
+ * @user_triggered: triggered through iwpriv
+ * @size: buffer size to be used for packetlog
+ *
+ * Return: 0 on success; error number otherwise
+ */
+static inline
+int wlan_hdd_pktlog_enable_disable(hdd_cb_handle context,
+				   bool enable_disable_flag,
+				   uint8_t user_triggered, int size)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return -EINVAL;
+	}
+	return hdd_pktlog_enable_disable(hdd_ctx, enable_disable_flag,
+					 user_triggered, size);
+}
+
+/**
+ * wlan_hdd_is_roaming_in_progress() - Check if roaming is in progress
+ * @context: HDD context
+ *
+ * Return: true if roaming is in progress else false
+ */
+static inline bool wlan_hdd_is_roaming_in_progress(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return false;
+	}
+	return hdd_is_roaming_in_progress(hdd_ctx);
+}
+
+/**
+ * hdd_is_ap_active() - Check if AP is active
+ * @context: HDD context
+ * @vdev_id : Vdev ID
+ *
+ * Return: true if AP active else false
+ */
+static inline bool hdd_is_ap_active(hdd_cb_handle context, uint8_t vdev_id)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return false;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return false;
+	}
+	return WLAN_HDD_GET_AP_CTX_PTR(adapter)->ap_active;
+}
+
+/**
+ * wlan_hdd_napi_apply_throughput_policy() - Apply NAPI policy
+ * @context: HDD context
+ * @tx_packets : tx_packets
+ * @rx_packets : rx_packets
+ *
+ * Return: 0 on success else error code
+ */
+static inline
+int wlan_hdd_napi_apply_throughput_policy(hdd_cb_handle context,
+					  uint64_t tx_packets,
+					  uint64_t rx_packets)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+	int rc = 0;
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return 0;
+	}
+	if (hdd_ctx->config->napi_cpu_affinity_mask)
+		rc = hdd_napi_apply_throughput_policy(hdd_ctx, tx_packets,
+						      rx_packets);
+	return rc;
+}
+
+/**
+ * hdd_is_link_adapter() - Check if adapter is link adapter
+ * @context: HDD context
+ * @vdev_id : Vdev ID
+ *
+ * Return: true if link adapter else false
+ */
+static inline bool hdd_is_link_adapter(hdd_cb_handle context, uint8_t vdev_id)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return false;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return false;
+	}
+	return hdd_adapter_is_link_adapter(adapter);
+}
+
+/**
+ * hdd_get_pause_map() - Get pause map value
+ * @context: HDD context
+ * @vdev_id : Vdev ID
+ *
+ * Return: pause map value
+ */
+static inline
+uint32_t hdd_get_pause_map(hdd_cb_handle context, uint8_t vdev_id)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+	struct hdd_adapter *adapter;
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return 0;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return 0;
+	}
+	return adapter->pause_map;
+}
+
+/**
+ * hdd_any_adapter_connected() - Check if any adapter connected.
+ * @context: HDD context
+ *
+ * Return: True if connected else false.
+ */
+static inline bool hdd_any_adapter_connected(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return false;
+	}
+
+	return hdd_is_any_adapter_connected(hdd_ctx);
+}
+
+#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
+/**
+ * hdd_pld_remove_pm_qos() - Remove PLD PM QoS request
+ * @context: HDD context
+ *
+ * Return: None
+ */
+static inline void hdd_pld_remove_pm_qos(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
+	if (!hdd_ctx->hbw_requested) {
+		PLD_REQUEST_PM_QOS(hdd_ctx->parent_dev, 1);
+		hdd_ctx->hbw_requested = true;
+	}
+}
+
+/**
+ * hdd_pld_request_pm_qos() - Request PLD PM QoS request
+ * @context: HDD context
+ *
+ * Return: None
+ */
+static inline void hdd_pld_request_pm_qos(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
+	if (hdd_ctx->hbw_requested &&
+	    !hdd_ctx->pm_qos_request) {
+		PLD_REMOVE_PM_QOS(hdd_ctx->parent_dev);
+		hdd_ctx->hbw_requested = false;
+	}
+}
+
+/**
+ * wlan_hdd_pm_qos_update_request() - Update PM QoS request
+ * @context: HDD context
+ * @pm_qos_cpu_mask: CPU mask
+ *
+ * Return: None
+ */
+static inline void
+wlan_hdd_pm_qos_update_request(hdd_cb_handle context,
+			       cpumask_t *pm_qos_cpu_mask)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
+	if (!hdd_ctx->pm_qos_request)
+		hdd_pm_qos_update_request(hdd_ctx, pm_qos_cpu_mask);
+}
+
+/**
+ * wlan_hdd_pm_qos_add_request() - Add PM QoS request
+ * @context: HDD context
+ *
+ * Return: None
+ */
+static inline void wlan_hdd_pm_qos_add_request(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
+	hdd_pm_qos_add_request(hdd_ctx);
+}
+
+/**
+ * wlan_hdd_pm_qos_remove_request() - remove PM QoS request
+ * @context: HDD context
+ *
+ * Return: None
+ */
+static inline void wlan_hdd_pm_qos_remove_request(hdd_cb_handle context)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
+	hdd_pm_qos_remove_request(hdd_ctx);
+}
+
+/**
+ * wlan_hdd_send_mscs_action_frame() - Send MSCS action frame
+ * @context: HDD context
+ * @vdev_id: Vdev ID
+ *
+ * Return: None
+ */
+static inline void wlan_hdd_send_mscs_action_frame(hdd_cb_handle context,
+						   uint8_t vdev_id)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return;
+	}
+	hdd_send_mscs_action_frame(hdd_ctx, adapter);
+}
+
+#else
+static inline void hdd_pld_remove_pm_qos(hdd_cb_handle context)
+{
+}
+
+static inline void hdd_pld_request_pm_qos(hdd_cb_handle context)
+{
+}
+
+static inline void
+wlan_hdd_pm_qos_update_request(hdd_cb_handle context,
+			       cpumask_t *pm_qos_cpu_mask)
+{
+}
+
+static inline void wlan_hdd_pm_qos_add_request(hdd_cb_handle context)
+{
+}
+
+static inline void wlan_hdd_pm_qos_remove_request(hdd_cb_handle context)
+{
+}
+
+static inline void wlan_hdd_send_mscs_action_frame(hdd_cb_handle context,
+						   uint8_t vdev_id)
+{
+}
+#endif
+
+/**
+ * hdd_dp_register_callbacks() - Register DP callbacks with HDD
+ * @hdd_ctx: HDD context
+ *
+ * Return: None
+ */
+static void hdd_dp_register_callbacks(struct hdd_context *hdd_ctx)
+{
+	struct wlan_dp_psoc_callbacks cb_obj = {0};
+
+	cb_obj.callback_ctx = (hdd_cb_handle)hdd_ctx;
+	cb_obj.wlan_dp_sta_get_dot11mode = wlan_hdd_sta_get_dot11mode;
+	cb_obj.wlan_dp_get_ap_client_count = wlan_hdd_get_ap_client_count;
+	cb_obj.wlan_dp_sta_ndi_connected = wlan_hdd_sta_ndi_connected;
+	cb_obj.dp_any_adapter_connected = hdd_any_adapter_connected;
+	cb_obj.dp_send_svc_nlink_msg = wlan_hdd_send_svc_nlink_msg;
+	cb_obj.dp_pld_remove_pm_qos = hdd_pld_remove_pm_qos;
+	cb_obj.dp_pld_request_pm_qos = hdd_pld_request_pm_qos;
+	cb_obj.dp_pktlog_enable_disable = wlan_hdd_pktlog_enable_disable;
+	cb_obj.dp_pm_qos_update_cpu_mask = hdd_pm_qos_update_cpu_mask;
+	cb_obj.dp_pm_qos_update_request = wlan_hdd_pm_qos_update_request;
+	cb_obj.dp_pm_qos_add_request = wlan_hdd_pm_qos_add_request;
+	cb_obj.dp_pm_qos_remove_request = wlan_hdd_pm_qos_remove_request;
+	cb_obj.dp_send_mscs_action_frame = wlan_hdd_send_mscs_action_frame;
+	cb_obj.dp_is_roaming_in_progress = wlan_hdd_is_roaming_in_progress;
+	cb_obj.wlan_dp_display_tx_multiq_stats =
+		wlan_hdd_display_tx_multiq_stats;
+	cb_obj.wlan_dp_display_netif_queue_history =
+		wlan_hdd_display_netif_queue_history;
+	cb_obj.dp_is_ap_active = hdd_is_ap_active;
+	cb_obj.dp_napi_apply_throughput_policy =
+		wlan_hdd_napi_apply_throughput_policy;
+	cb_obj.dp_is_link_adapter = hdd_is_link_adapter;
+	cb_obj.dp_nud_failure_work = hdd_nud_failure_work;
+	cb_obj.dp_get_pause_map = hdd_get_pause_map;
+
+	cb_obj.dp_get_nw_intf_mac_by_vdev_mac =
+		hdd_get_nw_adapter_mac_by_vdev_mac;
+	cb_obj.dp_get_tx_resource = hdd_get_tx_resource;
+	cb_obj.dp_get_tx_flow_low_watermark = hdd_get_tx_flow_low_watermark;
+	cb_obj.dp_get_tsf_time = hdd_get_tsf_time_cb;
+	cb_obj.dp_tsf_timestamp_rx = hdd_tsf_timestamp_rx;
+	cb_obj.dp_gro_rx_legacy_get_napi = hdd_legacy_gro_get_napi;
+
+	os_if_dp_register_hdd_callbacks(hdd_ctx->psoc, &cb_obj);
+}
+
 /**
  * __hdd_adapter_param_update_work() - Gist of the work to process
  *				       netdev feature update.
@@ -11903,18 +12412,24 @@ wlan_hdd_display_adapter_netif_queue_history(struct hdd_adapter *adapter)
 
 /**
  * wlan_hdd_display_netif_queue_history() - display netif queue history
- * @hdd_ctx: hdd context
+ * @context: hdd context
  *
  * Return: none
  */
 void
-wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
+wlan_hdd_display_netif_queue_history(hdd_cb_handle context,
 				     enum qdf_stats_verbosity_level verb_lvl)
 {
 	struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(context);
 	wlan_net_dev_ref_dbgid dbgid =
 				NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY;
 
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+
 	if (verb_lvl == QDF_STATS_VERBOSITY_LEVEL_LOW) {
 		hdd_display_netif_queue_history_compact(hdd_ctx);
 		return;

+ 14 - 8
core/hdd/src/wlan_hdd_nud_tracking.c

@@ -347,17 +347,23 @@ static void __hdd_nud_failure_work(struct hdd_adapter *adapter)
 	hdd_exit();
 }
 
-/**
- * hdd_nud_failure_work() - work for nud event
- * @data: Pointer to hdd_adapter
- *
- * Return: None
- */
-static void hdd_nud_failure_work(void *data)
+void hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id)
 {
-	struct hdd_adapter *adapter = data;
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
 	struct osif_vdev_sync *vdev_sync;
 
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return;
+	}
+
 	if (osif_vdev_sync_op_start(adapter->dev, &vdev_sync))
 		return;
 

+ 14 - 0
core/hdd/src/wlan_hdd_nud_tracking.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -157,6 +158,14 @@ void hdd_nud_flush_work(struct hdd_adapter *adapter);
  */
 void hdd_nud_indicate_roam(struct hdd_adapter *adapter);
 
+/**
+ * hdd_nud_failure_work() - Handle NUD failuire work
+ * @context: HDD context pointer
+ * @vdev_id: vdev id
+ *
+ * Return: None
+ */
+void hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id);
 #else
 static inline void hdd_nud_set_gateway_addr(struct hdd_adapter *adapter,
 					    struct qdf_mac_addr gw_mac_addr)
@@ -205,5 +214,10 @@ static inline void
 hdd_nud_indicate_roam(struct hdd_adapter *adapter)
 {
 }
+
+static inline void
+hdd_nud_failure_work(hdd_cb_handle context, uint8_t vdev_id)
+{
+}
 #endif /* WLAN_NUD_TRACKING */
 #endif /* end  of _WLAN_NUD_TRACKING_H_ */

+ 17 - 4
core/hdd/src/wlan_hdd_stats.c

@@ -7207,15 +7207,29 @@ int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature)
 }
 
 #ifdef TX_MULTIQ_PER_AC
-static inline
-void wlan_hdd_display_tx_multiq_stats(struct hdd_tx_rx_stats *stats)
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
 {
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+	struct hdd_tx_rx_stats *stats;
 	uint32_t total_inv_sk_and_skb_hash = 0;
 	uint32_t total_qselect_existing_skb_hash = 0;
 	uint32_t total_qselect_sk_tx_map = 0;
 	uint32_t total_qselect_skb_hash = 0;
 	uint8_t i;
 
+	hdd_ctx = hdd_cb_handle_to_context(context);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is null");
+		return;
+	}
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is null");
+		return;
+	}
+	stats = &adapter->hdd_stats.tx_rx_stats;
+
 	for (i = 0; i < NUM_CPUS; i++) {
 		total_inv_sk_and_skb_hash +=
 					  stats->per_cpu[i].inv_sk_and_skb_hash;
@@ -7231,8 +7245,7 @@ void wlan_hdd_display_tx_multiq_stats(struct hdd_tx_rx_stats *stats)
 		  total_qselect_sk_tx_map, total_qselect_skb_hash);
 }
 #else
-static inline
-void wlan_hdd_display_tx_multiq_stats(struct hdd_tx_rx_stats *stats)
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
 {
 }
 #endif

+ 9 - 0
core/hdd/src/wlan_hdd_stats.h

@@ -583,6 +583,15 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *hdd_ctx);
 void hdd_get_max_tx_bitrate(struct hdd_context *hdd_ctx,
 			    struct hdd_adapter *adapter);
 
+/**
+ * wlan_hdd_display_tx_multiq_stats() - display Tx multi queue stats
+ * @context: hdd context
+ * @vdev_id: vdev id
+ *
+ * Return: none
+ */
+void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id);
+
 /**
  * hdd_report_max_rate() - Fill the max rate stats in the station info structure
  * to be sent to the userspace.

+ 77 - 10
core/hdd/src/wlan_hdd_tx_rx.c

@@ -414,9 +414,21 @@ void hdd_deregister_tx_flow_control(struct hdd_adapter *adapter)
 	}
 }
 
-void hdd_get_tx_resource(struct hdd_adapter *adapter,
-			 struct qdf_mac_addr *mac_addr, uint16_t timer_value)
+void hdd_get_tx_resource(uint8_t vdev_id,
+			 struct qdf_mac_addr *mac_addr)
 {
+	struct hdd_adapter *adapter;
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	uint16_t timer_value = WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME;
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter)
+		return;
+
+	if (adapter->device_mode == QDF_P2P_GO_MODE ||
+	    adapter->device_mode == QDF_SAP_MODE)
+		timer_value = WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME;
+
 	if (false ==
 	    cdp_fc_get_tx_resource(cds_get_context(QDF_MODULE_ID_SOC),
 				   OL_TXRX_PDEV_ID,
@@ -440,8 +452,56 @@ void hdd_get_tx_resource(struct hdd_adapter *adapter,
 		}
 	}
 }
+
+unsigned int
+hdd_get_tx_flow_low_watermark(hdd_cb_handle cb_ctx, uint8_t intf_id)
+{
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(cb_ctx);
+	struct hdd_adapter *adapter;
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, intf_id);
+	if (!adapter)
+		return 0;
+
+	return adapter->tx_flow_low_watermark;
+}
 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
 
+#ifdef RECEIVE_OFFLOAD
+qdf_napi_struct
+*hdd_legacy_gro_get_napi(qdf_nbuf_t nbuf, bool enable_rxthread)
+{
+	struct qca_napi_info *qca_napii;
+	struct qca_napi_data *napid;
+	struct napi_struct *napi_to_use;
+
+	napid = hdd_napi_get_all();
+	if (unlikely(!napid))
+		return NULL;
+
+	qca_napii = hif_get_napi(QDF_NBUF_CB_RX_CTX_ID(nbuf), napid);
+	if (unlikely(!qca_napii))
+		return NULL;
+
+	/*
+	 * As we are breaking context in Rxthread mode, there is rx_thread NAPI
+	 * corresponds each hif_napi.
+	 */
+	if (enable_rxthread)
+		napi_to_use =  &qca_napii->rx_thread_napi;
+	else
+		napi_to_use = &qca_napii->napi;
+
+	return (qdf_napi_struct *)napi_to_use;
+}
+#else
+qdf_napi_struct
+*hdd_legacy_gro_get_napi(qdf_nbuf_t nbuf, bool enable_rxthread)
+{
+	return NULL;
+}
+#endif
+
 uint32_t hdd_txrx_get_tx_ack_count(struct hdd_adapter *adapter)
 {
 	return cdp_get_tx_ack_stats(cds_get_context(QDF_MODULE_ID_SOC),
@@ -2176,20 +2236,27 @@ void hdd_disable_rx_ol_for_low_tput(struct hdd_context *hdd_ctx, bool disable)
 #endif /* RECEIVE_OFFLOAD */
 
 #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)
+void hdd_tsf_timestamp_rx(hdd_cb_handle ctx, qdf_nbuf_t netbuf)
 {
+	struct hdd_context *hdd_ctx = hdd_cb_handle_to_context(ctx);
+
 	if (!hdd_tsf_is_rx_set(hdd_ctx))
 		return;
 
-	hdd_rx_timestamp(netbuf, target_time);
+	hdd_rx_timestamp(netbuf, ktime_to_us(netbuf->tstamp));
 }
-#else
-static inline void hdd_tsf_timestamp_rx(struct hdd_context *hdd_ctx,
-					qdf_nbuf_t netbuf,
-					uint64_t target_time)
+
+void hdd_get_tsf_time_cb(uint8_t vdev_id, uint64_t input_time,
+			 uint64_t *tsf_time)
 {
+	struct hdd_adapter *adapter;
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter)
+		return;
+
+	hdd_get_tsf_time(adapter, input_time, tsf_time);
 }
 #endif