Lines Matching refs:bp

24 static int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
27 static void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, in bnx2x_add_tlv() argument
38 static void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv, in bnx2x_vfpf_prep() argument
41 mutex_lock(&bp->vf2pf_mutex); in bnx2x_vfpf_prep()
47 memset(bp->vf2pf_mbox, 0, sizeof(struct bnx2x_vf_mbx_msg)); in bnx2x_vfpf_prep()
50 bnx2x_add_tlv(bp, &first_tlv->tl, 0, type, length); in bnx2x_vfpf_prep()
53 first_tlv->resp_msg_offset = sizeof(bp->vf2pf_mbox->req); in bnx2x_vfpf_prep()
57 static void bnx2x_vfpf_finalize(struct bnx2x *bp, in bnx2x_vfpf_finalize() argument
63 mutex_unlock(&bp->vf2pf_mutex); in bnx2x_vfpf_finalize()
67 static void *bnx2x_search_tlv_list(struct bnx2x *bp, void *tlvs_list, in bnx2x_search_tlv_list() argument
91 static void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list) in bnx2x_dp_tlv_list() argument
139 static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping) in bnx2x_send_msg2pf() argument
142 REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START); in bnx2x_send_msg2pf()
154 bnx2x_sample_bulletin(bp); in bnx2x_send_msg2pf()
155 if (bp->old_bulletin.valid_bitmap & 1 << CHANNEL_DOWN) { in bnx2x_send_msg2pf()
192 static int bnx2x_get_vf_id(struct bnx2x *bp, u32 *vf_id) in bnx2x_get_vf_id() argument
199 me_reg = readl(bp->doorbells); in bnx2x_get_vf_id()
221 int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count) in bnx2x_vfpf_acquire() argument
224 struct vfpf_acquire_tlv *req = &bp->vf2pf_mbox->req.acquire; in bnx2x_vfpf_acquire()
225 struct pfvf_acquire_resp_tlv *resp = &bp->vf2pf_mbox->resp.acquire_resp; in bnx2x_vfpf_acquire()
232 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_ACQUIRE, sizeof(*req)); in bnx2x_vfpf_acquire()
234 if (bnx2x_get_vf_id(bp, &vf_id)) { in bnx2x_vfpf_acquire()
245 req->resc_request.num_sbs = bp->igu_sb_cnt; in bnx2x_vfpf_acquire()
250 req->bulletin_addr = bp->pf2vf_bulletin_mapping; in bnx2x_vfpf_acquire()
253 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, in bnx2x_vfpf_acquire()
260 bnx2x_add_tlv(bp, req, in bnx2x_vfpf_acquire()
266 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_acquire()
272 rc = bnx2x_send_msg2pf(bp, in bnx2x_vfpf_acquire()
274 bp->vf2pf_mbox_mapping); in bnx2x_vfpf_acquire()
281 memcpy(&bp->acquire_resp, resp, sizeof(bp->acquire_resp)); in bnx2x_vfpf_acquire()
288 if (bp->acquire_resp.hdr.status == PFVF_STATUS_SUCCESS) { in bnx2x_vfpf_acquire()
291 } else if (bp->acquire_resp.hdr.status == in bnx2x_vfpf_acquire()
300 bp->acquire_resp.resc.num_txqs); in bnx2x_vfpf_acquire()
303 bp->acquire_resp.resc.num_rxqs); in bnx2x_vfpf_acquire()
306 bp->acquire_resp.resc.num_sbs); in bnx2x_vfpf_acquire()
309 bp->acquire_resp.resc.num_mac_filters); in bnx2x_vfpf_acquire()
312 bp->acquire_resp.resc.num_vlan_filters); in bnx2x_vfpf_acquire()
315 bp->acquire_resp.resc.num_mc_filters); in bnx2x_vfpf_acquire()
318 memset(&bp->vf2pf_mbox->resp, 0, in bnx2x_vfpf_acquire()
322 fp_hsi_resp = bnx2x_search_tlv_list(bp, resp, in bnx2x_vfpf_acquire()
328 bp->acquire_resp.hdr.status); in bnx2x_vfpf_acquire()
336 bnx2x_search_tlv_list(bp, resp, in bnx2x_vfpf_acquire()
339 memcpy(bp->phys_port_id, phys_port_resp->id, ETH_ALEN); in bnx2x_vfpf_acquire()
340 bp->flags |= HAS_PHYS_PORT_ID; in bnx2x_vfpf_acquire()
347 fp_hsi_resp = bnx2x_search_tlv_list(bp, resp, in bnx2x_vfpf_acquire()
355 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_acquire()
356 bnx2x_vfpf_release(bp); in bnx2x_vfpf_acquire()
363 bp->common.chip_id |= (bp->acquire_resp.pfdev_info.chip_num & 0xffff); in bnx2x_vfpf_acquire()
364 bp->link_params.chip_id = bp->common.chip_id; in bnx2x_vfpf_acquire()
365 bp->db_size = bp->acquire_resp.pfdev_info.db_size; in bnx2x_vfpf_acquire()
366 bp->common.int_block = INT_BLOCK_IGU; in bnx2x_vfpf_acquire()
367 bp->common.chip_port_mode = CHIP_2_PORT_MODE; in bnx2x_vfpf_acquire()
368 bp->igu_dsb_id = -1; in bnx2x_vfpf_acquire()
369 bp->mf_ov = 0; in bnx2x_vfpf_acquire()
370 bp->mf_mode = 0; in bnx2x_vfpf_acquire()
371 bp->common.flash_size = 0; in bnx2x_vfpf_acquire()
372 bp->flags |= in bnx2x_vfpf_acquire()
374 bp->igu_sb_cnt = bp->acquire_resp.resc.num_sbs; in bnx2x_vfpf_acquire()
375 bp->igu_base_sb = bp->acquire_resp.resc.hw_sbs[0].hw_sb_id; in bnx2x_vfpf_acquire()
376 strlcpy(bp->fw_ver, bp->acquire_resp.pfdev_info.fw_ver, in bnx2x_vfpf_acquire()
377 sizeof(bp->fw_ver)); in bnx2x_vfpf_acquire()
379 if (is_valid_ether_addr(bp->acquire_resp.resc.current_mac_addr)) in bnx2x_vfpf_acquire()
380 memcpy(bp->dev->dev_addr, in bnx2x_vfpf_acquire()
381 bp->acquire_resp.resc.current_mac_addr, in bnx2x_vfpf_acquire()
385 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_acquire()
389 int bnx2x_vfpf_release(struct bnx2x *bp) in bnx2x_vfpf_release() argument
391 struct vfpf_release_tlv *req = &bp->vf2pf_mbox->req.release; in bnx2x_vfpf_release()
392 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_release()
396 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_RELEASE, sizeof(*req)); in bnx2x_vfpf_release()
398 if (bnx2x_get_vf_id(bp, &vf_id)) { in bnx2x_vfpf_release()
406 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_release()
410 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_release()
413 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_release()
430 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_release()
436 int bnx2x_vfpf_init(struct bnx2x *bp) in bnx2x_vfpf_init() argument
438 struct vfpf_init_tlv *req = &bp->vf2pf_mbox->req.init; in bnx2x_vfpf_init()
439 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_init()
443 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_INIT, sizeof(*req)); in bnx2x_vfpf_init()
446 for_each_eth_queue(bp, i) in bnx2x_vfpf_init()
447 req->sb_addr[i] = (dma_addr_t)bnx2x_fp(bp, i, in bnx2x_vfpf_init()
451 req->stats_addr = bp->fw_stats_data_mapping + in bnx2x_vfpf_init()
457 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_init()
461 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_init()
463 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_init()
476 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_init()
482 void bnx2x_vfpf_close_vf(struct bnx2x *bp) in bnx2x_vfpf_close_vf() argument
484 struct vfpf_close_tlv *req = &bp->vf2pf_mbox->req.close; in bnx2x_vfpf_close_vf()
485 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_close_vf()
492 if (bnx2x_get_vf_id(bp, &vf_id)) in bnx2x_vfpf_close_vf()
496 for_each_queue(bp, i) in bnx2x_vfpf_close_vf()
497 bnx2x_vfpf_teardown_queue(bp, i); in bnx2x_vfpf_close_vf()
500 bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr, bp->fp->index, false); in bnx2x_vfpf_close_vf()
503 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_CLOSE, sizeof(*req)); in bnx2x_vfpf_close_vf()
508 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_close_vf()
512 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_close_vf()
514 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_close_vf()
523 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_close_vf()
527 bnx2x_netif_stop(bp, 0); in bnx2x_vfpf_close_vf()
529 bnx2x_del_all_napi(bp); in bnx2x_vfpf_close_vf()
532 bnx2x_free_irq(bp); in bnx2x_vfpf_close_vf()
535 static void bnx2x_leading_vfq_init(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_leading_vfq_init() argument
542 bnx2x_init_mac_obj(bp, &q->mac_obj, in bnx2x_leading_vfq_init()
544 bnx2x_vf_sp(bp, vf, mac_rdata), in bnx2x_leading_vfq_init()
545 bnx2x_vf_sp_map(bp, vf, mac_rdata), in bnx2x_leading_vfq_init()
549 &bp->macs_pool); in bnx2x_leading_vfq_init()
551 bnx2x_init_vlan_obj(bp, &q->vlan_obj, in bnx2x_leading_vfq_init()
553 bnx2x_vf_sp(bp, vf, vlan_rdata), in bnx2x_leading_vfq_init()
554 bnx2x_vf_sp_map(bp, vf, vlan_rdata), in bnx2x_leading_vfq_init()
558 &bp->vlans_pool); in bnx2x_leading_vfq_init()
561 bnx2x_init_mcast_obj(bp, &vf->mcast_obj, cl_id, in bnx2x_leading_vfq_init()
563 bnx2x_vf_sp(bp, vf, mcast_rdata), in bnx2x_leading_vfq_init()
564 bnx2x_vf_sp_map(bp, vf, mcast_rdata), in bnx2x_leading_vfq_init()
570 bnx2x_init_rss_config_obj(bp, &vf->rss_conf_obj, cl_id, q->cid, in bnx2x_leading_vfq_init()
572 bnx2x_vf_sp(bp, vf, rss_rdata), in bnx2x_leading_vfq_init()
573 bnx2x_vf_sp_map(bp, vf, rss_rdata), in bnx2x_leading_vfq_init()
584 int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, in bnx2x_vfpf_setup_q() argument
587 struct vfpf_setup_q_tlv *req = &bp->vf2pf_mbox->req.setup_q; in bnx2x_vfpf_setup_q()
588 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_setup_q()
594 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_SETUP_Q, sizeof(*req)); in bnx2x_vfpf_setup_q()
624 req->rxq.hc_rate = bp->rx_ticks ? 1000000/bp->rx_ticks : 0; in bnx2x_vfpf_setup_q()
625 req->rxq.mtu = bp->dev->mtu; in bnx2x_vfpf_setup_q()
629 req->rxq.max_sge_pkt = SGE_PAGE_ALIGN(bp->dev->mtu) >> SGE_PAGE_SHIFT; in bnx2x_vfpf_setup_q()
641 req->txq.hc_rate = bp->tx_ticks ? 1000000/bp->tx_ticks : 0; in bnx2x_vfpf_setup_q()
646 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_setup_q()
650 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_setup_q()
652 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_setup_q()
663 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_setup_q()
668 static int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) in bnx2x_vfpf_teardown_queue() argument
670 struct vfpf_q_op_tlv *req = &bp->vf2pf_mbox->req.q_op; in bnx2x_vfpf_teardown_queue()
671 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_teardown_queue()
675 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_TEARDOWN_Q, in bnx2x_vfpf_teardown_queue()
681 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_teardown_queue()
685 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_teardown_queue()
687 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_teardown_queue()
703 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_teardown_queue()
709 int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set) in bnx2x_vfpf_config_mac() argument
711 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters; in bnx2x_vfpf_config_mac()
712 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_config_mac()
713 struct pf_vf_bulletin_content bulletin = bp->pf2vf_bulletin->content; in bnx2x_vfpf_config_mac()
717 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_SET_Q_FILTERS, in bnx2x_vfpf_config_mac()
729 bnx2x_sample_bulletin(bp); in bnx2x_vfpf_config_mac()
735 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_config_mac()
739 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_config_mac()
742 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_config_mac()
754 memcpy(bp->dev->dev_addr, bulletin.mac, ETH_ALEN); in bnx2x_vfpf_config_mac()
757 if (bnx2x_sample_bulletin(bp) == PFVF_BULLETIN_UPDATED) { in bnx2x_vfpf_config_mac()
759 memcpy(req->filters[0].mac, bp->dev->dev_addr, in bnx2x_vfpf_config_mac()
763 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, in bnx2x_vfpf_config_mac()
764 bp->vf2pf_mbox_mapping); in bnx2x_vfpf_config_mac()
776 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_config_mac()
782 int bnx2x_vfpf_config_rss(struct bnx2x *bp, in bnx2x_vfpf_config_rss() argument
785 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_config_rss()
786 struct vfpf_rss_tlv *req = &bp->vf2pf_mbox->req.update_rss; in bnx2x_vfpf_config_rss()
790 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_UPDATE_RSS, in bnx2x_vfpf_config_rss()
794 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_config_rss()
826 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_config_rss()
829 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_config_rss()
845 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_config_rss()
852 struct bnx2x *bp = netdev_priv(dev); in bnx2x_vfpf_set_mcast() local
853 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters; in bnx2x_vfpf_set_mcast()
854 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_set_mcast()
858 if (bp->state != BNX2X_STATE_OPEN) { in bnx2x_vfpf_set_mcast()
859 DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state); in bnx2x_vfpf_set_mcast()
864 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_SET_Q_FILTERS, in bnx2x_vfpf_set_mcast()
892 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_set_mcast()
896 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_set_mcast()
897 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_set_mcast()
909 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_set_mcast()
914 int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) in bnx2x_vfpf_storm_rx_mode() argument
916 int mode = bp->rx_mode; in bnx2x_vfpf_storm_rx_mode()
917 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters; in bnx2x_vfpf_storm_rx_mode()
918 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; in bnx2x_vfpf_storm_rx_mode()
922 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_SET_Q_FILTERS, in bnx2x_vfpf_storm_rx_mode()
943 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, in bnx2x_vfpf_storm_rx_mode()
947 bnx2x_dp_tlv_list(bp, req); in bnx2x_vfpf_storm_rx_mode()
949 rc = bnx2x_send_msg2pf(bp, &resp->hdr.status, bp->vf2pf_mbox_mapping); in bnx2x_vfpf_storm_rx_mode()
958 bnx2x_vfpf_finalize(bp, &req->first_tlv); in bnx2x_vfpf_storm_rx_mode()
964 static void storm_memset_vf_mbx_ack(struct bnx2x *bp, u16 abs_fid) in storm_memset_vf_mbx_ack() argument
969 REG_WR8(bp, addr, VF_PF_CHANNEL_STATE_READY); in storm_memset_vf_mbx_ack()
972 static void storm_memset_vf_mbx_valid(struct bnx2x *bp, u16 abs_fid) in storm_memset_vf_mbx_valid() argument
977 REG_WR8(bp, addr, 1); in storm_memset_vf_mbx_valid()
981 void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid) in bnx2x_vf_enable_mbx() argument
983 bnx2x_vf_flr_clnup_epilog(bp, abs_vfid); in bnx2x_vf_enable_mbx()
986 storm_memset_vf_mbx_ack(bp, abs_vfid); in bnx2x_vf_enable_mbx()
987 storm_memset_vf_mbx_valid(bp, abs_vfid); in bnx2x_vf_enable_mbx()
990 bnx2x_vf_enable_access(bp, abs_vfid); in bnx2x_vf_enable_mbx()
994 static int bnx2x_copy32_vf_dmae(struct bnx2x *bp, u8 from_vf, in bnx2x_copy32_vf_dmae() argument
1000 if (CHIP_IS_E1x(bp)) { in bnx2x_copy32_vf_dmae()
1005 if (!bp->dmae_ready) { in bnx2x_copy32_vf_dmae()
1011 bnx2x_prep_dmae_with_comp(bp, &dmae, DMAE_SRC_PCI, DMAE_DST_PCI); in bnx2x_copy32_vf_dmae()
1039 return bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); in bnx2x_copy32_vf_dmae()
1042 static void bnx2x_vf_mbx_resp_single_tlv(struct bnx2x *bp, in bnx2x_vf_mbx_resp_single_tlv() argument
1045 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf->index); in bnx2x_vf_mbx_resp_single_tlv()
1053 bnx2x_add_tlv(bp, &mbx->msg->resp, 0, type, length); in bnx2x_vf_mbx_resp_single_tlv()
1054 bnx2x_add_tlv(bp, &mbx->msg->resp, length, CHANNEL_TLV_LIST_END, in bnx2x_vf_mbx_resp_single_tlv()
1058 static void bnx2x_vf_mbx_resp_send_msg(struct bnx2x *bp, in bnx2x_vf_mbx_resp_send_msg() argument
1062 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf->index); in bnx2x_vf_mbx_resp_send_msg()
1068 bnx2x_dp_tlv_list(bp, resp); in bnx2x_vf_mbx_resp_send_msg()
1085 rc = bnx2x_copy32_vf_dmae(bp, false, pf_addr, vf->abs_vfid, in bnx2x_vf_mbx_resp_send_msg()
1098 storm_memset_vf_mbx_ack(bp, vf->abs_vfid); in bnx2x_vf_mbx_resp_send_msg()
1104 rc = bnx2x_copy32_vf_dmae(bp, false, pf_addr, vf->abs_vfid, in bnx2x_vf_mbx_resp_send_msg()
1110 bnx2x_unlock_vf_pf_channel(bp, vf, mbx->first_tlv.tl.type); in bnx2x_vf_mbx_resp_send_msg()
1120 bnx2x_vf_release(bp, vf); in bnx2x_vf_mbx_resp_send_msg()
1123 static void bnx2x_vf_mbx_resp(struct bnx2x *bp, in bnx2x_vf_mbx_resp() argument
1127 bnx2x_vf_mbx_resp_single_tlv(bp, vf); in bnx2x_vf_mbx_resp()
1128 bnx2x_vf_mbx_resp_send_msg(bp, vf, rc); in bnx2x_vf_mbx_resp()
1131 static void bnx2x_vf_mbx_resp_phys_port(struct bnx2x *bp, in bnx2x_vf_mbx_resp_phys_port() argument
1138 if (!(bp->flags & HAS_PHYS_PORT_ID)) in bnx2x_vf_mbx_resp_phys_port()
1141 bnx2x_add_tlv(bp, buffer, *offset, CHANNEL_TLV_PHYS_PORT_ID, in bnx2x_vf_mbx_resp_phys_port()
1146 memcpy(port_id->id, bp->phys_port_id, ETH_ALEN); in bnx2x_vf_mbx_resp_phys_port()
1154 static void bnx2x_vf_mbx_resp_fp_hsi_ver(struct bnx2x *bp, in bnx2x_vf_mbx_resp_fp_hsi_ver() argument
1161 bnx2x_add_tlv(bp, buffer, *offset, CHANNEL_TLV_FP_HSI_SUPPORT, in bnx2x_vf_mbx_resp_fp_hsi_ver()
1174 static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_acquire_resp() argument
1186 resp->pfdev_info.chip_num = bp->common.chip_id; in bnx2x_vf_mbx_acquire_resp()
1187 resp->pfdev_info.db_size = bp->db_size; in bnx2x_vf_mbx_acquire_resp()
1192 bnx2x_fill_fw_str(bp, resp->pfdev_info.fw_ver, in bnx2x_vf_mbx_acquire_resp()
1201 bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_mbx_acquire_resp()
1203 bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_mbx_acquire_resp()
1212 BP_VF_BULLETIN(bp, vf->index); in bnx2x_vf_mbx_acquire_resp()
1258 bnx2x_add_tlv(bp, &mbx->msg->resp, 0, CHANNEL_TLV_ACQUIRE, length); in bnx2x_vf_mbx_acquire_resp()
1264 if (bnx2x_search_tlv_list(bp, &mbx->msg->req, in bnx2x_vf_mbx_acquire_resp()
1266 bnx2x_vf_mbx_resp_phys_port(bp, vf, &mbx->msg->resp, &length); in bnx2x_vf_mbx_acquire_resp()
1272 bnx2x_vf_mbx_resp_fp_hsi_ver(bp, vf, &mbx->msg->resp, &length); in bnx2x_vf_mbx_acquire_resp()
1274 bnx2x_add_tlv(bp, &mbx->msg->resp, length, CHANNEL_TLV_LIST_END, in bnx2x_vf_mbx_acquire_resp()
1278 bnx2x_vf_mbx_resp_send_msg(bp, vf, vfop_status); in bnx2x_vf_mbx_acquire_resp()
1281 static bool bnx2x_vf_mbx_is_windows_vm(struct bnx2x *bp, in bnx2x_vf_mbx_is_windows_vm() argument
1298 static int bnx2x_vf_mbx_acquire_chk_dorq(struct bnx2x *bp, in bnx2x_vf_mbx_acquire_chk_dorq() argument
1305 if (bnx2x_search_tlv_list(bp, &mbx->msg->req, in bnx2x_vf_mbx_acquire_chk_dorq()
1310 if (bnx2x_vf_mbx_is_windows_vm(bp, &mbx->msg->req.acquire)) in bnx2x_vf_mbx_acquire_chk_dorq()
1316 static void bnx2x_vf_mbx_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_acquire() argument
1335 rc = bnx2x_vf_mbx_acquire_chk_dorq(bp, vf, mbx); in bnx2x_vf_mbx_acquire()
1346 if (bnx2x_vf_mbx_is_windows_vm(bp, &mbx->msg->req.acquire)) in bnx2x_vf_mbx_acquire()
1361 rc = bnx2x_vf_acquire(bp, vf, &acquire->resc_request); in bnx2x_vf_mbx_acquire()
1375 bnx2x_vf_mbx_acquire_resp(bp, vf, mbx, rc); in bnx2x_vf_mbx_acquire()
1378 static void bnx2x_vf_mbx_init_vf(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_init_vf() argument
1388 rc = bnx2x_vf_init(bp, vf, (dma_addr_t *)init->sb_addr); in bnx2x_vf_mbx_init_vf()
1396 bnx2x_iov_link_update_vf(bp, vf->index); in bnx2x_vf_mbx_init_vf()
1399 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_init_vf()
1403 static void bnx2x_vf_mbx_set_q_flags(struct bnx2x *bp, u32 mbx_q_flags, in bnx2x_vf_mbx_set_q_flags() argument
1426 if (IS_MF_SD(bp)) in bnx2x_vf_mbx_set_q_flags()
1430 static void bnx2x_vf_mbx_setup_q(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_setup_q() argument
1456 bnx2x_leading_vfq_init(bp, vf, q); in bnx2x_vf_mbx_setup_q()
1480 bnx2x_vf_mbx_set_q_flags(bp, setup_q->txq.flags, in bnx2x_vf_mbx_setup_q()
1484 bnx2x_vf_mbx_set_q_flags(bp, setup_q->txq.flags, in bnx2x_vf_mbx_setup_q()
1494 bnx2x_vfop_qctor_dump_tx(bp, vf, init_p, setup_p, in bnx2x_vf_mbx_setup_q()
1512 bnx2x_vf_mbx_set_q_flags(bp, setup_q->rxq.flags, in bnx2x_vf_mbx_setup_q()
1516 bnx2x_vf_mbx_set_q_flags(bp, setup_q->rxq.flags, in bnx2x_vf_mbx_setup_q()
1544 bnx2x_vfop_qctor_dump_rx(bp, vf, init_p, setup_p, in bnx2x_vf_mbx_setup_q()
1548 bnx2x_vfop_qctor_prep(bp, vf, q, &qctor, q_type); in bnx2x_vf_mbx_setup_q()
1550 rc = bnx2x_vf_queue_setup(bp, vf, q->index, &qctor); in bnx2x_vf_mbx_setup_q()
1555 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_setup_q()
1558 static int bnx2x_vf_mbx_macvlan_list(struct bnx2x *bp, in bnx2x_vf_mbx_macvlan_list() argument
1601 static void bnx2x_vf_mbx_dp_q_filter(struct bnx2x *bp, int msglvl, int idx, in bnx2x_vf_mbx_dp_q_filter() argument
1612 static void bnx2x_vf_mbx_dp_q_filters(struct bnx2x *bp, int msglvl, in bnx2x_vf_mbx_dp_q_filters() argument
1619 bnx2x_vf_mbx_dp_q_filter(bp, msglvl, i, in bnx2x_vf_mbx_dp_q_filters()
1633 static int bnx2x_vf_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_mbx_qfilters() argument
1638 &BP_VF_MBX(bp, vf->index)->msg->req.set_q_filters; in bnx2x_vf_mbx_qfilters()
1645 rc = bnx2x_vf_mbx_macvlan_list(bp, vf, msg, &fl, in bnx2x_vf_mbx_qfilters()
1653 rc = bnx2x_vf_mac_vlan_config_list(bp, vf, fl, in bnx2x_vf_mbx_qfilters()
1663 rc = bnx2x_vf_mbx_macvlan_list(bp, vf, msg, &fl, in bnx2x_vf_mbx_qfilters()
1670 rc = bnx2x_vf_mac_vlan_config_list(bp, vf, fl, in bnx2x_vf_mbx_qfilters()
1681 BP_VF_BULLETIN(bp, vf->index); in bnx2x_vf_mbx_qfilters()
1698 rc = bnx2x_vf_rxmode(bp, vf, msg->vf_qid, accept); in bnx2x_vf_mbx_qfilters()
1705 rc = bnx2x_vf_mcast(bp, vf, msg->multicast, in bnx2x_vf_mbx_qfilters()
1717 static int bnx2x_filters_validate_mac(struct bnx2x *bp, in bnx2x_filters_validate_mac() argument
1721 struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vf->index); in bnx2x_filters_validate_mac()
1753 static int bnx2x_filters_validate_vlan(struct bnx2x *bp, in bnx2x_filters_validate_vlan() argument
1757 struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vf->index); in bnx2x_filters_validate_vlan()
1786 static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp, in bnx2x_vf_mbx_set_q_filters() argument
1793 rc = bnx2x_filters_validate_mac(bp, vf, filters); in bnx2x_vf_mbx_set_q_filters()
1797 rc = bnx2x_filters_validate_vlan(bp, vf, filters); in bnx2x_vf_mbx_set_q_filters()
1806 bnx2x_vf_mbx_dp_q_filters(bp, BNX2X_MSG_IOV, filters); in bnx2x_vf_mbx_set_q_filters()
1808 rc = bnx2x_vf_mbx_qfilters(bp, vf); in bnx2x_vf_mbx_set_q_filters()
1810 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_set_q_filters()
1813 static void bnx2x_vf_mbx_teardown_q(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_teardown_q() argument
1822 rc = bnx2x_vf_queue_teardown(bp, vf, qid); in bnx2x_vf_mbx_teardown_q()
1823 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_teardown_q()
1826 static void bnx2x_vf_mbx_close_vf(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_close_vf() argument
1833 rc = bnx2x_vf_close(bp, vf); in bnx2x_vf_mbx_close_vf()
1834 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_close_vf()
1837 static void bnx2x_vf_mbx_release_vf(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_release_vf() argument
1844 rc = bnx2x_vf_free(bp, vf); in bnx2x_vf_mbx_release_vf()
1845 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_release_vf()
1848 static void bnx2x_vf_mbx_update_rss(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_update_rss() argument
1904 rc = bnx2x_vf_rss_update(bp, vf, &rss); in bnx2x_vf_mbx_update_rss()
1906 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_update_rss()
1909 static int bnx2x_validate_tpa_params(struct bnx2x *bp, in bnx2x_validate_tpa_params() argument
1922 if (tpa_tlv->tpa_client_info.max_tpa_queues > MAX_AGG_QS(bp)) { in bnx2x_validate_tpa_params()
1926 MAX_AGG_QS(bp)); in bnx2x_validate_tpa_params()
1932 static void bnx2x_vf_mbx_update_tpa(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_update_tpa() argument
1941 if (bnx2x_validate_tpa_params(bp, tpa_tlv)) in bnx2x_vf_mbx_update_tpa()
1967 rc = bnx2x_vf_tpa_update(bp, vf, tpa_tlv, &vf_op_params); in bnx2x_vf_mbx_update_tpa()
1970 bnx2x_vf_mbx_resp(bp, vf, rc); in bnx2x_vf_mbx_update_tpa()
1974 static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mbx_request() argument
1984 bnx2x_lock_vf_pf_channel(bp, vf, mbx->first_tlv.tl.type); in bnx2x_vf_mbx_request()
1989 bnx2x_vf_mbx_acquire(bp, vf, mbx); in bnx2x_vf_mbx_request()
1992 bnx2x_vf_mbx_init_vf(bp, vf, mbx); in bnx2x_vf_mbx_request()
1995 bnx2x_vf_mbx_setup_q(bp, vf, mbx); in bnx2x_vf_mbx_request()
1998 bnx2x_vf_mbx_set_q_filters(bp, vf, mbx); in bnx2x_vf_mbx_request()
2001 bnx2x_vf_mbx_teardown_q(bp, vf, mbx); in bnx2x_vf_mbx_request()
2004 bnx2x_vf_mbx_close_vf(bp, vf, mbx); in bnx2x_vf_mbx_request()
2007 bnx2x_vf_mbx_release_vf(bp, vf, mbx); in bnx2x_vf_mbx_request()
2010 bnx2x_vf_mbx_update_rss(bp, vf, mbx); in bnx2x_vf_mbx_request()
2013 bnx2x_vf_mbx_update_tpa(bp, vf, mbx); in bnx2x_vf_mbx_request()
2035 bnx2x_vf_mbx_resp(bp, vf, PFVF_STATUS_NOT_SUPPORTED); in bnx2x_vf_mbx_request()
2041 storm_memset_vf_mbx_ack(bp, vf->abs_vfid); in bnx2x_vf_mbx_request()
2044 bnx2x_unlock_vf_pf_channel(bp, vf, mbx->first_tlv.tl.type); in bnx2x_vf_mbx_request()
2048 void bnx2x_vf_mbx_schedule(struct bnx2x *bp, in bnx2x_vf_mbx_schedule() argument
2059 if (vfpf_event->vf_id - BP_VFDB(bp)->sriov.first_vf_in_pf > in bnx2x_vf_mbx_schedule()
2060 BNX2X_NR_VIRTFN(bp)) { in bnx2x_vf_mbx_schedule()
2062 vfpf_event->vf_id, BNX2X_NR_VIRTFN(bp)); in bnx2x_vf_mbx_schedule()
2066 vf_idx = bnx2x_vf_idx_by_abs_fid(bp, vfpf_event->vf_id); in bnx2x_vf_mbx_schedule()
2069 mutex_lock(&BP_VFDB(bp)->event_mutex); in bnx2x_vf_mbx_schedule()
2070 BP_VF_MBX(bp, vf_idx)->vf_addr_hi = vfpf_event->msg_addr_hi; in bnx2x_vf_mbx_schedule()
2071 BP_VF_MBX(bp, vf_idx)->vf_addr_lo = vfpf_event->msg_addr_lo; in bnx2x_vf_mbx_schedule()
2072 BP_VFDB(bp)->event_occur |= (1ULL << vf_idx); in bnx2x_vf_mbx_schedule()
2073 mutex_unlock(&BP_VFDB(bp)->event_mutex); in bnx2x_vf_mbx_schedule()
2075 bnx2x_schedule_iov_task(bp, BNX2X_IOV_HANDLE_VF_MSG); in bnx2x_vf_mbx_schedule()
2079 void bnx2x_vf_mbx(struct bnx2x *bp) in bnx2x_vf_mbx() argument
2081 struct bnx2x_vfdb *vfdb = BP_VFDB(bp); in bnx2x_vf_mbx()
2094 for_each_vf(bp, vf_idx) { in bnx2x_vf_mbx()
2095 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf_idx); in bnx2x_vf_mbx()
2096 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_vf_mbx()
2108 rc = bnx2x_copy32_vf_dmae(bp, true, mbx->msg_mapping, in bnx2x_vf_mbx()
2115 bnx2x_vf_release(bp, vf); in bnx2x_vf_mbx()
2128 bnx2x_vf_mbx_request(bp, vf, mbx); in bnx2x_vf_mbx()
2144 int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf) in bnx2x_post_vf_bulletin() argument
2146 struct pf_vf_bulletin_content *bulletin = BP_VF_BULLETIN(bp, vf); in bnx2x_post_vf_bulletin()
2147 dma_addr_t pf_addr = BP_VF_BULLETIN_DMA(bp)->mapping + in bnx2x_post_vf_bulletin()
2149 dma_addr_t vf_addr = bnx2x_vf(bp, vf, bulletin_map); in bnx2x_post_vf_bulletin()
2153 if (bnx2x_vf(bp, vf, state) != VF_ENABLED && in bnx2x_post_vf_bulletin()
2154 bnx2x_vf(bp, vf, state) != VF_ACQUIRED) in bnx2x_post_vf_bulletin()
2160 (bnx2x_vf(bp, vf, cfg_flags) & in bnx2x_post_vf_bulletin()
2164 rc = bnx2x_copy32_vf_dmae(bp, false, pf_addr, in bnx2x_post_vf_bulletin()
2165 bnx2x_vf(bp, vf, abs_vfid), U64_HI(vf_addr), in bnx2x_post_vf_bulletin()