Bug 228556 - igb link status is not updating properly when configured as VF driver in guest OS
Summary: igb link status is not updating properly when configured as VF driver in gues...
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords: IntelNetworking, patch
Depends on:
Blocks:
 
Reported: 2018-05-28 05:53 UTC by Gokul
Modified: 2019-03-31 14:50 UTC (History)
4 users (show)

See Also:


Attachments
patch file to fix igb vf driver link issue (674 bytes, patch)
2018-05-28 05:53 UTC, Gokul
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gokul 2018-05-28 05:53:59 UTC
Created attachment 193773 [details]
patch file to fix igb vf driver link issue

When we use igb driver as Virtual function driver , link status is not updating once after link is up. Because of the same , if physical link went down , the status will not be updated at freebsd VF interface if its present state is link UP.  


Following patch should resolve the issue .

gokulcg@/$ cat igb_link.patch
Index: sys/dev/e1000/e1000_vf.c
===================================================================
--- sys/dev/e1000/e1000_vf.c	(revision 334275)
+++ sys/dev/e1000/e1000_vf.c	(working copy)
@@ -546,10 +546,11 @@
 	 * or a virtual function reset
 	 */

-	/* If we were hit with a reset or timeout drop the link */
-	if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout)
+	/* If we were hit with a reset or timeout or physical link is down drop the link */
+	if (!mbx->ops.check_for_rst(hw, 0) || !mbx->timeout || \
+            !(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		mac->get_link_status = TRUE;
-
+        }
 	if (!mac->get_link_status)
 		goto out;
Comment 1 Sean Bruno freebsd_committer 2018-05-29 14:49:05 UTC
(In reply to Gokul from comment #0)
What is the configuration you are using to host the FreeBSD VM?
Comment 2 Gokul 2018-05-31 06:30:35 UTC
(In reply to Sean Bruno from comment #1)
Its a 64bit linux 

>>3.10.100-ovp-rt110-WR6.0.0.31_preempt-rt #1 SMP Tue Mar 13 01:59:51 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

Driver details : 
root@:~# modinfo igb
filename:       /lib/modules/3.10.100-ovp-rt110-WR6.0.0.31_preempt-rt/kernel/drivers/net/ethernet/intel/igb/igb.ko
version:        5.0.5-k
license:        GPL
description:    Intel(R) Gigabit Ethernet Network Driver
author:         Intel Corporation, <e1000-devel@lists.sourceforge.net>

hypervisor : QEMU
root@:~# /usr/bin/qemu-system-x86_64 -version
QEMU emulator version 1.7.2, Copyright (c) 2003-2008 Fabrice Bellard
root@:~#
Comment 3 Gokul 2018-05-31 06:30:55 UTC
(In reply to Sean Bruno from comment #1)
Its a 64bit linux 

>>3.10.100-ovp-rt110-WR6.0.0.31_preempt-rt #1 SMP Tue Mar 13 01:59:51 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

Driver details : 
root@:~# modinfo igb
filename:       /lib/modules/3.10.100-ovp-rt110-WR6.0.0.31_preempt-rt/kernel/drivers/net/ethernet/intel/igb/igb.ko
version:        5.0.5-k
license:        GPL
description:    Intel(R) Gigabit Ethernet Network Driver
author:         Intel Corporation, <e1000-devel@lists.sourceforge.net>

hypervisor : QEMU
root@:~# /usr/bin/qemu-system-x86_64 -version
QEMU emulator version 1.7.2, Copyright (c) 2003-2008 Fabrice Bellard
root@:~#
Comment 4 Gokul 2018-05-31 06:44:26 UTC
Additional Info: 

If we make link down from host via command > 'ip link set down ethX' , guest will get reset indication and link status will update as 'DOWN' .
But if actual physical link is down then it will not update properly 

For eg: 

1) When physical link is up , VF will show as link 'UP'
root@/# ip link show eth2
6: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
    link/ether 00:a0:c9:00:00:01 brd ff:ff:ff:ff:ff:ff
    vf 0 MAC 02:01:01:00:00:05, spoof checking on
root@/# 

2) When physical link is down , in this case , vf link status will be link 'UP' as per current source code. 

root@/#  ip link show eth2
6: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
    link/ether 00:a0:c9:00:00:01 brd ff:ff:ff:ff:ff:ff
    vf 0 MAC 02:01:01:00:00:05, spoof checking on 
root@/# 

3) make link down using software , in this case VF will get reset indication and link status will be updated as 'DOWN'

root@/#  ip link set down eth2
root@/#  ip link show eth2
6: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
    link/ether 00:a0:c9:00:00:01 brd ff:ff:ff:ff:ff:ff
    vf 0 MAC 02:01:01:00:00:05, spoof checking on
root@/#