From: Konstantin Ananyev Date: Tue, 20 Jan 2015 18:40:57 +0000 (+0000) Subject: acl: make scalar RT code more similar to vector one X-Git-Tag: spdx-start~9817 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5c0e6c3de554c496fe0e8921badc2e3bbd237e32;p=dpdk.git acl: make scalar RT code more similar to vector one Make classify_scalar to behave in the same way as it's vector counterpart: move match check out of the inner loop, etc. That makes scalar and vector code look more identical. Plus it improves scalar code performance. Signed-off-by: Konstantin Ananyev Acked-by: Neil Horman --- diff --git a/lib/librte_acl/acl_run_scalar.c b/lib/librte_acl/acl_run_scalar.c index 40691ced9b..9935125cec 100644 --- a/lib/librte_acl/acl_run_scalar.c +++ b/lib/librte_acl/acl_run_scalar.c @@ -162,31 +162,34 @@ rte_acl_classify_scalar(const struct rte_acl_ctx *ctx, const uint8_t **data, transition0 = index_array[0]; transition1 = index_array[1]; + while ((transition0 | transition1) & RTE_ACL_NODE_MATCH) { + transition0 = acl_match_check(transition0, + 0, ctx, parms, &flows, resolve_priority_scalar); + transition1 = acl_match_check(transition1, + 1, ctx, parms, &flows, resolve_priority_scalar); + } + while (flows.started > 0) { input0 = GET_NEXT_4BYTES(parms, 0); input1 = GET_NEXT_4BYTES(parms, 1); for (n = 0; n < 4; n++) { - if (likely((transition0 & RTE_ACL_NODE_MATCH) == 0)) - transition0 = scalar_transition(flows.trans, - transition0, (uint8_t)input0); + transition0 = scalar_transition(flows.trans, + transition0, (uint8_t)input0); input0 >>= CHAR_BIT; - if (likely((transition1 & RTE_ACL_NODE_MATCH) == 0)) - transition1 = scalar_transition(flows.trans, - transition1, (uint8_t)input1); - + transition1 = scalar_transition(flows.trans, + transition1, (uint8_t)input1); input1 >>= CHAR_BIT; - } - if ((transition0 | transition1) & RTE_ACL_NODE_MATCH) { + + while ((transition0 | transition1) & RTE_ACL_NODE_MATCH) { transition0 = acl_match_check(transition0, 0, ctx, parms, &flows, resolve_priority_scalar); transition1 = acl_match_check(transition1, 1, ctx, parms, &flows, resolve_priority_scalar); - } } return 0;