From bd6ba14bebd27181ee18cfc3aebb21a78d96d672 Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Sat, 21 Aug 2021 00:12:37 +0800 Subject: src: Optimize prefix match only if is big-endian A prefix of integer type is big-endian in nature. Prefix match can be optimized to truncated 'cmp' only if it is big-endian. [ Add one tests/py for this use-case --pablo ] Fixes: 25338cdb6c77 ("src: Optimize prefix matches on byte-boundaries") Signed-off-by: Xiao Liang Signed-off-by: Pablo Neira Ayuso --- tests/py/any/meta.t.payload | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/py/any/meta.t.payload') diff --git a/tests/py/any/meta.t.payload b/tests/py/any/meta.t.payload index b79a0255..d8351c27 100644 --- a/tests/py/any/meta.t.payload +++ b/tests/py/any/meta.t.payload @@ -155,6 +155,12 @@ ip test-ip4 input [ meta load mark => reg 1 ] [ cmp neq reg 1 0x00000010 ] +# meta mark 0xffffff00/24 +ip test-ip4 input + [ meta load mark => reg 1 ] + [ bitwise reg 1 = ( reg 1 & 0xffffff00 ) ^ 0x00000000 ] + [ cmp eq reg 1 0xffffff00 ] + # meta mark or 0x03 == 0x01 ip test-ip4 input [ meta load mark => reg 1 ] -- cgit v1.2.3