diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2009-11-13 08:03:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-16 01:14:53 -0500 |
commit | 66711e66639776685aeaad774488be1857abce26 (patch) | |
tree | e719edd75292bd3ac6d739f26e29613c0c2c3b03 /drivers | |
parent | 2b2cdb65bec42d38268b2ac115876b066afa7f95 (diff) |
tg3: Create aliases for rx producer mailbox regs
The rx producer mailbox registers are used in several spots in the code.
The addition of TG3_64BIT_REG_LOW makes register references
uncomfortably long. This patch creates an alias for the standard and
jumbo ring producer index registers to make the code cleaner.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/tg3.c | 18 | ||||
-rw-r--r-- | drivers/net/tg3.h | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 168a7ca58b85..05fd42f8f4ed 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -402,7 +402,7 @@ static void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val) | |||
402 | TG3_64BIT_REG_LOW, val); | 402 | TG3_64BIT_REG_LOW, val); |
403 | return; | 403 | return; |
404 | } | 404 | } |
405 | if (off == (MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW)) { | 405 | if (off == TG3_RX_STD_PROD_IDX_REG) { |
406 | pci_write_config_dword(tp->pdev, TG3PCI_STD_RING_PROD_IDX + | 406 | pci_write_config_dword(tp->pdev, TG3PCI_STD_RING_PROD_IDX + |
407 | TG3_64BIT_REG_LOW, val); | 407 | TG3_64BIT_REG_LOW, val); |
408 | return; | 408 | return; |
@@ -4684,9 +4684,7 @@ next_pkt: | |||
4684 | 4684 | ||
4685 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { | 4685 | if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { |
4686 | u32 idx = *post_ptr % TG3_RX_RING_SIZE; | 4686 | u32 idx = *post_ptr % TG3_RX_RING_SIZE; |
4687 | 4687 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, idx); | |
4688 | tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + | ||
4689 | TG3_64BIT_REG_LOW, idx); | ||
4690 | work_mask &= ~RXD_OPAQUE_RING_STD; | 4688 | work_mask &= ~RXD_OPAQUE_RING_STD; |
4691 | rx_std_posted = 0; | 4689 | rx_std_posted = 0; |
4692 | } | 4690 | } |
@@ -4708,13 +4706,11 @@ next_pkt_nopost: | |||
4708 | /* Refill RX ring(s). */ | 4706 | /* Refill RX ring(s). */ |
4709 | if (work_mask & RXD_OPAQUE_RING_STD) { | 4707 | if (work_mask & RXD_OPAQUE_RING_STD) { |
4710 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; | 4708 | tpr->rx_std_prod_idx = std_prod_idx % TG3_RX_RING_SIZE; |
4711 | tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, | 4709 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, tpr->rx_std_prod_idx); |
4712 | tpr->rx_std_prod_idx); | ||
4713 | } | 4710 | } |
4714 | if (work_mask & RXD_OPAQUE_RING_JUMBO) { | 4711 | if (work_mask & RXD_OPAQUE_RING_JUMBO) { |
4715 | tpr->rx_jmb_prod_idx = jmb_prod_idx % TG3_RX_JUMBO_RING_SIZE; | 4712 | tpr->rx_jmb_prod_idx = jmb_prod_idx % TG3_RX_JUMBO_RING_SIZE; |
4716 | tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, | 4713 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, tpr->rx_jmb_prod_idx); |
4717 | tpr->rx_jmb_prod_idx); | ||
4718 | } | 4714 | } |
4719 | mmiowb(); | 4715 | mmiowb(); |
4720 | 4716 | ||
@@ -7526,13 +7522,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
7526 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val); | 7522 | tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val); |
7527 | 7523 | ||
7528 | tpr->rx_std_prod_idx = tp->rx_pending; | 7524 | tpr->rx_std_prod_idx = tp->rx_pending; |
7529 | tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, | 7525 | tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, tpr->rx_std_prod_idx); |
7530 | tpr->rx_std_prod_idx); | ||
7531 | 7526 | ||
7532 | tpr->rx_jmb_prod_idx = (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) ? | 7527 | tpr->rx_jmb_prod_idx = (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) ? |
7533 | tp->rx_jumbo_pending : 0; | 7528 | tp->rx_jumbo_pending : 0; |
7534 | tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, | 7529 | tw32_rx_mbox(TG3_RX_JMB_PROD_IDX_REG, tpr->rx_jmb_prod_idx); |
7535 | tpr->rx_jmb_prod_idx); | ||
7536 | 7530 | ||
7537 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { | 7531 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { |
7538 | tw32(STD_REPLENISH_LWM, 32); | 7532 | tw32(STD_REPLENISH_LWM, 32); |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 715df2b595dc..bbfbc5e5d608 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -242,7 +242,11 @@ | |||
242 | #define MAILBOX_GENERAL_7 0x00000258 /* 64-bit */ | 242 | #define MAILBOX_GENERAL_7 0x00000258 /* 64-bit */ |
243 | #define MAILBOX_RELOAD_STAT 0x00000260 /* 64-bit */ | 243 | #define MAILBOX_RELOAD_STAT 0x00000260 /* 64-bit */ |
244 | #define MAILBOX_RCV_STD_PROD_IDX 0x00000268 /* 64-bit */ | 244 | #define MAILBOX_RCV_STD_PROD_IDX 0x00000268 /* 64-bit */ |
245 | #define TG3_RX_STD_PROD_IDX_REG (MAILBOX_RCV_STD_PROD_IDX + \ | ||
246 | TG3_64BIT_REG_LOW) | ||
245 | #define MAILBOX_RCV_JUMBO_PROD_IDX 0x00000270 /* 64-bit */ | 247 | #define MAILBOX_RCV_JUMBO_PROD_IDX 0x00000270 /* 64-bit */ |
248 | #define TG3_RX_JMB_PROD_IDX_REG (MAILBOX_RCV_JUMBO_PROD_IDX + \ | ||
249 | TG3_64BIT_REG_LOW) | ||
246 | #define MAILBOX_RCV_MINI_PROD_IDX 0x00000278 /* 64-bit */ | 250 | #define MAILBOX_RCV_MINI_PROD_IDX 0x00000278 /* 64-bit */ |
247 | #define MAILBOX_RCVRET_CON_IDX_0 0x00000280 /* 64-bit */ | 251 | #define MAILBOX_RCVRET_CON_IDX_0 0x00000280 /* 64-bit */ |
248 | #define MAILBOX_RCVRET_CON_IDX_1 0x00000288 /* 64-bit */ | 252 | #define MAILBOX_RCVRET_CON_IDX_1 0x00000288 /* 64-bit */ |