get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 83910,
    "url": "http://patches.dpdk.org/api/patches/83910/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1605027999-352513-1-git-send-email-matan@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1605027999-352513-1-git-send-email-matan@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1605027999-352513-1-git-send-email-matan@nvidia.com",
    "date": "2020-11-10T17:06:39",
    "name": "[v3] app/testpmd: support age shared action context",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "493490b8ba1e6761f0e889b6f9c201d55cecbdad",
    "submitter": {
        "id": 1911,
        "url": "http://patches.dpdk.org/api/people/1911/?format=api",
        "name": "Matan Azrad",
        "email": "matan@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1605027999-352513-1-git-send-email-matan@nvidia.com/mbox/",
    "series": [
        {
            "id": 13780,
            "url": "http://patches.dpdk.org/api/series/13780/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13780",
            "date": "2020-11-10T17:06:39",
            "name": "[v3] app/testpmd: support age shared action context",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/13780/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/83910/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/83910/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 103C2A04DD;\n\tTue, 10 Nov 2020 18:06:55 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9CF6BF90;\n\tTue, 10 Nov 2020 18:06:53 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id D50A1F64\n for <dev@dpdk.org>; Tue, 10 Nov 2020 18:06:51 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n matan@nvidia.com) with SMTP; 10 Nov 2020 19:06:47 +0200",
            "from nvidia.com (pegasus25.mtr.labs.mlnx [10.210.16.10])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0AAH6lv3020460;\n Tue, 10 Nov 2020 19:06:47 +0200"
        ],
        "From": "Matan Azrad <matan@nvidia.com>",
        "To": "Wenzhuo Lu <wenzhuo.lu@intel.com>, Beilei Xing <beilei.xing@intel.com>,\n Bernard Iremonger <bernard.iremonger@intel.com>, Ori Kam <orika@nvidia.com>",
        "Cc": "dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>",
        "Date": "Tue, 10 Nov 2020 17:06:39 +0000",
        "Message-Id": "<1605027999-352513-1-git-send-email-matan@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1604611973-64970-1-git-send-email-matan@nvidia.com>",
        "References": "<1604611973-64970-1-git-send-email-matan@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v3] app/testpmd: support age shared action context",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "When an age action becomes aged-out the next call for\nrte_flow_get_aged_flows API should return the action context supplied\nby the action configuration structure.\n\nIn case the age action is created by the shared action API, the shared\naction context of the Testpmd application was not set.\n\nIn addition, the application handler of the contexts returned by the\nrte_flow_get_aged_flows API didn't consider the fact that the action\ncould be set by the shared action API and considered it as regular flow\ncontext.\n\nThis caused a crash in Testpmd when the context is parsed.\n\nThis patch set context type in the flow and shared action context and\nuses it to parse the aged-out contexts correctly.\n\nSigned-off-by: Matan Azrad <matan@nvidia.com>\nAcked-by: Dekel Peled <dekelp@nvidia.com>\n---\n\nv3:\nupdate age context to point to the context type field inside the context structures.\n\n app/test-pmd/config.c  | 89 +++++++++++++++++++++++++++++---------------------\n app/test-pmd/testpmd.h | 13 +++++++-\n 2 files changed, 64 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 755d1df..91e7542 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -1849,6 +1849,13 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)\n \tret = action_alloc(port_id, id, &psa);\n \tif (ret)\n \t\treturn ret;\n+\tif (action->type == RTE_FLOW_ACTION_TYPE_AGE) {\n+\t\tstruct rte_flow_action_age *age =\n+\t\t\t(struct rte_flow_action_age *)(uintptr_t)(action->conf);\n+\n+\t\tpsa->age_type = ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION;\n+\t\tage->context = &psa->age_type;\n+\t}\n \t/* Poisoning to make sure PMDs update it in case of error. */\n \tmemset(&error, 0x22, sizeof(error));\n \tpsa->action = rte_flow_shared_action_create(port_id, conf, action,\n@@ -1900,8 +1907,8 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\t*tmp = psa->next;\n-\t\t\tfree(psa);\n \t\t\tprintf(\"Shared action #%u destroyed\\n\", psa->id);\n+\t\t\tfree(psa);\n \t\t\tbreak;\n \t\t}\n \t\tif (i == n)\n@@ -2113,24 +2120,20 @@ struct rte_flow_shared_action *\n \treturn 0;\n }\n \n-/** Update age action context by port_flow pointer. */\n-void\n-update_age_action_context(const struct rte_flow_action *actions,\n-\t\t\tstruct port_flow *pf)\n+/** Return age action structure if exists, otherwise NULL. */\n+static struct rte_flow_action_age *\n+age_action_get(const struct rte_flow_action *actions)\n {\n-\tstruct rte_flow_action_age *age = NULL;\n-\n \tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n \t\tswitch (actions->type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_AGE:\n-\t\t\tage = (struct rte_flow_action_age *)\n+\t\t\treturn (struct rte_flow_action_age *)\n \t\t\t\t(uintptr_t)actions->conf;\n-\t\t\tage->context = pf;\n-\t\t\treturn;\n \t\tdefault:\n \t\t\tbreak;\n \t\t}\n \t}\n+\treturn NULL;\n }\n \n /** Create flow rule. */\n@@ -2147,6 +2150,7 @@ struct rte_flow_shared_action *\n \tuint32_t id = 0;\n \tstruct rte_flow_error error;\n \tstruct port_flow_tunnel *pft = NULL;\n+\tstruct rte_flow_action_age *age = age_action_get(actions);\n \n \tport = &ports[port_id];\n \tif (port->flow_list) {\n@@ -2170,7 +2174,10 @@ struct rte_flow_shared_action *\n \tpf = port_flow_new(attr, pattern, actions, &error);\n \tif (!pf)\n \t\treturn port_flow_complain(&error);\n-\tupdate_age_action_context(actions, pf);\n+\tif (age) {\n+\t\tpf->age_type = ACTION_AGE_CONTEXT_TYPE_FLOW;\n+\t\tage->context = &pf->age_type;\n+\t}\n \t/* Poisoning to make sure PMDs update it in case of error. */\n \tmemset(&error, 0x22, sizeof(error));\n \tflow = rte_flow_create(port_id, attr, pattern, actions, &error);\n@@ -2379,7 +2386,11 @@ struct rte_flow_shared_action *\n \tvoid **contexts;\n \tint nb_context, total = 0, idx;\n \tstruct rte_flow_error error;\n-\tstruct port_flow *pf;\n+\tenum age_action_context_type *type;\n+\tunion {\n+\t\tstruct port_flow *pf;\n+\t\tstruct port_shared_action *psa;\n+\t} ctx;\n \n \tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n \t    port_id == (portid_t)RTE_PORT_ALL)\n@@ -2397,7 +2408,7 @@ struct rte_flow_shared_action *\n \t\tprintf(\"Cannot allocate contexts for aged flow\\n\");\n \t\treturn;\n \t}\n-\tprintf(\"ID\\tGroup\\tPrio\\tAttr\\n\");\n+\tprintf(\"%-20s\\tID\\tGroup\\tPrio\\tAttr\\n\", \"Type\");\n \tnb_context = rte_flow_get_aged_flows(port_id, contexts, total, &error);\n \tif (nb_context != total) {\n \t\tprintf(\"Port:%d get aged flows count(%d) != total(%d)\\n\",\n@@ -2405,37 +2416,41 @@ struct rte_flow_shared_action *\n \t\tfree(contexts);\n \t\treturn;\n \t}\n+\ttotal = 0;\n \tfor (idx = 0; idx < nb_context; idx++) {\n-\t\tpf = (struct port_flow *)contexts[idx];\n-\t\tif (!pf) {\n+\t\tif (!contexts[idx]) {\n \t\t\tprintf(\"Error: get Null context in port %u\\n\", port_id);\n \t\t\tcontinue;\n \t\t}\n-\t\tprintf(\"%\" PRIu32 \"\\t%\" PRIu32 \"\\t%\" PRIu32 \"\\t%c%c%c\\t\\n\",\n-\t\t       pf->id,\n-\t\t       pf->rule.attr->group,\n-\t\t       pf->rule.attr->priority,\n-\t\t       pf->rule.attr->ingress ? 'i' : '-',\n-\t\t       pf->rule.attr->egress ? 'e' : '-',\n-\t\t       pf->rule.attr->transfer ? 't' : '-');\n-\t}\n-\tif (destroy) {\n-\t\tint ret;\n-\t\tuint32_t flow_id;\n-\n-\t\ttotal = 0;\n-\t\tprintf(\"\\n\");\n-\t\tfor (idx = 0; idx < nb_context; idx++) {\n-\t\t\tpf = (struct port_flow *)contexts[idx];\n-\t\t\tif (!pf)\n-\t\t\t\tcontinue;\n-\t\t\tflow_id = pf->id;\n-\t\t\tret = port_flow_destroy(port_id, 1, &flow_id);\n-\t\t\tif (!ret)\n+\t\ttype = (enum age_action_context_type *)contexts[idx];\n+\t\tswitch (*type) {\n+\t\tcase ACTION_AGE_CONTEXT_TYPE_FLOW:\n+\t\t\tctx.pf = container_of(type, struct port_flow, age_type);\n+\t\t\tprintf(\"%-20s\\t%\" PRIu32 \"\\t%\" PRIu32 \"\\t%\" PRIu32\n+\t\t\t\t\t\t\t\t \"\\t%c%c%c\\t\\n\",\n+\t\t\t       \"Flow\",\n+\t\t\t       ctx.pf->id,\n+\t\t\t       ctx.pf->rule.attr->group,\n+\t\t\t       ctx.pf->rule.attr->priority,\n+\t\t\t       ctx.pf->rule.attr->ingress ? 'i' : '-',\n+\t\t\t       ctx.pf->rule.attr->egress ? 'e' : '-',\n+\t\t\t       ctx.pf->rule.attr->transfer ? 't' : '-');\n+\t\t\tif (destroy && !port_flow_destroy(port_id, 1,\n+\t\t\t\t\t\t\t  &ctx.pf->id))\n \t\t\t\ttotal++;\n+\t\t\tbreak;\n+\t\tcase ACTION_AGE_CONTEXT_TYPE_SHARED_ACTION:\n+\t\t\tctx.psa = container_of(type, struct port_shared_action,\n+\t\t\t\t\t       age_type);\n+\t\t\tprintf(\"%-20s\\t%\" PRIu32 \"\\n\", \"Shared action\",\n+\t\t\t       ctx.psa->id);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tprintf(\"Error: invalid context type %u\\n\", port_id);\n+\t\t\tbreak;\n \t\t}\n-\t\tprintf(\"%d flows be destroyed\\n\", total);\n \t}\n+\tprintf(\"\\n%d flows destroyed\\n\", total);\n \tfree(contexts);\n }\n \ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 519d551..6b901a8 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -143,13 +143,23 @@ struct fwd_stream {\n \tstruct pkt_burst_stats tx_burst_stats;\n };\n \n+/**\n+ * Age action context types, must be included inside the age action\n+ * context structure.\n+ */\n+enum age_action_context_type {\n+\tACTION_AGE_CONTEXT_TYPE_FLOW,\n+\tACTION_AGE_CONTEXT_TYPE_SHARED_ACTION,\n+};\n+\n /** Descriptor for a single flow. */\n struct port_flow {\n \tstruct port_flow *next; /**< Next flow in list. */\n \tstruct port_flow *tmp; /**< Temporary linking. */\n \tuint32_t id; /**< Flow rule ID. */\n \tstruct rte_flow *flow; /**< Opaque flow object returned by PMD. */\n-\tstruct rte_flow_conv_rule rule; /* Saved flow rule description. */\n+\tstruct rte_flow_conv_rule rule; /**< Saved flow rule description. */\n+\tenum age_action_context_type age_type; /**< Age action context type. */\n \tuint8_t data[]; /**< Storage for flow rule description */\n };\n \n@@ -159,6 +169,7 @@ struct port_shared_action {\n \tuint32_t id; /**< Shared action ID. */\n \tenum rte_flow_action_type type; /**< Action type. */\n \tstruct rte_flow_shared_action *action;\t/**< Shared action handle. */\n+\tenum age_action_context_type age_type; /**< Age action context type. */\n };\n \n struct port_flow_tunnel {\n",
    "prefixes": [
        "v3"
    ]
}