get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 89001,
    "url": "http://patches.dpdk.org/api/patches/89001/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210312093143.28186-6-ivan.malov@oktetlabs.ru/",
    "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": "<20210312093143.28186-6-ivan.malov@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210312093143.28186-6-ivan.malov@oktetlabs.ru",
    "date": "2021-03-12T09:31:39",
    "name": "[06/10] common/sfc_efx/base: support adding action ENCAP to a set",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4784c7ca384da0687b1cc59aa41477a52272b503",
    "submitter": {
        "id": 869,
        "url": "http://patches.dpdk.org/api/people/869/?format=api",
        "name": "Ivan Malov",
        "email": "Ivan.Malov@oktetlabs.ru"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210312093143.28186-6-ivan.malov@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 15630,
            "url": "http://patches.dpdk.org/api/series/15630/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15630",
            "date": "2021-03-12T09:31:34",
            "name": "[01/10] ethdev: reuse header definition in flow pattern item ETH",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15630/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/89001/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/89001/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 9F1E9A0547;\n\tFri, 12 Mar 2021 10:32:24 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 77B8E16087B;\n\tFri, 12 Mar 2021 10:31:56 +0100 (CET)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 690D61607EE\n for <dev@dpdk.org>; Fri, 12 Mar 2021 10:31:50 +0100 (CET)",
            "from localhost.localdomain (unknown [188.242.7.54])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 118527F5AB;\n Fri, 12 Mar 2021 12:31:50 +0300 (MSK)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 118527F5AB",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru;\n s=default; t=1615541510;\n bh=eLbcKi5t5dU77ct6iQRmTzxKGAEq8Bu6aJlGTmMbsG0=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=WUT7XHr55ev1ULL1TMBjvc51tbQNVkD+dPmPgdqwwSf2gPT0wYBQXGwewfrM9+KIq\n /3excS/ohC7Fkiab6bJMc6b1BG7VHvJDzn/dvY1vADpBDeZSykt2yhyweGy032gXVw\n k+SJvlPcZNS+3SIBFexasB2Xk4K5a3UMkA+rgzYk=",
        "From": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>",
        "Date": "Fri, 12 Mar 2021 12:31:39 +0300",
        "Message-Id": "<20210312093143.28186-6-ivan.malov@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210312093143.28186-1-ivan.malov@oktetlabs.ru>",
        "References": "<20210312093143.28186-1-ivan.malov@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 06/10] common/sfc_efx/base: support adding action\n ENCAP to a set",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "For convenience, there are two separate APIs provided, one for\nadding the action and one for setting the encap. header ID.\nThis design allows the client driver to first build the action\nset specification (which validates the order of the actions)\nand, if everything is correct, proceed with allocation of the\nresource utilised by the action set (encap. header). This\nfacilitates clarity of the client code and its efficiency.\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nReviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n drivers/common/sfc_efx/base/efx.h      |  16 ++++\n drivers/common/sfc_efx/base/efx_impl.h |  12 +++\n drivers/common/sfc_efx/base/efx_mae.c  | 126 ++++++++++++++++++++++++-\n drivers/common/sfc_efx/version.map     |   2 +\n 4 files changed, 153 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h\nindex 4a738e589..052946aa3 100644\n--- a/drivers/common/sfc_efx/base/efx.h\n+++ b/drivers/common/sfc_efx/base/efx.h\n@@ -4252,6 +4252,15 @@ efx_mae_action_set_populate_vlan_push(\n \t__in\t\t\t\tuint16_t tpid_be,\n \t__in\t\t\t\tuint16_t tci_be);\n \n+/*\n+ * Use efx_mae_action_set_fill_in_eh_id() to set ID of the allocated\n+ * encap. header in the specification prior to action set allocation.\n+ */\n+LIBEFX_API\n+extern\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_populate_encap(\n+\t__in\t\t\t\tefx_mae_actions_t *spec);\n+\n LIBEFX_API\n extern\t__checkReturn\t\t\tefx_rc_t\n efx_mae_action_set_populate_flag(\n@@ -4345,6 +4354,13 @@ efx_mae_encap_header_free(\n \t__in\t\t\t\tefx_nic_t *enp,\n \t__in\t\t\t\tconst efx_mae_eh_id_t *eh_idp);\n \n+/* See description before efx_mae_action_set_populate_encap(). */\n+LIBEFX_API\n+extern\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_fill_in_eh_id(\n+\t__in\t\t\t\tefx_mae_actions_t *spec,\n+\t__in\t\t\t\tconst efx_mae_eh_id_t *eh_idp);\n+\n /* Action set ID */\n typedef struct efx_mae_aset_id_s {\n \tuint32_t id;\ndiff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h\nindex 1005dd0aa..0adf43c26 100644\n--- a/drivers/common/sfc_efx/base/efx_impl.h\n+++ b/drivers/common/sfc_efx/base/efx_impl.h\n@@ -1709,6 +1709,7 @@ typedef enum efx_mae_action_e {\n \t/* These actions are strictly ordered. */\n \tEFX_MAE_ACTION_VLAN_POP,\n \tEFX_MAE_ACTION_VLAN_PUSH,\n+\tEFX_MAE_ACTION_ENCAP,\n \n \t/*\n \t * These actions are not strictly ordered and can\n@@ -1736,6 +1737,10 @@ typedef struct efx_mae_action_vlan_push_s {\n \tuint16_t\t\t\temavp_tci_be;\n } efx_mae_action_vlan_push_t;\n \n+typedef struct efx_mae_actions_rsrc_s {\n+\tefx_mae_eh_id_t\t\t\temar_eh_id;\n+} efx_mae_actions_rsrc_t;\n+\n struct efx_mae_actions_s {\n \t/* Bitmap of actions in spec, indexed by action type */\n \tuint32_t\t\t\tema_actions;\n@@ -1746,6 +1751,13 @@ struct efx_mae_actions_s {\n \t    EFX_MAE_VLAN_PUSH_MAX_NTAGS];\n \tuint32_t\t\t\tema_mark_value;\n \tefx_mport_sel_t\t\t\tema_deliver_mport;\n+\n+\t/*\n+\t * Always keep this at the end of the struct since\n+\t * efx_mae_action_set_specs_equal() relies on that\n+\t * to make sure that resource IDs are not compared.\n+\t */\n+\tefx_mae_actions_rsrc_t\t\tema_rsrc;\n };\n \n #endif /* EFSYS_OPT_MAE */\ndiff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c\nindex 798867963..896500de0 100644\n--- a/drivers/common/sfc_efx/base/efx_mae.c\n+++ b/drivers/common/sfc_efx/base/efx_mae.c\n@@ -994,6 +994,8 @@ efx_mae_action_set_spec_init(\n \t\tgoto fail1;\n \t}\n \n+\tspec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;\n+\n \t*specp = spec;\n \n \treturn (0);\n@@ -1085,6 +1087,50 @@ efx_mae_action_set_add_vlan_push(\n \treturn (rc);\n }\n \n+static\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_add_encap(\n+\t__in\t\t\t\tefx_mae_actions_t *spec,\n+\t__in\t\t\t\tsize_t arg_size,\n+\t__in_bcount(arg_size)\t\tconst uint8_t *arg)\n+{\n+\tefx_rc_t rc;\n+\n+\t/*\n+\t * Adding this specific action to an action set spec and setting encap.\n+\t * header ID in the spec are two individual steps. This design allows\n+\t * the client driver to avoid encap. header allocation when it simply\n+\t * needs to check the order of actions submitted by user (\"validate\"),\n+\t * without actually allocating an action set and inserting a rule.\n+\t *\n+\t * For now, mark encap. header ID as invalid; the caller will invoke\n+\t * efx_mae_action_set_fill_in_eh_id() to override the field prior\n+\t * to action set allocation; otherwise, the allocation will fail.\n+\t */\n+\tspec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;\n+\n+\t/*\n+\t * As explained above, there are no arguments to handle here.\n+\t * efx_mae_action_set_fill_in_eh_id() will take care of them.\n+\t */\n+\tif (arg_size != 0) {\n+\t\trc = EINVAL;\n+\t\tgoto fail1;\n+\t}\n+\n+\tif (arg != NULL) {\n+\t\trc = EINVAL;\n+\t\tgoto fail2;\n+\t}\n+\n+\treturn (0);\n+\n+fail2:\n+\tEFSYS_PROBE(fail2);\n+fail1:\n+\tEFSYS_PROBE1(fail1, efx_rc_t, rc);\n+\treturn (rc);\n+}\n+\n static\t__checkReturn\t\t\tefx_rc_t\n efx_mae_action_set_add_flag(\n \t__in\t\t\t\tefx_mae_actions_t *spec,\n@@ -1187,6 +1233,9 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {\n \t[EFX_MAE_ACTION_VLAN_PUSH] = {\n \t\t.emad_add = efx_mae_action_set_add_vlan_push\n \t},\n+\t[EFX_MAE_ACTION_ENCAP] = {\n+\t\t.emad_add = efx_mae_action_set_add_encap\n+\t},\n \t[EFX_MAE_ACTION_FLAG] = {\n \t\t.emad_add = efx_mae_action_set_add_flag\n \t},\n@@ -1201,6 +1250,7 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {\n static const uint32_t efx_mae_action_ordered_map =\n \t(1U << EFX_MAE_ACTION_VLAN_POP) |\n \t(1U << EFX_MAE_ACTION_VLAN_PUSH) |\n+\t(1U << EFX_MAE_ACTION_ENCAP) |\n \t(1U << EFX_MAE_ACTION_FLAG) |\n \t(1U << EFX_MAE_ACTION_MARK) |\n \t(1U << EFX_MAE_ACTION_DELIVER);\n@@ -1317,6 +1367,20 @@ efx_mae_action_set_populate_vlan_push(\n \t    EFX_MAE_ACTION_VLAN_PUSH, sizeof (action), arg));\n }\n \n+\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_populate_encap(\n+\t__in\t\t\t\tefx_mae_actions_t *spec)\n+{\n+\t/*\n+\t * There is no argument to pass encap. header ID, thus, one does not\n+\t * need to allocate an encap. header while parsing application input.\n+\t * This is useful since building an action set may be done simply to\n+\t * validate a rule, whilst resource allocation usually consumes time.\n+\t */\n+\treturn (efx_mae_action_set_spec_populate(spec,\n+\t    EFX_MAE_ACTION_ENCAP, 0, NULL));\n+}\n+\n \t__checkReturn\t\t\tefx_rc_t\n efx_mae_action_set_populate_flag(\n \t__in\t\t\t\tefx_mae_actions_t *spec)\n@@ -1389,7 +1453,22 @@ efx_mae_action_set_specs_equal(\n \t__in\t\t\t\tconst efx_mae_actions_t *left,\n \t__in\t\t\t\tconst efx_mae_actions_t *right)\n {\n-\treturn ((memcmp(left, right, sizeof (*left)) == 0) ? B_TRUE : B_FALSE);\n+\tsize_t cmp_size = EFX_FIELD_OFFSET(efx_mae_actions_t, ema_rsrc);\n+\n+\t/*\n+\t * An action set specification consists of two parts. The first part\n+\t * indicates what actions are included in the action set, as well as\n+\t * extra quantitative values (in example, the number of VLAN tags to\n+\t * push). The second part comprises resource IDs used by the actions.\n+\t *\n+\t * A resource, in example, a counter, is allocated from the hardware\n+\t * by the client, and it's the client who is responsible for keeping\n+\t * track of allocated resources and comparing resource IDs if needed.\n+\t *\n+\t * In this API, don't compare resource IDs in the two specifications.\n+\t */\n+\n+\treturn ((memcmp(left, right, cmp_size) == 0) ? B_TRUE : B_FALSE);\n }\n \n \t__checkReturn\t\t\tefx_rc_t\n@@ -1846,6 +1925,46 @@ efx_mae_encap_header_free(\n \n \treturn (0);\n \n+fail3:\n+\tEFSYS_PROBE(fail3);\n+fail2:\n+\tEFSYS_PROBE(fail2);\n+fail1:\n+\tEFSYS_PROBE1(fail1, efx_rc_t, rc);\n+\treturn (rc);\n+}\n+\n+\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_fill_in_eh_id(\n+\t__in\t\t\t\tefx_mae_actions_t *spec,\n+\t__in\t\t\t\tconst efx_mae_eh_id_t *eh_idp)\n+{\n+\tefx_rc_t rc;\n+\n+\tif ((spec->ema_actions & (1U << EFX_MAE_ACTION_ENCAP)) == 0) {\n+\t\t/*\n+\t\t * The caller has not intended to have action ENCAP originally,\n+\t\t * hence, this attempt to indicate encap. header ID is invalid.\n+\t\t */\n+\t\trc = EINVAL;\n+\t\tgoto fail1;\n+\t}\n+\n+\tif (spec->ema_rsrc.emar_eh_id.id != EFX_MAE_RSRC_ID_INVALID) {\n+\t\t/* The caller attempts to indicate encap. header ID twice. */\n+\t\trc = EINVAL;\n+\t\tgoto fail2;\n+\t}\n+\n+\tif (eh_idp->id == EFX_MAE_RSRC_ID_INVALID) {\n+\t\trc = EINVAL;\n+\t\tgoto fail3;\n+\t}\n+\n+\tspec->ema_rsrc.emar_eh_id.id = eh_idp->id;\n+\n+\treturn (0);\n+\n fail3:\n \tEFSYS_PROBE(fail3);\n fail2:\n@@ -1889,8 +2008,6 @@ efx_mae_action_set_alloc(\n \t    MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID, EFX_MAE_RSRC_ID_INVALID);\n \tMCDI_IN_SET_DWORD(req,\n \t    MAE_ACTION_SET_ALLOC_IN_COUNTER_ID, EFX_MAE_RSRC_ID_INVALID);\n-\tMCDI_IN_SET_DWORD(req,\n-\t    MAE_ACTION_SET_ALLOC_IN_ENCAP_HEADER_ID, EFX_MAE_RSRC_ID_INVALID);\n \n \tMCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS,\n \t    MAE_ACTION_SET_ALLOC_IN_VLAN_POP, spec->ema_n_vlan_tags_to_pop);\n@@ -1920,6 +2037,9 @@ efx_mae_action_set_alloc(\n \t\t    spec->ema_vlan_push_descs[outer_tag_idx].emavp_tci_be);\n \t}\n \n+\tMCDI_IN_SET_DWORD(req, MAE_ACTION_SET_ALLOC_IN_ENCAP_HEADER_ID,\n+\t    spec->ema_rsrc.emar_eh_id.id);\n+\n \tif ((spec->ema_actions & (1U << EFX_MAE_ACTION_FLAG)) != 0) {\n \t\tMCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS,\n \t\t    MAE_ACTION_SET_ALLOC_IN_FLAG, 1);\ndiff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map\nindex 168899d51..f33a2a08e 100644\n--- a/drivers/common/sfc_efx/version.map\n+++ b/drivers/common/sfc_efx/version.map\n@@ -88,9 +88,11 @@ INTERNAL {\n \tefx_mae_action_rule_insert;\n \tefx_mae_action_rule_remove;\n \tefx_mae_action_set_alloc;\n+\tefx_mae_action_set_fill_in_eh_id;\n \tefx_mae_action_set_free;\n \tefx_mae_action_set_populate_deliver;\n \tefx_mae_action_set_populate_drop;\n+\tefx_mae_action_set_populate_encap;\n \tefx_mae_action_set_populate_flag;\n \tefx_mae_action_set_populate_mark;\n \tefx_mae_action_set_populate_vlan_pop;\n",
    "prefixes": [
        "06/10"
    ]
}