BNX2X: spatch ether->mtu -> ether->maxmtu
[akaros.git] / kern / drivers / net / bnx2x / bnx2x_main.c
index adf9b89..b82b545 100644 (file)
@@ -241,7 +241,7 @@ static DEFINE_SEMAPHORE(bnx2x_prev_sem);
 static LINUX_LIST_HEAD(bnx2x_prev_list);
 
 /* Forward declaration */
-static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev);
+static struct cnic_eth_dev *bnx2x_cnic_probe(struct ether *dev);
 static uint32_t bnx2x_rx_ustorm_prods_offset(struct bnx2x_fastpath *fp);
 static int bnx2x_set_storm_rx_mode(struct bnx2x *bp);
 
@@ -485,7 +485,7 @@ int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
         * from ndo_set_rx_mode() flow that may be called from BH.
         */
 
-       spin_lock_bh(&bp->dmae_lock);
+       spin_lock(&bp->dmae_lock);
 
        /* reset completion */
        *comp = 0;
@@ -514,7 +514,7 @@ int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, struct dmae_command *dmae,
 
 unlock:
 
-       spin_unlock_bh(&bp->dmae_lock);
+       spin_unlock(&bp->dmae_lock);
 
        return rc;
 }
@@ -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);
        }
@@ -1480,7 +1482,7 @@ static int bnx2x_pf_flr_clnup(struct bnx2x *bp)
        bnx2x_tx_hw_flushed(bp, poll_cnt);
 
        /* Wait 100ms (not adjusted according to platform) */
-       msleep(100);
+       kthread_usleep(1000 * 100);
 
        /* Verify no pending pci transactions */
        if (bnx2x_is_pcie_pending(bp->pdev))
@@ -1547,7 +1549,7 @@ static void bnx2x_hc_int_enable(struct bnx2x *bp)
         * Ensure that HC_CONFIG is written before leading/trailing edge config
         */
        bus_wmb();
-       barrier();
+       cmb();
 
        if (!CHIP_IS_E1(bp)) {
                /* init leading/trailing edge */
@@ -1612,7 +1614,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
        if (val & IGU_PF_CONF_INT_LINE_EN)
                pci_intx(bp->pdev, true);
 
-       barrier();
+       cmb();
 
        /* init leading/trailing edge */
        if (IS_MF(bp)) {
@@ -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);
@@ -1749,7 +1751,7 @@ static int bnx2x_schedule_sp_task(struct bnx2x *bp)
         * is set, otherwise we will get out of sync and miss all
         * further interrupts. Hence, the barrier.
         */
-       smp_wmb();
+       wmb();
 
        /* schedule sp_task to workqueue */
        return queue_delayed_work(bnx2x_wq, &bp->sp_task, 0);
@@ -1832,10 +1834,10 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
                return;
 #endif
 
-       smp_mb__before_atomic();
+       cmb();
        atomic_inc(&bp->cq_spq_left);
        /* push the change in bp->spq_left and towards the memory */
-       smp_mb__after_atomic();
+       cmb();
 
        DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left));
 
@@ -1850,11 +1852,11 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
                 * sp_state is cleared, and this order prevents
                 * races
                 */
-               smp_mb__before_atomic();
+               cmb();
                set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state);
                wmb();
                clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
-               smp_mb__after_atomic();
+               cmb();
 
                /* schedule the sp task as mcp ack is required */
                bnx2x_schedule_sp_task(bp);
@@ -1976,7 +1978,7 @@ int bnx2x_acquire_hw_lock(struct bnx2x *bp, uint32_t resource)
                if (lock_status & resource_bit)
                        return 0;
 
-               usleep_range(5000, 10000);
+               kthread_usleep(5000);
        }
        BNX2X_ERR("Timeout\n");
        return -EAGAIN;
@@ -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;
@@ -2934,7 +2936,7 @@ static void bnx2x_pmf_update(struct bnx2x *bp)
         * We need the mb() to ensure the ordering between the writing to
         * bp->port.pmf here and reading it from the bnx2x_periodic_task().
         */
-       smp_mb();
+       mb();
 
        /* queue a periodic task */
        queue_delayed_work(bnx2x_wq, &bp->period_task, 0);
@@ -2981,7 +2983,7 @@ uint32_t bnx2x_fw_command(struct bnx2x *bp, uint32_t command, uint32_t param)
 
        do {
                /* let the FW do it's magic ... */
-               msleep(delay);
+               kthread_usleep(1000 * delay);
 
                rc = SHMEM_RD(bp, func_mb[mb_idx].fw_mb_header);
 
@@ -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,11 +3153,11 @@ 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;
-               sge_sz = (uint16_t)min_t(uint32_t, SGE_PAGES, 0xffff);
+               sge_sz = (uint16_t)MIN_T(uint32_t, SGE_PAGES, 0xffff);
        }
 
        /* pause - not for e1 */
@@ -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;
 
@@ -3591,7 +3593,7 @@ static void bnx2x_handle_drv_info_req(struct bnx2x *bp)
                                break;
                        }
 
-                       msleep(BNX2X_UPDATE_DRV_INFO_IND_LENGTH);
+                       kthread_usleep(1000 * BNX2X_UPDATE_DRV_INFO_IND_LENGTH);
                }
        }
        if (!release) {
@@ -3810,18 +3812,18 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
        }
 #endif
 
