aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-11-13 08:03:38 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-16 01:14:40 -0500
commite849cdc309de4a1e49dc3c23c6c36da91b990c9f (patch)
tree1809164b142f3b8788e27192f16210c4f677d6d8 /drivers/net/tg3.c
parent507399f18ea5810de42f0ea228c14305a8f67512 (diff)
tg3: Add new HW_TSO_3 flag for 5717
The 5717 sets up TSO slightly differently in the transmit path. It looks like this method will be the new way of doing things. This patch defines a flag to indicate this. 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.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 29276e62f128..6831289baf2a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5206,7 +5206,7 @@ static void tg3_set_txd(struct tg3_napi *tnapi, int entry,
5206} 5206}
5207 5207
5208/* hard_start_xmit for devices that don't have any bugs and 5208/* hard_start_xmit for devices that don't have any bugs and
5209 * support TG3_FLG2_HW_TSO_2 only. 5209 * support TG3_FLG2_HW_TSO_2 and TG3_FLG2_HW_TSO_3 only.
5210 */ 5210 */
5211static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, 5211static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
5212 struct net_device *dev) 5212 struct net_device *dev)
@@ -5265,7 +5265,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
5265 hdrlen = ip_tcp_len + tcp_opt_len; 5265 hdrlen = ip_tcp_len + tcp_opt_len;
5266 } 5266 }
5267 5267
5268 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) { 5268 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) {
5269 mss |= (hdrlen & 0xc) << 12; 5269 mss |= (hdrlen & 0xc) << 12;
5270 if (hdrlen & 0x10) 5270 if (hdrlen & 0x10)
5271 base_flags |= 0x00000010; 5271 base_flags |= 0x00000010;
@@ -7523,7 +7523,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7523 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) 7523 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
7524 rdmac_mode |= RDMAC_MODE_IPV4_LSO_EN; 7524 rdmac_mode |= RDMAC_MODE_IPV4_LSO_EN;
7525 7525
7526 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 7526 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) ||
7527 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
7527 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) 7528 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
7528 rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN; 7529 rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN;
7529 7530
@@ -9513,15 +9514,16 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
9513 return 0; 9514 return 0;
9514 } 9515 }
9515 if ((dev->features & NETIF_F_IPV6_CSUM) && 9516 if ((dev->features & NETIF_F_IPV6_CSUM) &&
9516 (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2)) { 9517 ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) ||
9518 (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3))) {
9517 if (value) { 9519 if (value) {
9518 dev->features |= NETIF_F_TSO6; 9520 dev->features |= NETIF_F_TSO6;
9519 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || 9521 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) ||
9522 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
9520 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 9523 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
9521 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || 9524 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
9522 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 9525 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
9523 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 || 9526 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
9524 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
9525 dev->features |= NETIF_F_TSO_ECN; 9527 dev->features |= NETIF_F_TSO_ECN;
9526 } else 9528 } else
9527 dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN); 9529 dev->features &= ~(NETIF_F_TSO6 | NETIF_F_TSO_ECN);
@@ -12670,8 +12672,10 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
12670 } 12672 }
12671 12673
12672 /* Determine TSO capabilities */ 12674 /* Determine TSO capabilities */
12673 if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) || 12675 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
12674 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) 12676 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_3;
12677 else if ((tp->tg3_flags3 & TG3_FLG3_5755_PLUS) ||
12678 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
12675 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2; 12679 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2;
12676 else if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { 12680 else if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) {
12677 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1 | TG3_FLG2_TSO_BUG; 12681 tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1 | TG3_FLG2_TSO_BUG;
@@ -14136,22 +14140,23 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
14136 * Firmware TSO on older chips gives lower performance, so it 14140 * Firmware TSO on older chips gives lower performance, so it
14137 * is off by default, but can be enabled using ethtool. 14141 * is off by default, but can be enabled using ethtool.
14138 */ 14142 */
14139 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { 14143 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) &&
14140 if (dev->features & NETIF_F_IP_CSUM) 14144 (dev->features & NETIF_F_IP_CSUM))
14141 dev->features |= NETIF_F_TSO; 14145 dev->features |= NETIF_F_TSO;
14142 if ((dev->features & NETIF_F_IPV6_CSUM) && 14146
14143 (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2)) 14147 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) ||
14148 (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3)) {
14149 if (dev->features & NETIF_F_IPV6_CSUM)
14144 dev->features |= NETIF_F_TSO6; 14150 dev->features |= NETIF_F_TSO6;
14145 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || 14151 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) ||
14152 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
14146 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && 14153 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
14147 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || 14154 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) ||
14148 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || 14155 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
14149 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 || 14156 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
14150 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
14151 dev->features |= NETIF_F_TSO_ECN; 14157 dev->features |= NETIF_F_TSO_ECN;
14152 } 14158 }
14153 14159
14154
14155 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 && 14160 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 &&
14156 !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) && 14161 !(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) &&
14157 !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) { 14162 !(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH)) {