Bug#856049: ethtool: Can not use --change-eeprom option

2017-02-24 Thread Yvan Masson
Thanks for this fast and precise answer!

> As for why the driver failed to access the EEPROM, I can't tell -
> there are several possible error cases.  It might be worth trying to
> pass the EEPROM contents as a binary file on stdin, instead of trying
> to set a single byte.

I already tried this, and if I am not wrong in the procedure, this
produces the same error:
- dump EEPROM from working NIC on another laptop:
ethtool --eeprom-dump enp2s1 raw on > dump
- write dump file on faulty NIC:
ethtool --change-eeprom enp2s1 magic 0x100e8086 < dump

> As the e1000 driver is no longer maintained by Intel, I'm afraid these
> bugs are unlikely to be fixed.

So I will have to try other ways :-(

Regards,
Yvan



pgpna0MAGgZyI.pgp
Description: Signature digitale OpenPGP


Bug#856049: ethtool: Can not use --change-eeprom option

2017-02-24 Thread Ben Hutchings
Control: reassign -1 src:linux 4.9.6-3
Control: retitle -1 e1000: EEPROM write failed on 82540EM
Control: tag -1 upstream

On Fri, 2017-02-24 at 19:52 +0100, Yvan Masson wrote:
> Package: ethtool
> Version: 1:4.8-1
> Severity: normal
> 
> Dear maintainer,
> 
> The EEPROM of my Ethernet NIC has been flushed for some unknown reason.
> I would like to use ethtool to restore my EEPROM (fortunately I have a
> dump).
> 
> Here is one simple "test command" I tried and which should be valid
> according to the manpage and examples found on the net:
> # ethtool --change-eeprom enp2s1 magic 0x100e8086 offset 0x10 length 1 \
> value 0xff
> 
> But unfortunately, I always get this error:
> "Cannot set EEPROM data: Operation not permitted"
> 
> I am probably missing something, in which case please apologize, but
> maybe it is really a bug/something we can not do anymore with recent
> kernels? Maybe what I am probably be missing should be written in the
> manpage or in /usr/share/doc/ethtool/...?
> 
> Do not hesitate to ask if i can provide more information.
[...]

The e1000 driver's low-level EEPROM access functions return error code
1 on failure, and this code is propagated all the way up to the ethtool
program.  But the standard meaning of error code 1 is "Operation not
permitted", so that's what ethtool shows.  So that's a bug in the
driver's error reporting.

As for why the driver failed to access the EEPROM, I can't tell - there
are several possible error cases.  It might be worth trying to pass the
EEPROM contents as a binary file on stdin, instead of trying to set a
single byte.

As the e1000 driver is no longer maintained by Intel, I'm afraid these
bugs are unlikely to be fixed.

Ben.

-- 
Ben Hutchings
All the simple programs have been written, and all the good names
taken.


signature.asc
Description: This is a digitally signed message part


Bug#856049: ethtool: Can not use --change-eeprom option

2017-02-24 Thread Yvan Masson
Package: ethtool
Version: 1:4.8-1
Severity: normal

Dear maintainer,

The EEPROM of my Ethernet NIC has been flushed for some unknown reason.
I would like to use ethtool to restore my EEPROM (fortunately I have a
dump).

Here is one simple "test command" I tried and which should be valid
according to the manpage and examples found on the net:
# ethtool --change-eeprom enp2s1 magic 0x100e8086 offset 0x10 length 1 \
value 0xff

But unfortunately, I always get this error:
"Cannot set EEPROM data: Operation not permitted"

I am probably missing something, in which case please apologize, but
maybe it is really a bug/something we can not do anymore with recent
kernels? Maybe what I am probably be missing should be written in the
manpage or in /usr/share/doc/ethtool/...?

Do not hesitate to ask if i can provide more information.

Best regards,
Yvan


# ethtool -e enp2s1
Offset  Values
--  --
0x: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


# lspci -vnn:
...
02:01.0 Ethernet controller [0200]: Intel Corporation 82540EM Gigabit
Ethernet Controller [8086:100e] (rev 03)
Subsystem: Intel Corporation 82540EM Gigabit Ethernet
Controller [8086:100e]
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 11
Memory at c022 (64-bit, non-prefetchable) [size=128K]
Memory at c020 (64-bit, non-prefetchable) [size=64K]
I/O ports at 8000 [size=64]
[virtual] Expansion ROM at c021 [disabled] [size=64K]
Capabilities: [dc] Power Management version 2
Capabilities: [e4] PCI-X non-bridge device
Capabilities: [f0] MSI: Enable- Count=1/1 Maskable- 64bit+
Kernel driver in use: e1000
Kernel modules: e1000


The dump I would like to restore at the end (I just need to change the
MAC address):
Offset  Values
--  --
0x: 00 01 6c cb 09 3c 00 0b ff ff ff ff ff ff ff ff 
0x0010: 00 00 00 00 0b 66 49 05 14 10 1e 10 86 80 a5 b1 
0x0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
0x0040: cf 00 61 78 0b 14 00 00 c8 04 ff ff ff ff ff ff 
0x0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff 02 06 
0x0060: 2c 01 00 40 11 12 ff ff ff ff ff ff ff ff ff ff 
0x0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff 7c fe 


You will also find attached the strace for the above command.



-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-1-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ethtool depends on:
ii  libc6  2.24-9

ethtool recommends no packages.

ethtool suggests no packages.

-- no debconf information


ethtool.strace
Description: Binary data


pgpPn3p0v4pWO.pgp
Description: Signature digitale OpenPGP