[qca-nss-drv] Move nss_subsystem_dataplane_register into per core instance

Dynamic interfaces can be allocated on each core so the subsystem dataplane
needs to be in the per core instnace, not the top instance

Change-Id: Ida248107d686e4074a122d1d0813b3b5a32eae8b
Signed-off-by: Stephen Wang <wstephen@codeaurora.org>
diff --git a/nss_wifi.c b/nss_wifi.c
index 4472210..da48f09 100644
--- a/nss_wifi.c
+++ b/nss_wifi.c
@@ -136,7 +136,7 @@
 	 * Get callback & context
 	 */
 	cb = (nss_wifi_msg_callback_t)ncm->cb;
-	ctx =  nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+	ctx = nss_ctx->subsys_dp_register[ncm->interface].ndev;
 
 	/*
 	 * call wifi msg callback
@@ -220,19 +220,22 @@
 			nss_wifi_callback_t wifi_ext_callback,
 			nss_wifi_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
 {
-        nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES));
+	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
 
-        nss_info("nss_register_wifi_if if_num %d wifictx %p", if_num, netdev);
+	nss_assert(nss_ctx);
+	nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES));
 
-	nss_top_main.subsys_dp_register[if_num].ndev = netdev;
-	nss_top_main.subsys_dp_register[if_num].cb = wifi_callback;
-	nss_top_main.subsys_dp_register[if_num].ext_cb = wifi_ext_callback;
-	nss_top_main.subsys_dp_register[if_num].app_data = NULL;
-	nss_top_main.subsys_dp_register[if_num].features = features;
+	nss_info("%p: nss_register_wifi_if if_num %d wifictx %p", nss_ctx, if_num, netdev);
+
+	nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+	nss_ctx->subsys_dp_register[if_num].cb = wifi_callback;
+	nss_ctx->subsys_dp_register[if_num].ext_cb = wifi_ext_callback;
+	nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+	nss_ctx->subsys_dp_register[if_num].features = features;
 
 	nss_top_main.wifi_msg_callback = event_callback;
 
-	return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
+	return nss_ctx;
 }
 
 /*
@@ -241,13 +244,16 @@
  */
 void nss_unregister_wifi_if(uint32_t if_num)
 {
-        nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES));
+	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
 
-	nss_top_main.subsys_dp_register[if_num].ndev = NULL;
-	nss_top_main.subsys_dp_register[if_num].cb = NULL;
-	nss_top_main.subsys_dp_register[if_num].ext_cb = NULL;
-	nss_top_main.subsys_dp_register[if_num].app_data = NULL;
-	nss_top_main.subsys_dp_register[if_num].features = 0;
+	nss_assert(nss_ctx);
+	nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES));
+
+	nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+	nss_ctx->subsys_dp_register[if_num].cb = NULL;
+	nss_ctx->subsys_dp_register[if_num].ext_cb = NULL;
+	nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+	nss_ctx->subsys_dp_register[if_num].features = 0;
 }
 
 /*