@@ -151,12 +151,23 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
struct sockaddr_in *ipv4 = (struct sockaddr_in *)&iface->sockaddr;
struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)&iface->sockaddr;
- seq_printf(m, "\tSpeed: %zu bps\n", iface->speed);
+ /*
+ * Some servers will return an invalid (-1) link speed, e.g. virtio driver on Linux guests
+ * When the server parses it, it's cast to an unsigned value, and the field ends with a
+ * bogus value.
+ * Let's not print such values to avoid confusion.
+ */
+ if (iface->speed == ((u64)UINT_MAX * 1000 * 1000))
+ seq_printf(m, "\tSpeed: Unknown\n");
+ else
+ seq_printf(m, "\tSpeed: %zu bps\n", iface->speed);
seq_puts(m, "\t\tCapabilities: ");
if (iface->rdma_capable)
seq_puts(m, "rdma ");
if (iface->rss_capable)
seq_puts(m, "rss ");
+ if (!iface->rdma_capable && !iface->rss_capable)
+ seq_puts(m, "None");
seq_putc(m, '\n');
if (iface->sockaddr.ss_family == AF_INET)
seq_printf(m, "\t\tIPv4: %pI4\n", &ipv4->sin_addr);
The virtio driver for Linux guests will not set a link speed to its paravirtualized NICs. This will be shown as -1 in server settings, and when the SMB server (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 check if the speed we got is such value, and print "Unknown" instead. 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> --- fs/cifs/cifs_debug.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)