Show a patch.

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

{
    "id": 368,
    "url": "https://patches.dpdk.org/api/patches/368/",
    "web_url": "https://patches.dpdk.org/patch/368/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1410503639-10753-6-git-send-email-jijiang.liu@intel.com>",
    "date": "2014-09-12T06:33:56",
    "name": "[dpdk-dev,v3,5/8] i40e:implement API of VxLAN packet filter in librte_pmd_i40e",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8437724389ea601c4b852206edd536d531d8a89d",
    "submitter": {
        "id": 52,
        "url": "https://patches.dpdk.org/api/people/52/",
        "name": "Jijiang Liu",
        "email": "jijiang.liu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/368/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/368/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/368/checks/",
    "tags": {},
    "headers": {
        "Delivered-To": "patchwork@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Original-To": "patchwork@dpdk.org",
        "Date": "Fri, 12 Sep 2014 14:33:56 +0800",
        "In-Reply-To": "<1410503639-10753-1-git-send-email-jijiang.liu@intel.com>",
        "Precedence": "list",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<1410503639-10753-1-git-send-email-jijiang.liu@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "Errors-To": "dev-bounces@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id E648668B7;\n\tFri, 12 Sep 2014 08:29:10 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id A8EA7B3AC\n\tfor <dev@dpdk.org>; Fri, 12 Sep 2014 08:29:07 +0200 (CEST)",
            "from azsmga001.ch.intel.com ([10.2.17.19])\n\tby fmsmga103.fm.intel.com with ESMTP; 11 Sep 2014 23:25:44 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby azsmga001.ch.intel.com with ESMTP; 11 Sep 2014 23:34:22 -0700",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id s8C6YEdf005986;\n\tFri, 12 Sep 2014 14:34:14 +0800",
            "from shecgisg004.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s8C6YCTm010823; Fri, 12 Sep 2014 14:34:14 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8C6YCVo010819; \n\tFri, 12 Sep 2014 14:34:12 +0800"
        ],
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-ExtLoop1": "1",
        "Message-Id": "<1410503639-10753-6-git-send-email-jijiang.liu@intel.com>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v3 5/8]i40e:implement API of VxLAN packet filter\n\tin librte_pmd_i40e",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,511,1406617200\"; d=\"scan'208\";a=\"477052411\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "The implementation of VxLAN tunnel filter in librte_pmd_i40e, which include\n - add the i40e_dev_filter_ctrl() function.\n - add the i40e_dev_tunnel_filter_set() function.\n\nSigned-off-by: Jijiang Liu <jijiang.liu@intel.com>\nAcked-by: Helin Zhang <helin.zhang@intel.com>\nAcked-by: Jingjing Wu <jingjing.wu@intel.com>\nAcked-by: Jing Chen <jing.d.chen@intel.com>\n\n---\n lib/librte_pmd_i40e/i40e_ethdev.c |  205 +++++++++++++++++++++++++++++++++++++\n 1 files changed, 205 insertions(+), 0 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex 4234073..8adf04b 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -48,6 +48,7 @@\n #include <rte_malloc.h>\n #include <rte_memcpy.h>\n #include <rte_dev.h>\n+#include <rte_eth_ctrl.h>\n \n #include \"i40e_logs.h\"\n #include \"i40e/i40e_register_x710_int.h\"\n@@ -211,7 +212,13 @@ static int i40e_dev_udp_tunnel_add(struct rte_eth_dev *dev,\n static int i40e_dev_udp_tunnel_del(struct rte_eth_dev *dev,\n \t\t\t\t   struct rte_eth_udp_tunnel *udp_tunnel,\n \t\t\t\t   uint8_t count);\n+static int i40e_dev_tunnel_filter_set(struct i40e_pf *pf,\n+\t\t\t     struct rte_eth_tunnel_filter_conf *tunnel_filter,\n+\t\t\t     uint8_t add);\n static int i40e_pf_config_vxlan(struct i40e_pf *pf);\n+static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev,\n+\t\t\t       enum rte_filter_type filter_type,\n+\t\t\t       enum rte_filter_op filter_op, void *arg);\n \n \n /* Default hash key buffer for RSS */\n@@ -266,6 +273,7 @@ static struct eth_dev_ops i40e_eth_dev_ops = {\n \t.rss_hash_conf_get            = i40e_dev_rss_hash_conf_get,\n \t.udp_tunnel_add               = i40e_dev_udp_tunnel_add,\n \t.udp_tunnel_del               = i40e_dev_udp_tunnel_del,\n+\t.filter_ctrl                  = i40e_dev_filter_ctrl,\n };\n \n static struct eth_driver rte_i40e_pmd = {\n@@ -4121,6 +4129,110 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,\n }\n \n static int\n+i40e_dev_get_filter_type(enum rte_tunnel_filter_type filter_type,\n+\t\t\tuint16_t *flag)\n+{\n+\tswitch (filter_type) {\n+\tcase RTE_TUNNEL_FILTER_IMAC_IVLAN:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN;\n+\t\tbreak;\n+\tcase RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID;\n+\t\tbreak;\n+\tcase RTE_TUNNEL_FILTER_IMAC_TENID:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID;\n+\t\tbreak;\n+\tcase RTE_TUNNEL_FILTER_OMAC_TENID_IMAC:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC;\n+\t\tbreak;\n+\tcase RTE_TUNNEL_FILTER_IMAC:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC;\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"invalid tunnel filter type\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_dev_tunnel_filter_set(struct i40e_pf *pf,\n+\t\t\tstruct rte_eth_tunnel_filter_conf *tunnel_filter,\n+\t\t\tuint8_t add)\n+{\n+\tuint16_t ip_type;\n+\tuint8_t tun_type = 0;\n+\tint ret = 0;\n+\tint val;\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tstruct i40e_vsi *vsi = pf->main_vsi;\n+\tstruct i40e_aqc_add_remove_cloud_filters_element_data  *cld_filter;\n+\tstruct i40e_aqc_add_remove_cloud_filters_element_data  *pfilter;\n+\n+\tcld_filter = rte_zmalloc(\"tunnel_filter\",\n+\t\tsizeof(struct i40e_aqc_add_remove_cloud_filters_element_data),\n+\t\t0);\n+\n+\tif (NULL == cld_filter) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to alloc memory.\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tpfilter = cld_filter;\n+\n+\t(void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac,\n+\t\t\tsizeof(struct ether_addr));\n+\t(void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac,\n+\t\t\tsizeof(struct ether_addr));\n+\n+\tpfilter->inner_vlan = tunnel_filter->inner_vlan;\n+\tif (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) {\n+\t\tip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4;\n+\t\t(void)rte_memcpy(&pfilter->ipaddr.v4.data,\n+\t\t\t\t&tunnel_filter->ip_addr,\n+\t\t\t\tsizeof(pfilter->ipaddr.v4.data));\n+\t} else {\n+\t\tip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6;\n+\t\t(void)rte_memcpy(&pfilter->ipaddr.v6.data,\n+\t\t\t\t&tunnel_filter->ip_addr,\n+\t\t\t\tsizeof(pfilter->ipaddr.v6.data));\n+\t}\n+\n+\t/* check tunnel type */\n+\tswitch (tunnel_filter->tunnel_type) {\n+\tcase RTE_TUNNEL_TYPE_VXLAN:\n+\t\ttun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN;\n+\t\tbreak;\n+\tdefault:\n+\t\t/* Other tunnel types is not supported. */\n+\t\tPMD_DRV_LOG(ERR, \"tunnel type is not supported.\\n\");\n+\t\trte_free(cld_filter);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tval = i40e_dev_get_filter_type(tunnel_filter->filter_type,\n+\t\t\t\t\t\t&pfilter->flags);\n+\tif (val < 0) {\n+\t\trte_free(cld_filter);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tpfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type |\n+\t\t(tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT);\n+\tpfilter->tenant_id = tunnel_filter->tenant_id;\n+\tpfilter->queue_number = tunnel_filter->queue_id;\n+\n+\tif (add)\n+\t\tret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter, 1);\n+\telse\n+\t\tret = i40e_aq_remove_cloud_filters(hw, vsi->seid,\n+\t\t\t\t\t\tcld_filter, 1);\n+\n+\trte_free(cld_filter);\n+\treturn ret;\n+}\n+\n+static int\n i40e_get_vxlan_port_idx(struct i40e_pf *pf, uint16_t port)\n {\n \tuint8_t i;\n@@ -4311,6 +4423,99 @@ i40e_pf_config_vxlan(struct i40e_pf *pf)\n }\n \n static int\n+i40e_tunnel_filter_param_check(struct i40e_pf *pf,\n+\t\t\tstruct rte_eth_tunnel_filter_conf *filter)\n+{\n+\tif (pf == NULL || filter == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid parameter\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (filter->queue_id >= pf->dev_data->nb_rx_queues) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid queue ID\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (filter->inner_vlan > ETHER_MAX_VLAN_ID) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid inner VLAN ID\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) &&\n+\t\t(is_zero_ether_addr(filter->outer_mac))) {\n+\t\tPMD_DRV_LOG(ERR, \"Cannot add NULL outer MAC address\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) &&\n+\t\t(is_zero_ether_addr(filter->inner_mac))) {\n+\t\tPMD_DRV_LOG(ERR, \"Cannot add NULL inner MAC address\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_tunnel_filter_handle(struct i40e_pf *pf, enum rte_filter_op filter_op,\n+\t\t\tvoid *arg)\n+{\n+\tstruct rte_eth_tunnel_filter_conf *filter;\n+\tint ret = I40E_SUCCESS;\n+\tuint8_t add = 1;\n+\n+\tfilter = (struct rte_eth_tunnel_filter_conf *)(arg);\n+\n+\tif (i40e_tunnel_filter_param_check(pf, filter) < 0)\n+\t\treturn I40E_ERR_PARAM;\n+\n+\tswitch (filter_op) {\n+\tcase RTE_ETH_FILTER_OP_NONE:\n+\t\tif (!(pf->flags & I40E_FLAG_VXLAN))\n+\t\t\tret = I40E_NOT_SUPPORTED;\n+\tcase RTE_ETH_FILTER_OP_ADD:\n+\t\tret = i40e_dev_tunnel_filter_set(pf, filter, add);\n+\t\tbreak;\n+\tcase RTE_ETH_FILTER_OP_DELETE:\n+\t\tadd = 0;\n+\t\tret = i40e_dev_tunnel_filter_set(pf, filter, add);\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"unknown operation %u\\n\", filter_op);\n+\t\tret = I40E_ERR_PARAM;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+/*\n+ * Take operations to assigned filter type on NIC.\n+ */\n+static int\n+i40e_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,\n+\t\t     enum rte_filter_op filter_op, void *arg) {\n+\n+\tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\tint ret = 0;\n+\n+\tif (arg == NULL && filter_op != RTE_ETH_FILTER_OP_NONE)\n+\t\treturn -EINVAL;\n+\n+\tswitch (filter_type) {\n+\tcase RTE_ETH_FILTER_TUNNEL:\n+\t\tret = i40e_tunnel_filter_handle(pf, filter_op, arg);\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"unsupported filter type %u\\n\", filter_type);\n+\t\tret = -EINVAL;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int\n i40e_pf_config_mq_rx(struct i40e_pf *pf)\n {\n \tif (!pf->dev_data->sriov.active) {\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "5/8"
    ]
}