get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 756586,
    "url": "http://patchwork.ozlabs.org/api/patches/756586/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170428194203.24106-1-anthony.l.nguyen@intel.com/",
    "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": "<20170428194203.24106-1-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2017-04-28T19:42:03",
    "name": "ixgbe: Add error checking to setting VF MAC",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ca0030aee4a225404bfe2b072ae1245a51d45923",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@intel.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/20170428194203.24106-1-anthony.l.nguyen@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/756586/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/756586/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3wF5Yc0zwmz9s7w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 29 Apr 2017 06:50:27 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5E3938A243;\n\tFri, 28 Apr 2017 20:50:26 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id UW+rnknl3CS2; Fri, 28 Apr 2017 20:50:23 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 1B2138A22D;\n\tFri, 28 Apr 2017 20:50:23 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6E10A1CE6C9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 20:50:21 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 3D614883D3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 20:50:21 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id UocuhT4eD-ZL for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 20:50:20 +0000 (UTC)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 29B418815A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 28 Apr 2017 20:50:20 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga105.jf.intel.com with ESMTP; 28 Apr 2017 13:50:19 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.152.56])\n\tby fmsmga004.fm.intel.com with ESMTP; 28 Apr 2017 13:50:19 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.37,389,1488873600\"; d=\"scan'208\";a=\"254828694\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 28 Apr 2017 12:42:03 -0700",
        "Message-Id": "<20170428194203.24106-1-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "Subject": "[Intel-wired-lan] [PATCH] ixgbe: Add error checking to setting VF\n\tMAC",
        "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>",
        "MIME-Version": "1.0",
        "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": "Currently, when setting a VF MAC address there are no error checks to\nensure that the MAC filter was successfully added.  This patch adds\nadditional error checks, reporting, and propagation of errors.  It also\nwill not set the MAC address unless adding the MAC filter was successful.\n\nWith these changes, setting the mac address to zeros can no longer call\nixgbe_set_vf_mac() as adding a zero MAC address filter is not valid.\nInstead directly delete the filter and, if successful, clear the MAC\naddress.\n\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 54 +++++++++++++++++++-------\n 1 file changed, 41 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\nindex 8baf298..13c96a1 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n@@ -778,11 +778,17 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)\n static int ixgbe_set_vf_mac(struct ixgbe_adapter *adapter,\n \t\t\t    int vf, unsigned char *mac_addr)\n {\n+\ts32 retval;\n+\n \tixgbe_del_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf);\n-\tmemcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr, ETH_ALEN);\n-\tixgbe_add_mac_filter(adapter, adapter->vfinfo[vf].vf_mac_addresses, vf);\n+\tretval = ixgbe_add_mac_filter(adapter, mac_addr, vf);\n+\tif (retval >= 0)\n+\t\tmemcpy(adapter->vfinfo[vf].vf_mac_addresses, mac_addr,\n+\t\t       ETH_ALEN);\n+\telse\n+\t\tmemset(adapter->vfinfo[vf].vf_mac_addresses, 0, ETH_ALEN);\n \n-\treturn 0;\n+\treturn retval;\n }\n \n int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask)\n@@ -1347,27 +1353,49 @@ void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter)\n int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)\n {\n \tstruct ixgbe_adapter *adapter = netdev_priv(netdev);\n+\ts32 retval;\n \n \tif (vf >= adapter->num_vfs)\n \t\treturn -EINVAL;\n \n-\tif (is_zero_ether_addr(mac)) {\n-\t\tadapter->vfinfo[vf].pf_set_mac = false;\n-\t\tdev_info(&adapter->pdev->dev, \"removing MAC on VF %d\\n\", vf);\n-\t} else if (is_valid_ether_addr(mac)) {\n-\t\tadapter->vfinfo[vf].pf_set_mac = true;\n+\tif (is_valid_ether_addr(mac)) {\n \t\tdev_info(&adapter->pdev->dev, \"setting MAC %pM on VF %d\\n\",\n \t\t\t mac, vf);\n \t\tdev_info(&adapter->pdev->dev, \"Reload the VF driver to make this change effective.\");\n-\t\tif (test_bit(__IXGBE_DOWN, &adapter->state)) {\n-\t\t\tdev_warn(&adapter->pdev->dev, \"The VF MAC address has been set, but the PF device is not up.\\n\");\n-\t\t\tdev_warn(&adapter->pdev->dev, \"Bring the PF device up before attempting to use the VF device.\\n\");\n+\n+\t\tretval = ixgbe_set_vf_mac(adapter, vf, mac);\n+\t\tif (retval >= 0) {\n+\t\t\tadapter->vfinfo[vf].pf_set_mac = true;\n+\n+\t\t\tif (test_bit(__IXGBE_DOWN, &adapter->state)) {\n+\t\t\t\tdev_warn(&adapter->pdev->dev, \"The VF MAC address has been set, but the PF device is not up.\\n\");\n+\t\t\t\tdev_warn(&adapter->pdev->dev, \"Bring the PF device up before attempting to use the VF device.\\n\");\n+\t\t\t}\n+\t\t} else {\n+\t\t\tdev_warn(&adapter->pdev->dev, \"The VF MAC address was NOT set due to invalid or duplicate MAC address.\\n\");\n+\t\t}\n+\t} else if (is_zero_ether_addr(mac)) {\n+\t\tunsigned char *vf_mac_addr =\n+\t\t\t\t\t   adapter->vfinfo[vf].vf_mac_addresses;\n+\n+\t\t/* nothing to do */\n+\t\tif (is_zero_ether_addr(vf_mac_addr))\n+\t\t\treturn 0;\n+\n+\t\tdev_info(&adapter->pdev->dev, \"removing MAC on VF %d\\n\", vf);\n+\n+\t\tretval = ixgbe_del_mac_filter(adapter, vf_mac_addr, vf);\n+\t\tif (retval >= 0) {\n+\t\t\tadapter->vfinfo[vf].pf_set_mac = false;\n+\t\t\tmemcpy(vf_mac_addr, mac, ETH_ALEN);\n+\t\t} else {\n+\t\t\tdev_warn(&adapter->pdev->dev, \"Could NOT remove the VF MAC address.\\n\");\n \t\t}\n \t} else {\n-\t\treturn -EINVAL;\n+\t\tretval = -EINVAL;\n \t}\n \n-\treturn ixgbe_set_vf_mac(adapter, vf, mac);\n+\treturn retval;\n }\n \n static int ixgbe_enable_port_vlan(struct ixgbe_adapter *adapter, int vf,\n",
    "prefixes": []
}