get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43909,
    "url": "http://patches.dpdk.org/api/patches/43909/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/56069ef9ffabda908dc4ec74b2c070e8daed5d49.1535292771.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": "<56069ef9ffabda908dc4ec74b2c070e8daed5d49.1535292771.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/56069ef9ffabda908dc4ec74b2c070e8daed5d49.1535292771.git.rahul.lakkireddy@chelsio.com",
    "date": "2018-08-27T12:52:30",
    "name": "[2/4] net/cxgbe: add flow operations to offload vlan actions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fd3e29ef64ef3dfd3461fedc32bf5e3eea7247ae",
    "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/56069ef9ffabda908dc4ec74b2c070e8daed5d49.1535292771.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [
        {
            "id": 1068,
            "url": "http://patches.dpdk.org/api/series/1068/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1068",
            "date": "2018-08-27T12:52:28",
            "name": "net/cxgbe: add destination MAC match and VLAN rewrite support for flow API",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1068/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43909/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43909/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 3A3A15B40;\n\tMon, 27 Aug 2018 14:52:58 +0200 (CEST)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id DA2FD5B36\n\tfor <dev@dpdk.org>; Mon, 27 Aug 2018 14:52:56 +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 w7RCqr4j027067; \n\tMon, 27 Aug 2018 05:52:54 -0700"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "shaguna@chelsio.com, indranil@chelsio.com, nirranjan@chelsio.com",
        "Date": "Mon, 27 Aug 2018 18:22:30 +0530",
        "Message-Id": "<56069ef9ffabda908dc4ec74b2c070e8daed5d49.1535292771.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1535292771.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1535292771.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1535292771.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1535292771.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 2/4] net/cxgbe: add flow operations to offload\n\tvlan actions",
        "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 flow API operations to offload vlan push, pop, and rewrite actions.\nFor vlan push or rewrite actions, allocate and program an entry from\nL2T table. Use the L2T index to program vlan actions for LETCAM\n(maskfull) and HASH (maskless) filters.\n\nSigned-off-by: Shagun Agrawal <shaguna@chelsio.com>\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n doc/guides/rel_notes/release_18_11.rst |  6 ++++\n drivers/net/cxgbe/base/t4_msg.h        |  6 ++++\n drivers/net/cxgbe/base/t4_tcb.h        |  5 +++\n drivers/net/cxgbe/cxgbe_filter.c       | 62 ++++++++++++++++++++++++++++++++--\n drivers/net/cxgbe/cxgbe_filter.h       |  9 +++++\n drivers/net/cxgbe/cxgbe_flow.c         | 24 +++++++++++++\n 6 files changed, 109 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst\nindex 3ae6b3f58..db99518f4 100644\n--- a/doc/guides/rel_notes/release_18_11.rst\n+++ b/doc/guides/rel_notes/release_18_11.rst\n@@ -54,6 +54,12 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =========================================================\n \n+* **Add support to offload more flow match and actions for CXGBE PMD**\n+\n+  Flow API support has been enhanced for CXGBE Poll Mode Driver to offload:\n+\n+  * Action items: push/pop/rewrite vlan header.\n+\n \n API Changes\n -----------\ndiff --git a/drivers/net/cxgbe/base/t4_msg.h b/drivers/net/cxgbe/base/t4_msg.h\nindex 094a153f2..2128da64f 100644\n--- a/drivers/net/cxgbe/base/t4_msg.h\n+++ b/drivers/net/cxgbe/base/t4_msg.h\n@@ -138,6 +138,12 @@ struct work_request_hdr {\n #define V_TCAM_BYPASS(x) ((__u64)(x) << S_TCAM_BYPASS)\n #define F_TCAM_BYPASS    V_TCAM_BYPASS(1ULL)\n \n+#define S_L2T_IDX    36\n+#define V_L2T_IDX(x) ((__u64)(x) << S_L2T_IDX)\n+\n+#define S_NAGLE    49\n+#define V_NAGLE(x) ((__u64)(x) << S_NAGLE)\n+\n /* option 2 fields */\n #define S_RSS_QUEUE    0\n #define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)\ndiff --git a/drivers/net/cxgbe/base/t4_tcb.h b/drivers/net/cxgbe/base/t4_tcb.h\nindex 25435f9f4..68cda7730 100644\n--- a/drivers/net/cxgbe/base/t4_tcb.h\n+++ b/drivers/net/cxgbe/base/t4_tcb.h\n@@ -6,6 +6,9 @@\n #ifndef _T4_TCB_DEFS_H\n #define _T4_TCB_DEFS_H\n \n+/* 95:32 */\n+#define W_TCB_T_FLAGS    1\n+\n /* 105:96 */\n #define W_TCB_RSS_INFO    3\n #define S_TCB_RSS_INFO    0\n@@ -23,4 +26,6 @@\n #define M_TCB_T_RTT_TS_RECENT_AGE    0xffffffffULL\n #define V_TCB_T_RTT_TS_RECENT_AGE(x) ((x) << S_TCB_T_RTT_TS_RECENT_AGE)\n \n+#define S_TF_CCTRL_RFR    62\n+\n #endif /* _T4_TCB_DEFS_H */\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c\nindex 7f0d38001..4d3f3ebee 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.c\n+++ b/drivers/net/cxgbe/cxgbe_filter.c\n@@ -8,6 +8,7 @@\n #include \"t4_regs.h\"\n #include \"cxgbe_filter.h\"\n #include \"clip_tbl.h\"\n+#include \"l2t.h\"\n \n /**\n  * Initialize Hash Filters\n@@ -164,6 +165,16 @@ static void set_tcb_field(struct adapter *adapter, unsigned int ftid,\n \tt4_mgmt_tx(ctrlq, mbuf);\n }\n \n+/**\n+ * Set one of the t_flags bits in the TCB.\n+ */\n+static void set_tcb_tflag(struct adapter *adap, unsigned int ftid,\n+\t\t\t  unsigned int bit_pos, unsigned int val, int no_reply)\n+{\n+\tset_tcb_field(adap, ftid,  W_TCB_T_FLAGS, 1ULL << bit_pos,\n+\t\t      (unsigned long long)val << bit_pos, no_reply);\n+}\n+\n /**\n  * Build a CPL_SET_TCB_FIELD message as payload of a ULP_TX_PKT command.\n  */\n@@ -425,7 +436,10 @@ static void mk_act_open_req6(struct filter_entry *f, struct rte_mbuf *mbuf,\n \treq->local_ip_lo = local_lo;\n \treq->peer_ip_hi = peer_hi;\n \treq->peer_ip_lo = peer_lo;\n-\treq->opt0 = cpu_to_be64(V_DELACK(f->fs.hitcnts) |\n+\treq->opt0 = cpu_to_be64(V_NAGLE(f->fs.newvlan == VLAN_REMOVE ||\n+\t\t\t\t\tf->fs.newvlan == VLAN_REWRITE) |\n+\t\t\t\tV_DELACK(f->fs.hitcnts) |\n+\t\t\t\tV_L2T_IDX(f->l2t ? f->l2t->idx : 0) |\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@@ -468,7 +482,10 @@ static void mk_act_open_req(struct filter_entry *f, struct rte_mbuf *mbuf,\n \t\t\tf->fs.val.lip[2] << 16 | f->fs.val.lip[3] << 24;\n \treq->peer_ip = f->fs.val.fip[0] | f->fs.val.fip[1] << 8 |\n \t\t\tf->fs.val.fip[2] << 16 | f->fs.val.fip[3] << 24;\n-\treq->opt0 = cpu_to_be64(V_DELACK(f->fs.hitcnts) |\n+\treq->opt0 = cpu_to_be64(V_NAGLE(f->fs.newvlan == VLAN_REMOVE ||\n+\t\t\t\t\tf->fs.newvlan == VLAN_REWRITE) |\n+\t\t\t\tV_DELACK(f->fs.hitcnts) |\n+\t\t\t\tV_L2T_IDX(f->l2t ? f->l2t->idx : 0) |\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@@ -518,6 +535,22 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,\n \tf->dev = dev;\n \tf->fs.iq = iq;\n \n+\t/*\n+\t * If the new filter requires loopback Destination MAC and/or VLAN\n+\t * rewriting then we need to allocate a Layer 2 Table (L2T) entry for\n+\t * the filter.\n+\t */\n+\tif (f->fs.newvlan == VLAN_INSERT ||\n+\t    f->fs.newvlan == VLAN_REWRITE) {\n+\t\t/* allocate L2T entry for new filter */\n+\t\tf->l2t = cxgbe_l2t_alloc_switching(dev, f->fs.vlan,\n+\t\t\t\t\t\t   f->fs.eport, f->fs.dmac);\n+\t\tif (!f->l2t) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto out_err;\n+\t\t}\n+\t}\n+\n \tatid = cxgbe_alloc_atid(t, f);\n \tif (atid < 0)\n \t\tgoto out_err;\n@@ -653,6 +686,19 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)\n \tunsigned int port_id = ethdev2pinfo(dev)->port_id;\n \tint ret;\n \n+\t/*\n+\t * If the new filter requires loopback Destination MAC and/or VLAN\n+\t * rewriting then we need to allocate a Layer 2 Table (L2T) entry for\n+\t * the filter.\n+\t */\n+\tif (f->fs.newvlan) {\n+\t\t/* allocate L2T entry for new filter */\n+\t\tf->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan,\n+\t\t\t\t\t\t   f->fs.eport, f->fs.dmac);\n+\t\tif (!f->l2t)\n+\t\t\treturn -ENOMEM;\n+\t}\n+\n \tctrlq = &adapter->sge.ctrlq[port_id];\n \tmbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);\n \tif (!mbuf) {\n@@ -680,9 +726,16 @@ int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)\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_INSVLAN\n+\t\t\t\t(f->fs.newvlan == VLAN_INSERT ||\n+\t\t\t\t f->fs.newvlan == VLAN_REWRITE) |\n+\t\t\t    V_FW_FILTER_WR_RMVLAN\n+\t\t\t\t(f->fs.newvlan == VLAN_REMOVE ||\n+\t\t\t\t f->fs.newvlan == VLAN_REWRITE) |\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+\t\t\t    V_FW_FILTER_WR_PRIO(f->fs.prio) |\n+\t\t\t    V_FW_FILTER_WR_L2TIX(f->l2t ? f->l2t->idx : 0));\n \tfwr->ethtype = cpu_to_be16(f->fs.val.ethtype);\n \tfwr->ethtypem = cpu_to_be16(f->fs.mask.ethtype);\n \tfwr->smac_sel = 0;\n@@ -1046,6 +1099,9 @@ void hash_filter_rpl(struct adapter *adap, const struct cpl_act_open_rpl *rpl)\n \t\t\t\t      V_TCB_TIMESTAMP(0ULL) |\n \t\t\t\t      V_TCB_T_RTT_TS_RECENT_AGE(0ULL),\n \t\t\t\t      1);\n+\t\tif (f->fs.newvlan == VLAN_INSERT ||\n+\t\t    f->fs.newvlan == VLAN_REWRITE)\n+\t\t\tset_tcb_tflag(adap, tid, S_TF_CCTRL_RFR, 1, 1);\n \t\tbreak;\n \t}\n \tdefault:\ndiff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h\nindex be12e231a..c7d9366a6 100644\n--- a/drivers/net/cxgbe/cxgbe_filter.h\n+++ b/drivers/net/cxgbe/cxgbe_filter.h\n@@ -99,6 +99,9 @@ struct ch_filter_specification {\n \tuint32_t iq:10;\t\t/* ingress queue */\n \n \tuint32_t eport:2;\t/* egress port to switch packet out */\n+\tuint32_t newvlan:2;     /* rewrite VLAN Tag */\n+\tuint8_t dmac[ETHER_ADDR_LEN];   /* new destination MAC address */\n+\tuint16_t vlan;          /* VLAN Tag to insert */\n \n \t/* Filter rule value/mask pairs. */\n \tstruct ch_filter_tuple val;\n@@ -111,6 +114,12 @@ enum {\n \tFILTER_SWITCH\n };\n \n+enum {\n+\tVLAN_REMOVE = 1,\n+\tVLAN_INSERT,\n+\tVLAN_REWRITE\n+};\n+\n enum filter_type {\n \tFILTER_TYPE_IPV4 = 0,\n \tFILTER_TYPE_IPV6,\ndiff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c\nindex 01c945f1b..89fc68cf0 100644\n--- a/drivers/net/cxgbe/cxgbe_flow.c\n+++ b/drivers/net/cxgbe/cxgbe_flow.c\n@@ -331,9 +331,30 @@ 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_of_set_vlan_vid *vlanid;\n+\tconst struct rte_flow_action_of_push_vlan *pushvlan;\n \tconst struct rte_flow_action_phy_port *port;\n \n \tswitch (a->type) {\n+\tcase RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:\n+\t\tvlanid = (const struct rte_flow_action_of_set_vlan_vid *)\n+\t\t\t  a->conf;\n+\t\tfs->newvlan = VLAN_REWRITE;\n+\t\tfs->vlan = vlanid->vlan_vid;\n+\t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:\n+\t\tpushvlan = (const struct rte_flow_action_of_push_vlan *)\n+\t\t\t    a->conf;\n+\t\tif (pushvlan->ethertype != ETHER_TYPE_VLAN)\n+\t\t\treturn rte_flow_error_set(e, EINVAL,\n+\t\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_ACTION, a,\n+\t\t\t\t\t\t  \"only ethertype 0x8100 \"\n+\t\t\t\t\t\t  \"supported for push vlan.\");\n+\t\tfs->newvlan = VLAN_INSERT;\n+\t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:\n+\t\tfs->newvlan = VLAN_REMOVE;\n+\t\tbreak;\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@@ -391,6 +412,9 @@ 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_OF_SET_VLAN_VID:\n+\t\tcase RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:\n+\t\tcase RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:\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",
    "prefixes": [
        "2/4"
    ]
}