get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 115241,
    "url": "https://patches.dpdk.org/api/patches/115241/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220818114449.1408226-7-cristian.dumitrescu@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": "<20220818114449.1408226-7-cristian.dumitrescu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220818114449.1408226-7-cristian.dumitrescu@intel.com",
    "date": "2022-08-18T11:44:49",
    "name": "[6/6] pipeline: configure the hash function for learner tables",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "93040ccd15601c327a9b92281785cb952ae3e262",
    "submitter": {
        "id": 19,
        "url": "https://patches.dpdk.org/api/people/19/?format=api",
        "name": "Cristian Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220818114449.1408226-7-cristian.dumitrescu@intel.com/mbox/",
    "series": [
        {
            "id": 24356,
            "url": "https://patches.dpdk.org/api/series/24356/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24356",
            "date": "2022-08-18T11:44:43",
            "name": "pipeline: make the hash function configurable per table",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/24356/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/115241/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/115241/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9F11AA034C;\n\tThu, 18 Aug 2022 13:45:39 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 368634282B;\n\tThu, 18 Aug 2022 13:45:10 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 2C12041109\n for <dev@dpdk.org>; Thu, 18 Aug 2022 13:45:04 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 Aug 2022 04:44:55 -0700",
            "from silpixa00400573.ir.intel.com (HELO\n silpixa00400573.ger.corp.intel.com.) ([10.237.223.157])\n by fmsmga008.fm.intel.com with ESMTP; 18 Aug 2022 04:44:54 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1660823104; x=1692359104;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=pP/4V2Eml5Ufph11zTvqh6XCp4XB18M43tZEO74AyEQ=;\n b=YAuK1w3rlh7XBBj8NWAI0hGMOsfGZkMelE44BJPrw77QxiDLOLMzjlv2\n QZX2QqqLD0C2fA5hEX30tsxCb022for9VhcMKA7N67B3Rhc0R+cpIoqfS\n Ir0jN0qM6CJAcbRUrxC3/jpxB94ZvmJQgLxv3O5Epm0OeAk4F6cV6sWmm\n VWi7TIQ6BEPTUPSBpxYFcqfvasHkAElZN4GDlBJ46X8ulEcmeEXAppKRT\n BqRFt8TO9FCFBx5/fX55z/4bOu4/4cRnv6/I0SJ1PLavxJo4Qn6kXkBB/\n drLb/trXzpU1hKfKb73tGNtDDjZhFbVBGQ2l669eFGaiHvss2vauv0RLi A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10442\"; a=\"292735222\"",
            "E=Sophos;i=\"5.93,246,1654585200\"; d=\"scan'208\";a=\"292735222\"",
            "E=Sophos;i=\"5.93,246,1654585200\"; d=\"scan'208\";a=\"668069725\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cristian Dumitrescu <cristian.dumitrescu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "\"Kamalakannan R .\" <kamalakannan.r@intel.com>",
        "Subject": "[PATCH 6/6] pipeline: configure the hash function for learner tables",
        "Date": "Thu, 18 Aug 2022 11:44:49 +0000",
        "Message-Id": "<20220818114449.1408226-7-cristian.dumitrescu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220818114449.1408226-1-cristian.dumitrescu@intel.com>",
        "References": "<20220818114449.1408226-1-cristian.dumitrescu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Make the hash function configurable for the learner pipeline tables.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Kamalakannan R. <kamalakannan.r@intel.com>\n---\n lib/pipeline/rte_swx_pipeline.c          | 12 ++++++++\n lib/pipeline/rte_swx_pipeline.h          |  6 ++++\n lib/pipeline/rte_swx_pipeline_internal.h |  1 +\n lib/pipeline/rte_swx_pipeline_spec.c     | 35 +++++++++++++++++++++++-\n lib/pipeline/rte_swx_pipeline_spec.h     |  1 +\n 5 files changed, 54 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c\nindex e1227cbfcc..e9e024029e 100644\n--- a/lib/pipeline/rte_swx_pipeline.c\n+++ b/lib/pipeline/rte_swx_pipeline.c\n@@ -8893,6 +8893,7 @@ rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,\n \tstruct learner *l = NULL;\n \tstruct action *default_action;\n \tstruct header *header = NULL;\n+\tstruct hash_func *hf = NULL;\n \tuint32_t action_data_size_max = 0, i;\n \tint status = 0;\n \n@@ -8955,6 +8956,12 @@ rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,\n \tCHECK((default_action->st && params->default_action_args) || !params->default_action_args,\n \t      EINVAL);\n \n+\t/* Hash function checks. */\n+\tif (params->hash_func_name) {\n+\t\thf = hash_func_find(p, params->hash_func_name);\n+\t\tCHECK(hf, EINVAL);\n+\t}\n+\n \t/* Any other checks. */\n \tCHECK(size, EINVAL);\n \tCHECK(timeout, EINVAL);\n@@ -9043,6 +9050,8 @@ rte_swx_pipeline_learner_config(struct rte_swx_pipeline *p,\n \n \tl->action_data_size_max = action_data_size_max;\n \n+\tl->hf = hf;\n+\n \tl->size = size;\n \n \tfor (i = 0; i < n_timeouts; i++)\n@@ -9132,6 +9141,9 @@ learner_params_get(struct learner *l)\n \t/* Action data size. */\n \tparams->action_data_size = l->action_data_size_max;\n \n+\t/* Hash function. */\n+\tparams->hash_func = l->hf ? l->hf->func : NULL;\n+\n \t/* Maximum number of keys. */\n \tparams->n_keys_max = l->size;\n \ndiff --git a/lib/pipeline/rte_swx_pipeline.h b/lib/pipeline/rte_swx_pipeline.h\nindex 09c75180f8..2c9cc6ee44 100644\n--- a/lib/pipeline/rte_swx_pipeline.h\n+++ b/lib/pipeline/rte_swx_pipeline.h\n@@ -829,6 +829,12 @@ struct rte_swx_pipeline_learner_params {\n \t * list.\n \t */\n \tint default_action_is_const;\n+\n+\t/** Hash function name. When not set to NULL, it must point to one of\n+\t * the hash functions that were registered for the current pipeline.\n+\t * When NULL, the default hash function will be used.\n+\t */\n+\tconst char *hash_func_name;\n };\n \n /**\ndiff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h\nindex ee579c6656..ef60288dca 100644\n--- a/lib/pipeline/rte_swx_pipeline_internal.h\n+++ b/lib/pipeline/rte_swx_pipeline_internal.h\n@@ -900,6 +900,7 @@ struct learner {\n \tint *action_is_for_table_entries;\n \tint *action_is_for_default_entry;\n \n+\tstruct hash_func *hf;\n \tuint32_t size;\n \tuint32_t timeout[RTE_SWX_TABLE_LEARNER_N_KEY_TIMEOUTS_MAX];\n \tuint32_t n_timeouts;\ndiff --git a/lib/pipeline/rte_swx_pipeline_spec.c b/lib/pipeline/rte_swx_pipeline_spec.c\nindex c0ca7335ff..5a07edd519 100644\n--- a/lib/pipeline/rte_swx_pipeline_spec.c\n+++ b/lib/pipeline/rte_swx_pipeline_spec.c\n@@ -1350,7 +1350,7 @@ selector_block_parse(struct selector_spec *s,\n static void\n learner_spec_free(struct learner_spec *s)\n {\n-\tuintptr_t default_action_name, default_action_args;\n+\tuintptr_t default_action_name, default_action_args, hash_func_name;\n \tuint32_t i;\n \n \tif (!s)\n@@ -1397,6 +1397,10 @@ learner_spec_free(struct learner_spec *s)\n \n \ts->params.default_action_is_const = 0;\n \n+\thash_func_name = (uintptr_t)s->params.hash_func_name;\n+\tfree((void *)hash_func_name);\n+\ts->params.hash_func_name = NULL;\n+\n \ts->size = 0;\n \n \tfree(s->timeout);\n@@ -1853,6 +1857,35 @@ learner_block_parse(struct learner_spec *s,\n \t\t\t\t\t\t\t      err_line,\n \t\t\t\t\t\t\t      err_msg);\n \n+\tif (!strcmp(tokens[0], \"hash\")) {\n+\t\tif (n_tokens != 2) {\n+\t\t\tif (err_line)\n+\t\t\t\t*err_line = n_lines;\n+\t\t\tif (err_msg)\n+\t\t\t\t*err_msg = \"Invalid hash statement.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (s->params.hash_func_name) {\n+\t\t\tif (err_line)\n+\t\t\t\t*err_line = n_lines;\n+\t\t\tif (err_msg)\n+\t\t\t\t*err_msg = \"Duplicate hash statement.\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\ts->params.hash_func_name = strdup(tokens[1]);\n+\t\tif (!s->params.hash_func_name) {\n+\t\t\tif (err_line)\n+\t\t\t\t*err_line = n_lines;\n+\t\t\tif (err_msg)\n+\t\t\t\t*err_msg = \"Memory allocation failed.\";\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\treturn 0;\n+\t}\n+\n \tif (!strcmp(tokens[0], \"size\")) {\n \t\tchar *p = tokens[1];\n \ndiff --git a/lib/pipeline/rte_swx_pipeline_spec.h b/lib/pipeline/rte_swx_pipeline_spec.h\nindex dbe1b40adc..123e175f8b 100644\n--- a/lib/pipeline/rte_swx_pipeline_spec.h\n+++ b/lib/pipeline/rte_swx_pipeline_spec.h\n@@ -134,6 +134,7 @@ struct selector_spec {\n  *\t\t...\n  *\t}\n  *\tdefault_action ACTION_NAME args none | ARG0_NAME ARG0_VALUE ... [ const ]\n+ *\thash HASH_FUNCTION_NAME\n  *\tsize SIZE\n  *\ttimeout {\n  *\t\tTIMEOUT_IN_SECONDS\n",
    "prefixes": [
        "6/6"
    ]
}