aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-11-13 08:03:42 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-16 01:14:45 -0500
commit78f90dcf184b8225a24217605c4289f1986451a3 (patch)
treeee0559bf41211975701c8f2cc310ef8ec7303fe2 /drivers/net/tg3.c
parent35f2d7d0d7c222a580da0ed91c8d70c54267620a (diff)
tg3: Move napi_add calls below tg3_get_invariants
tg3_get_invariants(), among other things, discovers whether or not the device is MSI-X capable and how many interrupts it supports. This discovery needs to happen before registering NAPI instances with netdev. This patch moves the code block that calls napi_add later in tg3_init_one() so that tg3_get_invariants() has a chance to run first. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5e17abb409e9..f0360f8b8f7b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -14089,53 +14089,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14089 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 14089 tp->rx_pending = TG3_DEF_RX_RING_PENDING;
14090 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 14090 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
14091 14091
14092 intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
14093 rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
14094 sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
14095 for (i = 0; i < TG3_IRQ_MAX_VECS; i++) {
14096 struct tg3_napi *tnapi = &tp->napi[i];
14097
14098 tnapi->tp = tp;
14099 tnapi->tx_pending = TG3_DEF_TX_RING_PENDING;
14100
14101 tnapi->int_mbox = intmbx;
14102 if (i < 4)
14103 intmbx += 0x8;
14104 else
14105 intmbx += 0x4;
14106
14107 tnapi->consmbox = rcvmbx;
14108 tnapi->prodmbox = sndmbx;
14109
14110 if (i) {
14111 tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1);
14112 netif_napi_add(dev, &tnapi->napi, tg3_poll_msix, 64);
14113 } else {
14114 tnapi->coal_now = HOSTCC_MODE_NOW;
14115 netif_napi_add(dev, &tnapi->napi, tg3_poll, 64);
14116 }
14117
14118 if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX))
14119 break;
14120
14121 /*
14122 * If we support MSIX, we'll be using RSS. If we're using
14123 * RSS, the first vector only handles link interrupts and the
14124 * remaining vectors handle rx and tx interrupts. Reuse the
14125 * mailbox values for the next iteration. The values we setup
14126 * above are still useful for the single vectored mode.
14127 */
14128 if (!i)
14129 continue;
14130
14131 rcvmbx += 0x8;
14132
14133 if (sndmbx & 0x4)
14134 sndmbx -= 0x4;
14135 else
14136 sndmbx += 0xc;
14137 }
14138
14139 dev->ethtool_ops = &tg3_ethtool_ops; 14092 dev->ethtool_ops = &tg3_ethtool_ops;
14140 dev->watchdog_timeo = TG3_TX_TIMEOUT; 14093 dev->watchdog_timeo = TG3_TX_TIMEOUT;
14141 dev->irq = pdev->irq; 14094 dev->irq = pdev->irq;
@@ -14278,6 +14231,53 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14278 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; 14231 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG;
14279 tp->link_config.flowctrl = FLOW_CTRL_TX | FLOW_CTRL_RX; 14232 tp->link_config.flowctrl = FLOW_CTRL_TX | FLOW_CTRL_RX;
14280 14233
14234 intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
14235 rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
14236 sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
14237 for (i = 0; i < TG3_IRQ_MAX_VECS; i++) {
14238 struct tg3_napi *tnapi = &tp->napi[i];
14239
14240 tnapi->tp = tp;
14241 tnapi->tx_pending = TG3_DEF_TX_RING_PENDING;
14242
14243 tnapi->int_mbox = intmbx;
14244 if (i < 4)
14245 intmbx += 0x8;
14246 else
14247 intmbx += 0x4;
14248
14249 tnapi->consmbox = rcvmbx;
14250 tnapi->prodmbox = sndmbx;
14251
14252 if (i) {
14253 tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1);
14254 netif_napi_add(dev, &tnapi->napi, tg3_poll_msix, 64);
14255 } else {
14256 tnapi->coal_now = HOSTCC_MODE_NOW;
14257 netif_napi_add(dev, &tnapi->napi, tg3_poll, 64);
14258 }
14259
14260 if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX))
14261 break;
14262
14263 /*
14264 * If we support MSIX, we'll be using RSS. If we're using
14265 * RSS, the first vector only handles link interrupts and the
14266 * remaining vectors handle rx and tx interrupts. Reuse the
14267 * mailbox values for the next iteration. The values we setup
14268 * above are still useful for the single vectored mode.
14269 */
14270 if (!i)
14271 continue;
14272
14273 rcvmbx += 0x8;
14274
14275 if (sndmbx & 0x4)
14276 sndmbx -= 0x4;
14277 else
14278 sndmbx += 0xc;
14279 }
14280
14281 tg3_init_coal(tp); 14281 tg3_init_coal(tp);
14282 14282
14283 pci_set_drvdata(pdev, dev); 14283 pci_set_drvdata(pdev, dev);