get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 564180,
    "url": "http://patchwork.ozlabs.org/api/patches/564180/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160107071111.13648.16311.stgit@localhost.localdomain/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20160107071111.13648.16311.stgit@localhost.localdomain>",
    "list_archive_url": null,
    "date": "2016-01-07T07:11:11",
    "name": "[next,07/11] igb: Clean-up configuration of VF port VLANs",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f02e9f5a91b88bbca3ccfe4cb5ae039ee4fcb200",
    "submitter": {
        "id": 67293,
        "url": "http://patchwork.ozlabs.org/api/people/67293/?format=api",
        "name": "Alexander Duyck",
        "email": "aduyck@mirantis.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160107071111.13648.16311.stgit@localhost.localdomain/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/564180/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/564180/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id C687D1402C0\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Jan 2016 18:11:19 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 1C40032D9C;\n\tThu,  7 Jan 2016 07:11:19 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id yzlmVygW6rsl; Thu,  7 Jan 2016 07:11:16 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 7D3FC32D95;\n\tThu,  7 Jan 2016 07:11:16 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 315DB1C09CE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Jan 2016 07:11:15 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2D75F32D9E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Jan 2016 07:11:15 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id M5aimoc6fPDp for <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Jan 2016 07:11:13 +0000 (UTC)",
            "from mail-pa0-f45.google.com (mail-pa0-f45.google.com\n\t[209.85.220.45])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 4827D32D95\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  7 Jan 2016 07:11:13 +0000 (UTC)",
            "by mail-pa0-f45.google.com with SMTP id yy13so159031965pab.3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 06 Jan 2016 23:11:13 -0800 (PST)",
            "from localhost.localdomain\n\t(static-50-53-29-36.bvtn.or.frontiernet.net. [50.53.29.36])\n\tby smtp.gmail.com with ESMTPSA id\n\try1sm149625815pab.30.2016.01.06.23.11.12\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 06 Jan 2016 23:11:12 -0800 (PST)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mirantis.com header.i=@mirantis.com\n\theader.b=YE5vBqfU; dkim-atps=neutral",
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com;\n\ts=google; \n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-type:content-transfer-encoding;\n\tbh=c9eFasKLl67vWUSVHtLy+p6vlMFyEXq/YM0gFcYVe78=;\n\tb=YE5vBqfUeEW4D6Ym3apDSGut2lFyIZVG0rtxch3EvGKWQ2pTsaoadXKz1EhDkYSExC\n\tcJrJUKblAC94sdl++I/cxHcHLc2T9kyY8cGubBw8UM/K/X8sm9SEo+M72seZ4+WnzWdd\n\tosfj6roSCGuhPRVEch4X0O3erxVYep6gDZpi4=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-type\n\t:content-transfer-encoding;\n\tbh=c9eFasKLl67vWUSVHtLy+p6vlMFyEXq/YM0gFcYVe78=;\n\tb=f9IZeSASdBE5fS9qfNBqwrH5mbp4TrbO0o7yUSVCttXGoKXcjRHEcUpkiI2w/9dhnG\n\tnlLth5j+cCQkHlOxukCBN5R6KeEL72T5nI4CVS5Ybg4wpyBrxnBzjFh8gedf93qnWpr5\n\tov/OCffnEAyf3Ecrg+9/+qsFw8hiG2Ab7zpIrirFWsvPpfmw70u/DwXLZB9EX5qbjVFr\n\tttQAsZVijI5P9Bf86nHUELg5FE/ALymo/myQolQuzxgCMK2FmCo6c7GnyQnjVRm7yfgj\n\t5M9lCqXbtrjDxhz1jKAW+REic6eop6fQ8aY44rIQ4X+GTYP9HMGZePj5YFqB9GcE9Zyg\n\tUgQQ==",
        "X-Gm-Message-State": "ALoCoQltGHj+Nm6FmVxS65bNoq5+CzGd+fQo9S4gy9tiISqEuYtFEACkPPEBtIKElEjIRxaVZKaS7g/mqnQMwP97Pu1KSfLF4g==",
        "X-Received": "by 10.66.150.228 with SMTP id ul4mr149071976pab.15.1452150672970;\n\tWed, 06 Jan 2016 23:11:12 -0800 (PST)",
        "From": "Alexander Duyck <aduyck@mirantis.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 06 Jan 2016 23:11:11 -0800",
        "Message-ID": "<20160107071111.13648.16311.stgit@localhost.localdomain>",
        "In-Reply-To": "<20160107070850.13648.21033.stgit@localhost.localdomain>",
        "References": "<20160107070850.13648.21033.stgit@localhost.localdomain>",
        "User-Agent": "StGit/0.17.1-dirty",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next PATCH 07/11] igb: Clean-up configuration of\n\tVF port VLANs",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "This patch is meant to clean-up the configuration of the VF port based VLAN\nconfiguration.  The original logic was a bit muddled and had some\nundesirable side effects such as VLANs being either completely stripped\nfrom the port or VLANs being left when they shouldn't be.  The idea behind\nthis code is to avoid any events such as spurious spoof notifications when\nwe are removing one VLAN tag and replacing it with another.\n\nSigned-off-by: Alexander Duyck <aduyck@mirantis.com>\n---\n drivers/net/ethernet/intel/igb/igb_main.c |  181 ++++++++++++++++++-----------\n 1 file changed, 110 insertions(+), 71 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex fb98c7aa6588..cf91aae2a413 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -5914,53 +5914,6 @@ static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)\n \t}\n }\n \n-static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)\n-{\n-\tstruct e1000_hw *hw = &adapter->hw;\n-\n-\tif (vid)\n-\t\twr32(E1000_VMVIR(vf), (vid | E1000_VMVIR_VLANA_DEFAULT));\n-\telse\n-\t\twr32(E1000_VMVIR(vf), 0);\n-}\n-\n-static int igb_ndo_set_vf_vlan(struct net_device *netdev,\n-\t\t\t       int vf, u16 vlan, u8 qos)\n-{\n-\tstruct igb_adapter *adapter = netdev_priv(netdev);\n-\tstruct e1000_hw *hw = &adapter->hw;\n-\tint err = 0;\n-\n-\tif ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7))\n-\t\treturn -EINVAL;\n-\tif (vlan || qos) {\n-\t\terr = igb_vfta_set(hw, vlan, vf, !!vlan, false);\n-\t\tif (err)\n-\t\t\tgoto out;\n-\t\tigb_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf);\n-\t\tigb_set_vmolr(adapter, vf, !vlan);\n-\t\tadapter->vf_data[vf].pf_vlan = vlan;\n-\t\tadapter->vf_data[vf].pf_qos = qos;\n-\t\tdev_info(&adapter->pdev->dev,\n-\t\t\t \"Setting VLAN %d, QOS 0x%x on VF %d\\n\", vlan, qos, vf);\n-\t\tif (test_bit(__IGB_DOWN, &adapter->state)) {\n-\t\t\tdev_warn(&adapter->pdev->dev,\n-\t\t\t\t \"The VF VLAN has been set, but the PF device is not up.\\n\");\n-\t\t\tdev_warn(&adapter->pdev->dev,\n-\t\t\t\t \"Bring the PF device up before attempting to use the VF device.\\n\");\n-\t\t}\n-\t} else {\n-\t\tigb_vfta_set(hw, adapter->vf_data[vf].pf_vlan, vf,\n-\t\t\t     false, false);\n-\t\tigb_set_vmvir(adapter, vlan, vf);\n-\t\tigb_set_vmolr(adapter, vf, true);\n-\t\tadapter->vf_data[vf].pf_vlan = 0;\n-\t\tadapter->vf_data[vf].pf_qos = 0;\n-\t}\n-out:\n-\treturn err;\n-}\n-\n static int igb_find_vlvf_entry(struct igb_adapter *adapter, int vid)\n {\n \tstruct e1000_hw *hw = &adapter->hw;\n@@ -5981,23 +5934,25 @@ static int igb_find_vlvf_entry(struct igb_adapter *adapter, int vid)\n \treturn i;\n }\n \n-static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)\n+static s32 igb_set_vf_vlan(struct igb_adapter *adapter, u32 vid,\n+\t\t\t   bool add, u32 vf)\n {\n+\tint pf_id = adapter->vfs_allocated_count;\n \tstruct e1000_hw *hw = &adapter->hw;\n-\tint add = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT;\n-\tint vid = (msgbuf[1] & E1000_VLVF_VLANID_MASK);\n-\tint err = 0;\n+\tint err;\n \n-\t/* If in promiscuous mode we need to make sure the PF also has\n-\t * the VLAN filter set.\n+\t/* If VLAN overlaps with one the PF is currently monitoring make\n+\t * sure that we are able to allocate a VLVF entry.  This may be\n+\t * redundant but it guarantees PF will maintain visibility to\n+\t * the VLAN.\n \t */\n-\tif (add && (adapter->netdev->flags & IFF_PROMISC))\n-\t\terr = igb_vfta_set(hw, vid, adapter->vfs_allocated_count,\n-\t\t\t\t   true, false);\n-\tif (err)\n-\t\tgoto out;\n+\tif (add && (adapter->netdev->flags & IFF_PROMISC)) {\n+\t\terr = igb_vfta_set(hw, vid, pf_id, true, false);\n+\t\tif (err)\n+\t\t\treturn err;\n+\t}\n \n-\terr = igb_vfta_set(hw, vid, vf, !!add, false);\n+\terr = igb_vfta_set(hw, vid, vf, add, false);\n \n \tif (err)\n \t\tgoto out;\n@@ -6032,23 +5987,107 @@ out:\n \treturn err;\n }\n \n-static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)\n+static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)\n {\n-\t/* clear flags - except flag that indicates PF has set the MAC */\n-\tadapter->vf_data[vf].flags &= IGB_VF_FLAG_PF_SET_MAC;\n-\tadapter->vf_data[vf].last_nack = jiffies;\n+\tstruct e1000_hw *hw = &adapter->hw;\n \n-\t/* reset offloads to defaults */\n+\tif (vid)\n+\t\twr32(E1000_VMVIR(vf), (vid | E1000_VMVIR_VLANA_DEFAULT));\n+\telse\n+\t\twr32(E1000_VMVIR(vf), 0);\n+}\n+\n+static int igb_enable_port_vlan(struct igb_adapter *adapter, int vf,\n+\t\t\t\tu16 vlan, u8 qos)\n+{\n+\tint err;\n+\n+\terr = igb_set_vf_vlan(adapter, vlan, true, vf);\n+\tif (err)\n+\t\treturn err;\n+\n+\tigb_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf);\n+\tigb_set_vmolr(adapter, vf, !vlan);\n+\n+\t/* revoke access to previous VLAN */\n+\tif (vlan != adapter->vf_data[vf].pf_vlan)\n+\t\tigb_set_vf_vlan(adapter, adapter->vf_data[vf].pf_vlan,\n+\t\t\t\tfalse, vf);\n+\n+\tadapter->vf_data[vf].pf_vlan = vlan;\n+\tadapter->vf_data[vf].pf_qos = qos;\n+\tdev_info(&adapter->pdev->dev,\n+\t\t \"Setting VLAN %d, QOS 0x%x on VF %d\\n\", vlan, qos, vf);\n+\tif (test_bit(__IGB_DOWN, &adapter->state)) {\n+\t\tdev_warn(&adapter->pdev->dev,\n+\t\t\t \"The VF VLAN has been set, but the PF device is not up.\\n\");\n+\t\tdev_warn(&adapter->pdev->dev,\n+\t\t\t \"Bring the PF device up before attempting to use the VF device.\\n\");\n+\t}\n+\n+\treturn err;\n+}\n+\n+static int igb_disable_port_vlan(struct igb_adapter *adapter, int vf)\n+{\n+\t/* Restore tagless access via VLAN 0 */\n+\tigb_set_vf_vlan(adapter, 0, true, vf);\n+\n+\tigb_set_vmvir(adapter, 0, vf);\n \tigb_set_vmolr(adapter, vf, true);\n \n+\t/* Remove any PF assigned VLAN */\n+\tif (adapter->vf_data[vf].pf_vlan)\n+\t\tigb_set_vf_vlan(adapter, adapter->vf_data[vf].pf_vlan,\n+\t\t\t\tfalse, vf);\n+\n+\tadapter->vf_data[vf].pf_vlan = 0;\n+\tadapter->vf_data[vf].pf_qos = 0;\n+\n+\treturn 0;\n+}\n+\n+static int igb_ndo_set_vf_vlan(struct net_device *netdev,\n+\t\t\t       int vf, u16 vlan, u8 qos)\n+{\n+\tstruct igb_adapter *adapter = netdev_priv(netdev);\n+\n+\tif ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7))\n+\t\treturn -EINVAL;\n+\n+\treturn (vlan || qos) ? igb_enable_port_vlan(adapter, vf, vlan, qos) :\n+\t\t\t       igb_disable_port_vlan(adapter, vf);\n+}\n+\n+static int igb_set_vf_vlan_msg(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)\n+{\n+\tint add = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT;\n+\tint vid = (msgbuf[1] & E1000_VLVF_VLANID_MASK);\n+\n+\tif (adapter->vf_data[vf].pf_vlan)\n+\t\treturn -1;\n+\n+\t/* VLAN 0 is a special case, don't allow it to be removed */\n+\tif (!vid && !add)\n+\t\treturn 0;\n+\n+\treturn igb_set_vf_vlan(adapter, vid, !!add, vf);\n+}\n+\n+static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)\n+{\n+\tstruct vf_data_storage *vf_data = &adapter->vf_data[vf];\n+\n+\t/* clear flags - except flag that indicates PF has set the MAC */\n+\tvf_data->flags &= IGB_VF_FLAG_PF_SET_MAC;\n+\tvf_data->last_nack = jiffies;\n+\n \t/* reset vlans for device */\n \tigb_clear_vf_vfta(adapter, vf);\n-\tif (adapter->vf_data[vf].pf_vlan)\n-\t\tigb_ndo_set_vf_vlan(adapter->netdev, vf,\n-\t\t\t\t    adapter->vf_data[vf].pf_vlan,\n-\t\t\t\t    adapter->vf_data[vf].pf_qos);\n-\telse\n-\t\tigb_clear_vf_vfta(adapter, vf);\n+\tigb_set_vf_vlan(adapter, vf_data->pf_vlan, true, vf);\n+\tigb_set_vmvir(adapter, vf_data->pf_vlan |\n+\t\t\t       (vf_data->pf_qos << VLAN_PRIO_SHIFT), vf);\n+\tigb_set_vmolr(adapter, vf, !vf_data->pf_vlan);\n \n \t/* reset multicast table array for vf */\n \tadapter->vf_data[vf].num_vf_mc_hashes = 0;\n@@ -6193,7 +6232,7 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)\n \t\t\t\t \"VF %d attempted to override administratively set VLAN tag\\nReload the VF driver to resume operations\\n\",\n \t\t\t\t vf);\n \t\telse\n-\t\t\tretval = igb_set_vf_vlan(adapter, msgbuf, vf);\n+\t\t\tretval = igb_set_vf_vlan_msg(adapter, msgbuf, vf);\n \t\tbreak;\n \tdefault:\n \t\tdev_err(&pdev->dev, \"Unhandled Msg %08x\\n\", msgbuf[0]);\n",
    "prefixes": [
        "next",
        "07/11"
    ]
}