[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_capwap.c b/nss_capwap.c
index f155879..9dcb6e3 100644
--- a/nss_capwap.c
+++ b/nss_capwap.c
@@ -489,7 +489,7 @@
}
spin_lock(&nss_capwap_spinlock);
- if (nss_ctx->nss_top->subsys_dp_register[if_num].ndev != NULL) {
+ if (nss_ctx->subsys_dp_register[if_num].ndev != NULL) {
spin_unlock(&nss_capwap_spinlock);
return NULL;
}
@@ -506,10 +506,10 @@
return NULL;
}
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = cb;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = netdev;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = features;
+ nss_ctx->subsys_dp_register[if_num].cb = cb;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].features = features;
return nss_ctx;
}
@@ -545,10 +545,10 @@
(void) nss_core_unregister_handler(if_num);
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = 0;
+ nss_ctx->subsys_dp_register[if_num].cb = NULL;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
kfree(h);
return true;
diff --git a/nss_cmn.c b/nss_cmn.c
index 5bd3728..9c2b108 100644
--- a/nss_cmn.c
+++ b/nss_cmn.c
@@ -74,7 +74,7 @@
* Check physical interface table
*/
for (i = 0; i < NSS_MAX_NET_INTERFACES; i++) {
- if (dev == ((struct nss_ctx_instance *)nss_ctx)->nss_top->subsys_dp_register[i].ndev) {
+ if (dev == nss_ctx->subsys_dp_register[i].ndev) {
return i;
}
}
@@ -103,7 +103,7 @@
return NULL;
}
- return nss_ctx->nss_top->subsys_dp_register[if_num].ndev;
+ return nss_ctx->subsys_dp_register[if_num].ndev;
}
/*
@@ -114,16 +114,18 @@
*/
int32_t nss_cmn_get_interface_number_by_dev(struct net_device *dev)
{
- int i;
+ int i, core;
nss_assert(dev != 0);
/*
- * Check physical interface table
+ * Check physical interface table on both cores
*/
- for (i = 0; i < NSS_MAX_NET_INTERFACES; i++) {
- if (dev == nss_top_main.subsys_dp_register[i].ndev) {
- return i;
+ for (core = 0; core < NSS_MAX_CORES; core++) {
+ for (i = 0; i < NSS_MAX_NET_INTERFACES; i++) {
+ if (dev == nss_top_main.nss[core].subsys_dp_register[i].ndev) {
+ return i;
+ }
}
}
diff --git a/nss_core.c b/nss_core.c
index 696e33d..fdad77b 100644
--- a/nss_core.c
+++ b/nss_core.c
@@ -254,7 +254,7 @@
static void nss_core_handle_crypto_pkt(struct nss_ctx_instance *nss_ctx, unsigned int interface_num,
struct sk_buff *nbuf, struct napi_struct *napi)
{
- struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_ctx->nss_top->subsys_dp_register[interface_num];
+ struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_ctx->subsys_dp_register[interface_num];
nss_phys_if_rx_callback_t cb;
struct net_device *ndev;
@@ -435,7 +435,7 @@
struct sk_buff *nbuf)
{
struct nss_top_instance *nss_top = nss_ctx->nss_top;
- struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_top->subsys_dp_register[interface_num];
+ struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_ctx->subsys_dp_register[interface_num];
struct net_device *ndev = NULL;
uint32_t xmit_ret;
@@ -507,7 +507,7 @@
uint16_t flags)
{
struct nss_top_instance *nss_top = nss_ctx->nss_top;
- struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_top->subsys_dp_register[interface_num];
+ struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_ctx->subsys_dp_register[interface_num];
struct net_device *ndev = NULL;
nss_phys_if_rx_callback_t cb;
@@ -580,7 +580,7 @@
uint16_t flags)
{
struct nss_top_instance *nss_top = nss_ctx->nss_top;
- struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_top->subsys_dp_register[interface_num];
+ struct nss_subsystem_dataplane_register *subsys_dp_reg = &nss_ctx->subsys_dp_register[interface_num];
struct net_device *ndev = NULL;
nss_phys_if_rx_ext_data_callback_t ext_cb;
diff --git a/nss_core.h b/nss_core.h
index 64104f1..c7faa01 100644
--- a/nss_core.h
+++ b/nss_core.h
@@ -864,6 +864,22 @@
};
/*
+ * NSS core <-> subsystem data plane registration related paramaters.
+ * This struct is filled with if_register/data_plane register APIs and
+ * retrieved when handling a data packet/skb destined to that subsystem.
+ */
+struct nss_subsystem_dataplane_register {
+ nss_phys_if_rx_callback_t cb; /* callback to be invoked */
+ nss_phys_if_rx_ext_data_callback_t ext_cb;
+ /* Extended data plane callback to be invoked.
+ This is needed if driver needs extended handling of data packet
+ before giving to stack */
+ void *app_data; /* additional info passed during callback(for future use) */
+ struct net_device *ndev; /* Netdevice associated with the interface */
+ uint32_t features; /* skb types supported by this subsystem */
+};
+
+/*
* NSS context instance (one per NSS core)
*/
struct nss_ctx_instance {
@@ -899,27 +915,13 @@
/* Current MTU value of physical interface */
uint64_t stats_n2h[NSS_STATS_N2H_MAX];
/* N2H node stats: includes node, n2h, pbuf in this order */
+ struct nss_subsystem_dataplane_register subsys_dp_register[NSS_MAX_NET_INTERFACES];
+ /* Subsystem registration data */
uint32_t magic;
/* Magic protection */
};
/*
- * NSS core <-> subsystem data plane registration related paramaters.
- * This struct is filled in if_register/data_plane register APIs & retrieved
- * when handling a data packet/skb destined to that subsystem interface.
- */
-struct nss_subsystem_dataplane_register {
- nss_phys_if_rx_callback_t cb; /* callback to be invoked */
- nss_phys_if_rx_ext_data_callback_t ext_cb;
- /* Extended data plane callback to be invoked.
- This is needed if driver needs extended handling of data packet
- before giving to stack */
- void *app_data; /* additional info passed during callback(for future use) */
- struct net_device *ndev; /* Netdevice associated with the interface */
- uint32_t features; /* skb types supported by this subsystem */
-};
-
-/*
* Main NSS context structure (singleton)
*/
struct nss_top_instance {
@@ -1000,9 +1002,6 @@
uint8_t trustsec_tx_handler_id;
uint8_t vlan_handler_id;
- /* subsystem registration data */
- struct nss_subsystem_dataplane_register subsys_dp_register[NSS_MAX_NET_INTERFACES];
-
/*
* Data/Message callbacks for various interfaces
*/
diff --git a/nss_crypto.c b/nss_crypto.c
index 75ad1e0..200deab 100644
--- a/nss_crypto.c
+++ b/nss_crypto.c
@@ -261,14 +261,14 @@
* Avoid multiple data callback registration with the
* sama interface number
*/
- if (nss_ctx->nss_top->subsys_dp_register[if_num].cb) {
+ if (nss_ctx->subsys_dp_register[if_num].cb) {
return nss_ctx;
}
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = cb;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = netdev;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = features;
+ nss_ctx->subsys_dp_register[if_num].cb = cb;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].features = features;
return nss_ctx;
}
@@ -287,14 +287,14 @@
/*
* if already unregistered then return
*/
- if (!nss_ctx->nss_top->subsys_dp_register[if_num].cb) {
+ if (!nss_ctx->subsys_dp_register[if_num].cb) {
return;
}
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = 0;
+ nss_ctx->subsys_dp_register[if_num].cb = NULL;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
}
/*
diff --git a/nss_data_plane/nss_data_plane_edma.c b/nss_data_plane/nss_data_plane_edma.c
index e107031..4b74ff6 100644
--- a/nss_data_plane/nss_data_plane_edma.c
+++ b/nss_data_plane/nss_data_plane_edma.c
@@ -239,10 +239,10 @@
nss_top->phys_if_handler_id[if_num] = nss_ctx->id;
nss_phys_if_register_handler(if_num);
- nss_top->subsys_dp_register[if_num].ndev = netdev;
- nss_top->subsys_dp_register[if_num].cb = nss_dp_receive;
- nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_top->subsys_dp_register[if_num].features = ndpp->features;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = nss_dp_receive;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = ndpp->features;
/*
* Now we are registered and our side is ready, if the data plane was opened, ask it to start again
@@ -287,13 +287,13 @@
*/
static void __nss_data_plane_unregister(void)
{
- struct nss_top_instance *nss_top = &nss_top_main;
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[NSS_CORE_0];
int i;
for (i = 1; i < NSS_DATA_PLANE_EDMA_MAX_INTERFACES + 1; i++) {
- if (nss_top->subsys_dp_register[i].ndev) {
+ if (nss_ctx->subsys_dp_register[i].ndev) {
nss_data_plane_unregister_from_nss_dp(i);
- nss_top->subsys_dp_register[i].ndev = NULL;
+ nss_ctx->subsys_dp_register[i].ndev = NULL;
}
}
}
diff --git a/nss_data_plane/nss_data_plane_gmac.c b/nss_data_plane/nss_data_plane_gmac.c
index 42d189e..298b9d1 100644
--- a/nss_data_plane/nss_data_plane_gmac.c
+++ b/nss_data_plane/nss_data_plane_gmac.c
@@ -210,10 +210,10 @@
nss_top->phys_if_handler_id[if_num] = nss_ctx->id;
nss_phys_if_register_handler(if_num);
- nss_top->subsys_dp_register[if_num].ndev = netdev;
- nss_top->subsys_dp_register[if_num].cb = nss_gmac_receive;
- nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_top->subsys_dp_register[if_num].features = ndpp->features;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = nss_gmac_receive;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = ndpp->features;
/*
* Now we are registered and our side is ready, if the gmac was opened, ask it to start again
@@ -258,13 +258,13 @@
*/
static void __nss_data_plane_unregister(void)
{
- struct nss_top_instance *nss_top = &nss_top_main;
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[NSS_CORE_0];
int i;
for (i = 0; i < NSS_DATA_PLANE_GMAC_MAX_INTERFACES; i++) {
- if (nss_top->subsys_dp_register[i].ndev) {
+ if (nss_ctx->subsys_dp_register[i].ndev) {
nss_data_plane_unregister_from_nss_gmac(i);
- nss_top->subsys_dp_register[i].ndev = NULL;
+ nss_ctx->subsys_dp_register[i].ndev = NULL;
}
}
}
diff --git a/nss_dtls.c b/nss_dtls.c
index 5c9ec5c..023a4ed 100644
--- a/nss_dtls.c
+++ b/nss_dtls.c
@@ -186,7 +186,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->dtls_msg_callback;
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].app_data;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].app_data;
}
/*
@@ -426,17 +426,17 @@
return NULL;
}
- if (nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (nss_ctx->subsys_dp_register[if_num].ndev) {
nss_warning("%p: Cannot find free slot for "
"DTLS NSS I/F:%u\n", nss_ctx, if_num);
return NULL;
}
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = cb;
- nss_top_main.subsys_dp_register[if_num].app_data = app_ctx;
- 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 = cb;
+ nss_ctx->subsys_dp_register[if_num].app_data = app_ctx;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.dtls_msg_callback = ev_cb;
nss_core_register_handler(if_num, nss_dtls_handler, app_ctx);
@@ -450,6 +450,7 @@
*/
void nss_dtls_unregister_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = nss_dtls_get_context();
int32_t i;
BUG_ON(!nss_dtls_verify_if_num(if_num));
@@ -465,22 +466,20 @@
spin_unlock_bh(&nss_dtls_session_debug_stats_lock);
if (i == NSS_MAX_DTLS_SESSIONS) {
- nss_warning("%p: Cannot find debug stats for "
- "DTLS session %d\n", nss_dtls_get_context(), if_num);
+ nss_warning("%p: Cannot find debug stats for DTLS session %d\n", nss_ctx, if_num);
return;
}
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
- nss_warning("%p: Cannot find registered netdev for "
- "DTLS NSS I/F:%u\n", nss_dtls_get_context(), if_num);
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
+ nss_warning("%p: Cannot find registered netdev for DTLS NSS I/F:%u\n", nss_ctx, if_num);
return;
}
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.dtls_msg_callback = NULL;
nss_core_unregister_handler(if_num);
diff --git a/nss_gre_redir.c b/nss_gre_redir.c
index f6431b7..b6de415 100644
--- a/nss_gre_redir.c
+++ b/nss_gre_redir.c
@@ -120,7 +120,7 @@
* callback
*/
cb = (nss_gre_redir_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 gre tunnel callback
@@ -265,9 +265,11 @@
struct nss_ctx_instance *nss_gre_redir_register_if(uint32_t if_num, struct net_device *netdev, nss_gre_redir_data_callback_t cb_func_data,
nss_gre_redir_msg_callback_t cb_func_msg, uint32_t features)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id];
uint32_t status;
int i;
+ nss_assert(nss_ctx);
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)));
/*
@@ -279,12 +281,12 @@
return NULL;
}
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = cb_func_data;
- 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 = cb_func_data;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
- nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg;
+ nss_top_main.if_rx_msg_callback[if_num] = cb_func_msg;
spin_lock_bh(&nss_gre_redir_stats_lock);
for (i = 0; i < NSS_GRE_REDIR_MAX_INTERFACES; i++) {
@@ -296,7 +298,7 @@
}
spin_unlock_bh(&nss_gre_redir_stats_lock);
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id];
+ return nss_ctx;
}
/*
@@ -304,9 +306,11 @@
*/
void nss_gre_redir_unregister_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id];
uint32_t status;
int i;
+ nss_assert(nss_ctx);
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)));
status = nss_core_unregister_handler(if_num);
@@ -315,10 +319,10 @@
return;
}
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
diff --git a/nss_gre_tunnel.c b/nss_gre_tunnel.c
index 1f3944a..a5285fb 100644
--- a/nss_gre_tunnel.c
+++ b/nss_gre_tunnel.c
@@ -167,7 +167,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->gre_tunnel_msg_callback;
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].app_data;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].app_data;
}
nss_core_log_msg_failures(nss_ctx, ncm);
@@ -418,7 +418,7 @@
return NULL;
}
- if (nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (nss_ctx->subsys_dp_register[if_num].ndev) {
nss_warning("%p: Cannot find free slot for GRE Tunnel NSS I/F:%u\n", nss_ctx, if_num);
nss_gre_tunnel_session_debug_stats[i].valid = false;
nss_gre_tunnel_session_debug_stats[i].if_num = 0;
@@ -426,10 +426,10 @@
return NULL;
}
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = cb;
- nss_top_main.subsys_dp_register[if_num].app_data = app_ctx;
- 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 = cb;
+ nss_ctx->subsys_dp_register[if_num].app_data = app_ctx;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.gre_tunnel_msg_callback = ev_cb;
nss_core_register_handler(if_num, nss_gre_tunnel_handler, app_ctx);
@@ -444,6 +444,7 @@
void nss_gre_tunnel_unregister_if(uint32_t if_num)
{
int32_t i;
+ struct nss_ctx_instance *nss_ctx = nss_gre_tunnel_get_ctx();
BUG_ON(!nss_gre_tunnel_verify_if_num(if_num));
@@ -458,20 +459,20 @@
spin_unlock_bh(&nss_gre_tunnel_session_debug_stats_lock);
if (i == NSS_MAX_GRE_TUNNEL_SESSIONS) {
- nss_warning("%p: Cannot find debug stats for GRE Tunnel session: %d\n", nss_gre_tunnel_get_ctx(), if_num);
+ nss_warning("%p: Cannot find debug stats for GRE Tunnel session: %d\n", nss_ctx, if_num);
return;
}
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
- nss_warning("%p: Cannot find registered netdev for GRE Tunnel NSS I/F: %d\n", nss_gre_tunnel_get_ctx(), if_num);
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
+ nss_warning("%p: Cannot find registered netdev for GRE Tunnel NSS I/F: %d\n", nss_ctx, if_num);
return;
}
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.gre_tunnel_msg_callback = NULL;
nss_core_unregister_handler(if_num);
}
diff --git a/nss_if.c b/nss_if.c
index 3fe24cd..1e4d94f 100644
--- a/nss_if.c
+++ b/nss_if.c
@@ -141,7 +141,7 @@
}
if_num = ncm->interface;
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
if (!dev) {
nss_warning("%p: Unregister interface %d: no context", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
diff --git a/nss_ipsec.c b/nss_ipsec.c
index 6e90771..f8441a5 100644
--- a/nss_ipsec.c
+++ b/nss_ipsec.c
@@ -334,14 +334,14 @@
/*
* avoid multiple registeration for multiple tunnels
*/
- if (nss_ctx->nss_top->subsys_dp_register[if_num].cb) {
+ if (nss_ctx->subsys_dp_register[if_num].cb) {
return nss_ctx;
}
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = cb;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = netdev;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = features;
+ nss_ctx->subsys_dp_register[if_num].cb = cb;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].features = features;
return nss_ctx;
}
@@ -358,10 +358,10 @@
return;
}
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = 0;
+ nss_ctx->subsys_dp_register[if_num].cb = NULL;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
}
EXPORT_SYMBOL(nss_ipsec_data_unregister);
diff --git a/nss_l2tpv2.c b/nss_l2tpv2.c
index a937203..3b2a03d 100644
--- a/nss_l2tpv2.c
+++ b/nss_l2tpv2.c
@@ -129,7 +129,7 @@
* callback
*/
cb = (nss_l2tpv2_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 l2tpv2 tunnel callback
@@ -218,14 +218,16 @@
struct nss_ctx_instance *nss_register_l2tpv2_if(uint32_t if_num, nss_l2tpv2_callback_t l2tpv2_callback,
nss_l2tpv2_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
{
-
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.l2tpv2_handler_id];
int i = 0;
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = l2tpv2_callback;
- 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 = l2tpv2_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.l2tpv2_msg_callback = event_callback;
@@ -242,7 +244,7 @@
}
spin_unlock_bh(&nss_l2tpv2_session_debug_stats_lock);
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.l2tpv2_handler_id];
+ return nss_ctx;
}
/*
@@ -250,13 +252,16 @@
*/
void nss_unregister_l2tpv2_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.l2tpv2_handler_id];
int i;
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.l2tpv2_msg_callback = NULL;
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);
}
diff --git a/nss_map_t.c b/nss_map_t.c
index 8ca7f96..b2487cf 100644
--- a/nss_map_t.c
+++ b/nss_map_t.c
@@ -149,7 +149,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->map_t_msg_callback;
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].app_data;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].app_data;
}
/*
@@ -313,13 +313,16 @@
struct nss_ctx_instance *nss_map_t_register_if(uint32_t if_num, nss_map_t_callback_t map_t_callback,
nss_map_t_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.map_t_handler_id];
int i = 0;
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = map_t_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = netdev;
- 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 = map_t_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = netdev;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.map_t_msg_callback = event_callback;
@@ -336,7 +339,7 @@
}
spin_unlock_bh(&nss_map_t_debug_stats_lock);
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.map_t_handler_id];
+ return nss_ctx;
}
EXPORT_SYMBOL(nss_map_t_register_if);
@@ -345,13 +348,16 @@
*/
void nss_map_t_unregister_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.map_t_handler_id];
int i;
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.map_t_msg_callback = NULL;
diff --git a/nss_phys_if.c b/nss_phys_if.c
index c83c7cb..01ae028 100644
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -118,7 +118,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->phys_if_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
@@ -229,7 +229,7 @@
}
if_num = ncm->interface;
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
if (!dev) {
nss_warning("%p: Unregister physical interface %d: no context", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
@@ -308,12 +308,13 @@
uint8_t id = nss_top_main.phys_if_handler_id[if_num];
struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[id];
+ nss_assert(nss_ctx);
nss_assert(if_num <= NSS_MAX_PHYSICAL_INTERFACES);
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = rx_callback;
- 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 = rx_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.phys_if_msg_callback[if_num] = msg_callback;
@@ -326,12 +327,16 @@
*/
void nss_phys_if_unregister(uint32_t if_num)
{
+ uint8_t id = nss_top_main.phys_if_handler_id[if_num];
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[id];
+
+ nss_assert(nss_ctx);
nss_assert(if_num < NSS_MAX_PHYSICAL_INTERFACES);
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.phys_if_msg_callback[if_num] = NULL;
diff --git a/nss_portid.c b/nss_portid.c
index 41aa010..01d2f9e 100644
--- a/nss_portid.c
+++ b/nss_portid.c
@@ -134,7 +134,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
@@ -416,6 +416,8 @@
struct nss_ctx_instance *nss_portid_register_port_if(uint32_t if_num, uint32_t port_id, struct net_device *netdev,
nss_portid_buf_callback_t buf_callback)
{
+ struct nss_ctx_instance *nss_ctx = nss_portid_get_ctx();
+
if (nss_portid_verify_if_num(if_num) == false) {
nss_warning("nss portid register received invalid interface %d", if_num);
return NULL;
@@ -435,11 +437,11 @@
nss_portid_hdl[port_id].if_num = if_num;
spin_unlock(&nss_portid_spinlock);
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = buf_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = buf_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
- return nss_portid_get_ctx();
+ return nss_ctx;
}
EXPORT_SYMBOL(nss_portid_register_port_if);
@@ -468,10 +470,10 @@
(void) nss_core_unregister_handler(if_num);
- nss_ctx->nss_top->subsys_dp_register[if_num].cb = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].ndev = NULL;
- nss_ctx->nss_top->subsys_dp_register[if_num].features = 0;
+ nss_ctx->subsys_dp_register[if_num].cb = NULL;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
return true;
}
diff --git a/nss_pptp.c b/nss_pptp.c
index 53df9d8..f22c503 100644
--- a/nss_pptp.c
+++ b/nss_pptp.c
@@ -139,7 +139,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->pptp_msg_callback;
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].app_data;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].app_data;
}
/*
@@ -344,13 +344,16 @@
uint32_t features,
void *app_ctx)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.pptp_handler_id];
int i = 0;
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = pptp_data_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = app_ctx;
- 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 = pptp_data_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = app_ctx;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.pptp_msg_callback = notification_callback;
@@ -367,7 +370,7 @@
}
spin_unlock_bh(&nss_pptp_session_debug_stats_lock);
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.pptp_handler_id];
+ return nss_ctx;
}
/*
@@ -375,8 +378,10 @@
*/
void nss_unregister_pptp_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.pptp_handler_id];
int i;
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
spin_lock_bh(&nss_pptp_session_debug_stats_lock);
@@ -387,10 +392,10 @@
}
spin_unlock_bh(&nss_pptp_session_debug_stats_lock);
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.pptp_msg_callback = NULL;
diff --git a/nss_sjack.c b/nss_sjack.c
index 8dcc213..b6f634c 100644
--- a/nss_sjack.c
+++ b/nss_sjack.c
@@ -95,7 +95,7 @@
* callback
*/
cb = (nss_sjack_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;
cb(ctx, ncm);
}
@@ -168,13 +168,16 @@
struct nss_ctx_instance *nss_sjack_register_if(uint32_t if_num, struct net_device *netdev,
nss_sjack_msg_callback_t event_callback)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.sjack_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert(if_num == NSS_SJACK_INTERFACE);
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
nss_top_main.if_rx_msg_callback[if_num] = event_callback;
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.sjack_handler_id];
+ return nss_ctx;
}
/*
@@ -182,9 +185,12 @@
*/
void nss_sjack_unregister_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.sjack_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert(if_num == NSS_SJACK_INTERFACE);
- nss_top_main.subsys_dp_register[if_num].ndev = NULL;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
return;
diff --git a/nss_trustsec_tx.c b/nss_trustsec_tx.c
index 3b195d0..ac81868 100644
--- a/nss_trustsec_tx.c
+++ b/nss_trustsec_tx.c
@@ -100,7 +100,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
diff --git a/nss_tstamp.c b/nss_tstamp.c
index a891458..a59e286 100644
--- a/nss_tstamp.c
+++ b/nss_tstamp.c
@@ -186,11 +186,10 @@
struct nss_ctx_instance *nss_ctx;
nss_ctx = &nss_top_main.nss[nss_top_main.tstamp_handler_id];
- nss_ctx->nss_top->subsys_dp_register[NSS_TSTAMP_INTERFACE].cb = nss_tstamp_buf_receive;
- nss_ctx->nss_top->subsys_dp_register[NSS_TSTAMP_INTERFACE].app_data = NULL;
- nss_ctx->nss_top->subsys_dp_register[NSS_TSTAMP_INTERFACE].ndev = ndev;
- nss_ctx->nss_top->subsys_dp_register[NSS_TSTAMP_INTERFACE].features = features;
-
+ nss_ctx->subsys_dp_register[NSS_TSTAMP_INTERFACE].cb = nss_tstamp_buf_receive;
+ nss_ctx->subsys_dp_register[NSS_TSTAMP_INTERFACE].app_data = NULL;
+ nss_ctx->subsys_dp_register[NSS_TSTAMP_INTERFACE].ndev = ndev;
+ nss_ctx->subsys_dp_register[NSS_TSTAMP_INTERFACE].features = features;
}
diff --git a/nss_tun6rd.c b/nss_tun6rd.c
index 7768a60..2b7f0cf 100644
--- a/nss_tun6rd.c
+++ b/nss_tun6rd.c
@@ -66,7 +66,7 @@
* callback
*/
cb = (nss_tun6rd_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 6rd tunnel callback
@@ -152,18 +152,21 @@
struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, nss_tun6rd_callback_t tun6rd_callback,
nss_tun6rd_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tun6rd_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < NSS_SPECIAL_IF_START));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = tun6rd_callback;
- 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 = tun6rd_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.tun6rd_msg_callback = event_callback;
nss_core_register_handler(if_num, nss_tun6rd_handler, NULL);
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tun6rd_handler_id];
+ return nss_ctx;
}
/*
@@ -179,12 +182,15 @@
*/
void nss_unregister_tun6rd_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tun6rd_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.tun6rd_msg_callback = NULL;
diff --git a/nss_tunipip6.c b/nss_tunipip6.c
index 4ceadbc..13a044e 100644
--- a/nss_tunipip6.c
+++ b/nss_tunipip6.c
@@ -64,7 +64,7 @@
* callback
*/
cb = (nss_tunipip6_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 ipip6 tunnel callback
@@ -153,16 +153,19 @@
struct net_device *netdev,
uint32_t features)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tunipip6_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert((if_num >= NSS_MAX_VIRTUAL_INTERFACES) && (if_num < NSS_MAX_NET_INTERFACES));
nss_top_main.tunipip6_msg_callback = event_callback;
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = tunipip6_callback;
- 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 = tunipip6_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
- return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tunipip6_handler_id];
+ return nss_ctx;
}
/*
@@ -170,11 +173,14 @@
*/
void nss_unregister_tunipip6_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tunipip6_handler_id];
+
+ 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].cb = NULL;
- nss_top_main.subsys_dp_register[if_num].ndev = 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].features = 0;
nss_top_main.tunipip6_msg_callback = NULL;
}
diff --git a/nss_tx_rx_virt_if.c b/nss_tx_rx_virt_if.c
index 56947fc..699df34 100644
--- a/nss_tx_rx_virt_if.c
+++ b/nss_tx_rx_virt_if.c
@@ -120,7 +120,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
@@ -171,7 +171,7 @@
struct net_device *netdev)
{
struct nss_tx_rx_virt_if_handle *handle = (struct nss_tx_rx_virt_if_handle *)ctx;
-
+ struct nss_ctx_instance *nss_ctx;
int32_t if_num;
if (!handle) {
@@ -179,12 +179,13 @@
return NULL;
}
+ nss_ctx = handle->nss_ctx;
if_num = handle->if_num;
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = rx_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = (uint32_t)netdev->features;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = rx_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = (uint32_t)netdev->features;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
@@ -197,6 +198,7 @@
void nss_unregister_virt_if(void *ctx)
{
struct nss_tx_rx_virt_if_handle *handle = (struct nss_tx_rx_virt_if_handle *)ctx;
+ struct nss_ctx_instance *nss_ctx;
int32_t if_num;
if (!handle) {
@@ -204,12 +206,13 @@
return;
}
+ nss_ctx = handle->nss_ctx;
if_num = handle->if_num;
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
}
@@ -592,8 +595,8 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[handle->if_num].ndev) {
- nss_top_main.subsys_dp_register[handle->if_num].ndev = netdev;
+ if (!nss_ctx->subsys_dp_register[handle->if_num].ndev) {
+ nss_ctx->subsys_dp_register[handle->if_num].ndev = netdev;
}
spin_unlock_bh(&nss_top_main.lock);
@@ -641,13 +644,13 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
spin_unlock_bh(&nss_top_main.lock);
nss_warning("%p: Unregister redir interface %d: no context\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
}
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
nss_unregister_virt_if(handle);
spin_unlock_bh(&nss_top_main.lock);
dev_put(dev);
diff --git a/nss_virt_if.c b/nss_virt_if.c
index e9ca9d1..c476a41 100644
--- a/nss_virt_if.c
+++ b/nss_virt_if.c
@@ -118,7 +118,7 @@
*/
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
@@ -319,6 +319,7 @@
static void nss_virt_if_handle_create_cb(void *app_data, struct nss_dynamic_interface_msg *ndim)
{
struct nss_virt_if_handle *handle = (struct nss_virt_if_handle *)app_data;
+ struct nss_ctx_instance *nss_ctx = handle->nss_ctx;
nss_virt_if_msg_callback_t cb;
struct nss_virt_if_msg nvim;
struct nss_virt_if_create_msg *nvcm;
@@ -370,8 +371,8 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[handle->if_num].ndev) {
- nss_top_main.subsys_dp_register[handle->if_num].ndev = handle->ndev;
+ if (!nss_ctx->subsys_dp_register[handle->if_num].ndev) {
+ nss_ctx->subsys_dp_register[handle->if_num].ndev = handle->ndev;
}
spin_unlock_bh(&nss_top_main.lock);
@@ -602,8 +603,8 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[handle->if_num].ndev) {
- nss_top_main.subsys_dp_register[handle->if_num].ndev = netdev;
+ if (!nss_ctx->subsys_dp_register[handle->if_num].ndev) {
+ nss_ctx->subsys_dp_register[handle->if_num].ndev = netdev;
}
spin_unlock_bh(&nss_top_main.lock);
@@ -654,14 +655,14 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
spin_unlock_bh(&nss_top_main.lock);
nss_warning("%p: Unregister virt interface %d: no context\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
}
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
- nss_top_main.subsys_dp_register[if_num].ndev = NULL;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
spin_unlock_bh(&nss_top_main.lock);
dev_put(dev);
@@ -707,14 +708,14 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
spin_unlock_bh(&nss_top_main.lock);
nss_warning("%p: Unregister virt interface %d: no context\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
}
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
- nss_top_main.subsys_dp_register[if_num].ndev = NULL;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
spin_unlock_bh(&nss_top_main.lock);
dev_put(dev);
@@ -869,6 +870,7 @@
nss_virt_if_data_callback_t data_callback,
struct net_device *netdev)
{
+ struct nss_ctx_instance *nss_ctx = handle->nss_ctx;
int32_t if_num;
if (!handle) {
@@ -878,10 +880,10 @@
if_num = handle->if_num;
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = data_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = (uint32_t)netdev->features;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = data_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = (uint32_t)netdev->features;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
}
@@ -892,6 +894,7 @@
*/
void nss_virt_if_unregister(struct nss_virt_if_handle *handle)
{
+ struct nss_ctx_instance *nss_ctx = handle->nss_ctx;
int32_t if_num;
if (!handle) {
@@ -901,10 +904,10 @@
if_num = handle->if_num;
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.if_rx_msg_callback[if_num] = NULL;
}
diff --git a/nss_vlan.c b/nss_vlan.c
index 7001f24..770339b 100644
--- a/nss_vlan.c
+++ b/nss_vlan.c
@@ -393,16 +393,18 @@
struct nss_ctx_instance *nss_register_vlan_if(uint32_t if_num, nss_vlan_callback_t vlan_data_callback,
struct net_device *netdev, uint32_t features, void *app_ctx)
{
+ struct nss_ctx_instance *nss_ctx = nss_vlan_get_context();
+
nss_assert(nss_vlan_verify_if_num(if_num));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = vlan_data_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = app_ctx;
- 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 = vlan_data_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = app_ctx;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_core_register_handler(if_num, nss_vlan_handler, app_ctx);
- return nss_vlan_get_context();
+ return nss_ctx;
}
EXPORT_SYMBOL(nss_register_vlan_if);
@@ -411,12 +413,14 @@
*/
void nss_unregister_vlan_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = nss_vlan_get_context();
+
nss_assert(nss_vlan_verify_if_num(if_num));
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
nss_core_unregister_handler(if_num);
}
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;
}
/*
diff --git a/nss_wifi_if.c b/nss_wifi_if.c
index 3c5480e..676b135 100644
--- a/nss_wifi_if.c
+++ b/nss_wifi_if.c
@@ -418,8 +418,8 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[handle->if_num].ndev) {
- nss_top_main.subsys_dp_register[handle->if_num].ndev = netdev;
+ if (!nss_ctx->subsys_dp_register[handle->if_num].ndev) {
+ nss_ctx->subsys_dp_register[handle->if_num].ndev = netdev;
}
spin_unlock_bh(&nss_top_main.lock);
@@ -458,14 +458,14 @@
}
spin_lock_bh(&nss_top_main.lock);
- if (!nss_top_main.subsys_dp_register[if_num].ndev) {
+ if (!nss_ctx->subsys_dp_register[if_num].ndev) {
spin_unlock_bh(&nss_top_main.lock);
nss_warning("%p: Unregister wifi interface %d: no context\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
}
- dev = nss_top_main.subsys_dp_register[if_num].ndev;
- nss_top_main.subsys_dp_register[if_num].ndev = NULL;
+ dev = nss_ctx->subsys_dp_register[if_num].ndev;
+ nss_ctx->subsys_dp_register[if_num].ndev = NULL;
spin_unlock_bh(&nss_top_main.lock);
dev_put(dev);
@@ -483,6 +483,7 @@
nss_wifi_if_data_callback_t rx_callback,
struct net_device *netdev)
{
+ struct nss_ctx_instance *nss_ctx;
int32_t if_num;
if (!handle) {
@@ -490,13 +491,14 @@
return;
}
+ nss_ctx = handle->nss_ctx;
if_num = handle->if_num;
nss_assert(NSS_IS_IF_TYPE(DYNAMIC, if_num));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = rx_callback;
- nss_top_main.subsys_dp_register[if_num].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = netdev->features;
+ nss_ctx->subsys_dp_register[if_num].ndev = netdev;
+ nss_ctx->subsys_dp_register[if_num].cb = rx_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = netdev->features;
}
EXPORT_SYMBOL(nss_wifi_if_register);
@@ -506,6 +508,7 @@
*/
void nss_wifi_if_unregister(struct nss_wifi_if_handle *handle)
{
+ struct nss_ctx_instance *nss_ctx;
int32_t if_num;
if (!handle) {
@@ -513,12 +516,13 @@
return;
}
+ nss_ctx = handle->nss_ctx;
if_num = handle->if_num;
- 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].app_data = NULL;
- nss_top_main.subsys_dp_register[if_num].features = 0;
+ 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].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = 0;
}
EXPORT_SYMBOL(nss_wifi_if_unregister);
diff --git a/nss_wifi_vdev.c b/nss_wifi_vdev.c
index 4fd2ed1..452c54e 100644
--- a/nss_wifi_vdev.c
+++ b/nss_wifi_vdev.c
@@ -49,7 +49,7 @@
/*
* callback
*/
- if (!nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev) {
+ if (!nss_ctx->subsys_dp_register[ncm->interface].ndev) {
nss_warning("%p: Event received wifi vdev interface %d before registration", nss_ctx, ncm->interface);
return;
@@ -57,7 +57,7 @@
if (ncm->response == NSS_CMM_RESPONSE_NOTIFY) {
ncm->cb = (nss_ptr_t)nss_ctx->nss_top->if_rx_msg_callback[ncm->interface];
- ncm->app_data = (nss_ptr_t)nss_ctx->nss_top->subsys_dp_register[ncm->interface].ndev;
+ ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].ndev;
}
/*
@@ -256,11 +256,11 @@
{
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)));
- nss_top_main.subsys_dp_register[if_num].ndev = netdev;
- nss_top_main.subsys_dp_register[if_num].cb = vdev_data_callback;
- nss_top_main.subsys_dp_register[if_num].ext_cb = vdev_ext_data_callback;
- 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 = vdev_data_callback;
+ nss_ctx->subsys_dp_register[if_num].ext_cb = vdev_ext_data_callback;
+ nss_ctx->subsys_dp_register[if_num].app_data = NULL;
+ nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.if_rx_msg_callback[if_num] = vdev_event_callback;
@@ -274,13 +274,16 @@
*/
void nss_unregister_wifi_vdev_if(uint32_t if_num)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
+
+ nss_assert(nss_ctx);
nss_assert((if_num >= NSS_DYNAMIC_IF_START) && (if_num < (NSS_DYNAMIC_IF_START + NSS_MAX_DYNAMIC_INTERFACES)));
- 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_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;
nss_top_main.if_rx_msg_callback[if_num] = NULL;