[qca-nss-drv] Split host to NSS command/data queues

Change-Id: I30a4215fe7742262cd6a7b0c2bd0865ce6dffd7f
Signed-off-by: Stephen Wang <wstephen@codeaurora.org>
diff --git a/nss_freq.c b/nss_freq.c
index d21903a..0bfbf7c 100644
--- a/nss_freq.c
+++ b/nss_freq.c
@@ -1,6 +1,6 @@
 /*
  **************************************************************************
- * Copyright (c) 2013, 2015-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013, 2015-2018 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
  * above copyright notice and this permission notice appear in all copies.
@@ -236,43 +236,19 @@
  */
 nss_tx_status_t nss_freq_change(struct nss_ctx_instance *nss_ctx, uint32_t eng, uint32_t stats_enable, uint32_t start_or_end)
 {
-	struct sk_buff *nbuf;
-	int32_t status;
-	struct nss_corefreq_msg *ncm;
+	struct nss_corefreq_msg ncm;
 	struct nss_freq_msg *nfc;
 
 	nss_info("%p: frequency changing to: %d\n", nss_ctx, eng);
 
-	NSS_VERIFY_CTX_MAGIC(nss_ctx);
-	if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) {
-		return NSS_TX_FAILURE_NOT_READY;
-	}
-
-	nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
-	if (unlikely(!nbuf)) {
-		NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]);
-		return NSS_TX_FAILURE;
-	}
-
-	ncm = (struct nss_corefreq_msg *)skb_put(nbuf, sizeof(struct nss_corefreq_msg));
-
-	nss_freq_msg_init(ncm, NSS_COREFREQ_INTERFACE, NSS_TX_METADATA_TYPE_NSS_FREQ_CHANGE,
+	nss_freq_msg_init(&ncm, NSS_COREFREQ_INTERFACE, NSS_TX_METADATA_TYPE_NSS_FREQ_CHANGE,
 				sizeof(struct nss_freq_msg), NULL, NULL);
-	nfc = &ncm->msg.nfc;
+	nfc = &ncm.msg.nfc;
 	nfc->frequency = eng;
 	nfc->start_or_end = start_or_end;
 	nfc->stats_enable = stats_enable;
 
-	status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_CMD_QUEUE, H2N_BUFFER_CTRL, 0);
-	if (status != NSS_CORE_STATUS_SUCCESS) {
-		dev_kfree_skb_any(nbuf);
-		nss_info("%p: unable to enqueue 'nss frequency change' - marked as stopped\n", nss_ctx);
-		return NSS_TX_FAILURE;
-	}
-
-	nss_hal_send_interrupt(nss_ctx, NSS_H2N_INTR_DATA_COMMAND_QUEUE);
-
-	return NSS_TX_SUCCESS;
+	return nss_core_send_cmd(nss_ctx, &ncm, sizeof(ncm), NSS_NBUF_PAYLOAD_SIZE);
 }
 
 /*