bnxt_en: Use NETIF_F_GRO_HW.
authorMichael Chan <michael.chan@broadcom.com>
Sat, 16 Dec 2017 08:09:42 +0000 (03:09 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Dec 2017 15:38:36 +0000 (10:38 -0500)
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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 1d865ae201db79c7895e3dcf0af45af695bc4190..9efbdc6f1fcbb36c9bf1b93bc488db442805094a 100644 (file)
@@ -2755,7 +2755,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp)
                return;
        if (bp->dev->features & NETIF_F_LRO)
                bp->flags |= BNXT_FLAG_LRO;
-       if (bp->dev->features & NETIF_F_GRO)
+       else if (bp->dev->features & NETIF_F_GRO_HW)
                bp->flags |= BNXT_FLAG_GRO;
 }
 
@@ -2843,10 +2843,10 @@ int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode)
                        min_t(u16, bp->max_mtu, BNXT_MAX_PAGE_MODE_MTU);
                bp->flags &= ~BNXT_FLAG_AGG_RINGS;
                bp->flags |= BNXT_FLAG_NO_AGG_RINGS | BNXT_FLAG_RX_PAGE_MODE;
-               bp->dev->hw_features &= ~NETIF_F_LRO;
-               bp->dev->features &= ~NETIF_F_LRO;
                bp->rx_dir = DMA_BIDIRECTIONAL;
                bp->rx_skb_func = bnxt_rx_page_skb;
+               /* Disable LRO or GRO_HW */
+               netdev_update_features(bp->dev);
        } else {
                bp->dev->max_mtu = bp->max_mtu;
                bp->flags &= ~BNXT_FLAG_RX_PAGE_MODE;
@@ -6788,6 +6788,15 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
        if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
                features &= ~NETIF_F_NTUPLE;
 
+       if (bp->flags & BNXT_FLAG_NO_AGG_RINGS)
+               features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
+
+       if (!(features & NETIF_F_GRO))
+               features &= ~NETIF_F_GRO_HW;
+
+       if (features & NETIF_F_GRO_HW)
+               features &= ~NETIF_F_LRO;
+
        /* Both CTAG and STAG VLAN accelaration on the RX side have to be
         * turned on or off together.
         */
@@ -6821,9 +6830,9 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
        bool update_tpa = false;
 
        flags &= ~BNXT_FLAG_ALL_CONFIG_FEATS;
-       if ((features & NETIF_F_GRO) && !BNXT_CHIP_TYPE_NITRO_A0(bp))
+       if (features & NETIF_F_GRO_HW)
                flags |= BNXT_FLAG_GRO;
-       if (features & NETIF_F_LRO)
+       else if (features & NETIF_F_LRO)
                flags |= BNXT_FLAG_LRO;
 
        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,
                if (rc)
                        return rc;
                bp->flags |= BNXT_FLAG_NO_AGG_RINGS;
-               bp->dev->hw_features &= ~NETIF_F_LRO;
-               bp->dev->features &= ~NETIF_F_LRO;
+               bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
+               bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
                bnxt_set_ring_params(bp);
        }
 
@@ -8108,7 +8117,11 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;
        dev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX |
                            NETIF_F_HW_VLAN_STAG_RX | NETIF_F_HW_VLAN_STAG_TX;
+       if (!BNXT_CHIP_TYPE_NITRO_A0(bp))
+               dev->hw_features |= NETIF_F_GRO_HW;
        dev->features |= dev->hw_features | NETIF_F_HIGHDMA;
+       if (dev->features & NETIF_F_GRO_HW)
+               dev->features &= ~NETIF_F_LRO;
        dev->priv_flags |= IFF_UNICAST_FLT;
 
 #ifdef CONFIG_BNXT_SRIOV