-       spin_lock_bh(&bp->spq_lock);
+       spin_lock(&bp->spq_lock);
 
        if (common) {
                if (!atomic_read(&bp->eq_spq_left)) {
                        BNX2X_ERR("BUG! EQ ring full!\n");
-                       spin_unlock_bh(&bp->spq_lock);
+                       spin_unlock(&bp->spq_lock);
                        bnx2x_panic();
                        return -EBUSY;
                }
        } else if (!atomic_read(&bp->cq_spq_left)) {
                        BNX2X_ERR("BUG! SPQ ring full!\n");
-                       spin_unlock_bh(&bp->spq_lock);
+                       spin_unlock(&bp->spq_lock);
                        bnx2x_panic();
                        return -EBUSY;
        }
@@ -3870,7 +3872,7 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
           atomic_read(&bp->cq_spq_left), atomic_read(&bp->eq_spq_left));
 
        bnx2x_sp_prod_update(bp);
-       spin_unlock_bh(&bp->spq_lock);
+       spin_unlock(&bp->spq_lock);
        return 0;
 }
 
@@ -3887,7 +3889,7 @@ static int bnx2x_acquire_alr(struct bnx2x *bp)
                if (val & MCPR_ACCESS_LOCK_LOCK)
                        break;
 
-               usleep_range(5000, 10000);
+               kthread_usleep(5000);
        }
        if (!(val & MCPR_ACCESS_LOCK_LOCK)) {
                BNX2X_ERR("Cannot acquire MCP access lock register\n");
@@ -3911,7 +3913,7 @@ static uint16_t bnx2x_update_dsb_idx(struct bnx2x *bp)
        struct host_sp_status_block *def_sb = bp->def_status_blk;
        uint16_t rc = 0;
 
-       barrier(); /* status block is written to by the chip */
+       cmb(); /* status block is written to by the chip */
        if (bp->def_att_idx != def_sb->atten_status_block.attn_bits_index) {
                bp->def_att_idx = def_sb->atten_status_block.attn_bits_index;
                rc |= BNX2X_DEF_SB_ATT_IDX;
@@ -3923,7 +3925,7 @@ static uint16_t bnx2x_update_dsb_idx(struct bnx2x *bp)
        }
 
        /* Do not reorder: indices reading should complete before handling */
-       barrier();
+       cmb();
        return rc;
 }
 
@@ -4046,7 +4048,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, uint32_t asserted)
                        if (!igu_acked)
                                DP(NETIF_MSG_HW,
                                   "Failed to verify IGU ack on time\n");
-                       barrier();
+                       cmb();
                }
                REG_WR(bp, nig_int_mask_addr, nig_mask);
                bnx2x_release_phy_lock(bp);
@@ -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,
@@ -5339,9 +5341,9 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
                __clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags);
 
                /* mark latest Q bit */
-               smp_mb__before_atomic();
+               cmb();
                set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
-               smp_mb__after_atomic();
+               cmb();
 
                /* send Q update ramrod for FCoE Q */
                rc = bnx2x_queue_state_change(bp, &queue_params);
@@ -5575,13 +5577,13 @@ next_spqe:
                spqe_cnt++;
        } /* for */
 
-       smp_mb__before_atomic();
+       cmb();
        atomic_add(spqe_cnt, &bp->eq_spq_left);
 
        bp->eq_cons = sw_cons;
        bp->eq_prod = sw_prod;
        /* Make sure that above mem writes were issued towards the memory */
-       smp_wmb();
+       wmb();
 
        /* update producer */
        bnx2x_update_eq_prod(bp, bp->eq_prod);
@@ -5594,7 +5596,7 @@ static void bnx2x_sp_task(struct work_struct *work)
        DP(BNX2X_MSG_SP, "sp task invoked\n");
 
        /* make sure the atomic interrupt_occurred has been written */
-       smp_rmb();
+       rmb();
        if (atomic_read(&bp->interrupt_occurred)) {
 
                /* what work needs to be performed? */
@@ -5652,7 +5654,7 @@ static void bnx2x_sp_task(struct work_struct *work)
 
 irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
 {
-       struct net_device *dev = dev_instance;
+       struct ether *dev = dev_instance;
        struct bnx2x *bp = netdev_priv(dev);
 
        bnx2x_ack_sb(bp, bp->igu_dsb_id, USTORM_ID, 0,
@@ -6035,7 +6037,7 @@ void bnx2x_update_coalesce(struct bnx2x *bp)
 
 static void bnx2x_init_sp_ring(struct bnx2x *bp)
 {
-       spin_lock_init(&bp->spq_lock);
+       spinlock_init_irqsave(&bp->spq_lock);
        atomic_set(&bp->cq_spq_left, MAX_SPQ_PENDING);
 
        bp->spq_prod_idx = 0;
@@ -6063,7 +6065,7 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp)
        bp->eq_cons_sb = BNX2X_EQ_INDEX;
        /* we want a warning message before it gets wrought... */
        atomic_set(&bp->eq_spq_left,
-               min_t(int, MAX_SP_DESC_CNT - MAX_SPQ_PENDING, NUM_EQ_DESC) - 1);
+               MIN_T(int, MAX_SP_DESC_CNT - MAX_SPQ_PENDING, NUM_EQ_DESC) - 1);
 }
 
 /* called with netif_addr_lock_bh() */
@@ -6474,11 +6476,11 @@ void bnx2x_post_irq_nic_init(struct bnx2x *bp, uint32_t load_code)
 static int bnx2x_gunzip_init(struct bnx2x *bp)
 {
        bp->gunzip_buf = dma_alloc_coherent(&bp->pdev->dev, FW_BUF_SIZE,
-                                           &bp->gunzip_mapping, GFP_KERNEL);
+                                           &bp->gunzip_mapping, KMALLOC_WAIT);
        if (bp->gunzip_buf  == NULL)
                goto gunzip_nomem1;
 
-       bp->strm = kmalloc(sizeof(*bp->strm), GFP_KERNEL);
+       bp->strm = kmalloc(sizeof(*bp->strm), KMALLOC_WAIT);
        if (bp->strm  == NULL)
                goto gunzip_nomem2;
 
@@ -6626,7 +6628,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
                if (val == 0x10)
                        break;
 
-               usleep_range(10000, 20000);
+               kthread_usleep(10000);
                count--;
        }
        if (val != 0x10) {
@@ -6641,7 +6643,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
                if (val == 1)
                        break;
 
-               usleep_range(10000, 20000);
+               kthread_usleep(10000);
                count--;
        }
        if (val != 0x1) {
@@ -6651,9 +6653,9 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
 
        /* Reset and init BRB, PRS */
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, 0x03);
-       msleep(50);
+       kthread_usleep(1000 * 50);
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03);
-       msleep(50);
+       kthread_usleep(1000 * 50);
        bnx2x_init_block(bp, BLOCK_BRB1, PHASE_COMMON);
        bnx2x_init_block(bp, BLOCK_PRS, PHASE_COMMON);
 
