netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 08/10] chelsio: add MSI support
Date: Fri, 01 Dec 2006 16:36:20 -0800	[thread overview]
Message-ID: <20061202003707.741158000@osdl.org> (raw)
In-Reply-To: 20061202003612.573260000@osdl.org

[-- Attachment #1: chelsio-msi.patch --]
[-- Type: text/plain, Size: 1976 bytes --]

Using MSI can avoid sharing IRQ and associated overhead.
Tested on PCI-X.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

---
 drivers/net/chelsio/common.h |    1 +
 drivers/net/chelsio/cxgb2.c  |   20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

--- chelsio.orig/drivers/net/chelsio/common.h
+++ chelsio/drivers/net/chelsio/common.h
@@ -228,6 +228,7 @@ struct adapter_params {
 	unsigned short chip_revision;
 	unsigned char  chip_version;
 	unsigned char  is_asic;
+	unsigned char  has_msi;
 };
 
 struct link_config {
--- chelsio.orig/drivers/net/chelsio/cxgb2.c
+++ chelsio/drivers/net/chelsio/cxgb2.c
@@ -107,6 +107,10 @@ static int t1powersave = 1;	/* HW defaul
 module_param(t1powersave, int, 0);
 MODULE_PARM_DESC(t1powersave, "Enable/Disable T1 powersaving mode");
 
+static int disable_msi = 0;
+module_param(disable_msi, int, 0);
+MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
+
 static const char pci_speed[][4] = {
 	"33", "66", "100", "133"
 };
@@ -215,11 +219,19 @@ static int cxgb_up(struct adapter *adapt
 	}
 
 	t1_interrupts_clear(adapter);
-	if ((err = request_irq(adapter->pdev->irq,
-			       t1_select_intr_handler(adapter), IRQF_SHARED,
-			       adapter->name, adapter))) {
+
+	adapter->params.has_msi = !disable_msi && pci_enable_msi(adapter->pdev) == 0;
+	err = request_irq(adapter->pdev->irq,
+			  t1_select_intr_handler(adapter),
+			  adapter->params.has_msi ? 0 : IRQF_SHARED,
+			  adapter->name, adapter);
+	if (err) {
+		if (adapter->params.has_msi)
+			pci_disable_msi(adapter->pdev);
+
 		goto out_err;
 	}
+
 	t1_sge_start(adapter->sge);
 	t1_interrupts_enable(adapter);
  out_err:
@@ -234,6 +246,8 @@ static void cxgb_down(struct adapter *ad
 	t1_sge_stop(adapter->sge);
 	t1_interrupts_disable(adapter);
 	free_irq(adapter->pdev->irq, adapter);
+	if (adapter->params.has_msi)
+		pci_disable_msi(adapter->pdev);
 }
 
 static int cxgb_open(struct net_device *dev)

-- 


  parent reply	other threads:[~2006-12-02  0:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02  0:36 [PATCH 00/10] chelsio: 10G driver Stephen Hemminger
2006-12-02  0:36 ` [PATCH 01/10] chelsio: whitespace fixes Stephen Hemminger
2006-12-02  0:36 ` [PATCH 02/10] chelsio: use kzalloc Stephen Hemminger
2006-12-02  0:36 ` [PATCH 03/10] chelsio: remove unused mutex Stephen Hemminger
2006-12-02  0:36 ` [PATCH 05/10] chelsio: add 1G swcixw aupport Stephen Hemminger
2006-12-02  0:36 ` [PATCH 06/10] chelsio: cleanup pm3393 code Stephen Hemminger
2006-12-02  0:36 ` [PATCH 07/10] chelsio: use standard CRC routines Stephen Hemminger
2006-12-02  0:36 ` Stephen Hemminger [this message]
2006-12-02  0:36 ` [PATCH 09/10] chelsio: statistics improvement Stephen Hemminger
2006-12-02  0:36 ` [PATCH 10/10] chelesio: transmit locking (plus bug fix) Stephen Hemminger
2006-12-03 10:45   ` Eric Lemoine
2006-12-04 17:58     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061202003707.741158000@osdl.org \
    --to=shemminger@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).