[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_lag.c b/nss_lag.c
index 772c6c8..7c9deca 100644
--- a/nss_lag.c
+++ b/nss_lag.c
@@ -72,22 +72,24 @@
 			 nss_lag_event_callback_t lag_ev_cb,
 			 struct net_device *netdev)
 {
+	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.ipv4_handler_id];
 	uint32_t features = 0;
 
+	nss_assert(nss_ctx);
 	nss_assert((if_num == NSS_LAG0_INTERFACE_NUM) || (if_num == NSS_LAG1_INTERFACE_NUM) ||
 		   (if_num == NSS_LAG2_INTERFACE_NUM) || (if_num == NSS_LAG3_INTERFACE_NUM));
 
-	nss_top_main.subsys_dp_register[if_num].ndev = netdev;
-	nss_top_main.subsys_dp_register[if_num].cb = lag_cb;
-	nss_top_main.subsys_dp_register[if_num].app_data = NULL;
-	nss_top_main.subsys_dp_register[if_num].features = features;
+	nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+	nss_ctx->subsys_dp_register[if_num].cb = lag_cb;
+	nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+	nss_ctx->subsys_dp_register[if_num].features = features;
 
 	nss_top_main.lag_event_callback = lag_ev_cb;
 
 	/*
 	 * Return the NSS driver context for LAG (same as for ipv4 functions)
 	 */
-	return (void *)&nss_top_main.nss[nss_top_main.ipv4_handler_id];
+	return (void *)nss_ctx;
 }
 EXPORT_SYMBOL(nss_register_lag_if);
 
@@ -97,13 +99,16 @@
  */
 void nss_unregister_lag_if(uint32_t if_num)
 {
+	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.ipv4_handler_id];
+
+	nss_assert(nss_ctx);
 	nss_assert((if_num == NSS_LAG0_INTERFACE_NUM) || (if_num == NSS_LAG1_INTERFACE_NUM) ||
 		   (if_num == NSS_LAG2_INTERFACE_NUM) || (if_num == NSS_LAG3_INTERFACE_NUM));
 
-	nss_top_main.subsys_dp_register[if_num].cb = NULL;
-	nss_top_main.subsys_dp_register[if_num].ndev = NULL;
-	nss_top_main.subsys_dp_register[if_num].app_data = NULL;
-	nss_top_main.subsys_dp_register[if_num].features = 0;
+	nss_ctx->subsys_dp_register[if_num].cb = NULL;
+	nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+	nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+	nss_ctx->subsys_dp_register[if_num].features = 0;
 
 	nss_top_main.lag_event_callback = NULL;
 }
@@ -160,7 +165,7 @@
 	 * callback
 	 */
 	cb = (nss_lag_event_callback_t)ncm->cb;
-	ctx = nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+	ctx = nss_ctx->subsys_dp_register[ncm->interface].ndev;
 
 	cb(ctx, lm);
 }