[qca-nss-drv] Register dentry once for interfaces run both cores
Currently, we are using one stats entry for interfaces that
run on both cores. Second entry creation is not needed.
Change-Id: I69c571908c2649eb4db671d56feac302bc87a93a
Signed-off-by: Cemil Coskun <ccoskun@codeaurora.org>
diff --git a/nss_c2c_rx.c b/nss_c2c_rx.c
index 732a288..e67512e 100644
--- a/nss_c2c_rx.c
+++ b/nss_c2c_rx.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -99,6 +99,9 @@
void nss_c2c_rx_register_handler(struct nss_ctx_instance *nss_ctx)
{
nss_core_register_handler(nss_ctx, NSS_C2C_RX_INTERFACE, nss_c2c_rx_interface_handler, NULL);
- nss_c2c_rx_stats_dentry_create();
+
+ if (nss_ctx->id == NSS_CORE_0) {
+ nss_c2c_rx_stats_dentry_create();
+ }
}
EXPORT_SYMBOL(nss_c2c_rx_register_handler);
diff --git a/nss_c2c_tx.c b/nss_c2c_tx.c
index 683c13b..64e6d08 100644
--- a/nss_c2c_tx.c
+++ b/nss_c2c_tx.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -134,7 +134,10 @@
{
nss_info("%p: nss_c2c_tx_register_handler", nss_ctx);
nss_core_register_handler(nss_ctx, NSS_C2C_TX_INTERFACE, nss_c2c_tx_msg_handler, NULL);
- nss_c2c_tx_stats_dentry_create();
+
+ if (nss_ctx->id == NSS_CORE_0) {
+ nss_c2c_tx_stats_dentry_create();
+ }
}
EXPORT_SYMBOL(nss_c2c_tx_register_handler);
diff --git a/nss_n2h.c b/nss_n2h.c
index 552642a..e6c7697 100644
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -2053,7 +2053,9 @@
nss_core_register_handler(nss_ctx, NSS_N2H_INTERFACE, nss_n2h_interface_handler, NULL);
- nss_n2h_stats_dentry_create();
+ if (nss_ctx->id == NSS_CORE_0) {
+ nss_n2h_stats_dentry_create();
+ }
}
/*
diff --git a/nss_qrfs.c b/nss_qrfs.c
index baa23fe..5401efe 100644
--- a/nss_qrfs.c
+++ b/nss_qrfs.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -420,7 +420,10 @@
void nss_qrfs_register_handler(struct nss_ctx_instance *nss_ctx)
{
nss_core_register_handler(nss_ctx, NSS_QRFS_INTERFACE, nss_qrfs_msg_handler, NULL);
- nss_qrfs_stats_dentry_create();
+
+ if (nss_ctx->id == NSS_CORE_0) {
+ nss_qrfs_stats_dentry_create();
+ }
}
EXPORT_SYMBOL(nss_qrfs_register_handler);
diff --git a/nss_stats.c b/nss_stats.c
index c02f001..516c85d 100644
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -100,7 +100,7 @@
void nss_stats_create_dentry(char *name, const struct file_operations *ops)
{
if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) {
- nss_warning("Faied to create debug entry for subsystem %s\n", name);
+ nss_warning("Failed to create debug entry for subsystem %s\n", name);
}
}
@@ -367,7 +367,7 @@
/*
* nss_stats_clean()
- * Cleanup NSS statistics files
+ * Cleanup NSS statistics files
*/
void nss_stats_clean(void)
{
@@ -382,7 +382,7 @@
/*
* nss_stats_init()
- * Enable NSS statistics
+ * Enable NSS statistics
*/
void nss_stats_init(void)
{
diff --git a/nss_unaligned.c b/nss_unaligned.c
index 840f40d..f84ed8f 100644
--- a/nss_unaligned.c
+++ b/nss_unaligned.c
@@ -84,5 +84,8 @@
void nss_unaligned_register_handler(struct nss_ctx_instance *nss_ctx)
{
nss_core_register_handler(nss_ctx, NSS_UNALIGNED_INTERFACE, nss_unaligned_msg_handler, NULL);
- nss_unaligned_stats_dentry_create();
+
+ if (nss_ctx->id == NSS_CORE_0) {
+ nss_unaligned_stats_dentry_create();
+ }
}