get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 93514,
    "url": "http://patches.dpdk.org/api/patches/93514/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210527152510.1551026-16-andrew.rybchenko@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": "<20210527152510.1551026-16-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210527152510.1551026-16-andrew.rybchenko@oktetlabs.ru",
    "date": "2021-05-27T15:25:05",
    "name": "[15/20] common/sfc_efx/base: support counter in action set",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f9db1c8b763bdbd15de2b4bd20c0e11db243899b",
    "submitter": {
        "id": 2013,
        "url": "http://patches.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210527152510.1551026-16-andrew.rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 17144,
            "url": "http://patches.dpdk.org/api/series/17144/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=17144",
            "date": "2021-05-27T15:24:50",
            "name": "net/sfc: support flow API COUNT action",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/17144/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/93514/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/93514/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 8E9C3A0546;\n\tThu, 27 May 2021 17:27:32 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3311441107;\n\tThu, 27 May 2021 17:26:24 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id A264B41107\n for <dev@dpdk.org>; Thu, 27 May 2021 17:26:22 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id 710817F601; Thu, 27 May 2021 18:26:22 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 4113E7F608;\n Thu, 27 May 2021 18:25:43 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 4113E7F608",
        "Authentication-Results": "shelob.oktetlabs.ru/4113E7F608; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Igor Romanov <igor.romanov@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Thu, 27 May 2021 18:25:05 +0300",
        "Message-Id": "<20210527152510.1551026-16-andrew.rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210527152510.1551026-1-andrew.rybchenko@oktetlabs.ru>",
        "References": "<20210527152510.1551026-1-andrew.rybchenko@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 15/20] common/sfc_efx/base: support counter in\n action 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": "From: Igor Romanov <igor.romanov@oktetlabs.ru>\n\nUser will be able to associate counter with MAE action set to\ncollect counter packets and bytes for a specific action set.\n\nSigned-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\nReviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>\n---\n drivers/common/sfc_efx/base/efx.h      |  21 ++++\n drivers/common/sfc_efx/base/efx_impl.h |   3 +\n drivers/common/sfc_efx/base/efx_mae.c  | 133 ++++++++++++++++++++++++-\n drivers/common/sfc_efx/version.map     |   3 +\n 4 files changed, 157 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h\nindex cc173d13c6..628e61e065 100644\n--- a/drivers/common/sfc_efx/base/efx.h\n+++ b/drivers/common/sfc_efx/base/efx.h\n@@ -4306,6 +4306,15 @@ 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+/*\n+ * Use efx_mae_action_set_fill_in_counter_id() to set ID of a counter\n+ * 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_count(\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@@ -4410,6 +4419,18 @@ typedef struct efx_counter_s {\n \tuint32_t id;\n } efx_counter_t;\n \n+LIBEFX_API\n+extern\t__checkReturn\t\t\tunsigned int\n+efx_mae_action_set_get_nb_count(\n+\t__in\t\t\t\tconst efx_mae_actions_t *spec);\n+\n+/* See description before efx_mae_action_set_populate_count(). */\n+LIBEFX_API\n+extern\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_fill_in_counter_id(\n+\t__in\t\t\t\tefx_mae_actions_t *spec,\n+\t__in\t\t\t\tconst efx_counter_t *counter_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 9dbf6d450c..992edbabe3 100644\n--- a/drivers/common/sfc_efx/base/efx_impl.h\n+++ b/drivers/common/sfc_efx/base/efx_impl.h\n@@ -1734,6 +1734,7 @@ typedef enum efx_mae_action_e {\n \tEFX_MAE_ACTION_DECAP,\n \tEFX_MAE_ACTION_VLAN_POP,\n \tEFX_MAE_ACTION_VLAN_PUSH,\n+\tEFX_MAE_ACTION_COUNT,\n \tEFX_MAE_ACTION_ENCAP,\n \n \t/*\n@@ -1764,6 +1765,7 @@ typedef struct efx_mae_action_vlan_push_s {\n \n typedef struct efx_mae_actions_rsrc_s {\n \tefx_mae_eh_id_t\t\t\temar_eh_id;\n+\tefx_counter_t\t\t\temar_counter_id;\n } efx_mae_actions_rsrc_t;\n \n struct efx_mae_actions_s {\n@@ -1774,6 +1776,7 @@ struct efx_mae_actions_s {\n \tunsigned int\t\t\tema_n_vlan_tags_to_push;\n \tefx_mae_action_vlan_push_t\tema_vlan_push_descs[\n \t    EFX_MAE_VLAN_PUSH_MAX_NTAGS];\n+\tunsigned int\t\t\tema_n_count_actions;\n \tuint32_t\t\t\tema_mark_value;\n \tefx_mport_sel_t\t\t\tema_deliver_mport;\n \ndiff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c\nindex 0b3131161b..8d1294a627 100644\n--- a/drivers/common/sfc_efx/base/efx_mae.c\n+++ b/drivers/common/sfc_efx/base/efx_mae.c\n@@ -1191,6 +1191,7 @@ efx_mae_action_set_spec_init(\n \t}\n \n \tspec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;\n+\tspec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;\n \n \t*specp = spec;\n \n@@ -1358,6 +1359,50 @@ efx_mae_action_set_add_encap(\n \treturn (rc);\n }\n \n+static\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_add_count(\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+\tEFX_STATIC_ASSERT(EFX_MAE_RSRC_ID_INVALID ==\n+\t\t\t  MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL);\n+\n+\t/*\n+\t * Preparing an action set spec to update a counter requires\n+\t * two steps: first add this action to the action spec, and then\n+\t * add the counter ID to the spec. This allows validity checking\n+\t * and resource allocation to be done separately.\n+\t * Mark the counter ID as invalid in the spec to ensure that the\n+\t * caller must also invoke efx_mae_action_set_fill_in_counter_id()\n+\t * before action set allocation.\n+\t */\n+\tspec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;\n+\n+\t/* Nothing else is supposed to take place over here. */\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+\t++(spec->ema_n_count_actions);\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@@ -1466,6 +1511,9 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {\n \t[EFX_MAE_ACTION_ENCAP] = {\n \t\t.emad_add = efx_mae_action_set_add_encap\n \t},\n+\t[EFX_MAE_ACTION_COUNT] = {\n+\t\t.emad_add = efx_mae_action_set_add_count\n+\t},\n \t[EFX_MAE_ACTION_FLAG] = {\n \t\t.emad_add = efx_mae_action_set_add_flag\n \t},\n@@ -1481,6 +1529,12 @@ static const uint32_t efx_mae_action_ordered_map =\n \t(1U << EFX_MAE_ACTION_DECAP) |\n \t(1U << EFX_MAE_ACTION_VLAN_POP) |\n \t(1U << EFX_MAE_ACTION_VLAN_PUSH) |\n+\t/*\n+\t * HW will conduct action COUNT after\n+\t * the matching packet has been modified by\n+\t * length-affecting actions except for ENCAP.\n+\t */\n+\t(1U << EFX_MAE_ACTION_COUNT) |\n \t(1U << EFX_MAE_ACTION_ENCAP) |\n \t(1U << EFX_MAE_ACTION_FLAG) |\n \t(1U << EFX_MAE_ACTION_MARK) |\n@@ -1497,7 +1551,8 @@ static const uint32_t efx_mae_action_nonstrict_map =\n \n static const uint32_t efx_mae_action_repeat_map =\n \t(1U << EFX_MAE_ACTION_VLAN_POP) |\n-\t(1U << EFX_MAE_ACTION_VLAN_PUSH);\n+\t(1U << EFX_MAE_ACTION_VLAN_PUSH) |\n+\t(1U << EFX_MAE_ACTION_COUNT);\n \n /*\n  * Add an action to an action set.\n@@ -1620,6 +1675,20 @@ efx_mae_action_set_populate_encap(\n \t    EFX_MAE_ACTION_ENCAP, 0, NULL));\n }\n \n+\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_populate_count(\n+\t__in\t\t\t\tefx_mae_actions_t *spec)\n+{\n+\t/*\n+\t * There is no argument to pass counter ID, thus, one does not\n+\t * need to allocate a counter 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_COUNT, 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@@ -2306,8 +2375,6 @@ efx_mae_action_set_alloc(\n \t */\n \tMCDI_IN_SET_DWORD(req,\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 \n \tif ((spec->ema_actions & (1U << EFX_MAE_ACTION_DECAP)) != 0) {\n \t\tMCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS,\n@@ -2344,6 +2411,8 @@ efx_mae_action_set_alloc(\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+\tMCDI_IN_SET_DWORD(req, MAE_ACTION_SET_ALLOC_IN_COUNTER_ID,\n+\t    spec->ema_rsrc.emar_counter_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@@ -2603,6 +2672,64 @@ efx_mae_action_rule_remove(\n \n \treturn (0);\n \n+fail4:\n+\tEFSYS_PROBE(fail4);\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\tunsigned int\n+efx_mae_action_set_get_nb_count(\n+\t__in\t\t\t\tconst efx_mae_actions_t *spec)\n+{\n+\treturn (spec->ema_n_count_actions);\n+}\n+\n+\t__checkReturn\t\t\tefx_rc_t\n+efx_mae_action_set_fill_in_counter_id(\n+\t__in\t\t\t\tefx_mae_actions_t *spec,\n+\t__in\t\t\t\tconst efx_counter_t *counter_idp)\n+{\n+\tefx_rc_t rc;\n+\n+\tif ((spec->ema_actions & (1U << EFX_MAE_ACTION_COUNT)) == 0) {\n+\t\t/*\n+\t\t * Invalid to add counter ID if spec does not have COUNT action.\n+\t\t */\n+\t\trc = EINVAL;\n+\t\tgoto fail1;\n+\t}\n+\n+\tif (spec->ema_n_count_actions != 1) {\n+\t\t/*\n+\t\t * Having multiple COUNT actions in the spec requires a counter\n+\t\t * list to be used. This API must only be used for a single\n+\t\t * counter per spec. Turn down the request as inappropriate.\n+\t\t */\n+\t\trc = EINVAL;\n+\t\tgoto fail2;\n+\t}\n+\n+\tif (spec->ema_rsrc.emar_counter_id.id != EFX_MAE_RSRC_ID_INVALID) {\n+\t\t/* The caller attempts to indicate counter ID twice. */\n+\t\trc = EALREADY;\n+\t\tgoto fail3;\n+\t}\n+\n+\tif (counter_idp->id == EFX_MAE_RSRC_ID_INVALID) {\n+\t\trc = EINVAL;\n+\t\tgoto fail4;\n+\t}\n+\n+\tspec->ema_rsrc.emar_counter_id.id = counter_idp->id;\n+\n+\treturn (0);\n+\n fail4:\n \tEFSYS_PROBE(fail4);\n fail3:\ndiff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map\nindex 622f5d4cf5..0c5bcdfa84 100644\n--- a/drivers/common/sfc_efx/version.map\n+++ b/drivers/common/sfc_efx/version.map\n@@ -89,8 +89,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_counter_id;\n \tefx_mae_action_set_fill_in_eh_id;\n \tefx_mae_action_set_free;\n+\tefx_mae_action_set_get_nb_count;\n+\tefx_mae_action_set_populate_count;\n \tefx_mae_action_set_populate_decap;\n \tefx_mae_action_set_populate_deliver;\n \tefx_mae_action_set_populate_drop;\n",
    "prefixes": [
        "15/20"
    ]
}