BNX2X: spatch ether->mtu -> ether->maxmtu
[akaros.git] / kern / drivers / net / bnx2x / bnx2x_main.c
index 156eb02..b82b545 100644 (file)
@@ -769,7 +769,8 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl)
        /* dump buffer after the mark */
        for (offset = mark; offset < trace_shmem_base; offset += 0x8*4) {
                for (word = 0; word < 8; word++)
-                       data[word] = htonl(REG_RD(bp, offset + 4*word));
+                       data[word] = cpu_to_be32(REG_RD(bp,
+                                                offset + 4 * word));
                data[8] = 0x0;
                pr_cont("%s", (char *)data);
        }
@@ -777,7 +778,8 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl)
        /* dump buffer before the mark */
        for (offset = addr + 4; offset <= mark; offset += 0x8*4) {
                for (word = 0; word < 8; word++)
-                       data[word] = htonl(REG_RD(bp, offset + 4*word));
+                       data[word] = cpu_to_be32(REG_RD(bp,
+                                                offset + 4 * word));
                data[8] = 0x0;
                pr_cont("%s", (char *)data);
        }
@@ -1656,7 +1658,7 @@ void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
                for_each_eth_queue(bp, i)
                        synchronize_irq(bp->msix_table[offset++].vector);
        } else
-               synchronize_irq(bp->pdev->irq);
+               synchronize_irq(bp->pdev->irqline);
 
        /* make sure sp_task is not running */
        cancel_delayed_work(&bp->sp_task);
@@ -2278,7 +2280,7 @@ static void bnx2x_set_requested_fc(struct bnx2x *bp)
         * It is recommended to turn off RX FC for jumbo frames
         *  for better performance
         */
-       if (CHIP_IS_E1x(bp) && (bp->dev->mtu > 5000))
+       if (CHIP_IS_E1x(bp) && (bp->dev->maxmtu > 5000))
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX;
        else
                bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;
@@ -3126,7 +3128,7 @@ static void bnx2x_pf_q_prep_general(struct bnx2x *bp,
        if (IS_FCOE_FP(fp))
                gen_init->mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
        else
-               gen_init->mtu = bp->dev->mtu;
+               gen_init->mtu = bp->dev->maxmtu;
 
        gen_init->cos = cos;
 
@@ -3151,7 +3153,7 @@ static void bnx2x_pf_rx_q_prep(struct bnx2x *bp,
                                MAX_RX_SGE_CNT * NUM_RX_SGE_PAGES);
 
                tpa_agg_size = TPA_AGG_SIZE;
-               max_sge = SGE_PAGE_ALIGN(bp->dev->mtu) >>
+               max_sge = SGE_PAGE_ALIGN(bp->dev->maxmtu) >>
                        SGE_PAGE_SHIFT;
                max_sge = ((max_sge + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
@@ -3356,10 +3358,10 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp)
                                DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED,
                                ether_stat->mac_local + MAC_PAD, MAC_PAD,
                                Eaddrlen);
-       ether_stat->mtu_size = bp->dev->mtu;
-       if (bp->dev->features & NETIF_F_RXCSUM)
+       ether_stat->mtu_size = bp->dev->maxmtu;
+       if (bp->dev->feat & NETIF_F_RXCSUM)
                ether_stat->feature_flags |= FEATURE_ETH_CHKSUM_OFFLOAD_MASK;
-       if (bp->dev->features & NETIF_F_TSO)
+       if (bp->dev->feat & NETIF_F_TSO)
                ether_stat->feature_flags |= FEATURE_ETH_LSO_MASK;
        ether_stat->feature_flags |= bp->common.boot_mode;
 
@@ -5195,7 +5197,7 @@ static void bnx2x_handle_mcast_eqe(struct bnx2x *bp)
 
        rparam.mcast_obj = &bp->mcast_obj;
 
-       netif_addr_lock_bh(bp->dev);
+       qlock(&bp->dev->qlock);
 
        /* Clear pending state for the last command */
        bp->mcast_obj.raw.clear_pending(&bp->mcast_obj.raw);
@@ -5208,7 +5210,7 @@ static void bnx2x_handle_mcast_eqe(struct bnx2x *bp)
                                  rc);
        }
 
