lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-a7b6eb2e-598a-4ad0-9df5-7567cb544671-1416347483688@3capp-webde-bs54>
Date:	Tue, 18 Nov 2014 22:51:23 +0100
From:	"Roland Kletzing" <devzero@....de>
To:	netdev@...r.kernel.org
Cc:	"David Miller" <davem@...emloft.net>
Subject: [PATCH RESEND] fix #51791 - bug? mac 00:00:00:00:00:00 with natsemi
 DP83815 after driver load

This one should fix Bugzilla #51791 

Natsemi driver does not read MAC correctly from eeprom, while natsemi-diag
from nictools-pci does. Apparently, it`s a timing issue in the kernel driver.

According to ftp://ftp.gwdg.de/pub/linux/misc/donald.becker/diag/natsemi-diag.c
, eeprom_delay(ee_addr) is defined as follows:

/* Delay between EEPROM clock transitions.
This flushes the write buffer to prevent quick double-writes.
*/
#define eeprom_delay(ee_addr) inl(ee_addr); inl(ee_addr)

while in the natsemi linux kernel driver, the delay is done this way :

#define eeprom_delay(ee_addr) readl(ee_addr)

, which results in the MAC being all zero`s.

So i simply added a second readl() to increase delay (instead of turning into 
inl() as proposed before). This may look a little bit ugly, but it`s fixing the
problem for me.

I´m not sure how many natsemi users being left on this planet (probably few),
but i guess this change does not do any harm on platforms where the driver does
not behave buggy, so please consider adding it to mainline/stable/longterm.

regards
Roland


Signed-off-by: Roland Kletzing <devzero@....de>

---
drivers/net/ethernet/natsemi/natsemi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
index b83f7c0..96f0029 100644
--- a/drivers/net/ethernet/natsemi/natsemi.c
+++ b/drivers/net/ethernet/natsemi/natsemi.c
@@ -987,7 +987,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent)
    The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
    deprecated.
 */
-#define eeprom_delay(ee_addr)  readl(ee_addr)
+#define eeprom_delay(ee_addr)  readl(ee_addr);  readl(ee_addr)

 #define EE_Write0 (EE_ChipSelect)
 #define EE_Write1 (EE_ChipSelect | EE_DataIn)
--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