Show a patch.

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

{
    "id": 452,
    "url": "https://patches.dpdk.org/api/patches/452/?format=api",
    "web_url": "https://patches.dpdk.org/patch/452/",
    "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": "<1411442991-15386-5-git-send-email-jijiang.liu@intel.com>",
    "date": "2014-09-23T03:29:50",
    "name": "[dpdk-dev,4/5] i40e:add VF MACVLAN filter implementation in librte_pmd_i40e",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5919aaef3cc32e7b469f94defb4030b16b5b13c6",
    "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/452/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/452/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/452/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Message-Id": "<1411442991-15386-5-git-send-email-jijiang.liu@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "To": "dev@dpdk.org",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 66400B39F;\n\tTue, 23 Sep 2014 05:24:12 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 7EEBEB3AD\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 05:24:06 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 22 Sep 2014 20:21:03 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 22 Sep 2014 20:30:06 -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 s8N3U4k8010976;\n\tTue, 23 Sep 2014 11:30:04 +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 s8N3U2Xq015483; Tue, 23 Sep 2014 11:30:04 +0800",
            "(from jijiangl@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8N3U1Nm015479; \n\tTue, 23 Sep 2014 11:30:01 +0800"
        ],
        "X-BeenThere": "dev@dpdk.org",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Subject": "[dpdk-dev] [PATCH 4/5]i40e:add VF MACVLAN filter implementation in\n\tlibrte_pmd_i40e",
        "In-Reply-To": "<1411442991-15386-1-git-send-email-jijiang.liu@intel.com>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Date": "Tue, 23 Sep 2014 11:29:50 +0800",
        "X-ExtLoop1": "1",
        "Precedence": "list",
        "From": "Jijiang Liu <jijiang.liu@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.04,577,1406617200\"; d=\"scan'208\";a=\"595345776\"",
        "References": "<1411442991-15386-1-git-send-email-jijiang.liu@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Add i40e_vf_mac_filter_set() function to support perfect match and hash match filter of MAC address and VLAN ID for a VF.\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: Changchun Ouyang <changchun.ouyang@intel.com>\n\n---\n lib/librte_pmd_i40e/i40e_ethdev.c |  117 ++++++++++++++++++++++++++++++++++++-\n 1 files changed, 114 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex bdab17c..66ad3bb 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -1591,6 +1591,118 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)\n \t\tmemset(&pf->dev_addr, 0, sizeof(struct ether_addr));\n }\n \n+/* Set perfect match or hash match of MAC and VLAN for a VF */\n+static int\n+i40e_vf_mac_filter_set(struct i40e_pf *pf,\n+\t\t struct rte_eth_mac_filter *filter,\n+\t\t bool add)\n+{\n+\tstruct i40e_hw *hw;\n+\tstruct i40e_mac_filter_info mac_filter;\n+\tstruct ether_addr old_mac;\n+\tstruct ether_addr *new_mac;\n+\tstruct i40e_pf_vf *vf = NULL;\n+\tuint16_t vf_id;\n+\tint ret;\n+\n+\tif (pf == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid PF argument\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\thw = I40E_PF_TO_HW(pf);\n+\n+\tif (filter == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid mac filter argument\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tnew_mac = &filter->mac_addr;\n+\n+\tif (is_zero_ether_addr(new_mac)) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid ethernet address\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvf_id = filter->id;\n+\n+\tif (vf_id > pf->vf_num - 1 || !pf->vfs) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid argument\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tvf = &pf->vfs[vf_id];\n+\n+\tif (add && is_same_ether_addr(new_mac, &(pf->dev_addr))) {\n+\t\tPMD_DRV_LOG(INFO, \"Ignore adding permanent MAC address\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (add) {\n+\t\t(void)rte_memcpy(&old_mac, hw->mac.addr, ETHER_ADDR_LEN);\n+\t\t(void)rte_memcpy(hw->mac.addr, new_mac->addr_bytes,\n+\t\t\t\tETHER_ADDR_LEN);\n+\t\t(void)rte_memcpy(&mac_filter.mac_addr, &filter->mac_addr,\n+\t\t\t\t ETHER_ADDR_LEN);\n+\n+\t\tmac_filter.filter_type = filter->filter_type;\n+\t\tmac_filter.queue_id = filter->queue_id;\n+\t\tret = i40e_vsi_add_mac(vf->vsi, &mac_filter);\n+\t\tif (ret != I40E_SUCCESS) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Failed to add MAC filter\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tether_addr_copy(new_mac, &pf->dev_addr);\n+\t} else {\n+\t\t(void)rte_memcpy(hw->mac.addr, hw->mac.perm_addr,\n+\t\t\t\tETHER_ADDR_LEN);\n+\t\tret = i40e_vsi_delete_mac(vf->vsi, &filter->mac_addr);\n+\t\tif (ret != I40E_SUCCESS) {\n+\t\t\tPMD_DRV_LOG(ERR, \"Failed to delete MAC filter\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/* Clear device address as it has been removed */\n+\t\tif (is_same_ether_addr(&(pf->dev_addr), new_mac))\n+\t\t\tmemset(&pf->dev_addr, 0, sizeof(struct ether_addr));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_mac_filter_handle(struct i40e_pf *pf, enum rte_filter_op filter_op,\n+\t\tvoid *arg)\n+{\n+\tstruct rte_eth_mac_filter *filter;\n+\tstruct i40e_hw *hw = I40E_PF_TO_HW(pf);\n+\tint ret = I40E_NOT_SUPPORTED;\n+\n+\tfilter = (struct rte_eth_mac_filter *)(arg);\n+\n+\tswitch (filter_op) {\n+\tcase RTE_ETH_FILTER_OP_NONE:\n+\t\tret = I40E_SUCCESS;\n+\t\tbreak;\n+\tcase RTE_ETH_FILTER_OP_ADD:\n+\t\ti40e_pf_disable_irq0(hw);\n+\t\tif (!filter->pf_vf_flag)\n+\t\t\tret = i40e_vf_mac_filter_set(pf, filter, 1);\n+\t\ti40e_pf_enable_irq0(hw);\n+\t\tbreak;\n+\tcase RTE_ETH_FILTER_OP_DELETE:\n+\t\ti40e_pf_disable_irq0(hw);\n+\t\tif (!filter->pf_vf_flag)\n+\t\t\tret = i40e_vf_mac_filter_set(pf, filter, 0);\n+\t\ti40e_pf_enable_irq0(hw);\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 static int\n i40e_dev_rss_reta_update(struct rte_eth_dev *dev,\n \t\t\t struct rte_eth_rss_reta *reta_conf)\n@@ -4224,16 +4336,15 @@ 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 (dev == NULL)\n-\t\treturn -EINVAL;\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_MACVLAN:\n+\t\tret = i40e_mac_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",
    "prefixes": [
        "dpdk-dev",
        "4/5"
    ]
}