Lines Matching refs:vf
30 struct bnx2x_virtf **vf,
78 static void bnx2x_vf_igu_ack_sb(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_igu_ack_sb() argument
86 u32 func_encode = vf->abs_vfid; in bnx2x_vf_igu_ack_sb()
114 struct bnx2x_virtf *vf, in bnx2x_validate_vf_sp_objs() argument
117 if (!bnx2x_leading_vfq(vf, sp_initialized)) { in bnx2x_validate_vf_sp_objs()
128 void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_dump_tx() argument
135 vf->abs_vfid, in bnx2x_vfop_qctor_dump_tx()
144 void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_dump_rx() argument
153 vf->abs_vfid, in bnx2x_vfop_qctor_dump_rx()
169 struct bnx2x_virtf *vf, in bnx2x_vfop_qctor_prep() argument
187 init_p->rx.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
188 init_p->tx.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
196 setup_p->gen_params.spcl_id = vf->sp_cl_id; in bnx2x_vfop_qctor_prep()
197 setup_p->gen_params.stat_id = vfq_stat_id(vf, q); in bnx2x_vfop_qctor_prep()
198 setup_p->gen_params.fp_hsi = vf->fp_hsi; in bnx2x_vfop_qctor_prep()
218 rxq_p->cl_qzone_id = vfq_qzone_id(vf, q); in bnx2x_vfop_qctor_prep()
219 rxq_p->fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
220 rxq_p->rss_engine_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfop_qctor_prep()
228 setup_p->txq_params.tss_leading_cl_id = vf->leading_rss; in bnx2x_vfop_qctor_prep()
229 setup_p->txq_params.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
234 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_create() argument
240 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_create()
244 q_params->q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_create()
267 bnx2x_vf_igu_ack_sb(bp, vf, vf_igu_sb(vf, bnx2x_vfq(vf, qid, sb_idx)), in bnx2x_vf_queue_create()
273 static int bnx2x_vf_queue_destroy(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_destroy() argument
282 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_queue_destroy()
286 q_params.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_destroy()
306 if (bnx2x_vfq(vf, qid, cxt)) { in bnx2x_vf_queue_destroy()
307 bnx2x_vfq(vf, qid, cxt)->ustorm_ag_context.cdu_usage = 0; in bnx2x_vf_queue_destroy()
308 bnx2x_vfq(vf, qid, cxt)->xstorm_ag_context.cdu_reserved = 0; in bnx2x_vf_queue_destroy()
317 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_set_igu_info() local
318 if (vf) { in bnx2x_vf_set_igu_info()
324 if (!vf_sb_count(vf)) in bnx2x_vf_set_igu_info()
325 vf->igu_base_id = igu_sb_id; in bnx2x_vf_set_igu_info()
327 ++vf_sb_count(vf); in bnx2x_vf_set_igu_info()
328 ++vf->sb_count; in bnx2x_vf_set_igu_info()
354 static int bnx2x_vf_vlan_mac_clear(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_vlan_mac_clear() argument
360 DP(BNX2X_MSG_IOV, "vf[%d] - deleting all %s\n", vf->abs_vfid, in bnx2x_vf_vlan_mac_clear()
368 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_mac_obj); in bnx2x_vf_vlan_mac_clear()
371 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_vlan_mac_clear()
373 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_vlan_mac_clear()
399 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_mac_vlan_config() argument
407 vf->abs_vfid, filter->add ? "Adding" : "Deleting", in bnx2x_vf_mac_vlan_config()
414 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_mac_obj); in bnx2x_vf_mac_vlan_config()
419 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_mac_vlan_config()
423 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_mac_vlan_config()
454 int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mac_vlan_config_list() argument
460 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mac_vlan_config_list()
462 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_vf_mac_vlan_config_list()
467 rc = bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
481 bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
493 int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_setup() argument
498 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_setup()
500 rc = bnx2x_vf_queue_create(bp, vf, qid, qctor); in bnx2x_vf_queue_setup()
509 BNX2X_ERR("QSETUP[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_setup()
513 static int bnx2x_vf_queue_flr(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_flr() argument
518 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_flr()
522 bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_vf_queue_flr()
523 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
527 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
531 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
538 if (bnx2x_vfq(vf, qid, sp_obj).state != BNX2X_Q_STATE_RESET) { in bnx2x_vf_queue_flr()
542 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_flr()
553 BNX2X_ERR("vf[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_flr()
557 int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mcast() argument
564 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mcast()
568 mcast.mcast_obj = &vf->mcast_obj; in bnx2x_vf_mcast()
609 struct bnx2x_virtf *vf, in bnx2x_vf_prep_rx_mode() argument
612 struct bnx2x_vf_queue *vfq = vfq_get(vf, qid); in bnx2x_vf_prep_rx_mode()
616 ramrod->cl_id = vfq_cl_id(vf, vfq); in bnx2x_vf_prep_rx_mode()
618 ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_prep_rx_mode()
621 ramrod->pstate = &vf->filter_state; in bnx2x_vf_prep_rx_mode()
624 set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_prep_rx_mode()
628 ramrod->rdata = bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
629 ramrod->rdata_mapping = bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
632 int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rxmode() argument
637 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rxmode()
639 bnx2x_vf_prep_rx_mode(bp, qid, &ramrod, vf, accept_flags); in bnx2x_vf_rxmode()
641 vfq_get(vf, qid)->accept_flags = ramrod.rx_accept_flags; in bnx2x_vf_rxmode()
645 int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid) in bnx2x_vf_queue_teardown() argument
649 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_teardown()
653 rc = bnx2x_vf_rxmode(bp, vf, qid, 0); in bnx2x_vf_queue_teardown()
658 if (bnx2x_validate_vf_sp_objs(bp, vf, true)) { in bnx2x_vf_queue_teardown()
659 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
664 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
669 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
674 rc = bnx2x_vf_mcast(bp, vf, NULL, 0, false); in bnx2x_vf_queue_teardown()
681 rc = bnx2x_vf_queue_destroy(bp, vf, qid); in bnx2x_vf_queue_teardown()
687 vf->abs_vfid, qid, rc); in bnx2x_vf_queue_teardown()
735 static void bnx2x_vf_igu_reset(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_reset() argument
741 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_reset()
758 vf->abs_vfid, val); in bnx2x_vf_igu_reset()
763 for (i = 0; i < vf_sb_count(vf); i++) { in bnx2x_vf_igu_reset()
764 u8 igu_sb_id = vf_igu_sb(vf, i); in bnx2x_vf_igu_reset()
770 bnx2x_igu_clear_sb_gen(bp, vf->abs_vfid, igu_sb_id, in bnx2x_vf_igu_reset()
774 bnx2x_vf_igu_ack_sb(bp, vf, igu_sb_id, USTORM_ID, 0, in bnx2x_vf_igu_reset()
796 static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_enable_traffic() argument
799 bnx2x_vf_igu_reset(bp, vf); in bnx2x_vf_enable_traffic()
802 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_enable_traffic()
810 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_is_pcie_pending() local
812 if (!vf) in bnx2x_vf_is_pcie_pending()
815 dev = pci_get_bus_and_slot(vf->bus, vf->devfn); in bnx2x_vf_is_pcie_pending()
834 bnx2x_iov_static_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_iov_static_resc() argument
836 struct vf_pf_resc_request *resc = &vf->alloc_resc; in bnx2x_iov_static_resc()
849 resc->num_sbs = vf->sb_count; in bnx2x_iov_static_resc()
853 static void bnx2x_vf_free_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free_resc() argument
856 bnx2x_iov_static_resc(bp, vf); in bnx2x_vf_free_resc()
857 vf->state = VF_FREE; in bnx2x_vf_free_resc()
860 static void bnx2x_vf_flr_clnup_hw(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr_clnup_hw() argument
865 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_flr_clnup_hw()
872 if (bnx2x_send_final_clnup(bp, (u8)FW_VF_HANDLE(vf->abs_vfid), in bnx2x_vf_flr_clnup_hw()
874 BNX2X_ERR("VF[%d] Final cleanup timed-out\n", vf->abs_vfid); in bnx2x_vf_flr_clnup_hw()
880 static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr() argument
884 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_flr()
889 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_flr()
890 rc = bnx2x_vf_queue_flr(bp, vf, i); in bnx2x_vf_flr()
896 bnx2x_vf_mcast(bp, vf, NULL, 0, true); in bnx2x_vf_flr()
899 bnx2x_vf_flr_clnup_hw(bp, vf); in bnx2x_vf_flr()
902 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_flr()
905 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_vf_flr()
909 vf->abs_vfid, i, rc); in bnx2x_vf_flr()
914 struct bnx2x_virtf *vf; in bnx2x_vf_flr_clnup() local
926 vf = BP_VF(bp, i); in bnx2x_vf_flr_clnup()
929 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
932 bnx2x_vf_flr(bp, vf); in bnx2x_vf_flr_clnup()
935 vf->flr_clnup_stage = false; in bnx2x_vf_flr_clnup()
936 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
974 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_vf_handle_flr_event() local
977 if (vf->abs_vfid < 32) in bnx2x_vf_handle_flr_event()
978 reset = bp->vfdb->flrd_vfs[0] & (1 << vf->abs_vfid); in bnx2x_vf_handle_flr_event()
981 (1 << (vf->abs_vfid - 32)); in bnx2x_vf_handle_flr_event()
985 vf->state = VF_RESET; in bnx2x_vf_handle_flr_event()
986 vf->flr_clnup_stage = true; in bnx2x_vf_handle_flr_event()
990 vf->abs_vfid); in bnx2x_vf_handle_flr_event()
1059 static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_set_bars() argument
1070 vf->bars[n].bar = start + size * vf->abs_vfid; in bnx2x_vf_set_bars()
1071 vf->bars[n].size = size; in bnx2x_vf_set_bars()
1413 static void bnx2x_vfq_init(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfq_init() argument
1416 u8 cl_id = vfq_cl_id(vf, q); in bnx2x_vfq_init()
1417 u8 func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfq_init()
1426 bnx2x_vf_sp(bp, vf, q_data), in bnx2x_vfq_init()
1427 bnx2x_vf_sp_map(bp, vf, q_data), in bnx2x_vfq_init()
1435 vf->abs_vfid, q->sp_obj.func_id, q->cid); in bnx2x_vfq_init()
1453 struct bnx2x_virtf *vf; in bnx2x_iov_link_update_vf() local
1458 rc = bnx2x_vf_op_prep(bp, idx, &vf, &bulletin, false); in bnx2x_iov_link_update_vf()
1464 if (vf->link_cfg == IFLA_VF_LINK_STATE_AUTO) { in bnx2x_iov_link_update_vf()
1481 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_DISABLE && in bnx2x_iov_link_update_vf()
1485 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_ENABLE && in bnx2x_iov_link_update_vf()
1497 vf->link_cfg, bulletin->link_speed, bulletin->link_flags); in bnx2x_iov_link_update_vf()
1515 struct bnx2x_virtf *vf = BP_VF(bp, idx); in bnx2x_set_vf_link_state() local
1517 if (!vf) in bnx2x_set_vf_link_state()
1520 if (vf->link_cfg == link_state) in bnx2x_set_vf_link_state()
1523 vf->link_cfg = link_state; in bnx2x_set_vf_link_state()
1556 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1567 vf->abs_vfid, vf_sb_count(vf), base_vf_cid, in bnx2x_iov_nic_init()
1571 bnx2x_iov_static_resc(bp, vf); in bnx2x_iov_nic_init()
1574 vf->filter_state = 0; in bnx2x_iov_nic_init()
1575 vf->sp_cl_id = bnx2x_fp(bp, 0, cl_id); in bnx2x_iov_nic_init()
1577 bnx2x_init_credit_pool(&vf->vf_vlans_pool, 0, in bnx2x_iov_nic_init()
1578 vf_vlan_rules_cnt(vf)); in bnx2x_iov_nic_init()
1579 bnx2x_init_credit_pool(&vf->vf_macs_pool, 0, in bnx2x_iov_nic_init()
1580 vf_mac_rules_cnt(vf)); in bnx2x_iov_nic_init()
1587 bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF, in bnx2x_iov_nic_init()
1589 bnx2x_vf_sp(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1590 bnx2x_vf_sp_map(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1592 &vf->filter_state, in bnx2x_iov_nic_init()
1604 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_iov_nic_init()
1609 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1612 vf->bus = bnx2x_vf_bus(bp, vfid); in bnx2x_iov_nic_init()
1613 vf->devfn = bnx2x_vf_devfn(bp, vfid); in bnx2x_iov_nic_init()
1614 bnx2x_vf_set_bars(bp, vf); in bnx2x_iov_nic_init()
1618 vf->abs_vfid, vf->bus, vf->devfn, in bnx2x_iov_nic_init()
1619 (unsigned)vf->bars[0].bar, vf->bars[0].size, in bnx2x_iov_nic_init()
1620 (unsigned)vf->bars[1].bar, vf->bars[1].size, in bnx2x_iov_nic_init()
1621 (unsigned)vf->bars[2].bar, vf->bars[2].size); in bnx2x_iov_nic_init()
1701 struct bnx2x_virtf *vf) in bnx2x_vf_handle_mcast_eqe() argument
1706 rparam.mcast_obj = &vf->mcast_obj; in bnx2x_vf_handle_mcast_eqe()
1707 vf->mcast_obj.raw.clear_pending(&vf->mcast_obj.raw); in bnx2x_vf_handle_mcast_eqe()
1710 if (vf->mcast_obj.check_pending(&vf->mcast_obj)) { in bnx2x_vf_handle_mcast_eqe()
1720 struct bnx2x_virtf *vf) in bnx2x_vf_handle_filters_eqe() argument
1723 clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_handle_filters_eqe()
1728 struct bnx2x_virtf *vf) in bnx2x_vf_handle_rss_update_eqe() argument
1730 vf->rss_conf_obj.raw.clear_pending(&vf->rss_conf_obj.raw); in bnx2x_vf_handle_rss_update_eqe()
1735 struct bnx2x_virtf *vf; in bnx2x_iov_eq_sp_event() local
1788 vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_iov_eq_sp_event()
1790 if (!vf) { in bnx2x_iov_eq_sp_event()
1799 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1800 vfq_get(vf, qidx)->sp_obj.complete_cmd(bp, in bnx2x_iov_eq_sp_event()
1801 &vfq_get(vf, in bnx2x_iov_eq_sp_event()
1807 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1808 bnx2x_vf_handle_classification_eqe(bp, vfq_get(vf, qidx), elem); in bnx2x_iov_eq_sp_event()
1812 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1813 bnx2x_vf_handle_mcast_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1817 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1818 bnx2x_vf_handle_filters_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1822 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1823 bnx2x_vf_handle_rss_update_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1846 struct bnx2x_virtf *vf; in bnx2x_iov_set_queue_sp_obj() local
1851 vf = bnx2x_vf_by_cid(bp, vf_cid); in bnx2x_iov_set_queue_sp_obj()
1853 if (vf) { in bnx2x_iov_set_queue_sp_obj()
1859 *q_obj = &bnx2x_vfq(vf, q_index, sp_obj); in bnx2x_iov_set_queue_sp_obj()
1899 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_iov_adjust_stats_req() local
1901 if (vf->state != VF_ENABLED) { in bnx2x_iov_adjust_stats_req()
1904 vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1908 DP(BNX2X_MSG_IOV, "add addresses for vf %d\n", vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1909 for_each_vfq(vf, j) { in bnx2x_iov_adjust_stats_req()
1910 struct bnx2x_vf_queue *rxq = vfq_get(vf, j); in bnx2x_iov_adjust_stats_req()
1913 vf->fw_stat_map + j * vf->stats_stride; in bnx2x_iov_adjust_stats_req()
1922 cur_query_entry->index = vfq_stat_id(vf, rxq); in bnx2x_iov_adjust_stats_req()
1924 cpu_to_le16(FW_VF_HANDLE(vf->abs_vfid)); in bnx2x_iov_adjust_stats_req()
1939 if (vf->cfg_flags & VF_CFG_STATS_COALESCE) in bnx2x_iov_adjust_stats_req()
1956 static void bnx2x_vf_clr_qtbl(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_clr_qtbl() argument
1960 for_each_vfq(vf, i) in bnx2x_vf_clr_qtbl()
1961 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_clr_qtbl()
1962 vfq_qzone_id(vf, vfq_get(vf, i)), false); in bnx2x_vf_clr_qtbl()
1965 static void bnx2x_vf_igu_disable(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_disable() argument
1970 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_disable()
1978 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_max_queue_cnt() argument
1980 return min_t(u8, min_t(u8, vf_sb_count(vf), BNX2X_CIDS_PER_VF), in bnx2x_vf_max_queue_cnt()
1985 int bnx2x_vf_chk_avail_resc(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_chk_avail_resc() argument
1988 u8 rxq_cnt = vf_rxq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
1989 u8 txq_cnt = vf_txq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
1993 (req_resc->num_sbs <= vf_sb_count(vf)) && in bnx2x_vf_chk_avail_resc()
1994 (req_resc->num_mac_filters <= vf_mac_rules_cnt(vf)) && in bnx2x_vf_chk_avail_resc()
1995 (req_resc->num_vlan_filters <= vf_vlan_rules_cnt(vf))); in bnx2x_vf_chk_avail_resc()
1999 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_acquire() argument
2002 int base_vf_cid = (BP_VFDB(bp)->sriov.first_vf_in_pf + vf->index) * in bnx2x_vf_acquire()
2015 if (vf->state == VF_ACQUIRED) { in bnx2x_vf_acquire()
2017 vf->abs_vfid); in bnx2x_vf_acquire()
2019 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2021 vf->abs_vfid); in bnx2x_vf_acquire()
2028 if (vf->state != VF_FREE && vf->state != VF_RESET) { in bnx2x_vf_acquire()
2030 vf->abs_vfid, vf->state); in bnx2x_vf_acquire()
2038 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2046 vf_sb_count(vf) = resc->num_sbs; in bnx2x_vf_acquire()
2047 vf_rxq_count(vf) = resc->num_rxqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2048 vf_txq_count(vf) = resc->num_txqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2052 vf_sb_count(vf), vf_rxq_count(vf), in bnx2x_vf_acquire()
2053 vf_txq_count(vf), vf_mac_rules_cnt(vf), in bnx2x_vf_acquire()
2054 vf_vlan_rules_cnt(vf)); in bnx2x_vf_acquire()
2057 if (!vf->vfqs) { in bnx2x_vf_acquire()
2062 for_each_vfq(vf, i) { in bnx2x_vf_acquire()
2063 struct bnx2x_vf_queue *q = vfq_get(vf, i); in bnx2x_vf_acquire()
2075 vf->abs_vfid, i, q->index, q->cid, q->cxt); in bnx2x_vf_acquire()
2078 bnx2x_vfq_init(bp, vf, q); in bnx2x_vf_acquire()
2080 vf->state = VF_ACQUIRED; in bnx2x_vf_acquire()
2084 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map) in bnx2x_vf_init() argument
2092 for_each_vf_sb(vf, i) in bnx2x_vf_init()
2093 bnx2x_init_sb(bp, (dma_addr_t)sb_map[i], vf->abs_vfid, true, in bnx2x_vf_init()
2094 vf_igu_sb(vf, i), vf_igu_sb(vf, i)); in bnx2x_vf_init()
2097 if (vf->state != VF_ACQUIRED) { in bnx2x_vf_init()
2099 vf->abs_vfid, vf->state); in bnx2x_vf_init()
2107 if (bnx2x_vf_flr_clnup_epilog(bp, vf->abs_vfid)) in bnx2x_vf_init()
2111 REG_WR(bp, IGU_REG_STATISTIC_NUM_MESSAGE_SENT + vf->abs_vfid * 4 , 0); in bnx2x_vf_init()
2115 func_init.func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_init()
2119 bnx2x_vf_enable_access(bp, vf->abs_vfid); in bnx2x_vf_init()
2120 bnx2x_vf_enable_traffic(bp, vf); in bnx2x_vf_init()
2123 for_each_vfq(vf, i) in bnx2x_vf_init()
2124 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_init()
2125 vfq_qzone_id(vf, vfq_get(vf, i)), true); in bnx2x_vf_init()
2127 vf->state = VF_ENABLED; in bnx2x_vf_init()
2130 bnx2x_post_vf_bulletin(bp, vf->index); in bnx2x_vf_init()
2136 struct bnx2x_virtf *vf; member
2144 p->vf->state = p->state; in bnx2x_set_vf_state()
2147 int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_close() argument
2151 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_close()
2154 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_close()
2155 rc = bnx2x_vf_queue_teardown(bp, vf, i); in bnx2x_vf_close()
2162 bnx2x_vf_igu_disable(bp, vf); in bnx2x_vf_close()
2166 bnx2x_vf_clr_qtbl(bp, vf); in bnx2x_vf_close()
2175 cookie.vf = vf; in bnx2x_vf_close()
2186 BNX2X_ERR("vf[%d] CLOSE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_close()
2194 int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free() argument
2198 DP(BNX2X_MSG_IOV, "VF[%d] STATE: %s\n", vf->abs_vfid, in bnx2x_vf_free()
2199 vf->state == VF_FREE ? "Free" : in bnx2x_vf_free()
2200 vf->state == VF_ACQUIRED ? "Acquired" : in bnx2x_vf_free()
2201 vf->state == VF_ENABLED ? "Enabled" : in bnx2x_vf_free()
2202 vf->state == VF_RESET ? "Reset" : in bnx2x_vf_free()
2205 switch (vf->state) { in bnx2x_vf_free()
2207 rc = bnx2x_vf_close(bp, vf); in bnx2x_vf_free()
2213 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_free()
2223 BNX2X_ERR("VF[%d] RELEASE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_free()
2227 int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rss_update() argument
2230 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rss_update()
2235 int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_tpa_update() argument
2243 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_tpa_update()
2252 for (qid = 0; qid < vf_rxq_count(vf); qid++) { in bnx2x_vf_tpa_update()
2253 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_tpa_update()
2256 vf->abs_vfid, qid, U64_HI(sge_addr[qid]), in bnx2x_vf_tpa_update()
2262 vf->abs_vfid, qid); in bnx2x_vf_tpa_update()
2274 int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_release() argument
2278 DP(BNX2X_MSG_IOV, "PF releasing vf %d\n", vf->abs_vfid); in bnx2x_vf_release()
2279 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2281 rc = bnx2x_vf_free(bp, vf); in bnx2x_vf_release()
2285 vf->abs_vfid, rc); in bnx2x_vf_release()
2286 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2290 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_lock_vf_pf_channel() argument
2300 mutex_lock(&vf->op_mutex); in bnx2x_lock_vf_pf_channel()
2303 vf->op_current = tlv; in bnx2x_lock_vf_pf_channel()
2307 vf->abs_vfid, tlv); in bnx2x_lock_vf_pf_channel()
2310 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_unlock_vf_pf_channel() argument
2315 if (!vf) { in bnx2x_unlock_vf_pf_channel()
2316 BNX2X_ERR("VF was %p\n", vf); in bnx2x_unlock_vf_pf_channel()
2320 current_tlv = vf->op_current; in bnx2x_unlock_vf_pf_channel()
2326 WARN(expected_tlv != vf->op_current, in bnx2x_unlock_vf_pf_channel()
2328 vf->op_current); in bnx2x_unlock_vf_pf_channel()
2331 vf->op_current = CHANNEL_TLV_NONE; in bnx2x_unlock_vf_pf_channel()
2334 mutex_unlock(&vf->op_mutex); in bnx2x_unlock_vf_pf_channel()
2338 vf->abs_vfid, current_tlv); in bnx2x_unlock_vf_pf_channel()
2450 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2452 vf->sb_count = 0; in bnx2x_enable_sriov()
2481 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2484 vf->vfqs = &bp->vfdb->vfqs[qcount]; in bnx2x_enable_sriov()
2485 qcount += vf_sb_count(vf); in bnx2x_enable_sriov()
2486 bnx2x_iov_static_resc(bp, vf); in bnx2x_enable_sriov()
2547 struct bnx2x_virtf **vf, in bnx2x_vf_op_prep() argument
2568 *vf = BP_VF(bp, vfidx); in bnx2x_vf_op_prep()
2571 if (!*vf) { in bnx2x_vf_op_prep()
2576 if (test_queue && !(*vf)->vfqs) { in bnx2x_vf_op_prep()
2595 struct bnx2x_virtf *vf = NULL; in bnx2x_get_vf_config() local
2602 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_get_vf_config()
2606 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_get_vf_config()
2607 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_get_vf_config()
2613 ivi->vf = vfidx; in bnx2x_get_vf_config()
2618 if (vf->state == VF_ENABLED) { in bnx2x_get_vf_config()
2620 if (bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_get_vf_config()
2672 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_mac() local
2681 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_mac()
2705 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)); in bnx2x_set_vf_mac()
2706 if (vf->state == VF_ENABLED && in bnx2x_set_vf_mac()
2713 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_mac()
2717 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2720 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_set_vf_mac()
2742 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2749 struct bnx2x_virtf *vf, bool accept) in bnx2x_set_vf_vlan_acceptance() argument
2755 accept_flags = bnx2x_leading_vfq(vf, accept_flags); in bnx2x_set_vf_vlan_acceptance()
2761 bnx2x_vf_prep_rx_mode(bp, LEADING_IDX, &rx_ramrod, vf, in bnx2x_set_vf_vlan_acceptance()
2763 bnx2x_leading_vfq(vf, accept_flags) = accept_flags; in bnx2x_set_vf_vlan_acceptance()
2767 static int bnx2x_set_vf_vlan_filter(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_set_vf_vlan_filter() argument
2777 ramrod_param.vlan_mac_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_set_vf_vlan_filter()
2799 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_vlan() local
2814 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_vlan()
2839 if (vf->state != VF_ENABLED || in bnx2x_set_vf_vlan()
2840 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) != in bnx2x_set_vf_vlan()
2845 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_vlan()
2849 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()
2853 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_set_vf_vlan()
2865 if (vlan || !(vf->cfg_flags & VF_CFG_VLAN_FILTER)) in bnx2x_set_vf_vlan()
2866 bnx2x_set_vf_vlan_acceptance(bp, vf, !vlan); in bnx2x_set_vf_vlan()
2868 rc = bnx2x_set_vf_vlan_filter(bp, vf, vlan, true); in bnx2x_set_vf_vlan()
2875 for_each_vfq(vf, i) { in bnx2x_set_vf_vlan()
2879 q_params.q_obj = &bnx2x_vfq(vf, i, sp_obj); in bnx2x_set_vf_vlan()
2925 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()