summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-10-31 19:56:44 +0100
committerFlorin Coras <florin.coras@gmail.com>2021-11-02 17:33:47 +0000
commit06e0085a6721d0c3650c9af2cae9b5aa2dc72f88 (patch)
tree557ee941eee7b73b488b887affa28b8664af589f
parent55c8fa4f23b6830904c055f524c404d58ac85d42 (diff)
ip: fix build without vector unit
Change-Id: I102f84d6d72a7f17e62fb8c16a1d4a3234753476 Type: fix Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/vnet/ip/ip4_source_and_port_range_check.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_source_and_port_range_check.c b/src/vnet/ip/ip4_source_and_port_range_check.c
index 4c311eb8335..2edbeeddf10 100644
--- a/src/vnet/ip/ip4_source_and_port_range_check.c
+++ b/src/vnet/ip/ip4_source_and_port_range_check.c
@@ -99,7 +99,9 @@ static inline u32
check_adj_port_range_x1 (const protocol_port_range_dpo_t * ppr_dpo,
u16 dst_port, u32 next)
{
+#ifdef CLIB_HAVE_VEC128
u16x8 key = u16x8_splat (dst_port);
+#endif
int i;
if (NULL == ppr_dpo || dst_port == 0)
@@ -107,9 +109,20 @@ check_adj_port_range_x1 (const protocol_port_range_dpo_t * ppr_dpo,
for (i = 0; i < ppr_dpo->n_used_blocks; i++)
+#ifdef CLIB_HAVE_VEC128
if (!u16x8_is_all_zero ((ppr_dpo->blocks[i].low.as_u16x8 <= key) &
(ppr_dpo->blocks[i].hi.as_u16x8 >= key)))
return next;
+#else
+ {
+ for (int j = 0; j < 8; j++)
+ {
+ if ((ppr_dpo->blocks[i].low.as_u16[j] <= dst_port) &&
+ (ppr_dpo->blocks[i].hi.as_u16[j] >= dst_port))
+ return next;
+ }
+ };
+#endif
return IP4_SOURCE_AND_PORT_RANGE_CHECK_NEXT_DROP;
}