@@ -6682,7 +6684,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
                if (val == 0xb0)
                        break;
 
-               usleep_range(10000, 20000);
+               kthread_usleep(10000);
                count--;
        }
        if (val != 0xb0) {
@@ -6699,7 +6701,7 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
        REG_WR(bp, PRS_REG_CFC_SEARCH_INITIAL_CREDIT, 0x1);
 
        /* Wait until PRS register shows 3 packets */
-       msleep(10 * factor);
+       kthread_usleep(1000 * (10 * factor));
        /* Wait until NIG register shows 1 packet of size 0x10 */
        val = REG_RD(bp, PRS_REG_NUM_OF_PACKETS);
        if (val != 3)
@@ -6716,9 +6718,9 @@ static int bnx2x_int_mem_test(struct bnx2x *bp)
 
        /* Reset and init BRB, PRS, NIG */
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, 0x03);
-       msleep(50);
+       kthread_usleep(1000 * 50);
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0x03);
-       msleep(50);
+       kthread_usleep(1000 * 50);
        bnx2x_init_block(bp, BLOCK_BRB1, PHASE_COMMON);
        bnx2x_init_block(bp, BLOCK_PRS, PHASE_COMMON);
        if (!CNIC_SUPPORT(bp))
@@ -6815,7 +6817,7 @@ static void bnx2x_reset_common(struct bnx2x *bp)
 static void bnx2x_setup_dmae(struct bnx2x *bp)
 {
        bp->dmae_ready = 0;
-       spin_lock_init(&bp->dmae_lock);
+       spinlock_init_irqsave(&bp->dmae_lock);
 }
 
 static void bnx2x_init_pxp(struct bnx2x *bp)
@@ -7021,7 +7023,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
                REG_WR(bp, PXP2_REG_PGL_TAGS_LIMIT, 0x1);
 
        /* let the HW do it's magic ... */
-       msleep(100);
+       kthread_usleep(1000 * 100);
        /* finish PXP init */
        val = REG_RD(bp, PXP2_REG_RQ_CFG_DONE);
        if (val != 1) {
@@ -7144,7 +7146,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
 
                /* let the HW do it's magic ... */
                do {
-                       msleep(200);
+                       kthread_usleep(1000 * 200);
                        val = REG_RD(bp, ATC_REG_ATC_INIT_DONE);
                } while (factor-- && (val != 1));
 
@@ -7234,7 +7236,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
                           VFC_MEMORIES_RST_REG_CAM_RST |
                           VFC_MEMORIES_RST_REG_RAM_RST);
 
-               msleep(20);
+               kthread_usleep(1000 * 20);
        }
 
        bnx2x_init_block(bp, BLOCK_TSEM, PHASE_COMMON);
@@ -7341,7 +7343,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
                REG_WR(bp, NIG_REG_LLH_E1HOV_MODE, IS_MF_SD(bp));
 
        if (CHIP_REV_IS_SLOW(bp))
-               msleep(200);
+               kthread_usleep(1000 * 200);
 
        /* finish CFC init */
        val = reg_poll(bp, CFC_REG_LL_INIT_DONE, 1, 100, 10);
@@ -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);
@@ -7678,16 +7680,16 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, uint8_t func,
                         data, igu_addr_data);
        REG_WR(bp, igu_addr_data, data);
        bus_wmb();
-       barrier();
+       cmb();
        DP(NETIF_MSG_HW, "write 0x%08x to IGU(via GRC) addr 0x%x\n",
                          ctl, igu_addr_ctl);
        REG_WR(bp, igu_addr_ctl, ctl);
        bus_wmb();
-       barrier();
+       cmb();
 
        /* wait for clean up to finish */
        while (!(REG_RD(bp, igu_addr_ack) & sb_bit) && --cnt)
