get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 19255,
    "url": "http://patches.dpdk.org/api/patches/19255/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1484212665-1635-15-git-send-email-wei.zhao1@intel.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": "<1484212665-1635-15-git-send-email-wei.zhao1@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1484212665-1635-15-git-send-email-wei.zhao1@intel.com",
    "date": "2017-01-12T09:17:41",
    "name": "[dpdk-dev,v5,14/18] net/ixgbe: parse L2 tunnel filter",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3a6db8d30a96546a4ba8615edb0ecd13f2e9fe44",
    "submitter": {
        "id": 495,
        "url": "http://patches.dpdk.org/api/people/495/?format=api",
        "name": "Zhao1, Wei",
        "email": "wei.zhao1@intel.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/1484212665-1635-15-git-send-email-wei.zhao1@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/19255/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/19255/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 93A83FA67;\n\tThu, 12 Jan 2017 10:22:42 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id AC8A5F96A\n\tfor <dev@dpdk.org>; Thu, 12 Jan 2017 10:22:29 +0100 (CET)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga101.fm.intel.com with ESMTP; 12 Jan 2017 01:22:29 -0800",
            "from dpdk1.bj.intel.com ([172.16.182.84])\n\tby fmsmga005.fm.intel.com with ESMTP; 12 Jan 2017 01:22:28 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.33,349,1477983600\"; d=\"scan'208\";a=\"52363360\"",
        "From": "Wei Zhao <wei.zhao1@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Wei Zhao <wei.zhao1@intel.com>,\n\tWenzhuo Lu <wenzhuo.lu@intel.com>",
        "Date": "Thu, 12 Jan 2017 17:17:41 +0800",
        "Message-Id": "<1484212665-1635-15-git-send-email-wei.zhao1@intel.com>",
        "X-Mailer": "git-send-email 2.5.5",
        "In-Reply-To": "<1484212665-1635-1-git-send-email-wei.zhao1@intel.com>",
        "References": "<1484210439-61746-1-git-send-email-wei.zhao1@intel.com>\n\t<1484212665-1635-1-git-send-email-wei.zhao1@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 14/18] net/ixgbe: parse L2 tunnel filter",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "check if the rule is a L2 tunnel rule, and get the L2 tunnel info.\n\nSigned-off-by: Wei Zhao <wei.zhao1@intel.com>\nSigned-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>\n---\n drivers/net/ixgbe/ixgbe_ethdev.c |   3 +-\n drivers/net/ixgbe/ixgbe_flow.c   | 203 +++++++++++++++++++++++++++++++++++++++\n lib/librte_ether/rte_flow.h      |  48 +++++++++\n 3 files changed, 253 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c\nindex 2a67462..14a88ee 100644\n--- a/drivers/net/ixgbe/ixgbe_ethdev.c\n+++ b/drivers/net/ixgbe/ixgbe_ethdev.c\n@@ -8089,7 +8089,8 @@ ixgbe_clear_syn_filter(struct rte_eth_dev *dev)\n }\n \n /* remove all the L2 tunnel filters */\n-int ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev)\n+int\n+ixgbe_clear_all_l2_tn_filter(struct rte_eth_dev *dev)\n {\n \tstruct ixgbe_l2_tn_info *l2_tn_info =\n \t\tIXGBE_DEV_PRIVATE_TO_L2_TN_INFO(dev->data->dev_private);\ndiff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c\nindex 317deed..6e1c0bc 100644\n--- a/drivers/net/ixgbe/ixgbe_flow.c\n+++ b/drivers/net/ixgbe/ixgbe_flow.c\n@@ -114,6 +114,19 @@ ixgbe_parse_syn_filter(const struct rte_flow_attr *attr,\n \t\t\t\tstruct rte_eth_syn_filter *filter,\n \t\t\t\tstruct rte_flow_error *error);\n static int\n+cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,\n+\t\tconst struct rte_flow_item pattern[],\n+\t\tconst struct rte_flow_action actions[],\n+\t\tstruct rte_eth_l2_tunnel_conf *filter,\n+\t\tstruct rte_flow_error *error);\n+static int\n+ixgbe_validate_l2_tn_filter(struct rte_eth_dev *dev,\n+\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\tconst struct rte_flow_item pattern[],\n+\t\t\tconst struct rte_flow_action actions[],\n+\t\t\tstruct rte_eth_l2_tunnel_conf *rule,\n+\t\t\tstruct rte_flow_error *error);\n+static int\n ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,\n \t\tconst struct rte_flow_attr *attr,\n \t\tconst struct rte_flow_item pattern[],\n@@ -1008,6 +1021,191 @@ ixgbe_parse_syn_filter(const struct rte_flow_attr *attr,\n }\n \n /**\n+ * Parse the rule to see if it is a L2 tunnel rule.\n+ * And get the L2 tunnel filter info BTW.\n+ * Only support E-tag now.\n+ */\n+static int\n+cons_parse_l2_tn_filter(const struct rte_flow_attr *attr,\n+\t\t\tconst struct rte_flow_item pattern[],\n+\t\t\tconst struct rte_flow_action actions[],\n+\t\t\tstruct rte_eth_l2_tunnel_conf *filter,\n+\t\t\tstruct rte_flow_error *error)\n+{\n+\tconst struct rte_flow_item *item;\n+\tconst struct rte_flow_item_e_tag *e_tag_spec;\n+\tconst struct rte_flow_item_e_tag *e_tag_mask;\n+\tconst struct rte_flow_action *act;\n+\tconst struct rte_flow_action_queue *act_q;\n+\tuint32_t index;\n+\n+\tif (!pattern) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM_NUM,\n+\t\t\tNULL, \"NULL pattern.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tif (!actions) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ACTION_NUM,\n+\t\t\t\t   NULL, \"NULL action.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tif (!attr) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ATTR,\n+\t\t\t\t   NULL, \"NULL attribute.\");\n+\t\treturn -rte_errno;\n+\t}\n+\t/* parse pattern */\n+\tindex = 0;\n+\n+\t/* The first not void item should be e-tag. */\n+\tNEXT_ITEM_OF_PATTERN(item, pattern, index);\n+\tif (item->type != RTE_FLOW_ITEM_TYPE_E_TAG) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\titem, \"Not supported by L2 tunnel filter\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tif (!item->spec || !item->mask) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\titem, \"Not supported by L2 tunnel filter\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/*Not supported last point for range*/\n+\tif (item->last) {\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\titem, \"Not supported last point for range\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\te_tag_spec = (const struct rte_flow_item_e_tag *)item->spec;\n+\te_tag_mask = (const struct rte_flow_item_e_tag *)item->mask;\n+\n+\t/* Only care about GRP and E cid base. */\n+\tif (e_tag_mask->epcp_edei_in_ecid_b ||\n+\t    e_tag_mask->in_ecid_e ||\n+\t    e_tag_mask->ecid_e ||\n+\t    e_tag_mask->rsvd_grp_ecid_b != rte_cpu_to_be_16(0x3FFF)) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\titem, \"Not supported by L2 tunnel filter\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tfilter->l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;\n+\t/**\n+\t * grp and e_cid_base are bit fields and only use 14 bits.\n+\t * e-tag id is taken as little endian by HW.\n+\t */\n+\tfilter->tunnel_id = rte_be_to_cpu_16(e_tag_spec->rsvd_grp_ecid_b);\n+\n+\t/* check if the next not void item is END */\n+\tindex++;\n+\tNEXT_ITEM_OF_PATTERN(item, pattern, index);\n+\tif (item->type != RTE_FLOW_ITEM_TYPE_END) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\titem, \"Not supported by L2 tunnel filter\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/* parse attr */\n+\t/* must be input direction */\n+\tif (!attr->ingress) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ATTR_INGRESS,\n+\t\t\tattr, \"Only support ingress.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/* not supported */\n+\tif (attr->egress) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ATTR_EGRESS,\n+\t\t\tattr, \"Not support egress.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/* not supported */\n+\tif (attr->priority) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,\n+\t\t\tattr, \"Not support priority.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/* parse action */\n+\tindex = 0;\n+\n+\t/* check if the first not void action is QUEUE. */\n+\tNEXT_ITEM_OF_ACTION(act, actions, index);\n+\tif (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\tact, \"Not supported action.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tact_q = (const struct rte_flow_action_queue *)act->conf;\n+\tfilter->pool = act_q->index;\n+\n+\t/* check if the next not void item is END */\n+\tindex++;\n+\tNEXT_ITEM_OF_ACTION(act, actions, index);\n+\tif (act->type != RTE_FLOW_ACTION_TYPE_END) {\n+\t\tmemset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ACTION,\n+\t\t\tact, \"Not supported action.\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+ixgbe_validate_l2_tn_filter(struct rte_eth_dev *dev,\n+\t\t\tconst struct rte_flow_attr *attr,\n+\t\t\tconst struct rte_flow_item pattern[],\n+\t\t\tconst struct rte_flow_action actions[],\n+\t\t\tstruct rte_eth_l2_tunnel_conf *l2_tn_filter,\n+\t\t\tstruct rte_flow_error *error)\n+{\n+\tint ret = 0;\n+\tstruct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\n+\tret = cons_parse_l2_tn_filter(attr, pattern,\n+\t\t\t\tactions, l2_tn_filter, error);\n+\n+\tif (hw->mac.type != ixgbe_mac_X550 &&\n+\t\thw->mac.type != ixgbe_mac_X550EM_x &&\n+\t\thw->mac.type != ixgbe_mac_X550EM_a) {\n+\t\tmemset(l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\t\trte_flow_error_set(error, EINVAL,\n+\t\t\tRTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\tNULL, \"Not supported by L2 tunnel filter\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+/**\n  * Check if the flow rule is supported by ixgbe.\n  * It only checkes the format. Don't guarantee the rule can be programmed into\n  * the HW. Because there can be no enough room for the rule.\n@@ -1022,6 +1220,7 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,\n \tstruct rte_eth_ntuple_filter ntuple_filter;\n \tstruct rte_eth_ethertype_filter ethertype_filter;\n \tstruct rte_eth_syn_filter syn_filter;\n+\tstruct rte_eth_l2_tunnel_conf l2_tn_filter;\n \tint ret;\n \n \tmemset(&ntuple_filter, 0, sizeof(struct rte_eth_ntuple_filter));\n@@ -1042,6 +1241,10 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev,\n \tif (!ret)\n \t\treturn 0;\n \n+\tmemset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));\n+\tret = ixgbe_validate_l2_tn_filter(dev, attr, pattern,\n+\t\t\t\tactions, &l2_tn_filter, error);\n+\n \treturn ret;\n }\n \ndiff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h\nindex 98084ac..7142479 100644\n--- a/lib/librte_ether/rte_flow.h\n+++ b/lib/librte_ether/rte_flow.h\n@@ -268,6 +268,20 @@ enum rte_flow_item_type {\n \t * See struct rte_flow_item_vxlan.\n \t */\n \tRTE_FLOW_ITEM_TYPE_VXLAN,\n+\n+\t/**\n+\t * Matches a E_TAG header.\n+\t *\n+\t * See struct rte_flow_item_e_tag.\n+\t */\n+\tRTE_FLOW_ITEM_TYPE_E_TAG,\n+\n+\t/**\n+\t * Matches a NVGRE header.\n+\t *\n+\t * See struct rte_flow_item_nvgre.\n+\t */\n+\tRTE_FLOW_ITEM_TYPE_NVGRE,\n };\n \n /**\n@@ -454,6 +468,40 @@ struct rte_flow_item_vxlan {\n };\n \n /**\n+ * RTE_FLOW_ITEM_TYPE_E_TAG.\n+ *\n+ * Matches a E-tag header.\n+ */\n+struct rte_flow_item_e_tag {\n+\tuint16_t tpid; /**< Tag protocol identifier (0x893F). */\n+\t/** E-Tag control information (E-TCI). */\n+\t/**< E-PCP (3b), E-DEI (1b), ingress E-CID base (12b). */\n+\tuint16_t epcp_edei_in_ecid_b;\n+\t/**< Reserved (2b), GRP (2b), E-CID base (12b). */\n+\tuint16_t rsvd_grp_ecid_b;\n+\tuint8_t in_ecid_e; /**< Ingress E-CID ext. */\n+\tuint8_t ecid_e; /**< E-CID ext. */\n+};\n+\n+/**\n+ * RTE_FLOW_ITEM_TYPE_NVGRE.\n+ *\n+ * Matches a NVGRE header.\n+ */\n+struct rte_flow_item_nvgre {\n+     /**\n+      * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),\n+      * reserved 0 (9b), version (3b).\n+      *\n+      * \\c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.\n+      */\n+\tuint16_t c_k_s_rsvd0_ver;\n+\tuint16_t protocol; /**< Protocol type (0x6558). */\n+\tuint8_t tni[3]; /**< Virtual subnet ID. */\n+\tuint8_t flow_id; /**< Flow ID. */\n+};\n+\n+/**\n  * Matching pattern item definition.\n  *\n  * A pattern is formed by stacking items starting from the lowest protocol\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "14/18"
    ]
}