[qca-nss-drv] Adds priority based RPS

Allow users to map packets with certain priority to specified core.

Change-Id: I9439e957412d98e105696804c61b7f94fcf8bf1c
Signed-off-by: Cemil Coskun <ccoskun@codeaurora.org>
diff --git a/nss_n2h.c b/nss_n2h.c
index e09834a..24ea961 100644
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -33,7 +33,6 @@
 int nss_n2h_water_mark[NSS_MAX_CORES][2] __read_mostly = {{-1, -1}, {-1, -1} };
 int nss_n2h_paged_water_mark[NSS_MAX_CORES][2] __read_mostly = {{-1, -1}, {-1, -1} };
 int nss_n2h_wifi_pool_buf_cfg __read_mostly = -1;
-int nss_n2h_rps_config __read_mostly;
 int nss_n2h_core0_mitigation_cfg __read_mostly = 1;
 int nss_n2h_core1_mitigation_cfg __read_mostly = 1;
 int nss_n2h_core0_add_buf_pool_size __read_mostly;
@@ -132,33 +131,6 @@
 }
 
 /*
- * nss_n2h_rps_cfg_callback()
- *	call back function for rps configuration
- */
-static void nss_n2h_rps_cfg_callback(void *app_data, struct nss_n2h_msg *nnm)
-{
-	struct nss_ctx_instance *nss_ctx =  (struct nss_ctx_instance *)app_data;
-	if (nnm->cm.response != NSS_CMN_RESPONSE_ACK) {
-
-		/*
-		 * Error, hence we are not updating the nss_n2h_empty_pool_buf
-		 * Restore the current_value to its previous state
-		 */
-		nss_n2h_rcp.response = NSS_FAILURE;
-		complete(&nss_n2h_rcp.complete);
-		nss_warning("%p: RPS configuration failed : %d\n", nss_ctx,
-								   nnm->cm.error);
-		return;
-	}
-
-	nss_info("%p: RPS configuration succeeded: %d\n", nss_ctx,
-							   nnm->cm.error);
-	nss_ctx->n2h_rps_en = nnm->msg.rps_cfg.enable;
-	nss_n2h_rcp.response = NSS_SUCCESS;
-	complete(&nss_n2h_rcp.complete);
-}
-
-/*
  * nss_n2h_mitigation_cfg_callback()
  *	call back function for mitigation configuration
  */
@@ -259,7 +231,7 @@
 
 /*
  * nss_n2h_set_wifi_payloads_callback()
- * 	call back function for response to wifi pool configuration
+ *	call back function for response to wifi pool configuration
  *
  */
 static void nss_n2h_set_wifi_payloads_callback(void *app_data,
@@ -1047,8 +1019,8 @@
 	cfg = &nnm.msg.pn_q_cfg;
 
 	/*
-         * Update limits
-         */
+	 * Update limits
+	 */
 	for (i = 0; i < NSS_MAX_NUM_PRI; i++) {
 		cfg->qlimits[i] = qlimits[i];
 	}
@@ -1097,8 +1069,8 @@
 	cfg = &nnm.msg.pn_q_cfg;
 
 	/*
-         * Update limits
-         */
+	 * Update limits
+	 */
 	for (i = 0; i < NSS_MAX_NUM_PRI; i++) {
 		cfg->qlimits[i] = qlimits[i];
 	}
@@ -1127,59 +1099,6 @@
 EXPORT_SYMBOL(nss_n2h_update_queue_config_sync);
 
 /*
- * nss_n2h_rps_cfg()
- *	Send Message to NSS to enable RPS.
- */
-static nss_tx_status_t nss_n2h_rps_cfg(struct nss_ctx_instance *nss_ctx, int enable_rps)
-{
-	struct nss_n2h_msg nnm;
-	struct nss_n2h_rps *rps_cfg;
-	nss_tx_status_t nss_tx_status;
-	int ret;
-
-	down(&nss_n2h_rcp.sem);
-	nss_n2h_msg_init(&nnm, NSS_N2H_INTERFACE, NSS_TX_METADATA_TYPE_N2H_RPS_CFG,
-			sizeof(struct nss_n2h_rps),
-			nss_n2h_rps_cfg_callback,
-			(void *)nss_ctx);
-
-	rps_cfg = &nnm.msg.rps_cfg;
-	rps_cfg->enable = enable_rps;
-
-	nss_tx_status = nss_n2h_tx_msg(nss_ctx, &nnm);
-
-	if (nss_tx_status != NSS_TX_SUCCESS) {
-		nss_warning("%p: nss_tx error setting rps\n", nss_ctx);
-
-		up(&nss_n2h_rcp.sem);
-		return NSS_FAILURE;
-	}
-
-	/*
-	 * Blocking call, wait till we get ACK for this msg.
-	 */
-	ret = wait_for_completion_timeout(&nss_n2h_rcp.complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT));
-	if (ret == 0) {
-		nss_warning("%p: Waiting for ack timed out\n", nss_ctx);
-		up(&nss_n2h_rcp.sem);
-		return NSS_FAILURE;
-	}
-
-	/*
-	 * ACK/NACK received from NSS FW
-	 * If ACK: Callback function will update nss_n2h_empty_pool_buf with
-	 * nss_n2h_nepbcfgp.num_conn_valid, which holds the user input
-	 */
-	if (NSS_FAILURE == nss_n2h_rcp.response) {
-		up(&nss_n2h_rcp.sem);
-		return NSS_FAILURE;
-	}
-
-	up(&nss_n2h_rcp.sem);
-	return NSS_SUCCESS;
-}
-
-/*
  * nss_n2h_mitigation_cfg()
  *	Send Message to NSS to disable MITIGATION.
  */
