smb/client: print "Unknown" instead of bogus link speed value
authorSteve French <stfrench@microsoft.com>
Fri, 16 Jun 2023 01:28:50 +0000 (20:28 -0500)
committerSteve French <stfrench@microsoft.com>
Fri, 16 Jun 2023 01:39:00 +0000 (20:39 -0500)
commit40acd384735c75ad09d9797aa38bb08e8defa323
tree0fa9a1e5a18291fd8cf2b02a5f9ffc42a2b2b164
parent81a819c4c96e9720942f3a337f4fcd8d393e75f4
smb/client: print "Unknown" instead of bogus link speed value

The virtio driver for Linux guests will not set a link speed to its
paravirtualized NICs.  This will be seen as -1 in the ethernet layer, and
when some servers (e.g. samba) fetches it, it's converted to an unsigned
value (and multiplied by 1000 * 1000), so in client side we end up with:

   1)      Speed: 4294967295000000 bps

in DebugData.

This patch introduces a helper that returns a speed string (in Mbps or
Gbps) if interface speed is valid (>= SPEED_10 and <= SPEED_800000), or
"Unknown" otherwise.

The reason to not change the value in iface->speed is because we don't
know the real speed of the HW backing the server NIC, so let's keep
considering these as the fastest NICs available.

Also print "Capabilities: None" when the interface doesn't support any.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifs_debug.c