ecki / net-tools

Linux base networking tools
GNU General Public License v2.0
248 stars 95 forks source link

[mii-tool]Can't change mode! #15

Open jiangqii opened 4 years ago

jiangqii commented 4 years ago

Enviroment:

0001:2c:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 128 bytes
        Interrupt: pin D routed to IRQ 277
        NUMA node: 0
        Region 0: Memory at f0e1c60000 (32-bit, non-prefetchable) [size=128K]
        Region 2: I/O ports at f600003060 [disabled] [size=32]
        Region 3: Memory at f0e1c8c000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>
        Kernel driver in use: igb

mii-tool -F 100baseTx-HD enP1p44s0f3

SIOCSMIIREG on enP1p44s0f3 failed: Operation not supported

##############################################################

ethtool enP1p44s0f3

Settings for enP1p44s0f3: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: off (auto) Cannot get wake-on-lan settings: Operation not permitted Current message level: 0x00000007 (7) drv probe link Link detected: yes

ethtool -s enP1p44s0f3 autoneg off speed 100 duplex half

ethtool enP1p44s0f3

Settings for enP1p44s0f3: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: Symmetric Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 100Mb/s Duplex: Half Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: off MDI-X: off (auto) Cannot get wake-on-lan settings: Operation not permitted Current message level: 0x00000007 (7) drv probe link Link detected: yes


**my opinion**
- Is it a problem with the mii module? Because mii is not loaded after igb is loaded
- Problems with the software itself (if there is no mii module)

**man page**

DIAGNOSTICS SIOCGMIIPHY on 'eth?' failed: Operation not supported The interface in question does not support MII queries. Most likely, it does not have MII transceivers, at all.


And It seem that NIC supported.
![image](https://user-images.githubusercontent.com/45223669/75642385-4f075b80-5c76-11ea-9df4-7898f87db9b9.png)
ecki commented 4 years ago

Is ethtool working or not? (I.e. is it communicating?), not sure from the output.

Can you also write two strace files of the two tools?

jiangqii commented 4 years ago

mii-tool

# strace mii-tool -F 100baseTx-HD enP1p44s0f3
execve("/sbin/mii-tool", ["mii-tool", "-F", "100baseTx-HD", "enP1p44s0f3"], 0x11f914228 /* 17 vars */) = 0
brk(NULL)                               = 0x122010000
uname({sysname="Linux", nodename="deepin-PC", ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20009df0000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (没有那个文件或目录)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=75065, ...}) = 0
mmap(NULL, 75065, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2000009a000
close(3)                                = 0
open("/lib/libc.so.6.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\26\231\1\0\0\0@\307\2\0\0\0\0\0"..., 832) = 832
fstat64(3, {st_mode=S_IFREG|0755, st_size=1903016, ...}) = 0
mmap(NULL, 1976704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x20007b70000
mprotect(0x20007d36000, 65536, PROT_NONE) = 0
mmap(0x20007d46000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c6000) = 0x20007d46000
mmap(0x20007d50000, 10624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x20007d50000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2000be80000
mprotect(0x20007d46000, 16384, PROT_READ) = 0
mprotect(0x120014000, 8192, PROT_READ)  = 0
mprotect(0x2000f060000, 8192, PROT_READ) = 0
munmap(0x2000009a000, 75065)            = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGMIIPHY, 0x120016428)      = 0
ioctl(3, SIOCSMIIREG, 0x120016428)      = -1 EOPNOTSUPP (不支持的操作)
write(2, "SIOCSMIIREG on enP1p44s0f3 faile"..., 59SIOCSMIIREG on enP1p44s0f3 failed: Operation not supported
) = 59
close(3)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

ethtool

# strace ethtool -s enP1p44s0f3 speed 100 duplex half autoneg off
execve("/sbin/ethtool", ["ethtool", "-s", "enP1p44s0f3", "speed", "100", "duplex", "half", "autoneg", "off"], 0x11fd86210 /* 17 vars */) = 0
brk(NULL)                               = 0x12069a000
uname({sysname="Linux", nodename="deepin-PC", ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20003cb4000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (没有那个文件或目录)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=75065, ...}) = 0
mmap(NULL, 75065, PROT_READ, MAP_PRIVATE, 3, 0) = 0x20002668000
close(3)                                = 0
open("/lib/libm.so.6.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\26\231\1\0\0\0\360\217\0\0\0\0\0\0"..., 832) = 832
fstat64(3, {st_mode=S_IFREG|0755, st_size=1341592, ...}) = 0
mmap(NULL, 1404848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2000ea60000
mprotect(0x2000eba0000, 57344, PROT_NONE) = 0
mmap(0x2000ebae000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13e000) = 0x2000ebae000
close(3)                                = 0
open("/lib/libc.so.6.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\26\231\1\0\0\0@\307\2\0\0\0\0\0"..., 832) = 832
fstat64(3, {st_mode=S_IFREG|0755, st_size=1903016, ...}) = 0
mmap(NULL, 1976704, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2000ebb8000
mprotect(0x2000ed7e000, 65536, PROT_NONE) = 0
mmap(0x2000ed8e000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c6000) = 0x2000ed8e000
mmap(0x2000ed98000, 10624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2000ed98000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x20009db4000
mprotect(0x2000ed8e000, 16384, PROT_READ) = 0
mprotect(0x2000ebae000, 8192, PROT_READ) = 0
mprotect(0x120066000, 8192, PROT_READ)  = 0
mprotect(0x20005764000, 8192, PROT_READ) = 0
munmap(0x20002668000, 75065)            = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCETHTOOL, 0x11fb88050)      = 0
ioctl(3, SIOCETHTOOL, 0x11fb88050)      = 0
brk(NULL)                               = 0x12069a000
brk(0x1206bc000)                        = 0x1206bc000
ioctl(3, SIOCETHTOOL, 0x11fb88050)      = 0
exit_group(0)                           = ?
+++ exited with 0 +++

ethtool can work.I use ping.

ecki commented 3 years ago

Hm yeah looks like it only supports the SIOCETHTOOL but not the SIOCSMIIREG ioctl, that could be expected, I am not sure how the current strategy of driver makers is in this regard. mii-tool might be deprecated for a reason. We probably could add a fallback on ENOTSUPP - not sure how compatible the parameter logic is. Anybody tried this? (there is no change for this in 2.10 AFAIK).