BNX2X: spatch ether->mtu -> ether->maxmtu
[akaros.git] / kern / drivers / net / bnx2x / bnx2x_vfpf.c
index c5fd309..84e4dd8 100644 (file)
@@ -161,20 +161,20 @@ static int bnx2x_send_msg2pf(struct bnx2x *bp, uint8_t *done,
        }
 
        /* Write message address */
-       writel(U64_LO(msg_mapping),
+       write32(U64_LO(msg_mapping),
               &zone_data->non_trigger.vf_pf_channel.msg_addr_lo);
-       writel(U64_HI(msg_mapping),
+       write32(U64_HI(msg_mapping),
               &zone_data->non_trigger.vf_pf_channel.msg_addr_hi);
 
        /* make sure the address is written before FW accesses it */
        wmb();
 
        /* Trigger the PF FW */
-       writeb(1, &zone_data->trigger.vf_pf_channel.addr_valid);
+       write8(1, &zone_data->trigger.vf_pf_channel.addr_valid);
 
        /* Wait for PF to complete */
        while ((tout >= 0) && (!*done)) {
-               msleep(interval);
+               kthread_usleep(1000 * interval);
                tout -= 1;
 
                /* progress indicator - HV can take its own sweet time in
@@ -198,11 +198,11 @@ static int bnx2x_get_vf_id(struct bnx2x *bp, uint32_t *vf_id)
 
        do {
                /* pxp traps vf read of doorbells and returns me reg value */
-               me_reg = readl(bp->doorbells);
+               me_reg = read32(bp->doorbells);
                if (GOOD_ME_REG(me_reg))
                        break;
 
-               msleep(interval);
+               kthread_usleep(1000 * interval);
 
                BNX2X_ERR("Invalid ME register value: 0x%08x\n. Is pf driver up?",
                          me_reg);
@@ -298,22 +298,22 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, uint8_t tx_count, uint8_t rx_count)
 
                        /* humble our request */
                        req->resc_request.num_txqs =
-                               min(req->resc_request.num_txqs,
+                               MIN(req->resc_request.num_txqs,
                                    bp->acquire_resp.resc.num_txqs);
                        req->resc_request.num_rxqs =
-                               min(req->resc_request.num_rxqs,
+                               MIN(req->resc_request.num_rxqs,
                                    bp->acquire_resp.resc.num_rxqs);
                        req->resc_request.num_sbs =
-                               min(req->resc_request.num_sbs,
+                               MIN(req->resc_request.num_sbs,
                                    bp->acquire_resp.resc.num_sbs);
                        req->resc_request.num_mac_filters =
-                               min(req->resc_request.num_mac_filters,
+                               MIN(req->resc_request.num_mac_filters,
                                    bp->acquire_resp.resc.num_mac_filters);
                        req->resc_request.num_vlan_filters =
-                               min(req->resc_request.num_vlan_filters,
+                               MIN(req->resc_request.num_vlan_filters,
                                    bp->acquire_resp.resc.num_vlan_filters);
                        req->resc_request.num_mc_filters =
-                               min(req->resc_request.num_mc_filters,
+                               MIN(req->resc_request.num_mc_filters,
                                    bp->acquire_resp.resc.num_mc_filters);
 
                        /* Clear response buffer */
@@ -624,11 +624,11 @@ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
        req->rxq.vf_sb = fp_idx;
        req->rxq.sb_index = HC_INDEX_ETH_RX_CQ_CONS;
        req->rxq.hc_rate = bp->rx_ticks ? 1000000/bp->rx_ticks : 0;
-       req->rxq.mtu = bp->dev->mtu;
+       req->rxq.mtu = bp->dev->maxmtu;
        req->rxq.buf_sz = fp->rx_buf_size;
        req->rxq.sge_buf_sz = BCM_PAGE_SIZE * PAGES_PER_SGE;
        req->rxq.tpa_agg_sz = tpa_agg_size;
-       req->rxq.max_sge_pkt = SGE_PAGE_ALIGN(bp->dev->mtu) >> SGE_PAGE_SHIFT;
+       req->rxq.max_sge_pkt = SGE_PAGE_ALIGN(bp->dev->maxmtu) >> SGE_PAGE_SHIFT;
        req->rxq.max_sge_pkt = ((req->rxq.max_sge_pkt + PAGES_PER_SGE - 1) &
                          (~(PAGES_PER_SGE-1))) >> PAGES_PER_SGE_SHIFT;
        req->rxq.flags = flags;
@@ -850,7 +850,7 @@ out:
        return rc;
 }
 
-int bnx2x_vfpf_set_mcast(struct net_device *dev)
+int bnx2x_vfpf_set_mcast(struct ether *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters;
@@ -1100,7 +1100,7 @@ static void bnx2x_vf_mbx_resp_send_msg(struct bnx2x *bp,
 
        /* ack the FW */
        storm_memset_vf_mbx_ack(bp, vf->abs_vfid);
-       mmiowb();
+       bus_wmb();
 
        /* copy the response header including status-done field,
         * must be last dmae, must be after FW is acked
@@ -1350,7 +1350,7 @@ static void bnx2x_vf_mbx_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
        if (bnx2x_vf_mbx_is_windows_vm(bp, &mbx->msg->req.acquire))
                vf->fp_hsi = acquire->vfdev_info.fp_hsi_ver;
        else
-               vf->fp_hsi = max_t(uint8_t, acquire->vfdev_info.fp_hsi_ver,
+               vf->fp_hsi = MAX_T(uint8_t, acquire->vfdev_info.fp_hsi_ver,
                                   ETH_FP_HSI_VER_2);
        if (vf->fp_hsi > ETH_FP_HSI_VERSION) {
                DP(BNX2X_MSG_IOV,
@@ -1573,7 +1573,7 @@ static int bnx2x_vf_mbx_macvlan_list(struct bnx2x *bp,
              sizeof(struct bnx2x_vf_mac_vlan_filter) +
              sizeof(struct bnx2x_vf_mac_vlan_filters);
 
-       fl = kzalloc(fsz, GFP_KERNEL);
+       fl = kzmalloc(fsz, KMALLOC_WAIT);
        if (!fl)
                return -ENOMEM;
 
@@ -2044,7 +2044,7 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf,
                 */
                storm_memset_vf_mbx_ack(bp, vf->abs_vfid);
                /* Firmware ack should be written before unlocking channel */
-               mmiowb();
+               bus_wmb();
                bnx2x_unlock_vf_pf_channel(bp, vf, mbx->first_tlv.tl.type);
        }
 }