From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F09C41BAA; Thu, 2 Feb 2023 08:48:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 210A442D2C; Thu, 2 Feb 2023 08:48:13 +0100 (CET) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by mails.dpdk.org (Postfix) with ESMTP id 66AF84021D for ; Wed, 1 Feb 2023 20:34:37 +0100 (CET) Received: by mail-oi1-f179.google.com with SMTP id dt8so13549582oib.0 for ; Wed, 01 Feb 2023 11:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/o9iB8pQbpwcDx/sq4ETuKgThS0l9oJDcU824kTsaNU=; b=N7qKrYIT364hzatOWf43c56B+/eUB4T1MCCdJZkvhk1t55LHP9Mgjz+IOOPkyuKZAt IRrKE2DffObI2rsF2k4ylUyaPnzm8nnSLWo03bRj8aSugItouCc0kAos0c1oXB6AVLv7 q/mKFvouOwVaU/JI+d0/w1glWDk+nRduWjGCO+j0LVIK0eWQe+p2Om/cOj4oE3qXMgzy sLoj8awC08qhI/Nwh/mZEwUCdcX65jhBqV0nxjF4a6UQInP1fWNuzS4rloVIxrIDclwo PHZ2g9MEMOLYcOf5ZThsmDqn/yPvm4tWvQLTjVdliRFbwPYgXRepHS3Cvjhse2lvZaUM OZSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/o9iB8pQbpwcDx/sq4ETuKgThS0l9oJDcU824kTsaNU=; b=UqBBXsTevowWHPwS0lQgN3ghWLr9830Unp5NZBYLzw4x9mT3FrYE7vzcKKC5bmsDWe 7eF0Nkk2bnAlYVMH4TaQuswG1dLXN0NmwkB3X9//ErQf9yb3aYPh/GGBpo89Q0Z73F+k vvPkVdh/QXNq/ja53ORxmSqIN5M9jtOI3Sv42LDJgPyEQw5cTaHksqYi68cV78yGyr3h kp9vmLdw6kvTQLKHxyssZZWSKx0UzoOMEvfavnYB/HZeDz1PDJNe1LCZYk7o9Emo2bzW 4f90+jKC2xRVSgmOs6FEHlhe0A3pRjCIb7pzkDUdE+57H6tv0ss3RPDCy/YUNKF687Ov 03TA== X-Gm-Message-State: AO0yUKUim6lVTZUzQr6Y4a0c+hqPiX6rWpfOOgVX4GB4hG79HeoSO7eG QbJ8UmnoAyRZrq0eg4fI8RYg+BjI0wQR/Q== X-Google-Smtp-Source: AK7set/C3AgOpJtmpD6KWlF1bG/fUe74yv3yWH/a0HDf7KgQr1HVw8SDFkWHcLDerdHYoivx2zbopw== X-Received: by 2002:a05:6808:609:b0:360:ea59:5931 with SMTP id y9-20020a056808060900b00360ea595931mr1744617oih.18.1675280076273; Wed, 01 Feb 2023 11:34:36 -0800 (PST) Received: from A2103108754.china.huawei.com ([119.8.128.21]) by smtp.gmail.com with ESMTPSA id t2-20020a9d7742000000b0068d3ec1427bsm1315633otl.69.2023.02.01.11.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 11:34:35 -0800 (PST) From: Arthur Leung To: dev@dpdk.org Cc: Arthur Leung , Konstantin Ananyev , Pablo de Lara Subject: [PATCH] acl: fix trie splitting Date: Wed, 1 Feb 2023 14:34:26 -0500 Message-Id: <20230201193426.19243-1-arcyleung@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 02 Feb 2023 08:48:10 +0100 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When using a large number of ACL rules, the trie is supposed to split when there are over 2048 nodes. However, node_count is negative, so node_count > context->cur_node_max never actually runs, so all the nodes created from the rules end up being in one trie. Original PR with sample files and test output can be found here: https://github.com/DPDK/dpdk/pull/50 Fixes: dc276b5780c2 ("acl: new library") Signed-off-by: Arthur Leung --- app/test-acl/test-acl.sh | 2 +- lib/acl/acl_bld.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/test-acl/test-acl.sh b/app/test-acl/test-acl.sh index 30814f3fe2..59bfa121cf 100644 --- a/app/test-acl/test-acl.sh +++ b/app/test-acl/test-acl.sh @@ -17,7 +17,7 @@ # '/' # trace record format: # \ -# ... +# ... # # As an example: # /bin/bash app/test-acl/test-acl.sh build/app/dpdk-test-acl \ diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c index 2816632803..6064a8103b 100644 --- a/lib/acl/acl_bld.c +++ b/lib/acl/acl_bld.c @@ -946,7 +946,7 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head, struct rte_acl_build_rule **last, uint32_t *count) { uint32_t n, m; - int field_index, node_count; + int field_index; struct rte_acl_node *trie; struct rte_acl_build_rule *prev, *rule; struct rte_acl_node *end, *merge, *root, *end_prev; @@ -1048,15 +1048,13 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head, } } - node_count = context->num_nodes; (*count)++; /* merge this rule into the trie */ if (acl_merge_trie(context, trie, root, 0, NULL)) return NULL; - node_count = context->num_nodes - node_count; - if (node_count > context->cur_node_max) { + if (context->num_nodes > (context->cur_node_max * context->num_tries)) { *last = prev; return trie; } @@ -1368,6 +1366,7 @@ acl_build_tries(struct acl_build_context *context, for (n = 0;; n = num_tries) { num_tries = n + 1; + context->num_tries = num_tries; last = build_one_trie(context, rule_sets, n, context->node_max); if (context->bld_tries[n].trie == NULL) { @@ -1411,8 +1410,6 @@ acl_build_tries(struct acl_build_context *context, } } - - context->num_tries = num_tries; return 0; } -- 2.25.1