get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 135195,
    "url": "https://patches.dpdk.org/api/patches/135195/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231214105813.570597-2-psatheesh@marvell.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": "<20231214105813.570597-2-psatheesh@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231214105813.570597-2-psatheesh@marvell.com",
    "date": "2023-12-14T10:58:12",
    "name": "[2/3] net/cnxk: support mirror flow action",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "d49bc061b41549f2f08c23b463aae917fa13d7b8",
    "submitter": {
        "id": 1663,
        "url": "https://patches.dpdk.org/api/people/1663/?format=api",
        "name": "Satheesh Paul Antonysamy",
        "email": "psatheesh@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20231214105813.570597-2-psatheesh@marvell.com/mbox/",
    "series": [
        {
            "id": 30552,
            "url": "https://patches.dpdk.org/api/series/30552/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=30552",
            "date": "2023-12-14T10:58:11",
            "name": "[1/3] common/cnxk: support mirror flow action",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/30552/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/135195/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/135195/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 695D8436EE;\n\tThu, 14 Dec 2023 11:58:28 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 70BEF43036;\n\tThu, 14 Dec 2023 11:58:27 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 78BDA40697\n for <dev@dpdk.org>; Thu, 14 Dec 2023 11:58:26 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id\n 3BE9LV7n016648 for <dev@dpdk.org>; Thu, 14 Dec 2023 02:58:25 -0800",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uyy0nr8yj-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 14 Dec 2023 02:58:25 -0800 (PST)",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Thu, 14 Dec 2023 02:58:23 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Thu, 14 Dec 2023 02:58:23 -0800",
            "from satheeshpaullabpc.. (unknown [10.28.34.33])\n by maili.marvell.com (Postfix) with ESMTP id ADD293F7045;\n Thu, 14 Dec 2023 02:58:21 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding:content-type; s=\n pfpt0220; bh=WbqK5bJLqDraZpO1lAB1z1Y4xES1y8WR8UfsTVQ3UPA=; b=iF5\n LpVw5y0/uMhb11fNyENnjZVfJQlG3kJkA+2tvcFCQIlnIvaO26jsWrpAmrlk2fnd\n HE1AtRThizNfUFCdzvAZt/5zqpFHxA5NRVG7wcvZLe7diQ3Bh7vv81atYIJKIS2N\n EpIfmH7uzlpZqHvCwO/GypqLkGx6uuZr2IrtyWYNlmACcb6qo98hyzpXIA64wTTm\n eBSL3+Fs3IpXk7PeQYiZaZx1GAFYaOSIwP3lJ4ljnaegHPdVkBKN2gk+co//Wr4n\n Z4PgEs/nZ97L31oJZT+7tjhuj2xb8natpIpeHS+WAWSak+w8ArD1ovm5M9PahxOe\n iUXbLSmbLGEXhNao/UQ==",
        "From": "<psatheesh@marvell.com>",
        "To": "Nithin Dabilpuram <ndabilpuram@marvell.com>, Kiran Kumar K\n <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>, Satha Rao\n <skoteshwar@marvell.com>",
        "CC": "<dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>",
        "Subject": "[dpdk-dev] [PATCH 2/3] net/cnxk: support mirror flow action",
        "Date": "Thu, 14 Dec 2023 16:28:12 +0530",
        "Message-ID": "<20231214105813.570597-2-psatheesh@marvell.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20231214105813.570597-1-psatheesh@marvell.com>",
        "References": "<20231214105813.570597-1-psatheesh@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "tgh-c6cycCFvVZpwrGsBrP9mhDlXAcyV",
        "X-Proofpoint-GUID": "tgh-c6cycCFvVZpwrGsBrP9mhDlXAcyV",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02",
        "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": "From: Satheesh Paul <psatheesh@marvell.com>\n\nAdded RTE_FLOW_ACTION_TYPE_SAMPLE action type for cnxk device.\n\nSigned-off-by: Satheesh Paul <psatheesh@marvell.com>\nReviewed-by: Kiran Kumar K <kirankumark@marvell.com>\n---\n doc/guides/nics/features/cnxk.ini |   1 +\n drivers/net/cnxk/cnxk_flow.c      | 121 ++++++++++++++++++++++++++++--\n 2 files changed, 115 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini\nindex cc7deaeaa9..94e7a6ab8d 100644\n--- a/doc/guides/nics/features/cnxk.ini\n+++ b/doc/guides/nics/features/cnxk.ini\n@@ -97,6 +97,7 @@ port_id              = Y\n queue                = Y\n represented_port     = Y\n rss                  = Y\n+sample               = Y\n security             = Y\n skip_cman            = Y\n vf                   = Y\ndiff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c\nindex 2eee44ed09..11670d37e0 100644\n--- a/drivers/net/cnxk/cnxk_flow.c\n+++ b/drivers/net/cnxk/cnxk_flow.c\n@@ -114,14 +114,102 @@ npc_rss_flowkey_get(struct cnxk_eth_dev *eth_dev,\n \t*flowkey_cfg = cnxk_rss_ethdev_to_nix(eth_dev, rss->types, rss->level);\n }\n \n+static int\n+npc_parse_port_id_action(struct rte_eth_dev *eth_dev, const struct rte_flow_action *action,\n+\t\t\t uint16_t *dst_pf_func, uint16_t *dst_channel)\n+{\n+\tconst struct rte_flow_action_port_id *port_act;\n+\tstruct rte_eth_dev *portid_eth_dev;\n+\tchar if_name[RTE_ETH_NAME_MAX_LEN];\n+\tstruct cnxk_eth_dev *hw_dst;\n+\tstruct roc_npc *roc_npc_dst;\n+\tint rc = 0;\n+\n+\tport_act = (const struct rte_flow_action_port_id *)action->conf;\n+\n+\trc = rte_eth_dev_get_name_by_port(port_act->id, if_name);\n+\tif (rc) {\n+\t\tplt_err(\"Name not found for output port id\");\n+\t\tgoto err_exit;\n+\t}\n+\tportid_eth_dev = rte_eth_dev_allocated(if_name);\n+\tif (!portid_eth_dev) {\n+\t\tplt_err(\"eth_dev not found for output port id\");\n+\t\tgoto err_exit;\n+\t}\n+\tif (strcmp(portid_eth_dev->device->driver->name, eth_dev->device->driver->name) != 0) {\n+\t\tplt_err(\"Output port not under same driver\");\n+\t\tgoto err_exit;\n+\t}\n+\thw_dst = portid_eth_dev->data->dev_private;\n+\troc_npc_dst = &hw_dst->npc;\n+\t*dst_pf_func = roc_npc_dst->pf_func;\n+\t*dst_channel = hw_dst->npc.channel;\n+\n+\treturn 0;\n+\n+err_exit:\n+\treturn -EINVAL;\n+}\n+\n+static int\n+roc_npc_parse_sample_subaction(struct rte_eth_dev *eth_dev, const struct rte_flow_action actions[],\n+\t\t\t       struct roc_npc_action_sample *sample_action)\n+{\n+\tuint16_t dst_pf_func = 0, dst_channel = 0;\n+\tconst struct roc_npc_action_vf *vf_act;\n+\tint rc = 0, count = 0;\n+\tbool is_empty = true;\n+\n+\tif (sample_action->ratio != 1) {\n+\t\tplt_err(\"Sample ratio must be 1\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {\n+\t\tis_empty = false;\n+\t\tswitch (actions->type) {\n+\t\tcase RTE_FLOW_ACTION_TYPE_PF:\n+\t\t\tcount++;\n+\t\t\tsample_action->action_type |= ROC_NPC_ACTION_TYPE_PF;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_VF:\n+\t\t\tcount++;\n+\t\t\tvf_act = (const struct roc_npc_action_vf *)actions->conf;\n+\t\t\tsample_action->action_type |= ROC_NPC_ACTION_TYPE_VF;\n+\t\t\tsample_action->pf_func = vf_act->id & NPC_PFVF_FUNC_MASK;\n+\t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n+\t\t\trc = npc_parse_port_id_action(eth_dev, actions, &dst_pf_func, &dst_channel);\n+\t\t\tif (rc)\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tcount++;\n+\t\t\tsample_action->action_type |= ROC_NPC_ACTION_TYPE_PORT_ID;\n+\t\t\tsample_action->pf_func = dst_pf_func;\n+\t\t\tsample_action->channel = dst_channel;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcontinue;\n+\t\t}\n+\t}\n+\n+\tif (count > 1 || is_empty)\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n static int\n cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t const struct rte_flow_action actions[], struct roc_npc_action in_actions[],\n-\t\t uint32_t *flowkey_cfg, uint16_t *dst_pf_func)\n+\t\t struct roc_npc_action_sample *in_sample_actions, uint32_t *flowkey_cfg,\n+\t\t uint16_t *dst_pf_func)\n {\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tconst struct rte_flow_action_queue *act_q = NULL;\n \tconst struct rte_flow_action_ethdev *act_ethdev;\n+\tconst struct rte_flow_action_sample *act_sample;\n \tconst struct rte_flow_action_port_id *port_act;\n \tstruct rte_eth_dev *portid_eth_dev;\n \tchar if_name[RTE_ETH_NAME_MAX_LEN];\n@@ -237,9 +325,21 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_AGE;\n \t\t\tin_actions[i].conf = actions->conf;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_SAMPLE:\n+\t\t\tact_sample = actions->conf;\n+\t\t\tin_sample_actions->ratio = act_sample->ratio;\n+\t\t\trc = roc_npc_parse_sample_subaction(eth_dev, act_sample->actions,\n+\t\t\t\t\t\t\t    in_sample_actions);\n+\t\t\tif (rc) {\n+\t\t\t\tplt_err(\"Sample subaction parsing failed.\");\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\n+\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_SAMPLE;\n+\t\t\tin_actions[i].conf = in_sample_actions;\n+\t\t\tbreak;\n \t\tdefault:\n-\t\t\tplt_npc_dbg(\"Action is not supported = %d\",\n-\t\t\t\t    actions->type);\n+\t\t\tplt_npc_dbg(\"Action is not supported = %d\", actions->type);\n \t\t\tgoto err_exit;\n \t\t}\n \t\ti++;\n@@ -263,7 +363,9 @@ static int\n cnxk_map_flow_data(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t   const struct rte_flow_item pattern[], const struct rte_flow_action actions[],\n \t\t   struct roc_npc_attr *in_attr, struct roc_npc_item_info in_pattern[],\n-\t\t   struct roc_npc_action in_actions[], uint32_t *flowkey_cfg, uint16_t *dst_pf_func)\n+\t\t   struct roc_npc_action in_actions[],\n+\t\t   struct roc_npc_action_sample *in_sample_actions, uint32_t *flowkey_cfg,\n+\t\t   uint16_t *dst_pf_func)\n {\n \tint i = 0;\n \n@@ -282,7 +384,8 @@ cnxk_map_flow_data(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr\n \t}\n \tin_pattern[i].type = ROC_NPC_ITEM_TYPE_END;\n \n-\treturn cnxk_map_actions(eth_dev, attr, actions, in_actions, flowkey_cfg, dst_pf_func);\n+\treturn cnxk_map_actions(eth_dev, attr, actions, in_actions, in_sample_actions, flowkey_cfg,\n+\t\t\t\tdst_pf_func);\n }\n \n static int\n@@ -293,6 +396,7 @@ cnxk_flow_validate(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr\n \tstruct roc_npc_item_info in_pattern[ROC_NPC_ITEM_TYPE_END + 1];\n \tstruct roc_npc_action in_actions[ROC_NPC_MAX_ACTION_COUNT];\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tstruct roc_npc_action_sample in_sample_action;\n \tstruct roc_npc *npc = &dev->npc;\n \tstruct roc_npc_attr in_attr;\n \tstruct roc_npc_flow flow;\n@@ -306,10 +410,11 @@ cnxk_flow_validate(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr\n \t\treturn 0;\n \n \tmemset(&flow, 0, sizeof(flow));\n+\tmemset(&in_sample_action, 0, sizeof(in_sample_action));\n \tflow.is_validate = true;\n \n \trc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, in_pattern, in_actions,\n-\t\t\t\t&flowkey_cfg, &dst_pf_func);\n+\t\t\t\t&in_sample_action, &flowkey_cfg, &dst_pf_func);\n \tif (rc) {\n \t\trte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n \t\t\t\t   \"Failed to map flow data\");\n@@ -335,6 +440,7 @@ cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tstruct roc_npc_item_info in_pattern[ROC_NPC_ITEM_TYPE_END + 1];\n \tstruct roc_npc_action in_actions[ROC_NPC_MAX_ACTION_COUNT];\n+\tstruct roc_npc_action_sample in_sample_action;\n \tstruct roc_npc *npc = &dev->npc;\n \tstruct roc_npc_attr in_attr;\n \tstruct roc_npc_flow *flow;\n@@ -342,8 +448,9 @@ cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \tint errcode = 0;\n \tint rc;\n \n+\tmemset(&in_sample_action, 0, sizeof(in_sample_action));\n \trc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, in_pattern, in_actions,\n-\t\t\t\t&npc->flowkey_cfg_state, &dst_pf_func);\n+\t\t\t\t&in_sample_action, &npc->flowkey_cfg_state, &dst_pf_func);\n \tif (rc) {\n \t\trte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n \t\t\t\t   \"Failed to map flow data\");\n",
    "prefixes": [
        "2/3"
    ]
}