Browse Source

qcacld-3.0: Enabling RPS for STA in STA+SAP mode

In STA+SAP mode, RPS is enabled only for SAP interface and
not for STA interface resulting in low throughput as STA RX
will also take the IPA path.
To fix this, enable/disable RPS when SAP is turned on/off
when IPA is enabled

Change-Id: I67c0da2fbbb43bd7b34969bbb05c1127e60d5673
CRs-Fixed: 2783136
Ananya Gupta 4 years ago
parent
commit
b7b97c1bc5

+ 55 - 0
components/ipa/core/inc/wlan_ipa_core.h

@@ -554,6 +554,61 @@ void wlan_ipa_reg_send_to_nw_cb(struct wlan_ipa_priv *ipa_ctx,
 	ipa_ctx->send_to_nw = cb;
 }
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+/**
+ * wlan_ipa_reg_rps_enable_cb() - Register callback to enable RPS
+ * @ipa_ctx: IPA context
+ * @cb: callback
+ *
+ * Return: None
+ */
+static inline
+void wlan_ipa_reg_rps_enable_cb(struct wlan_ipa_priv *ipa_ctx,
+				wlan_ipa_rps_enable cb)
+{
+	ipa_ctx->rps_enable = cb;
+}
+
+/**
+ * ipa_set_rps_enable(): Enable/disable RPS for all interfaces of specific mode
+ * @ipa_ctx: IPA context
+ * @mode: mode of interface for which RPS needs to be enabled
+ * @enable: Set true to enable RPS
+ *
+ * Return: None
+ */
+void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
+		 bool enable);
+
+/**
+ * ipa_set_rps_per_vdev(): Enable/disable RPS for a specific vdev
+ * @ipa_ctx: IPA context
+ * @vdev_id: vdev id for which RPS needs to be enabled
+ * @enable: Set true to enable RPS
+ *
+ * Return: None
+ */
+static inline
+void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id,
+			  bool enable)
+{
+	ipa_ctx->rps_enable(vdev_id, enable);
+}
+
+#else
+static inline
+void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
+		 bool enable)
+{
+}
+
+static inline
+void ipa_set_rps_per_vdev(struct wlan_ipa_priv *ipa_ctx, uint8_t vdev_id,
+			  bool enable)
+{
+}
+#endif
+
 /**
  * wlan_ipa_set_mcc_mode() - Set MCC mode
  * @ipa_ctx: IPA context

+ 13 - 0
components/ipa/core/inc/wlan_ipa_main.h

@@ -256,6 +256,18 @@ void ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
 void ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
 			   wlan_ipa_send_to_nw cb);
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+/**
+ * ipa_reg_rps_enable_cb() - Register cb to enable RPS
+ * @pdev: pdev obj
+ * @cb: callback
+ *
+ * Return: None
+ */
+void ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+			   wlan_ipa_rps_enable cb);
+#endif
+
 /**
  * ipa_set_mcc_mode() - Set MCC mode
  * @pdev: pdev obj
@@ -492,6 +504,7 @@ bool ipa_is_ready(void);
 #else /* Not IPA_OFFLOAD */
 typedef QDF_STATUS (*wlan_ipa_softap_xmit)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
 typedef void (*wlan_ipa_send_to_nw)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
+typedef void (*wlan_ipa_rps_enable)(uint8_t vdev_id, bool enable);
 
 #endif /* IPA_OFFLOAD */
 #endif /* end  of _WLAN_IPA_MAIN_H_ */

+ 12 - 0
components/ipa/core/inc/wlan_ipa_priv.h

