get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 620,
    "url": "http://patchwork.ozlabs.org/api/patches/620/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/48D3A381.1080500@redhat.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<48D3A381.1080500@redhat.com>",
    "list_archive_url": null,
    "date": "2008-09-19T13:05:05",
    "name": "[PATCH] r8169: read MAC address from EEPROM on init",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8b9dae5f26deec48db808cca83de5859e320a855",
    "submitter": {
        "id": 262,
        "url": "http://patchwork.ozlabs.org/api/people/262/?format=api",
        "name": "Ivan Vecera",
        "email": "ivecera@redhat.com"
    },
    "delegate": {
        "id": 36,
        "url": "http://patchwork.ozlabs.org/api/users/36/?format=api",
        "username": "jgarzik",
        "first_name": "Jeff",
        "last_name": "Garzik",
        "email": "jgarzik@pobox.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/48D3A381.1080500@redhat.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/620/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/620/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 4943DDDFD2\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 19 Sep 2008 23:08:43 +1000 (EST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753293AbYISNId (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 19 Sep 2008 09:08:33 -0400",
            "(majordomo@vger.kernel.org) by vger.kernel.org id S1751023AbYISNId\n\t(ORCPT <rfc822; netdev-outgoing>); Fri, 19 Sep 2008 09:08:33 -0400",
            "from mx2.redhat.com ([66.187.237.31]:46159 \"EHLO mx2.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751373AbYISNIc (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 19 Sep 2008 09:08:32 -0400",
            "from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com\n\t[172.16.27.26])\n\tby mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m8JD5Je4011879;\n\tFri, 19 Sep 2008 09:05:39 -0400",
            "from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199])\n\tby int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id\n\tm8JD57qZ019801; Fri, 19 Sep 2008 09:05:08 -0400",
            "from [10.32.4.22] (vpn-4-22.str.redhat.com [10.32.4.22])\n\tby ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id m8JD53e9028246;\n\tFri, 19 Sep 2008 09:05:04 -0400"
        ],
        "Message-ID": "<48D3A381.1080500@redhat.com>",
        "Date": "Fri, 19 Sep 2008 15:05:05 +0200",
        "From": "Ivan Vecera <ivecera@redhat.com>",
        "User-Agent": "Thunderbird 2.0.0.16 (X11/20080724)",
        "MIME-Version": "1.0",
        "To": "=?ISO-8859-1?Q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi>,\n\tFrancois Romieu <romieu@fr.zoreil.com>",
        "CC": "Netdev <netdev@vger.kernel.org>, Edward Hsu <edward_hsu@realtek.com.tw>",
        "Subject": "Re: [PATCH] r8169: read MAC address from EEPROM on init",
        "References": "<48D25BA2.6070008@redhat.com>\n\t<Pine.LNX.4.64.0809182235550.4742@wrl-59.cs.helsinki.fi>",
        "In-Reply-To": "<Pine.LNX.4.64.0809182235550.4742@wrl-59.cs.helsinki.fi>",
        "X-Enigmail-Version": "0.95.0",
        "Content-Type": "text/plain; charset=ISO-8859-1",
        "Content-Transfer-Encoding": "8bit",
        "X-Scanned-By": "MIMEDefang 2.58 on 172.16.27.26",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "Ilpo Järvinen wrote:\n>> +\t * is always consecutive 4-byte data starting from the VPD address\n>> +\t * specified.\"\n>> +\t */\n>> +\tif (rtl_eeprom_read(tp->pci_dev, vpd_cap, 0x000e, &low) < 0 ||\n>> +\t    rtl_eeprom_read(tp->pci_dev, vpd_cap, 0x0012, &high) < 0) {\n>> +\t\tdprintk(\"Reading MAC address from EEPROM failed\\n\");\n>> +\t\treturn;\n>> +\t}\n>> +\n>> +\t/* Mask hi-word */\n>> +\thigh &= 0xffff;\n> \n> ..Hmm, and besides fixing sparse printouts, this looks like a real \n> endianness bug.\n\nYes it is, my mistake. The patch below will be better.",
    "diff": "diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c\nindex befc927..cff8dd6 100644\n--- a/drivers/net/r8169.c\n+++ b/drivers/net/r8169.c\n@@ -1910,6 +1910,75 @@ static void rtl_disable_msi(struct pci_dev *pdev, struct rtl8169_private *tp)\n \t}\n }\n\n+static int rtl_eeprom_read(struct pci_dev *pdev, int cap, int addr, __le32 *val)\n+{\n+\tint ret, count = 100;\n+\tu16 status = 0;\n+\tu32 value;\n+\n+\tret = pci_write_config_word(pdev, cap + PCI_VPD_ADDR, addr);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tdo {\n+\t\tudelay(10);\n+\t\tret = pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &status);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t} while (!(status & PCI_VPD_ADDR_F) && --count);\n+\n+\tif (!(status & PCI_VPD_ADDR_F))\n+\t\treturn -ETIMEDOUT;\n+\n+\tret = pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &value);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\t*val = cpu_to_le32(value);\n+\n+\treturn 0;\n+}\n+\n+static void rtl_init_mac_address(struct rtl8169_private *tp,\n+\t\t\t\t void __iomem *ioaddr)\n+{\n+\tstruct pci_dev *pdev = tp->pci_dev;\n+\tu8 cfg1;\n+\tint vpd_cap;\n+\tu8 mac[8];\n+\n+\tcfg1 = RTL_R8(Config1);\n+\tif (!(cfg1  & VPD)) {\n+\t\tdprintk(\"VPD access not enabled, enabling\\n\");\n+\t\tRTL_W8(Cfg9346, Cfg9346_Unlock);\n+\t\tRTL_W8(Config1, cfg1 | VPD);\n+\t\tRTL_W8(Cfg9346, Cfg9346_Lock);\n+\t}\n+\n+\tvpd_cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);\n+\tif (!vpd_cap)\n+\t\treturn;\n+\n+\t/* MAC address is stored in EEPROM at offset 0x0e\n+\t * Realtek says: \"The VPD address does not have to be a DWORD-aligned\n+\t * address as defined in the PCI 2.2 Specifications, but the VPD data\n+\t * is always consecutive 4-byte data starting from the VPD address\n+\t * specified.\"\n+\t */\n+\tif (rtl_eeprom_read(pdev, vpd_cap, 0x000e, (__le32*)&mac[0]) < 0 ||\n+\t    rtl_eeprom_read(pdev, vpd_cap, 0x0012, (__le32*)&mac[4]) < 0) {\n+\t\tdprintk(\"Reading MAC address from EEPROM failed\\n\");\n+\t\treturn;\n+\t}\n+\n+\tdprintk(\"MAC address found in EEPROM: \"\n+\t\t\"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\\n\",\n+\t\tmac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6]);\n+\n+\t/* Write MAC address */\n+\trtl_rar_set(tp, mac);\n+}\n+\n static int __devinit\n rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)\n {\n@@ -2079,7 +2148,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\tdev->do_ioctl = rtl8169_ioctl;\n \t}\n\n-\t/* Get MAC address.  FIXME: read EEPROM */\n+\t/* Read MAC address from EEPROM */\n+\trtl_init_mac_address(tp, ioaddr);\n+\n+\t/* Get MAC address */\n \tfor (i = 0; i < MAC_ADDR_LEN; i++)\n \t\tdev->dev_addr[i] = RTL_R8(MAC0 + i);\n \tmemcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);\n",
    "prefixes": []
}