Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / intel / ixgb / ixgb_main.c
index ea48083734359e52b229f592e84abf7654a82523..fce3e92f9d11cf249b9574d3687947f3242dd81e 100644 (file)
@@ -101,8 +101,10 @@ static void ixgb_tx_timeout_task(struct work_struct *work);
 
 static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter);
 static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter);
-static int ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
-static int ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
+static int ixgb_vlan_rx_add_vid(struct net_device *netdev,
+                               __be16 proto, u16 vid);
+static int ixgb_vlan_rx_kill_vid(struct net_device *netdev,
+                                __be16 proto, u16 vid);
 static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -332,8 +334,8 @@ ixgb_fix_features(struct net_device *netdev, netdev_features_t features)
         * Tx VLAN insertion does not work per HW design when Rx stripping is
         * disabled.
         */
-       if (!(features & NETIF_F_HW_VLAN_RX))
-               features &= ~NETIF_F_HW_VLAN_TX;
+       if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
+               features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
        return features;
 }
@@ -344,7 +346,7 @@ ixgb_set_features(struct net_device *netdev, netdev_features_t features)
        struct ixgb_adapter *adapter = netdev_priv(netdev);
        netdev_features_t changed = features ^ netdev->features;
 
-       if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_RX)))
+       if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_CTAG_RX)))
                return 0;
 
        adapter->rx_csum = !!(features & NETIF_F_RXCSUM);
@@ -479,10 +481,10 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        netdev->hw_features = NETIF_F_SG |
                           NETIF_F_TSO |
                           NETIF_F_HW_CSUM |
-                          NETIF_F_HW_VLAN_TX |
-                          NETIF_F_HW_VLAN_RX;
+                          NETIF_F_HW_VLAN_CTAG_TX |
+                          NETIF_F_HW_VLAN_CTAG_RX;
        netdev->features = netdev->hw_features |
-                          NETIF_F_HW_VLAN_FILTER;
+                          NETIF_F_HW_VLAN_CTAG_FILTER;
        netdev->hw_features |= NETIF_F_RXCSUM;
 
        if (pci_using_dac) {
@@ -717,14 +719,11 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        txdr->size = ALIGN(txdr->size, 4096);
 
        txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
-                                       GFP_KERNEL);
+                                       GFP_KERNEL | __GFP_ZERO);
        if (!txdr->desc) {
                vfree(txdr->buffer_info);
-               netif_err(adapter, probe, adapter->netdev,
-                         "Unable to allocate transmit descriptor memory\n");
                return -ENOMEM;
        }
-       memset(txdr->desc, 0, txdr->size);
 
        txdr->next_to_use = 0;
        txdr->next_to_clean = 0;
@@ -807,8 +806,6 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
 
        if (!rxdr->desc) {
                vfree(rxdr->buffer_info);
-               netif_err(adapter, probe, adapter->netdev,
-                         "Unable to allocate receive descriptors\n");
                return -ENOMEM;
        }
        memset(rxdr->desc, 0, rxdr->size);
@@ -1145,7 +1142,7 @@ ixgb_set_multi(struct net_device *netdev)
        }
 
 alloc_failed:
-       if (netdev->features & NETIF_F_HW_VLAN_RX)
+       if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
                ixgb_vlan_strip_enable(adapter);
        else
                ixgb_vlan_strip_disable(adapter);
@@ -2085,8 +2082,8 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
 
                skb->protocol = eth_type_trans(skb, netdev);
                if (status & IXGB_RX_DESC_STATUS_VP)
-                       __vlan_hwaccel_put_tag(skb,
-                                              le16_to_cpu(rx_desc->special));
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
+                                      le16_to_cpu(rx_desc->special));
 
                netif_receive_skb(skb);
 
@@ -2159,6 +2156,10 @@ map_skb:
                                                  skb->data,
                                                  adapter->rx_buffer_len,
                                                  DMA_FROM_DEVICE);
+               if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+                       adapter->alloc_rx_buff_failed++;
+                       break;
+               }
 
                rx_desc = IXGB_RX_DESC(*rx_ring, i);
                rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
@@ -2168,7 +2169,8 @@ map_skb:
                rx_desc->status = 0;
 
 
-               if (++i == rx_ring->count) i = 0;
+               if (++i == rx_ring->count)
+                       i = 0;
                buffer_info = &rx_ring->buffer_info[i];
        }
 
@@ -2209,7 +2211,7 @@ ixgb_vlan_strip_disable(struct ixgb_adapter *adapter)
 }
 
 static int
-ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
+ixgb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
 {
        struct ixgb_adapter *adapter = netdev_priv(netdev);
        u32 vfta, index;
@@ -2226,7 +2228,7 @@ ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 }
 
 static int
-ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
+ixgb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
 {
        struct ixgb_adapter *adapter = netdev_priv(netdev);
        u32 vfta, index;
@@ -2248,7 +2250,7 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
        u16 vid;
 
        for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
-               ixgb_vlan_rx_add_vid(adapter->netdev, vid);
+               ixgb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER