aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-09-30 14:35:36 +0000
committerOle Trøan <otroan@employees.org>2019-09-30 16:45:56 +0000
commit63c735362d3758677c535196885c7acfa0a82efa (patch)
treeb5281effdc1d9d3d03f624bab8d6dc5568eeae44 /src/vnet
parent5517bd34535e4ffffb838a835bb95ddcb77e2bba (diff)
ip: svr: fix feature refcounts
Reference counts need to be per-interface as opposed to global. This allows configuring the feature on more than one interface correctly. Type: fix Fixes: de34c35fc73226943538149fae9dbc5cfbdc6e75 Change-Id: I05534ac59fa86e67290737ec6c61df2c19acab48 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/reass/ip4_sv_reass.c17
-rw-r--r--src/vnet/ip/reass/ip6_sv_reass.c17
2 files changed, 20 insertions, 14 deletions
diff --git a/src/vnet/ip/reass/ip4_sv_reass.c b/src/vnet/ip/reass/ip4_sv_reass.c
index 25119e8d0a7..91a50036b4f 100644
--- a/src/vnet/ip/reass/ip4_sv_reass.c
+++ b/src/vnet/ip/reass/ip4_sv_reass.c
@@ -148,8 +148,8 @@ typedef struct
u32 fq_index;
u32 fq_feature_index;
- // reference count for enabling/disabling feature
- u32 feature_use_refcount;
+ // reference count for enabling/disabling feature - per interface
+ u32 *feature_use_refcount_per_intf;
} ip4_sv_reass_main_t;
@@ -822,6 +822,8 @@ ip4_sv_reass_init_function (vlib_main_t * vm)
rm->fq_feature_index =
vlib_frame_queue_main_init (ip4_sv_reass_node_feature.index, 0);
+ rm->feature_use_refcount_per_intf = NULL;
+
return error;
}
@@ -1160,21 +1162,22 @@ int
ip4_sv_reass_enable_disable_with_refcnt (u32 sw_if_index, int is_enable)
{
ip4_sv_reass_main_t *rm = &ip4_sv_reass_main;
+ vec_validate (rm->feature_use_refcount_per_intf, sw_if_index);
if (is_enable)
{
- if (!rm->feature_use_refcount)
+ if (!rm->feature_use_refcount_per_intf[sw_if_index])
{
- ++rm->feature_use_refcount;
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
return vnet_feature_enable_disable ("ip4-unicast",
"ip4-sv-reassembly-feature",
sw_if_index, 1, 0, 0);
}
- ++rm->feature_use_refcount;
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
}
else
{
- --rm->feature_use_refcount;
- if (!rm->feature_use_refcount)
+ --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-sv-reassembly-feature",
sw_if_index, 0, 0, 0);
diff --git a/src/vnet/ip/reass/ip6_sv_reass.c b/src/vnet/ip/reass/ip6_sv_reass.c
index e2f425a6aa8..9b5d5b2922b 100644
--- a/src/vnet/ip/reass/ip6_sv_reass.c
+++ b/src/vnet/ip/reass/ip6_sv_reass.c
@@ -146,8 +146,8 @@ typedef struct
u32 fq_index;
u32 fq_feature_index;
- // reference count for enabling/disabling feature
- u32 feature_use_refcount;
+ // reference count for enabling/disabling feature - per interface
+ u32 *feature_use_refcount_per_intf;
} ip6_sv_reass_main_t;
extern ip6_sv_reass_main_t ip6_sv_reass_main;
@@ -945,6 +945,8 @@ ip6_sv_reass_init_function (vlib_main_t * vm)
rm->fq_feature_index =
vlib_frame_queue_main_init (ip6_sv_reass_node_feature.index, 0);
+ rm->feature_use_refcount_per_intf = NULL;
+
return error;
}
@@ -1300,21 +1302,22 @@ int
ip6_sv_reass_enable_disable_with_refcnt (u32 sw_if_index, int is_enable)
{
ip6_sv_reass_main_t *rm = &ip6_sv_reass_main;
+ vec_validate (rm->feature_use_refcount_per_intf, sw_if_index);
if (is_enable)
{
- if (!rm->feature_use_refcount)
+ if (!rm->feature_use_refcount_per_intf[sw_if_index])
{
- ++rm->feature_use_refcount;
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
return vnet_feature_enable_disable ("ip6-unicast",
"ip6-sv-reassembly-feature",
sw_if_index, 1, 0, 0);
}
- ++rm->feature_use_refcount;
+ ++rm->feature_use_refcount_per_intf[sw_if_index];
}
else
{
- --rm->feature_use_refcount;
- if (!rm->feature_use_refcount)
+ --rm->feature_use_refcount_per_intf[sw_if_index];
+ if (!rm->feature_use_refcount_per_intf[sw_if_index])
return vnet_feature_enable_disable ("ip6-unicast",
"ip6-sv-reassembly-feature",
sw_if_index, 0, 0, 0);