-       netif_addr_unlock_bh(bp->dev);
+       qunlock(&bp->dev->qlock);
 }
 
 static void bnx2x_handle_classification_eqe(struct bnx2x *bp,
@@ -5257,7 +5259,7 @@ static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp, bool start);
 
 static void bnx2x_handle_rx_mode_eqe(struct bnx2x *bp)
 {
-       netif_addr_lock_bh(bp->dev);
+       qlock(&bp->dev->qlock);
 
        clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state);
 
@@ -5271,7 +5273,7 @@ static void bnx2x_handle_rx_mode_eqe(struct bnx2x *bp)
                                    &bp->sp_state))
                bnx2x_set_iscsi_eth_rx_mode(bp, false);
 
-       netif_addr_unlock_bh(bp->dev);
+       qunlock(&bp->dev->qlock);
 }
 
 static void bnx2x_after_afex_vif_lists(struct bnx2x *bp,
@@ -7460,11 +7462,11 @@ static int bnx2x_init_hw_port(struct bnx2x *bp)
 
                if (IS_MF(bp))
                        low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
-               else if (bp->dev->mtu > 4096) {
+               else if (bp->dev->maxmtu > 4096) {
                        if (bp->flags & ONE_PORT_FLAG)
                                low = 160;
                        else {
-                               val = bp->dev->mtu;
+                               val = bp->dev->maxmtu;
                                /* (24*1024 + val*4)/256 */
                                low = 96 + (val/64) +
                                                ((val % 64) ? 1 : 0);
@@ -9072,7 +9074,7 @@ static int bnx2x_func_wait_started(struct bnx2x *bp)
        if (msix)
                synchronize_irq(bp->msix_table[0].vector);
        else
-               synchronize_irq(bp->pdev->irq);
+               synchronize_irq(bp->pdev->irqline);
 
        flush_workqueue(bnx2x_wq);
        flush_workqueue(bnx2x_iov_wq);
@@ -9199,7 +9201,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
         * We need to take a netif_addr_lock() here in order to prevent
         * a race between the completion code and this code.
         */
-       netif_addr_lock_bh(bp->dev);
+       qlock(&bp->dev->qlock);
        /* Schedule the rx_mode command */
        if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state))
                set_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state);
@@ -9212,7 +9214,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
        if (rc < 0)
                BNX2X_ERR("Failed to send DEL multicast command: %d\n", rc);
 
-       netif_addr_unlock_bh(bp->dev);
+       qunlock(&bp->dev->qlock);
 
        bnx2x_iov_chip_cleanup(bp);
 
@@ -12063,10 +12065,10 @@ static int bnx2x_init_bp(struct bnx2x *bp)
        /* Set TPA flags */
        if (bp->disable_tpa) {
                bp->flags &= ~(TPA_ENABLE_FLAG | GRO_ENABLE_FLAG);
-               bp->dev->features &= ~NETIF_F_LRO;
+               bp->dev->feat &= ~NETIF_F_LRO;
        } else {
                bp->flags |= (TPA_ENABLE_FLAG | GRO_ENABLE_FLAG);
-               bp->dev->features |= NETIF_F_LRO;
+               bp->dev->feat |= NETIF_F_LRO;
        }
 
        if (CHIP_IS_E1(bp))
@@ -12366,7 +12368,7 @@ void bnx2x_set_rx_mode_inner(struct bnx2x *bp)
 
        DP(NETIF_MSG_IFUP, "dev->flags = %x\n", bp->dev->flags);
 
-       netif_addr_lock_bh(bp->dev);
+       qlock(&bp->dev->qlock);
 
        if (bp->dev->flags & IFF_PROMISC) {
                rx_mode = BNX2X_RX_MODE_PROMISC;
@@ -12381,10 +12383,10 @@ void bnx2x_set_rx_mode_inner(struct bnx2x *bp)
                                rx_mode = BNX2X_RX_MODE_ALLMULTI;
 
                        /* release bh lock, as bnx2x_set_uc_list might sleep */
-                       netif_addr_unlock_bh(bp->dev);
+                       qunlock(&bp->dev->qlock);
                        if (bnx2x_set_uc_list(bp) < 0)
                                rx_mode = BNX2X_RX_MODE_PROMISC;
-                       netif_addr_lock_bh(bp->dev);
+                       qlock(&bp->dev->qlock);
                } else {
                        /* configuring mcast to a vf involves sleeping (when we
                         * wait for the pf's response).
@@ -12402,19 +12404,19 @@ void bnx2x_set_rx_mode_inner(struct bnx2x *bp)
        /* Schedule the rx_mode command */
        if (test_bit(BNX2X_FILTER_RX_MODE_PENDING, &bp->sp_state)) {
                set_bit(BNX2X_FILTER_RX_MODE_SCHED, &bp->sp_state);
-               netif_addr_unlock_bh(bp->dev);
+               qunlock(&bp->dev->qlock);
                return;
        }
 
        if (IS_PF(bp)) {
                bnx2x_set_storm_rx_mode(bp);
-               netif_addr_unlock_bh(bp->dev);
+               qunlock(&bp->dev->qlock);
        } else {
                /* VF will need to request the PF to make this change, and so
                 * the VF needs to release the bottom-half lock prior to the
                 * request (as it will likely require sleep on the VF side)
                 */
-               netif_addr_unlock_bh(bp->dev);
+               qunlock(&bp->dev->qlock);
                bnx2x_vfpf_storm_rx_mode(bp);
        }
 }
@@ -12663,7 +12665,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_device *pdev,
        dev->base_addr = dev->mem_start;
        dev->mem_end = pci_resource_end(pdev, 0);
 
-       dev->irq = pdev->irq;
+       dev->irq = pdev->irqline;
 
        bp->regview = pci_ioremap_bar(pdev, 0);
        if (!bp->regview) {
@@ -12740,19 +12742,10 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_device *pdev,
        if (!CHIP_IS_E1x(bp)) {
                dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL |
                                    NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT;
-               dev->hw_enc_features =
-                       NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
-                       NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
-                       NETIF_F_GSO_IPIP |
-                       NETIF_F_GSO_SIT |
-                       NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL;
        }
 
-       dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-               NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
-
-       dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
-       dev->features |= NETIF_F_HIGHDMA;
+       dev->feat |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
+       dev->feat |= NETIF_F_HIGHDMA;
 
        /* Add Loopback capability to the device */
        dev->hw_features |= NETIF_F_LOOPBACK;
@@ -13489,7 +13482,7 @@ static int bnx2x_init_one(struct pci_device *pdev,
                       pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" :
                       pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" :
                       "Unknown",
-                      dev->base_addr, bp->pdev->irq, dev->dev_addr);
+                      dev->base_addr, bp->pdev->irqline, dev->dev_addr);
 
        bnx2x_register_phc(bp);
 
@@ -14194,9 +14187,9 @@ static int bnx2x_drv_ctl(struct ether *dev, struct drv_ctl_info *ctl)
 
                /* Start accepting on iSCSI L2 ring */
 
-               netif_addr_lock_bh(dev);
+               qlock(&dev->qlock);
                bnx2x_set_iscsi_eth_rx_mode(bp, true);
-               netif_addr_unlock_bh(dev);
+               qunlock(&dev->qlock);
 
                /* bits to wait on */
                __set_bit(BNX2X_FILTER_RX_MODE_PENDING, &sp_bits);
@@ -14213,9 +14206,9 @@ static int bnx2x_drv_ctl(struct ether *dev, struct drv_ctl_info *ctl)
                unsigned long sp_bits = 0;
 
                /* Stop accepting on iSCSI L2 ring */
-               netif_addr_lock_bh(dev);
+               qlock(&dev->qlock);
                bnx2x_set_iscsi_eth_rx_mode(bp, false);
-               netif_addr_unlock_bh(dev);
+               qunlock(&dev->qlock);
 
                /* bits to wait on */
                __set_bit(BNX2X_FILTER_RX_MODE_PENDING, &sp_bits);