Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / drivers / net / sky2.c
index 7985165e84fc4ed6ca6ce5fceb8e60d54dca0b5d..d6577084ce70b79690e79aea191ac2b36240cbfb 100644 (file)
@@ -79,7 +79,7 @@
 
 #define SKY2_EEPROM_MAGIC      0x9955aabb
 
-#define RING_NEXT(x,s) (((x)+1) & ((s)-1))
+#define RING_NEXT(x, s)        (((x)+1) & ((s)-1))
 
 static const u32 default_msg =
     NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
@@ -172,7 +172,7 @@ static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
                udelay(10);
        }
 
-       dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name);
+       dev_warn(&hw->pdev->dev, "%s: phy write timeout\n", hw->dev[port]->name);
        return -ETIMEDOUT;
 
 io_error:
@@ -1067,7 +1067,7 @@ static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2)
        return le;
 }
 
-static unsigned sky2_get_rx_threshold(struct sky2_portsky2)
+static unsigned sky2_get_rx_threshold(struct sky2_port *sky2)
 {
        unsigned size;
 
@@ -1078,7 +1078,7 @@ static unsigned sky2_get_rx_threshold(struct sky2_port* sky2)
        return (size - 8) / sizeof(u32);
 }
 
-static unsigned sky2_get_rx_data_size(struct sky2_portsky2)
+static unsigned sky2_get_rx_data_size(struct sky2_port *sky2)
 {
        struct rx_ring_info *re;
        unsigned size;
@@ -1102,7 +1102,7 @@ static unsigned sky2_get_rx_data_size(struct sky2_port* sky2)
 }
 
 /* Build description to hardware for one receive segment */
-static void sky2_rx_add(struct sky2_port *sky2,  u8 op,
+static void sky2_rx_add(struct sky2_port *sky2, u8 op,
                        dma_addr_t map, unsigned len)
 {
        struct sky2_rx_le *le;
@@ -1782,7 +1782,7 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
        ctrl = 0;
 #ifdef SKY2_VLAN_TAG_USED
        /* Add VLAN tag, can piggyback on LRGLEN or ADDR64 */
-       if (sky2->vlgrp && vlan_tx_tag_present(skb)) {
+       if (vlan_tx_tag_present(skb)) {
                if (!le) {
                        le = get_tx_le(sky2, &slot);
                        le->addr = 0;
@@ -3014,7 +3014,7 @@ static int __devinit sky2_init(struct sky2_hw *hw)
        hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
        hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
 
-       switch(hw->chip_id) {
+       switch (hw->chip_id) {
        case CHIP_ID_YUKON_XL:
                hw->flags = SKY2_HW_GIGABIT | SKY2_HW_NEWER_PHY;
                if (hw->chip_rev < CHIP_REV_YU_XL_A2)
@@ -3685,7 +3685,7 @@ static int sky2_set_mac_address(struct net_device *dev, void *p)
        return 0;
 }
 
-static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
+static inline void sky2_add_filter(u8 filter[8], const u8 *addr)
 {
        u32 bit;
 
@@ -3911,7 +3911,7 @@ static int sky2_set_coalesce(struct net_device *dev,
                return -EINVAL;
        if (ecmd->rx_max_coalesced_frames > RX_MAX_PENDING)
                return -EINVAL;
-       if (ecmd->rx_max_coalesced_frames_irq >RX_MAX_PENDING)
+       if (ecmd->rx_max_coalesced_frames_irq > RX_MAX_PENDING)
                return -EINVAL;
 
        if (ecmd->tx_coalesce_usecs == 0)
@@ -4188,17 +4188,13 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
 static int sky2_set_flags(struct net_device *dev, u32 data)
 {
        struct sky2_port *sky2 = netdev_priv(dev);
+       u32 supported =
+               (sky2->hw->flags & SKY2_HW_RSS_BROKEN) ? 0 : ETH_FLAG_RXHASH;
+       int rc;
 
-       if (data & ~ETH_FLAG_RXHASH)
-               return -EOPNOTSUPP;
-
-       if (data & ETH_FLAG_RXHASH) {
-               if (sky2->hw->flags & SKY2_HW_RSS_BROKEN)
-                       return -EINVAL;
-
-               dev->features |= NETIF_F_RXHASH;
-       } else
-               dev->features &= ~NETIF_F_RXHASH;
+       rc = ethtool_op_set_flags(dev, data, supported);
+       if (rc)
+               return rc;
 
        rx_set_rss(dev);
 
@@ -4376,7 +4372,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
                        seq_printf(seq, "%u:", idx);
                sop = 0;
 
-               switch(le->opcode & ~HW_OWNER) {
+               switch (le->opcode & ~HW_OWNER) {
                case OP_ADDR64:
                        seq_printf(seq, " %#x:", a);
                        break;
@@ -4445,7 +4441,7 @@ static int sky2_device_event(struct notifier_block *unused,
        if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug)
                return NOTIFY_DONE;
 
-       switch(event) {
+       switch (event) {
        case NETDEV_CHANGENAME:
                if (sky2->debugfs) {
                        sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
@@ -4585,7 +4581,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
 
        sky2->port = port;
 
-       dev->features |= NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_SG;
+       dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG
+               | NETIF_F_TSO  | NETIF_F_GRO;
        if (highmem)
                dev->features |= NETIF_F_HIGHDMA;
 
@@ -4640,7 +4637,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
        struct pci_dev *pdev = hw->pdev;
        int err;
 
-       init_waitqueue_head (&hw->msi_wait);
+       init_waitqueue_head(&hw->msi_wait);
 
        sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
 
@@ -4757,7 +4754,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
         * this driver uses software swapping.
         */
        reg &= ~PCI_REV_DESC;
-       err = pci_write_config_dword(pdev,PCI_DEV_REG2, reg);
+       err = pci_write_config_dword(pdev, PCI_DEV_REG2, reg);
        if (err) {
                dev_err(&pdev->dev, "PCI write config failed\n");
                goto err_out_free_regions;