Lines Matching refs:vf

28 			    struct bnx2x_virtf **vf,
76 static void bnx2x_vf_igu_ack_sb(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_igu_ack_sb() argument
84 u32 func_encode = vf->abs_vfid; in bnx2x_vf_igu_ack_sb()
112 struct bnx2x_virtf *vf, in bnx2x_validate_vf_sp_objs() argument
115 if (!bnx2x_leading_vfq(vf, sp_initialized)) { in bnx2x_validate_vf_sp_objs()
126 void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_dump_tx() argument
133 vf->abs_vfid, in bnx2x_vfop_qctor_dump_tx()
142 void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_dump_rx() argument
151 vf->abs_vfid, in bnx2x_vfop_qctor_dump_rx()
167 struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_prep() argument
185 init_p->rx.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
186 init_p->tx.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
194 setup_p->gen_params.spcl_id = vf->sp_cl_id; in bnx2x_vfop_qctor_prep()
195 setup_p->gen_params.stat_id = vfq_stat_id(vf, q); in bnx2x_vfop_qctor_prep()
196 setup_p->gen_params.fp_hsi = vf->fp_hsi; in bnx2x_vfop_qctor_prep()
203 if (vf->cfg_flags & VF_CFG_FW_FC) in bnx2x_vfop_qctor_prep()
205 vf->abs_vfid); in bnx2x_vfop_qctor_prep()
224 rxq_p->cl_qzone_id = vfq_qzone_id(vf, q); in bnx2x_vfop_qctor_prep()
225 rxq_p->fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
226 rxq_p->rss_engine_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfop_qctor_prep()
234 setup_p->txq_params.tss_leading_cl_id = vf->leading_rss; in bnx2x_vfop_qctor_prep()
235 setup_p->txq_params.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
240 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_create() argument
246 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_create()
250 q_params->q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_create()
273 bnx2x_vf_igu_ack_sb(bp, vf, vf_igu_sb(vf, bnx2x_vfq(vf, qid, sb_idx)), in bnx2x_vf_queue_create()
279 static int bnx2x_vf_queue_destroy(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_destroy() argument
288 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_queue_destroy()
292 q_params.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_destroy()
312 if (bnx2x_vfq(vf, qid, cxt)) { in bnx2x_vf_queue_destroy()
313 bnx2x_vfq(vf, qid, cxt)->ustorm_ag_context.cdu_usage = 0; in bnx2x_vf_queue_destroy()
314 bnx2x_vfq(vf, qid, cxt)->xstorm_ag_context.cdu_reserved = 0; in bnx2x_vf_queue_destroy()
323 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_set_igu_info() local
324 if (vf) { in bnx2x_vf_set_igu_info()
330 if (!vf_sb_count(vf)) in bnx2x_vf_set_igu_info()
331 vf->igu_base_id = igu_sb_id; in bnx2x_vf_set_igu_info()
333 ++vf_sb_count(vf); in bnx2x_vf_set_igu_info()
334 ++vf->sb_count; in bnx2x_vf_set_igu_info()
360 static int bnx2x_vf_vlan_mac_clear(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_vlan_mac_clear() argument
366 DP(BNX2X_MSG_IOV, "vf[%d] - deleting all %s\n", vf->abs_vfid, in bnx2x_vf_vlan_mac_clear()
373 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_vlan_mac_clear()
377 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_vlan_mac_clear()
400 atomic_set(&bnx2x_vfq(vf, qid, vlan_count), 0); in bnx2x_vf_vlan_mac_clear()
406 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_mac_vlan_config() argument
414 vf->abs_vfid, filter->add ? "Adding" : "Deleting", in bnx2x_vf_mac_vlan_config()
422 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_mac_vlan_config()
426 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_mac_vlan_config()
434 (atomic_read(&bnx2x_vfq(vf, qid, vlan_count)) >= in bnx2x_vf_mac_vlan_config()
435 vf_vlan_rules_cnt(vf))) { in bnx2x_vf_mac_vlan_config()
437 atomic_read(&bnx2x_vfq(vf, qid, vlan_count)), in bnx2x_vf_mac_vlan_config()
438 vf_vlan_rules_cnt(vf)); in bnx2x_vf_mac_vlan_config()
461 &bnx2x_vfq(vf, qid, vlan_count)); in bnx2x_vf_mac_vlan_config()
466 int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mac_vlan_config_list() argument
472 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mac_vlan_config_list()
474 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_vf_mac_vlan_config_list()
479 rc = bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
491 bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
503 int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_setup() argument
508 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_setup()
510 rc = bnx2x_vf_queue_create(bp, vf, qid, qctor); in bnx2x_vf_queue_setup()
522 rc = bnx2x_vf_mac_vlan_config(bp, vf, qid, &filter, false); in bnx2x_vf_queue_setup()
528 vf->cfg_flags |= VF_CFG_VLAN; in bnx2x_vf_queue_setup()
533 BNX2X_ERR("QSETUP[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_setup()
537 static int bnx2x_vf_queue_flr(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_flr() argument
542 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_flr()
546 bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_vf_queue_flr()
547 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, false); in bnx2x_vf_queue_flr()
550 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, true); in bnx2x_vf_queue_flr()
556 if (bnx2x_vfq(vf, qid, sp_obj).state != BNX2X_Q_STATE_RESET) { in bnx2x_vf_queue_flr()
560 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_flr()
571 BNX2X_ERR("vf[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_flr()
575 int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mcast() argument
582 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mcast()
586 mcast.mcast_obj = &vf->mcast_obj; in bnx2x_vf_mcast()
601 mcast.mcast_list_len = vf->mcast_list_len; in bnx2x_vf_mcast()
602 vf->mcast_list_len = mc_num; in bnx2x_vf_mcast()
632 struct bnx2x_virtf *vf, in bnx2x_vf_prep_rx_mode() argument
635 struct bnx2x_vf_queue *vfq = vfq_get(vf, qid); in bnx2x_vf_prep_rx_mode()
639 ramrod->cl_id = vfq_cl_id(vf, vfq); in bnx2x_vf_prep_rx_mode()
641 ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_prep_rx_mode()
644 ramrod->pstate = &vf->filter_state; in bnx2x_vf_prep_rx_mode()
647 set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_prep_rx_mode()
651 ramrod->rdata = bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
652 ramrod->rdata_mapping = bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
655 int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rxmode() argument
660 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rxmode()
662 bnx2x_vf_prep_rx_mode(bp, qid, &ramrod, vf, accept_flags); in bnx2x_vf_rxmode()
664 vfq_get(vf, qid)->accept_flags = ramrod.rx_accept_flags; in bnx2x_vf_rxmode()
668 int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid) in bnx2x_vf_queue_teardown() argument
672 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_teardown()
676 rc = bnx2x_vf_rxmode(bp, vf, qid, 0); in bnx2x_vf_queue_teardown()
681 if (bnx2x_validate_vf_sp_objs(bp, vf, true)) { in bnx2x_vf_queue_teardown()
682 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
686 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
690 rc = bnx2x_vf_mcast(bp, vf, NULL, 0, false); in bnx2x_vf_queue_teardown()
697 rc = bnx2x_vf_queue_destroy(bp, vf, qid); in bnx2x_vf_queue_teardown()
703 vf->abs_vfid, qid, rc); in bnx2x_vf_queue_teardown()
751 static void bnx2x_vf_igu_reset(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_reset() argument
757 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_reset()
768 if (vf->cfg_flags & VF_CFG_INT_SIMD) in bnx2x_vf_igu_reset()
776 vf->abs_vfid, val); in bnx2x_vf_igu_reset()
781 for (i = 0; i < vf_sb_count(vf); i++) { in bnx2x_vf_igu_reset()
782 u8 igu_sb_id = vf_igu_sb(vf, i); in bnx2x_vf_igu_reset()
788 bnx2x_igu_clear_sb_gen(bp, vf->abs_vfid, igu_sb_id, in bnx2x_vf_igu_reset()
792 bnx2x_vf_igu_ack_sb(bp, vf, igu_sb_id, USTORM_ID, 0, in bnx2x_vf_igu_reset()
814 static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_enable_traffic() argument
817 bnx2x_vf_igu_reset(bp, vf); in bnx2x_vf_enable_traffic()
820 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_enable_traffic()
828 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_is_pcie_pending() local
830 if (!vf) in bnx2x_vf_is_pcie_pending()
833 dev = pci_get_bus_and_slot(vf->bus, vf->devfn); in bnx2x_vf_is_pcie_pending()
849 struct bnx2x_virtf *vf, in bnx2x_iov_re_set_vlan_filters() argument
852 int num = vf_vlan_rules_cnt(vf); in bnx2x_iov_re_set_vlan_filters()
857 vf->abs_vfid, new, num); in bnx2x_iov_re_set_vlan_filters()
865 vf_vlan_rules_cnt(vf) = new; in bnx2x_iov_re_set_vlan_filters()
868 vf->abs_vfid); in bnx2x_iov_re_set_vlan_filters()
875 bnx2x_iov_static_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_iov_static_resc() argument
877 struct vf_pf_resc_request *resc = &vf->alloc_resc; in bnx2x_iov_static_resc()
888 bnx2x_iov_re_set_vlan_filters(bp, vf, 0); in bnx2x_iov_static_resc()
891 bnx2x_iov_re_set_vlan_filters(bp, vf, in bnx2x_iov_static_resc()
898 resc->num_sbs = vf->sb_count; in bnx2x_iov_static_resc()
902 static void bnx2x_vf_free_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free_resc() argument
905 bnx2x_iov_static_resc(bp, vf); in bnx2x_vf_free_resc()
906 vf->state = VF_FREE; in bnx2x_vf_free_resc()
909 static void bnx2x_vf_flr_clnup_hw(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr_clnup_hw() argument
914 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_flr_clnup_hw()
921 if (bnx2x_send_final_clnup(bp, (u8)FW_VF_HANDLE(vf->abs_vfid), in bnx2x_vf_flr_clnup_hw()
923 BNX2X_ERR("VF[%d] Final cleanup timed-out\n", vf->abs_vfid); in bnx2x_vf_flr_clnup_hw()
929 static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr() argument
933 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_flr()
938 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_flr()
939 rc = bnx2x_vf_queue_flr(bp, vf, i); in bnx2x_vf_flr()
945 bnx2x_vf_mcast(bp, vf, NULL, 0, true); in bnx2x_vf_flr()
948 bnx2x_vf_flr_clnup_hw(bp, vf); in bnx2x_vf_flr()
951 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_flr()
954 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_vf_flr()
958 vf->abs_vfid, i, rc); in bnx2x_vf_flr()
963 struct bnx2x_virtf *vf; in bnx2x_vf_flr_clnup() local
975 vf = BP_VF(bp, i); in bnx2x_vf_flr_clnup()
978 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
981 bnx2x_vf_flr(bp, vf); in bnx2x_vf_flr_clnup()
984 vf->flr_clnup_stage = false; in bnx2x_vf_flr_clnup()
985 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
1023 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_vf_handle_flr_event() local
1026 if (vf->abs_vfid < 32) in bnx2x_vf_handle_flr_event()
1027 reset = bp->vfdb->flrd_vfs[0] & (1 << vf->abs_vfid); in bnx2x_vf_handle_flr_event()
1030 (1 << (vf->abs_vfid - 32)); in bnx2x_vf_handle_flr_event()
1034 vf->state = VF_RESET; in bnx2x_vf_handle_flr_event()
1035 vf->flr_clnup_stage = true; in bnx2x_vf_handle_flr_event()
1039 vf->abs_vfid); in bnx2x_vf_handle_flr_event()
1108 static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_set_bars() argument
1119 vf->bars[n].bar = start + size * vf->abs_vfid; in bnx2x_vf_set_bars()
1120 vf->bars[n].size = size; in bnx2x_vf_set_bars()
1459 static void bnx2x_vfq_init(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfq_init() argument
1462 u8 cl_id = vfq_cl_id(vf, q); in bnx2x_vfq_init()
1463 u8 func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfq_init()
1472 bnx2x_vf_sp(bp, vf, q_data), in bnx2x_vfq_init()
1473 bnx2x_vf_sp_map(bp, vf, q_data), in bnx2x_vfq_init()
1481 vf->abs_vfid, q->sp_obj.func_id, q->cid); in bnx2x_vfq_init()
1499 struct bnx2x_virtf *vf; in bnx2x_iov_link_update_vf() local
1504 rc = bnx2x_vf_op_prep(bp, idx, &vf, &bulletin, false); in bnx2x_iov_link_update_vf()
1510 if (vf->link_cfg == IFLA_VF_LINK_STATE_AUTO) { in bnx2x_iov_link_update_vf()
1527 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_DISABLE && in bnx2x_iov_link_update_vf()
1531 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_ENABLE && in bnx2x_iov_link_update_vf()
1543 vf->link_cfg, bulletin->link_speed, bulletin->link_flags); in bnx2x_iov_link_update_vf()
1561 struct bnx2x_virtf *vf = BP_VF(bp, idx); in bnx2x_set_vf_link_state() local
1563 if (!vf) in bnx2x_set_vf_link_state()
1566 if (vf->link_cfg == link_state) in bnx2x_set_vf_link_state()
1569 vf->link_cfg = link_state; in bnx2x_set_vf_link_state()
1602 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1613 vf->abs_vfid, vf_sb_count(vf), base_vf_cid, in bnx2x_iov_nic_init()
1617 bnx2x_iov_static_resc(bp, vf); in bnx2x_iov_nic_init()
1620 vf->filter_state = 0; in bnx2x_iov_nic_init()
1621 vf->sp_cl_id = bnx2x_fp(bp, 0, cl_id); in bnx2x_iov_nic_init()
1628 vf->mcast_list_len = 0; in bnx2x_iov_nic_init()
1629 bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF, in bnx2x_iov_nic_init()
1631 bnx2x_vf_sp(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1632 bnx2x_vf_sp_map(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1634 &vf->filter_state, in bnx2x_iov_nic_init()
1646 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_iov_nic_init()
1651 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1654 vf->bus = bnx2x_vf_bus(bp, vfid); in bnx2x_iov_nic_init()
1655 vf->devfn = bnx2x_vf_devfn(bp, vfid); in bnx2x_iov_nic_init()
1656 bnx2x_vf_set_bars(bp, vf); in bnx2x_iov_nic_init()
1660 vf->abs_vfid, vf->bus, vf->devfn, in bnx2x_iov_nic_init()
1661 (unsigned)vf->bars[0].bar, vf->bars[0].size, in bnx2x_iov_nic_init()
1662 (unsigned)vf->bars[1].bar, vf->bars[1].size, in bnx2x_iov_nic_init()
1663 (unsigned)vf->bars[2].bar, vf->bars[2].size); in bnx2x_iov_nic_init()
1743 struct bnx2x_virtf *vf) in bnx2x_vf_handle_mcast_eqe() argument
1748 rparam.mcast_obj = &vf->mcast_obj; in bnx2x_vf_handle_mcast_eqe()
1749 vf->mcast_obj.raw.clear_pending(&vf->mcast_obj.raw); in bnx2x_vf_handle_mcast_eqe()
1752 if (vf->mcast_obj.check_pending(&vf->mcast_obj)) { in bnx2x_vf_handle_mcast_eqe()
1762 struct bnx2x_virtf *vf) in bnx2x_vf_handle_filters_eqe() argument
1765 clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_handle_filters_eqe()
1770 struct bnx2x_virtf *vf) in bnx2x_vf_handle_rss_update_eqe() argument
1772 vf->rss_conf_obj.raw.clear_pending(&vf->rss_conf_obj.raw); in bnx2x_vf_handle_rss_update_eqe()
1777 struct bnx2x_virtf *vf; in bnx2x_iov_eq_sp_event() local
1832 vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_iov_eq_sp_event()
1834 if (!vf) { in bnx2x_iov_eq_sp_event()
1843 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1844 vfq_get(vf, qidx)->sp_obj.complete_cmd(bp, in bnx2x_iov_eq_sp_event()
1845 &vfq_get(vf, in bnx2x_iov_eq_sp_event()
1851 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1852 bnx2x_vf_handle_classification_eqe(bp, vfq_get(vf, qidx), elem); in bnx2x_iov_eq_sp_event()
1856 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1857 bnx2x_vf_handle_mcast_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1861 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1862 bnx2x_vf_handle_filters_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1866 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1867 bnx2x_vf_handle_rss_update_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1890 struct bnx2x_virtf *vf; in bnx2x_iov_set_queue_sp_obj() local
1895 vf = bnx2x_vf_by_cid(bp, vf_cid); in bnx2x_iov_set_queue_sp_obj()
1897 if (vf) { in bnx2x_iov_set_queue_sp_obj()
1903 *q_obj = &bnx2x_vfq(vf, q_index, sp_obj); in bnx2x_iov_set_queue_sp_obj()
1943 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_iov_adjust_stats_req() local
1945 if (vf->state != VF_ENABLED) { in bnx2x_iov_adjust_stats_req()
1948 vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1952 DP(BNX2X_MSG_IOV, "add addresses for vf %d\n", vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1953 for_each_vfq(vf, j) { in bnx2x_iov_adjust_stats_req()
1954 struct bnx2x_vf_queue *rxq = vfq_get(vf, j); in bnx2x_iov_adjust_stats_req()
1957 vf->fw_stat_map + j * vf->stats_stride; in bnx2x_iov_adjust_stats_req()
1966 cur_query_entry->index = vfq_stat_id(vf, rxq); in bnx2x_iov_adjust_stats_req()
1968 cpu_to_le16(FW_VF_HANDLE(vf->abs_vfid)); in bnx2x_iov_adjust_stats_req()
1983 if (vf->cfg_flags & VF_CFG_STATS_COALESCE) in bnx2x_iov_adjust_stats_req()
2000 static void bnx2x_vf_clr_qtbl(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_clr_qtbl() argument
2004 for_each_vfq(vf, i) in bnx2x_vf_clr_qtbl()
2005 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_clr_qtbl()
2006 vfq_qzone_id(vf, vfq_get(vf, i)), false); in bnx2x_vf_clr_qtbl()
2009 static void bnx2x_vf_igu_disable(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_disable() argument
2014 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_disable()
2022 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_max_queue_cnt() argument
2024 return min_t(u8, min_t(u8, vf_sb_count(vf), BNX2X_CIDS_PER_VF), in bnx2x_vf_max_queue_cnt()
2029 int bnx2x_vf_chk_avail_resc(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_chk_avail_resc() argument
2032 u8 rxq_cnt = vf_rxq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
2033 u8 txq_cnt = vf_txq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
2038 (req_resc->num_sbs <= vf_sb_count(vf)) && in bnx2x_vf_chk_avail_resc()
2039 (req_resc->num_mac_filters <= vf_mac_rules_cnt(vf)) && in bnx2x_vf_chk_avail_resc()
2040 (req_resc->num_vlan_filters <= vf_vlan_rules_visible_cnt(vf))); in bnx2x_vf_chk_avail_resc()
2044 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_acquire() argument
2047 int base_vf_cid = (BP_VFDB(bp)->sriov.first_vf_in_pf + vf->index) * in bnx2x_vf_acquire()
2060 if (vf->state == VF_ACQUIRED) { in bnx2x_vf_acquire()
2062 vf->abs_vfid); in bnx2x_vf_acquire()
2064 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2066 vf->abs_vfid); in bnx2x_vf_acquire()
2073 if (vf->state != VF_FREE && vf->state != VF_RESET) { in bnx2x_vf_acquire()
2075 vf->abs_vfid, vf->state); in bnx2x_vf_acquire()
2083 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2091 vf_sb_count(vf) = resc->num_sbs; in bnx2x_vf_acquire()
2092 vf_rxq_count(vf) = resc->num_rxqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2093 vf_txq_count(vf) = resc->num_txqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2095 vf_mac_rules_cnt(vf) = resc->num_mac_filters; in bnx2x_vf_acquire()
2097 bnx2x_iov_re_set_vlan_filters(bp, vf, resc->num_vlan_filters + 1); in bnx2x_vf_acquire()
2101 vf_sb_count(vf), vf_rxq_count(vf), in bnx2x_vf_acquire()
2102 vf_txq_count(vf), vf_mac_rules_cnt(vf), in bnx2x_vf_acquire()
2103 vf_vlan_rules_visible_cnt(vf)); in bnx2x_vf_acquire()
2106 if (!vf->vfqs) { in bnx2x_vf_acquire()
2111 for_each_vfq(vf, i) { in bnx2x_vf_acquire()
2112 struct bnx2x_vf_queue *q = vfq_get(vf, i); in bnx2x_vf_acquire()
2124 vf->abs_vfid, i, q->index, q->cid, q->cxt); in bnx2x_vf_acquire()
2127 bnx2x_vfq_init(bp, vf, q); in bnx2x_vf_acquire()
2129 vf->state = VF_ACQUIRED; in bnx2x_vf_acquire()
2133 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map) in bnx2x_vf_init() argument
2142 for_each_vf_sb(vf, i) in bnx2x_vf_init()
2143 bnx2x_init_sb(bp, (dma_addr_t)sb_map[i], vf->abs_vfid, true, in bnx2x_vf_init()
2144 vf_igu_sb(vf, i), vf_igu_sb(vf, i)); in bnx2x_vf_init()
2147 if (vf->state != VF_ACQUIRED) { in bnx2x_vf_init()
2149 vf->abs_vfid, vf->state); in bnx2x_vf_init()
2157 if (bnx2x_vf_flr_clnup_epilog(bp, vf->abs_vfid)) in bnx2x_vf_init()
2161 REG_WR(bp, IGU_REG_STATISTIC_NUM_MESSAGE_SENT + vf->abs_vfid * 4 , 0); in bnx2x_vf_init()
2164 if (vf->cfg_flags & VF_CFG_STATS) in bnx2x_vf_init()
2167 if (vf->cfg_flags & VF_CFG_TPA) in bnx2x_vf_init()
2170 if (is_vf_multi(vf)) in bnx2x_vf_init()
2176 func_init.func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_init()
2177 func_init.fw_stat_map = vf->fw_stat_map; in bnx2x_vf_init()
2178 func_init.spq_map = vf->spq_map; in bnx2x_vf_init()
2183 bnx2x_vf_enable_access(bp, vf->abs_vfid); in bnx2x_vf_init()
2184 bnx2x_vf_enable_traffic(bp, vf); in bnx2x_vf_init()
2187 for_each_vfq(vf, i) in bnx2x_vf_init()
2188 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_init()
2189 vfq_qzone_id(vf, vfq_get(vf, i)), true); in bnx2x_vf_init()
2191 vf->state = VF_ENABLED; in bnx2x_vf_init()
2194 bnx2x_post_vf_bulletin(bp, vf->index); in bnx2x_vf_init()
2200 struct bnx2x_virtf *vf; member
2208 p->vf->state = p->state; in bnx2x_set_vf_state()
2211 int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_close() argument
2215 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_close()
2218 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_close()
2219 rc = bnx2x_vf_queue_teardown(bp, vf, i); in bnx2x_vf_close()
2226 bnx2x_vf_igu_disable(bp, vf); in bnx2x_vf_close()
2230 bnx2x_vf_clr_qtbl(bp, vf); in bnx2x_vf_close()
2239 cookie.vf = vf; in bnx2x_vf_close()
2250 BNX2X_ERR("vf[%d] CLOSE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_close()
2258 int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free() argument
2262 DP(BNX2X_MSG_IOV, "VF[%d] STATE: %s\n", vf->abs_vfid, in bnx2x_vf_free()
2263 vf->state == VF_FREE ? "Free" : in bnx2x_vf_free()
2264 vf->state == VF_ACQUIRED ? "Acquired" : in bnx2x_vf_free()
2265 vf->state == VF_ENABLED ? "Enabled" : in bnx2x_vf_free()
2266 vf->state == VF_RESET ? "Reset" : in bnx2x_vf_free()
2269 switch (vf->state) { in bnx2x_vf_free()
2271 rc = bnx2x_vf_close(bp, vf); in bnx2x_vf_free()
2277 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_free()
2287 BNX2X_ERR("VF[%d] RELEASE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_free()
2291 int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rss_update() argument
2294 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rss_update()
2299 int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_tpa_update() argument
2307 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_tpa_update()
2316 for (qid = 0; qid < vf_rxq_count(vf); qid++) { in bnx2x_vf_tpa_update()
2317 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_tpa_update()
2320 vf->abs_vfid, qid, U64_HI(sge_addr[qid]), in bnx2x_vf_tpa_update()
2326 vf->abs_vfid, qid); in bnx2x_vf_tpa_update()
2338 int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_release() argument
2342 DP(BNX2X_MSG_IOV, "PF releasing vf %d\n", vf->abs_vfid); in bnx2x_vf_release()
2343 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2345 rc = bnx2x_vf_free(bp, vf); in bnx2x_vf_release()
2349 vf->abs_vfid, rc); in bnx2x_vf_release()
2350 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2354 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_lock_vf_pf_channel() argument
2364 mutex_lock(&vf->op_mutex); in bnx2x_lock_vf_pf_channel()
2367 vf->op_current = tlv; in bnx2x_lock_vf_pf_channel()
2371 vf->abs_vfid, tlv); in bnx2x_lock_vf_pf_channel()
2374 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_unlock_vf_pf_channel() argument
2379 if (!vf) { in bnx2x_unlock_vf_pf_channel()
2380 BNX2X_ERR("VF was %p\n", vf); in bnx2x_unlock_vf_pf_channel()
2384 current_tlv = vf->op_current; in bnx2x_unlock_vf_pf_channel()
2390 WARN(expected_tlv != vf->op_current, in bnx2x_unlock_vf_pf_channel()
2392 vf->op_current); in bnx2x_unlock_vf_pf_channel()
2395 vf->op_current = CHANNEL_TLV_NONE; in bnx2x_unlock_vf_pf_channel()
2398 mutex_unlock(&vf->op_mutex); in bnx2x_unlock_vf_pf_channel()
2402 vf->abs_vfid, current_tlv); in bnx2x_unlock_vf_pf_channel()
2514 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2516 vf->sb_count = 0; in bnx2x_enable_sriov()
2545 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2548 vf->vfqs = &bp->vfdb->vfqs[qcount]; in bnx2x_enable_sriov()
2549 qcount += vf_sb_count(vf); in bnx2x_enable_sriov()
2550 bnx2x_iov_static_resc(bp, vf); in bnx2x_enable_sriov()
2610 struct bnx2x_virtf **vf, in bnx2x_vf_op_prep() argument
2631 *vf = BP_VF(bp, vfidx); in bnx2x_vf_op_prep()
2634 if (!*vf) { in bnx2x_vf_op_prep()
2639 if (test_queue && !(*vf)->vfqs) { in bnx2x_vf_op_prep()
2658 struct bnx2x_virtf *vf = NULL; in bnx2x_get_vf_config() local
2665 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_get_vf_config()
2669 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_get_vf_config()
2670 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_get_vf_config()
2676 ivi->vf = vfidx; in bnx2x_get_vf_config()
2681 if (vf->state == VF_ENABLED) { in bnx2x_get_vf_config()
2683 if (bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_get_vf_config()
2735 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_mac() local
2744 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_mac()
2768 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)); in bnx2x_set_vf_mac()
2769 if (vf->state == VF_ENABLED && in bnx2x_set_vf_mac()
2776 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_mac()
2780 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2783 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_set_vf_mac()
2805 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2822 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_vlan() local
2835 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_vlan()
2856 if (vf->state != VF_ENABLED || in bnx2x_set_vf_vlan()
2857 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) != in bnx2x_set_vf_vlan()
2862 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_vlan()
2866 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()
2870 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_set_vf_vlan()
2880 accept_flags = bnx2x_leading_vfq(vf, accept_flags); in bnx2x_set_vf_vlan()
2886 bnx2x_vf_prep_rx_mode(bp, LEADING_IDX, &rx_ramrod, vf, in bnx2x_set_vf_vlan()
2888 bnx2x_leading_vfq(vf, accept_flags) = accept_flags; in bnx2x_set_vf_vlan()
2912 q_params.q_obj = &bnx2x_leading_vfq(vf, sp_obj); in bnx2x_set_vf_vlan()
2954 vf->cfg_flags &= ~VF_CFG_VLAN; in bnx2x_set_vf_vlan()
2955 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()