-               msleep(20);
+               kthread_usleep(1000 * 20);
 
        if (!(REG_RD(bp, igu_addr_ack) & sb_bit)) {
                DP(NETIF_MSG_HW,
@@ -7911,7 +7913,7 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
                 * needed to make sure there are no requests in
                 * one of the PXP internal queues with "old" ILT addresses
                 */
-               msleep(20);
+               kthread_usleep(1000 * 20);
                /*
                 * Master enable - Due to WB DMAE writes performed before this
                 * register is re-initialized as part of the regular function
@@ -8273,7 +8275,7 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
        context_size = sizeof(union cdu_context) * BNX2X_L2_CID_COUNT(bp);
 
        for (i = 0, allocated = 0; allocated < context_size; i++) {
-               bp->context[i].size = min(CDU_ILT_PAGE_SZ,
+               bp->context[i].size = MIN(CDU_ILT_PAGE_SZ,
                                          (context_size - allocated));
                bp->context[i].vcxt = BNX2X_PCI_ALLOC(&bp->context[i].cxt_mapping,
                                                      bp->context[i].size);
@@ -8281,8 +8283,8 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
                        goto alloc_mem_err;
                allocated += bp->context[i].size;
        }
-       bp->ilt->lines = kcalloc(ILT_MAX_LINES, sizeof(struct ilt_line),
-                                GFP_KERNEL);
+       bp->ilt->lines = kzmalloc((ILT_MAX_LINES) * (sizeof(struct ilt_line)),
+                                 KMALLOC_WAIT);
        if (!bp->ilt->lines)
                goto alloc_mem_err;
 
@@ -8483,7 +8485,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
           ilt_client->end,
           ilt_client->page_size,
           ilt_client->flags,
-          ilog2(ilt_client->page_size >> 12));
+          LOG2_UP(ilt_client->page_size >> 12));
 
        /* QM */
        if (QM_INIT(bp->qm_cid_count)) {
@@ -8505,7 +8507,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
        }
 
        if (CNIC_SUPPORT(bp)) {
@@ -8524,7 +8526,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
 
                /* TM */
                ilt_client = &ilt->clients[ILT_CLIENT_TM];
@@ -8541,7 +8543,7 @@ void bnx2x_ilt_set_info(struct bnx2x *bp)
                   ilt_client->end,
                   ilt_client->page_size,
                   ilt_client->flags,
-                  ilog2(ilt_client->page_size >> 12));
+                  LOG2_UP(ilt_client->page_size >> 12));
        }
 
        BUG_ON(line > ILT_MAX_LINES);
@@ -8854,7 +8856,7 @@ static void bnx2x_reset_func(struct bnx2x *bp)
                 * scan to complete
                 */
                for (i = 0; i < 200; i++) {
-                       usleep_range(10000, 20000);
+                       kthread_usleep(10000);
                        if (!REG_RD(bp, TM_REG_LIN0_SCAN_ON + port*4))
                                break;
                }
@@ -8902,7 +8904,7 @@ static void bnx2x_reset_port(struct bnx2x *bp)
        /* Configure AEU */
        REG_WR(bp, MISC_REG_AEU_MASK_ATTN_FUNC_0 + port*4, 0);
 
-       msleep(100);
+       kthread_usleep(1000 * 100);
        /* Check for BRB port occupancy */
        val = REG_RD(bp, BRB1_REG_PORT_NUM_OCC_BLOCKS_0 + port*4);
        if (val)
@@ -9072,14 +9074,14 @@ 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);
 
        while (bnx2x_func_get_state(bp, &bp->func_obj) !=
                                BNX2X_F_STATE_STARTED && tout--)
-               msleep(20);
+               kthread_usleep(1000 * 20);
 
        if (bnx2x_func_get_state(bp, &bp->func_obj) !=
                                                BNX2X_F_STATE_STARTED) {
@@ -9176,7 +9178,7 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode, bool keep_link)
        }
 
        /* Give HW time to discard old tx messages */
-       usleep_range(1000, 2000);
+       kthread_usleep(1000);
 
        /* Clean all ETH MACs */
        rc = bnx2x_del_all_macs(bp, &bp->sp_objs[0].mac_obj, BNX2X_ETH_MAC,
@@ -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);
 
@@ -9427,9 +9429,9 @@ static void bnx2x_mcp_wait_one(struct bnx2x *bp)
        /* special handling for emulation and FPGA,
           wait 10 times longer */
        if (CHIP_REV_IS_SLOW(bp))
-               msleep(MCP_ONE_TIMEOUT*10);
+               kthread_usleep(1000 * (MCP_ONE_TIMEOUT * 10));
        else
-               msleep(MCP_ONE_TIMEOUT);
+               kthread_usleep(1000 * MCP_ONE_TIMEOUT);
 }
 
 /*
@@ -9572,13 +9574,13 @@ static void bnx2x_process_kill_chip_reset(struct bnx2x *bp, bool global)
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
               reset_mask1 & (~not_reset_mask1));
 
-       barrier();
+       cmb();
        bus_wmb();
 
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
               reset_mask2 & (~stay_reset2));
 
-       barrier();
+       cmb();
        bus_wmb();
 
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, reset_mask1);
@@ -9605,7 +9607,7 @@ static int bnx2x_er_poll_igu_vq(struct bnx2x *bp)
                if (pend_bits == 0)
                        break;
 
-               usleep_range(1000, 2000);
+               kthread_usleep(1000);
        } while (cnt-- > 0);
 
        if (cnt <= 0) {
@@ -9640,7 +9642,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
                    (pgl_exp_rom2 == 0xffffffff) &&
                    (!CHIP_IS_E3(bp) || (tags_63_32 == 0xffffffff)))
                        break;
-               usleep_range(1000, 2000);
+               kthread_usleep(1000);
        } while (cnt-- > 0);
 
        if (cnt <= 0) {
@@ -9651,7 +9653,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
                return -EAGAIN;
        }
 
-       barrier();
+       cmb();
 
        /* Close gates #2, #3 and #4 */
        bnx2x_set_234_gates(bp, true);
