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()
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()
210 if (vf->spoofchk) in bnx2x_vfop_qctor_prep()
219 rxq_p->cl_qzone_id = vfq_qzone_id(vf, q); in bnx2x_vfop_qctor_prep()
220 rxq_p->fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
221 rxq_p->rss_engine_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfop_qctor_prep()
229 setup_p->txq_params.tss_leading_cl_id = vf->leading_rss; in bnx2x_vfop_qctor_prep()
230 setup_p->txq_params.fw_sb_id = vf_igu_sb(vf, q->sb_idx); in bnx2x_vfop_qctor_prep()
235 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_create() argument
241 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_create()
245 q_params->q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_create()
268 bnx2x_vf_igu_ack_sb(bp, vf, vf_igu_sb(vf, bnx2x_vfq(vf, qid, sb_idx)), in bnx2x_vf_queue_create()
274 static int bnx2x_vf_queue_destroy(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_destroy() argument
283 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_queue_destroy()
287 q_params.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_destroy()
307 if (bnx2x_vfq(vf, qid, cxt)) { in bnx2x_vf_queue_destroy()
308 bnx2x_vfq(vf, qid, cxt)->ustorm_ag_context.cdu_usage = 0; in bnx2x_vf_queue_destroy()
309 bnx2x_vfq(vf, qid, cxt)->xstorm_ag_context.cdu_reserved = 0; in bnx2x_vf_queue_destroy()
318 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_set_igu_info() local
319 if (vf) { in bnx2x_vf_set_igu_info()
325 if (!vf_sb_count(vf)) in bnx2x_vf_set_igu_info()
326 vf->igu_base_id = igu_sb_id; in bnx2x_vf_set_igu_info()
328 ++vf_sb_count(vf); in bnx2x_vf_set_igu_info()
329 ++vf->sb_count; in bnx2x_vf_set_igu_info()
334 static int bnx2x_vf_vlan_mac_clear(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_vlan_mac_clear() argument
340 DP(BNX2X_MSG_IOV, "vf[%d] - deleting all %s\n", vf->abs_vfid, in bnx2x_vf_vlan_mac_clear()
348 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_mac_obj); in bnx2x_vf_vlan_mac_clear()
351 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_vlan_mac_clear()
353 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_vlan_mac_clear()
379 struct bnx2x_virtf *vf, int qid, in bnx2x_vf_mac_vlan_config() argument
387 vf->abs_vfid, filter->add ? "Adding" : "Deleting", in bnx2x_vf_mac_vlan_config()
394 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_mac_obj); in bnx2x_vf_mac_vlan_config()
399 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, vlan_obj); in bnx2x_vf_mac_vlan_config()
403 ramrod.vlan_mac_obj = &bnx2x_vfq(vf, qid, mac_obj); in bnx2x_vf_mac_vlan_config()
434 int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mac_vlan_config_list() argument
440 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mac_vlan_config_list()
442 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_vf_mac_vlan_config_list()
447 rc = bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
461 bnx2x_vf_mac_vlan_config(bp, vf, qid, in bnx2x_vf_mac_vlan_config_list()
473 int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid, in bnx2x_vf_queue_setup() argument
478 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_setup()
480 rc = bnx2x_vf_queue_create(bp, vf, qid, qctor); in bnx2x_vf_queue_setup()
489 BNX2X_ERR("QSETUP[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_setup()
493 static int bnx2x_vf_queue_flr(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_queue_flr() argument
498 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_flr()
502 bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_vf_queue_flr()
503 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
507 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
511 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, true, in bnx2x_vf_queue_flr()
518 if (bnx2x_vfq(vf, qid, sp_obj).state != BNX2X_Q_STATE_RESET) { in bnx2x_vf_queue_flr()
522 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_queue_flr()
533 BNX2X_ERR("vf[%d:%d] error: rc %d\n", vf->abs_vfid, qid, rc); in bnx2x_vf_queue_flr()
537 int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_mcast() argument
544 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_mcast()
548 mcast.mcast_obj = &vf->mcast_obj; in bnx2x_vf_mcast()
589 struct bnx2x_virtf *vf, in bnx2x_vf_prep_rx_mode() argument
592 struct bnx2x_vf_queue *vfq = vfq_get(vf, qid); in bnx2x_vf_prep_rx_mode()
596 ramrod->cl_id = vfq_cl_id(vf, vfq); in bnx2x_vf_prep_rx_mode()
598 ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_prep_rx_mode()
601 ramrod->pstate = &vf->filter_state; in bnx2x_vf_prep_rx_mode()
604 set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_prep_rx_mode()
608 ramrod->rdata = bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
609 ramrod->rdata_mapping = bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2); in bnx2x_vf_prep_rx_mode()
612 int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rxmode() argument
617 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rxmode()
619 bnx2x_vf_prep_rx_mode(bp, qid, &ramrod, vf, accept_flags); in bnx2x_vf_rxmode()
621 vfq_get(vf, qid)->accept_flags = ramrod.rx_accept_flags; in bnx2x_vf_rxmode()
625 int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid) in bnx2x_vf_queue_teardown() argument
629 DP(BNX2X_MSG_IOV, "vf[%d:%d]\n", vf->abs_vfid, qid); in bnx2x_vf_queue_teardown()
633 rc = bnx2x_vf_rxmode(bp, vf, qid, 0); in bnx2x_vf_queue_teardown()
638 if (bnx2x_validate_vf_sp_objs(bp, vf, true)) { in bnx2x_vf_queue_teardown()
639 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
644 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
649 rc = bnx2x_vf_vlan_mac_clear(bp, vf, qid, in bnx2x_vf_queue_teardown()
654 rc = bnx2x_vf_mcast(bp, vf, NULL, 0, false); in bnx2x_vf_queue_teardown()
661 rc = bnx2x_vf_queue_destroy(bp, vf, qid); in bnx2x_vf_queue_teardown()
667 vf->abs_vfid, qid, rc); in bnx2x_vf_queue_teardown()
715 static void bnx2x_vf_igu_reset(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_reset() argument
721 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_reset()
738 vf->abs_vfid, val); in bnx2x_vf_igu_reset()
743 for (i = 0; i < vf_sb_count(vf); i++) { in bnx2x_vf_igu_reset()
744 u8 igu_sb_id = vf_igu_sb(vf, i); in bnx2x_vf_igu_reset()
750 bnx2x_igu_clear_sb_gen(bp, vf->abs_vfid, igu_sb_id, in bnx2x_vf_igu_reset()
754 bnx2x_vf_igu_ack_sb(bp, vf, igu_sb_id, USTORM_ID, 0, in bnx2x_vf_igu_reset()
776 static void bnx2x_vf_enable_traffic(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_enable_traffic() argument
779 bnx2x_vf_igu_reset(bp, vf); in bnx2x_vf_enable_traffic()
782 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_enable_traffic()
790 struct bnx2x_virtf *vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_vf_is_pcie_pending() local
792 if (!vf) in bnx2x_vf_is_pcie_pending()
795 dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn); in bnx2x_vf_is_pcie_pending()
814 bnx2x_iov_static_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_iov_static_resc() argument
816 struct vf_pf_resc_request *resc = &vf->alloc_resc; in bnx2x_iov_static_resc()
829 resc->num_sbs = vf->sb_count; in bnx2x_iov_static_resc()
833 static void bnx2x_vf_free_resc(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free_resc() argument
836 bnx2x_iov_static_resc(bp, vf); in bnx2x_vf_free_resc()
837 vf->state = VF_FREE; in bnx2x_vf_free_resc()
840 static void bnx2x_vf_flr_clnup_hw(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr_clnup_hw() argument
845 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_flr_clnup_hw()
852 if (bnx2x_send_final_clnup(bp, (u8)FW_VF_HANDLE(vf->abs_vfid), in bnx2x_vf_flr_clnup_hw()
854 BNX2X_ERR("VF[%d] Final cleanup timed-out\n", vf->abs_vfid); in bnx2x_vf_flr_clnup_hw()
860 static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_flr() argument
864 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_flr()
869 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_flr()
870 rc = bnx2x_vf_queue_flr(bp, vf, i); in bnx2x_vf_flr()
876 bnx2x_vf_mcast(bp, vf, NULL, 0, true); in bnx2x_vf_flr()
879 bnx2x_vf_flr_clnup_hw(bp, vf); in bnx2x_vf_flr()
882 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_flr()
884 vf->malicious = false; in bnx2x_vf_flr()
887 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_vf_flr()
891 vf->abs_vfid, i, rc); in bnx2x_vf_flr()
896 struct bnx2x_virtf *vf; in bnx2x_vf_flr_clnup() local
908 vf = BP_VF(bp, i); in bnx2x_vf_flr_clnup()
911 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
914 bnx2x_vf_flr(bp, vf); in bnx2x_vf_flr_clnup()
917 vf->flr_clnup_stage = false; in bnx2x_vf_flr_clnup()
918 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_FLR); in bnx2x_vf_flr_clnup()
956 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_vf_handle_flr_event() local
959 if (vf->abs_vfid < 32) in bnx2x_vf_handle_flr_event()
960 reset = bp->vfdb->flrd_vfs[0] & (1 << vf->abs_vfid); in bnx2x_vf_handle_flr_event()
963 (1 << (vf->abs_vfid - 32)); in bnx2x_vf_handle_flr_event()
967 vf->state = VF_RESET; in bnx2x_vf_handle_flr_event()
968 vf->flr_clnup_stage = true; in bnx2x_vf_handle_flr_event()
972 vf->abs_vfid); in bnx2x_vf_handle_flr_event()
1048 static void bnx2x_vf_set_bars(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_set_bars() argument
1059 vf->bars[n].bar = start + size * vf->abs_vfid; in bnx2x_vf_set_bars()
1060 vf->bars[n].size = size; in bnx2x_vf_set_bars()
1401 static void bnx2x_vfq_init(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vfq_init() argument
1404 u8 cl_id = vfq_cl_id(vf, q); in bnx2x_vfq_init()
1405 u8 func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vfq_init()
1414 bnx2x_vf_sp(bp, vf, q_data), in bnx2x_vfq_init()
1415 bnx2x_vf_sp_map(bp, vf, q_data), in bnx2x_vfq_init()
1423 vf->abs_vfid, q->sp_obj.func_id, q->cid); in bnx2x_vfq_init()
1441 struct bnx2x_virtf *vf; in bnx2x_iov_link_update_vf() local
1446 rc = bnx2x_vf_op_prep(bp, idx, &vf, &bulletin, false); in bnx2x_iov_link_update_vf()
1452 if (vf->link_cfg == IFLA_VF_LINK_STATE_AUTO) { in bnx2x_iov_link_update_vf()
1469 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_DISABLE && in bnx2x_iov_link_update_vf()
1473 } else if (vf->link_cfg == IFLA_VF_LINK_STATE_ENABLE && in bnx2x_iov_link_update_vf()
1485 vf->link_cfg, bulletin->link_speed, bulletin->link_flags); in bnx2x_iov_link_update_vf()
1503 struct bnx2x_virtf *vf = BP_VF(bp, idx); in bnx2x_set_vf_link_state() local
1505 if (!vf) in bnx2x_set_vf_link_state()
1508 if (vf->link_cfg == link_state) in bnx2x_set_vf_link_state()
1511 vf->link_cfg = link_state; in bnx2x_set_vf_link_state()
1544 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1555 vf->abs_vfid, vf_sb_count(vf), base_vf_cid, in bnx2x_iov_nic_init()
1559 bnx2x_iov_static_resc(bp, vf); in bnx2x_iov_nic_init()
1562 vf->filter_state = 0; in bnx2x_iov_nic_init()
1563 vf->sp_cl_id = bnx2x_fp(bp, 0, cl_id); in bnx2x_iov_nic_init()
1565 bnx2x_init_credit_pool(&vf->vf_vlans_pool, 0, in bnx2x_iov_nic_init()
1566 vf_vlan_rules_cnt(vf)); in bnx2x_iov_nic_init()
1567 bnx2x_init_credit_pool(&vf->vf_macs_pool, 0, in bnx2x_iov_nic_init()
1568 vf_mac_rules_cnt(vf)); in bnx2x_iov_nic_init()
1575 bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF, in bnx2x_iov_nic_init()
1577 bnx2x_vf_sp(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1578 bnx2x_vf_sp_map(bp, vf, mcast_rdata), in bnx2x_iov_nic_init()
1580 &vf->filter_state, in bnx2x_iov_nic_init()
1592 bnx2x_vf_enable_mbx(bp, vf->abs_vfid); in bnx2x_iov_nic_init()
1597 struct bnx2x_virtf *vf = BP_VF(bp, vfid); in bnx2x_iov_nic_init() local
1600 vf->domain = bnx2x_vf_domain(bp, vfid); in bnx2x_iov_nic_init()
1601 vf->bus = bnx2x_vf_bus(bp, vfid); in bnx2x_iov_nic_init()
1602 vf->devfn = bnx2x_vf_devfn(bp, vfid); in bnx2x_iov_nic_init()
1603 bnx2x_vf_set_bars(bp, vf); in bnx2x_iov_nic_init()
1607 vf->abs_vfid, vf->bus, vf->devfn, in bnx2x_iov_nic_init()
1608 (unsigned)vf->bars[0].bar, vf->bars[0].size, in bnx2x_iov_nic_init()
1609 (unsigned)vf->bars[1].bar, vf->bars[1].size, in bnx2x_iov_nic_init()
1610 (unsigned)vf->bars[2].bar, vf->bars[2].size); in bnx2x_iov_nic_init()
1690 struct bnx2x_virtf *vf) in bnx2x_vf_handle_mcast_eqe() argument
1695 rparam.mcast_obj = &vf->mcast_obj; in bnx2x_vf_handle_mcast_eqe()
1696 vf->mcast_obj.raw.clear_pending(&vf->mcast_obj.raw); in bnx2x_vf_handle_mcast_eqe()
1699 if (vf->mcast_obj.check_pending(&vf->mcast_obj)) { in bnx2x_vf_handle_mcast_eqe()
1709 struct bnx2x_virtf *vf) in bnx2x_vf_handle_filters_eqe() argument
1712 clear_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); in bnx2x_vf_handle_filters_eqe()
1717 struct bnx2x_virtf *vf) in bnx2x_vf_handle_rss_update_eqe() argument
1719 vf->rss_conf_obj.raw.clear_pending(&vf->rss_conf_obj.raw); in bnx2x_vf_handle_rss_update_eqe()
1724 struct bnx2x_virtf *vf; in bnx2x_iov_eq_sp_event() local
1777 vf = bnx2x_vf_by_abs_fid(bp, abs_vfid); in bnx2x_iov_eq_sp_event()
1779 if (!vf) { in bnx2x_iov_eq_sp_event()
1788 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1789 vfq_get(vf, qidx)->sp_obj.complete_cmd(bp, in bnx2x_iov_eq_sp_event()
1790 &vfq_get(vf, in bnx2x_iov_eq_sp_event()
1796 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1797 bnx2x_vf_handle_classification_eqe(bp, vfq_get(vf, qidx), elem); in bnx2x_iov_eq_sp_event()
1801 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1802 bnx2x_vf_handle_mcast_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1806 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1807 bnx2x_vf_handle_filters_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1811 vf->abs_vfid, qidx); in bnx2x_iov_eq_sp_event()
1812 bnx2x_vf_handle_rss_update_eqe(bp, vf); in bnx2x_iov_eq_sp_event()
1818 vf->malicious = true; in bnx2x_iov_eq_sp_event()
1838 struct bnx2x_virtf *vf; in bnx2x_iov_set_queue_sp_obj() local
1843 vf = bnx2x_vf_by_cid(bp, vf_cid); in bnx2x_iov_set_queue_sp_obj()
1845 if (vf) { in bnx2x_iov_set_queue_sp_obj()
1851 *q_obj = &bnx2x_vfq(vf, q_index, sp_obj); in bnx2x_iov_set_queue_sp_obj()
1886 struct bnx2x_virtf *vf = BP_VF(bp, i); in bnx2x_iov_adjust_stats_req() local
1888 if (vf->state != VF_ENABLED) { in bnx2x_iov_adjust_stats_req()
1891 vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1895 if (vf->malicious) { in bnx2x_iov_adjust_stats_req()
1898 vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1903 "add addresses for vf %d\n", vf->abs_vfid); in bnx2x_iov_adjust_stats_req()
1904 for_each_vfq(vf, j) { in bnx2x_iov_adjust_stats_req()
1905 struct bnx2x_vf_queue *rxq = vfq_get(vf, j); in bnx2x_iov_adjust_stats_req()
1908 vf->fw_stat_map + j * vf->stats_stride; in bnx2x_iov_adjust_stats_req()
1917 cur_query_entry->index = vfq_stat_id(vf, rxq); in bnx2x_iov_adjust_stats_req()
1919 cpu_to_le16(FW_VF_HANDLE(vf->abs_vfid)); in bnx2x_iov_adjust_stats_req()
1934 if (vf->cfg_flags & VF_CFG_STATS_COALESCE) in bnx2x_iov_adjust_stats_req()
1951 static void bnx2x_vf_clr_qtbl(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_clr_qtbl() argument
1955 for_each_vfq(vf, i) in bnx2x_vf_clr_qtbl()
1956 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_clr_qtbl()
1957 vfq_qzone_id(vf, vfq_get(vf, i)), false); in bnx2x_vf_clr_qtbl()
1960 static void bnx2x_vf_igu_disable(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_igu_disable() argument
1965 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf->abs_vfid)); in bnx2x_vf_igu_disable()
1973 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_max_queue_cnt() argument
1975 return min_t(u8, min_t(u8, vf_sb_count(vf), BNX2X_CIDS_PER_VF), in bnx2x_vf_max_queue_cnt()
1980 int bnx2x_vf_chk_avail_resc(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_chk_avail_resc() argument
1983 u8 rxq_cnt = vf_rxq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
1984 u8 txq_cnt = vf_txq_count(vf) ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_chk_avail_resc()
1988 (req_resc->num_sbs <= vf_sb_count(vf)) && in bnx2x_vf_chk_avail_resc()
1989 (req_resc->num_mac_filters <= vf_mac_rules_cnt(vf)) && in bnx2x_vf_chk_avail_resc()
1990 (req_resc->num_vlan_filters <= vf_vlan_rules_cnt(vf))); in bnx2x_vf_chk_avail_resc()
1994 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_acquire() argument
1997 int base_vf_cid = (BP_VFDB(bp)->sriov.first_vf_in_pf + vf->index) * in bnx2x_vf_acquire()
2010 if (vf->state == VF_ACQUIRED) { in bnx2x_vf_acquire()
2012 vf->abs_vfid); in bnx2x_vf_acquire()
2014 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2016 vf->abs_vfid); in bnx2x_vf_acquire()
2023 if (vf->state != VF_FREE && vf->state != VF_RESET) { in bnx2x_vf_acquire()
2025 vf->abs_vfid, vf->state); in bnx2x_vf_acquire()
2033 if (!bnx2x_vf_chk_avail_resc(bp, vf, resc)) { in bnx2x_vf_acquire()
2041 vf_sb_count(vf) = resc->num_sbs; in bnx2x_vf_acquire()
2042 vf_rxq_count(vf) = resc->num_rxqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2043 vf_txq_count(vf) = resc->num_txqs ? : bnx2x_vf_max_queue_cnt(bp, vf); in bnx2x_vf_acquire()
2047 vf_sb_count(vf), vf_rxq_count(vf), in bnx2x_vf_acquire()
2048 vf_txq_count(vf), vf_mac_rules_cnt(vf), in bnx2x_vf_acquire()
2049 vf_vlan_rules_cnt(vf)); in bnx2x_vf_acquire()
2052 if (!vf->vfqs) { in bnx2x_vf_acquire()
2057 for_each_vfq(vf, i) { in bnx2x_vf_acquire()
2058 struct bnx2x_vf_queue *q = vfq_get(vf, i); in bnx2x_vf_acquire()
2070 vf->abs_vfid, i, q->index, q->cid, q->cxt); in bnx2x_vf_acquire()
2073 bnx2x_vfq_init(bp, vf, q); in bnx2x_vf_acquire()
2075 vf->state = VF_ACQUIRED; in bnx2x_vf_acquire()
2079 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf, dma_addr_t *sb_map) in bnx2x_vf_init() argument
2087 for_each_vf_sb(vf, i) in bnx2x_vf_init()
2088 bnx2x_init_sb(bp, (dma_addr_t)sb_map[i], vf->abs_vfid, true, in bnx2x_vf_init()
2089 vf_igu_sb(vf, i), vf_igu_sb(vf, i)); in bnx2x_vf_init()
2092 if (vf->state != VF_ACQUIRED) { in bnx2x_vf_init()
2094 vf->abs_vfid, vf->state); in bnx2x_vf_init()
2102 if (bnx2x_vf_flr_clnup_epilog(bp, vf->abs_vfid)) in bnx2x_vf_init()
2106 REG_WR(bp, IGU_REG_STATISTIC_NUM_MESSAGE_SENT + vf->abs_vfid * 4 , 0); in bnx2x_vf_init()
2110 func_init.func_id = FW_VF_HANDLE(vf->abs_vfid); in bnx2x_vf_init()
2114 bnx2x_vf_enable_access(bp, vf->abs_vfid); in bnx2x_vf_init()
2115 bnx2x_vf_enable_traffic(bp, vf); in bnx2x_vf_init()
2118 for_each_vfq(vf, i) in bnx2x_vf_init()
2119 bnx2x_vf_qtbl_set_q(bp, vf->abs_vfid, in bnx2x_vf_init()
2120 vfq_qzone_id(vf, vfq_get(vf, i)), true); in bnx2x_vf_init()
2122 vf->state = VF_ENABLED; in bnx2x_vf_init()
2125 bnx2x_post_vf_bulletin(bp, vf->index); in bnx2x_vf_init()
2131 struct bnx2x_virtf *vf; member
2139 p->vf->state = p->state; in bnx2x_set_vf_state()
2142 int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_close() argument
2146 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_close()
2149 for (i = 0; i < vf_rxq_count(vf); i++) { in bnx2x_vf_close()
2150 rc = bnx2x_vf_queue_teardown(bp, vf, i); in bnx2x_vf_close()
2157 bnx2x_vf_igu_disable(bp, vf); in bnx2x_vf_close()
2161 bnx2x_vf_clr_qtbl(bp, vf); in bnx2x_vf_close()
2170 cookie.vf = vf; in bnx2x_vf_close()
2181 BNX2X_ERR("vf[%d] CLOSE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_close()
2189 int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_free() argument
2193 DP(BNX2X_MSG_IOV, "VF[%d] STATE: %s\n", vf->abs_vfid, in bnx2x_vf_free()
2194 vf->state == VF_FREE ? "Free" : in bnx2x_vf_free()
2195 vf->state == VF_ACQUIRED ? "Acquired" : in bnx2x_vf_free()
2196 vf->state == VF_ENABLED ? "Enabled" : in bnx2x_vf_free()
2197 vf->state == VF_RESET ? "Reset" : in bnx2x_vf_free()
2200 switch (vf->state) { in bnx2x_vf_free()
2202 rc = bnx2x_vf_close(bp, vf); in bnx2x_vf_free()
2208 bnx2x_vf_free_resc(bp, vf); in bnx2x_vf_free()
2218 BNX2X_ERR("VF[%d] RELEASE error: rc %d\n", vf->abs_vfid, rc); in bnx2x_vf_free()
2222 int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_rss_update() argument
2225 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_rss_update()
2230 int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_vf_tpa_update() argument
2238 DP(BNX2X_MSG_IOV, "vf[%d]\n", vf->abs_vfid); in bnx2x_vf_tpa_update()
2247 for (qid = 0; qid < vf_rxq_count(vf); qid++) { in bnx2x_vf_tpa_update()
2248 qstate.q_obj = &bnx2x_vfq(vf, qid, sp_obj); in bnx2x_vf_tpa_update()
2251 vf->abs_vfid, qid, U64_HI(sge_addr[qid]), in bnx2x_vf_tpa_update()
2257 vf->abs_vfid, qid); in bnx2x_vf_tpa_update()
2269 int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf) in bnx2x_vf_release() argument
2273 DP(BNX2X_MSG_IOV, "PF releasing vf %d\n", vf->abs_vfid); in bnx2x_vf_release()
2274 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2276 rc = bnx2x_vf_free(bp, vf); in bnx2x_vf_release()
2280 vf->abs_vfid, rc); in bnx2x_vf_release()
2281 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF); in bnx2x_vf_release()
2285 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_lock_vf_pf_channel() argument
2295 mutex_lock(&vf->op_mutex); in bnx2x_lock_vf_pf_channel()
2298 vf->op_current = tlv; in bnx2x_lock_vf_pf_channel()
2302 vf->abs_vfid, tlv); in bnx2x_lock_vf_pf_channel()
2305 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_unlock_vf_pf_channel() argument
2310 if (!vf) { in bnx2x_unlock_vf_pf_channel()
2311 BNX2X_ERR("VF was %p\n", vf); in bnx2x_unlock_vf_pf_channel()
2315 current_tlv = vf->op_current; in bnx2x_unlock_vf_pf_channel()
2321 WARN(expected_tlv != vf->op_current, in bnx2x_unlock_vf_pf_channel()
2323 vf->op_current); in bnx2x_unlock_vf_pf_channel()
2326 vf->op_current = CHANNEL_TLV_NONE; in bnx2x_unlock_vf_pf_channel()
2329 mutex_unlock(&vf->op_mutex); in bnx2x_unlock_vf_pf_channel()
2333 vf->abs_vfid, current_tlv); in bnx2x_unlock_vf_pf_channel()
2451 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2453 vf->sb_count = 0; in bnx2x_enable_sriov()
2482 struct bnx2x_virtf *vf = BP_VF(bp, vf_idx); in bnx2x_enable_sriov() local
2485 vf->vfqs = &bp->vfdb->vfqs[qcount]; in bnx2x_enable_sriov()
2486 qcount += vf_sb_count(vf); in bnx2x_enable_sriov()
2487 bnx2x_iov_static_resc(bp, vf); in bnx2x_enable_sriov()
2548 struct bnx2x_virtf **vf, in bnx2x_vf_op_prep() argument
2569 *vf = BP_VF(bp, vfidx); in bnx2x_vf_op_prep()
2572 if (!*vf) { in bnx2x_vf_op_prep()
2577 if (test_queue && !(*vf)->vfqs) { in bnx2x_vf_op_prep()
2596 struct bnx2x_virtf *vf = NULL; in bnx2x_get_vf_config() local
2603 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_get_vf_config()
2607 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_get_vf_config()
2608 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_get_vf_config()
2614 ivi->vf = vfidx; in bnx2x_get_vf_config()
2618 ivi->spoofchk = vf->spoofchk ? 1 : 0; in bnx2x_get_vf_config()
2619 ivi->linkstate = vf->link_cfg; in bnx2x_get_vf_config()
2620 if (vf->state == VF_ENABLED) { in bnx2x_get_vf_config()
2622 if (bnx2x_validate_vf_sp_objs(bp, vf, false)) { in bnx2x_get_vf_config()
2674 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_mac() local
2683 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_mac()
2707 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)); in bnx2x_set_vf_mac()
2708 if (vf->state == VF_ENABLED && in bnx2x_set_vf_mac()
2715 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_mac()
2719 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2722 mac_obj = &bnx2x_leading_vfq(vf, mac_obj); in bnx2x_set_vf_mac()
2744 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_MAC); in bnx2x_set_vf_mac()
2751 struct bnx2x_virtf *vf, bool accept) in bnx2x_set_vf_vlan_acceptance() argument
2757 accept_flags = bnx2x_leading_vfq(vf, accept_flags); in bnx2x_set_vf_vlan_acceptance()
2763 bnx2x_vf_prep_rx_mode(bp, LEADING_IDX, &rx_ramrod, vf, in bnx2x_set_vf_vlan_acceptance()
2765 bnx2x_leading_vfq(vf, accept_flags) = accept_flags; in bnx2x_set_vf_vlan_acceptance()
2769 static int bnx2x_set_vf_vlan_filter(struct bnx2x *bp, struct bnx2x_virtf *vf, in bnx2x_set_vf_vlan_filter() argument
2779 ramrod_param.vlan_mac_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_set_vf_vlan_filter()
2801 struct bnx2x_virtf *vf = NULL; in bnx2x_set_vf_vlan() local
2816 rc = bnx2x_vf_op_prep(bp, vfidx, &vf, &bulletin, true); in bnx2x_set_vf_vlan()
2841 if (vf->state != VF_ENABLED || in bnx2x_set_vf_vlan()
2842 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) != in bnx2x_set_vf_vlan()
2847 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_vlan()
2851 bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()
2855 vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); in bnx2x_set_vf_vlan()
2867 if (vlan || !(vf->cfg_flags & VF_CFG_VLAN_FILTER)) in bnx2x_set_vf_vlan()
2868 bnx2x_set_vf_vlan_acceptance(bp, vf, !vlan); in bnx2x_set_vf_vlan()
2870 rc = bnx2x_set_vf_vlan_filter(bp, vf, vlan, true); in bnx2x_set_vf_vlan()
2877 for_each_vfq(vf, i) { in bnx2x_set_vf_vlan()
2881 q_params.q_obj = &bnx2x_vfq(vf, i, sp_obj); in bnx2x_set_vf_vlan()
2927 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); in bnx2x_set_vf_vlan()
2940 struct bnx2x_virtf *vf; in bnx2x_set_vf_spoofchk() local
2943 vf = BP_VF(bp, idx); in bnx2x_set_vf_spoofchk()
2944 if (!vf) in bnx2x_set_vf_spoofchk()
2948 if (vf->spoofchk == val) in bnx2x_set_vf_spoofchk()
2951 vf->spoofchk = val ? 1 : 0; in bnx2x_set_vf_spoofchk()
2957 if (vf->state != VF_ENABLED || in bnx2x_set_vf_spoofchk()
2958 bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) != in bnx2x_set_vf_spoofchk()
2963 if (!bnx2x_validate_vf_sp_objs(bp, vf, true)) in bnx2x_set_vf_spoofchk()
2967 for_each_vfq(vf, i) { in bnx2x_set_vf_spoofchk()
2971 q_params.q_obj = &bnx2x_vfq(vf, i, sp_obj); in bnx2x_set_vf_spoofchk()