Several minor bug fixes in the cxgb4vf driver ...
[01/05]: Virtual Interfaces are always up ...
[02/05]: Check driver parameters in the right place ...
[03/05]: Behave properly when CONFIG_DEBUG_FS isn't defined ...
[04/05]: Quiesce Virtual Interfaces on shutdown ...
[05/05]: Use defined Mailbox Timeout
drivers/net/cxgb4vf/cxgb4vf_main.c | 110 ++++++++++++++++++++++++++++--------
drivers/net/cxgb4vf/t4vf_hw.c | 2 +-
2 files changed, 88 insertions(+), 24 deletions(-)
VF Driver should use mailbox command timeout specified in t4fw_interface.h
rather than hard-coded value of 500ms.
Signed-off-by: Casey Leedom <redacted>
---
drivers/net/cxgb4vf/t4vf_hw.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Implement new default mode of always reporting the Virtual Interface link as
being "up". This allows different Virtual Interfaces on the same port to
continue to communicate with each other even when the physical port link is
down. This new behavior is controlled via the module parameter
force_link_up (default 1). The old behavior can be achieved by setting
force_link_up=0.
Signed-off-by: Casey Leedom <redacted>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
@@ -96,6 +96,18 @@ module_param(msi, int, 0644);MODULE_PARM_DESC(msi,"whether to use MSI-X or MSI");/*+*TheVirtualInterfacesareconnectedtoaninternalswitchonthechip+*whichallowsVIsattachedtothesameporttotalktoeachotherevenwhen+*theportlinkisdown.Asaresult,wegenerallywanttoalwaysreporta+*VI'slinkasbeing"up".+*/+staticintforce_link_up=1;++module_param(force_link_up,int,0644);+MODULE_PARM_DESC(force_link_up,"always report link up");+++/**Fundamentalconstants.*======================*/
@@ -151,7 +163,8 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)return;/*-*TelltheOSthatthelinkstatushaschangedandprintashort+*TelltheOSthatthelinkstatushaschanged(ifwe'renot+*operatingintheforcedlink"up"mode)andprintashort*informativemessageontheconsoleabouttheevent.*/if(link_ok){
@@ -159,7 +172,8 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)constchar*fc;conststructport_info*pi=netdev_priv(dev);-netif_carrier_on(dev);+if(!force_link_up)+netif_carrier_on(dev);switch(pi->link_cfg.speed){caseSPEED_10000:
@@ -200,7 +214,9 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)printk(KERN_INFO"%s: link up, %s, full-duplex, %s PAUSE\n",dev->name,s,fc);}else{-netif_carrier_off(dev);+if(!force_link_up)+netif_carrier_off(dev);+printk(KERN_INFO"%s: link down\n",dev->name);}}
@@ -254,6 +270,14 @@ static int link_start(struct net_device *dev)*/if(ret==0)ret=t4vf_enable_vi(pi->adapter,pi->viid,true,true);++/*+*Ifwedidn'texperienceanyerrorandwe'realwaysreportingthe+*linkasbeing"up",telltheOSthatthelinkisup.+*/+if(ret==0&&force_link_up)+netif_carrier_on(dev);+returnret;}
When CONFIG_DEBUG_FS we get "ERR_PTR()"s back from the debugfs routines
instead of NULL. Use the right predicates to check for this.
Signed-off-by: Casey Leedom <redacted>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
@@ -2940,12 +2940,12 @@ static int __init cxgb4vf_module_init(void)/* Debugfs support is optional, just warn if this fails */cxgb4vf_debugfs_root=debugfs_create_dir(KBUILD_MODNAME,NULL);-if(!cxgb4vf_debugfs_root)+if(IS_ERR_OR_NULL(cxgb4vf_debugfs_root))printk(KERN_WARNINGKBUILD_MODNAME": could not create"" debugfs entry, continuing\n");ret=pci_register_driver(&cxgb4vf_driver);-if(ret<0)+if(ret<0&&!IS_ERR_OR_NULL(cxgb4vf_debugfs_root))debugfs_remove(cxgb4vf_debugfs_root);returnret;}
@@ -2513,17 +2513,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,structnet_device*netdev;/*-*Vetourmoduleparameters.-*/-if(msi!=MSI_MSIX&&msi!=MSI_MSI){-dev_err(&pdev->dev,"bad module parameter msi=%d; must be %d"-" (MSI-X or MSI) or %d (MSI)\n",msi,MSI_MSIX,-MSI_MSI);-err=-EINVAL;-gotoerr_out;-}--/**Printourdriverbannerthefirsttimewe'recalledtoinitializea*device.*/
@@ -2939,6 +2927,17 @@ static int __init cxgb4vf_module_init(void){intret;+/*+*Vetourmoduleparameters.+*/+if(msi!=MSI_MSIX&&msi!=MSI_MSI){+printk(KERN_WARNINGKBUILD_MODNAME+": bad module parameter msi=%d; must be %d"+" (MSI-X or MSI) or %d (MSI)\n",+msi,MSI_MSIX,MSI_MSI);+return-EINVAL;+}+/* Debugfs support is optional, just warn if this fails */cxgb4vf_debugfs_root=debugfs_create_dir(KBUILD_MODNAME,NULL);if(!cxgb4vf_debugfs_root)
When a Virtual Machine is rebooted, KVM currently fails to issue a Function
Level Reset against any "Attached PCI Devices" (AKA "PCI Passthrough"). In
addition to leaving the attached device in a random state in the next booted
kernel (which sort of violates the entire idea of a reboot reseting hardware
state), this leaves our peer thinking that the link is still up. (Note that
a bug has been filed with the KVM folks, #25332, but there's been no
response on that as of yet.) So, we add a "->shutdown()" method for the
Virtual Function PCI Device to handle administrative shutdowns like a
reboot.
Signed-off-by: Casey Leedom <redacted>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 41 ++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
Implement new default mode of always reporting the Virtual Interface link as
being "up". This allows different Virtual Interfaces on the same port to
continue to communicate with each other even when the physical port link is
down. This new behavior is controlled via the module parameter
force_link_up (default 1). The old behavior can be achieved by setting
force_link_up=0.
Signed-off-by: Casey Leedom <redacted>
No driver specific module parameters! Add something generic and common
so other drivers can use it too.
Otherwise every user has to learn a different way to control this
attribute, depending upon the device type, which is rediculious.
How many times do we have to tell driver authors this?
When a Virtual Machine is rebooted, KVM currently fails to issue a Function
Level Reset against any "Attached PCI Devices" (AKA "PCI Passthrough"). In
addition to leaving the attached device in a random state in the next booted
kernel (which sort of violates the entire idea of a reboot reseting hardware
state), this leaves our peer thinking that the link is still up. (Note that
a bug has been filed with the KVM folks, #25332, but there's been no
response on that as of yet.) So, we add a "->shutdown()" method for the
Virtual Function PCI Device to handle administrative shutdowns like a
reboot.
Signed-off-by: Casey Leedom <redacted>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 41 ++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
You could invoke pci_reset_function as an alternative, that would make sure FLR happens.
-Anirban
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
| From: Anirban Chakraborty [off-list ref]
| Date: Friday, February 11, 2011 11:17 pm
|
|
| You could invoke pci_reset_function as an alternative, that would make sure
| FLR happens.
I'd love to do that but pci_reset_function() ends up taking the device
semaphore in the underlaying routine pci_dev_reset(). I used to call
pci_reset_function() in my probe() routine till 2.6.31 where that lock as added
... which resulted in an instant self-deadlock ...
Casey
| From: David Miller [off-list ref]
| Date: Friday, February 11, 2011 09:19 pm
|
| From: Casey Leedom [off-list ref]
| Date: Fri, 11 Feb 2011 17:00:19 -0800
|
| > Implement new default mode of always reporting the Virtual Interface link
| > as being "up". This allows different Virtual Interfaces on the same
| > port to continue to communicate with each other even when the physical
| > port link is down. This new behavior is controlled via the module
| > parameter
| > force_link_up (default 1). The old behavior can be achieved by setting
| > force_link_up=0.
| >
| > Signed-off-by: Casey Leedom [off-list ref]
|
| No driver specific module parameters! Add something generic and common
| so other drivers can use it too.
|
| Otherwise every user has to learn a different way to control this
| attribute, depending upon the device type, which is rediculious.
|
| How many times do we have to tell driver authors this?
Sorry. I wasn't aware of this rule. My bad. Is this writeen down somewhere
under Documentation? I'm not being snarky. I really would like to know so I
can read through the general ground rules and avoid making more mistakes in the
future.
As for a generic mechanism, what's the preferred way of doing this? A new
ethtool flag? Sorry for being a doofus here, I'm happy to follow whatever the
accepted standard is. Thanks for your time and patience.
Casey
| From: Casey Leedom [off-list ref]
| Date: Monday, February 14, 2011 11:13 am
|
| | No driver specific module parameters! Add something generic and common
| | so other drivers can use it too.
| |
| | Otherwise every user has to learn a different way to control this
| | attribute, depending upon the device type, which is rediculious.
| |
| | How many times do we have to tell driver authors this?
|
| Sorry. I wasn't aware of this rule. My bad. Is this writeen down
| somewhere under Documentation? I'm not being snarky. I really would like
| to know so I can read through the general ground rules and avoid making
| more mistakes in the future.
|
| As for a generic mechanism, what's the preferred way of doing this? A
| new ethtool flag? Sorry for being a doofus here, I'm happy to follow
| whatever the accepted standard is. Thanks for your time and patience.
Also, I assume then the the entire patch series is now rejected, right? And
that I should resubmit the patch series without the unacceptable module
parameter, right? I'm just trying to figure out what I need to do next.
Thanks.
Casey
| From: Casey Leedom [off-list ref]
| Date: Monday, February 14, 2011 11:13 am
|
| | No driver specific module parameters! Add something generic and common
| | so other drivers can use it too.
| |
| | Otherwise every user has to learn a different way to control this
| | attribute, depending upon the device type, which is rediculious.
| |
| | How many times do we have to tell driver authors this?
|
| Sorry. I wasn't aware of this rule. My bad. Is this writeen down
| somewhere under Documentation? I'm not being snarky. I really would like
| to know so I can read through the general ground rules and avoid making
| more mistakes in the future.
|
| As for a generic mechanism, what's the preferred way of doing this? A
| new ethtool flag? Sorry for being a doofus here, I'm happy to follow
| whatever the accepted standard is. Thanks for your time and patience.
Also, I assume then the the entire patch series is now rejected, right? And
that I should resubmit the patch series without the unacceptable module
parameter, right? I'm just trying to figure out what I need to do next.
You need to resubmit the whole series, because changing an earlier
patch causes the subsequent ones to have, at a minimum, offsets which
GIT apply will reject.