@@ -9664,7 +9666,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
 
        /* Clear "unprepared" bit */
        REG_WR(bp, MISC_REG_UNPREPARED, 0);
-       barrier();
+       cmb();
 
        /* Make sure all is written to the chip before the reset */
        bus_wmb();
@@ -9672,7 +9674,7 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
        /* Wait for 1ms to empty GLUE and PCI-E core queues,
         * PSWHST, GRC and PSWRD Tetris buffer.
         */
-       usleep_range(1000, 2000);
+       kthread_usleep(1000);
 
        /* Prepare to chip reset: */
        /* MCP */
@@ -9681,11 +9683,11 @@ static int bnx2x_process_kill(struct bnx2x *bp, bool global)
 
        /* PXP */
        bnx2x_pxp_prep(bp);
-       barrier();
+       cmb();
 
        /* reset the chip */
        bnx2x_process_kill_chip_reset(bp, global);
-       barrier();
+       cmb();
 
        /* clear errors in PGB */
        if (!CHIP_IS_E1x(bp))
@@ -9763,7 +9765,7 @@ exit_leader_reset2:
 exit_leader_reset:
        bp->is_leader = 0;
        bnx2x_release_leader_lock(bp);
-       smp_mb();
+       mb();
        return rc;
 }
 
@@ -9785,7 +9787,7 @@ static void bnx2x_recovery_failed(struct bnx2x *bp)
 
        bp->recovery_state = BNX2X_RECOVERY_FAILED;
 
-       smp_mb();
+       mb();
 }
 
 /*
@@ -9833,7 +9835,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
                         * "recovery_state" update values are seen on other
                         * CPUs.
                         */
-                       smp_mb();
+                       mb();
                        break;
 
                case BNX2X_RECOVERY_WAIT:
@@ -9927,12 +9929,12 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
                                                /* Shut down the power */
                                                bnx2x_set_power_state(
                                                        bp, PCI_D3hot);
-                                               smp_mb();
+                                               mb();
                                        } else {
                                                bp->recovery_state =
                                                        BNX2X_RECOVERY_DONE;
                                                error_recovered++;
-                                               smp_mb();
+                                               mb();
                                        }
                                        bp->eth_stats.recoverable_error =
                                                error_recovered;
@@ -9948,7 +9950,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
        }
 }
 
-static int bnx2x_close(struct net_device *dev);
+static int bnx2x_close(struct ether *dev);
 
 /* bnx2x_nic_unload() flushes the bnx2x_wq, thus reset task is
  * scheduled on a general queue in order to prevent a dead lock.
@@ -9975,7 +9977,7 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work)
                 * function anyway.
                 */
                bp->sp_rtnl_state = 0;
-               smp_mb();
+               mb();
 
                bnx2x_parity_recover(bp);
 
@@ -9995,7 +9997,7 @@ static void bnx2x_sp_rtnl_task(struct work_struct *work)
                 * function anyway.
                 */
                bp->sp_rtnl_state = 0;
-               smp_mb();
+               mb();
 
                bnx2x_nic_unload(bp, UNLOAD_NORMAL, true);
                bnx2x_nic_load(bp, LOAD_NORMAL);
@@ -10085,7 +10087,7 @@ static void bnx2x_period_task(struct work_struct *work)
         * the bp->port.pmf in the bnx2x_nic_load() or bnx2x_pmf_update() and
         * the reading here.
         */
-       smp_mb();
+       mb();
        if (bp->port.pmf) {
                bnx2x_period_func(&bp->link_params, &bp->link_vars);
 
@@ -10181,7 +10183,7 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp,
        }
 
        if (mac_stopped)
-               msleep(20);
+               kthread_usleep(1000 * 20);
 }
 
 #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4))
@@ -10351,7 +10353,7 @@ static int bnx2x_prev_mark_path(struct bnx2x *bp, bool after_undi)
        up(&bnx2x_prev_sem);
 
        /* Create an entry for this path and add it */
