aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/reass/ip4_full_reass.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-10-01 13:00:22 +0000
committerOle Trøan <otroan@employees.org>2019-10-09 12:53:44 +0000
commit7b2e9fb1a8f389fa7b88fcbaf3356cbdae254250 (patch)
tree2ef293fd777c7260f3f3fdbc7315a460c5ce35aa /src/vnet/ip/reass/ip4_full_reass.c
parentd5262831a3379afc77cab9a16067765585dd5175 (diff)
map: use ip6-full-reassembly instead of own code
Remove map's implementation of reassembly and use common ip6-full-reassembly functionality. This makes it easier to maintain by removing duplicate code/functionality. Type: refactor Change-Id: I430e888b704e28c100a9ce075d1460cb529e4676 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/ip/reass/ip4_full_reass.c')
-rw-r--r--src/vnet/ip/reass/ip4_full_reass.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vnet/ip/reass/ip4_full_reass.c b/src/vnet/ip/reass/ip4_full_reass.c
index 176c01c74fb..87a677208fb 100644
--- a/src/vnet/ip/reass/ip4_full_reass.c
+++ b/src/vnet/ip/reass/ip4_full_reass.c
@@ -185,6 +185,8 @@ typedef struct
u32 fq_index;
u32 fq_feature_index;
+ // reference count for enabling/disabling feature - per interface
+ u32 *feature_use_refcount_per_intf;
} ip4_full_reass_main_t;
extern ip4_full_reass_main_t ip4_full_reass_main;
@@ -1448,6 +1450,7 @@ ip4_full_reass_init_function (vlib_main_t * vm)
rm->fq_feature_index =
vlib_frame_queue_main_init (ip4_full_reass_node_feature.index, 0);
+ rm->feature_use_refcount_per_intf = NULL;
return error;
}
@@ -1793,6 +1796,35 @@ VLIB_REGISTER_NODE (ip4_full_reass_feature_handoff_node) = {
};
/* *INDENT-ON* */
+#ifndef CLIB_MARCH_VARIANT
+int
+ip4_full_reass_enable_disable_with_refcnt (u32 sw_if_index, int is_enable)
+{
+ ip4_full_reass_main_t *rm = &ip4_full_reass_main;
+ vec_validate (rm->feature_use_refcount_per_intf, sw_if_index);
+ if (is_enable)
+ {
+ if (!rm->feature_use_refcount_per_intf[sw_if_index])
+ {
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
+ return vnet_feature_enable_disable ("ip4-unicast",
+ "ip4-full-reassembly-feature",
+ sw_if_index, 1, 0, 0);
+ }
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
+ }
+ else
+ {
+ --rm->feature_use_refcount_per_intf[sw_if_index];
+ if (!rm->feature_use_refcount_per_intf[sw_if_index])
+ return vnet_feature_enable_disable ("ip4-unicast",
+ "ip4-full-reassembly-feature",
+ sw_if_index, 0, 0, 0);
+ }
+ return -1;
+}
+#endif
+
/*
* fd.io coding-style-patch-verification: ON
*