@@ -1290,8 +1209,8 @@
 		}
 
 		/*
-	 	 * Blocking call, wait till we get ACK for this msg.
-	 	 */
+		 * Blocking call, wait till we get ACK for this msg.
+		 */
 		ret = wait_for_completion_timeout(&nss_n2h_bufcp[core_num].complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT));
 		if (ret == 0) {
 			nss_warning("%p: Waiting for ack timed out\n", nss_ctx);
@@ -1316,37 +1235,6 @@
 	return NSS_FAILURE;
 }
 
-/*
- * nss_rps_handler()
- *	Enable NSS RPS
- */
-static int nss_n2h_rpscfg_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-	struct nss_top_instance *nss_top = &nss_top_main;
-	struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
-	int ret;
-
-	ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
-	if (!ret) {
-		if ((write) && (nss_n2h_rps_config == 1)) {
-			printk(KERN_INFO "Enabling NSS RPS\n");
-
-			return nss_n2h_rps_cfg(nss_ctx, 1);
-		}
-
-		if ((write) && (nss_n2h_rps_config == 0)) {
-			printk(KERN_INFO "Runtime disabling of NSS RPS not supported\n");
-			return ret;
-		}
-
-		if (write) {
-			printk(KERN_INFO "Invalid input value.Valid values are 0 and 1\n");
-		}
-
-	}
-
-	return ret;
-}
 
 /*
  * nss_mitigation_handler()
@@ -1582,13 +1470,6 @@
 		.proc_handler	= &nss_n2h_wifi_payloads_handler,
 	},
 	{
-		.procname	= "rps",
-		.data		= &nss_n2h_rps_config,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= &nss_n2h_rpscfg_handler,
-	},
-	{
 		.procname	= "mitigation_core0",
 		.data		= &nss_n2h_core0_mitigation_cfg,
 		.maxlen		= sizeof(int),
@@ -1651,7 +1532,7 @@
 
 /*
  * nss_n2h_flush_payloads()
- * 	Sends a command down to NSS for flushing all payloads
+ *	Sends a command down to NSS for flushing all payloads
  */
 nss_tx_status_t nss_n2h_flush_payloads(struct nss_ctx_instance *nss_ctx)
 {
@@ -1695,7 +1576,7 @@
 
 /*
  * nss_n2h_tx_msg()
- *	Send messages to NSS n2h pacakge
+ *	Send messages to NSS n2h package.
  */
 nss_tx_status_t nss_n2h_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_n2h_msg *nnm)
 {