Commit 3c3def5f authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnx2x: Use NETIF_F_GRO_HW.

Advertise NETIF_F_GRO_HW and turn on TPA_MODE_GRO when NETIF_F_GRO_HW
is set.  Disable NETIF_F_GRO_HW in bnx2x_fix_features() if the MTU
does not support TPA_MODE_GRO or GRO is not set.  bnx2x_change_mtu() also
needs to disable NETIF_F_GRO_HW if the MTU does not support it.

Original parameter disable_tpa will continue to disable LRO and GRO_HW.

Preserve the original behavior of enabling LRO by default.  User has
to run ethtool -K to explicitly enable GRO_HW.

Cc: Ariel Elior <Ariel.Elior@cavium.com>
Cc: everest-linux-l2@cavium.com
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Acked-by: default avatarManish Chopra <manish.chopra@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1054aee8
...@@ -2482,8 +2482,7 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index) ...@@ -2482,8 +2482,7 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index)
*/ */
if (bp->dev->features & NETIF_F_LRO) if (bp->dev->features & NETIF_F_LRO)
fp->mode = TPA_MODE_LRO; fp->mode = TPA_MODE_LRO;
else if (bp->dev->features & NETIF_F_GRO && else if (bp->dev->features & NETIF_F_GRO_HW)
bnx2x_mtu_allows_gro(bp->dev->mtu))
fp->mode = TPA_MODE_GRO; fp->mode = TPA_MODE_GRO;
else else
fp->mode = TPA_MODE_DISABLED; fp->mode = TPA_MODE_DISABLED;
...@@ -4874,6 +4873,9 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu) ...@@ -4874,6 +4873,9 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
*/ */
dev->mtu = new_mtu; dev->mtu = new_mtu;
if (!bnx2x_mtu_allows_gro(new_mtu))
dev->features &= ~NETIF_F_GRO_HW;
if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg)) if (IS_PF(bp) && SHMEM2_HAS(bp, curr_cfg))
SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS); SHMEM2_WR(bp, curr_cfg, CURR_CFG_MET_OS);
...@@ -4903,10 +4905,13 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev, ...@@ -4903,10 +4905,13 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
} }
/* TPA requires Rx CSUM offloading */ /* TPA requires Rx CSUM offloading */
if (!(features & NETIF_F_RXCSUM)) { if (!(features & NETIF_F_RXCSUM))
features &= ~NETIF_F_LRO;
if (!(features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu))
features &= ~NETIF_F_GRO_HW;
if (features & NETIF_F_GRO_HW)
features &= ~NETIF_F_LRO; features &= ~NETIF_F_LRO;
features &= ~NETIF_F_GRO;
}
return features; return features;
} }
...@@ -4933,13 +4938,8 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features) ...@@ -4933,13 +4938,8 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
} }
} }
/* if GRO is changed while LRO is enabled, don't force a reload */ /* Don't care about GRO changes */
if ((changes & NETIF_F_GRO) && (features & NETIF_F_LRO)) changes &= ~NETIF_F_GRO;
changes &= ~NETIF_F_GRO;
/* if GRO is changed while HW TPA is off, don't force a reload */
if ((changes & NETIF_F_GRO) && bp->disable_tpa)
changes &= ~NETIF_F_GRO;
if (changes) if (changes)
bnx2x_reload = true; bnx2x_reload = true;
......
...@@ -12400,8 +12400,8 @@ static int bnx2x_init_bp(struct bnx2x *bp) ...@@ -12400,8 +12400,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
/* Set TPA flags */ /* Set TPA flags */
if (bp->disable_tpa) { if (bp->disable_tpa) {
bp->dev->hw_features &= ~NETIF_F_LRO; bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
bp->dev->features &= ~NETIF_F_LRO; bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
} }
if (CHIP_IS_E1(bp)) if (CHIP_IS_E1(bp))
...@@ -13273,7 +13273,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, ...@@ -13273,7 +13273,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | NETIF_F_GRO_HW |
NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
if (!chip_is_e1x) { if (!chip_is_e1x) {
dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM |
...@@ -13309,6 +13309,8 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, ...@@ -13309,6 +13309,8 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX; dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
dev->features |= NETIF_F_HIGHDMA; dev->features |= NETIF_F_HIGHDMA;
if (dev->features & NETIF_F_LRO)
dev->features &= ~NETIF_F_GRO_HW;
/* Add Loopback capability to the device */ /* Add Loopback capability to the device */
dev->hw_features |= NETIF_F_LOOPBACK; dev->hw_features |= NETIF_F_LOOPBACK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment