Show a patch.

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

{
    "id": 465,
    "url": "https://patches.dpdk.org/api/patches/465/?format=api",
    "web_url": "https://patches.dpdk.org/patch/465/",
    "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": "<1411478047-1251-6-git-send-email-jing.d.chen@intel.com>",
    "date": "2014-09-23T13:14:06",
    "name": "[dpdk-dev,5/6] i40e: macaddr add/del enhancement",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4c18f6d65ab89336e46b7d8863000a629ff07513",
    "submitter": {
        "id": 40,
        "url": "https://patches.dpdk.org/api/people/40/?format=api",
        "name": "Chen, Jing D",
        "email": "jing.d.chen@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/465/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/465/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/465/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 1.7.4.1",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 22803B3B2;\n\tTue, 23 Sep 2014 15:12:58 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 17D1B333\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 15:12:50 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP; 23 Sep 2014 06:14:25 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga002.fm.intel.com with ESMTP; 23 Sep 2014 06:14:24 -0700",
            "from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com\n\t[10.239.29.90])\n\tby shvmail01.sh.intel.com with ESMTP id s8NDEMao012303;\n\tTue, 23 Sep 2014 21:14:22 +0800",
            "from shecgisg003.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s8NDEKpb001323; Tue, 23 Sep 2014 21:14:22 +0800",
            "(from jingche2@localhost)\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s8NDEKEB001319; \n\tTue, 23 Sep 2014 21:14:20 +0800"
        ],
        "References": "<1411478047-1251-1-git-send-email-jing.d.chen@intel.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1411478047-1251-6-git-send-email-jing.d.chen@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,580,1406617200\"; d=\"scan'208\";a=\"604019026\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "\"Chen Jing D(Mark)\" <jing.d.chen@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<1411478047-1251-1-git-send-email-jing.d.chen@intel.com>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "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>",
        "Date": "Tue, 23 Sep 2014 21:14:06 +0800",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH 5/6] i40e: macaddr add/del enhancement"
    },
    "content": "From: \"Chen Jing D(Mark)\" <jing.d.chen@intel.com>\n\nChange i40e_macaddr_add and i40e_macaddr_remove functions to support\nmultiple macaddr add/delete. In the meanwhile, support macaddr ops\non different pools.\n\nSigned-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\nAcked-by: Jingjing Wu <jingjing.wu@intel.com>\nAcked-by: Jijiang Liu <jijiang.liu@intel.com>\nAcked-by: Huawei Xie <huawei.xie@intel.com>\n---\n lib/librte_pmd_i40e/i40e_ethdev.c |   91 +++++++++++++++++-------------------\n 1 files changed, 43 insertions(+), 48 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex a267c96..3185654 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -1532,45 +1532,37 @@ i40e_priority_flow_ctrl_set(__rte_unused struct rte_eth_dev *dev,\n static void\n i40e_macaddr_add(struct rte_eth_dev *dev,\n \t\t struct ether_addr *mac_addr,\n-\t\t __attribute__((unused)) uint32_t index,\n-\t\t __attribute__((unused)) uint32_t pool)\n+\t\t __rte_unused uint32_t index,\n+\t\t uint32_t pool)\n {\n \tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct i40e_vsi *vsi = pf->main_vsi;\n-\tstruct ether_addr old_mac;\n+\tstruct i40e_vsi *vsi;\n \tint ret;\n \n-\tif (!is_valid_assigned_ether_addr(mac_addr)) {\n-\t\tPMD_DRV_LOG(ERR, \"Invalid ethernet address\");\n-\t\treturn;\n-\t}\n-\n-\tif (is_same_ether_addr(mac_addr, &(pf->dev_addr))) {\n-\t\tPMD_DRV_LOG(INFO, \"Ignore adding permanent mac address\");\n+\t/* If VMDQ not enabled or configured, return */\n+\tif (pool != 0 && (!(pf->flags | I40E_FLAG_VMDQ) || !pf->nb_cfg_vmdq_vsi)) {\n+\t\tPMD_DRV_LOG(ERR, \"VMDQ not %s, can't set mac to pool %u\\n\",\n+\t\t\tpf->flags | I40E_FLAG_VMDQ ? \"configured\" : \"enabled\",\n+\t\t\tpool);\n \t\treturn;\n \t}\n \n-\t/* Write mac address */\n-\tret = i40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_ONLY,\n-\t\t\t\t\tmac_addr->addr_bytes, NULL);\n-\tif (ret != I40E_SUCCESS) {\n-\t\tPMD_DRV_LOG(ERR, \"Failed to write mac address\");\n+\tif (pool > pf->nb_cfg_vmdq_vsi) {\n+\t\tPMD_DRV_LOG(ERR, \"Pool number %u invalid. Max pool is %u\\n\",\n+\t\t\t\tpool, pf->nb_cfg_vmdq_vsi);\n \t\treturn;\n \t}\n \n-\t(void)rte_memcpy(&old_mac, hw->mac.addr, ETHER_ADDR_LEN);\n-\t(void)rte_memcpy(hw->mac.addr, mac_addr->addr_bytes,\n-\t\t\tETHER_ADDR_LEN);\n+\tif (pool == 0)\n+\t\tvsi = pf->main_vsi;\n+\telse\n+\t\tvsi = pf->vmdq[pool - 1].vsi;\n \n \tret = i40e_vsi_add_mac(vsi, mac_addr);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_DRV_LOG(ERR, \"Failed to add MACVLAN filter\");\n+\t\tPMD_DRV_LOG(ERR, \"Failed to add MACVLAN filter\\n\");\n \t\treturn;\n \t}\n-\n-\tether_addr_copy(mac_addr, &pf->dev_addr);\n-\ti40e_vsi_delete_mac(vsi, &old_mac);\n }\n \n /* Remove a MAC address, and update filters */\n@@ -1578,36 +1570,39 @@ static void\n i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)\n {\n \tstruct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tstruct i40e_vsi *vsi = pf->main_vsi;\n-\tstruct rte_eth_dev_data *data = I40E_VSI_TO_DEV_DATA(vsi);\n+\tstruct i40e_vsi *vsi;\n+\tstruct rte_eth_dev_data *data = dev->data;\n \tstruct ether_addr *macaddr;\n \tint ret;\n-\tstruct i40e_hw *hw =\n-\t\tI40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\n-\tif (index >= vsi->max_macaddrs)\n-\t\treturn;\n+\tuint32_t i;\n+\tuint64_t pool_sel;\n \n \tmacaddr = &(data->mac_addrs[index]);\n-\tif (!is_valid_assigned_ether_addr(macaddr))\n-\t\treturn;\n-\n-\tret = i40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_ONLY,\n-\t\t\t\t\thw->mac.perm_addr, NULL);\n-\tif (ret != I40E_SUCCESS) {\n-\t\tPMD_DRV_LOG(ERR, \"Failed to write mac address\");\n-\t\treturn;\n-\t}\n-\n-\t(void)rte_memcpy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN);\n \n-\tret = i40e_vsi_delete_mac(vsi, macaddr);\n-\tif (ret != I40E_SUCCESS)\n-\t\treturn;\n+\tpool_sel = dev->data->mac_pool_sel[index];\n+\n+\tfor (i = 0; i < sizeof(pool_sel) * CHAR_BIT; i++) {\n+\t\tif (pool_sel & (1ULL << i)) {\n+\t\t\tif (i == 0)\n+\t\t\t\tvsi = pf->main_vsi;\n+\t\t\telse {\n+\t\t\t\t/* No VMDQ pool enabled or configured */\n+\t\t\t\tif (!(pf->flags | I40E_FLAG_VMDQ) ||\n+\t\t\t\t\t(i > pf->nb_cfg_vmdq_vsi)) {\n+\t\t\t\t\tPMD_DRV_LOG(ERR, \"No VMDQ pool enabled\"\n+\t\t\t\t\t\t\t\"/configured\\n\");\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n+\t\t\t\tvsi = pf->vmdq[i - 1].vsi;\n+\t\t\t}\n+\t\t\tret = i40e_vsi_delete_mac(vsi, macaddr);\n \n-\t/* Clear device address as it has been removed */\n-\tif (is_same_ether_addr(&(pf->dev_addr), macaddr))\n-\t\tmemset(&pf->dev_addr, 0, sizeof(struct ether_addr));\n+\t\t\tif (ret) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"Failed to remove MACVLAN filter\\n\");\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\t}\n }\n \n static int\n",
    "prefixes": [
        "dpdk-dev",
        "5/6"
    ]
}