get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 6996,
    "url": "http://patches.dpdk.org/api/patches/6996/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1441859917-26475-19-git-send-email-xiao.w.wang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1441859917-26475-19-git-send-email-xiao.w.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1441859917-26475-19-git-send-email-xiao.w.wang@intel.com",
    "date": "2015-09-10T04:38:27",
    "name": "[dpdk-dev,18/28] fm10k: fix iov_msg_mac_vlan_pf VID checks",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a408e4ce12cea1efe8c2abfb7448a4ea51885d75",
    "submitter": {
        "id": 281,
        "url": "http://patches.dpdk.org/api/people/281/?format=api",
        "name": "Xiao Wang",
        "email": "xiao.w.wang@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1441859917-26475-19-git-send-email-xiao.w.wang@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/6996/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/6996/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 C47E591D7;\n\tThu, 10 Sep 2015 06:39:28 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id A1D6791B2\n\tfor <dev@dpdk.org>; Thu, 10 Sep 2015 06:39:26 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP; 09 Sep 2015 21:39:27 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby fmsmga001.fm.intel.com with ESMTP; 09 Sep 2015 21:39:25 -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 t8A4dNax007716;\n\tThu, 10 Sep 2015 12:39:23 +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 t8A4dK10026637; Thu, 10 Sep 2015 12:39:22 +0800",
            "(from xiaowan1@localhost)\n\tby shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t8A4dJNw026633; \n\tThu, 10 Sep 2015 12:39:19 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,501,1437462000\"; d=\"scan'208\";a=\"786352726\"",
        "From": "Wang Xiao W <xiao.w.wang@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Thu, 10 Sep 2015 12:38:27 +0800",
        "Message-Id": "<1441859917-26475-19-git-send-email-xiao.w.wang@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1441859917-26475-1-git-send-email-xiao.w.wang@intel.com>",
        "References": "<1441859917-26475-1-git-send-email-xiao.w.wang@intel.com>",
        "Cc": "Wang Xiao W <xiao.w.wang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 18/28] fm10k: fix iov_msg_mac_vlan_pf VID checks",
        "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": "The VF will send a message to request multicast addresses with the\ndefault vid. In the current code, if the PF has statically assigned a\nVLAN to a VF, then the VF will not get the multicast addresses. Fix up\nall of the various vlan messages to use identical checks (since each\ncheck was different). Also use set as a variable, so that it simplifies\nour check for whether vlan matches the pf_vid.\n\nThe new logic will allow set of a vlan if it is zero, automatically\nconverting to the default vid. Otherwise it will allow setting the PF\nvid, or any VLAN if PF has not statically assigned a VLAN. This is\nconsistent behavior, and allows VF to request either 0 or the\ndefault_vid without silently failing. Note that we need the check for\nzero since VFs might not get the default VID message in time to actually\nrequest non-zero VLANs.\n\nCreate a function, fm10k_iov_select_vid which implements the logic for\nselecting a default vid. This helps us remove duplicate code and\nstreamlines location of this logic so that we don't make similar bugs in\nthe future.\n\nSigned-off-by: Wang Xiao W <xiao.w.wang@intel.com>\n---\n drivers/net/fm10k/base/fm10k_pf.c | 83 ++++++++++++++++++++++++---------------\n 1 file changed, 51 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c\nindex aa04937..5506568 100644\n--- a/drivers/net/fm10k/base/fm10k_pf.c\n+++ b/drivers/net/fm10k/base/fm10k_pf.c\n@@ -1225,6 +1225,24 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,\n }\n \n /**\n+ * fm10k_iov_select_vid - Select correct default vid\n+ * @hw: Pointer to hardware structure\n+ * @vid: vid to correct\n+ *\n+ * Will report an error if vid is out of range. For vid = 0, it will return\n+ * either the pf_vid or sw_vid depending on which one is set.\n+ */\n+STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)\n+{\n+\tif (!vid)\n+\t\treturn vf_info->pf_vid ? vf_info->pf_vid : vf_info->sw_vid;\n+\telse if (vf_info->pf_vid && vid != vf_info->pf_vid)\n+\t\treturn FM10K_ERR_PARAM;\n+\telse\n+\t\treturn vid;\n+}\n+\n+/**\n  *  fm10k_iov_msg_mac_vlan_pf - Message handler for MAC/VLAN request from VF\n  *  @hw: Pointer to hardware structure\n  *  @results: Pointer array to message, results[0] is pointer to message\n@@ -1241,6 +1259,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,\n \tint err = FM10K_SUCCESS;\n \tu8 mac[ETH_ALEN];\n \tu32 *result;\n+\tbool set;\n \tu16 vlan;\n \tu32 vid;\n \n@@ -1258,19 +1277,21 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,\n \t\tif (err)\n \t\t\treturn err;\n \n-\t\t/* if VLAN ID is 0, set the default VLAN ID instead of 0 */\n-\t\tif (!vid || (vid == FM10K_VLAN_CLEAR)) {\n-\t\t\tif (vf_info->pf_vid)\n-\t\t\t\tvid |= vf_info->pf_vid;\n-\t\t\telse\n-\t\t\t\tvid |= vf_info->sw_vid;\n-\t\t} else if (vid != vf_info->pf_vid) {\n+\t\t/* verify upper 16 bits are zero */\n+\t\tif (vid >> 16)\n \t\t\treturn FM10K_ERR_PARAM;\n-\t\t}\n+\n+\t\tset = !(vid & FM10K_VLAN_CLEAR);\n+\t\tvid &= ~FM10K_VLAN_CLEAR;\n+\n+\t\terr = fm10k_iov_select_vid(vf_info, (u16)vid);\n+\t\tif (err < 0)\n+\t\t\treturn err;\n+\t\telse\n+\t\t\tvid = err;\n \n \t\t/* update VSI info for VF in regards to VLAN table */\n-\t\terr = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi,\n-\t\t\t\t\t      !(vid & FM10K_VLAN_CLEAR));\n+\t\terr = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi, set);\n \t}\n \n \tif (!err && !!results[FM10K_MAC_VLAN_MSG_MAC]) {\n@@ -1286,19 +1307,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,\n \t\t    memcmp(mac, vf_info->mac, ETH_ALEN))\n \t\t\treturn FM10K_ERR_PARAM;\n \n-\t\t/* if VLAN ID is 0, set the default VLAN ID instead of 0 */\n-\t\tif (!vlan || (vlan == FM10K_VLAN_CLEAR)) {\n-\t\t\tif (vf_info->pf_vid)\n-\t\t\t\tvlan |= vf_info->pf_vid;\n-\t\t\telse\n-\t\t\t\tvlan |= vf_info->sw_vid;\n-\t\t} else if (vf_info->pf_vid) {\n-\t\t\treturn FM10K_ERR_PARAM;\n-\t\t}\n+\t\tset = !(vlan & FM10K_VLAN_CLEAR);\n+\t\tvlan &= ~FM10K_VLAN_CLEAR;\n+\n+\t\terr = fm10k_iov_select_vid(vf_info, vlan);\n+\t\tif (err < 0)\n+\t\t\treturn err;\n+\t\telse\n+\t\t\tvlan = (u16)err;\n \n \t\t/* notify switch of request for new unicast address */\n-\t\terr = hw->mac.ops.update_uc_addr(hw, vf_info->glort, mac, vlan,\n-\t\t\t\t\t\t !(vlan & FM10K_VLAN_CLEAR), 0);\n+\t\terr = hw->mac.ops.update_uc_addr(hw, vf_info->glort,\n+\t\t\t\t\t\t mac, vlan, set, 0);\n \t}\n \n \tif (!err && !!results[FM10K_MAC_VLAN_MSG_MULTICAST]) {\n@@ -1313,19 +1333,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,\n \t\tif (!(vf_info->vf_flags & FM10K_VF_FLAG_MULTI_ENABLED))\n \t\t\treturn FM10K_ERR_PARAM;\n \n-\t\t/* if VLAN ID is 0, set the default VLAN ID instead of 0 */\n-\t\tif (!vlan || (vlan == FM10K_VLAN_CLEAR)) {\n-\t\t\tif (vf_info->pf_vid)\n-\t\t\t\tvlan |= vf_info->pf_vid;\n-\t\t\telse\n-\t\t\t\tvlan |= vf_info->sw_vid;\n-\t\t} else if (vf_info->pf_vid) {\n-\t\t\treturn FM10K_ERR_PARAM;\n-\t\t}\n+\t\tset = !(vlan & FM10K_VLAN_CLEAR);\n+\t\tvlan &= ~FM10K_VLAN_CLEAR;\n+\n+\t\terr = fm10k_iov_select_vid(vf_info, vlan);\n+\t\tif (err < 0)\n+\t\t\treturn err;\n+\t\telse\n+\t\t\tvlan = (u16)err;\n \n \t\t/* notify switch of request for new multicast address */\n-\t\terr = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac, vlan,\n-\t\t\t\t\t\t !(vlan & FM10K_VLAN_CLEAR));\n+\t\terr = hw->mac.ops.update_mc_addr(hw, vf_info->glort,\n+\t\t\t\t\t\t mac, vlan, set);\n \t}\n \n \treturn err;\n",
    "prefixes": [
        "dpdk-dev",
        "18/28"
    ]
}