netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Fleming <afleming@freescale.com>
To: davem@davemloft.net, jeff@garzik.org
Cc: netdev@vger.kernel.org, Haruki Dai <Dai.Haruki@freescale.com>,
	Dai Haruki <dai.haruki@freescale.com>,
	Andy Fleming <afleming@freescale.com>
Subject: [PATCH v2.6.29 v3 3/5] gianfar: Use interface name in interrupt name to distinguish the source.
Date: Wed, 17 Dec 2008 15:42:53 -0600	[thread overview]
Message-ID: <1229550175-15600-3-git-send-email-afleming@freescale.com> (raw)
In-Reply-To: <1229550175-15600-2-git-send-email-afleming@freescale.com>

From: Haruki Dai <Dai.Haruki@freescale.com>

Interface name (ex. eth0) is used as the prefix for the interrupt name,
with _rx, _tx, and _er appended to distinguish multiple interrupts on
the same interface.

Signed-off-by: Dai Haruki <dai.haruki@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
---
 drivers/net/gianfar.c |   30 ++++++++++++++++++++++++------
 drivers/net/gianfar.h |    7 +++++++
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 094387f..4d7c225 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -304,8 +304,9 @@ static int gfar_probe(struct of_device *ofdev,
 	u32 tempval;
 	struct net_device *dev = NULL;
 	struct gfar_private *priv = NULL;
-	int err = 0;
 	DECLARE_MAC_BUF(mac);
+	int err = 0;
+	int len_devname;
 
 	/* Create an ethernet device instance */
 	dev = alloc_etherdev(sizeof (*priv));
@@ -447,6 +448,23 @@ static int gfar_probe(struct of_device *ofdev,
 		goto register_fail;
 	}
 
+	/* fill out IRQ number and name fields */
+	len_devname = strlen(dev->name);
+	strncpy(&priv->int_name_tx[0], dev->name, len_devname);
+	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
+		strncpy(&priv->int_name_tx[len_devname],
+			"_tx", sizeof("_tx") + 1);
+
+		strncpy(&priv->int_name_rx[0], dev->name, len_devname);
+		strncpy(&priv->int_name_rx[len_devname],
+			"_rx", sizeof("_rx") + 1);
+
+		strncpy(&priv->int_name_er[0], dev->name, len_devname);
+		strncpy(&priv->int_name_er[len_devname],
+			"_er", sizeof("_er") + 1);
+	} else
+		priv->int_name_tx[len_devname] = '\0';
+
 	/* Create all the sysfs files */
 	gfar_init_sysfs(dev);
 
@@ -1020,7 +1038,7 @@ int startup_gfar(struct net_device *dev)
 		/* Install our interrupt handlers for Error,
 		 * Transmit, and Receive */
 		if (request_irq(priv->interruptError, gfar_error,
-				0, "enet_error", dev) < 0) {
+				0, priv->int_name_er, dev) < 0) {
 			if (netif_msg_intr(priv))
 				printk(KERN_ERR "%s: Can't get IRQ %d\n",
 					dev->name, priv->interruptError);
@@ -1030,7 +1048,7 @@ int startup_gfar(struct net_device *dev)
 		}
 
 		if (request_irq(priv->interruptTransmit, gfar_transmit,
-				0, "enet_tx", dev) < 0) {
+				0, priv->int_name_tx, dev) < 0) {
 			if (netif_msg_intr(priv))
 				printk(KERN_ERR "%s: Can't get IRQ %d\n",
 					dev->name, priv->interruptTransmit);
@@ -1041,7 +1059,7 @@ int startup_gfar(struct net_device *dev)
 		}
 
 		if (request_irq(priv->interruptReceive, gfar_receive,
-				0, "enet_rx", dev) < 0) {
+				0, priv->int_name_rx, dev) < 0) {
 			if (netif_msg_intr(priv))
 				printk(KERN_ERR "%s: Can't get IRQ %d (receive0)\n",
 						dev->name, priv->interruptReceive);
@@ -1051,10 +1069,10 @@ int startup_gfar(struct net_device *dev)
 		}
 	} else {
 		if (request_irq(priv->interruptTransmit, gfar_interrupt,
-				0, "gfar_interrupt", dev) < 0) {
+				0, priv->int_name_tx, dev) < 0) {
 			if (netif_msg_intr(priv))
 				printk(KERN_ERR "%s: Can't get IRQ %d\n",
-					dev->name, priv->interruptError);
+					dev->name, priv->interruptTransmit);
 
 			err = -1;
 			goto err_irq_fail;
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 7ef3cc5..06bac34 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -374,6 +374,8 @@ extern const char gfar_driver_version[];
 #define RXFCB_PERR_MASK		0x000c
 #define RXFCB_PERR_BADL3	0x0008
 
+#define GFAR_INT_NAME_MAX	IFNAMSIZ + 4
+
 struct txbd8
 {
 	union {
@@ -796,6 +798,11 @@ struct gfar_private {
 	uint32_t msg_enable;
 
 	struct work_struct reset_task;
+
+	char int_name_tx[GFAR_INT_NAME_MAX];
+	char int_name_rx[GFAR_INT_NAME_MAX];
+	char int_name_er[GFAR_INT_NAME_MAX];
+
 	/* Network Statistics */
 	struct gfar_extra_stats extra_stats;
 };
-- 
1.5.4.GIT


  reply	other threads:[~2008-12-17 21:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 21:42 [PATCH v2.6.29 v3 1/5] gianfar: Fix packet drop when out of memory Andy Fleming
2008-12-17 21:42 ` [PATCH v2.6.29 v3 2/5] gianfar: Add Scatter Gather support Andy Fleming
2008-12-17 21:42   ` Andy Fleming [this message]
2008-12-17 21:42     ` [PATCH v2.6.29 v3 4/5] gianfar: Merge Tx and Rx interrupt for scheduling clean up ring Andy Fleming
2008-12-17 21:42       ` [PATCH v2.6.29 v3 5/5] gianfar: Continue polling until both tx and rx are empty Andy Fleming
2008-12-18  0:54         ` David Miller
2008-12-18  2:40           ` Fleming Andy-AFLEMING
2008-12-18  2:44             ` David Miller
2008-12-18  0:53       ` [PATCH v2.6.29 v3 4/5] gianfar: Merge Tx and Rx interrupt for scheduling clean up ring David Miller
2008-12-18  0:53     ` [PATCH v2.6.29 v3 3/5] gianfar: Use interface name in interrupt name to distinguish the source David Miller
2008-12-18  0:52   ` [PATCH v2.6.29 v3 2/5] gianfar: Add Scatter Gather support David Miller
2008-12-18  0:52 ` [PATCH v2.6.29 v3 1/5] gianfar: Fix packet drop when out of memory David Miller

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=1229550175-15600-3-git-send-email-afleming@freescale.com \
    --to=afleming@freescale.com \
    --cc=Dai.Haruki@freescale.com \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --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).