[{"id":1199,"web_url":"http://patchwork.ozlabs.org/comment/1199/","msgid":"<Pine.LNX.4.64.0809182232230.4742@wrl-59.cs.helsinki.fi>","list_archive_url":null,"date":"2008-09-18T19:34:22","subject":"Re: [PATCH] r8169: read MAC address from EEPROM on init","submitter":{"id":255,"url":"http://patchwork.ozlabs.org/api/people/255/","name":"Ilpo Järvinen","email":"ilpo.jarvinen@helsinki.fi"},"content":"On Thu, 18 Sep 2008, Ivan Vecera wrote:\n\n> This fixes the problem when MAC address is set by ifconfig or by\n> ip link commands and this address is stored in the device after\n> reboot. The power-off is needed to get right MAC address.\n> This is problem when Xen daemon is running because it renames the device\n> name from ethX to pethX and sets its MAC address to FE:FF:FF:FF:FF:FF.\n> After reboot the device is still using FE:FF:FF:FF:FF:FF.\n> \n> Signed-off-by: Ivan Vecera <ivecera@redhat.com>\n> ---\n>  drivers/net/r8169.c |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++-\n>  1 files changed, 79 insertions(+), 1 deletions(-)\n> \n> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c\n> index befc927..b09a4ec 100644\n> --- a/drivers/net/r8169.c\n> +++ b/drivers/net/r8169.c\n> @@ -1910,6 +1910,81 @@ 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, u32 *val)\n> +{\n> +\tint ret, count = 100;\n> +\tu16 status = 0;\n> +\tu32 value;\n\n...\n\n> +\t*val = cpu_to_le32(value);\n\nDid you check this with sparse?","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 33DA6DE171\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 19 Sep 2008 05:34:31 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754588AbYIRTe0 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 18 Sep 2008 15:34:26 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1754575AbYIRTe0\n\t(ORCPT <rfc822; netdev-outgoing>); Thu, 18 Sep 2008 15:34:26 -0400","from courier.cs.helsinki.fi ([128.214.9.1]:34998 \"EHLO\n\tmail.cs.helsinki.fi\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753963AbYIRTeZ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 18 Sep 2008 15:34:25 -0400","from wrl-59.cs.helsinki.fi (wrl-59.cs.helsinki.fi\n\t[128.214.166.179])\n\t(AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA)\n\tby mail.cs.helsinki.fi with esmtp; Thu, 18 Sep 2008 22:34:23 +0300\n\tid 0005BEBB.48D2AD3F.00006E77","by wrl-59.cs.helsinki.fi (Postfix, from userid 50795)\n\tid CB98DA0095; Thu, 18 Sep 2008 22:34:22 +0300 (EEST)","from localhost (localhost [127.0.0.1])\n\tby wrl-59.cs.helsinki.fi (Postfix) with ESMTP id B490DA006C;\n\tThu, 18 Sep 2008 22:34:22 +0300 (EEST)"],"Date":"Thu, 18 Sep 2008 22:34:22 +0300 (EEST)","From":"\"=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=\" <ilpo.jarvinen@helsinki.fi>","X-X-Sender":"ijjarvin@wrl-59.cs.helsinki.fi","To":"Ivan Vecera <ivecera@redhat.com>","cc":"Francois Romieu <romieu@fr.zoreil.com>, netdev@vger.kernel.org,\n\tEdward Hsu <edward_hsu@realtek.com.tw>","Subject":"Re: [PATCH] r8169: read MAC address from EEPROM on init","In-Reply-To":"<48D25BA2.6070008@redhat.com>","Message-ID":"<Pine.LNX.4.64.0809182232230.4742@wrl-59.cs.helsinki.fi>","References":"<48D25BA2.6070008@redhat.com>","Mime-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1205,"web_url":"http://patchwork.ozlabs.org/comment/1205/","msgid":"<Pine.LNX.4.64.0809182235550.4742@wrl-59.cs.helsinki.fi>","list_archive_url":null,"date":"2008-09-18T19:53:20","subject":"Re: [PATCH] r8169: read MAC address from EEPROM on init","submitter":{"id":255,"url":"http://patchwork.ozlabs.org/api/people/255/","name":"Ilpo Järvinen","email":"ilpo.jarvinen@helsinki.fi"},"content":"On Thu, 18 Sep 2008, Ivan Vecera wrote:\n> This fixes the problem when MAC address is set by ifconfig or by\n> ip link commands and this address is stored in the device after\n> reboot. The power-off is needed to get right MAC address.\n> This is problem when Xen daemon is running because it renames the device\n> name from ethX to pethX and sets its MAC address to FE:FF:FF:FF:FF:FF.\n> After reboot the device is still using FE:FF:FF:FF:FF:FF.\n> \n> Signed-off-by: Ivan Vecera <ivecera@redhat.com>\n> ---\n>  drivers/net/r8169.c |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++-\n>  1 files changed, 79 insertions(+), 1 deletions(-)\n> \n> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c\n> index befc927..b09a4ec 100644\n> --- a/drivers/net/r8169.c\n> +++ b/drivers/net/r8169.c\n\n...\n\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 \nendianness bug.","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 BC7D8DDEE9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 19 Sep 2008 05:53:28 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755205AbYIRTxX (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 18 Sep 2008 15:53:23 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1754298AbYIRTxX\n\t(ORCPT <rfc822; netdev-outgoing>); Thu, 18 Sep 2008 15:53:23 -0400","from courier.cs.helsinki.fi ([128.214.9.1]:35112 \"EHLO\n\tmail.cs.helsinki.fi\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1754575AbYIRTxW (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 18 Sep 2008 15:53:22 -0400","from wrl-59.cs.helsinki.fi (wrl-59.cs.helsinki.fi\n\t[128.214.166.179])\n\t(AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA)\n\tby mail.cs.helsinki.fi with esmtp; Thu, 18 Sep 2008 22:53:21 +0300\n\tid 0005BEA2.48D2B1B1.00001B25","by wrl-59.cs.helsinki.fi (Postfix, from userid 50795)\n\tid 521B5A0095; Thu, 18 Sep 2008 22:53:21 +0300 (EEST)","from localhost (localhost [127.0.0.1])\n\tby wrl-59.cs.helsinki.fi (Postfix) with ESMTP id 4E65BA006C;\n\tThu, 18 Sep 2008 22:53:21 +0300 (EEST)"],"Date":"Thu, 18 Sep 2008 22:53:20 +0300 (EEST)","From":"\"=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=\" <ilpo.jarvinen@helsinki.fi>","X-X-Sender":"ijjarvin@wrl-59.cs.helsinki.fi","To":"Ivan Vecera <ivecera@redhat.com>","cc":"Francois Romieu <romieu@fr.zoreil.com>, Netdev <netdev@vger.kernel.org>,\n\tEdward Hsu <edward_hsu@realtek.com.tw>","Subject":"Re: [PATCH] r8169: read MAC address from EEPROM on init","In-Reply-To":"<48D25BA2.6070008@redhat.com>","Message-ID":"<Pine.LNX.4.64.0809182235550.4742@wrl-59.cs.helsinki.fi>","References":"<48D25BA2.6070008@redhat.com>","Mime-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]