aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-09-01 08:58:41 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-02 03:43:36 -0400
commit646c9eddcffd202bb0f3d906cecf94eaf10cad31 (patch)
tree5f6ad6b05ef0d9f06d43d5db06dec9f842c68291 /drivers/net/tg3.c
parent679563f47cd2547a0e091b5bd3ddf30027af6b08 (diff)
tg3: Add mailbox assignments
The 5717 assigns mailbox locations to interrupt vectors in a rather non-intuitive way. (Much of the complexity stems from legacy compatibility issues.) This patch implements the assignment scheme. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c59
1 files changed, 50 insertions, 9 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 12ead83bd06f..4d16ce05dba4 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9219,7 +9219,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
9219static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) 9219static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
9220{ 9220{
9221 struct tg3 *tp = netdev_priv(dev); 9221 struct tg3 *tp = netdev_priv(dev);
9222 int irq_sync = 0, err = 0; 9222 int i, irq_sync = 0, err = 0;
9223 9223
9224 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || 9224 if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
9225 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || 9225 (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
@@ -9243,7 +9243,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
9243 tp->rx_pending > 63) 9243 tp->rx_pending > 63)
9244 tp->rx_pending = 63; 9244 tp->rx_pending = 63;
9245 tp->rx_jumbo_pending = ering->rx_jumbo_pending; 9245 tp->rx_jumbo_pending = ering->rx_jumbo_pending;
9246 tp->napi[0].tx_pending = ering->tx_pending; 9246
9247 for (i = 0; i < TG3_IRQ_MAX_VECS; i++)
9248 tp->napi[i].tx_pending = ering->tx_pending;
9247 9249
9248 if (netif_running(dev)) { 9250 if (netif_running(dev)) {
9249 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 9251 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
@@ -13443,7 +13445,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13443 static int tg3_version_printed = 0; 13445 static int tg3_version_printed = 0;
13444 struct net_device *dev; 13446 struct net_device *dev;
13445 struct tg3 *tp; 13447 struct tg3 *tp;
13446 int err, pm_cap; 13448 int i, err, pm_cap;
13449 u32 sndmbx, rcvmbx, intmbx;
13447 char str[40]; 13450 char str[40];
13448 u64 dma_mask, persist_dma_mask; 13451 u64 dma_mask, persist_dma_mask;
13449 13452
@@ -13538,12 +13541,50 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13538 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 13541 tp->rx_pending = TG3_DEF_RX_RING_PENDING;
13539 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 13542 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
13540 13543
13541 tp->napi[0].tp = tp; 13544 intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW;
13542 tp->napi[0].int_mbox = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; 13545 rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW;
13543 tp->napi[0].consmbox = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; 13546 sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW;
13544 tp->napi[0].prodmbox = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; 13547 for (i = 0; i < TG3_IRQ_MAX_VECS; i++) {
13545 tp->napi[0].coal_now = HOSTCC_MODE_NOW; 13548 struct tg3_napi *tnapi = &tp->napi[i];
13546 tp->napi[0].tx_pending = TG3_DEF_TX_RING_PENDING; 13549
13550 tnapi->tp = tp;
13551 tnapi->tx_pending = TG3_DEF_TX_RING_PENDING;
13552
13553 tnapi->int_mbox = intmbx;
13554 if (i < 4)
13555 intmbx += 0x8;
13556 else
13557 intmbx += 0x4;
13558
13559 tnapi->consmbox = rcvmbx;
13560 tnapi->prodmbox = sndmbx;
13561
13562 if (i)
13563 tnapi->coal_now = HOSTCC_MODE_COAL_VEC1_NOW << (i - 1);
13564 else
13565 tnapi->coal_now = HOSTCC_MODE_NOW;
13566
13567 if (!(tp->tg3_flags & TG3_FLAG_SUPPORT_MSIX))
13568 break;
13569
13570 /*
13571 * If we support MSIX, we'll be using RSS. If we're using
13572 * RSS, the first vector only handles link interrupts and the
13573 * remaining vectors handle rx and tx interrupts. Reuse the
13574 * mailbox values for the next iteration. The values we setup
13575 * above are still useful for the single vectored mode.
13576 */
13577 if (!i)
13578 continue;
13579
13580 rcvmbx += 0x8;
13581
13582 if (sndmbx & 0x4)
13583 sndmbx -= 0x4;
13584 else
13585 sndmbx += 0xc;
13586 }
13587
13547 netif_napi_add(dev, &tp->napi[0].napi, tg3_poll, 64); 13588 netif_napi_add(dev, &tp->napi[0].napi, tg3_poll, 64);
13548 dev->ethtool_ops = &tg3_ethtool_ops; 13589 dev->ethtool_ops = &tg3_ethtool_ops;
13549 dev->watchdog_timeo = TG3_TX_TIMEOUT; 13590 dev->watchdog_timeo = TG3_TX_TIMEOUT;