@@ -584,6 +584,13 @@ struct wlan_ipa_tx_desc {
 typedef QDF_STATUS (*wlan_ipa_softap_xmit)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
 typedef void (*wlan_ipa_send_to_nw)(qdf_nbuf_t nbuf, qdf_netdev_t dev);
 
+/**
+ * typedef wlan_ipa_rps_enable - Enable/disable RPS for adapter using vdev id
+ * @vdev_id: vdev_id of adapter
+ * @enable: Set true to enable RPS
+ */
+typedef void (*wlan_ipa_rps_enable)(uint8_t vdev_id, bool enable);
+
 /* IPA private context structure definition */
 struct wlan_ipa_priv {
 	struct wlan_objmgr_pdev *pdev;
@@ -691,6 +698,11 @@ struct wlan_ipa_priv {
 	wlan_ipa_send_to_nw send_to_nw;
 	ipa_uc_offload_control_req ipa_tx_op;
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+	/*Callback to enable RPS for STA in STA+SAP scenario*/
+	wlan_ipa_rps_enable rps_enable;
+#endif
+
 	qdf_event_t ipa_resource_comp;
 
 	uint32_t wdi_version;

+ 32 - 0
components/ipa/core/src/wlan_ipa_core.c

@@ -1592,6 +1592,26 @@ end:
 
 #if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
     defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_QCA6750)
+
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void ipa_set_rps(struct wlan_ipa_priv *ipa_ctx, enum QDF_OPMODE mode,
+		 bool enable)
+{
+	struct wlan_ipa_iface_context *iface_ctx;
+	wlan_ipa_rps_enable cb = ipa_ctx->rps_enable;
+	int i;
+
+	if (!cb)
+		return;
+
+	for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
+		iface_ctx = &ipa_ctx->iface_context[i];
+		if (iface_ctx->device_mode == mode)
+			cb(iface_ctx->session_id, enable);
+	}
+}
+#endif
+
 /**
  * wlan_ipa_uc_handle_first_con() - Handle first uC IPA connection
  * @ipa_ctx: IPA context
@@ -1607,6 +1627,9 @@ static QDF_STATUS wlan_ipa_uc_handle_first_con(struct wlan_ipa_priv *ipa_ctx)
 		return QDF_STATUS_E_PERM;
 	}
 
+	if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sta_connected)
+		ipa_set_rps(ipa_ctx, QDF_STA_MODE, true);
+
 	if (wlan_ipa_uc_enable_pipes(ipa_ctx) != QDF_STATUS_SUCCESS) {
 		ipa_err("IPA WDI Pipe activation failed");
 		return QDF_STATUS_E_BUSY;
@@ -1625,6 +1648,9 @@ void wlan_ipa_uc_handle_last_discon(struct wlan_ipa_priv *ipa_ctx,
 
 	wlan_ipa_uc_disable_pipes(ipa_ctx, force_disable);
 
+	if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sta_connected)
+		ipa_set_rps(ipa_ctx, QDF_STA_MODE, false);
+
 	ipa_debug("exit: IPA WDI Pipes deactivated");
 }
 
@@ -2199,6 +2225,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode,
 
 		ipa_ctx->sta_connected++;
 
+		if (qdf_ipa_get_lan_rx_napi() && ipa_ctx->sap_num_connected_sta)
+			ipa_set_rps_per_vdev(ipa_ctx, session_id, true);
+
 		qdf_mutex_release(&ipa_ctx->event_lock);
 
 		ipa_debug("sta_connected=%d vdev_to_iface[%u] %u",
@@ -2325,6 +2354,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode,
 		if (iface_ctx)
 			wlan_ipa_cleanup_iface(iface_ctx);
 
+		if (qdf_ipa_get_lan_rx_napi())
+			ipa_set_rps_per_vdev(ipa_ctx, session_id, false);
+
 		qdf_mutex_release(&ipa_ctx->event_lock);
 
 		ipa_debug("sta_connected=%d", ipa_ctx->sta_connected);

+ 24 - 0
components/ipa/core/src/wlan_ipa_main.c

@@ -347,6 +347,30 @@ void ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
 	return wlan_ipa_reg_send_to_nw_cb(ipa_obj, cb);
 }
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+			   wlan_ipa_rps_enable cb)
+{
+	struct wlan_ipa_priv *ipa_obj;
+
+	if (!ipa_config_is_enabled()) {
+		ipa_debug("ipa is disabled");
+		return;
+	}
+
+	if (!ipa_is_ready())
+		return;
+
+	ipa_obj = ipa_pdev_get_priv_obj(pdev);
+	if (!ipa_obj) {
+		ipa_err("IPA object is NULL");
+		return;
+	}
+
+	return wlan_ipa_reg_rps_enable_cb(ipa_obj, cb);
+}
+#endif
+
 void ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
 {
 	struct wlan_ipa_priv *ipa_obj;

+ 24 - 0
components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h

@@ -176,6 +176,24 @@ void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
 void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
 				wlan_ipa_send_to_nw cb);
 
+/**
+ * ucfg_ipa_reg_rps_enable_cb() - Register cb to enable RPS
+ * @pdev: pdev obj
+ * @cb: callback
+ *
+ * Return: None
+ */
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+				wlan_ipa_rps_enable cb);
+#else
+static inline
+void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+				wlan_ipa_rps_enable cb)
+{
+}
+#endif
+
 /**
  * ucfg_ipa_set_mcc_mode() - Set MCC mode
  * @pdev: pdev obj
@@ -494,6 +512,12 @@ void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
 {
 }
 
+static inline
+void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+				wlan_ipa_rps_enable cb)
+{
+}
+
 static inline
 void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
 {

+ 7 - 0
components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c

@@ -104,8 +104,15 @@ void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
 				wlan_ipa_send_to_nw cb)
 {
 	return ipa_reg_send_to_nw_cb(pdev, cb);
+}
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void ucfg_ipa_reg_rps_enable_cb(struct wlan_objmgr_pdev *pdev,
+				wlan_ipa_rps_enable cb)
+{
+	return ipa_reg_rps_enable_cb(pdev, cb);
 }
+#endif
 
 void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
 {

+ 19 - 0
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -397,6 +397,25 @@ QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
 
 void hdd_send_rps_ind(struct hdd_adapter *adapter);
 void hdd_send_rps_disable_ind(struct hdd_adapter *adapter);
+
+/**
+ * hdd_adapter_set_rps() - Enable/disable RPS for mode specified
+ * @vdev_id: vdev id of adapter for which RPS needs to be enabled
+ * @enable: Set true to enable RPS in SAP mode
+ *
+ * Callback function registered with ipa
+ *
+ * Return: none
+ */
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void hdd_adapter_set_rps(uint8_t vdev_id, bool enable);
+#else
+static inline
+void hdd_adapter_set_rps(uint8_t vdev_id, bool enable)
+{
+}
+#endif
+
 void wlan_hdd_classify_pkt(struct sk_buff *skb);
 
 #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH

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

