diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-05-19 08:12:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-19 18:00:01 -0400 |
commit | 0da0606f493c5cdab74bdcc96b12f4305ad94085 (patch) | |
tree | 4e5a5ff42ca6a3d36195c08525d579c8f5518a81 /drivers/net/tg3.c | |
parent | dabc5c670d3f86d15ee4f42ab38ec5bd2682487d (diff) |
tg3: Consolidate all netdev feature assignments
This patch consolidates all the netdev feature bit assignments to one
location.
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.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 09fe06784432..5bf2ce125421 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -13602,19 +13602,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13602 | tg3_flag(tp, 5750_PLUS)) | 13602 | tg3_flag(tp, 5750_PLUS)) |
13603 | tg3_flag_set(tp, 5705_PLUS); | 13603 | tg3_flag_set(tp, 5705_PLUS); |
13604 | 13604 | ||
13605 | /* 5700 B0 chips do not support checksumming correctly due | ||
13606 | * to hardware bugs. | ||
13607 | */ | ||
13608 | if (tp->pci_chip_rev_id != CHIPREV_ID_5700_B0) { | ||
13609 | u32 features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM; | ||
13610 | |||
13611 | if (tg3_flag(tp, 5755_PLUS)) | ||
13612 | features |= NETIF_F_IPV6_CSUM; | ||
13613 | tp->dev->features |= features; | ||
13614 | tp->dev->hw_features |= features; | ||
13615 | tp->dev->vlan_features |= features; | ||
13616 | } | ||
13617 | |||
13618 | /* Determine TSO capabilities */ | 13605 | /* Determine TSO capabilities */ |
13619 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | 13606 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) |
13620 | ; /* Do nothing. HW bug. */ | 13607 | ; /* Do nothing. HW bug. */ |
@@ -14922,7 +14909,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14922 | u32 sndmbx, rcvmbx, intmbx; | 14909 | u32 sndmbx, rcvmbx, intmbx; |
14923 | char str[40]; | 14910 | char str[40]; |
14924 | u64 dma_mask, persist_dma_mask; | 14911 | u64 dma_mask, persist_dma_mask; |
14925 | u32 hw_features = 0; | 14912 | u32 features = 0; |
14926 | 14913 | ||
14927 | printk_once(KERN_INFO "%s\n", version); | 14914 | printk_once(KERN_INFO "%s\n", version); |
14928 | 14915 | ||
@@ -14958,8 +14945,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14958 | 14945 | ||
14959 | SET_NETDEV_DEV(dev, &pdev->dev); | 14946 | SET_NETDEV_DEV(dev, &pdev->dev); |
14960 | 14947 | ||
14961 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
14962 | |||
14963 | tp = netdev_priv(dev); | 14948 | tp = netdev_priv(dev); |
14964 | tp->pdev = pdev; | 14949 | tp->pdev = pdev; |
14965 | tp->dev = dev; | 14950 | tp->dev = dev; |
@@ -15039,7 +15024,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
15039 | if (dma_mask > DMA_BIT_MASK(32)) { | 15024 | if (dma_mask > DMA_BIT_MASK(32)) { |
15040 | err = pci_set_dma_mask(pdev, dma_mask); | 15025 | err = pci_set_dma_mask(pdev, dma_mask); |
15041 | if (!err) { | 15026 | if (!err) { |
15042 | dev->features |= NETIF_F_HIGHDMA; | 15027 | features |= NETIF_F_HIGHDMA; |
15043 | err = pci_set_consistent_dma_mask(pdev, | 15028 | err = pci_set_consistent_dma_mask(pdev, |
15044 | persist_dma_mask); | 15029 | persist_dma_mask); |
15045 | if (err < 0) { | 15030 | if (err < 0) { |
@@ -15060,6 +15045,18 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
15060 | 15045 | ||
15061 | tg3_init_bufmgr_config(tp); | 15046 | tg3_init_bufmgr_config(tp); |
15062 | 15047 | ||
15048 | features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
15049 | |||
15050 | /* 5700 B0 chips do not support checksumming correctly due | ||
15051 | * to hardware bugs. | ||
15052 | */ | ||
15053 | if (tp->pci_chip_rev_id != CHIPREV_ID_5700_B0) { | ||
15054 | features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM; | ||
15055 | |||
15056 | if (tg3_flag(tp, 5755_PLUS)) | ||
15057 | features |= NETIF_F_IPV6_CSUM; | ||
15058 | } | ||
15059 | |||
15063 | /* TSO is on by default on chips that support hardware TSO. | 15060 | /* TSO is on by default on chips that support hardware TSO. |
15064 | * Firmware TSO on older chips gives lower performance, so it | 15061 | * Firmware TSO on older chips gives lower performance, so it |
15065 | * is off by default, but can be enabled using ethtool. | 15062 | * is off by default, but can be enabled using ethtool. |
@@ -15067,24 +15064,20 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
15067 | if ((tg3_flag(tp, HW_TSO_1) || | 15064 | if ((tg3_flag(tp, HW_TSO_1) || |
15068 | tg3_flag(tp, HW_TSO_2) || | 15065 | tg3_flag(tp, HW_TSO_2) || |
15069 | tg3_flag(tp, HW_TSO_3)) && | 15066 | tg3_flag(tp, HW_TSO_3)) && |
15070 | (dev->features & NETIF_F_IP_CSUM)) | 15067 | (features & NETIF_F_IP_CSUM)) |
15071 | hw_features |= NETIF_F_TSO; | 15068 | features |= NETIF_F_TSO; |
15072 | if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) { | 15069 | if (tg3_flag(tp, HW_TSO_2) || tg3_flag(tp, HW_TSO_3)) { |
15073 | if (dev->features & NETIF_F_IPV6_CSUM) | 15070 | if (features & NETIF_F_IPV6_CSUM) |
15074 | hw_features |= NETIF_F_TSO6; | 15071 | features |= NETIF_F_TSO6; |
15075 | if (tg3_flag(tp, HW_TSO_3) || | 15072 | if (tg3_flag(tp, HW_TSO_3) || |
15076 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || | 15073 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 || |
15077 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && | 15074 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 && |
15078 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || | 15075 | GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) || |
15079 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || | 15076 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 || |
15080 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) | 15077 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) |
15081 | hw_features |= NETIF_F_TSO_ECN; | 15078 | features |= NETIF_F_TSO_ECN; |
15082 | } | 15079 | } |
15083 | 15080 | ||
15084 | dev->hw_features |= hw_features; | ||
15085 | dev->features |= hw_features; | ||
15086 | dev->vlan_features |= hw_features; | ||
15087 | |||
15088 | /* | 15081 | /* |
15089 | * Add loopback capability only for a subset of devices that support | 15082 | * Add loopback capability only for a subset of devices that support |
15090 | * MAC-LOOPBACK. Eventually this need to be enhanced to allow INT-PHY | 15083 | * MAC-LOOPBACK. Eventually this need to be enhanced to allow INT-PHY |
@@ -15093,7 +15086,11 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
15093 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780 && | 15086 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780 && |
15094 | !tg3_flag(tp, CPMU_PRESENT)) | 15087 | !tg3_flag(tp, CPMU_PRESENT)) |
15095 | /* Add the loopback capability */ | 15088 | /* Add the loopback capability */ |
15096 | dev->hw_features |= NETIF_F_LOOPBACK; | 15089 | features |= NETIF_F_LOOPBACK; |
15090 | |||
15091 | dev->features |= features; | ||
15092 | dev->hw_features |= features; | ||
15093 | dev->vlan_features |= features; | ||
15097 | 15094 | ||
15098 | if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 && | 15095 | if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 && |
15099 | !tg3_flag(tp, TSO_CAPABLE) && | 15096 | !tg3_flag(tp, TSO_CAPABLE) && |