All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set
@ 2011-02-14 22:56 Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 1/4] cxgb4vf: Check driver parameters in the right place Casey Leedom
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Casey Leedom @ 2011-02-14 22:56 UTC (permalink / raw)
  To: netdev; +Cc: davem

  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(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-26 1/4] cxgb4vf: Check driver parameters in the right place ...
  2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
@ 2011-02-14 22:56 ` Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 2/4] cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined Casey Leedom
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2011-02-14 22:56 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

Check module parameter validity in the module initialization routine instead
of the PCI Device Probe routine.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/cxgb4vf_main.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 56166ae..072b64e 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -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)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-26 2/4] cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined ...
  2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 1/4] cxgb4vf: Check driver parameters in the right place Casey Leedom
@ 2011-02-14 22:56 ` Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 3/4] cxgb4vf: Quiesce Virtual Interfaces on shutdown Casey Leedom
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2011-02-14 22:56 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

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 <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/cxgb4vf_main.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 072b64e..2be1088 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -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;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-26 3/4] cxgb4vf: Quiesce Virtual Interfaces on shutdown ...
  2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 1/4] cxgb4vf: Check driver parameters in the right place Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 2/4] cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined Casey Leedom
@ 2011-02-14 22:56 ` Casey Leedom
  2011-02-14 22:56 ` [PATCH net-26 4/4] cxgb4vf: Use defined Mailbox Timeout Casey Leedom
  2011-02-15  1:37 ` [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2011-02-14 22:56 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

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 <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/cxgb4vf_main.c |   41 ++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 2be1088..6aad64d 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -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),
 };
 
 /*
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-26 4/4] cxgb4vf: Use defined Mailbox Timeout
  2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
                   ` (2 preceding siblings ...)
  2011-02-14 22:56 ` [PATCH net-26 3/4] cxgb4vf: Quiesce Virtual Interfaces on shutdown Casey Leedom
@ 2011-02-14 22:56 ` Casey Leedom
  2011-02-15  1:37 ` [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Casey Leedom @ 2011-02-14 22:56 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

VF Driver should use mailbox command timeout specified in t4fw_interface.h
rather than hard-coded value of 500ms.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/t4vf_hw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c
index 0f51c80..192db22 100644
--- a/drivers/net/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/cxgb4vf/t4vf_hw.c
@@ -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)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set
  2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
                   ` (3 preceding siblings ...)
  2011-02-14 22:56 ` [PATCH net-26 4/4] cxgb4vf: Use defined Mailbox Timeout Casey Leedom
@ 2011-02-15  1:37 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-02-15  1:37 UTC (permalink / raw)
  To: leedom; +Cc: netdev

From: Casey Leedom <leedom@chelsio.com>
Date: Mon, 14 Feb 2011 14:56:21 -0800

> [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

All applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-15  1:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 22:56 [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set Casey Leedom
2011-02-14 22:56 ` [PATCH net-26 1/4] cxgb4vf: Check driver parameters in the right place Casey Leedom
2011-02-14 22:56 ` [PATCH net-26 2/4] cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined Casey Leedom
2011-02-14 22:56 ` [PATCH net-26 3/4] cxgb4vf: Quiesce Virtual Interfaces on shutdown Casey Leedom
2011-02-14 22:56 ` [PATCH net-26 4/4] cxgb4vf: Use defined Mailbox Timeout Casey Leedom
2011-02-15  1:37 ` [PATCH net-26 0/4] cxgb4vf: minor bug fixes -- revised patch set David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.