cxgb4vf: minor bug fixes -- revised patch set
Subsystems (2)
cover cxgb4vf: minor bug fixes -- revised patch set
This is the same as the previous patch set but with the unacceptable patch
removed. Let me know if there's anything else I should do. Thanks and sorry for not know the rules about that unacceptable patch.
[01/04]: Check driver parameters in the right place ... [02/04]: Behave properly when CONFIG_DEBUG_FS isn't defined ... [03/04]: Quiesce Virtual Interfaces on shutdown ... [04/04]: Use defined Mailbox Timeout
drivers/net/cxgb4vf/cxgb4vf_main.c | 80 +++++++++++++++++++++++++++--------- drivers/net/cxgb4vf/t4vf_hw.c | 2 +- 2 files changed, 61 insertions(+), 21 deletions(-)
PATCH 1/4 cxgb4vf: Check driver parameters in the right place ...
Check module parameter validity in the module initialization routine instead of the PCI Device Probe routine.
--- drivers/net/cxgb4vf/cxgb4vf_main.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/cxgb4vf/cxgb4vf_main.c +11 -12
@@ -2489,17 +2489,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,struct net_device *netdev;/* -* Vet our module parameters. -*/ -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 ; - goto err_out; - } - -/* * Print our driver banner the first time we're called to initialize a * device. */
@@ -2802,7 +2791,6 @@ err_release_regions: err_disable_device:pci_disable_device (pdev); -err_out:return err; }
@@ -2915,6 +2903,17 @@ static int __init cxgb4vf_module_init(void) {int ret; +/* +* Vet our module parameters. +*/ +if (msi !=MSI_MSIX && msi !=MSI_MSI ) { + printk(KERN_WARNING KBUILD_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)
Signature · 1 line
1.7.0.4
PATCH 2/4 cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined ...
In reply to Casey LeedomWhen CONFIG_DEBUG_FS we get "ERR_PTR()"s back from the debugfs routines instead of NULL. Use the right predicates to check for this.
--- drivers/net/cxgb4vf/cxgb4vf_main.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/cxgb4vf/cxgb4vf_main.c +8 -8
@@ -2040,7 +2040,7 @@ static int __devinit setup_debugfs(struct adapter *adapter) {int i; -BUG_ON (adapter->debugfs_root ==NULL ); +BUG_ON (IS_ERR_OR_NULL (adapter->debugfs_root));/* * Debugfs support is best effort.
@@ -2061,7 +2061,7 @@ static int __devinit setup_debugfs(struct adapter *adapter)*/ static void cleanup_debugfs (struct adapter *adapter) { -BUG_ON (adapter->debugfs_root ==NULL ); +BUG_ON (IS_ERR_OR_NULL (adapter->debugfs_root));/* * Unlike our sister routine cleanup_proc(), we don't need to remove
@@ -2700,11 +2700,11 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,/* * Set up our debugfs entries. */ -if (cxgb4vf_debugfs_root) { +if (!IS_ERR_OR_NULL (cxgb4vf_debugfs_root)) { adapter->debugfs_root =debugfs_create_dir (pci_name (pdev), cxgb4vf_debugfs_root); -if (adapter->debugfs_root ==NULL ) +if (IS_ERR_OR_NULL (adapter->debugfs_root))dev_warn (&pdev->dev,"could not create debugfs" " directory" );else
@@ -2759,7 +2759,7 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,*/ err_free_debugfs: -if (adapter->debugfs_root) { +if (!IS_ERR_OR_NULL (adapter->debugfs_root)) {cleanup_debugfs (adapter);debugfs_remove_recursive (adapter->debugfs_root); }
@@ -2828,7 +2828,7 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev)/* * Tear down our debugfs entries. */ -if (adapter->debugfs_root) { +if (!IS_ERR_OR_NULL (adapter->debugfs_root)) {cleanup_debugfs (adapter);debugfs_remove_recursive (adapter->debugfs_root); }
@@ -2916,12 +2916,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_WARNING KBUILD_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);return ret; }
Signature · 1 line
1.7.0.4
PATCH 3/4 cxgb4vf: Quiesce Virtual Interfaces on shutdown ...
In reply to Casey LeedomWhen 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.
--- drivers/net/cxgb4vf/cxgb4vf_main.c | 41 ++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-)
drivers/net/cxgb4vf/cxgb4vf_main.c +41 -0
@@ -2862,6 +2862,46 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev) }/* +* "Shutdown" quiesce the device, stopping Ingress Packet and Interrupt +* delivery. +*/ +static void __devexit cxgb4vf_pci_shutdown(struct pci_dev *pdev) +{ +struct adapter *adapter; +int pidx; + + adapter =pci_get_drvdata (pdev); +if (!adapter) +return ; + +/* +* Disable all Virtual Interfaces. This will shut down the +* delivery of all ingress packets into the chip for these +* Virtual Interfaces. +*/ +for_each_port (adapter, pidx) { +struct net_device *netdev; +struct port_info *pi; + +if (!test_bit (pidx, &adapter->registered_device_map)) +continue ; + + netdev = adapter->port[pidx]; +if (!netdev) +continue ; + + pi =netdev_priv (netdev); +t4vf_enable_vi (adapter, pi->viid, false, false); + } + +/* +* Free up all Queues which will prevent further DMA and +* Interrupts allowing various internal pathways to drain. +*/ +t4vf_free_sge_resources (adapter); +} + +/* * PCI Device registration data structures. */ #define CH_DEVICE (devid, idx) \
@@ -2894,6 +2934,7 @@ static struct pci_driver cxgb4vf_driver = { .id_table = cxgb4vf_pci_tbl, .probe = cxgb4vf_pci_probe, .remove = __devexit_p(cxgb4vf_pci_remove), + .shutdown = __devexit_p(cxgb4vf_pci_shutdown), };/*
Signature · 1 line
1.7.0.4
PATCH 4/4 cxgb4vf: Use defined Mailbox Timeout
In reply to Casey LeedomVF Driver should use mailbox command timeout specified in t4fw_interface.h rather than hard-coded value of 500ms.
--- drivers/net/cxgb4vf/t4vf_hw.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/cxgb4vf/t4vf_hw.c +1 -1
@@ -171,7 +171,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, delay_idx =0 ; ms = delay[0 ]; -for (i =0 ; i <500 ; i += ms) { +for (i =0 ; i <FW_CMD_MAX_TIMEOUT ; i += ms) {if (sleep_ok) { ms = delay[delay_idx];if (delay_idx <ARRAY_SIZE (delay) -1 )
Signature · 1 line
1.7.0.4
David Miller
maintainerFrom: Casey Leedom <[email protected]>
Date: Mon, 14 Feb 2011 14:56:21 -0800
Quoted 4 lines
[01/04]: Check driver parameters in the right place ... [02/04]: Behave properly when
CONFIG_DEBUG_FSisn't defined ... [03/04]: Quiesce Virtual Interfaces on shutdown ... [04/04]: Use defined Mailbox Timeout
All applied, thanks.