[qca-nss-drv] Support for IGS module reference APIs.
Change-Id: I2156bd34a590c05c9fac7d3d8364c33828b28b77
Signed-off-by: Manish Verma <maniverm@codeaurora.org>
diff --git a/nss_igs.c b/nss_igs.c
index 1fd91eb..5b10bdd 100644
--- a/nss_igs.c
+++ b/nss_igs.c
@@ -14,9 +14,15 @@
**************************************************************************
*/
+#ifdef CONFIG_NET_CLS_ACT
+#include <linux/tc_act/tc_nss_mirred.h>
+#endif
+
#include "nss_tx_rx_common.h"
#include "nss_igs_stats.h"
+static struct module *nss_igs_module;
+
/*
* nss_igs_verify_if_num()
* Verify interface number passed to us.
@@ -152,3 +158,40 @@
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id];
}
EXPORT_SYMBOL(nss_igs_get_context);
+
+#ifdef CONFIG_NET_CLS_ACT
+/*
+ * nss_igs_module_save()
+ * Save the ingress shaping module reference.
+ */
+void nss_igs_module_save(struct tc_action_ops *act, struct module *module)
+{
+ nss_assert(act);
+ nss_assert(act->type == TCA_ACT_MIRRED_NSS);
+
+ nss_igs_module = module;
+}
+EXPORT_SYMBOL(nss_igs_module_save);
+#endif
+
+/*
+ * nss_igs_module_get()
+ * Get the ingress shaping module reference.
+ */
+bool nss_igs_module_get()
+{
+ nss_assert(nss_igs_module);
+ return try_module_get(nss_igs_module);
+}
+EXPORT_SYMBOL(nss_igs_module_get);
+
+/*
+ * nss_igs_module_put()
+ * Release the ingress shaping module reference.
+ */
+void nss_igs_module_put()
+{
+ nss_assert(nss_igs_module);
+ module_put(nss_igs_module);
+}
+EXPORT_SYMBOL(nss_igs_module_put);