get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 553521,
    "url": "http://patchwork.ozlabs.org/api/patches/553521/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20151207200634.GA4415@oracle.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": "<20151207200634.GA4415@oracle.com>",
    "list_archive_url": null,
    "date": "2015-12-07T20:06:34",
    "name": "[v9] i40e: Look up MAC address in Open Firmware or IDPROM",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9c39f51266c1ec94109f7adc4d04cd0f76620b58",
    "submitter": {
        "id": 64444,
        "url": "http://patchwork.ozlabs.org/api/people/64444/?format=api",
        "name": "Sowmini Varadhan",
        "email": "sowmini.varadhan@oracle.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/20151207200634.GA4415@oracle.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/553521/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/553521/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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ozlabs.org (Postfix) with ESMTP id 7404D1402C9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  8 Dec 2015 07:06:56 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 8140E8728D;\n\tMon,  7 Dec 2015 20:06:55 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id yqyNebHdulaz; Mon,  7 Dec 2015 20:06:54 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id A808A86BF6;\n\tMon,  7 Dec 2015 20:06:54 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 299AD1BFC02\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  7 Dec 2015 20:06:53 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 2298A86E7A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  7 Dec 2015 20:06:53 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 69nsiM0gBl-6 for <intel-wired-lan@lists.osuosl.org>;\n\tMon,  7 Dec 2015 20:06:52 +0000 (UTC)",
            "from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 2FCFC86BF6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon,  7 Dec 2015 20:06:52 +0000 (UTC)",
            "from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2)\n\twith ESMTP id tB7K6gh0019036\n\t(version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\n\tMon, 7 Dec 2015 20:06:42 GMT",
            "from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])\n\tby aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id\n\ttB7K6fXc003229\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); \n\tMon, 7 Dec 2015 20:06:41 GMT",
            "from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7])\n\tby aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tB7K6fX8021474; \n\tMon, 7 Dec 2015 20:06:41 GMT",
            "from oracle.com (/10.154.162.63)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Mon, 07 Dec 2015 12:06:41 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "Date": "Mon, 7 Dec 2015 15:06:34 -0500",
        "From": "Sowmini Varadhan <sowmini.varadhan@oracle.com>",
        "To": "sowmini.varadhan@oracle.com, intel-wired-lan@lists.osuosl.org,\n\tnetdev@vger.kernel.org, linux-kernel@vger.kernel.org",
        "Message-ID": "<20151207200634.GA4415@oracle.com>",
        "MIME-Version": "1.0",
        "Content-Disposition": "inline",
        "User-Agent": "Mutt/1.5.21 (2010-09-15)",
        "X-Source-IP": "aserv0022.oracle.com [141.146.126.234]",
        "Cc": "andy.shevchenko@gmail.com, matthew.vick@intel.com, davem@davemloft.net",
        "Subject": "[Intel-wired-lan] [PATCH v9] i40e: Look up MAC address in Open\n\tFirmware or IDPROM",
        "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 is the i40e equivalent of commit c762dff24c06 (\"ixgbe: Look up MAC\naddress in Open Firmware or IDPROM\").\n\nAs with that fix, attempt to look up the MAC address in Open Firmware\non systems that support it, and use IDPROM on SPARC if no OF address\nis found.\n\nIn the case of the i40e there is an assumption that the default mac\naddress has already been set up as the primary mac filter on probe,\nso if this filter is obtained from the Open Firmware or IDPROM, an\nexplicit write is needed via i40e_aq_mac_address_write() and\ni40e_aq_add_macvlan() invocation.\n\nThe I40E_FLAG_PF_MAC flag in the platform-private i40e_pf structure\ntracks whether a platform-specific mac address was found, in which\ncase calls to i40e_aq_mac_address_write() and i40e_aq_add_macvlan()\nwill be triggered.\n\nReviewed-by: Martin K. Petersen <martin.petersen@oracle.com>\nSigned-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>\n---\nv2, v3: Andy Shevchenko comments\nv4: Shannon Nelson review: explicitly set up mac filters before register_netdev\nv5: Shannon Nelson code style comments\nv6: Shannon Nelson code style comments\nv7: Ensure that i40e_macaddr_init() is called only for VSI_MAIN, and only\n    if the mac address is not the default. Some additional code-refactoring\n    based on comments from Shannon Nelson\nv8: use pf->flags instead of bit value to track if we found a platform-specific\n    macaddr. Other code-style comments from Shannon Nelson\nv9: David Miller, Shannon Nelson comments for i40e_get_platform_mac_addr\n\n drivers/net/ethernet/intel/i40e/i40e.h      |    1 +\n drivers/net/ethernet/intel/i40e/i40e_main.c |   90 +++++++++++++++++++++++++++\n 2 files changed, 91 insertions(+), 0 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 0b9537b..b85eaee 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -337,6 +337,7 @@ struct i40e_pf {\n #define I40E_FLAG_LINK_POLLING_ENABLED\t\tBIT_ULL(39)\n #define I40E_FLAG_VEB_MODE_ENABLED\t\tBIT_ULL(40)\n #define I40E_FLAG_NO_PCI_LINK_CHECK\t\tBIT_ULL(42)\n+#define I40E_FLAG_PF_MAC\t\t\tBIT_ULL(50)\n \n \t/* tracks features that get auto disabled by errors */\n \tu64 auto_disable_flags;\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 9e6268b..3e2d4e0 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -24,6 +24,15 @@\n  *\n  ******************************************************************************/\n \n+#include <linux/etherdevice.h>\n+#include <linux/of_net.h>\n+#include <linux/pci.h>\n+\n+#ifdef CONFIG_SPARC\n+#include <asm/idprom.h>\n+#include <asm/prom.h>\n+#endif\n+\n /* Local includes */\n #include \"i40e.h\"\n #include \"i40e_diag.h\"\n@@ -9387,6 +9396,44 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi)\n }\n \n /**\n+ * i40e_macaddr_init - explicitly write the mac address filters.\n+ *\n+ * @vsi: pointer to the vsi.\n+ * @macaddr: the MAC address\n+ *\n+ * This is needed when the macaddr has been obtained by other\n+ * means than the default, e.g., from Open Firmware or IDPROM.\n+ * Returns 0 on success, negative on failure\n+ **/\n+static int i40e_macaddr_init(struct i40e_vsi *vsi, u8 *macaddr)\n+{\n+\tint ret;\n+\tstruct i40e_aqc_add_macvlan_element_data element;\n+\n+\tret = i40e_aq_mac_address_write(&vsi->back->hw,\n+\t\t\t\t\tI40E_AQC_WRITE_TYPE_LAA_WOL,\n+\t\t\t\t\tmacaddr, NULL);\n+\tif (ret) {\n+\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t \"Addr change for VSI failed: %d\\n\", ret);\n+\t\treturn -EADDRNOTAVAIL;\n+\t}\n+\n+\tmemset(&element, 0, sizeof(element));\n+\tether_addr_copy(element.mac_addr, macaddr);\n+\telement.flags = cpu_to_le16(I40E_AQC_MACVLAN_ADD_PERFECT_MATCH);\n+\tret = i40e_aq_add_macvlan(&vsi->back->hw, vsi->seid, &element, 1, NULL);\n+\tif (ret) {\n+\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t \"add filter failed err %s aq_err %s\\n\",\n+\t\t\t i40e_stat_str(&vsi->back->hw, ret),\n+\t\t\t i40e_aq_str(&vsi->back->hw,\n+\t\t\t\t     vsi->back->hw.aq.asq_last_status));\n+\t}\n+\treturn ret;\n+}\n+\n+/**\n  * i40e_vsi_setup - Set up a VSI by a given type\n  * @pf: board private structure\n  * @type: VSI type\n@@ -9510,6 +9557,17 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,\n \tswitch (vsi->type) {\n \t/* setup the netdev if needed */\n \tcase I40E_VSI_MAIN:\n+\t\t/* Apply relevant filters if a platform-specific mac\n+\t\t * address was selected.\n+\t\t */\n+\t\tif (!!(pf->flags & I40E_FLAG_PF_MAC)) {\n+\t\t\tret = i40e_macaddr_init(vsi, pf->hw.mac.addr);\n+\t\t\tif (ret) {\n+\t\t\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t\t\t \"could not set up macaddr; err %d\\n\",\n+\t\t\t\t\t ret);\n+\t\t\t}\n+\t\t}\n \tcase I40E_VSI_VMDQ2:\n \tcase I40E_VSI_FCOE:\n \t\tret = i40e_config_netdev(vsi);\n@@ -10340,6 +10398,36 @@ static void i40e_print_features(struct i40e_pf *pf)\n }\n \n /**\n+ * i40e_get_platform_mac_addr - get platform-specific MAC address\n+ *\n+ * @pdev: PCI device information struct\n+ * @pf: board private structure\n+ *\n+ * Look up the MAC address in Open Firmware  on systems that support it,\n+ * and use IDPROM on SPARC if no OF address is found. On return, the\n+ * I40E_FLAG_PF_MAC will be wset in pf->flags if a platform-specific value\n+ * has been selected.\n+ **/\n+static void i40e_get_platform_mac_addr(struct pci_dev *pdev, struct i40e_pf *pf)\n+{\n+\tstruct device_node *dp = pci_device_to_OF_node(pdev);\n+\tconst unsigned char *addr;\n+\tu8 *mac_addr = pf->hw.mac.addr;\n+\n+\tpf->flags &= ~I40E_FLAG_PF_MAC;\n+\taddr = of_get_mac_address(dp);\n+\tif (addr) {\n+\t\tether_addr_copy(mac_addr, addr);\n+\t\tpf->flags |= I40E_FLAG_PF_MAC;\n+#ifdef CONFIG_SPARC\n+\t} else {\n+\t\tether_addr_copy(mac_addr, idprom->id_ethaddr);\n+\t\tpf->flags |= I40E_FLAG_PF_MAC;\n+#endif /* CONFIG_SPARC */\n+\t}\n+}\n+\n+/**\n  * i40e_probe - Device initialization routine\n  * @pdev: PCI device information struct\n  * @ent: entry in i40e_pci_tbl\n@@ -10543,6 +10631,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t}\n \n \ti40e_get_mac_addr(hw, hw->mac.addr);\n+\t/* allow a platform config to override the HW addr */\n+\ti40e_get_platform_mac_addr(pdev, pf);\n \tif (!is_valid_ether_addr(hw->mac.addr)) {\n \t\tdev_info(&pdev->dev, \"invalid MAC address %pM\\n\", hw->mac.addr);\n \t\terr = -EIO;\n",
    "prefixes": [
        "v9"
    ]
}