niu: Naming interrupt vectors.
authorRobert Olsson <robert.olsson@its.uu.se>
Wed, 26 Nov 2008 00:41:57 +0000 (16:41 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Nov 2008 00:44:38 +0000 (16:44 -0800)
 A patch to put names on the niu interrupt vectors according the syntax below.
 This is needed to assign correct affinity.

 > So on a multiqueue card with 2 RX queues and 2 TX queues we'd
 > have names like:
 >
 >  eth0-rx-0
 >  eth0-rx-1
 >  eth0-tx-0
 >  eth0-tx-1

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Tested-by: Jesper Dangaard Brouer <jdb@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/niu.c
drivers/net/niu.h

index a8d1063..f368e74 100644 (file)
@@ -5847,17 +5847,42 @@ static void niu_stop_hw(struct niu *np)
        niu_reset_rx_channels(np);
 }
 
+static void niu_set_irq_name(struct niu *np)
+{
+       int port = np->port;
+       int i, j = 1;
+
+       sprintf(np->irq_name[0], "%s:MAC", np->dev->name);
+
+       if (port == 0) {
+               sprintf(np->irq_name[1], "%s:MIF", np->dev->name);
+               sprintf(np->irq_name[2], "%s:SYSERR", np->dev->name);
+               j = 3;
+       }
+
+       for (i = 0; i < np->num_ldg - j; i++) {
+               if (i < np->num_rx_rings)
+                       sprintf(np->irq_name[i+j], "%s-rx-%d",
+                               np->dev->name, i);
+               else if (i < np->num_tx_rings + np->num_rx_rings)
+                       sprintf(np->irq_name[i+j], "%s-tx-%d", np->dev->name,
+                               i - np->num_rx_rings);
+       }
+}
+
 static int niu_request_irq(struct niu *np)
 {
        int i, j, err;
 
+       niu_set_irq_name(np);
+
        err = 0;
        for (i = 0; i < np->num_ldg; i++) {
                struct niu_ldg *lp = &np->ldg[i];
 
                err = request_irq(lp->irq, niu_interrupt,
                                  IRQF_SHARED | IRQF_SAMPLE_RANDOM,
-                                 np->dev->name, lp);
+                                 np->irq_name[i], lp);
                if (err)
                        goto out_free_irqs;
 
index 180ca8a..cf449aa 100644 (file)
@@ -3243,6 +3243,7 @@ struct niu {
 #define NIU_FLAGS_XMAC                 0x00010000 /* 0=BMAC 1=XMAC */
 
        u32                             msg_enable;
+       char                            irq_name[NIU_NUM_RXCHAN+NIU_NUM_TXCHAN+3][IFNAMSIZ + 6];
 
        /* Protects hw programming, and ring state.  */
        spinlock_t                      lock;