get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 552798,
    "url": "http://patchwork.ozlabs.org/api/patches/552798/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20151204162407.GM26633@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": "<20151204162407.GM26633@oracle.com>",
    "list_archive_url": null,
    "date": "2015-12-04T16:24:07",
    "name": "[RESEND,v7] i40e: Look up MAC address in Open Firmware or IDPROM",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d91cb7c96391a30ccec59639298e6e3b33069ece",
    "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/20151204162407.GM26633@oracle.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/552798/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/552798/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 AE8C3140273\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  5 Dec 2015 03:24:19 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id A01662EE98;\n\tFri,  4 Dec 2015 16:24:18 +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 c-qgt7J7MGX4; Fri,  4 Dec 2015 16:24:17 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 3600F305C8;\n\tFri,  4 Dec 2015 16:24:17 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id C4CB91C10DA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  4 Dec 2015 16:24:16 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id B979832A65\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  4 Dec 2015 16:24:16 +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 QTetS49McwuH for <intel-wired-lan@lists.osuosl.org>;\n\tFri,  4 Dec 2015 16:24:15 +0000 (UTC)",
            "from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 1B1542EE98\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri,  4 Dec 2015 16:24:15 +0000 (UTC)",
            "from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with\n\tESMTP id tB4GOBWR019590\n\t(version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\n\tFri, 4 Dec 2015 16:24:11 GMT",
            "from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])\n\tby userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tB4GOBg3010368\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); \n\tFri, 4 Dec 2015 16:24:11 GMT",
            "from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15])\n\tby userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id\n\ttB4GOANa010000; Fri, 4 Dec 2015 16:24:10 GMT",
            "from oracle.com (/10.154.131.110)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Fri, 04 Dec 2015 08:24:10 -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": "Fri, 4 Dec 2015 11:24:07 -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": "<20151204162407.GM26633@oracle.com>",
        "MIME-Version": "1.0",
        "Content-Disposition": "inline",
        "User-Agent": "Mutt/1.5.21 (2010-09-15)",
        "X-Source-IP": "userv0021.oracle.com [156.151.31.71]",
        "Cc": "andy.shevchenko@gmail.com, matthew.vick@intel.com",
        "Subject": "[Intel-wired-lan] [PATCH RESEND v7] i40e: Look up MAC address in\n\tOpen Firmware 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": "[Apologies for fat-fingering subject in the other attempt]\n\nThis 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 is_default_mac field in the platform-private i40e_pf structure\ntracks whether the mac address was default or not, and in the latter\ncase, will trigger the calls to i40e_aq_mac_address_write() and\ni40e_aq_add_macvlan().\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\n\n drivers/net/ethernet/intel/i40e/i40e.h      |    2 +\n drivers/net/ethernet/intel/i40e/i40e_main.c |   87 +++++++++++++++++++++++++++\n 2 files changed, 89 insertions(+), 0 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 0b9537b..6d41757 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -420,6 +420,8 @@ struct i40e_pf {\n \n \tu32 ioremap_len;\n \tu32 fd_inv;\n+\n+\tu32 is_default_mac:1;\n };\n \n struct i40e_mac_filter {\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 9e6268b..40a5d53 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, aq_err;\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+\taq_err = vsi->back->hw.aq.asq_last_status;\n+\tif (aq_err != I40E_AQ_RC_OK) {\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, aq_err));\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,14 @@ 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->is_default_mac) {\n+\t\t\tret = i40e_macaddr_init(vsi, pf->hw.mac.addr);\n+\t\t\tif (ret)\n+\t\t\t\tgoto err_netdev;\n+\t\t}\n \tcase I40E_VSI_VMDQ2:\n \tcase I40E_VSI_FCOE:\n \t\tret = i40e_config_netdev(vsi);\n@@ -10340,6 +10395,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 value\n+ * of pf->is_default_mac will be set to 1, if the default mac address is\n+ * to be used, or 0, if a platform-specific value has been selected.\n+ *\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->is_default_mac = 1;\n+\taddr = of_get_mac_address(dp);\n+\tif (addr) {\n+\t\tether_addr_copy(mac_addr, addr);\n+\t\tpf->is_default_mac = 0;\n+\t}\n+#ifdef CONFIG_SPARC\n+\tether_addr_copy(mac_addr, idprom->id_ethaddr);\n+\tpf->is_default_mac = 0;\n+#endif /* CONFIG_SPARC */\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 +10628,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": [
        "RESEND",
        "v7"
    ]
}