[qca-nss-drv] Update callback handler
Update the callback handler to handle
per core requests
Change-Id: Id0502903ffd26c81620e34427af7e2f626a572b3
Signed-off-by: Thomas Wu <wthomas@codeaurora.org>
diff --git a/exports/nss_cmn.h b/exports/nss_cmn.h
index 193b268..ed464b5 100644
--- a/exports/nss_cmn.h
+++ b/exports/nss_cmn.h
@@ -51,6 +51,11 @@
*/
#define NSS_INTERFACE_NUM_GET(interface) ((interface) & 0xffffff)
+/**
+ * Macro to obtain an interface core number.
+ */
+#define NSS_INTERFACE_NUM_GET_COREID(interface) ((interface >> NSS_CORE_ID_SHIFT) & 0xff)
+
/*
* Common enumerations.
*/
diff --git a/nss_bridge.c b/nss_bridge.c
index 3b953d0..88b5d73 100644
--- a/nss_bridge.c
+++ b/nss_bridge.c
@@ -447,7 +447,7 @@
nss_top_main.bridge_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
EXPORT_SYMBOL(nss_bridge_unregister);
@@ -471,7 +471,7 @@
nss_top_main.bridge_callback = bridge_msg_cb;
- nss_core_register_handler(if_num, nss_bridge_handler, app_data);
+ nss_core_register_handler(nss_ctx, if_num, nss_bridge_handler, app_data);
return nss_ctx;
}
EXPORT_SYMBOL(nss_bridge_register);
diff --git a/nss_capwap.c b/nss_capwap.c
index 9dcb6e3..13df093 100644
--- a/nss_capwap.c
+++ b/nss_capwap.c
@@ -495,7 +495,7 @@
}
spin_unlock(&nss_capwap_spinlock);
- core_status = nss_core_register_handler(if_num, nss_capwap_msg_handler, NULL);
+ core_status = nss_core_register_handler(nss_ctx, if_num, nss_capwap_msg_handler, NULL);
if (core_status != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%p: nss core register handler failed for if_num:%d with error :%d", nss_ctx, if_num, core_status);
return NULL;
@@ -543,7 +543,7 @@
nss_capwap_hdl[if_num - NSS_DYNAMIC_IF_START] = NULL;
spin_unlock(&nss_capwap_spinlock);
- (void) nss_core_unregister_handler(if_num);
+ (void) nss_core_unregister_handler(nss_ctx, if_num);
nss_ctx->subsys_dp_register[if_num].cb = NULL;
nss_ctx->subsys_dp_register[if_num].app_data = NULL;
diff --git a/nss_core.c b/nss_core.c
index a97d43f..2395be1 100644
--- a/nss_core.c
+++ b/nss_core.c
@@ -73,16 +73,6 @@
*/
/*
- * NSS Rx per interface callback structure
- */
-struct nss_rx_cb_list {
- nss_core_rx_callback_t cb;
- void *app_data;
-};
-
-static struct nss_rx_cb_list nss_rx_interface_handlers[NSS_MAX_NET_INTERFACES];
-
-/*
* nss_core_max_ipv4_conn_get()
* Get the maximum number of configured IPv4 connections
*/
@@ -138,9 +128,10 @@
/*
* nss_core_register_handler()
- * Register a callback per interface code. Only one per interface.
+
+-- Register a callback per interface code. Only one per interface.
*/
-uint32_t nss_core_register_handler(uint32_t interface, nss_core_rx_callback_t cb, void *app_data)
+uint32_t nss_core_register_handler(struct nss_ctx_instance *nss_ctx, uint32_t interface, nss_core_rx_callback_t cb, void *app_data)
{
nss_assert(cb != NULL);
@@ -148,36 +139,36 @@
* Validate interface id
*/
if (interface >= NSS_MAX_NET_INTERFACES) {
- printk("Error - Interface %d not Supported\n", interface);
+ nss_warning("Error - Interface %d not Supported\n", interface);
return NSS_CORE_STATUS_FAILURE;
}
/*
* Check if already registered
*/
- if (nss_rx_interface_handlers[interface].cb != NULL) {
- printk("Error - Duplicate Interface CB Registered for interface %d\n", interface);
+ if (nss_ctx->nss_rx_interface_handlers[nss_ctx->id][interface].cb != NULL) {
+ nss_warning("Error - Duplicate Interface CB Registered for interface %d\n", interface);
return NSS_CORE_STATUS_FAILURE;
}
- nss_rx_interface_handlers[interface].cb = cb;
- nss_rx_interface_handlers[interface].app_data = app_data;
+ nss_ctx->nss_rx_interface_handlers[nss_ctx->id][interface].cb = cb;
+ nss_ctx->nss_rx_interface_handlers[nss_ctx->id][interface].app_data = app_data;
return NSS_CORE_STATUS_SUCCESS;
}
-uint32_t nss_core_unregister_handler(uint32_t interface)
+uint32_t nss_core_unregister_handler(struct nss_ctx_instance *nss_ctx, uint32_t interface)
{
/*
* Validate interface id
*/
if (interface >= NSS_MAX_NET_INTERFACES) {
- printk("Error - Interface %d not Supported\n", interface);
+ nss_warning("Error - Interface %d not Supported\n", interface);
return NSS_CORE_STATUS_FAILURE;
}
- nss_rx_interface_handlers[interface].cb = NULL;
- nss_rx_interface_handlers[interface].app_data = NULL;
+ nss_ctx->nss_rx_interface_handlers[nss_ctx->id][interface].cb = NULL;
+ nss_ctx->nss_rx_interface_handlers[nss_ctx->id][interface].app_data = NULL;
return NSS_CORE_STATUS_SUCCESS;
}
@@ -231,8 +222,8 @@
return;
}
- cb = nss_rx_interface_handlers[nss_if].cb;
- app_data = nss_rx_interface_handlers[nss_if].app_data;
+ cb = nss_ctx->nss_rx_interface_handlers[nss_ctx->id][nss_if].cb;
+ app_data = nss_ctx->nss_rx_interface_handlers[nss_ctx->id][nss_if].app_data;
if (!cb) {
nss_warning("%p: Callback not registered for interface %d", nss_ctx, nss_if);
diff --git a/nss_core.h b/nss_core.h
index ddcb969..b7cbbc0 100644
--- a/nss_core.h
+++ b/nss_core.h
@@ -1102,6 +1102,19 @@
};
/*
+ * CB function declarations
+ */
+typedef void (*nss_core_rx_callback_t)(struct nss_ctx_instance *, struct nss_cmn_msg *, void *);
+
+/*
+ * NSS Rx per interface callback structure
+ */
+struct nss_rx_cb_list {
+ nss_core_rx_callback_t cb;
+ void *app_data;
+};
+
+/*
* 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.
@@ -1153,6 +1166,8 @@
/* 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_rx_cb_list nss_rx_interface_handlers[NSS_MAX_CORES][NSS_MAX_NET_INTERFACES];
+ /* NSS interface callback handlers */
struct nss_subsystem_dataplane_register subsys_dp_register[NSS_MAX_NET_INTERFACES];
/* Subsystem registration data */
uint32_t magic;
@@ -1603,11 +1618,6 @@
} nss_work_t;
/*
- * CB function declarations
- */
-typedef void (*nss_core_rx_callback_t)(struct nss_ctx_instance *, struct nss_cmn_msg *, void *);
-
-/*
* APIs provided by nss_core.c
*/
extern int nss_core_handle_napi(struct napi_struct *napi, int budget);
@@ -1617,8 +1627,8 @@
struct sk_buff *nbuf, uint16_t qid,
uint8_t buffer_type, uint16_t flags);
extern void nss_wq_function( struct work_struct *work);
-extern uint32_t nss_core_register_handler(uint32_t interface, nss_core_rx_callback_t cb, void *app_data);
-extern uint32_t nss_core_unregister_handler(uint32_t interface);
+extern uint32_t nss_core_register_handler(struct nss_ctx_instance *nss_ctx, uint32_t interface, nss_core_rx_callback_t cb, void *app_data);
+extern uint32_t nss_core_unregister_handler(struct nss_ctx_instance *nss_ctx, uint32_t interface);
extern int nss_core_max_ipv4_conn_get(void);
extern int nss_core_max_ipv6_conn_get(void);
diff --git a/nss_crypto.c b/nss_crypto.c
index 2df35e8..07951bd 100644
--- a/nss_crypto.c
+++ b/nss_crypto.c
@@ -315,9 +315,11 @@
/*
* nss_crypto_register_handler()
*/
-void nss_crypto_register_handler()
+void nss_crypto_register_handler(void)
{
- nss_core_register_handler(NSS_CRYPTO_INTERFACE, nss_crypto_msg_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[nss_top_main.crypto_handler_id];
+
+ nss_core_register_handler(nss_ctx, NSS_CRYPTO_INTERFACE, nss_crypto_msg_handler, NULL);
}
/*
diff --git a/nss_crypto_cmn.c b/nss_crypto_cmn.c
index 777beb3..e2989e8 100644
--- a/nss_crypto_cmn.c
+++ b/nss_crypto_cmn.c
@@ -383,9 +383,11 @@
*/
void nss_crypto_cmn_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = nss_crypto_cmn_get_context();
+
sema_init(&g_nss_crypto_cmn.sem, 1);
init_completion(&g_nss_crypto_cmn.complete);
- nss_core_register_handler(NSS_CRYPTO_EIP197_INTERFACE, nss_crypto_cmn_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_CRYPTO_EIP197_INTERFACE, nss_crypto_cmn_msg_handler, NULL);
}
/*
diff --git a/nss_data_plane/nss_data_plane_edma.c b/nss_data_plane/nss_data_plane_edma.c
index 6684dc6..3650df8 100644
--- a/nss_data_plane/nss_data_plane_edma.c
+++ b/nss_data_plane/nss_data_plane_edma.c
@@ -247,7 +247,7 @@
* be redirected to the nss-dp driver as we are overriding the data plane
*/
nss_top->phys_if_handler_id[if_num] = nss_ctx->id;
- nss_phys_if_register_handler(if_num);
+ nss_phys_if_register_handler(nss_ctx, if_num);
/*
* Packets recieved on physical interface can be exceptioned to HLOS
diff --git a/nss_data_plane/nss_data_plane_gmac.c b/nss_data_plane/nss_data_plane_gmac.c
index 88c0334..a648fae 100644
--- a/nss_data_plane/nss_data_plane_gmac.c
+++ b/nss_data_plane/nss_data_plane_gmac.c
@@ -209,7 +209,7 @@
* be redirected to the gmac driver as we are overriding the data plane
*/
nss_top->phys_if_handler_id[if_num] = nss_ctx->id;
- nss_phys_if_register_handler(if_num);
+ nss_phys_if_register_handler(nss_ctx, if_num);
/*
* Packets recieved on physical interface can be exceptioned to HLOS
diff --git a/nss_dscp2pri.c b/nss_dscp2pri.c
index 1f95e8b..92a42ed 100644
--- a/nss_dscp2pri.c
+++ b/nss_dscp2pri.c
@@ -551,10 +551,11 @@
/*
* nss_dscp2pri_register_handler()
- * Registering handler for receiving notify msg from dscp2pri node on NSS.
+ * Registering handler for receiving notify msg from dscp2pri node on NSS.
*/
void nss_dscp2pri_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[0];
int i;
/*
@@ -565,7 +566,7 @@
mapping[i].action = NSS_DSCP2PRI_ACTION_ACCEL;
}
- nss_core_register_handler(NSS_DSCP2PRI_INTERFACE, nss_dscp2pri_configure_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_DSCP2PRI_INTERFACE, nss_dscp2pri_configure_handler, NULL);
/*
* dscp2pri sema init.
diff --git a/nss_dtls.c b/nss_dtls.c
index 023a4ed..f526224 100644
--- a/nss_dtls.c
+++ b/nss_dtls.c
@@ -439,7 +439,7 @@
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);
+ nss_core_register_handler(nss_ctx, if_num, nss_dtls_handler, app_ctx);
return nss_ctx;
}
@@ -482,7 +482,7 @@
nss_ctx->subsys_dp_register[if_num].features = 0;
nss_top_main.dtls_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
EXPORT_SYMBOL(nss_dtls_unregister_if);
diff --git a/nss_dynamic_interface.c b/nss_dynamic_interface.c
index 4807d5a..fdcb80d 100644
--- a/nss_dynamic_interface.c
+++ b/nss_dynamic_interface.c
@@ -326,9 +326,9 @@
/*
* nss_dynamic_interface_register_handler()
*/
-void nss_dynamic_interface_register_handler(void)
+void nss_dynamic_interface_register_handler(struct nss_ctx_instance *nss_ctx)
{
- nss_core_register_handler(NSS_DYNAMIC_INTERFACE, nss_dynamic_interface_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_DYNAMIC_INTERFACE, nss_dynamic_interface_handler, NULL);
sema_init(&di.sem, 1);
init_completion(&di.complete);
diff --git a/nss_edma.c b/nss_edma.c
index 60e8532..31a3092 100644
--- a/nss_edma.c
+++ b/nss_edma.c
@@ -211,9 +211,20 @@
EXPORT_SYMBOL(nss_edma_notify_unregister);
/*
+ * nss_get_edma_context()
+ */
+struct nss_ctx_instance *nss_edma_get_context(void)
+{
+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.edma_handler_id];
+}
+EXPORT_SYMBOL(nss_edma_get_context);
+
+/*
* nss_edma_register_handler()
*/
void nss_edma_register_handler(void)
{
- nss_core_register_handler(NSS_EDMA_INTERFACE, nss_edma_interface_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_edma_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_EDMA_INTERFACE, nss_edma_interface_handler, NULL);
}
diff --git a/nss_eth_rx.c b/nss_eth_rx.c
index bc434f5..17a30fd 100644
--- a/nss_eth_rx.c
+++ b/nss_eth_rx.c
@@ -90,7 +90,7 @@
/*
* nss_eth_rx_register_handler()
*/
-void nss_eth_rx_register_handler()
+void nss_eth_rx_register_handler(struct nss_ctx_instance *nss_ctx)
{
- nss_core_register_handler(NSS_ETH_RX_INTERFACE, nss_eth_rx_interface_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_ETH_RX_INTERFACE, nss_eth_rx_interface_handler, NULL);
}
diff --git a/nss_freq.c b/nss_freq.c
index 86adbb6..9990076 100644
--- a/nss_freq.c
+++ b/nss_freq.c
@@ -304,9 +304,21 @@
}
/*
+ * nss_freq_get_context()
+ * get NSS context instance for frequency
+ */
+struct nss_ctx_instance *nss_freq_get_context(void)
+{
+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.frequency_handler_id];
+}
+EXPORT_SYMBOL(nss_freq_get_context);
+
+/*
* nss_freq_register_handler()
*/
void nss_freq_register_handler(void)
{
- nss_core_register_handler(NSS_COREFREQ_INTERFACE, nss_freq_interface_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_freq_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_COREFREQ_INTERFACE, nss_freq_interface_handler, NULL);
}
diff --git a/nss_gre.c b/nss_gre.c
index 78704ef..866a131 100644
--- a/nss_gre.c
+++ b/nss_gre.c
@@ -419,7 +419,7 @@
nss_top_main.gre_msg_callback = event_callback;
nss_top_main.gre_data_callback = data_callback;
- nss_core_register_handler(if_num, nss_gre_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_gre_msg_handler, NULL);
spin_lock_bh(&nss_gre_stats_lock);
for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
@@ -455,7 +455,7 @@
nss_top_main.gre_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
spin_lock_bh(&nss_gre_stats_lock);
for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
@@ -471,7 +471,7 @@
/*
* nss_get_gre_context()
*/
-struct nss_ctx_instance *nss_gre_get_context()
+struct nss_ctx_instance *nss_gre_get_context(void)
{
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_handler_id];
}
@@ -493,8 +493,10 @@
*/
void nss_gre_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = nss_gre_get_context();
+
nss_info("nss_gre_register_handler");
sema_init(&nss_gre_pvt.sem, 1);
init_completion(&nss_gre_pvt.complete);
- nss_core_register_handler(NSS_GRE_INTERFACE, nss_gre_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_GRE_INTERFACE, nss_gre_msg_handler, NULL);
}
diff --git a/nss_gre_redir.c b/nss_gre_redir.c
index b6de415..07a8385 100644
--- a/nss_gre_redir.c
+++ b/nss_gre_redir.c
@@ -275,7 +275,7 @@
/*
* Registering handler for sending tunnel interface msgs to NSS.
*/
- status = nss_core_register_handler(if_num, nss_gre_redir_msg_handler, NULL);
+ status = nss_core_register_handler(nss_ctx, if_num, nss_gre_redir_msg_handler, NULL);
if (status != NSS_CORE_STATUS_SUCCESS) {
nss_warning("Not able to register handler for gre_redir interface %d with NSS core\n", if_num);
return NULL;
@@ -313,7 +313,7 @@
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);
+ status = nss_core_unregister_handler(nss_ctx, if_num);
if (status != NSS_CORE_STATUS_SUCCESS) {
nss_warning("Not able to unregister handler for gre_redir interface %d with NSS core\n", if_num);
return;
@@ -338,12 +338,23 @@
}
/*
+ * nss_get_gre_redir_context()
+ */
+struct nss_ctx_instance *nss_gre_redir_get_context(void)
+{
+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_redir_handler_id];
+}
+EXPORT_SYMBOL(nss_gre_redir_get_context);
+
+/*
* nss_gre_redir_register_handler()
* Registering handler for sending msg to base gre_redir node on NSS.
*/
void nss_gre_redir_register_handler(void)
{
- uint32_t status = nss_core_register_handler(NSS_GRE_REDIR_INTERFACE, nss_gre_redir_msg_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_gre_redir_get_context();
+
+ uint32_t status = nss_core_register_handler(nss_ctx, NSS_GRE_REDIR_INTERFACE, nss_gre_redir_msg_handler, NULL);
if (status != NSS_CORE_STATUS_SUCCESS) {
nss_warning("Not able to register handler for gre_redir base interface with NSS core\n");
return;
diff --git a/nss_gre_tunnel.c b/nss_gre_tunnel.c
index 337ebeb..d8457fb 100644
--- a/nss_gre_tunnel.c
+++ b/nss_gre_tunnel.c
@@ -432,7 +432,7 @@
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);
+ nss_core_register_handler(nss_ctx, if_num, nss_gre_tunnel_handler, app_ctx);
return nss_ctx;
}
@@ -475,6 +475,6 @@
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);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
EXPORT_SYMBOL(nss_gre_tunnel_unregister_if);
diff --git a/nss_hal/nss_hal.c b/nss_hal/nss_hal.c
index 2fba80e..05a4fd8 100644
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -327,6 +327,12 @@
spin_lock_bh(&(nss_top->lock));
/*
+ * Features that will always be enabled on both cores
+ */
+ nss_dynamic_interface_register_handler(nss_ctx);
+ nss_n2h_register_handler(nss_ctx);
+
+ /*
* Check functionalities are supported by this NSS core
*/
if (npd->shaping_enabled == NSS_FEATURE_ENABLED) {
@@ -338,15 +344,13 @@
nss_top->ipv4_handler_id = nss_dev->id;
nss_ipv4_register_handler();
if (npd->pppoe_enabled == NSS_FEATURE_ENABLED) {
- nss_pppoe_register_handler();
+ nss_pppoe_register_handler(nss_ctx);
}
nss_top->edma_handler_id = nss_dev->id;
nss_edma_register_handler();
- nss_eth_rx_register_handler();
- nss_n2h_register_handler();
+ nss_eth_rx_register_handler(nss_ctx);
nss_lag_register_handler();
- nss_dynamic_interface_register_handler();
nss_top->trustsec_tx_handler_id = nss_dev->id;
nss_trustsec_tx_register_handler();
@@ -446,6 +450,7 @@
nss_top->gre_redir_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR] = nss_dev->id;
nss_gre_redir_register_handler();
+ nss_top->sjack_handler_id = nss_dev->id;
nss_sjack_register_handler();
}
@@ -492,7 +497,7 @@
#if (NSS_FREQ_SCALE_SUPPORT == 1)
nss_freq_register_handler();
#endif
- nss_lso_rx_register_handler();
+ nss_lso_rx_register_handler(nss_ctx);
}
nss_top->frequency_handler_id = nss_dev->id;
diff --git a/nss_ipsec.c b/nss_ipsec.c
index 2caa09a..87ed152 100644
--- a/nss_ipsec.c
+++ b/nss_ipsec.c
@@ -408,7 +408,7 @@
EXPORT_SYMBOL(nss_ipsec_get_data_interface);
/*
- * nss_ipsec_get_ctx()
+ * nss_ipsec_get_context()
* get NSS context instance for IPsec handle
*/
struct nss_ctx_instance *nss_ipsec_get_context(void)
@@ -433,8 +433,8 @@
nss_ctx->nss_top->ipsec_encap_ctx = NULL;
nss_ctx->nss_top->ipsec_decap_ctx = NULL;
- nss_core_register_handler(NSS_IPSEC_ENCAP_INTERFACE_NUM, nss_ipsec_msg_handler, NULL);
- nss_core_register_handler(NSS_IPSEC_DECAP_INTERFACE_NUM, nss_ipsec_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_IPSEC_ENCAP_INTERFACE_NUM, nss_ipsec_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_IPSEC_DECAP_INTERFACE_NUM, nss_ipsec_msg_handler, NULL);
}
/*
diff --git a/nss_ipv4.c b/nss_ipv4.c
index a26e986..7930be3 100644
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -360,7 +360,9 @@
*/
void nss_ipv4_register_handler(void)
{
- if (nss_core_register_handler(NSS_IPV4_RX_INTERFACE, nss_ipv4_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ struct nss_ctx_instance *nss_ctx = nss_ipv4_get_mgr();
+
+ if (nss_core_register_handler(nss_ctx, NSS_IPV4_RX_INTERFACE, nss_ipv4_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("IPv4 handler failed to register");
}
}
diff --git a/nss_ipv4_reasm.c b/nss_ipv4_reasm.c
index 9a681ac..043dcc2 100644
--- a/nss_ipv4_reasm.c
+++ b/nss_ipv4_reasm.c
@@ -75,12 +75,24 @@
}
/*
+ * nss_ipv4_reasm_get_context()
+ * get NSS context instance for ipv4 reassembly
+ */
+struct nss_ctx_instance *nss_ipv4_reasm_get_context(void)
+{
+ return &nss_top_main.nss[nss_top_main.ipv4_reasm_handler_id];
+}
+EXPORT_SYMBOL(nss_ipv4_reasm_get_context);
+
+/*
* nss_ipv4_reasm_register_handler()
* Register our handler to receive messages for this interface
*/
void nss_ipv4_reasm_register_handler(void)
{
- if (nss_core_register_handler(NSS_IPV4_REASM_INTERFACE, nss_ipv4_reasm_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ struct nss_ctx_instance *nss_ctx = nss_ipv4_reasm_get_context();
+
+ if (nss_core_register_handler(nss_ctx, NSS_IPV4_REASM_INTERFACE, nss_ipv4_reasm_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("IPv4 reasm handler failed to register");
}
}
diff --git a/nss_ipv6.c b/nss_ipv6.c
index 64af645..430d260 100644
--- a/nss_ipv6.c
+++ b/nss_ipv6.c
@@ -363,7 +363,9 @@
*/
void nss_ipv6_register_handler()
{
- if (nss_core_register_handler(NSS_IPV6_RX_INTERFACE, nss_ipv6_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ struct nss_ctx_instance *nss_ctx = nss_ipv6_get_mgr();
+
+ if (nss_core_register_handler(nss_ctx, NSS_IPV6_RX_INTERFACE, nss_ipv6_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("IPv6 handler failed to register");
}
}
diff --git a/nss_ipv6_reasm.c b/nss_ipv6_reasm.c
index 2e384b0..002bb82 100644
--- a/nss_ipv6_reasm.c
+++ b/nss_ipv6_reasm.c
@@ -72,12 +72,24 @@
}
/*
+ * nss_ipv6_reasm_get_context()
+ * get NSS context instance for ipv6 reassembly
+ */
+struct nss_ctx_instance *nss_ipv6_reasm_get_context(void)
+{
+ return &nss_top_main.nss[nss_top_main.ipv6_reasm_handler_id];
+}
+EXPORT_SYMBOL(nss_ipv6_reasm_get_context);
+
+/*
* nss_ipv6_reasm_register_handler()
* Register our handler to receive messages for this interface
*/
void nss_ipv6_reasm_register_handler(void)
{
- if (nss_core_register_handler(NSS_IPV6_REASM_INTERFACE, nss_ipv6_reasm_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ struct nss_ctx_instance *nss_ctx = nss_ipv6_reasm_get_context();
+
+ if (nss_core_register_handler(nss_ctx, NSS_IPV6_REASM_INTERFACE, nss_ipv6_reasm_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("IPv6 reasm handler failed to register");
}
}
diff --git a/nss_l2tpv2.c b/nss_l2tpv2.c
index 3b2a03d..0b37252 100644
--- a/nss_l2tpv2.c
+++ b/nss_l2tpv2.c
@@ -231,7 +231,7 @@
nss_top_main.l2tpv2_msg_callback = event_callback;
- nss_core_register_handler(if_num, nss_l2tpv2_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_l2tpv2_handler, NULL);
spin_lock_bh(&nss_l2tpv2_session_debug_stats_lock);
for (i = 0; i < NSS_MAX_L2TPV2_DYNAMIC_INTERFACES; i++) {
@@ -265,7 +265,7 @@
nss_top_main.l2tpv2_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
spin_lock_bh(&nss_l2tpv2_session_debug_stats_lock);
for (i = 0; i < NSS_MAX_L2TPV2_DYNAMIC_INTERFACES; i++) {
@@ -299,8 +299,10 @@
*/
void nss_l2tpv2_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = nss_l2tpv2_get_context();
+
nss_info("nss_l2tpv2_register_handler");
- nss_core_register_handler(NSS_L2TPV2_INTERFACE, nss_l2tpv2_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_L2TPV2_INTERFACE, nss_l2tpv2_handler, NULL);
}
EXPORT_SYMBOL(nss_l2tpv2_get_context);
diff --git a/nss_lag.c b/nss_lag.c
index 4d24d52..b1bdd15 100644
--- a/nss_lag.c
+++ b/nss_lag.c
@@ -221,10 +221,12 @@
*/
void nss_lag_register_handler(void)
{
- nss_core_register_handler(NSS_LAG0_INTERFACE_NUM, nss_lag_handler, NULL);
- nss_core_register_handler(NSS_LAG1_INTERFACE_NUM, nss_lag_handler, NULL);
- nss_core_register_handler(NSS_LAG2_INTERFACE_NUM, nss_lag_handler, NULL);
- nss_core_register_handler(NSS_LAG3_INTERFACE_NUM, nss_lag_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_lag_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_LAG0_INTERFACE_NUM, nss_lag_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_LAG1_INTERFACE_NUM, nss_lag_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_LAG2_INTERFACE_NUM, nss_lag_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_LAG3_INTERFACE_NUM, nss_lag_handler, NULL);
}
/**
diff --git a/nss_log.c b/nss_log.c
index 7bed5f8..9dd56db 100644
--- a/nss_log.c
+++ b/nss_log.c
@@ -675,8 +675,11 @@
}
nss_debug_interface_set_callback(nss_debug_interface_event, NULL);
- core_status = nss_core_register_handler(NSS_DEBUG_INTERFACE, nss_debug_interface_handler, NULL);
- if (core_status != NSS_CORE_STATUS_SUCCESS) {
- nss_warning("NSS logbuffer init failed with register handler:%d\n", core_status);
+
+ for (i = 0; i < NSS_MAX_CORES; i++) {
+ core_status = nss_core_register_handler(&nss_top_main.nss[i], NSS_DEBUG_INTERFACE, nss_debug_interface_handler, NULL);
+ if (core_status != NSS_CORE_STATUS_SUCCESS) {
+ nss_warning("NSS logbuffer init failed with register handler:%d\n", core_status);
+ }
}
}
diff --git a/nss_lso_rx.c b/nss_lso_rx.c
index 2eab7d7..5d3b012 100644
--- a/nss_lso_rx.c
+++ b/nss_lso_rx.c
@@ -82,7 +82,7 @@
* nss_lso_rx_register_handler()
* Register handler for messaging
*/
-void nss_lso_rx_register_handler(void)
+void nss_lso_rx_register_handler(struct nss_ctx_instance *nss_ctx)
{
- nss_core_register_handler(NSS_LSO_RX_INTERFACE, nss_rx_lso_rx_interface_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_LSO_RX_INTERFACE, nss_rx_lso_rx_interface_handler, NULL);
}
diff --git a/nss_map_t.c b/nss_map_t.c
index b2487cf..e88b369 100644
--- a/nss_map_t.c
+++ b/nss_map_t.c
@@ -326,7 +326,7 @@
nss_top_main.map_t_msg_callback = event_callback;
- nss_core_register_handler(if_num, nss_map_t_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_map_t_handler, NULL);
spin_lock_bh(&nss_map_t_debug_stats_lock);
for (i = 0; i < NSS_MAX_MAP_T_DYNAMIC_INTERFACES; i++) {
@@ -361,7 +361,7 @@
nss_top_main.map_t_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
spin_lock_bh(&nss_map_t_debug_stats_lock);
for (i = 0; i < NSS_MAX_MAP_T_DYNAMIC_INTERFACES; i++) {
@@ -399,8 +399,10 @@
*/
void nss_map_t_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = nss_map_t_get_context();
+
nss_info("nss_map_t_register_handler");
sema_init(&nss_map_t_pvt.sem, 1);
init_completion(&nss_map_t_pvt.complete);
- nss_core_register_handler(NSS_MAP_T_INTERFACE, nss_map_t_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_MAP_T_INTERFACE, nss_map_t_handler, NULL);
}
diff --git a/nss_n2h.c b/nss_n2h.c
index fc4ee15..7981a01 100644
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -1382,9 +1382,9 @@
/*
* nss_n2h_register_handler()
*/
-void nss_n2h_register_handler()
+void nss_n2h_register_handler(struct nss_ctx_instance *nss_ctx)
{
- nss_core_register_handler(NSS_N2H_INTERFACE, nss_n2h_interface_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_N2H_INTERFACE, nss_n2h_interface_handler, NULL);
}
/*
diff --git a/nss_oam.c b/nss_oam.c
index 9d3204e..26f5906 100644
--- a/nss_oam.c
+++ b/nss_oam.c
@@ -162,7 +162,9 @@
*/
void nss_oam_register_handler(void)
{
- if (nss_core_register_handler(NSS_OAM_INTERFACE, nss_oam_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[nss_top_main.oam_handler_id];
+
+ if (nss_core_register_handler(nss_ctx, NSS_OAM_INTERFACE, nss_oam_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("OAM handler failed to register");
}
}
diff --git a/nss_phys_if.c b/nss_phys_if.c
index 01ae028..2f1cd2f 100644
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -347,11 +347,11 @@
/*
* nss_phys_if_register_handler()
*/
-void nss_phys_if_register_handler(uint32_t if_num)
+void nss_phys_if_register_handler(struct nss_ctx_instance *nss_ctx, uint32_t if_num)
{
uint32_t ret;
- ret = nss_core_register_handler(if_num, nss_phys_if_msg_handler, NULL);
+ ret = nss_core_register_handler(nss_ctx, if_num, nss_phys_if_msg_handler, NULL);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("Message handler FAILED to be registered for interface %d", if_num);
diff --git a/nss_portid.c b/nss_portid.c
index 01d2f9e..cf317e6 100644
--- a/nss_portid.c
+++ b/nss_portid.c
@@ -468,7 +468,7 @@
}
spin_unlock(&nss_portid_spinlock);
- (void) nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
nss_ctx->subsys_dp_register[if_num].cb = NULL;
nss_ctx->subsys_dp_register[if_num].app_data = NULL;
@@ -494,7 +494,9 @@
*/
void nss_portid_register_handler(void)
{
- nss_core_register_handler(NSS_PORTID_INTERFACE, nss_portid_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_portid_get_ctx();
+
+ nss_core_register_handler(nss_ctx, NSS_PORTID_INTERFACE, nss_portid_handler, NULL);
sema_init(&pid.sem, 1);
init_completion(&pid.complete);
diff --git a/nss_ppe.c b/nss_ppe.c
index 06f0a6c..cd3e1f6 100644
--- a/nss_ppe.c
+++ b/nss_ppe.c
@@ -211,6 +211,16 @@
}
/*
+ * nss_ppe_get_context()
+ * get NSS context instance for ppe
+ */
+struct nss_ctx_instance *nss_ppe_get_context(void)
+{
+ return &nss_top_main.nss[nss_top_main.ppe_handler_id];
+}
+EXPORT_SYMBOL(nss_ppe_get_context);
+
+/*
* nss_ppe_register_handler()
* debugfs stats msg handler received on static ppe interface
*
@@ -218,7 +228,9 @@
*/
void nss_ppe_register_handler(void)
{
- nss_core_register_handler(NSS_PPE_INTERFACE, nss_ppe_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_ppe_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_PPE_INTERFACE, nss_ppe_handler, NULL);
}
/*
diff --git a/nss_pppoe.c b/nss_pppoe.c
index 1aa61aa..d8b4398 100644
--- a/nss_pppoe.c
+++ b/nss_pppoe.c
@@ -214,9 +214,9 @@
/*
* nss_pppoe_register_handler()
*/
-void nss_pppoe_register_handler()
+void nss_pppoe_register_handler(struct nss_ctx_instance *nss_ctx)
{
- nss_core_register_handler(NSS_PPPOE_RX_INTERFACE, nss_pppoe_rx_msg_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_PPPOE_RX_INTERFACE, nss_pppoe_rx_msg_handler, NULL);
}
/*
@@ -224,7 +224,7 @@
* Initialize pppoe message.
*/
void nss_pppoe_msg_init(struct nss_pppoe_msg *npm, uint16_t if_num, uint32_t type, uint32_t len,
- void *cb, void *app_data)
+ void *cb, void *app_data)
{
nss_cmn_msg_init(&npm->cm, if_num, type, len, (void *)cb, app_data);
}
diff --git a/nss_pptp.c b/nss_pptp.c
index f22c503..25828b4 100644
--- a/nss_pptp.c
+++ b/nss_pptp.c
@@ -357,7 +357,7 @@
nss_top_main.pptp_msg_callback = notification_callback;
- nss_core_register_handler(if_num, nss_pptp_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_pptp_handler, NULL);
spin_lock_bh(&nss_pptp_session_debug_stats_lock);
for (i = 0; i < NSS_MAX_PPTP_DYNAMIC_INTERFACES; i++) {
@@ -399,7 +399,7 @@
nss_top_main.pptp_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
/*
@@ -427,7 +427,7 @@
int i;
nss_info("nss_pptp_register_handler");
- nss_core_register_handler(NSS_PPTP_INTERFACE, nss_pptp_handler, NULL);
+ nss_core_register_handler(nss_pptp_get_context(), NSS_PPTP_INTERFACE, nss_pptp_handler, NULL);
spin_lock_bh(&nss_pptp_session_debug_stats_lock);
for (i = 0; i < NSS_MAX_PPTP_DYNAMIC_INTERFACES; i++) {
diff --git a/nss_profiler.c b/nss_profiler.c
index 5ead651..f99767c 100644
--- a/nss_profiler.c
+++ b/nss_profiler.c
@@ -130,7 +130,7 @@
nss_assert(core_id < NSS_CORE_MAX);
if ((core_id == NSS_CORE_0) && (NSS_CORE_STATUS_SUCCESS !=
- nss_core_register_handler(NSS_PROFILER_INTERFACE, nss_profiler_rx_msg_handler, NULL))) {
+ nss_core_register_handler(ctx, NSS_PROFILER_INTERFACE, nss_profiler_rx_msg_handler, NULL))) {
nss_warning("Message handler FAILED to be registered for profiler");
return NULL;
}
@@ -148,7 +148,7 @@
{
nss_assert(core_id < NSS_CORE_MAX);
- nss_core_register_handler(NSS_PROFILER_INTERFACE, NULL, NULL);
+ nss_core_register_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE, NULL, NULL);
nss_top_main.profiler_callback[core_id] = NULL;
nss_top_main.profiler_ctx[core_id] = NULL;
}
diff --git a/nss_sjack.c b/nss_sjack.c
index b6f634c..17fedbd 100644
--- a/nss_sjack.c
+++ b/nss_sjack.c
@@ -197,12 +197,24 @@
}
/*
+ * nss_sjack_get_context()
+ * get NSS context instance for sjack
+ */
+struct nss_ctx_instance *nss_sjack_get_context(void)
+{
+ return &nss_top_main.nss[nss_top_main.sjack_handler_id];
+}
+EXPORT_SYMBOL(nss_sjack_get_context);
+
+/*
* nss_sjack_register_handler()
* Registering handler for sending msg to sjack node on NSS.
*/
void nss_sjack_register_handler(void)
{
- nss_core_register_handler(NSS_SJACK_INTERFACE, nss_sjack_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_sjack_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_SJACK_INTERFACE, nss_sjack_handler, NULL);
}
EXPORT_SYMBOL(nss_sjack_register_if);
diff --git a/nss_trustsec_tx.c b/nss_trustsec_tx.c
index ac81868..348eb1b 100644
--- a/nss_trustsec_tx.c
+++ b/nss_trustsec_tx.c
@@ -315,7 +315,9 @@
*/
void nss_trustsec_tx_register_handler(void)
{
- nss_core_register_handler(NSS_TRUSTSEC_TX_INTERFACE, nss_trustsec_tx_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_trustsec_tx_get_ctx();
+
+ nss_core_register_handler(nss_ctx, NSS_TRUSTSEC_TX_INTERFACE, nss_trustsec_tx_handler, NULL);
sema_init(&ttx.sem, 1);
init_completion(&ttx.complete);
diff --git a/nss_tun6rd.c b/nss_tun6rd.c
index 2b7f0cf..d538b13 100644
--- a/nss_tun6rd.c
+++ b/nss_tun6rd.c
@@ -164,15 +164,15 @@
nss_top_main.tun6rd_msg_callback = event_callback;
- nss_core_register_handler(if_num, nss_tun6rd_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_tun6rd_handler, NULL);
return nss_ctx;
}
/*
- * nss_get_tun6rd_context()
+ * nss_tun6rd_get_context()
*/
-struct nss_ctx_instance * nss_tun6rd_get_context()
+struct nss_ctx_instance *nss_tun6rd_get_context()
{
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tun6rd_handler_id];
}
@@ -194,7 +194,7 @@
nss_top_main.tun6rd_msg_callback = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
/*
@@ -203,7 +203,7 @@
*/
void nss_tun6rd_msg_init(struct nss_tun6rd_msg *ncm, uint16_t if_num, uint32_t type, uint32_t len, void *cb, void *app_data)
{
- nss_cmn_msg_init(&ncm->cm, if_num, type, len, cb, app_data);
+ nss_cmn_msg_init(&ncm->cm, if_num, type, len, cb, app_data);
}
EXPORT_SYMBOL(nss_tun6rd_get_context);
diff --git a/nss_tunipip6.c b/nss_tunipip6.c
index 13a044e..fb8ad5a 100644
--- a/nss_tunipip6.c
+++ b/nss_tunipip6.c
@@ -185,16 +185,26 @@
}
/*
+ * nss_tunipip6_get_context()
+ */
+struct nss_ctx_instance *nss_tunipip6_get_context(void)
+{
+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.tunipip6_handler_id];
+}
+
+/*
* nss_tunipip6_register_handler()
*/
void nss_tunipip6_register_handler()
{
- nss_core_register_handler(NSS_TUNIPIP6_INTERFACE, nss_tunipip6_handler, NULL);
+ struct nss_ctx_instance *nss_ctx = nss_tunipip6_get_context();
+
+ nss_core_register_handler(nss_ctx, NSS_TUNIPIP6_INTERFACE, nss_tunipip6_handler, NULL);
}
/*
* nss_tunipip6_msg_init()
- * Initialize nss_tunipip6 msg.
+ * Initialize nss_tunipip6 msg.
*/
void nss_tunipip6_msg_init(struct nss_tunipip6_msg *ntm, uint16_t if_num, uint32_t type, uint32_t len, void *cb, void *app_data)
{
diff --git a/nss_tx_rx_common.h b/nss_tx_rx_common.h
index 5882507..e3b9232 100644
--- a/nss_tx_rx_common.h
+++ b/nss_tx_rx_common.h
@@ -176,7 +176,7 @@
/*
* CB handlers for variour interfaces
*/
-void nss_phys_if_register_handler(uint32_t if_num);
+void nss_phys_if_register_handler(struct nss_ctx_instance *nss_ctx, uint32_t if_num);
extern void nss_crypto_register_handler(void);
extern void nss_crypto_cmn_register_handler(void);
extern void nss_ipsec_register_handler(void);
@@ -184,16 +184,16 @@
extern void nss_ipv4_reasm_register_handler(void);
extern void nss_ipv6_register_handler(void);
extern void nss_ipv6_reasm_register_handler(void);
-extern void nss_n2h_register_handler(void);
+extern void nss_n2h_register_handler(struct nss_ctx_instance *nss_ctx);
extern void nss_tunipip6_register_handler(void);
-extern void nss_pppoe_register_handler(void);
+extern void nss_pppoe_register_handler(struct nss_ctx_instance *nss_ctx);
extern void nss_freq_register_handler(void);
-extern void nss_eth_rx_register_handler(void);
+extern void nss_eth_rx_register_handler(struct nss_ctx_instance *nss_ctx);
extern void nss_edma_register_handler(void);
extern void nss_lag_register_handler(void);
-extern void nss_dynamic_interface_register_handler(void);
+extern void nss_dynamic_interface_register_handler(struct nss_ctx_instance *nss_ctx);
extern void nss_gre_redir_register_handler(void);
-extern void nss_lso_rx_register_handler(void);
+extern void nss_lso_rx_register_handler(struct nss_ctx_instance *nss_ctx);
extern void nss_sjack_register_handler(void);
extern void nss_wifi_register_handler(void);
extern struct net_device *nss_tstamp_register_netdev(void);
diff --git a/nss_tx_rx_virt_if.c b/nss_tx_rx_virt_if.c
index 699df34..438f9a0 100644
--- a/nss_tx_rx_virt_if.c
+++ b/nss_tx_rx_virt_if.c
@@ -403,11 +403,13 @@
*/
static uint32_t nss_tx_rx_virt_if_register_handler(struct nss_tx_rx_virt_if_handle *handle)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wlan_handler_id];
+
uint32_t ret;
struct nss_tx_rx_virt_if_pvt *nrip = NULL;
int32_t if_num = handle->if_num;
- ret = nss_core_register_handler(if_num, nss_tx_rx_virt_if_msg_handler, NULL);
+ ret = nss_core_register_handler(nss_ctx, if_num, nss_tx_rx_virt_if_msg_handler, NULL);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%d: Message handler failed to be registered for interface\n", if_num);
return NSS_TX_RX_VIRT_IF_CORE_FAILURE;
@@ -661,7 +663,7 @@
return NSS_TX_FAILURE;
}
- ret = nss_core_unregister_handler(if_num);
+ ret = nss_core_unregister_handler(nss_ctx, if_num);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%p: Not able to unregister handler for redir_if interface %d with NSS core\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
diff --git a/nss_virt_if.c b/nss_virt_if.c
index b4eed1f..27371df 100644
--- a/nss_virt_if.c
+++ b/nss_virt_if.c
@@ -204,15 +204,23 @@
}
/*
+ * nss_virt_if_get_context()
+ */
+struct nss_ctx_instance *nss_virt_if_get_context(int i)
+{
+ return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.virt_if_handler_id[i]];
+}
+
+/*
* nss_virt_if_register_handler()
* register msg handler for virtual interface.
*/
-static uint32_t nss_virt_if_register_handler(struct nss_virt_if_handle *handle)
+static uint32_t nss_virt_if_register_handler(struct nss_ctx_instance *nss_ctx, struct nss_virt_if_handle *handle)
{
uint32_t ret;
int32_t if_num = handle->if_num;
- ret = nss_core_register_handler(if_num, nss_virt_if_msg_handler, NULL);
+ ret = nss_core_register_handler(nss_ctx, if_num, nss_virt_if_msg_handler, NULL);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%d: Message handler failed to be registered for interface\n", if_num);
return NSS_VIRT_IF_CORE_FAILURE;
@@ -346,7 +354,7 @@
spin_unlock_bh(&nss_virt_if_lock);
/* Register the msg handler for if_num */
- ret = nss_virt_if_register_handler(handle);
+ ret = nss_virt_if_register_handler(nss_ctx, handle);
if (ret != NSS_VIRT_IF_SUCCESS) {
nss_warning("%p: Registration handler failed reason: %d\n", handle->nss_ctx, ret);
nss_virt_if_handle_destroy(handle);
@@ -482,13 +490,13 @@
* nss_virt_if_register_handler_sync()
* register msg handler for virtual interface and initialize semaphore and completion.
*/
-static uint32_t nss_virt_if_register_handler_sync(struct nss_virt_if_handle *handle)
+static uint32_t nss_virt_if_register_handler_sync(struct nss_ctx_instance *nss_ctx, struct nss_virt_if_handle *handle)
{
uint32_t ret;
struct nss_virt_if_pvt *nvip = NULL;
int32_t if_num = handle->if_num;
- ret = nss_core_register_handler(if_num, nss_virt_if_msg_handler, NULL);
+ ret = nss_core_register_handler(nss_ctx, if_num, nss_virt_if_msg_handler, NULL);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%d: Message handler failed to be registered for interface\n", if_num);
return NSS_VIRT_IF_CORE_FAILURE;
@@ -583,7 +591,7 @@
}
/* Initializes the semaphore and also sets the msg handler for if_num */
- ret = nss_virt_if_register_handler_sync(handle);
+ ret = nss_virt_if_register_handler_sync(nss_ctx, handle);
if (ret != NSS_VIRT_IF_SUCCESS) {
nss_warning("%p: Registration handler failed reason: %d\n", nss_ctx, ret);
goto error;
@@ -672,7 +680,7 @@
return NSS_TX_FAILURE;
}
- ret = nss_core_unregister_handler(if_num);
+ ret = nss_core_unregister_handler(nss_ctx, if_num);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("Not able to unregister handler for virt_if interface %d with NSS core\n", if_num);
return NSS_TX_FAILURE_BAD_PARAM;
@@ -725,7 +733,7 @@
return NSS_TX_FAILURE;
}
- ret = nss_core_unregister_handler(if_num);
+ ret = nss_core_unregister_handler(nss_ctx, if_num);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%p: Not able to unregister handler for virt_if interface %d with NSS core\n", nss_ctx, if_num);
return NSS_TX_FAILURE_BAD_PARAM;
diff --git a/nss_vlan.c b/nss_vlan.c
index 770339b..d562127 100644
--- a/nss_vlan.c
+++ b/nss_vlan.c
@@ -402,7 +402,7 @@
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);
+ nss_core_register_handler(nss_ctx, if_num, nss_vlan_handler, app_ctx);
return nss_ctx;
}
@@ -422,7 +422,7 @@
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);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
EXPORT_SYMBOL(nss_unregister_vlan_if);
@@ -432,8 +432,10 @@
*/
void nss_vlan_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = nss_vlan_get_context();
+
nss_info("nss_vlan_register_handler\n");
- nss_core_register_handler(NSS_VLAN_INTERFACE, nss_vlan_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_VLAN_INTERFACE, nss_vlan_handler, NULL);
sema_init(&vlan_pvt.sem, 1);
init_completion(&vlan_pvt.complete);
diff --git a/nss_wifi.c b/nss_wifi.c
index f0a3b17..a628daf 100644
--- a/nss_wifi.c
+++ b/nss_wifi.c
@@ -270,11 +270,15 @@
*/
void nss_wifi_register_handler(void )
{
+ 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_info("nss_wifi_register_handler");
- nss_core_register_handler(NSS_WIFI_INTERFACE0, nss_wifi_handler, NULL);
- nss_core_register_handler(NSS_WIFI_INTERFACE1, nss_wifi_handler, NULL);
- nss_core_register_handler(NSS_WIFI_INTERFACE2, nss_wifi_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE0, nss_wifi_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE1, nss_wifi_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE2, nss_wifi_handler, NULL);
}
EXPORT_SYMBOL(nss_wifi_get_context);
diff --git a/nss_wifi_if.c b/nss_wifi_if.c
index 676b135..3deed14 100644
--- a/nss_wifi_if.c
+++ b/nss_wifi_if.c
@@ -140,11 +140,12 @@
*/
static uint32_t nss_wifi_if_register_handler(struct nss_wifi_if_handle *handle)
{
+ struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[nss_top_main.wlan_handler_id];
uint32_t ret;
struct nss_wifi_if_pvt *nwip = NULL;
int32_t if_num = handle->if_num;
- ret = nss_core_register_handler(if_num, nss_wifi_if_msg_handler, NULL);
+ ret = nss_core_register_handler(nss_ctx, if_num, nss_wifi_if_msg_handler, NULL);
if (ret != NSS_CORE_STATUS_SUCCESS) {
nss_warning("%d: Message handler failed to be registered for interface ret %d\n", if_num, ret);
diff --git a/nss_wifi_vdev.c b/nss_wifi_vdev.c
index 76ab99c..57f5d62 100644
--- a/nss_wifi_vdev.c
+++ b/nss_wifi_vdev.c
@@ -290,7 +290,7 @@
nss_top_main.if_rx_msg_callback[if_num] = vdev_event_callback;
- nss_core_register_handler(if_num, nss_wifi_vdev_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_wifi_vdev_handler, NULL);
return NSS_CORE_STATUS_SUCCESS;
}
@@ -313,7 +313,7 @@
nss_top_main.if_rx_msg_callback[if_num] = NULL;
- nss_core_unregister_handler(if_num);
+ nss_core_unregister_handler(nss_ctx, if_num);
}
EXPORT_SYMBOL(nss_wifi_vdev_tx_msg_ext);
diff --git a/nss_wifili.c b/nss_wifili.c
index bc9b678..9a57b07 100644
--- a/nss_wifili.c
+++ b/nss_wifili.c
@@ -448,7 +448,7 @@
nss_ctx->subsys_dp_register[if_num].features = features;
nss_top_main.wifili_msg_callback = event_callback;
- nss_core_register_handler(if_num, nss_wifili_handler, NULL);
+ nss_core_register_handler(nss_ctx, if_num, nss_wifili_handler, NULL);
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
}
@@ -528,8 +528,10 @@
*/
void nss_wifili_register_handler(void)
{
+ struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.wifi_handler_id];
+
nss_info("nss_wifili_register_handler");
- nss_core_register_handler(NSS_WIFILI_INTERFACE, nss_wifili_handler, NULL);
+ nss_core_register_handler(nss_ctx, NSS_WIFILI_INTERFACE, nss_wifili_handler, NULL);
sema_init(&wifili_pvt.sem, 1);
init_completion(&wifili_pvt.complete);