From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0062.outbound.protection.outlook.com [104.47.34.62]) by dpdk.org (Postfix) with ESMTP id 5B8939E7 for ; Wed, 8 Feb 2017 09:26:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=studentuml.onmicrosoft.com; s=selector1-student-uml-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EVfMeZFmXqVilD5ljMGj3bC4nbRihr9mSZxb6KfIOMw=; b=EW+/Va64wh1rafnEytb9jfRLQXeLkkbgqTqVajRiiyUY8DUdBYng/qOa8i0LVUOHaGZ1MFdarNgrmjXFmjhp5PBhvO4UwZWtPLLZcz1ZBAlMahfyTjiV7Mn7u/VRYaJeqbvE0dx8AvgKfQaIkjpDIjeXPxHGL2SMpzElNtq74LI= Received: from BN6PR02MB2706.namprd02.prod.outlook.com (10.175.95.20) by BN6PR02MB2705.namprd02.prod.outlook.com (10.175.95.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 8 Feb 2017 08:26:15 +0000 Received: from BN6PR02MB2706.namprd02.prod.outlook.com ([10.175.95.20]) by BN6PR02MB2706.namprd02.prod.outlook.com ([10.175.95.20]) with mapi id 15.01.0888.026; Wed, 8 Feb 2017 08:26:15 +0000 From: "Wu, Xiaoban" To: "users@dpdk.org" Thread-Topic: A confusion caused by the inconsistency in the source code of acl_gen.c. A possible bug? Thread-Index: AQHSgd3hXVX5MzI8q0mEA977lXuJEg== Date: Wed, 8 Feb 2017 08:26:14 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Xiaoban_Wu@student.uml.edu; x-originating-ip: [25.175.94.132] x-ms-office365-filtering-correlation-id: e20a4725-4ebf-44e6-1ce7-08d44ffc25f2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR02MB2705; x-microsoft-exchange-diagnostics: 1; BN6PR02MB2705; 7:FcspHvOuCcDXD9GIrsODQ0yW5mt/zBxDccnKEMXu8ql4B6lAePdECOeXgcz/5l5s0mkf7XmJOkQi3PPH+hsY9jX+0cp+8ASeJYWgOE7zqtzE80orOm9pUUful1k2uz1cypJ+suOglJtuVGarlyzL5DyAT+47Gpg9Qun1DURRWh05i3nquXyxhQXTNFmXYkPhcx7QvjwmaIIt7OtM26Grw3dEDxH9pEH+x6NpoJg0zNnSasYnQArAi8aum8FDEZIbsyj6J/vvTpjJI7adS3dKJ7yNDV8sIiLblOYoJ9v5iNR2d4obLuIi7sq0D1E1jxlWYMTthsjM9MN4NYWkKuUVRXOErC0CzcK54K3LT2pmonGsJN60GcrZIrpOrP4QtI2EaxbBqTkbWMKX3Da6zYsXvdRlMsZC9dGXeffWrndAj8w/OH6Cd0d7/E0/+dv4ReX3SxFNahwIJcgieGTW+tQJijncxmQxuNYwUhtgfpFceVjZJcno/Glnse6AL7jc9okiBsy+k70Wq/fgqZD9GyrQGg== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(20170203043)(8121501046)(2017020702029)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123558025)(20161123564025)(6072148); SRVR:BN6PR02MB2705; BCL:0; PCL:0; RULEID:; SRVR:BN6PR02MB2705; x-forefront-prvs: 0212BDE3BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(189002)(199003)(81156014)(19627405001)(2351001)(1730700003)(3846002)(122556002)(50986999)(101416001)(68736007)(8676002)(8936002)(5660300001)(6116002)(81166006)(2900100001)(189998001)(450100001)(77096006)(102836003)(7696004)(2501003)(105586002)(106116001)(6606003)(106356001)(7736002)(42882006)(54356999)(6916009)(66066001)(6436002)(54896002)(55016002)(9686003)(92566002)(99286003)(25786008)(5640700003)(6506006)(75432002)(53936002)(97736004)(110136004)(33656002)(86362001)(2906002)(3280700002)(3660700001)(74316002)(88552002)(38730400002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB2705; H:BN6PR02MB2706.namprd02.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: student.uml.edu does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: student.uml.edu X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2017 08:26:14.9876 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4c25b8a6-17f7-46f9-83f0-54734ab81fb1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2705 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] A confusion caused by the inconsistency in the source code of acl_gen.c. A possible bug? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 08:26:18 -0000 Dear DPDK users, I have been reading and studying the source codes of the librte_acl, since = I am very curious to know how to algorithmically implement a fast lookup pr= ocess. When I read the function acl_add_ptrs() in the acl_gen.c, there is one comm= ent saying that /* * Rather than going from 0 to 256, the range count and * the layout are from 80-ff then 0-7f due to signed compare * for SSE (cmpgt). */ However, in the following codes, it is for (x =3D QRANGE_MIN + 1; x < UINT8_MAX + 1; x++) { if (dfa[x] !=3D index) { index =3D dfa[x]; *node_a++ =3D index; node->transitions[m++] =3D (uint8_t)(x - 1); } } for (x =3D 0; x < INT8_MAX + 1; x++) { if (dfa[x] !=3D index) { index =3D dfa[x]; *node_a++ =3D index; node->transitions[m++] =3D (uint8_t)(x - 1); } } As you can see that there are two for-loops, and the second for-loop includ= e the first for-loop. And, this is not consistent with the comment. If the = comment is followed, in the second for-loop, it should be "for (x =3D 0; x = < QRANGE_MIN + 1; x++)", if we assume QRANGE_MIN is ff? Moreover, due to that the first for-loop is included in the second for-loop= and the "m" variable is increased by 1 whenever the if-statement is true, = I am thinking about a case in which during the first for-loop, the "m" is i= ncreased by 3, hence after the second for-loop, the "m" is at least 6, this= will finally break the check RTE_ACL_VERIFY(m <=3D RTE_ACL_QUAD_SIZE) in t= he following code, since RTE_ACL_QUAD_SIZE is 4. I am wondering if this cas= e will ever happen? Am I missing something here? Thanks very much for your help. Best wishes, Xiaoban