get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41724,
    "url": "http://patches.dpdk.org/api/patches/41724/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180627173355.4718-4-adrien.mazarguil@6wind.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": "<20180627173355.4718-4-adrien.mazarguil@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180627173355.4718-4-adrien.mazarguil@6wind.com",
    "date": "2018-06-27T18:08:14",
    "name": "[3/6] net/mlx5: add fate actions to switch flow rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ee3ee9e60ac17535edacf55dac40d29f14613774",
    "submitter": {
        "id": 165,
        "url": "http://patches.dpdk.org/api/people/165/?format=api",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180627173355.4718-4-adrien.mazarguil@6wind.com/mbox/",
    "series": [
        {
            "id": 273,
            "url": "http://patches.dpdk.org/api/series/273/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=273",
            "date": "2018-06-27T18:08:08",
            "name": "net/mlx5: add support for switch flow rules",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/273/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41724/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41724/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2C82F1C3A0;\n\tWed, 27 Jun 2018 20:08:35 +0200 (CEST)",
            "from mail-wr0-f195.google.com (mail-wr0-f195.google.com\n\t[209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 83D5C1C38C\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 20:08:31 +0200 (CEST)",
            "by mail-wr0-f195.google.com with SMTP id l2-v6so2358644wro.7\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 11:08:31 -0700 (PDT)",
            "from 6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\ti4-v6sm4189360wrq.28.2018.06.27.11.08.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 27 Jun 2018 11:08:30 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to;\n\tbh=vowwvn2lJbLTtsrzkUyNNl062xLLE43DSfy0OjgKNpA=;\n\tb=RaJ8T779SqKbwI3G1rHbTFuRyScPRjCvjZA8eeH8EhOrG0xF/UBpopCw+K5JdA0aZz\n\tAaRWNLRPANAd9DP+q8SzPDfHlpckRi2y5pwC1w0T7si+QfMKSN69Sk19A5EjhJ3wXZag\n\txdlFga2513JBAXLC8vnxNI/ZbOpYWf5lbxMqtuVvxSPcKXURx5X8+nlDL1ENQs5BQ07o\n\tWuJ7tkmrhJ+AsJZEfzhIiBBWBL4iXZsmp1GUOyFAdH6QKODtKmVTZWavr2zhinwXCmJw\n\tUp1zNTcc+FVc37rZ43nRAx7OY5F0Nfg78YBpl3lq7xI7ge1RuzbM5PvVnZ2szFu3qVE9\n\th9sA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to;\n\tbh=vowwvn2lJbLTtsrzkUyNNl062xLLE43DSfy0OjgKNpA=;\n\tb=OsM6/9EXzqY7hjDrOvoRXojwK/mLnE6apfgQ0EGNtaioKJjwL3wyRiklbM8I9Szdpp\n\tOA2RVnnAebtUS0qILLxuGhrOQEYgnCC36llPSVMggu05wovXOQTA9SGgbcreVZybCs1J\n\tbq//HILkyvpZS0P+oQ9k1D1Wkgh+QSMBTN4fZbJ0Ink4AEWSho+k7gEQYhR0AKw7Uocd\n\tJCRNS4+MITmLvyQfNwvnx5ICPkXK80TysnTg9OazlbXEbrUvZ1a6H9A55unF3T139pbS\n\tUwLZQXUgVyRHPcxXN/3GJslbqg1lybelwGDXDlYQ2tNwStsb19hqsZgUWs4ndoqirXAV\n\tjgWA==",
        "X-Gm-Message-State": "APt69E3sWnZ09h8Wyy4PuEbwo1wf4d5RLrI9X6ScyYl3g7fYX4msBxPE\n\tKuFZU0uH2tsFvrFa7iGvSJknxA==",
        "X-Google-Smtp-Source": "AAOMgpfSH7+bCq2Ce24lK/EHsdTcXJV/IPFne47ziSdusGcBhfAMG+SMhTntW1XNq3sKsjiyBeKGsQ==",
        "X-Received": "by 2002:adf:f708:: with SMTP id\n\tr8-v6mr975072wrp.85.1530122911280; \n\tWed, 27 Jun 2018 11:08:31 -0700 (PDT)",
        "Date": "Wed, 27 Jun 2018 20:08:14 +0200",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>",
        "Cc": "Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,\n\tYongseok Koh <yskoh@mellanox.com>, dev@dpdk.org",
        "Message-ID": "<20180627173355.4718-4-adrien.mazarguil@6wind.com>",
        "References": "<20180627173355.4718-1-adrien.mazarguil@6wind.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "In-Reply-To": "<20180627173355.4718-1-adrien.mazarguil@6wind.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "Subject": "[dpdk-dev] [PATCH 3/6] net/mlx5: add fate actions to switch flow\n\trules",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch enables creation of rte_flow rules that direct matching traffic\nto a different port (e.g. another VF representor) or drop it directly at\nthe switch level (PORT_ID and DROP actions).\n\nTestpmd examples:\n\n- Directing all traffic to port ID 0:\n\n  flow create 1 ingress transfer pattern end actions port_id id 0 / end\n\n- Dropping all traffic normally received by port ID 1:\n\n  flow create 1 ingress transfer pattern end actions drop / end\n\nNote the presence of the transfer attribute, which requests them to be\napplied at the switch level. All traffic is matched due to empty pattern.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\n---\n drivers/net/mlx5/mlx5_nl_flow.c | 77 +++++++++++++++++++++++++++++++++++-\n 1 file changed, 75 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_nl_flow.c b/drivers/net/mlx5/mlx5_nl_flow.c\nindex 1fc62fb0a..70da85fd5 100644\n--- a/drivers/net/mlx5/mlx5_nl_flow.c\n+++ b/drivers/net/mlx5/mlx5_nl_flow.c\n@@ -10,6 +10,8 @@\n #include <linux/pkt_cls.h>\n #include <linux/pkt_sched.h>\n #include <linux/rtnetlink.h>\n+#include <linux/tc_act/tc_gact.h>\n+#include <linux/tc_act/tc_mirred.h>\n #include <stdalign.h>\n #include <stddef.h>\n #include <stdint.h>\n@@ -31,6 +33,8 @@ enum mlx5_nl_flow_trans {\n \tITEM_VOID,\n \tACTIONS,\n \tACTION_VOID,\n+\tACTION_PORT_ID,\n+\tACTION_DROP,\n \tEND,\n };\n \n@@ -39,7 +43,9 @@ enum mlx5_nl_flow_trans {\n #define PATTERN_COMMON \\\n \tITEM_VOID, ACTIONS\n #define ACTIONS_COMMON \\\n-\tACTION_VOID, END\n+\tACTION_VOID\n+#define ACTIONS_FATE \\\n+\tACTION_PORT_ID, ACTION_DROP\n \n /** Parser state transitions used by mlx5_nl_flow_transpose(). */\n static const enum mlx5_nl_flow_trans *const mlx5_nl_flow_trans[] = {\n@@ -48,8 +54,10 @@ static const enum mlx5_nl_flow_trans *const mlx5_nl_flow_trans[] = {\n \t[ATTR] = TRANS(PATTERN),\n \t[PATTERN] = TRANS(PATTERN_COMMON),\n \t[ITEM_VOID] = TRANS(BACK),\n-\t[ACTIONS] = TRANS(ACTIONS_COMMON),\n+\t[ACTIONS] = TRANS(ACTIONS_FATE, ACTIONS_COMMON),\n \t[ACTION_VOID] = TRANS(BACK),\n+\t[ACTION_PORT_ID] = TRANS(ACTION_VOID, END),\n+\t[ACTION_DROP] = TRANS(ACTION_VOID, END),\n \t[END] = NULL,\n };\n \n@@ -98,6 +106,7 @@ mlx5_nl_flow_transpose(void *buf,\n \tconst struct rte_flow_item *item;\n \tconst struct rte_flow_action *action;\n \tunsigned int n;\n+\tuint32_t act_index_cur;\n \tstruct nlattr *na_flower;\n \tstruct nlattr *na_flower_act;\n \tconst enum mlx5_nl_flow_trans *trans;\n@@ -109,14 +118,21 @@ mlx5_nl_flow_transpose(void *buf,\n \titem = pattern;\n \taction = actions;\n \tn = 0;\n+\tact_index_cur = 0;\n \tna_flower = NULL;\n \tna_flower_act = NULL;\n \ttrans = TRANS(ATTR);\n \tback = trans;\n trans:\n \tswitch (trans[n++]) {\n+\t\tunion {\n+\t\t\tconst struct rte_flow_action_port_id *port_id;\n+\t\t} conf;\n \t\tstruct nlmsghdr *nlh;\n \t\tstruct tcmsg *tcm;\n+\t\tstruct nlattr *act_index;\n+\t\tstruct nlattr *act;\n+\t\tunsigned int i;\n \n \tcase INVALID:\n \t\tif (item->type)\n@@ -207,12 +223,69 @@ mlx5_nl_flow_transpose(void *buf,\n \t\t\tmnl_attr_nest_start_check(buf, size, TCA_FLOWER_ACT);\n \t\tif (!na_flower_act)\n \t\t\tgoto error_nobufs;\n+\t\tact_index_cur = 1;\n \t\tbreak;\n \tcase ACTION_VOID:\n \t\tif (action->type != RTE_FLOW_ACTION_TYPE_VOID)\n \t\t\tgoto trans;\n \t\t++action;\n \t\tbreak;\n+\tcase ACTION_PORT_ID:\n+\t\tif (action->type != RTE_FLOW_ACTION_TYPE_PORT_ID)\n+\t\t\tgoto trans;\n+\t\tconf.port_id = action->conf;\n+\t\tif (conf.port_id->original)\n+\t\t\ti = 0;\n+\t\telse\n+\t\t\tfor (i = 0; ptoi[i].ifindex; ++i)\n+\t\t\t\tif (ptoi[i].port_id == conf.port_id->id)\n+\t\t\t\t\tbreak;\n+\t\tif (!ptoi[i].ifindex)\n+\t\t\treturn rte_flow_error_set\n+\t\t\t\t(error, ENODEV, RTE_FLOW_ERROR_TYPE_ACTION_CONF,\n+\t\t\t\t conf.port_id,\n+\t\t\t\t \"missing data to convert port ID to ifindex\");\n+\t\tact_index =\n+\t\t\tmnl_attr_nest_start_check(buf, size, act_index_cur++);\n+\t\tif (!act_index ||\n+\t\t    !mnl_attr_put_strz_check(buf, size, TCA_ACT_KIND, \"mirred\"))\n+\t\t\tgoto error_nobufs;\n+\t\tact = mnl_attr_nest_start_check(buf, size, TCA_ACT_OPTIONS);\n+\t\tif (!act)\n+\t\t\tgoto error_nobufs;\n+\t\tif (!mnl_attr_put_check(buf, size, TCA_MIRRED_PARMS,\n+\t\t\t\t\tsizeof(struct tc_mirred),\n+\t\t\t\t\t&(struct tc_mirred){\n+\t\t\t\t\t\t.action = TC_ACT_STOLEN,\n+\t\t\t\t\t\t.eaction = TCA_EGRESS_REDIR,\n+\t\t\t\t\t\t.ifindex = ptoi[i].ifindex,\n+\t\t\t\t\t}))\n+\t\t\tgoto error_nobufs;\n+\t\tmnl_attr_nest_end(buf, act);\n+\t\tmnl_attr_nest_end(buf, act_index);\n+\t\t++action;\n+\t\tbreak;\n+\tcase ACTION_DROP:\n+\t\tif (action->type != RTE_FLOW_ACTION_TYPE_DROP)\n+\t\t\tgoto trans;\n+\t\tact_index =\n+\t\t\tmnl_attr_nest_start_check(buf, size, act_index_cur++);\n+\t\tif (!act_index ||\n+\t\t    !mnl_attr_put_strz_check(buf, size, TCA_ACT_KIND, \"gact\"))\n+\t\t\tgoto error_nobufs;\n+\t\tact = mnl_attr_nest_start_check(buf, size, TCA_ACT_OPTIONS);\n+\t\tif (!act)\n+\t\t\tgoto error_nobufs;\n+\t\tif (!mnl_attr_put_check(buf, size, TCA_GACT_PARMS,\n+\t\t\t\t\tsizeof(struct tc_gact),\n+\t\t\t\t\t&(struct tc_gact){\n+\t\t\t\t\t\t.action = TC_ACT_SHOT,\n+\t\t\t\t\t}))\n+\t\t\tgoto error_nobufs;\n+\t\tmnl_attr_nest_end(buf, act);\n+\t\tmnl_attr_nest_end(buf, act_index);\n+\t\t++action;\n+\t\tbreak;\n \tcase END:\n \t\tif (item->type != RTE_FLOW_ITEM_TYPE_END ||\n \t\t    action->type != RTE_FLOW_ACTION_TYPE_END)\n",
    "prefixes": [
        "3/6"
    ]
}