get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2401/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2401,
    "url": "https://patches.dpdk.org/api/patches/2401/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1421779267-18492-8-git-send-email-konstantin.ananyev@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1421779267-18492-8-git-send-email-konstantin.ananyev@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1421779267-18492-8-git-send-email-konstantin.ananyev@intel.com",
    "date": "2015-01-20T18:40:56",
    "name": "[dpdk-dev,v3,07/18] librte_acl: build/gen phase - simplify the way match nodes are allocated.",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fc66d9be612926bf6e04adc13c41b39b33c69fa3",
    "submitter": {
        "id": 33,
        "url": "https://patches.dpdk.org/api/people/33/?format=api",
        "name": "Ananyev, Konstantin",
        "email": "konstantin.ananyev@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1421779267-18492-8-git-send-email-konstantin.ananyev@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2401/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2401/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 7A4BB5AB5;\n\tTue, 20 Jan 2015 19:41:34 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 1EEB05A9A\n\tfor <dev@dpdk.org>; Tue, 20 Jan 2015 19:41:23 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga101.fm.intel.com with ESMTP; 20 Jan 2015 10:41:22 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 20 Jan 2015 10:41:21 -0800",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt0KIfK0J029493; Tue, 20 Jan 2015 18:41:20 GMT",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id t0KIfK5g018834;\n\tTue, 20 Jan 2015 18:41:20 GMT",
            "(from kananye1@localhost)\n\tby sivswdev02.ir.intel.com with  id t0KIfKqN018830;\n\tTue, 20 Jan 2015 18:41:20 GMT"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,435,1418112000\"; d=\"scan'208\";a=\"672969145\"",
        "From": "Konstantin Ananyev <konstantin.ananyev@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 20 Jan 2015 18:40:56 +0000",
        "Message-Id": "<1421779267-18492-8-git-send-email-konstantin.ananyev@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1421779267-18492-1-git-send-email-konstantin.ananyev@intel.com>",
        "References": "<1421779267-18492-1-git-send-email-konstantin.ananyev@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 07/18] librte_acl: build/gen phase - simplify\n\tthe way match nodes are allocated.",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Right now we allocate indexes for all types of nodes, except MATCH,\nat 'gen final RT table' stage.\nFor MATCH type nodes we are doing it at building temporary tree stage.\nThis is totally unnecessary and makes code more complex and error prone.\nRework the code and make MATCH indexes being allocated at the same stage\nas all others.\n\nSigned-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n lib/librte_acl/acl.h     |  3 +--\n lib/librte_acl/acl_bld.c |  4 +--\n lib/librte_acl/acl_gen.c | 69 ++++++++++++++++++++++--------------------------\n 3 files changed, 34 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/lib/librte_acl/acl.h b/lib/librte_acl/acl.h\nindex 3f6ac79..96bb318 100644\n--- a/lib/librte_acl/acl.h\n+++ b/lib/librte_acl/acl.h\n@@ -146,7 +146,6 @@ enum {\n struct rte_acl_trie {\n \tuint32_t        type;\n \tuint32_t        count;\n-\tint32_t         smallest;  /* smallest rule in this trie */\n \tuint32_t        root_index;\n \tconst uint32_t *data_index;\n \tuint32_t        num_data_indexes;\n@@ -181,7 +180,7 @@ struct rte_acl_ctx {\n \n int rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,\n \tstruct rte_acl_bld_trie *node_bld_trie, uint32_t num_tries,\n-\tuint32_t num_categories, uint32_t data_index_sz, int match_num);\n+\tuint32_t num_categories, uint32_t data_index_sz);\n \n typedef int (*rte_acl_classify_t)\n (const struct rte_acl_ctx *, const uint8_t **, uint32_t *, uint32_t, uint32_t);\ndiff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c\nindex 22f7934..1fd59ee 100644\n--- a/lib/librte_acl/acl_bld.c\n+++ b/lib/librte_acl/acl_bld.c\n@@ -1719,7 +1719,6 @@ acl_build_tries(struct acl_build_context *context,\n \t\tcontext->tries[n].type = RTE_ACL_UNUSED_TRIE;\n \t\tcontext->bld_tries[n].trie = NULL;\n \t\tcontext->tries[n].count = 0;\n-\t\tcontext->tries[n].smallest = INT32_MAX;\n \t}\n \n \tcontext->tries[0].type = RTE_ACL_FULL_TRIE;\n@@ -1906,8 +1905,7 @@ rte_acl_build(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)\n \t\trc = rte_acl_gen(ctx, bcx.tries, bcx.bld_tries,\n \t\t\t\tbcx.num_tries, bcx.cfg.num_categories,\n \t\t\t\tRTE_ACL_MAX_FIELDS * RTE_DIM(bcx.tries) *\n-\t\t\t\tsizeof(ctx->data_indexes[0]),\n-\t\t\t\tbcx.num_build_rules + 1);\n+\t\t\t\tsizeof(ctx->data_indexes[0]));\n \t\tif (rc == 0) {\n \n \t\t\t/* set data indexes. */\ndiff --git a/lib/librte_acl/acl_gen.c b/lib/librte_acl/acl_gen.c\nindex c9b7839..d3def66 100644\n--- a/lib/librte_acl/acl_gen.c\n+++ b/lib/librte_acl/acl_gen.c\n@@ -50,14 +50,14 @@ struct acl_node_counters {\n \tint32_t quad_vectors;\n \tint32_t dfa;\n \tint32_t dfa_gr64;\n-\tint32_t smallest_match;\n };\n \n struct rte_acl_indices {\n-\tint                dfa_index;\n-\tint                quad_index;\n-\tint                single_index;\n-\tint                match_index;\n+\tint32_t dfa_index;\n+\tint32_t quad_index;\n+\tint32_t single_index;\n+\tint32_t match_index;\n+\tint32_t match_start;\n };\n \n static void\n@@ -243,9 +243,9 @@ acl_count_fanout(struct rte_acl_node *node)\n /*\n  * Determine the type of nodes and count each type\n  */\n-static int\n+static void\n acl_count_trie_types(struct acl_node_counters *counts,\n-\tstruct rte_acl_node *node, uint64_t no_match, int match, int force_dfa)\n+\tstruct rte_acl_node *node, uint64_t no_match, int force_dfa)\n {\n \tuint32_t n;\n \tint num_ptrs;\n@@ -253,16 +253,12 @@ acl_count_trie_types(struct acl_node_counters *counts,\n \n \t/* skip if this node has been counted */\n \tif (node->node_type != (uint32_t)RTE_ACL_NODE_UNDEFINED)\n-\t\treturn match;\n+\t\treturn;\n \n \tif (node->match_flag != 0 || node->num_ptrs == 0) {\n \t\tcounts->match++;\n-\t\tif (node->match_flag == -1)\n-\t\t\tnode->match_flag = match++;\n \t\tnode->node_type = RTE_ACL_NODE_MATCH;\n-\t\tif (counts->smallest_match > node->match_flag)\n-\t\t\tcounts->smallest_match = node->match_flag;\n-\t\treturn match;\n+\t\treturn;\n \t}\n \n \tnum_ptrs = acl_count_fanout(node);\n@@ -299,11 +295,9 @@ acl_count_trie_types(struct acl_node_counters *counts,\n \t */\n \tfor (n = 0; n < node->num_ptrs; n++) {\n \t\tif (node->ptrs[n].ptr != NULL)\n-\t\t\tmatch = acl_count_trie_types(counts, node->ptrs[n].ptr,\n-\t\t\t\tno_match, match, 0);\n+\t\t\tacl_count_trie_types(counts, node->ptrs[n].ptr,\n+\t\t\t\tno_match, 0);\n \t}\n-\n-\treturn match;\n }\n \n static void\n@@ -400,9 +394,13 @@ acl_gen_node(struct rte_acl_node *node, uint64_t *node_array,\n \t\tbreak;\n \tcase RTE_ACL_NODE_MATCH:\n \t\tmatch = ((struct rte_acl_match_results *)\n-\t\t\t(node_array + index->match_index));\n-\t\tmemcpy(match + node->match_flag, node->mrt, sizeof(*node->mrt));\n-\t\tnode->node_index = node->match_flag | node->node_type;\n+\t\t\t(node_array + index->match_start));\n+\t\tfor (n = 0; n != RTE_DIM(match->results); n++)\n+\t\t\tRTE_ACL_VERIFY(match->results[0] == 0);\n+\t\tmemcpy(match + index->match_index, node->mrt,\n+\t\t\tsizeof(*node->mrt));\n+\t\tnode->node_index = index->match_index | node->node_type;\n+\t\tindex->match_index += 1;\n \t\tbreak;\n \tcase RTE_ACL_NODE_UNDEFINED:\n \t\tRTE_ACL_VERIFY(node->node_type !=\n@@ -443,11 +441,11 @@ acl_gen_node(struct rte_acl_node *node, uint64_t *node_array,\n \t}\n }\n \n-static int\n+static void\n acl_calc_counts_indices(struct acl_node_counters *counts,\n-\tstruct rte_acl_indices *indices, struct rte_acl_trie *trie,\n+\tstruct rte_acl_indices *indices,\n \tstruct rte_acl_bld_trie *node_bld_trie, uint32_t num_tries,\n-\tint match_num, uint64_t no_match)\n+\tuint64_t no_match)\n {\n \tuint32_t n;\n \n@@ -456,21 +454,18 @@ acl_calc_counts_indices(struct acl_node_counters *counts,\n \n \t/* Get stats on nodes */\n \tfor (n = 0; n < num_tries; n++) {\n-\t\tcounts->smallest_match = INT32_MAX;\n-\t\tmatch_num = acl_count_trie_types(counts, node_bld_trie[n].trie,\n-\t\t\tno_match, match_num, 1);\n-\t\ttrie[n].smallest = counts->smallest_match;\n+\t\tacl_count_trie_types(counts, node_bld_trie[n].trie,\n+\t\t\tno_match, 1);\n \t}\n \n \tindices->dfa_index = RTE_ACL_DFA_SIZE + 1;\n \tindices->quad_index = indices->dfa_index +\n \t\tcounts->dfa_gr64 * RTE_ACL_DFA_GR64_SIZE;\n \tindices->single_index = indices->quad_index + counts->quad_vectors;\n-\tindices->match_index = indices->single_index + counts->single + 1;\n-\tindices->match_index = RTE_ALIGN(indices->match_index,\n+\tindices->match_start = indices->single_index + counts->single + 1;\n+\tindices->match_start = RTE_ALIGN(indices->match_start,\n \t\t(XMM_SIZE / sizeof(uint64_t)));\n-\n-\treturn match_num;\n+\tindices->match_index = 1;\n }\n \n /*\n@@ -479,7 +474,7 @@ acl_calc_counts_indices(struct acl_node_counters *counts,\n int\n rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,\n \tstruct rte_acl_bld_trie *node_bld_trie, uint32_t num_tries,\n-\tuint32_t num_categories, uint32_t data_index_sz, int match_num)\n+\tuint32_t num_categories, uint32_t data_index_sz)\n {\n \tvoid *mem;\n \tsize_t total_size;\n@@ -492,13 +487,13 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,\n \tno_match = RTE_ACL_NODE_MATCH;\n \n \t/* Fill counts and indices arrays from the nodes. */\n-\tmatch_num = acl_calc_counts_indices(&counts, &indices, trie,\n-\t\tnode_bld_trie, num_tries, match_num, no_match);\n+\tacl_calc_counts_indices(&counts, &indices,\n+\t\tnode_bld_trie, num_tries, no_match);\n \n \t/* Allocate runtime memory (align to cache boundary) */\n \ttotal_size = RTE_ALIGN(data_index_sz, RTE_CACHE_LINE_SIZE) +\n-\t\tindices.match_index * sizeof(uint64_t) +\n-\t\t(match_num + 2) * sizeof(struct rte_acl_match_results) +\n+\t\tindices.match_start * sizeof(uint64_t) +\n+\t\t(counts.match + 1) * sizeof(struct rte_acl_match_results) +\n \t\tXMM_SIZE;\n \n \tmem = rte_zmalloc_socket(ctx->name, total_size, RTE_CACHE_LINE_SIZE,\n@@ -511,7 +506,7 @@ rte_acl_gen(struct rte_acl_ctx *ctx, struct rte_acl_trie *trie,\n \t}\n \n \t/* Fill the runtime structure */\n-\tmatch_index = indices.match_index;\n+\tmatch_index = indices.match_start;\n \tnode_array = (uint64_t *)((uintptr_t)mem +\n \t\tRTE_ALIGN(data_index_sz, RTE_CACHE_LINE_SIZE));\n \n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "07/18"
    ]
}