From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B18D3231E for ; Thu, 30 Aug 2018 12:07:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 03:07:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="69028884" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by orsmga007.jf.intel.com with ESMTP; 30 Aug 2018 03:07:48 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.54]) by IRSMSX151.ger.corp.intel.com ([169.254.4.94]) with mapi id 14.03.0319.002; Thu, 30 Aug 2018 11:07:48 +0100 From: "Ananyev, Konstantin" To: "stable@dpdk.org" Thread-Topic: [PATCH] acl: fix invalid results for rule with zero priority Thread-Index: AQHUO8okabR66IiVskCCHPgFoAaPy6TYGtSA Date: Thu, 30 Aug 2018 10:07:47 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258EA94F17A@irsmsx105.ger.corp.intel.com> References: <1535129226-25510-1-git-send-email-konstantin.ananyev@intel.com> In-Reply-To: <1535129226-25510-1-git-send-email-konstantin.ananyev@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTJiNzg4YzEtNjBlMy00NWJkLTg1YjMtZmFiMjEyMmU0MDRjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNXFCK3VXOWlqZVZoQmpUcmhDVmYxOTJYUTZRYlhBaHRaOW5JYk1mUHY2S2RqS21XVDZWRjhZZ3BMbVdrdlE3eCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [dpdk-stable] [PATCH] acl: fix invalid results for rule with zero priority X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 10:07:51 -0000 If user specifies priority=3D0 for some of ACL rules that can cause rte_acl_classify to return wrong results. The reason is that priority zero is used internally for no-match nodes. See more details at: https://bugs.dpdk.org/show_bug.cgi?id=3D79. The simplest way to overcome the issue is just not allow zero to be a valid priority for the rule. Fixes: dc276b5780c2 ("acl: new library") Signed-off-by: Konstantin Ananyev --- lib/librte_acl/rte_acl.h | 2 +- test/test/test_acl.h | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h index 34c3b9c6a..aa22e70c6 100644 --- a/lib/librte_acl/rte_acl.h +++ b/lib/librte_acl/rte_acl.h @@ -88,7 +88,7 @@ enum { RTE_ACL_TYPE_SHIFT =3D 29, RTE_ACL_MAX_INDEX =3D RTE_LEN2MASK(RTE_ACL_TYPE_SHIFT, uint32_t), RTE_ACL_MAX_PRIORITY =3D RTE_ACL_MAX_INDEX, - RTE_ACL_MIN_PRIORITY =3D 0, + RTE_ACL_MIN_PRIORITY =3D 1, }; =20 #define RTE_ACL_MASKLEN_TO_BITMASK(v, s) \ diff --git a/test/test/test_acl.h b/test/test/test_acl.h index c4811c8f5..bbb0447a8 100644 --- a/test/test/test_acl.h +++ b/test/test/test_acl.h @@ -80,34 +80,40 @@ enum { struct rte_acl_ipv4vlan_rule invalid_layout_rules[] =3D { /* test src and dst address */ { - .data =3D {.userdata =3D 1, .category_mask =3D 1}, + .data =3D {.userdata =3D 1, .category_mask =3D 1, + .priority =3D 1}, .src_addr =3D IPv4(10,0,0,0), .src_mask_len =3D 24, }, { - .data =3D {.userdata =3D 2, .category_mask =3D 1}, + .data =3D {.userdata =3D 2, .category_mask =3D 1, + .priority =3D 1}, .dst_addr =3D IPv4(10,0,0,0), .dst_mask_len =3D 24, }, /* test src and dst ports */ { - .data =3D {.userdata =3D 3, .category_mask =3D 1}, + .data =3D {.userdata =3D 3, .category_mask =3D 1, + .priority =3D 1}, .dst_port_low =3D 100, .dst_port_high =3D 100, }, { - .data =3D {.userdata =3D 4, .category_mask =3D 1}, + .data =3D {.userdata =3D 4, .category_mask =3D 1, + .priority =3D 1}, .src_port_low =3D 100, .src_port_high =3D 100, }, /* test proto */ { - .data =3D {.userdata =3D 5, .category_mask =3D 1}, + .data =3D {.userdata =3D 5, .category_mask =3D 1, + .priority =3D 1}, .proto =3D 0xf, .proto_mask =3D 0xf }, { - .data =3D {.userdata =3D 6, .category_mask =3D 1}, + .data =3D {.userdata =3D 6, .category_mask =3D 1, + .priority =3D 1}, .dst_port_low =3D 0xf, .dst_port_high =3D 0xf, } --=20 2.13.6