get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41996,
    "url": "http://patches.dpdk.org/api/patches/41996/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1f5c5539f1c9fbe3e7b8df4e7d0806a405b63911.1530295732.git.rahul.lakkireddy@chelsio.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": "<1f5c5539f1c9fbe3e7b8df4e7d0806a405b63911.1530295732.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1f5c5539f1c9fbe3e7b8df4e7d0806a405b63911.1530295732.git.rahul.lakkireddy@chelsio.com",
    "date": "2018-06-29T18:12:24",
    "name": "[9/9] net/cxgbe: add support to redirect packets to egress physical port",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "367e7d8bc27b1a3f9fd261553adc5daa4b95b4cc",
    "submitter": {
        "id": 241,
        "url": "http://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1f5c5539f1c9fbe3e7b8df4e7d0806a405b63911.1530295732.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 331,
            "url": "http://patches.dpdk.org/api/series/331/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=331",
            "date": "2018-06-29T18:12:15",
            "name": "net/cxgbe: add support for offloading flows to HASH region",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/331/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41996/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/41996/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 5177B1BB1C;\n\tFri, 29 Jun 2018 20:14:03 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id 20FB21BB09\n\tfor <dev@dpdk.org>; Fri, 29 Jun 2018 20:13:58 +0200 (CEST)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w5TIDt5P028638; \n\tFri, 29 Jun 2018 11:13:55 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "shaguna@chelsio.com, indranil@chelsio.com, nirranjan@chelsio.com",
        "Date": "Fri, 29 Jun 2018 23:42:24 +0530",
        "Message-Id": "<1f5c5539f1c9fbe3e7b8df4e7d0806a405b63911.1530295732.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1530295732.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1530295732.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1530295732.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1530295732.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 9/9] net/cxgbe: add support to redirect packets\n\tto egress physical port",
        "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": "From: Shagun Agrawal <shaguna@chelsio.com>\n\nAdd action to redirect matched packets to specified egress physical\nport without sending them to host.\n\nSigned-off-by: Shagun Agrawal <shaguna@chelsio.com>\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n drivers/net/cxgbe/base/t4_msg.h  |  6 ++++++\n drivers/net/cxgbe/cxgbe_filter.c | 19 +++++++++++++++++--\n drivers/net/cxgbe/cxgbe_filter.h |  5 ++++-\n drivers/net/cxgbe/cxgbe_flow.c   | 36 ++++++++++++++++++++++++++++++++++++\n 4 files changed, 63 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/cxgbe/base/t4_msg.h b/drivers/net/cxgbe/base/t4_msg.h\nindex 7f4c98fb6..5d433c91c 100644\n--- a/drivers/net/cxgbe/base/t4_msg.h\n+++ b/drivers/net/cxgbe/base/t4_msg.h\n@@ -113,6 +113,9 @@ struct work_request_hdr {\n #define G_COOKIE(x) (((x) >> S_COOKIE) & M_COOKIE)\n \n /* option 0 fields */\n+#define S_TX_CHAN    2\n+#define V_TX_CHAN(x) ((x) << S_TX_CHAN)\n+\n #define S_DELACK    5\n #define V_DELACK(x) ((x) << S_DELACK)\n \n@@ -145,6 +148,9 @@ struct work_request_hdr {\n #define V_RX_CHANNEL(x) ((x) << S_RX_CHANNEL)\n #define F_RX_CHANNEL    V_RX_CHANNEL(1U)\n \n+#define S_CCTRL_ECN    27\n+#define V_CCTRL_ECN(x) ((x) << S_CCTRL_ECN)\n+\n #define S_T5_OPT_2_VALID    31\n #define V_T5_OPT_2_VALID(x) ((x) << S_T5_OPT_2_VALID)\n #define F_T5_OPT_2_VALID    V_T5_OPT_2_VALID(1U)\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c\nindex 8c5890ea8..7f0d38001 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.c\n+++ b/drivers/net/cxgbe/cxgbe_filter.c\n@@ -71,6 +71,15 @@ int validate_filter(struct adapter *adapter, struct ch_filter_specification *fs)\n #undef S\n #undef U\n \n+\t/*\n+\t * If the user is requesting that the filter action loop\n+\t * matching packets back out one of our ports, make sure that\n+\t * the egress port is in range.\n+\t */\n+\tif (fs->action == FILTER_SWITCH &&\n+\t    fs->eport >= adapter->params.nports)\n+\t\treturn -ERANGE;\n+\n \t/*\n \t * Don't allow various trivially obvious bogus out-of-range\n \t * values ...\n@@ -419,6 +428,7 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf,\n \treq->opt0 = cpu_to_be64(V_DELACK(f->fs.hitcnts) |\n \t\t\t\tV_SMAC_SEL((cxgbe_port_viid(f->dev) & 0x7F)\n \t\t\t\t\t   << 1) |\n+\t\t\t\tV_TX_CHAN(f->fs.eport) |\n \t\t\t\tV_ULP_MODE(ULP_MODE_NONE) |\n \t\t\t\tF_TCAM_BYPASS | F_NON_OFFLOAD);\n \treq->params = cpu_to_be64(V_FILTER_TUPLE(hash_filter_ntuple(f)));\n@@ -427,7 +437,8 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf,\n \t\t\t    F_T5_OPT_2_VALID |\n \t\t\t    F_RX_CHANNEL |\n \t\t\t    V_CONG_CNTRL((f->fs.action == FILTER_DROP) |\n-\t\t\t\t\t (f->fs.dirsteer << 1)));\n+\t\t\t\t\t (f->fs.dirsteer << 1)) |\n+\t\t\t    V_CCTRL_ECN(f->fs.action == FILTER_SWITCH));\n }\n \n /**\n@@ -460,6 +471,7 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf,\n \treq->opt0 = cpu_to_be64(V_DELACK(f->fs.hitcnts) |\n \t\t\t\tV_SMAC_SEL((cxgbe_port_viid(f->dev) & 0x7F)\n \t\t\t\t\t   << 1) |\n+\t\t\t\tV_TX_CHAN(f->fs.eport) |\n \t\t\t\tV_ULP_MODE(ULP_MODE_NONE) |\n \t\t\t\tF_TCAM_BYPASS | F_NON_OFFLOAD);\n \treq->params = cpu_to_be64(V_FILTER_TUPLE(hash_filter_ntuple(f)));\n@@ -468,7 +480,8 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf,\n \t\t\t    F_T5_OPT_2_VALID |\n \t\t\t    F_RX_CHANNEL |\n \t\t\t    V_CONG_CNTRL((f->fs.action == FILTER_DROP) |\n-\t\t\t\t\t (f->fs.dirsteer << 1)));\n+\t\t\t\t\t (f->fs.dirsteer << 1)) |\n+\t\t\t    V_CCTRL_ECN(f->fs.action == FILTER_SWITCH));\n }\n \n /**\n@@ -666,7 +679,9 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)\n \tfwr->del_filter_to_l2tix =\n \t\tcpu_to_be32(V_FW_FILTER_WR_DROP(f->fs.action == FILTER_DROP) |\n \t\t\t    V_FW_FILTER_WR_DIRSTEER(f->fs.dirsteer) |\n+\t\t\t    V_FW_FILTER_WR_LPBK(f->fs.action == FILTER_SWITCH) |\n \t\t\t    V_FW_FILTER_WR_HITCNTS(f->fs.hitcnts) |\n+\t\t\t    V_FW_FILTER_WR_TXCHAN(f->fs.eport) |\n \t\t\t    V_FW_FILTER_WR_PRIO(f->fs.prio));\n \tfwr->ethtype = cpu_to_be16(f->fs.val.ethtype);\n \tfwr->ethtypem = cpu_to_be16(f->fs.mask.ethtype);\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h\nindex fac1f75f9..af8fa7529 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.h\n+++ b/drivers/net/cxgbe/cxgbe_filter.h\n@@ -98,6 +98,8 @@ struct ch_filter_specification {\n \tuint32_t dirsteer:1;\t/* 0 => RSS, 1 => steer to iq */\n \tuint32_t iq:10;\t\t/* ingress queue */\n \n+\tuint32_t eport:2;\t/* egress port to switch packet out */\n+\n \t/* Filter rule value/mask pairs. */\n \tstruct ch_filter_tuple val;\n \tstruct ch_filter_tuple mask;\n@@ -105,7 +107,8 @@ struct ch_filter_specification {\n \n enum {\n \tFILTER_PASS = 0,\t/* default */\n-\tFILTER_DROP\n+\tFILTER_DROP,\n+\tFILTER_SWITCH\n };\n \n enum filter_type {\ndiff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c\nindex 823bc720c..01c945f1b 100644\n--- a/drivers/net/cxgbe/cxgbe_flow.c\n+++ b/drivers/net/cxgbe/cxgbe_flow.c\n@@ -326,6 +326,28 @@ static int cxgbe_get_fidx(struct rte_flow *flow, unsigned int *fidx)\n \treturn 0;\n }\n \n+static int\n+ch_rte_parse_atype_switch(const struct rte_flow_action *a,\n+\t\t\t  struct ch_filter_specification *fs,\n+\t\t\t  struct rte_flow_error *e)\n+{\n+\tconst struct rte_flow_action_phy_port *port;\n+\n+\tswitch (a->type) {\n+\tcase RTE_FLOW_ACTION_TYPE_PHY_PORT:\n+\t\tport = (const struct rte_flow_action_phy_port *)a->conf;\n+\t\tfs->eport = port->index;\n+\t\tbreak;\n+\tdefault:\n+\t\t/* We are not supposed to come here */\n+\t\treturn rte_flow_error_set(e, EINVAL,\n+\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, a,\n+\t\t\t\t\t  \"Action not supported\");\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n cxgbe_rtef_parse_actions(struct rte_flow *flow,\n \t\t\t const struct rte_flow_action action[],\n@@ -335,6 +357,7 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,\n \tconst struct rte_flow_action_queue *q;\n \tconst struct rte_flow_action *a;\n \tchar abit = 0;\n+\tint ret;\n \n \tfor (a = action; a->type != RTE_FLOW_ACTION_TYPE_END; a++) {\n \t\tswitch (a->type) {\n@@ -368,6 +391,19 @@ cxgbe_rtef_parse_actions(struct rte_flow *flow,\n \t\tcase RTE_FLOW_ACTION_TYPE_COUNT:\n \t\t\tfs->hitcnts = 1;\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_PHY_PORT:\n+\t\t\t/* We allow multiple switch actions, but switch is\n+\t\t\t * not compatible with either queue or drop\n+\t\t\t */\n+\t\t\tif (abit++ && fs->action != FILTER_SWITCH)\n+\t\t\t\treturn rte_flow_error_set(e, EINVAL,\n+\t\t\t\t\t\tRTE_FLOW_ERROR_TYPE_ACTION, a,\n+\t\t\t\t\t\t\"overlapping action specified\");\n+\t\t\tret = ch_rte_parse_atype_switch(a, fs, e);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t\tfs->action = FILTER_SWITCH;\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\t/* Not supported action : return error */\n \t\t\treturn rte_flow_error_set(e, ENOTSUP,\n",
    "prefixes": [
        "9/9"
    ]
}