Show a patch.

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

{
    "id": 150,
    "url": "https://patches.dpdk.org/api/patches/150/?format=api",
    "web_url": "https://patches.dpdk.org/patch/150/",
    "project": {
        "id": 1,
        "url": "https://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"
    },
    "msgid": "<1407813127-10991-4-git-send-email-jijiang.liu@intel.com>",
    "date": "2014-08-12T03:12:04",
    "name": "[dpdk-dev,3/6] i40e:Add VxLAN Cloud filter API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0abb59f7fc543ae6d2cfbacbac53de75f32a1bfd",
    "submitter": {
        "id": 52,
        "url": "https://patches.dpdk.org/api/people/52/?format=api",
        "name": "Jijiang Liu",
        "email": "jijiang.liu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/150/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/150/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/150/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Return-Path": "<jijiangl@shecgisg004.sh.intel.com>",
        "Message-Id": "<1407813127-10991-4-git-send-email-jijiang.liu@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "To": "dev@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-BeenThere": "dev@dpdk.org",
        "Received": [
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id DA3DBB394\n\tfor <dev@dpdk.org>; Tue, 12 Aug 2014 05:09:57 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga102.fm.intel.com with ESMTP; 11 Aug 2014 20:12:50 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 11 Aug 2014 20:12:26 -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 s7C3CPOa012544;\n\tTue, 12 Aug 2014 11:12:25 +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 s7C3CMB0011124; Tue, 12 Aug 2014 11:12:24 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s7C3CL65011120; \n\tTue, 12 Aug 2014 11:12:22 +0800"
        ],
        "Subject": "[dpdk-dev] [PATCH 3/6]i40e:Add VxLAN Cloud filter API",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "In-Reply-To": "<1407813127-10991-1-git-send-email-jijiang.liu@intel.com>",
        "X-ExtLoop1": "1",
        "Precedence": "list",
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,846,1400050800\"; d=\"scan'208\";a=\"583517034\"",
        "References": "<1407813127-10991-1-git-send-email-jijiang.liu@intel.com>",
        "X-List-Received-Date": "Tue, 12 Aug 2014 03:09:58 -0000",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Date": "Tue, 12 Aug 2014 11:12:04 +0800",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Support VxLAN cloud filters,which is used to use MAC, VLAN to point\n   to a queue. The filter types supported include below:\n   1. Inner MAC and Inner VLAN ID\n   2. Inner MAC address and inner VLAN ID, tenned ID.\n   3. Inner MAC and tenant ID\n   4. Inner MAC address\n   5. Outer MAC address, tenant ID and inner MAC\n\nSigned-off-by: jijiangl <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 lib/librte_ether/rte_ethdev.c     |   50 ++++++++++++++++\n lib/librte_ether/rte_ethdev.h     |   72 ++++++++++++++++++++++++\n lib/librte_pmd_i40e/i40e_ethdev.c |  112 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 234 insertions(+), 0 deletions(-)",
    "diff": "diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 325edb1..0e5b16d 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -1955,6 +1955,56 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,\n }\n \n int\n+rte_eth_dev_cloud_filter_set(uint8_t port_id,\n+\t\t\t struct rte_eth_cloud_filter_conf *cloud_filter,\n+\t\t\t uint8_t filter_count, uint8_t add)\n+{\n+\tuint8_t i;\n+\tstruct rte_eth_dev *dev;\n+\tstruct rte_eth_cloud_filter_conf *pfilter;\n+\n+\tif (port_id >= nb_ports) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid port_id=%d\\n\", port_id);\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tif (cloud_filter == NULL) {\n+\t\tPMD_DEBUG_TRACE(\"Invalid oud_filter parameter\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tpfilter = cloud_filter;\n+\n+\tdev = &rte_eth_devices[port_id];\n+\tfor (i = 0; i < filter_count; i++, pfilter++) {\n+\t\tif (pfilter->queue_id >= dev->data->nb_rx_queues) {\n+\t\t\tPMD_DEBUG_TRACE(\"Invalid queue number\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (pfilter->inner_vlan > ETHER_MAX_VLAN_ID) {\n+\t\t\tPMD_DEBUG_TRACE(\"Invalid inner VLAN ID\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (is_zero_ether_addr(pfilter->outer_mac)) {\n+\t\t\tPMD_DEBUG_TRACE(\"port %d: Cannot add NULL outer MAC address\\n\",\n+\t\t\t\tport_id);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (is_zero_ether_addr(pfilter->inner_mac)) {\n+\t\t\tPMD_DEBUG_TRACE(\"port %d: Cannot add NULL inner MAC address\\n\",\n+\t\t\t\tport_id);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\tFUNC_PTR_OR_ERR_RET(*dev->dev_ops->cloud_filter_set, -ENOTSUP);\n+\treturn (*dev->dev_ops->cloud_filter_set)(dev, cloud_filter,\n+\t\t\t\t\t\tfilter_count, add);\n+}\n+\n+int\n rte_eth_led_on(uint8_t port_id)\n {\n \tstruct rte_eth_dev *dev;\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex d24907f..c95bab5 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -707,6 +707,28 @@ struct rte_fdir_conf {\n \tuint8_t drop_queue;\n };\n \n+enum rte_cloud_filter_type {\n+\tRTE_CLOUD_FILTER_TYPE_NONE = 0,\n+\tRTE_CLOUD_FILTER_IMAC_IVLAN, /**< Filter by inner MAC and VLAN ID. */\n+\tRTE_CLOUD_FILTER_IMAC_IVLAN_TENID,\n+\t/**< Filter by inner MAC address and VLAN ID, tenned ID. */\n+\tRTE_CLOUD_FILTER_IMAC_TENID, /**< Filter by inner MAC and tenant ID. */\n+\tRTE_CLOUD_FILTER_IMAC, /**< Filter by inner MAC address */\n+\tRTE_CLOUD_FILTER_OMAC_TENID_IMAC,\n+\t/**< Filter by outer MAC address, tenant ID and Inner MAC */\n+\tRTE_CLOUD_FILTER_TYPE_MAX,\n+};\n+\n+#define RTE_CLOUD_FLAGS_TO_QUEUE               1\n+\n+/**\n+ *  Select IPv4 or IPv6 Cloud filters.\n+ */\n+enum rte_cloud_iptype {\n+\tRTE_CLOUD_IPTYPE_IPV4 = 0, /**< IPv4. */\n+\tRTE_CLOUD_IPTYPE_IPV6,     /**< IPv6. */\n+};\n+\n /**\n  * Tunneled type.\n  */\n@@ -720,6 +742,26 @@ enum rte_eth_tunnel_type {\n };\n \n /**\n+ * Cloud filter configuration.\n+ */\n+struct rte_eth_cloud_filter_conf {\n+\tstruct ether_addr *outer_mac;  /**< Outer MAC address fiter. */\n+\tstruct ether_addr *inner_mac;  /**< Inner MAC address fiter. */\n+\tuint16_t inner_vlan;           /**< Inner VLAN fiter. */\n+\tenum rte_cloud_iptype ip_type; /**< IP address type. */\n+\tunion {\n+\t\tuint32_t ipv4_addr;    /**< IPv4 source address to match. */\n+\t\tuint32_t ipv6_addr[4]; /**< IPv6 source address to match. */\n+\t} ip_addr; /**< IPv4/IPv6 source address to match (union of above). */\n+\n+\tuint8_t filter_type;           /**< Filter type. */\n+\tuint8_t to_queue;              /**< Use MAC and VLAN to point to a queue. */\n+\tenum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */\n+\tuint32_t tenant_id;            /** < Tenant number. */\n+\tuint16_t queue_id;             /** < queue number. */\n+};\n+\n+/**\n  * UDP tunneling configuration.\n  */\n struct rte_eth_udp_tunnel {\n@@ -1251,6 +1293,11 @@ typedef int (*eth_set_vf_rate_limit_t)(struct rte_eth_dev *dev,\n \t\t\t\tuint64_t q_msk);\n /**< @internal Set VF TX rate */\n \n+typedef int (*eth_cloud_filter_set_t)(struct rte_eth_dev *dev,\n+\t\t\t\t      struct rte_eth_cloud_filter_conf *cloud_filter,\n+\t\t\t\t      uint8_t filter_count, uint8_t add);\n+/**< @internal Set cloud filter */\n+\n typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,\n \t\t\t\t  struct rte_eth_vmdq_mirror_conf *mirror_conf,\n \t\t\t\t  uint8_t rule_id,\n@@ -1446,6 +1493,7 @@ struct eth_dev_ops {\n \teth_set_vf_vlan_filter_t   set_vf_vlan_filter;  /**< Set VF VLAN filter */\n \teth_udp_tunnel_add_t       udp_tunnel_add;\n \teth_udp_tunnel_del_t       udp_tunnel_del;\n+\teth_cloud_filter_set_t     cloud_filter_set;\n \teth_set_queue_rate_limit_t set_queue_rate_limit;   /**< Set queue rate limit */\n \teth_set_vf_rate_limit_t    set_vf_rate_limit;   /**< Set VF rate limit */\n \n@@ -3344,6 +3392,30 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,\n \t\t\tstruct rte_eth_udp_tunnel *tunnel_udp,\n \t\t\tuint8_t count);\n \n+ /**\n+ * Add Cloud filter configuration of Ethernet device\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param cloud_filter\n+ *   Where to store the current Tunneling UDP configuration\n+ *   of the Ethernet device.\n+ * @param filter_count\n+ *   How many filters are going to added.\n+ * @param add\n+ *   0: remove cloud filter\n+ *   1: add cloud filter\n+ *\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENODEV) if port identifier is invalid.\n+ *   - (-EINVAL) if bad parameter.\n+ *   - (-ENOTSUP) if hardware doesn't support tunnel type.\n+ */\n+int\n+rte_eth_dev_cloud_filter_set(uint8_t port_id,\n+\t\t\tstruct rte_eth_cloud_filter_conf *cloud_filter,\n+\t\t\tuint8_t filter_count, uint8_t add);\n /**\n  * add syn filter\n  *\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex bb3d39a..29bb931 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -209,6 +209,9 @@ 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_cloud_filter_set(struct rte_eth_dev *dev,\n+\t\t\t     struct rte_eth_cloud_filter_conf *cloud_filter,\n+\t\t\t     uint8_t filter_count, uint8_t add);\n static int i40e_pf_config_vxlan(struct i40e_pf *pf);\n \n /* Default hash key buffer for RSS */\n@@ -257,6 +260,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.cloud_filter_set             = i40e_dev_cloud_filter_set,\n };\n \n static struct eth_driver rte_i40e_pmd = {\n@@ -3948,6 +3952,114 @@ i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev,\n }\n \n static int\n+i40e_dev_get_filter_type(enum rte_cloud_filter_type filter_type, uint16_t *flag)\n+{\n+\tswitch (filter_type) {\n+\tcase RTE_CLOUD_FILTER_IMAC_IVLAN:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN;\n+\t\tbreak;\n+\tcase RTE_CLOUD_FILTER_IMAC_IVLAN_TENID:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID;\n+\t\tbreak;\n+\tcase RTE_CLOUD_FILTER_IMAC_TENID:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID;\n+\t\tbreak;\n+\tcase RTE_CLOUD_FILTER_OMAC_TENID_IMAC:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC;\n+\t\tbreak;\n+\tcase RTE_CLOUD_FILTER_IMAC:\n+\t\t*flag = I40E_AQC_ADD_CLOUD_FILTER_IMAC;\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \"invalid cloud filter type\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_dev_cloud_filter_set(struct rte_eth_dev *dev,\n+\t\t\tstruct rte_eth_cloud_filter_conf *cloud_filter,\n+\t\t\tuint8_t filter_count, uint8_t add)\n+{\n+\tuint16_t ip_type;\n+\tuint8_t i, tun_type = 0;\n+\tenum i40e_status_code ret;\n+\tint val;\n+\tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\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(\"cloud_filter\", filter_count *\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+\tfor (i = 0; i < filter_count; i++, cloud_filter++, pfilter++) {\n+\n+\t\t(void)rte_memcpy(&pfilter->outer_mac, cloud_filter->outer_mac,\n+\t\t\t\tsizeof(struct ether_addr));\n+\t\t(void)rte_memcpy(&pfilter->inner_mac, cloud_filter->inner_mac,\n+\t\t\t\tsizeof(struct ether_addr));\n+\n+\t\tpfilter->inner_vlan = cloud_filter->inner_vlan;\n+\t\tif (cloud_filter->ip_type == RTE_CLOUD_IPTYPE_IPV4) {\n+\t\t\tip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4;\n+\t\t\t(void)rte_memcpy(&pfilter->ipaddr.v4.data,\n+\t\t\t\t\t&cloud_filter->ip_addr,\n+\t\t\t\t\tsizeof(pfilter->ipaddr.v4.data));\n+\t\t} else {\n+\t\t\tip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6;\n+\t\t\t(void)rte_memcpy(&pfilter->ipaddr.v6.data,\n+\t\t\t\t\t&cloud_filter->ip_addr,\n+\t\t\t\t\tsizeof(pfilter->ipaddr.v6.data));\n+\t\t}\n+\n+\t\t/* check tunnel type */\n+\t\tswitch (cloud_filter->tunnel_type) {\n+\t\tcase RTE_TUNNEL_TYPE_VXLAN:\n+\t\t\ttun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\t/* Other tunnel types is not supported. */\n+\t\t\tPMD_DRV_LOG(ERR, \"tunnel type is not supported.\\n\");\n+\t\t\trte_free(cld_filter);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tval = i40e_dev_get_filter_type(cloud_filter->filter_type,\n+\t\t\t\t\t\t&pfilter->flags);\n+\t\tif (val < 0) {\n+\t\t\trte_free(cld_filter);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tpfilter->flags |= I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE | ip_type |\n+\t\t\t(tun_type << I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT);\n+\t\tpfilter->tenant_id = cloud_filter->tenant_id;\n+\t\tpfilter->queue_number = cloud_filter->queue_id;\n+\t}\n+\n+\tif (add)\n+\t\tret = i40e_aq_add_cloud_filters(hw, vsi->seid, cld_filter,\n+\t\t\t\t\t\tfilter_count);\n+\telse\n+\t\tret = i40e_aq_remove_cloud_filters(hw, vsi->seid, cld_filter,\n+\t\t\t\t\t\tfilter_count);\n+\trte_free(cld_filter);\n+\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",
    "prefixes": [
        "dpdk-dev",
        "3/6"
    ]
}