[qca-nss-ecm] Add Mark Classifier
With this classifier an external kernel module which
is registered with this classifiers callbacks can inspect
the skb and make smart decisions on that buffer, returns
a mark value extracted from the buffer for future use.
Change-Id: I6b1cce6585d105603bef84f697bc0d47fb6b0105
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
diff --git a/ecm_classifier.c b/ecm_classifier.c
index a6da26c..0dac519 100644
--- a/ecm_classifier.c
+++ b/ecm_classifier.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016, 2018, 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.
@@ -50,6 +50,9 @@
#ifdef ECM_CLASSIFIER_PCC_ENABLE
#include "ecm_classifier_pcc.h"
#endif
+#ifdef ECM_CLASSIFIER_MARK_ENABLE
+#include "ecm_classifier_mark.h"
+#endif
/*
* ecm_classifier_assign_classifier()
@@ -115,6 +118,19 @@
return (struct ecm_classifier_instance *)chfi;
}
#endif
+#ifdef ECM_CLASSIFIER_MARK_ENABLE
+ if (type == ECM_CLASSIFIER_TYPE_MARK) {
+ struct ecm_classifier_mark_instance *ecmi;
+ ecmi = ecm_classifier_mark_instance_alloc(ci);
+ if (!ecmi) {
+ DEBUG_TRACE("%p: Failed to create mark classifier\n", ci);
+ return NULL;
+ }
+ DEBUG_TRACE("%p: Created mark classifier: %p\n", ci, ecmi);
+ ecm_db_connection_classifier_assign(ci, (struct ecm_classifier_instance *)ecmi);
+ return (struct ecm_classifier_instance *)ecmi;
+ }
+#endif
DEBUG_ASSERT(NULL, "%p: Unsupported type: %d\n", ci, type);
return NULL;