-       tmp_list = kmalloc(sizeof(struct bnx2x_prev_path_list), GFP_KERNEL);
+       tmp_list = kmalloc(sizeof(struct bnx2x_prev_path_list), KMALLOC_WAIT);
        if (!tmp_list) {
                BNX2X_ERR("Failed to allocate 'bnx2x_prev_path_list'\n");
                return -ENOMEM;
@@ -10624,7 +10626,7 @@ static int bnx2x_prev_unload(struct bnx2x *bp)
                if (rc != BNX2X_PREV_WAIT_NEEDED)
                        break;
 
-               msleep(20);
+               kthread_usleep(1000 * 20);
        } while (--time_counter);
 
        if (!time_counter || rc) {
@@ -10879,7 +10881,7 @@ static int bnx2x_get_igu_cam_info(struct bnx2x *bp)
         * Driver should use the minimal value of both as the actual status
         * block count
         */
-       bp->igu_sb_cnt = min_t(int, bp->igu_sb_cnt, igu_sb_cnt);
+       bp->igu_sb_cnt = MIN_T(int, bp->igu_sb_cnt, igu_sb_cnt);
 #endif
 
        if (igu_sb_cnt == 0) {
@@ -11649,7 +11651,7 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp)
 
                        while (tout && REG_RD(bp, IGU_REG_RESET_MEMORIES)) {
                                tout--;
-                               usleep_range(1000, 2000);
+                               kthread_usleep(1000);
                        }
 
                        if (REG_RD(bp, IGU_REG_RESET_MEMORIES)) {
@@ -11851,7 +11853,7 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp)
 
        /* adjust igu_sb_cnt to MF for E1H */
        if (CHIP_IS_E1H(bp) && IS_MF(bp))
-               bp->igu_sb_cnt = min_t(uint8_t, bp->igu_sb_cnt,
+               bp->igu_sb_cnt = MIN_T(uint8_t, bp->igu_sb_cnt,
                                       E1H_MAX_MF_SB_COUNT);
 
        /* port info */
@@ -11895,7 +11897,7 @@ static void bnx2x_read_fwinfo(struct bnx2x *bp)
        i += PCI_VPD_LRDT_TAG_SIZE;
 
        if (block_end > BNX2X_VPD_LEN) {
-               vpd_extended_data = kmalloc(block_end, GFP_KERNEL);
+               vpd_extended_data = kmalloc(block_end, KMALLOC_WAIT);
                if (vpd_extended_data  == NULL)
                        goto out_not_found;
 
@@ -12009,7 +12011,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
        mutex_init(&bp->fw_mb_mutex);
        mutex_init(&bp->drv_info_mutex);
        bp->drv_info_mng_owner = false;
-       spin_lock_init(&bp->stats_lock);
+       spinlock_init_irqsave(&bp->stats_lock);
        sema_init(&bp->stats_sema, 1);
 
        INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
@@ -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))
@@ -12149,7 +12151,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
  */
 
 /* called with rtnl_lock */
-static int bnx2x_open(struct net_device *dev)
+static int bnx2x_open(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        int rc;
@@ -12218,7 +12220,7 @@ static int bnx2x_open(struct net_device *dev)
 }
 
 /* called with rtnl_lock */
-static int bnx2x_close(struct net_device *dev)
+static int bnx2x_close(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
 
@@ -12233,7 +12235,7 @@ static int bnx2x_init_mcast_macs_list(struct bnx2x *bp,
 {
        int mc_count = netdev_mc_count(bp->dev);
        struct bnx2x_mcast_list_elem *mc_mac =
-               kcalloc(mc_count, sizeof(*mc_mac), GFP_ATOMIC);
+               kzmalloc((mc_count) * (sizeof(*mc_mac)), 0);
        struct netdev_hw_addr *ha;
 
        if (!mc_mac)
@@ -12273,7 +12275,7 @@ static void bnx2x_free_mcast_macs_list(
 static int bnx2x_set_uc_list(struct bnx2x *bp)
 {
        int rc;
-       struct net_device *dev = bp->dev;
+       struct ether *dev = bp->dev;
        struct netdev_hw_addr *ha;
        struct bnx2x_vlan_mac_obj *mac_obj = &bp->sp_objs->mac_obj;
        unsigned long ramrod_flags = 0;
@@ -12310,7 +12312,7 @@ static int bnx2x_set_uc_list(struct bnx2x *bp)
 
 static int bnx2x_set_mc_list(struct bnx2x *bp)
 {
-       struct net_device *dev = bp->dev;
+       struct ether *dev = bp->dev;
        struct bnx2x_mcast_ramrod_params rparam = {NULL};
        int rc = 0;
 
@@ -12346,7 +12348,7 @@ static int bnx2x_set_mc_list(struct bnx2x *bp)
 }
 
 /* If bp->state is OPEN, should be called with netif_addr_lock_bh() */
-static void bnx2x_set_rx_mode(struct net_device *dev)
+static void bnx2x_set_rx_mode(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
 
@@ -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,25 +12404,25 @@ 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);
        }
 }
 
 /* called with rtnl_lock */
-static int bnx2x_mdio_read(struct net_device *netdev, int prtad,
+static int bnx2x_mdio_read(struct ether *netdev, int prtad,
                           int devad, uint16_t addr)
 {
        struct bnx2x *bp = netdev_priv(netdev);
@@ -12444,7 +12446,7 @@ static int bnx2x_mdio_read(struct net_device *netdev, int prtad,
 }
 
 /* called with rtnl_lock */
-static int bnx2x_mdio_write(struct net_device *netdev, int prtad, int devad,
+static int bnx2x_mdio_write(struct ether *netdev, int prtad, int devad,
                            uint16_t addr, uint16_t value)
 {
        struct bnx2x *bp = netdev_priv(netdev);
@@ -12464,7 +12466,7 @@ static int bnx2x_mdio_write(struct net_device *netdev, int prtad, int devad,
 }
 
 /* called with rtnl_lock */
-static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+static int bnx2x_ioctl(struct ether *dev, struct ifreq *ifr, int cmd)
 {
        struct bnx2x *bp = netdev_priv(dev);
        struct mii_ioctl_data *mdio = if_mii(ifr);
@@ -12483,7 +12485,7 @@ static int bnx2x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static void poll_bnx2x(struct net_device *dev)
+static void poll_bnx2x(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        int i;
@@ -12495,7 +12497,7 @@ static void poll_bnx2x(struct net_device *dev)
 }
 #endif
 
-static int bnx2x_validate_addr(struct net_device *dev)
+static int bnx2x_validate_addr(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
 
@@ -12510,7 +12512,7 @@ static int bnx2x_validate_addr(struct net_device *dev)
        return 0;
 }
 
-static int bnx2x_get_phys_port_id(struct net_device *netdev,
+static int bnx2x_get_phys_port_id(struct ether *netdev,
                                  struct netdev_phys_item_id *ppid)
 {
        struct bnx2x *bp = netdev_priv(netdev);
@@ -12525,7 +12527,7 @@ static int bnx2x_get_phys_port_id(struct net_device *netdev,
 }
 
 static netdev_features_t bnx2x_features_check(struct sk_buff *skb,
-                                             struct net_device *dev,
+                                             struct ether *dev,
                                              netdev_features_t features)
 {
        return vxlan_features_check(skb, features);
@@ -12587,7 +12589,7 @@ static void bnx2x_disable_pcie_error_reporting(struct bnx2x *bp)
 }
 
 static int bnx2x_init_dev(struct bnx2x *bp, struct pci_device *pdev,
-                         struct net_device *dev, unsigned long board_type)
+                         struct ether *dev, unsigned long board_type)
 {
        int rc;
        uint32_t pci_cfg_dword;
@@ -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;
@@ -12910,7 +12903,7 @@ static void be16_to_cpu_n(const uint8_t *_source, uint8_t *_target,
 #define BNX2X_ALLOC_AND_SET(arr, lbl, func)                            \
 do {                                                                   \
        uint32_t len = be32_to_cpu(fw_hdr->arr.len);                            \
-       bp->arr = kmalloc(len, GFP_KERNEL);                             \
+       bp->arr = kmalloc(len, KMALLOC_WAIT);                           \
        if (!bp->arr)                                                   \
                goto lbl;                                               \
        func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset),      \
@@ -13171,7 +13164,7 @@ static int bnx2x_send_update_drift_ramrod(struct bnx2x *bp, int drift_dir,
        return bnx2x_func_state_change(bp, &func_params);
 }
 
-static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
+static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, int32_t ppb)
 {
        struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
        int rc;
@@ -13239,7 +13232,7 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
        return 0;
 }
 
-static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
+static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, int64_t delta)
 {
        struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
        uint64_t now;
@@ -13323,7 +13316,7 @@ void bnx2x_register_phc(struct bnx2x *bp)
 static int bnx2x_init_one(struct pci_device *pdev,
                                    const struct pci_device_id *ent)
 {
-       struct net_device *dev = NULL;
+       struct ether *dev = NULL;
        struct bnx2x *bp;
        enum pcie_link_width pcie_width;
        enum pci_bus_speed pcie_speed;
@@ -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);
 
@@ -13515,7 +13508,7 @@ init_one_exit:
 }
 
 static void __bnx2x_remove(struct pci_device *pdev,
-                          struct net_device *dev,
+                          struct ether *dev,
                           struct bnx2x *bp,
                           bool remove_netdev)
 {
@@ -13611,7 +13604,7 @@ static void __bnx2x_remove(struct pci_device *pdev,
 
 static void bnx2x_remove_one(struct pci_device *pdev)
 {
-       struct net_device *dev = pci_get_drvdata(pdev);
+       struct ether *dev = pci_get_drvdata(pdev);
        struct bnx2x *bp;
 
        if (!dev) {
@@ -13644,9 +13637,9 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
        cancel_delayed_work_sync(&bp->sp_task);
        cancel_delayed_work_sync(&bp->period_task);
 
-       spin_lock_bh(&bp->stats_lock);
+       spin_lock(&bp->stats_lock);
        bp->stats_state = STATS_STATE_DISABLED;
-       spin_unlock_bh(&bp->stats_lock);
+       spin_unlock(&bp->stats_lock);
 
        bnx2x_save_statistics(bp);
 
@@ -13666,7 +13659,7 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
 static pci_ers_result_t bnx2x_io_error_detected(struct pci_device *pdev,
                                                pci_channel_state_t state)
 {
-       struct net_device *dev = pci_get_drvdata(pdev);
+       struct ether *dev = pci_get_drvdata(pdev);
        struct bnx2x *bp = netdev_priv(dev);
 
        rtnl_lock();
@@ -13701,7 +13694,7 @@ static pci_ers_result_t bnx2x_io_error_detected(struct pci_device *pdev,
  */
 static pci_ers_result_t bnx2x_io_slot_reset(struct pci_device *pdev)
 {
-       struct net_device *dev = pci_get_drvdata(pdev);
+       struct ether *dev = pci_get_drvdata(pdev);
        struct bnx2x *bp = netdev_priv(dev);
        int i;
 
@@ -13783,7 +13776,7 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_device *pdev)
  */
 static void bnx2x_io_resume(struct pci_device *pdev)
 {
-       struct net_device *dev = pci_get_drvdata(pdev);
+       struct ether *dev = pci_get_drvdata(pdev);
        struct bnx2x *bp = netdev_priv(dev);
 
        if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
@@ -13812,7 +13805,7 @@ static const struct pci_error_handlers bnx2x_err_handler = {
 
 static void bnx2x_shutdown(struct pci_device *pdev)
 {
-       struct net_device *dev = pci_get_drvdata(pdev);
+       struct ether *dev = pci_get_drvdata(pdev);
        struct bnx2x *bp;
 
        if (!dev)
@@ -13932,7 +13925,7 @@ static void bnx2x_cnic_sp_post(struct bnx2x *bp, int count)
                return;
 #endif
 
-       spin_lock_bh(&bp->spq_lock);
+       spin_lock(&bp->spq_lock);
        BUG_ON(bp->cnic_spq_pending < count);
        bp->cnic_spq_pending -= count;
 
@@ -14000,10 +13993,10 @@ static void bnx2x_cnic_sp_post(struct bnx2x *bp, int count)
                        bp->cnic_kwq_cons++;
        }
        bnx2x_sp_prod_update(bp);
-       spin_unlock_bh(&bp->spq_lock);
+       spin_unlock(&bp->spq_lock);
 }
 
-static int bnx2x_cnic_sp_queue(struct net_device *dev,
+static int bnx2x_cnic_sp_queue(struct ether *dev,
                               struct kwqe_16 *kwqes[], uint32_t count)
 {
        struct bnx2x *bp = netdev_priv(dev);
@@ -14022,7 +14015,7 @@ static int bnx2x_cnic_sp_queue(struct net_device *dev,
                return -EAGAIN;
        }
 
-       spin_lock_bh(&bp->spq_lock);
+       spin_lock(&bp->spq_lock);
 
        for (i = 0; i < count; i++) {
                struct eth_spe *spe = (struct eth_spe *)kwqes[i];
@@ -14046,7 +14039,7 @@ static int bnx2x_cnic_sp_queue(struct net_device *dev,
                        bp->cnic_kwq_prod++;
        }
 
-       spin_unlock_bh(&bp->spq_lock);
+       spin_unlock(&bp->spq_lock);
 
        if (bp->cnic_spq_pending < bp->cnic_eth_dev.max_kwqe_pending)
                bnx2x_cnic_sp_post(bp, 0);
@@ -14148,7 +14141,7 @@ static void bnx2x_set_iscsi_eth_rx_mode(struct bnx2x *bp, bool start)
        }
 }
 
-static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
+static int bnx2x_drv_ctl(struct ether *dev, struct drv_ctl_info *ctl)
 {
        struct bnx2x *bp = netdev_priv(dev);
        int rc = 0;
@@ -14190,13 +14183,13 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
                        break;
 
                bus_wmb();
-               barrier();
+               cmb();
 
                /* 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 net_device *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);
@@ -14225,7 +14218,7 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
                        BNX2X_ERR("rx_mode completion timed out!\n");
 
                bus_wmb();
-               barrier();
+               cmb();
 
                /* Unset iSCSI L2 MAC */
                rc = bnx2x_del_all_macs(bp, &bp->iscsi_l2_mac_obj,
@@ -14235,9 +14228,9 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
        case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: {
                int count = ctl->data.credit.credit_count;
 
-               smp_mb__before_atomic();
+               cmb();
                atomic_add(count, &bp->cq_spq_left);
-               smp_mb__after_atomic();
+               cmb();
                break;
        }
        case DRV_CTL_ULP_REGISTER_CMD: {
@@ -14351,7 +14344,7 @@ void bnx2x_setup_cnic_info(struct bnx2x *bp)
                cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
 }
 
-static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops,
+static int bnx2x_register_cnic(struct ether *dev, struct cnic_ops *ops,
                               void *data)
 {
        struct bnx2x *bp = netdev_priv(dev);
@@ -14380,7 +14373,7 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops,
 
        bp->cnic_enabled = true;
 
-       bp->cnic_kwq = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       bp->cnic_kwq = kzmalloc(PAGE_SIZE, KMALLOC_WAIT);
        if (!bp->cnic_kwq)
                return -ENOMEM;
 
@@ -14407,7 +14400,7 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops,
        return 0;
 }
 
-static int bnx2x_unregister_cnic(struct net_device *dev)
+static int bnx2x_unregister_cnic(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
@@ -14424,7 +14417,7 @@ static int bnx2x_unregister_cnic(struct net_device *dev)
        return 0;
 }
 
-static struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
+static struct cnic_eth_dev *bnx2x_cnic_probe(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
@@ -14738,7 +14731,7 @@ static int bnx2x_hwtstamp_ioctl(struct bnx2x *bp, struct ifreq *ifr)
 
        DP(BNX2X_MSG_PTP, "HWTSTAMP IOCTL called\n");
 
-       if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+       if (memcpy_from_user(current, &config, ifr->ifr_data, sizeof(config)))
                return -EFAULT;
 
        DP(BNX2X_MSG_PTP, "Requested tx_type: %d, requested rx_filters = %d\n",
@@ -14759,7 +14752,7 @@ static int bnx2x_hwtstamp_ioctl(struct bnx2x *bp, struct ifreq *ifr)
 
        config.rx_filter = bp->rx_filter;
 
-       return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+       return memcpy_to_user(current, ifr->ifr_data, &config, sizeof(config)) ?
                -EFAULT : 0;
 }
 
@@ -14830,7 +14823,7 @@ void bnx2x_init_ptp(struct bnx2x *bp)
        if (!bp->timecounter_init_done) {
                bnx2x_init_cyclecounter(bp);
                timecounter_init(&bp->timecounter, &bp->cyclecounter,
-                                ktime_to_ns(ktime_get_real()));
+                                epoch_nsec());
                bp->timecounter_init_done = 1;
        }