safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
120 stars 69 forks source link

speed for bond type device is not correct #21

Closed jonnary closed 5 years ago

safchain commented 5 years ago

Can you tell me :

I just did a quick test with a bond and a veth, the speed is correctly reported.

ip link add name bond0 type bond
ip link add name veth1 type veth peer name veth0
ip link set veth1 master bond0
ip link set veth1 up
ip link set veth0 up
ip link set bond0 up

Thanks,

jonnary commented 5 years ago

With pleasure. Assume bond0 contains ens44f0 and ens44f1, the speed for ens44f1 is shown 65535. The real speed is10000. Maybe cause by unit16 left shift.

safchain commented 5 years ago

What is incorrect ? the bond0 speed or the speed of one interface belonging to the bond ? The title of the issue lead me think that it was the bond speed.

How do you retrieve the speed of the device ?

thanks.

safchain commented 5 years ago

So I checked and the value of 65535(-1) means unknown. I'm not sure there is an issue here. Maybe we could return an error in case of -1 in order to notify that the value is unknown.

jonnary commented 5 years ago

When Link detected is no.The speed can not be got. It's better to show "Unknown". I checked the problem again, the project safchain/ethtool is ok. Maybe we should improve it in skydive. [root@host_192_51_151_25 ~]# ethtool ens44f1 Settings for ens44f1: Supported ports: [ FIBRE ] Supported link modes: 1000baseT/Full 10000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 1000baseT/Full 10000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: Unknown! Duplex: Unknown! (255) Port: Other PHYAD: 0 Transceiver: external Auto-negotiation: on Supports Wake-on: umbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: no [root@host_192_51_151_25 ~]# ethtool ens44f0 Settings for ens44f0: Supported ports: [ FIBRE ] Supported link modes: 1000baseT/Full 10000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 1000baseT/Full 10000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 10000Mb/s Duplex: Full Port: Other PHYAD: 0 Transceiver: external Auto-negotiation: on Supports Wake-on: umbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes

safchain commented 5 years ago

Closing it for now as it is not related to this library. Please re-open if needed

jonnary commented 5 years ago

ok