get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 10971,
    "url": "https://patches.dpdk.org/api/patches/10971/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1456906110-15081-3-git-send-email-zhe.tao@intel.com/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1456906110-15081-3-git-send-email-zhe.tao@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1456906110-15081-3-git-send-email-zhe.tao@intel.com",
    "date": "2016-03-02T08:08:30",
    "name": "[dpdk-dev,2/2,v4] i40e: Add floating VEB support in i40e",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "09779842d74d6dcef616c252c44243e98fd27101",
    "submitter": {
        "id": 276,
        "url": "https://patches.dpdk.org/api/people/276/?format=api",
        "name": "Zhe Tao",
        "email": "zhe.tao@intel.com"
    },
    "delegate": {
        "id": 10,
        "url": "https://patches.dpdk.org/api/users/10/?format=api",
        "username": "bruce",
        "first_name": "Bruce",
        "last_name": "Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1456906110-15081-3-git-send-email-zhe.tao@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/10971/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/10971/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 5E7C7A250;\n\tWed,  2 Mar 2016 09:09:24 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id A25AF9AC8\n\tfor <dev@dpdk.org>; Wed,  2 Mar 2016 09:09:22 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP; 02 Mar 2016 00:09:21 -0800",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 02 Mar 2016 00:08:53 -0800",
            "from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com\n\t[10.239.29.89])\n\tby shvmail01.sh.intel.com with ESMTP id u2288prA023485;\n\tWed, 2 Mar 2016 16:08:51 +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 u2288l60015130; Wed, 2 Mar 2016 16:08:49 +0800",
            "(from zhetao@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u2288l9w015126; \n\tWed, 2 Mar 2016 16:08:47 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,527,1449561600\"; d=\"scan'208\";a=\"927735712\"",
        "From": "Zhe Tao <zhe.tao@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed,  2 Mar 2016 16:08:30 +0800",
        "Message-Id": "<1456906110-15081-3-git-send-email-zhe.tao@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1456906110-15081-1-git-send-email-zhe.tao@intel.com>",
        "References": "<1456381901-23080-1-git-send-email-zhe.tao@intel.com>\n\t<1456906110-15081-1-git-send-email-zhe.tao@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/2 v4] i40e: Add floating VEB support in i40e",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "This patch add the support for floating VEB in i40e.\nAll the VFs VSIs can decide whether to connect to the legacy VEB/VEPA or\nthe floating VEB. When connect to the floating VEB a new floating VEB is\ncreated. Now all the VFs need to connect to floating VEB or legacy VEB,\ncannot connect to both of them. The PF and VMDQ,FD VSIs still connect to\nthe old legacy VEB/VEPA.\n\nAll the VEB/VEPA concepts are not specific for FVL, they are defined in the\n802.1Qbg spec.\n\nNow the floating VEB feature is only avaiable in the specific version of FW.\n\nSigned-off-by: Zhe Tao <zhe.tao@intel.com>\n---\n doc/guides/rel_notes/release_16_04.rst |   2 +\n drivers/net/i40e/Makefile              |   2 +-\n drivers/net/i40e/i40e_ethdev.c         | 115 +++++++++++++++++++++++++++------\n drivers/net/i40e/i40e_ethdev.h         |   8 +++\n drivers/net/i40e/i40e_pf.c             |  11 +++-\n 5 files changed, 115 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst\nindex 5786f74..446112c 100644\n--- a/doc/guides/rel_notes/release_16_04.rst\n+++ b/doc/guides/rel_notes/release_16_04.rst\n@@ -46,6 +46,8 @@ This section should contain new features added in this release. Sample format:\n \n * **Added vhost-user live migration support.**\n \n+* **Added floating VEB support for FVL.**\n+\n \n Resolved Issues\n ---------------\ndiff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile\nindex 033ee4a..2e01d45 100644\n--- a/drivers/net/i40e/Makefile\n+++ b/drivers/net/i40e/Makefile\n@@ -39,7 +39,7 @@ LIB = librte_pmd_i40e.a\n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF\n CFLAGS += -DX722_SUPPORT -DX722_A0_SUPPORT\n-\n+CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common\n EXPORT_MAP := rte_pmd_i40e_version.map\n \n LIBABIVER := 1\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex ef24122..cf3c346 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -802,6 +802,13 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)\n \t\t     ((hw->nvm.version >> 4) & 0xff),\n \t\t     (hw->nvm.version & 0xf), hw->nvm.eetrack);\n \n+\t/* Need the special FW version support floating VEB */\n+\tif ((hw->aq.fw_maj_ver == FLOATING_FW_MAJ) &&\n+\t    (hw->aq.fw_min_ver == FLOATING_FW_MIN)) {\n+\t\tpf->floating = internal_config.floating;\n+\t} else {\n+\t\tpf->floating = false;\n+\t}\n \t/* Clear PXE mode */\n \ti40e_clear_pxe_mode(hw);\n \n@@ -3592,21 +3599,27 @@ i40e_veb_release(struct i40e_veb *veb)\n \tstruct i40e_vsi *vsi;\n \tstruct i40e_hw *hw;\n \n-\tif (veb == NULL || veb->associate_vsi == NULL)\n+\tif (veb == NULL)\n \t\treturn -EINVAL;\n \n \tif (!TAILQ_EMPTY(&veb->head)) {\n \t\tPMD_DRV_LOG(ERR, \"VEB still has VSI attached, can't remove\");\n \t\treturn -EACCES;\n \t}\n+\t/* associate_vsi field is NULL for floating VEB */\n+\tif (veb->associate_vsi != NULL) {\n+\t\tvsi = veb->associate_vsi;\n+\t\thw = I40E_VSI_TO_HW(vsi);\n \n-\tvsi = veb->associate_vsi;\n-\thw = I40E_VSI_TO_HW(vsi);\n+\t\tvsi->uplink_seid = veb->uplink_seid;\n+\t\tvsi->veb = NULL;\n+\t} else {\n+\t\tveb->associate_pf->main_vsi->floating_veb = NULL;\n+\t\thw = I40E_VSI_TO_HW(veb->associate_pf->main_vsi);\n+\t}\n \n-\tvsi->uplink_seid = veb->uplink_seid;\n \ti40e_aq_delete_element(hw, veb->seid, NULL);\n \trte_free(veb);\n-\tvsi->veb = NULL;\n \treturn I40E_SUCCESS;\n }\n \n@@ -3618,9 +3631,9 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi)\n \tint ret;\n \tstruct i40e_hw *hw;\n \n-\tif (NULL == pf || vsi == NULL) {\n+\tif (NULL == pf) {\n \t\tPMD_DRV_LOG(ERR, \"veb setup failed, \"\n-\t\t\t    \"associated VSI shouldn't null\");\n+\t\t\t    \"associated PF shouldn't null\");\n \t\treturn NULL;\n \t}\n \thw = I40E_PF_TO_HW(pf);\n@@ -3632,11 +3645,19 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi)\n \t}\n \n \tveb->associate_vsi = vsi;\n+\tveb->associate_pf = pf;\n \tTAILQ_INIT(&veb->head);\n-\tveb->uplink_seid = vsi->uplink_seid;\n+\tveb->uplink_seid = vsi ? vsi->uplink_seid : 0;\n \n-\tret = i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid,\n-\t\tI40E_DEFAULT_TCMAP, false, false, &veb->seid, NULL);\n+\t/* create floating veb if vsi is NULL */\n+\tif (vsi != NULL) {\n+\t\tret = i40e_aq_add_veb(hw, veb->uplink_seid, vsi->seid,\n+\t\t\t\t      I40E_DEFAULT_TCMAP, false, false,\n+\t\t\t\t      &veb->seid, NULL);\n+\t} else {\n+\t\tret = i40e_aq_add_veb(hw, 0, 0, I40E_DEFAULT_TCMAP,\n+\t\t\t\t      true, false, &veb->seid, NULL);\n+\t}\n \n \tif (ret != I40E_SUCCESS) {\n \t\tPMD_DRV_LOG(ERR, \"Add veb failed, aq_err: %d\",\n@@ -3652,10 +3673,10 @@ i40e_veb_setup(struct i40e_pf *pf, struct i40e_vsi *vsi)\n \t\t\t    hw->aq.asq_last_status);\n \t\tgoto fail;\n \t}\n-\n \t/* Get VEB bandwidth, to be implemented */\n \t/* Now associated vsi binding to the VEB, set uplink to this VEB */\n-\tvsi->uplink_seid = veb->seid;\n+\tif (vsi)\n+\t\tvsi->uplink_seid = veb->seid;\n \n \treturn veb;\n fail:\n@@ -3688,12 +3709,22 @@ i40e_vsi_release(struct i40e_vsi *vsi)\n \t\ti40e_veb_release(vsi->veb);\n \t}\n \n+\tif (vsi->floating_veb) {\n+\t\tTAILQ_FOREACH(vsi_list, &vsi->floating_veb->head, list) {\n+\t\t\tif (i40e_vsi_release(vsi_list->vsi) != I40E_SUCCESS)\n+\t\t\t\treturn -1;\n+\t\t\tTAILQ_REMOVE(&vsi->floating_veb->head, vsi_list, list);\n+\t\t}\n+\t\ti40e_veb_release(vsi->floating_veb);\n+\t}\n+\n \t/* Remove all macvlan filters of the VSI */\n \ti40e_vsi_remove_all_macvlan_filter(vsi);\n \tTAILQ_FOREACH(f, &vsi->mac_list, next)\n \t\trte_free(f);\n \n-\tif (vsi->type != I40E_VSI_MAIN) {\n+\tif (vsi->type != I40E_VSI_MAIN &&\n+\t    ((vsi->type != I40E_VSI_SRIOV) || !pf->floating)) {\n \t\t/* Remove vsi from parent's sibling list */\n \t\tif (vsi->parent_vsi == NULL || vsi->parent_vsi->veb == NULL) {\n \t\t\tPMD_DRV_LOG(ERR, \"VSI's parent VSI is NULL\");\n@@ -3707,6 +3738,23 @@ i40e_vsi_release(struct i40e_vsi *vsi)\n \t\tif (ret != I40E_SUCCESS)\n \t\t\tPMD_DRV_LOG(ERR, \"Failed to delete element\");\n \t}\n+\n+\tif ((vsi->type == I40E_VSI_SRIOV) && pf->floating) {\n+\t\t/* Remove vsi from parent's sibling list */\n+\t\tif (vsi->parent_vsi == NULL ||\n+\t\t    vsi->parent_vsi->floating_veb == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"VSI's parent VSI is NULL\");\n+\t\t\treturn I40E_ERR_PARAM;\n+\t\t}\n+\t\tTAILQ_REMOVE(&vsi->parent_vsi->floating_veb->head,\n+\t\t\t     &vsi->sib_vsi_list, list);\n+\n+\t\t/* Remove all switch element of the VSI */\n+\t\tret = i40e_aq_delete_element(hw, vsi->seid, NULL);\n+\t\tif (ret != I40E_SUCCESS)\n+\t\t\tPMD_DRV_LOG(ERR, \"Failed to delete element\");\n+\t}\n+\n \ti40e_res_pool_free(&pf->qp_pool, vsi->base_queue);\n \n \tif (vsi->type != I40E_VSI_SRIOV)\n@@ -3837,7 +3885,8 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \tstruct ether_addr broadcast =\n \t\t{.addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};\n \n-\tif (type != I40E_VSI_MAIN && uplink_vsi == NULL) {\n+\tif (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV &&\n+\t    uplink_vsi == NULL) {\n \t\tPMD_DRV_LOG(ERR, \"VSI setup failed, \"\n \t\t\t    \"VSI link shouldn't be NULL\");\n \t\treturn NULL;\n@@ -3849,11 +3898,28 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \t\treturn NULL;\n \t}\n \n-\t/* If uplink vsi didn't setup VEB, create one first */\n-\tif (type != I40E_VSI_MAIN && uplink_vsi->veb == NULL) {\n+\t/* two situations\n+\t * 1.type is not MAIN and uplink vsi is not NULL\n+\t * If uplink vsi didn't setup VEB, create one first under veb field\n+\t * 2.type is SRIOV and the uplink is NULL\n+\t * If floating VEB is NULL, create one veb under floating veb field\n+\t */\n+\n+\tif (type != I40E_VSI_MAIN && uplink_vsi != NULL &&\n+\t    uplink_vsi->veb == NULL) {\n \t\tuplink_vsi->veb = i40e_veb_setup(pf, uplink_vsi);\n \n-\t\tif (NULL == uplink_vsi->veb) {\n+\t\tif (uplink_vsi->veb == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR, \"VEB setup failed\");\n+\t\t\treturn NULL;\n+\t\t}\n+\t}\n+\n+\tif (type == I40E_VSI_SRIOV && uplink_vsi == NULL &&\n+\t    pf->main_vsi->floating_veb == NULL) {\n+\t\tpf->main_vsi->floating_veb = i40e_veb_setup(pf, uplink_vsi);\n+\n+\t\tif (pf->main_vsi->floating_veb == NULL) {\n \t\t\tPMD_DRV_LOG(ERR, \"VEB setup failed\");\n \t\t\treturn NULL;\n \t\t}\n@@ -4022,7 +4088,11 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \t\t * For other VSI, the uplink_seid equals to uplink VSI's\n \t\t * uplink_seid since they share same VEB\n \t\t */\n-\t\tvsi->uplink_seid = uplink_vsi->uplink_seid;\n+\t\tif (uplink_vsi == NULL) {\n+\t\t\tvsi->uplink_seid = pf->main_vsi->floating_veb->seid;\n+\t\t} else {\n+\t\t\tvsi->uplink_seid = uplink_vsi->uplink_seid;\n+\t\t}\n \t\tctxt.pf_num = hw->pf_id;\n \t\tctxt.vf_num = hw->func_caps.vf_base_id + user_param;\n \t\tctxt.uplink_seid = vsi->uplink_seid;\n@@ -4130,8 +4200,13 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \t\tvsi->seid = ctxt.seid;\n \t\tvsi->vsi_id = ctxt.vsi_number;\n \t\tvsi->sib_vsi_list.vsi = vsi;\n-\t\tTAILQ_INSERT_TAIL(&uplink_vsi->veb->head,\n-\t\t\t\t&vsi->sib_vsi_list, list);\n+\t\tif (vsi->type == I40E_VSI_SRIOV && uplink_vsi == NULL) {\n+\t\t\tTAILQ_INSERT_TAIL(&pf->main_vsi->floating_veb->head,\n+\t\t\t\t\t  &vsi->sib_vsi_list, list);\n+\t\t} else {\n+\t\t\tTAILQ_INSERT_TAIL(&uplink_vsi->veb->head,\n+\t\t\t\t\t  &vsi->sib_vsi_list, list);\n+\t\t}\n \t}\n \n \t/* MAC/VLAN configuration */\ndiff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h\nindex 6edd7dd..9ace7af 100644\n--- a/drivers/net/i40e/i40e_ethdev.h\n+++ b/drivers/net/i40e/i40e_ethdev.h\n@@ -36,6 +36,7 @@\n \n #include <rte_eth_ctrl.h>\n #include <rte_time.h>\n+#include <eal_internal_cfg.h>\n \n #define I40E_VLAN_TAG_SIZE        4\n \n@@ -168,6 +169,10 @@ enum i40e_flxpld_layer_idx {\n #define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32 /* 32 us */\n #define I40E_QUEUE_ITR_INTERVAL_MAX     8160 /* 8160 us */\n \n+/* Special FW support this floating VEB feature */\n+#define FLOATING_FW_MAJ 0\n+#define FLOATING_FW_MIN 0\n+\n struct i40e_adapter;\n \n /**\n@@ -203,6 +208,7 @@ struct i40e_tx_queue;\n struct i40e_veb {\n \tstruct i40e_vsi_list_head head;\n \tstruct i40e_vsi *associate_vsi; /* Associate VSI who owns the VEB */\n+\tstruct i40e_pf *associate_pf; /* Associate PF who owns the VEB */\n \tuint16_t seid; /* The seid of VEB itself */\n \tuint16_t uplink_seid; /* The uplink seid of this VEB */\n \tuint16_t stats_idx;\n@@ -254,6 +260,7 @@ struct i40e_vsi {\n \tstruct i40e_vsi_list sib_vsi_list; /* sibling vsi list */\n \tstruct i40e_vsi *parent_vsi;\n \tstruct i40e_veb *veb;    /* Associated veb, could be null */\n+\tstruct i40e_veb *floating_veb; /* Associated floating veb */\n \tbool offset_loaded;\n \tenum i40e_vsi_type type; /* VSI types */\n \tuint16_t vlan_num;       /* Total VLAN number */\n@@ -440,6 +447,7 @@ struct i40e_pf {\n \tstruct i40e_fc_conf fc_conf; /* Flow control conf */\n \tstruct i40e_mirror_rule_list mirror_list;\n \tuint16_t nb_mirror_rule;   /* The number of mirror rules */\n+\tuint16_t floating; /* The flag to use the floating VEB */\n };\n \n enum pending_msg {\ndiff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c\nindex cbf4e5b..7ce399b 100644\n--- a/drivers/net/i40e/i40e_pf.c\n+++ b/drivers/net/i40e/i40e_pf.c\n@@ -124,6 +124,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)\n {\n \tuint32_t val, i;\n \tstruct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);\n+\tstruct i40e_pf *pf = vf->pf;\n \tuint16_t vf_id, abs_vf_id, vf_msix_num;\n \tint ret;\n \tstruct i40e_virtchnl_queue_select qsel;\n@@ -223,9 +224,15 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)\n \tvf->reset_cnt++;\n \tI40E_WRITE_FLUSH(hw);\n \n+\tif (pf->floating == true) {\n+\t\tvf->vsi = i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV,\n+\t\t\tNULL, vf->vf_idx);\n+\t} else {\n \t/* Allocate resource again */\n-\tvf->vsi = i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV,\n-\t\t\tvf->pf->main_vsi, vf->vf_idx);\n+\t\tvf->vsi = i40e_vsi_setup(vf->pf, I40E_VSI_SRIOV,\n+\t\t\t\tvf->pf->main_vsi, vf->vf_idx);\n+\t}\n+\n \tif (vf->vsi == NULL) {\n \t\tPMD_DRV_LOG(ERR, \"Add vsi failed\");\n \t\treturn -EFAULT;\n",
    "prefixes": [
        "dpdk-dev",
        "2/2",
        "v4"
    ]
}