get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81454,
    "url": "http://patches.dpdk.org/api/patches/81454/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1603183709-23420-16-git-send-email-arybchenko@solarflare.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": "<1603183709-23420-16-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1603183709-23420-16-git-send-email-arybchenko@solarflare.com",
    "date": "2020-10-20T08:47:42",
    "name": "[15/62] net/sfc: add actions parsing stub to MAE backend",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7b27ac89a8123fd491769e9fffc268ef92a1b781",
    "submitter": {
        "id": 607,
        "url": "http://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1603183709-23420-16-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [
        {
            "id": 13132,
            "url": "http://patches.dpdk.org/api/series/13132/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13132",
            "date": "2020-10-20T08:47:30",
            "name": "net/sfc: support flow API transfer rules",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/13132/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/81454/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/81454/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 C0569A04DD;\n\tTue, 20 Oct 2020 10:53:02 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CF9A0BC14;\n\tTue, 20 Oct 2020 10:49:21 +0200 (CEST)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 6BBF8AD31\n for <dev@dpdk.org>; Tue, 20 Oct 2020 10:49:00 +0200 (CEST)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.65.62])\n by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id\n F031E6007B for <dev@dpdk.org>; Tue, 20 Oct 2020 08:48:58 +0000 (UTC)",
            "from us4-mdac16-25.ut7.mdlocal (unknown [10.7.65.251])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id F0B118009B\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:48:58 +0000 (UTC)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.66.33])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n 7D099280053\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:48:58 +0000 (UTC)",
            "from webmail.solarflare.com (uk.solarflare.com [193.34.186.16])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n (No client certificate requested)\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n 32F81A80061\n for <dev@dpdk.org>; Tue, 20 Oct 2020 08:48:58 +0000 (UTC)",
            "from ukex01.SolarFlarecom.com (10.17.10.4) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id\n 15.0.1497.2; Tue, 20 Oct 2020 09:48:50 +0100",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id\n 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 09:48:50 +0100",
            "from ukv-loginhost.uk.solarflarecom.com\n (ukv-loginhost.uk.solarflarecom.com [10.17.10.39])\n by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K8mn1O030804;\n Tue, 20 Oct 2020 09:48:49 +0100",
            "from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])\n by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 7DD051619C0;\n Tue, 20 Oct 2020 09:48:48 +0100 (BST)"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<y@solarflare.com>",
        "CC": "<dev@dpdk.org>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Tue, 20 Oct 2020 09:47:42 +0100",
        "Message-ID": "<1603183709-23420-16-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1603183709-23420-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1603183709-23420-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-TM-AS-Product-Ver": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-TM-AS-Result": "No-0.462400-8.000000-10",
        "X-TMASE-MatchedRID": "s4SlA1o/QeqvddsITeyYIA9rVnOZ7Na29l9p8mNlkgn5BgEebZ/Id92I\n 5lCpZsGnSU+/BVsfN4xsu9NQ2X6vHgXjSpVHn22DqJSK+HSPY+/pVMb1xnESMgaYevV4zG3ZUx7\n kGWSmvLut2gtuWr1LmjUt9JuWj4xHqj01FlWBadoaPMGCcVm9DhQEj9RZgbsWqPGqHIPGZiNcLC\n J/KjH2+fENLDkevvRYfVkdlGqLoLaEQeXrAUW/pxIRh9wkXSlFuoYFb0nRiqPSqRSAHh9TUIk+J\n GTs+SgTuW0lBjgUk+f0RAJjMpMwivq1PT1fWLFicaD+wPaBYtYOROc6V2b9xpsoi2XrUn/Jn6Kd\n MrRsL14qtq5d3cxkNaIBjL0CQ2REDbLtTFChLUp7UmoA+n8lk5o7vPKPqgVvEZT73Il4h6p2Haz\n DE/4ydD3gQ4Z8FpQbGHhbAlQ4GxxU/9hXOAmyk1Lp4hUUe2ehOKBkFAm8GOUPoO5ncI6OuehbQ2\n QpmASdyky8P5TYMPI=",
        "X-TM-AS-User-Approved-Sender": "Yes",
        "X-TM-AS-User-Blocked-Sender": "No",
        "X-TMASE-Result": "10--0.462400-8.000000",
        "X-TMASE-Version": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-MDID": "1603183739-iAoPuGm54bOm",
        "X-PPE-DISP": "1603183739;iAoPuGm54bOm",
        "Subject": "[dpdk-dev] [PATCH 15/62] net/sfc: add actions parsing stub to MAE\n\tbackend",
        "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": "From: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nIf parsing a flow results in an action set specification\nidentical to an already existing one, duplication will\nbe avoided by reusing the list entry of the latter.\nUsing an attach helper and a reference counter\nis meant to serve the said purpose.\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n drivers/net/sfc/sfc_flow.c |   8 ++-\n drivers/net/sfc/sfc_flow.h |   2 +\n drivers/net/sfc/sfc_mae.c  | 133 +++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_mae.h  |  15 +++++\n 4 files changed, 157 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c\nindex f69dd6ac5d..f4d53bf770 100644\n--- a/drivers/net/sfc/sfc_flow.c\n+++ b/drivers/net/sfc/sfc_flow.c\n@@ -1201,6 +1201,7 @@ sfc_flow_parse_attr(struct sfc_adapter *sa,\n \t\tspec->type = SFC_FLOW_SPEC_MAE;\n \t\tspec_mae->priority = attr->priority;\n \t\tspec_mae->match_spec = NULL;\n+\t\tspec_mae->action_set = NULL;\n \t}\n \n \treturn 0;\n@@ -2428,7 +2429,7 @@ sfc_flow_parse_rte_to_filter(struct rte_eth_dev *dev,\n static int\n sfc_flow_parse_rte_to_mae(struct rte_eth_dev *dev,\n \t\t\t  const struct rte_flow_item pattern[],\n-\t\t\t  __rte_unused const struct rte_flow_action actions[],\n+\t\t\t  const struct rte_flow_action actions[],\n \t\t\t  struct rte_flow *flow,\n \t\t\t  struct rte_flow_error *error)\n {\n@@ -2441,6 +2442,11 @@ sfc_flow_parse_rte_to_mae(struct rte_eth_dev *dev,\n \tif (rc != 0)\n \t\treturn rc;\n \n+\trc = sfc_mae_rule_parse_actions(sa, actions, &spec_mae->action_set,\n+\t\t\t\t\terror);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n \treturn 0;\n }\n \ndiff --git a/drivers/net/sfc/sfc_flow.h b/drivers/net/sfc/sfc_flow.h\nindex 164e9f9a9a..7d15f47e60 100644\n--- a/drivers/net/sfc/sfc_flow.h\n+++ b/drivers/net/sfc/sfc_flow.h\n@@ -65,6 +65,8 @@ struct sfc_flow_spec_mae {\n \tunsigned int\t\t\tpriority;\n \t/* EFX match specification */\n \tefx_mae_match_spec_t\t\t*match_spec;\n+\t/* Action set registry entry */\n+\tstruct sfc_mae_action_set\t*action_set;\n };\n \n /* Flow specification */\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 42200c3f7e..de2c6b26e4 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -43,6 +43,7 @@ sfc_mae_attach(struct sfc_adapter *sa)\n \n \tmae->status = SFC_MAE_STATUS_SUPPORTED;\n \tmae->nb_action_rule_prios_max = limits.eml_max_n_action_prios;\n+\tTAILQ_INIT(&mae->action_sets);\n \n \tsfc_log_init(sa, \"done\");\n \n@@ -76,6 +77,68 @@ sfc_mae_detach(struct sfc_adapter *sa)\n \tsfc_log_init(sa, \"done\");\n }\n \n+static struct sfc_mae_action_set *\n+sfc_mae_action_set_attach(struct sfc_adapter *sa,\n+\t\t\t  const efx_mae_actions_t *spec)\n+{\n+\tstruct sfc_mae_action_set *action_set;\n+\tstruct sfc_mae *mae = &sa->mae;\n+\n+\tSFC_ASSERT(sfc_adapter_is_locked(sa));\n+\n+\tTAILQ_FOREACH(action_set, &mae->action_sets, entries) {\n+\t\tif (efx_mae_action_set_specs_equal(action_set->spec, spec)) {\n+\t\t\t++(action_set->refcnt);\n+\t\t\treturn action_set;\n+\t\t}\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+static int\n+sfc_mae_action_set_add(struct sfc_adapter *sa,\n+\t\t       efx_mae_actions_t *spec,\n+\t\t       struct sfc_mae_action_set **action_setp)\n+{\n+\tstruct sfc_mae_action_set *action_set;\n+\tstruct sfc_mae *mae = &sa->mae;\n+\n+\tSFC_ASSERT(sfc_adapter_is_locked(sa));\n+\n+\taction_set = rte_zmalloc(\"sfc_mae_action_set\", sizeof(*action_set), 0);\n+\tif (action_set == NULL)\n+\t\treturn ENOMEM;\n+\n+\taction_set->refcnt = 1;\n+\taction_set->spec = spec;\n+\n+\tTAILQ_INSERT_TAIL(&mae->action_sets, action_set, entries);\n+\n+\t*action_setp = action_set;\n+\n+\treturn 0;\n+}\n+\n+static void\n+sfc_mae_action_set_del(struct sfc_adapter *sa,\n+\t\t       struct sfc_mae_action_set *action_set)\n+{\n+\tstruct sfc_mae *mae = &sa->mae;\n+\n+\tSFC_ASSERT(sfc_adapter_is_locked(sa));\n+\tSFC_ASSERT(action_set->refcnt != 0);\n+\n+\t--(action_set->refcnt);\n+\n+\tif (action_set->refcnt != 0)\n+\t\treturn;\n+\n+\tefx_mae_action_set_spec_fini(sa->nic, action_set->spec);\n+\tTAILQ_REMOVE(&mae->action_sets, action_set, entries);\n+\trte_free(action_set);\n+}\n+\n void\n sfc_mae_flow_cleanup(struct sfc_adapter *sa,\n \t\t     struct rte_flow *flow)\n@@ -93,6 +156,9 @@ sfc_mae_flow_cleanup(struct sfc_adapter *sa,\n \n \tspec_mae = &spec->mae;\n \n+\tif (spec_mae->action_set != NULL)\n+\t\tsfc_mae_action_set_del(sa, spec_mae->action_set);\n+\n \tif (spec_mae->match_spec != NULL)\n \t\tefx_mae_match_spec_fini(sa->nic, spec_mae->match_spec);\n }\n@@ -149,6 +215,73 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \treturn rc;\n }\n \n+static int\n+sfc_mae_rule_parse_action(const struct rte_flow_action *action,\n+\t\t\t  __rte_unused efx_mae_actions_t *spec,\n+\t\t\t  struct rte_flow_error *error)\n+{\n+\tswitch (action->type) {\n+\tdefault:\n+\t\treturn rte_flow_error_set(error, ENOTSUP,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION, NULL,\n+\t\t\t\t\"Unsupported action\");\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n+\t\t\t   const struct rte_flow_action actions[],\n+\t\t\t   struct sfc_mae_action_set **action_setp,\n+\t\t\t   struct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_action *action;\n+\tefx_mae_actions_t *spec;\n+\tint rc;\n+\n+\tif (actions == NULL) {\n+\t\treturn rte_flow_error_set(error, EINVAL,\n+\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n+\t\t\t\t\"NULL actions\");\n+\t}\n+\n+\trc = efx_mae_action_set_spec_init(sa->nic, &spec);\n+\tif (rc != 0)\n+\t\tgoto fail_action_set_spec_init;\n+\n+\tfor (action = actions;\n+\t     action->type != RTE_FLOW_ACTION_TYPE_END; ++action) {\n+\t\trc = sfc_mae_rule_parse_action(action, spec, error);\n+\t\tif (rc != 0)\n+\t\t\tgoto fail_rule_parse_action;\n+\t}\n+\n+\t*action_setp = sfc_mae_action_set_attach(sa, spec);\n+\tif (*action_setp != NULL) {\n+\t\tefx_mae_action_set_spec_fini(sa->nic, spec);\n+\t\treturn 0;\n+\t}\n+\n+\trc = sfc_mae_action_set_add(sa, spec, action_setp);\n+\tif (rc != 0)\n+\t\tgoto fail_action_set_add;\n+\n+\treturn 0;\n+\n+fail_action_set_add:\n+fail_rule_parse_action:\n+\tefx_mae_action_set_spec_fini(sa->nic, spec);\n+\n+fail_action_set_spec_init:\n+\tif (rc > 0) {\n+\t\trc = rte_flow_error_set(error, rc,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL, \"Failed to process the action\");\n+\t}\n+\treturn rc;\n+}\n+\n static bool\n sfc_mae_rules_class_cmp(struct sfc_adapter *sa,\n \t\t\tconst efx_mae_match_spec_t *left,\ndiff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h\nindex 4c5bc4c6ce..5727962a0b 100644\n--- a/drivers/net/sfc/sfc_mae.h\n+++ b/drivers/net/sfc/sfc_mae.h\n@@ -18,6 +18,15 @@\n extern \"C\" {\n #endif\n \n+/** Action set registry entry */\n+struct sfc_mae_action_set {\n+\tTAILQ_ENTRY(sfc_mae_action_set)\tentries;\n+\tunsigned int\t\t\trefcnt;\n+\tefx_mae_actions_t\t\t*spec;\n+};\n+\n+TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);\n+\n /** Options for MAE support status */\n enum sfc_mae_status {\n \tSFC_MAE_STATUS_UNKNOWN = 0,\n@@ -30,6 +39,8 @@ struct sfc_mae {\n \tenum sfc_mae_status\t\tstatus;\n \t/** Priority level limit for MAE action rules */\n \tunsigned int\t\t\tnb_action_rule_prios_max;\n+\t/** Action set registry */\n+\tstruct sfc_mae_action_sets\taction_sets;\n };\n \n struct sfc_adapter;\n@@ -46,6 +57,10 @@ int sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,\n \t\t\t       const struct rte_flow_item pattern[],\n \t\t\t       struct sfc_flow_spec_mae *spec,\n \t\t\t       struct rte_flow_error *error);\n+int sfc_mae_rule_parse_actions(struct sfc_adapter *sa,\n+\t\t\t       const struct rte_flow_action actions[],\n+\t\t\t       struct sfc_mae_action_set **action_setp,\n+\t\t\t       struct rte_flow_error *error);\n sfc_flow_verify_cb_t sfc_mae_flow_verify;\n \n #ifdef __cplusplus\n",
    "prefixes": [
        "15/62"
    ]
}