aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-11-13 08:03:37 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-16 01:14:39 -0500
commit507399f18ea5810de42f0ea228c14305a8f67512 (patch)
treecbb2d9dad6f78a08d40276137256368c5f416ab9 /drivers/net/tg3.c
parentf66a29b03a2637ff052f2b8a81a5417fa44e228b (diff)
tg3: Refine TSO and MSI discovery
This patch consolidates the TSO capability discovery code into its own code block. The code that decides whether or not to allow TSO is then cleaned up. Finally, the patch consolidates all MSI and MSIX capability code into a single code block. 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.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index f74d80d5515d..29276e62f128 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12669,6 +12669,27 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12669 tp->dev->features |= NETIF_F_IPV6_CSUM; 12669 tp->dev->features |= NETIF_F_IPV6_CSUM;
12670 } 12670 }
12671 12671
12672 /* Determine TSO capabilities */
12673 if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
12674 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
12675 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2;
12676 else if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {
12677 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1 | TG3_FLG2_TSO_BUG;
12678 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 &&
12679 tp->pci_chip_rev_id >= CHIPREV_ID_5750_C2)
12680 tp->tg3_flags2 &= ~TG3_FLG2_TSO_BUG;
12681 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
12682 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701 &&
12683 tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) {
12684 tp->tg3_flags2 |= TG3_FLG2_TSO_BUG;
12685 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
12686 tp->fw_needed = FIRMWARE_TG3TSO5;
12687 else
12688 tp->fw_needed = FIRMWARE_TG3TSO;
12689 }
12690
12691 tp->irq_max = 1;
12692
12672 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { 12693 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {
12673 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSI; 12694 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSI;
12674 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX || 12695 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX ||
@@ -12680,22 +12701,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12680 12701
12681 if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) || 12702 if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
12682 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 12703 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
12683 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2;
12684 tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI; 12704 tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI;
12685 } else {
12686 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1 | TG3_FLG2_TSO_BUG;
12687 if (GET_ASIC_REV(tp->pci_chip_rev_id) ==
12688 ASIC_REV_5750 &&
12689 tp->pci_chip_rev_id >= CHIPREV_ID_5750_C2)
12690 tp->tg3_flags2 &= ~TG3_FLG2_TSO_BUG;
12691 } 12705 }
12692 }
12693
12694 tp->irq_max = 1;
12695 12706
12696 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { 12707 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
12697 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSIX; 12708 tp->tg3_flags |= TG3_FLAG_SUPPORT_MSIX;
12698 tp->irq_max = TG3_IRQ_MAX_VECS; 12709 tp->irq_max = TG3_IRQ_MAX_VECS;
12710 }
12699 } 12711 }
12700 12712
12701 if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS)) { 12713 if (!(tp->tg3_flags3 & TG3_FLG3_5755_PLUS)) {
@@ -14108,25 +14120,17 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14108 14120
14109 tg3_init_bufmgr_config(tp); 14121 tg3_init_bufmgr_config(tp);
14110 14122
14111 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) 14123 /* Selectively allow TSO based on operating conditions */
14112 tp->fw_needed = FIRMWARE_TG3; 14124 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) ||
14113 14125 (tp->fw_needed && !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)))
14114 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
14115 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 14126 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
14127 else {
14128 tp->tg3_flags2 &= ~(TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG);
14129 tp->fw_needed = NULL;
14116 } 14130 }
14117 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 14131
14118 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 || 14132 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0)
14119 tp->pci_chip_rev_id == CHIPREV_ID_5705_A0 || 14133 tp->fw_needed = FIRMWARE_TG3;
14120 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
14121 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) {
14122 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
14123 } else {
14124 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG;
14125 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
14126 tp->fw_needed = FIRMWARE_TG3TSO5;
14127 else
14128 tp->fw_needed = FIRMWARE_TG3TSO;
14129 }
14130 14134
14131 /* TSO is on by default on chips that support hardware TSO. 14135 /* TSO is on by default on chips that support hardware TSO.
14132 * Firmware TSO on older chips gives lower performance, so it 14136 * Firmware TSO on older chips gives lower performance, so it