BNX2X: spatch ether->mtu -> ether->maxmtu
[akaros.git] / kern / drivers / net / bnx2x / bnx2x_vfpf.c
index 879a850..84e4dd8 100644 (file)
@@ -39,7 +39,7 @@ static void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list,
 static void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
                            uint16_t type, uint16_t length)
 {
-       mutex_lock(&bp->vf2pf_mutex);
+       qlock(&bp->vf2pf_mutex);
 
        DP(BNX2X_MSG_IOV, "preparing to send %d tlv over vf pf channel\n",
           type);
@@ -61,7 +61,7 @@ static void bnx2x_vfpf_finalize(struct bnx2x *bp,
        DP(BNX2X_MSG_IOV, "done sending [%d] tlv over vf pf channel\n",
           first_tlv->tl.type);
 
-       mutex_unlock(&bp->vf2pf_mutex);
+       qunlock(&bp->vf2pf_mutex);
 }
 
 /* Finds a TLV by type in a TLV buffer; If found, returns pointer to the TLV */
@@ -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);
        }
 }
@@ -2070,11 +2070,11 @@ void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
        vf_idx = bnx2x_vf_idx_by_abs_fid(bp, vfpf_event->vf_id);
 
        /* Update VFDB with current message and schedule its handling */
-       mutex_lock(&BP_VFDB(bp)->event_mutex);
+       qlock(&BP_VFDB(bp)->event_mutex);
        BP_VF_MBX(bp, vf_idx)->vf_addr_hi = vfpf_event->msg_addr_hi;
        BP_VF_MBX(bp, vf_idx)->vf_addr_lo = vfpf_event->msg_addr_lo;
        BP_VFDB(bp)->event_occur |= (1ULL << vf_idx);
-       mutex_unlock(&BP_VFDB(bp)->event_mutex);
+       qunlock(&BP_VFDB(bp)->event_mutex);
 
        bnx2x_schedule_iov_task(bp, BNX2X_IOV_HANDLE_VF_MSG);
 }
@@ -2090,10 +2090,10 @@ void bnx2x_vf_mbx(struct bnx2x *bp)
        if (!vfdb)
                return;
 
-       mutex_lock(&vfdb->event_mutex);
+       qlock(&vfdb->event_mutex);
        events = vfdb->event_occur;
        vfdb->event_occur = 0;
-       mutex_unlock(&vfdb->event_mutex);
+       qunlock(&vfdb->event_mutex);
 
        for_each_vf(bp, vf_idx) {
                struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf_idx);