qcacld-3.0: Add timer for resuming OS-netdev queues

1) Add timer callback function for resuming OS netdev queues once
they have been paused.
2) Add HDD function to register resume timer callback for High Latency
Data Path Flow Control.
HL netdev flow control will re-use some of the
QCA_LL_LEGACY_TX_FLOW_CONTROL functionality, hence some parts of the
legacy flow control code have been conditionally enabled for
QCA_HL_NETDEV_FLOW_CONTROL as well.

Change-Id: I4d4a03ddd5be980ce27fd0771fa9d6dc26138357
CRs-fixed: 2236321
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index dac0b32..e4a3126 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -321,6 +321,32 @@
 		hdd_send_rps_ind(adapter);
 }
 
+#ifdef QCA_HL_NETDEV_FLOW_CONTROL
+void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
+			   enum netif_action_type action)
+{
+	if (!adapter->tx_flow_timer_initialized)
+		return;
+
+	if (action == WLAN_WAKE_NON_PRIORITY_QUEUE) {
+		qdf_mc_timer_stop(&adapter->tx_flow_control_timer);
+	} else if (action == WLAN_STOP_NON_PRIORITY_QUEUE) {
+		QDF_STATUS status =
+		qdf_mc_timer_start(&adapter->tx_flow_control_timer,
+				   WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
+
+		if (!QDF_IS_STATUS_SUCCESS(status))
+			hdd_err("Failed to start tx_flow_control_timer");
+		else
+			adapter->
+			hdd_stats.tx_rx_stats.txflow_timer_cnt++;
+
+		adapter->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
+		adapter->hdd_stats.tx_rx_stats.is_txflow_paused = true;
+	}
+}
+#endif /* QCA_HL_NETDEV_FLOW_CONTROL */
+
 /**
  * wlan_hdd_txrx_pause_cb() - pause callback from txrx layer
  * @vdev_id: vdev_id
@@ -340,7 +366,7 @@
 		return;
 	}
 	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
-
+	wlan_hdd_mod_fc_timer(adapter, action);
 	wlan_hdd_netif_queue_control(adapter, action, reason);
 }
 
@@ -4807,6 +4833,9 @@
 		hdd_err("Interface %s wow debug_fs init failed",
 			netdev_name(adapter->dev));
 
+	hdd_register_hl_netdev_fc_timer(adapter,
+					hdd_tx_resume_timer_expired_handler);
+
 	hdd_info("%s interface created. iftype: %d", netdev_name(adapter->dev),
 		 session_type);
 
@@ -5200,6 +5229,8 @@
 		break;
 	}
 
+	hdd_deregister_hl_netdev_fc_timer(adapter);
+
 	if (adapter->scan_info.default_scan_ies) {
 		qdf_mem_free(adapter->scan_info.default_scan_ies);
 		adapter->scan_info.default_scan_ies = NULL;