aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <michael.chan@broadcom.com>2017-12-16 03:09:42 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-19 10:38:36 -0500
commit1054aee82321483dceabbb9b9e5d6512e8fe684b (patch)
treeef3068bb6c94cf1e7dfc83ac4957561679069513
parent56f5aa77cdad1076bea0ae8ddeb74ba68ddc9502 (diff)
bnxt_en: Use NETIF_F_GRO_HW.
Advertise NETIF_F_GRO_HW in hw_features if hardware GRO is supported. In bnxt_fix_features(), disable GRO_HW and LRO if current hardware configuration does not allow it. GRO_HW depends on GRO. GRO_HW is also mutually exclusive with LRO. XDP setup will now rely on bnxt_fix_features() to turn off aggregation. During chip init, turn on or off hardware GRO based on NETIF_F_GRO_HW in features flag. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 1d865ae201db..9efbdc6f1fcb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -2755,7 +2755,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp)
2755 return; 2755 return;
2756 if (bp->dev->features & NETIF_F_LRO) 2756 if (bp->dev->features & NETIF_F_LRO)
2757 bp->flags |= BNXT_FLAG_LRO; 2757 bp->flags |= BNXT_FLAG_LRO;
2758 if (bp->dev->features & NETIF_F_GRO) 2758 else if (bp->dev->features & NETIF_F_GRO_HW)
2759 bp->flags |= BNXT_FLAG_GRO; 2759 bp->flags |= BNXT_FLAG_GRO;
2760} 2760}
2761 2761
@@ -2843,10 +2843,10 @@ int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode)
2843 min_t(u16, bp->max_mtu, BNXT_MAX_PAGE_MODE_MTU); 2843 min_t(u16, bp->max_mtu, BNXT_MAX_PAGE_MODE_MTU);
2844 bp->flags &= ~BNXT_FLAG_AGG_RINGS; 2844 bp->flags &= ~BNXT_FLAG_AGG_RINGS;
2845 bp->flags |= BNXT_FLAG_NO_AGG_RINGS | BNXT_FLAG_RX_PAGE_MODE; 2845 bp->flags |= BNXT_FLAG_NO_AGG_RINGS | BNXT_FLAG_RX_PAGE_MODE;
2846 bp->dev->hw_features &= ~NETIF_F_LRO;
2847 bp->dev->features &= ~NETIF_F_LRO;
2848 bp->rx_dir = DMA_BIDIRECTIONAL; 2846 bp->rx_dir = DMA_BIDIRECTIONAL;
2849 bp->rx_skb_func = bnxt_rx_page_skb; 2847 bp->rx_skb_func = bnxt_rx_page_skb;
2848 /* Disable LRO or GRO_HW */
2849 netdev_update_features(bp->dev);
2850 } else { 2850 } else {
2851 bp->dev->max_mtu = bp->max_mtu; 2851 bp->dev->max_mtu = bp->max_mtu;
2852 bp->flags &= ~BNXT_FLAG_RX_PAGE_MODE; 2852 bp->flags &= ~BNXT_FLAG_RX_PAGE_MODE;
@@ -6788,6 +6788,15 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
6788 if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp)) 6788 if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
6789 features &= ~NETIF_F_NTUPLE; 6789 features &= ~NETIF_F_NTUPLE;
6790 6790
6791 if (bp->flags & BNXT_FLAG_NO_AGG_RINGS)
6792 features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
6793
6794 if (!(features & NETIF_F_GRO))
6795 features &= ~NETIF_F_GRO_HW;
6796
6797 if (features & NETIF_F_GRO_HW)
6798 features &= ~NETIF_F_LRO;
6799
6791 /* Both CTAG and STAG VLAN accelaration on the RX side have to be 6800 /* Both CTAG and STAG VLAN accelaration on the RX side have to be
6792 * turned on or off together. 6801 * turned on or off together.
6793 */ 6802 */
@@ -6821,9 +6830,9 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
6821 bool update_tpa = false; 6830 bool update_tpa = false;
6822 6831
6823 flags &= ~BNXT_FLAG_ALL_CONFIG_FEATS; 6832 flags &= ~BNXT_FLAG_ALL_CONFIG_FEATS;
6824 if ((features & NETIF_F_GRO) && !BNXT_CHIP_TYPE_NITRO_A0(bp)) 6833 if (features & NETIF_F_GRO_HW)
6825 flags |= BNXT_FLAG_GRO; 6834 flags |= BNXT_FLAG_GRO;
6826 if (features & NETIF_F_LRO) 6835 else if (features & NETIF_F_LRO)
6827 flags |= BNXT_FLAG_LRO; 6836 flags |= BNXT_FLAG_LRO;
6828 6837
6829 if (bp->flags & BNXT_FLAG_NO_AGG_RINGS) 6838 if (bp->flags & BNXT_FLAG_NO_AGG_RINGS)
@@ -7924,8 +7933,8 @@ static int bnxt_get_dflt_rings(struct bnxt *bp, int *max_rx, int *max_tx,
7924 if (rc) 7933 if (rc)
7925 return rc; 7934 return rc;
7926 bp->flags |= BNXT_FLAG_NO_AGG_RINGS; 7935 bp->flags |= BNXT_FLAG_NO_AGG_RINGS;
7927 bp->dev->hw_features &= ~NETIF_F_LRO; 7936 bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
7928 bp->dev->features &= ~NETIF_F_LRO; 7937 bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
7929 bnxt_set_ring_params(bp); 7938 bnxt_set_ring_params(bp);
7930 } 7939 }
7931 7940
@@ -8108,7 +8117,11 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8108 dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA; 8117 dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;
8109 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX | 8118 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX |
8110 NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX; 8119 NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX;
8120 if (!BNXT_CHIP_TYPE_NITRO_A0(bp))
8121 dev->hw_features |= NETIF_F_GRO_HW;
8111 dev->features |= dev->hw_features | NETIF_F_HIGHDMA; 8122 dev->features |= dev->hw_features | NETIF_F_HIGHDMA;
8123 if (dev->features & NETIF_F_GRO_HW)
8124 dev->features &= ~NETIF_F_LRO;
8112 dev->priv_flags |= IFF_UNICAST_FLT; 8125 dev->priv_flags |= IFF_UNICAST_FLT;
8113 8126
8114#ifdef CONFIG_BNXT_SRIOV 8127#ifdef CONFIG_BNXT_SRIOV