@@ -4047,7 +4047,8 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
 				 hdd_softap_ipa_start_xmit);
 	ucfg_ipa_reg_send_to_nw_cb(hdd_ctx->pdev,
 				   hdd_ipa_send_nbuf_to_network);
-
+	ucfg_ipa_reg_rps_enable_cb(hdd_ctx->pdev,
+				   hdd_adapter_set_rps);
 	hdd_exit();
 
 	return 0;

+ 26 - 0
core/hdd/src/wlan_hdd_tx_rx.c

@@ -3262,6 +3262,32 @@ void hdd_send_rps_disable_ind(struct hdd_adapter *adapter)
 	cds_cfg->rps_enabled = false;
 }
 
+#ifdef IPA_LAN_RX_NAPI_SUPPORT
+void hdd_adapter_set_rps(uint8_t vdev_id, bool enable)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (!hdd_ctx)
+		return;
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err_rl("Adapter not found for vdev_id: %d", vdev_id);
+		return;
+	}
+
+	hdd_debug("Set RPS to %d for vdev_id %d", enable, vdev_id);
+	if (!hdd_ctx->rps) {
+		if (enable)
+			hdd_send_rps_ind(adapter);
+		else
+			hdd_send_rps_disable_ind(adapter);
+	}
+}
+#endif
+
 void hdd_tx_queue_cb(hdd_handle_t hdd_handle, uint32_t vdev_id,
 		     enum netif_action_type action,
 		     enum netif_reason_type reason)