Lines Matching refs:cdev
80 static bool qed_db_rec_sanity(struct qed_dev *cdev, in qed_db_rec_sanity() argument
88 if (db_addr < cdev->doorbells || in qed_db_rec_sanity()
90 (u8 __iomem *)cdev->doorbells + cdev->db_size) { in qed_db_rec_sanity()
94 cdev->doorbells, in qed_db_rec_sanity()
95 (u8 __iomem *)cdev->doorbells + cdev->db_size); in qed_db_rec_sanity()
109 static struct qed_hwfn *qed_db_rec_find_hwfn(struct qed_dev *cdev, in qed_db_rec_find_hwfn() argument
115 if (cdev->num_hwfns > 1) in qed_db_rec_find_hwfn()
116 p_hwfn = db_addr < cdev->hwfns[1].doorbells ? in qed_db_rec_find_hwfn()
117 &cdev->hwfns[0] : &cdev->hwfns[1]; in qed_db_rec_find_hwfn()
119 p_hwfn = QED_LEADING_HWFN(cdev); in qed_db_rec_find_hwfn()
125 int qed_db_recovery_add(struct qed_dev *cdev, in qed_db_recovery_add() argument
135 if (IS_VF(cdev)) { in qed_db_recovery_add()
136 DP_VERBOSE(cdev, in qed_db_recovery_add()
142 if (!qed_db_rec_sanity(cdev, db_addr, db_width, db_data)) in qed_db_recovery_add()
146 p_hwfn = qed_db_rec_find_hwfn(cdev, db_addr); in qed_db_recovery_add()
151 DP_NOTICE(cdev, "Failed to allocate a db recovery entry\n"); in qed_db_recovery_add()
174 int qed_db_recovery_del(struct qed_dev *cdev, in qed_db_recovery_del() argument
182 if (IS_VF(cdev)) { in qed_db_recovery_del()
183 DP_VERBOSE(cdev, in qed_db_recovery_del()
189 p_hwfn = qed_db_rec_find_hwfn(cdev, db_addr); in qed_db_recovery_del()
223 if (!p_hwfn->cdev->db_size) { in qed_db_recovery_setup()
224 DP_ERR(p_hwfn->cdev, "db_size not set\n"); in qed_db_recovery_setup()
276 if (!qed_db_rec_sanity(p_hwfn->cdev, db_entry->db_addr, in qed_db_recovery_ring()
364 static void qed_llh_free(struct qed_dev *cdev) in qed_llh_free() argument
366 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_free()
378 cdev->p_llh_info = NULL; in qed_llh_free()
381 static int qed_llh_alloc(struct qed_dev *cdev) in qed_llh_alloc() argument
389 cdev->p_llh_info = p_llh_info; in qed_llh_alloc()
392 if (!(cdev->ppfid_bitmap & (0x1 << i))) in qed_llh_alloc()
396 DP_VERBOSE(cdev, QED_MSG_SP, "ppfid_array[%d] = %u\n", in qed_llh_alloc()
417 static int qed_llh_shadow_sanity(struct qed_dev *cdev, in qed_llh_shadow_sanity() argument
420 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_shadow_sanity()
423 DP_NOTICE(cdev, in qed_llh_shadow_sanity()
430 DP_NOTICE(cdev, in qed_llh_shadow_sanity()
442 qed_llh_shadow_search_filter(struct qed_dev *cdev, in qed_llh_shadow_search_filter() argument
446 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_shadow_search_filter()
451 rc = qed_llh_shadow_sanity(cdev, ppfid, 0, "search"); in qed_llh_shadow_search_filter()
470 qed_llh_shadow_get_free_idx(struct qed_dev *cdev, u8 ppfid, u8 *p_filter_idx) in qed_llh_shadow_get_free_idx() argument
472 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_shadow_get_free_idx()
477 rc = qed_llh_shadow_sanity(cdev, ppfid, 0, "get_free_idx"); in qed_llh_shadow_get_free_idx()
495 __qed_llh_shadow_add_filter(struct qed_dev *cdev, in __qed_llh_shadow_add_filter() argument
501 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in __qed_llh_shadow_add_filter()
505 rc = qed_llh_shadow_sanity(cdev, ppfid, filter_idx, "add"); in __qed_llh_shadow_add_filter()
523 qed_llh_shadow_add_filter(struct qed_dev *cdev, in qed_llh_shadow_add_filter() argument
532 rc = qed_llh_shadow_search_filter(cdev, ppfid, p_filter, p_filter_idx); in qed_llh_shadow_add_filter()
538 rc = qed_llh_shadow_get_free_idx(cdev, ppfid, p_filter_idx); in qed_llh_shadow_add_filter()
545 DP_NOTICE(cdev, in qed_llh_shadow_add_filter()
551 return __qed_llh_shadow_add_filter(cdev, ppfid, *p_filter_idx, type, in qed_llh_shadow_add_filter()
556 __qed_llh_shadow_remove_filter(struct qed_dev *cdev, in __qed_llh_shadow_remove_filter() argument
559 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in __qed_llh_shadow_remove_filter()
563 rc = qed_llh_shadow_sanity(cdev, ppfid, filter_idx, "remove"); in __qed_llh_shadow_remove_filter()
569 DP_NOTICE(cdev, in __qed_llh_shadow_remove_filter()
583 qed_llh_shadow_remove_filter(struct qed_dev *cdev, in qed_llh_shadow_remove_filter() argument
590 rc = qed_llh_shadow_search_filter(cdev, ppfid, p_filter, p_filter_idx); in qed_llh_shadow_remove_filter()
596 DP_NOTICE(cdev, "Failed to find a filter in the LLH shadow\n"); in qed_llh_shadow_remove_filter()
600 return __qed_llh_shadow_remove_filter(cdev, ppfid, *p_filter_idx, in qed_llh_shadow_remove_filter()
604 static int qed_llh_abs_ppfid(struct qed_dev *cdev, u8 ppfid, u8 *p_abs_ppfid) in qed_llh_abs_ppfid() argument
606 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_abs_ppfid()
609 DP_NOTICE(cdev, in qed_llh_abs_ppfid()
624 struct qed_dev *cdev = p_hwfn->cdev; in qed_llh_set_engine_affin() local
638 eng = cdev->fir_affin ? QED_ENG1 : QED_ENG0; in qed_llh_set_engine_affin()
639 rc = qed_llh_set_roce_affinity(cdev, eng); in qed_llh_set_engine_affin()
641 DP_NOTICE(cdev, in qed_llh_set_engine_affin()
646 DP_VERBOSE(cdev, in qed_llh_set_engine_affin()
655 eng = cdev->fir_affin ? QED_ENG1 : QED_ENG0; in qed_llh_set_engine_affin()
659 for (ppfid = 0; ppfid < cdev->p_llh_info->num_ppfid; ppfid++) { in qed_llh_set_engine_affin()
660 rc = qed_llh_set_ppfid_affinity(cdev, ppfid, eng); in qed_llh_set_engine_affin()
662 DP_NOTICE(cdev, in qed_llh_set_engine_affin()
669 DP_VERBOSE(cdev, QED_MSG_SP, in qed_llh_set_engine_affin()
679 struct qed_dev *cdev = p_hwfn->cdev; in qed_llh_hw_init_pf() local
683 for (ppfid = 0; ppfid < cdev->p_llh_info->num_ppfid; ppfid++) { in qed_llh_hw_init_pf()
686 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_hw_init_pf()
694 if (test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits) && in qed_llh_hw_init_pf()
696 rc = qed_llh_add_mac_filter(cdev, 0, in qed_llh_hw_init_pf()
699 DP_NOTICE(cdev, in qed_llh_hw_init_pf()
703 if (QED_IS_CMT(cdev)) { in qed_llh_hw_init_pf()
712 u8 qed_llh_get_num_ppfid(struct qed_dev *cdev) in qed_llh_get_num_ppfid() argument
714 return cdev->p_llh_info->num_ppfid; in qed_llh_get_num_ppfid()
722 int qed_llh_set_ppfid_affinity(struct qed_dev *cdev, u8 ppfid, enum qed_eng eng) in qed_llh_set_ppfid_affinity() argument
724 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_set_ppfid_affinity()
733 if (!QED_IS_CMT(cdev)) in qed_llh_set_ppfid_affinity()
736 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_set_ppfid_affinity()
751 DP_NOTICE(cdev, "Invalid affinity value for ppfid [%d]\n", eng); in qed_llh_set_ppfid_affinity()
763 cdev->iwarp_affin = (eng == QED_ENG1) ? 1 : 0; in qed_llh_set_ppfid_affinity()
770 int qed_llh_set_roce_affinity(struct qed_dev *cdev, enum qed_eng eng) in qed_llh_set_roce_affinity() argument
772 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_set_roce_affinity()
781 if (!QED_IS_CMT(cdev)) in qed_llh_set_roce_affinity()
797 DP_NOTICE(cdev, "Invalid affinity value for RoCE [%d]\n", eng); in qed_llh_set_roce_affinity()
802 for (ppfid = 0; ppfid < cdev->p_llh_info->num_ppfid; ppfid++) { in qed_llh_set_roce_affinity()
803 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_set_roce_affinity()
846 if (QED_IS_BB(p_hwfn->cdev)) in qed_llh_access_filter()
849 pfid = abs_ppfid * p_hwfn->cdev->num_ports_in_engine + in qed_llh_access_filter()
935 int qed_llh_add_mac_filter(struct qed_dev *cdev, in qed_llh_add_mac_filter() argument
938 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_add_mac_filter()
948 if (!test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits)) in qed_llh_add_mac_filter()
952 rc = qed_llh_shadow_add_filter(cdev, ppfid, in qed_llh_add_mac_filter()
960 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_add_mac_filter()
973 DP_VERBOSE(cdev, in qed_llh_add_mac_filter()
980 err: DP_NOTICE(cdev, in qed_llh_add_mac_filter()
990 qed_llh_protocol_filter_stringify(struct qed_dev *cdev, in qed_llh_protocol_filter_stringify() argument
1023 DP_NOTICE(cdev, in qed_llh_protocol_filter_stringify()
1032 qed_llh_protocol_filter_to_hilo(struct qed_dev *cdev, in qed_llh_protocol_filter_to_hilo() argument
1057 DP_NOTICE(cdev, in qed_llh_protocol_filter_to_hilo()
1066 qed_llh_add_protocol_filter(struct qed_dev *cdev, in qed_llh_add_protocol_filter() argument
1071 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_add_protocol_filter()
1081 if (!test_bit(QED_MF_LLH_PROTO_CLSS, &cdev->mf_bits)) in qed_llh_add_protocol_filter()
1084 rc = qed_llh_protocol_filter_stringify(cdev, type, in qed_llh_add_protocol_filter()
1093 rc = qed_llh_shadow_add_filter(cdev, in qed_llh_add_protocol_filter()
1100 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_add_protocol_filter()
1106 rc = qed_llh_protocol_filter_to_hilo(cdev, type, in qed_llh_add_protocol_filter()
1119 DP_VERBOSE(cdev, in qed_llh_add_protocol_filter()
1135 void qed_llh_remove_mac_filter(struct qed_dev *cdev, in qed_llh_remove_mac_filter() argument
1138 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_remove_mac_filter()
1148 if (!test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits)) in qed_llh_remove_mac_filter()
1155 rc = qed_llh_shadow_remove_filter(cdev, ppfid, &filter, &filter_idx, in qed_llh_remove_mac_filter()
1160 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_remove_mac_filter()
1172 DP_VERBOSE(cdev, in qed_llh_remove_mac_filter()
1179 err: DP_NOTICE(cdev, in qed_llh_remove_mac_filter()
1186 void qed_llh_remove_protocol_filter(struct qed_dev *cdev, in qed_llh_remove_protocol_filter() argument
1191 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_remove_protocol_filter()
1201 if (!test_bit(QED_MF_LLH_PROTO_CLSS, &cdev->mf_bits)) in qed_llh_remove_protocol_filter()
1204 rc = qed_llh_protocol_filter_stringify(cdev, type, in qed_llh_remove_protocol_filter()
1213 rc = qed_llh_shadow_remove_filter(cdev, ppfid, &filter, &filter_idx, in qed_llh_remove_protocol_filter()
1218 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_remove_protocol_filter()
1230 DP_VERBOSE(cdev, in qed_llh_remove_protocol_filter()
1237 err: DP_NOTICE(cdev, in qed_llh_remove_protocol_filter()
1256 if (IS_VF(p_hwfn->cdev)) in qed_hw_bar_size()
1264 if (p_hwfn->cdev->num_hwfns > 1) { in qed_hw_bar_size()
1275 void qed_init_dp(struct qed_dev *cdev, u32 dp_module, u8 dp_level) in qed_init_dp() argument
1279 cdev->dp_level = dp_level; in qed_init_dp()
1280 cdev->dp_module = dp_module; in qed_init_dp()
1282 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_init_dp()
1289 void qed_init_struct(struct qed_dev *cdev) in qed_init_struct() argument
1294 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_init_struct()
1296 p_hwfn->cdev = cdev; in qed_init_struct()
1304 cdev->hwfns[0].b_active = true; in qed_init_struct()
1307 cdev->cache_shift = 7; in qed_init_struct()
1330 void qed_resc_free(struct qed_dev *cdev) in qed_resc_free() argument
1336 if (IS_VF(cdev)) { in qed_resc_free()
1337 for_each_hwfn(cdev, i) in qed_resc_free()
1338 qed_l2_free(&cdev->hwfns[i]); in qed_resc_free()
1342 kfree(cdev->fw_data); in qed_resc_free()
1343 cdev->fw_data = NULL; in qed_resc_free()
1345 kfree(cdev->reset_stats); in qed_resc_free()
1346 cdev->reset_stats = NULL; in qed_resc_free()
1348 qed_llh_free(cdev); in qed_resc_free()
1350 for_each_hwfn(cdev, i) { in qed_resc_free()
1351 p_hwfn = cdev->hwfns + i; in qed_resc_free()
1407 if (IS_QED_SRIOV(p_hwfn->cdev)) in qed_get_pq_flags()
1448 return IS_QED_SRIOV(p_hwfn->cdev) ? in qed_init_qm_get_num_vfs()
1449 p_hwfn->cdev->p_iov_info->total_vfs : 0; in qed_init_qm_get_num_vfs()
1526 four_port = p_hwfn->cdev->num_ports_in_engine == MAX_NUM_PORTS_K2; in qed_init_qm_params()
1555 u8 i, active_phys_tcs, num_ports = p_hwfn->cdev->num_ports_in_engine; in qed_init_qm_port_params()
1556 struct qed_dev *cdev = p_hwfn->cdev; in qed_init_qm_port_params() local
1570 pbf_max_cmd_lines = (u16)NUM_OF_PBF_CMD_LINES(cdev); in qed_init_qm_port_params()
1572 p_qm_port->num_btb_blocks = NUM_OF_BTB_BLOCKS(cdev) / num_ports; in qed_init_qm_port_params()
1997 for (i = 0; i < p_hwfn->cdev->num_ports_in_engine; i++) { in qed_dp_init_qm_params()
2123 qm_info->qm_port_params = kcalloc(p_hwfn->cdev->num_ports_in_engine, in qed_alloc_qm_data()
2143 int qed_resc_alloc(struct qed_dev *cdev) in qed_resc_alloc() argument
2149 if (IS_VF(cdev)) { in qed_resc_alloc()
2150 for_each_hwfn(cdev, i) { in qed_resc_alloc()
2151 rc = qed_l2_alloc(&cdev->hwfns[i]); in qed_resc_alloc()
2158 cdev->fw_data = kzalloc(sizeof(*cdev->fw_data), GFP_KERNEL); in qed_resc_alloc()
2159 if (!cdev->fw_data) in qed_resc_alloc()
2162 for_each_hwfn(cdev, i) { in qed_resc_alloc()
2163 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_resc_alloc()
2341 rc = qed_llh_alloc(cdev); in qed_resc_alloc()
2343 DP_NOTICE(cdev, in qed_resc_alloc()
2348 cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL); in qed_resc_alloc()
2349 if (!cdev->reset_stats) in qed_resc_alloc()
2357 qed_resc_free(cdev); in qed_resc_alloc()
2398 DP_INFO(p_hwfn->cdev, "Unknown eqe event 0x%02x, echo 0x%x\n", in qed_common_eqe_event()
2404 void qed_resc_setup(struct qed_dev *cdev) in qed_resc_setup() argument
2408 if (IS_VF(cdev)) { in qed_resc_setup()
2409 for_each_hwfn(cdev, i) in qed_resc_setup()
2410 qed_l2_setup(&cdev->hwfns[i]); in qed_resc_setup()
2414 for_each_hwfn(cdev, i) { in qed_resc_setup()
2415 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_resc_setup()
2505 if (QED_IS_BB_B0(p_hwfn->cdev)) { in qed_calc_hw_mode()
2507 } else if (QED_IS_AH(p_hwfn->cdev)) { in qed_calc_hw_mode()
2511 p_hwfn->cdev->type); in qed_calc_hw_mode()
2515 switch (p_hwfn->cdev->num_ports_in_engine) { in qed_calc_hw_mode()
2527 p_hwfn->cdev->num_ports_in_engine); in qed_calc_hw_mode()
2531 if (test_bit(QED_MF_OVLAN_CLSS, &p_hwfn->cdev->mf_bits)) in qed_calc_hw_mode()
2538 if (p_hwfn->cdev->num_hwfns > 1) in qed_calc_hw_mode()
2551 static void qed_init_cau_rt_data(struct qed_dev *cdev) in qed_init_cau_rt_data() argument
2556 for_each_hwfn(cdev, i) { in qed_init_cau_rt_data()
2557 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_init_cau_rt_data()
2565 igu_sb_id < QED_MAPPING_MEMORY_SIZE(cdev); igu_sb_id++) { in qed_init_cau_rt_data()
2639 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_init_common() local
2647 DP_NOTICE(p_hwfn->cdev, in qed_hw_init_common()
2653 qed_init_cau_rt_data(cdev); in qed_hw_init_common()
2665 params->max_ports_per_engine = p_hwfn->cdev->num_ports_in_engine; in qed_hw_init_common()
2686 if (QED_IS_BB(p_hwfn->cdev)) { in qed_hw_init_common()
2687 num_pfs = NUM_OF_ENG_PFS(p_hwfn->cdev); in qed_hw_init_common()
2697 max_num_vfs = QED_IS_AH(cdev) ? MAX_NUM_VFS_K2 : MAX_NUM_VFS_BB; in qed_hw_init_common()
2770 if (p_hwfn->cdev->num_hwfns > 1) in qed_hw_init_pf_doorbell_bar()
2785 DP_ERR(p_hwfn->cdev, in qed_hw_init_pf_doorbell_bar()
2792 DP_ERR(p_hwfn->cdev, in qed_hw_init_pf_doorbell_bar()
2859 if (!QED_IS_CMT(p_hwfn->cdev) || !IS_LEAD_HWFN(p_hwfn)) in qed_hw_init_port()
3046 int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params) in qed_hw_init() argument
3057 if ((p_params->int_mode == QED_INT_MODE_MSI) && (cdev->num_hwfns > 1)) { in qed_hw_init()
3058 DP_NOTICE(cdev, "MSI mode is not supported for CMT devices\n"); in qed_hw_init()
3062 if (IS_PF(cdev)) { in qed_hw_init()
3063 rc = qed_init_fw_data(cdev, p_params->bin_fw_data); in qed_hw_init()
3068 for_each_hwfn(cdev, i) { in qed_hw_init()
3069 p_hwfn = &cdev->hwfns[i]; in qed_hw_init()
3077 if (IS_VF(cdev)) { in qed_hw_init()
3089 if (IS_PF(cdev) && (test_bit(QED_MF_8021Q_TAGGING, in qed_hw_init()
3090 &cdev->mf_bits) || in qed_hw_init()
3092 &cdev->mf_bits))) { in qed_hw_init()
3093 if (test_bit(QED_MF_8021Q_TAGGING, &cdev->mf_bits)) in qed_hw_init()
3124 cdev->recov_in_prog = false; in qed_hw_init()
3161 fw_overlays = cdev->fw_data->fw_overlays; in qed_hw_init()
3162 fw_overlays_len = cdev->fw_data->fw_overlays_len; in qed_hw_init()
3230 if (IS_PF(cdev)) { in qed_hw_init()
3231 p_hwfn = QED_LEADING_HWFN(cdev); in qed_hw_init()
3282 static void qed_hw_timers_stop(struct qed_dev *cdev, in qed_hw_timers_stop() argument
3291 if (cdev->recov_in_prog) in qed_hw_timers_stop()
3315 void qed_hw_timers_stop_all(struct qed_dev *cdev) in qed_hw_timers_stop_all() argument
3319 for_each_hwfn(cdev, j) { in qed_hw_timers_stop_all()
3320 struct qed_hwfn *p_hwfn = &cdev->hwfns[j]; in qed_hw_timers_stop_all()
3323 qed_hw_timers_stop(cdev, p_hwfn, p_ptt); in qed_hw_timers_stop_all()
3327 int qed_hw_stop(struct qed_dev *cdev) in qed_hw_stop() argument
3334 for_each_hwfn(cdev, j) { in qed_hw_stop()
3335 p_hwfn = &cdev->hwfns[j]; in qed_hw_stop()
3340 if (IS_VF(cdev)) { in qed_hw_stop()
3356 if (!cdev->recov_in_prog) { in qed_hw_stop()
3388 qed_hw_timers_stop(cdev, p_hwfn, p_ptt); in qed_hw_stop()
3406 test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits) && in qed_hw_stop()
3408 qed_llh_remove_mac_filter(cdev, 0, in qed_hw_stop()
3411 if (!cdev->recov_in_prog) { in qed_hw_stop()
3422 if (IS_PF(cdev) && !cdev->recov_in_prog) { in qed_hw_stop()
3423 p_hwfn = QED_LEADING_HWFN(cdev); in qed_hw_stop()
3424 p_ptt = QED_LEADING_HWFN(cdev)->p_main_ptt; in qed_hw_stop()
3443 int qed_hw_stop_fastpath(struct qed_dev *cdev) in qed_hw_stop_fastpath() argument
3447 for_each_hwfn(cdev, j) { in qed_hw_stop_fastpath()
3448 struct qed_hwfn *p_hwfn = &cdev->hwfns[j]; in qed_hw_stop_fastpath()
3451 if (IS_VF(cdev)) { in qed_hw_stop_fastpath()
3485 if (IS_VF(p_hwfn->cdev)) in qed_hw_start_fastpath()
3515 if (QED_IS_AH(p_hwfn->cdev)) { in qed_hw_hwfn_prepare()
3702 u32 qed_get_hsi_def_val(struct qed_dev *cdev, enum qed_hsi_def_type type) in qed_get_hsi_def_val() argument
3704 enum chip_ids chip_id = QED_IS_BB(cdev) ? CHIP_BB : CHIP_K2; in qed_get_hsi_def_val()
3707 DP_ERR(cdev, "Unexpected HSI definition type [%d]\n", type); in qed_get_hsi_def_val()
3737 NUM_OF_RDMA_STATISTIC_COUNTERS(p_hwfn->cdev); in qed_hw_set_soft_resc_size()
3770 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_get_dflt_resc() local
3774 *p_resc_num = NUM_OF_L2_QUEUES(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3777 *p_resc_num = NUM_OF_VPORTS(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3780 *p_resc_num = NUM_OF_RSS_ENGINES(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3783 *p_resc_num = NUM_OF_QM_TX_QUEUES(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3787 *p_resc_num = NUM_OF_QM_GLOBAL_RLS(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3795 *p_resc_num = NUM_OF_PXP_ILT_RECORDS(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3809 *p_resc_num = NUM_OF_RDMA_STATISTIC_COUNTERS(cdev) / num_funcs; in qed_hw_get_dflt_resc()
3833 else if (p_hwfn->cdev->num_ports_in_engine == 4) in qed_hw_get_dflt_resc()
3927 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_get_ppfid_bitmap() local
3932 if (QED_IS_BB(cdev)) in qed_hw_get_ppfid_bitmap()
3936 cdev->num_ports_in_engine; in qed_hw_get_ppfid_bitmap()
3942 cdev->ppfid_bitmap = 0x1 << native_ppfid_idx; in qed_hw_get_ppfid_bitmap()
3944 if (!(cdev->ppfid_bitmap & (0x1 << native_ppfid_idx))) { in qed_hw_get_ppfid_bitmap()
3947 native_ppfid_idx, cdev->ppfid_bitmap); in qed_hw_get_ppfid_bitmap()
3948 cdev->ppfid_bitmap = 0x1 << native_ppfid_idx; in qed_hw_get_ppfid_bitmap()
3958 bool b_ah = QED_IS_AH(p_hwfn->cdev); in qed_hw_get_resc()
4302 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_get_nvm_info() local
4316 cdev->mf_bits = BIT(QED_MF_OVLAN_CLSS); in qed_hw_get_nvm_info()
4319 cdev->mf_bits = BIT(QED_MF_OVLAN_CLSS) | in qed_hw_get_nvm_info()
4326 cdev->mf_bits = BIT(QED_MF_OVLAN_CLSS) | in qed_hw_get_nvm_info()
4332 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) | in qed_hw_get_nvm_info()
4339 cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) | in qed_hw_get_nvm_info()
4342 if (QED_IS_BB(p_hwfn->cdev)) in qed_hw_get_nvm_info()
4343 cdev->mf_bits |= BIT(QED_MF_NEED_DEF_PF); in qed_hw_get_nvm_info()
4348 cdev->mf_bits); in qed_hw_get_nvm_info()
4355 if (QED_IS_CMT(cdev)) in qed_hw_get_nvm_info()
4356 cdev->mf_bits |= BIT(QED_MF_DISABLE_ARFS); in qed_hw_get_nvm_info()
4360 p_hwfn->cdev->mf_bits); in qed_hw_get_nvm_info()
4396 struct qed_dev *cdev = p_hwfn->cdev; in qed_get_num_funcs() local
4398 num_funcs = QED_IS_AH(cdev) ? MAX_NUM_PFS_K2 : MAX_NUM_PFS_BB; in qed_get_num_funcs()
4411 if (QED_IS_BB(cdev)) { in qed_get_num_funcs()
4412 if (QED_PATH_ID(p_hwfn) && cdev->num_hwfns == 1) { in qed_get_num_funcs()
4456 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_info_port_num() local
4459 if (cdev->num_hwfns > 1) { in qed_hw_info_port_num()
4460 cdev->num_ports_in_engine = 1; in qed_hw_info_port_num()
4461 cdev->num_ports = 1; in qed_hw_info_port_num()
4469 cdev->num_ports_in_engine = 1; in qed_hw_info_port_num()
4472 cdev->num_ports_in_engine = 2; in qed_hw_info_port_num()
4475 cdev->num_ports_in_engine = 4; in qed_hw_info_port_num()
4479 cdev->num_ports_in_engine = 1; /* Default to something */ in qed_hw_info_port_num()
4489 cdev->num_ports = (u8)qed_rd(p_hwfn, p_ptt, addr); in qed_hw_info_port_num()
4579 struct qed_dev *cdev = p_hwfn->cdev; in qed_get_dev_info() local
4584 pci_read_config_word(cdev->pdev, PCI_VENDOR_ID, &cdev->vendor_id); in qed_get_dev_info()
4585 pci_read_config_word(cdev->pdev, PCI_DEVICE_ID, &cdev->device_id); in qed_get_dev_info()
4588 device_id_mask = cdev->device_id & QED_DEV_ID_MASK; in qed_get_dev_info()
4591 cdev->type = QED_DEV_TYPE_BB; in qed_get_dev_info()
4594 cdev->type = QED_DEV_TYPE_AH; in qed_get_dev_info()
4597 DP_NOTICE(p_hwfn, "Unknown device id 0x%x\n", cdev->device_id); in qed_get_dev_info()
4601 cdev->chip_num = (u16)qed_rd(p_hwfn, p_ptt, MISCS_REG_CHIP_NUM); in qed_get_dev_info()
4602 cdev->chip_rev = (u16)qed_rd(p_hwfn, p_ptt, MISCS_REG_CHIP_REV); in qed_get_dev_info()
4604 MASK_FIELD(CHIP_REV, cdev->chip_rev); in qed_get_dev_info()
4610 DP_NOTICE(cdev->hwfns, "device in CMT mode\n"); in qed_get_dev_info()
4611 cdev->num_hwfns = 2; in qed_get_dev_info()
4613 cdev->num_hwfns = 1; in qed_get_dev_info()
4616 cdev->chip_bond_id = qed_rd(p_hwfn, p_ptt, in qed_get_dev_info()
4618 MASK_FIELD(CHIP_BOND_ID, cdev->chip_bond_id); in qed_get_dev_info()
4619 cdev->chip_metal = (u16)qed_rd(p_hwfn, p_ptt, MISCS_REG_CHIP_METAL); in qed_get_dev_info()
4620 MASK_FIELD(CHIP_METAL, cdev->chip_metal); in qed_get_dev_info()
4622 DP_INFO(cdev->hwfns, in qed_get_dev_info()
4624 QED_IS_BB(cdev) ? "BB" : "AH", in qed_get_dev_info()
4625 'A' + cdev->chip_rev, in qed_get_dev_info()
4626 (int)cdev->chip_metal, in qed_get_dev_info()
4627 cdev->chip_num, cdev->chip_rev, in qed_get_dev_info()
4628 cdev->chip_bond_id, cdev->chip_metal); in qed_get_dev_info()
4639 struct qed_dev *cdev = p_hwfn->cdev; in qed_hw_prepare_single() local
4647 if (IS_VF(p_hwfn->cdev)) in qed_hw_prepare_single()
4693 if (IS_LEAD_HWFN(p_hwfn) && !cdev->recov_in_prog) { in qed_hw_prepare_single()
4720 qed_iov_free_hw_info(p_hwfn->cdev); in qed_hw_prepare_single()
4728 int qed_hw_prepare(struct qed_dev *cdev, in qed_hw_prepare() argument
4731 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_hw_prepare()
4735 if (IS_PF(cdev)) in qed_hw_prepare()
4736 qed_init_iro_array(cdev); in qed_hw_prepare()
4740 cdev->regview, in qed_hw_prepare()
4741 cdev->doorbells, in qed_hw_prepare()
4742 cdev->db_phys_addr, in qed_hw_prepare()
4750 if (cdev->num_hwfns > 1) { in qed_hw_prepare()
4758 p_regview = cdev->regview + offset; in qed_hw_prepare()
4763 p_doorbell = cdev->doorbells + offset; in qed_hw_prepare()
4765 db_phys_addr = cdev->db_phys_addr + offset; in qed_hw_prepare()
4768 rc = qed_hw_prepare_single(&cdev->hwfns[1], p_regview, in qed_hw_prepare()
4776 if (IS_PF(cdev)) { in qed_hw_prepare()
4788 void qed_hw_remove(struct qed_dev *cdev) in qed_hw_remove() argument
4790 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_hw_remove()
4793 if (IS_PF(cdev)) in qed_hw_remove()
4797 for_each_hwfn(cdev, i) { in qed_hw_remove()
4798 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_hw_remove()
4800 if (IS_VF(cdev)) { in qed_hw_remove()
4810 qed_iov_free_hw_info(cdev); in qed_hw_remove()
4878 if (p_hwfn->cdev->int_coalescing_mode != QED_COAL_MODE_ENABLE) { in qed_set_coalesce()
4901 if (IS_VF(p_hwfn->cdev)) in qed_set_queue_coalesce()
4912 p_hwfn->cdev->rx_coalesce_usecs = rx_coal; in qed_set_queue_coalesce()
4919 p_hwfn->cdev->tx_coalesce_usecs = tx_coal; in qed_set_queue_coalesce()
5139 p_link = &p_hwfn->cdev->hwfns[0].mcp_info->link_output; in __qed_configure_vport_wfq()
5197 int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate) in qed_configure_vport_wfq() argument
5202 if (cdev->num_hwfns > 1) { in qed_configure_vport_wfq()
5203 DP_NOTICE(cdev, in qed_configure_vport_wfq()
5208 for_each_hwfn(cdev, i) { in qed_configure_vport_wfq()
5209 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_configure_vport_wfq()
5230 void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, in qed_configure_vp_wfq_on_link_change() argument
5235 if (cdev->num_hwfns > 1) { in qed_configure_vp_wfq_on_link_change()
5236 DP_VERBOSE(cdev, in qed_configure_vp_wfq_on_link_change()
5242 for_each_hwfn(cdev, i) { in qed_configure_vp_wfq_on_link_change()
5243 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_configure_vp_wfq_on_link_change()
5283 int qed_configure_pf_max_bandwidth(struct qed_dev *cdev, u8 max_bw) in qed_configure_pf_max_bandwidth() argument
5288 DP_NOTICE(cdev, "PF max bw valid range is [1-100]\n"); in qed_configure_pf_max_bandwidth()
5292 for_each_hwfn(cdev, i) { in qed_configure_pf_max_bandwidth()
5293 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_configure_pf_max_bandwidth()
5294 struct qed_hwfn *p_lead = QED_LEADING_HWFN(cdev); in qed_configure_pf_max_bandwidth()
5341 int qed_configure_pf_min_bandwidth(struct qed_dev *cdev, u8 min_bw) in qed_configure_pf_min_bandwidth() argument
5346 DP_NOTICE(cdev, "PF min bw valid range is [1-100]\n"); in qed_configure_pf_min_bandwidth()
5350 for_each_hwfn(cdev, i) { in qed_configure_pf_min_bandwidth()
5351 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; in qed_configure_pf_min_bandwidth()
5352 struct qed_hwfn *p_lead = QED_LEADING_HWFN(cdev); in qed_configure_pf_min_bandwidth()
5397 int qed_device_num_ports(struct qed_dev *cdev) in qed_device_num_ports() argument
5399 return cdev->num_ports; in qed_device_num_ports()
5413 static int qed_llh_shadow_remove_all_filters(struct qed_dev *cdev, u8 ppfid) in qed_llh_shadow_remove_all_filters() argument
5415 struct qed_llh_info *p_llh_info = cdev->p_llh_info; in qed_llh_shadow_remove_all_filters()
5419 rc = qed_llh_shadow_sanity(cdev, ppfid, 0, "remove_all"); in qed_llh_shadow_remove_all_filters()
5430 static void qed_llh_clear_ppfid_filters(struct qed_dev *cdev, u8 ppfid) in qed_llh_clear_ppfid_filters() argument
5432 struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev); in qed_llh_clear_ppfid_filters()
5440 if (!test_bit(QED_MF_LLH_PROTO_CLSS, &cdev->mf_bits) && in qed_llh_clear_ppfid_filters()
5441 !test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits)) in qed_llh_clear_ppfid_filters()
5444 rc = qed_llh_abs_ppfid(cdev, ppfid, &abs_ppfid); in qed_llh_clear_ppfid_filters()
5448 rc = qed_llh_shadow_remove_all_filters(cdev, ppfid); in qed_llh_clear_ppfid_filters()
5463 int qed_llh_add_src_tcp_port_filter(struct qed_dev *cdev, u16 src_port) in qed_llh_add_src_tcp_port_filter() argument
5465 return qed_llh_add_protocol_filter(cdev, 0, in qed_llh_add_src_tcp_port_filter()
5470 void qed_llh_remove_src_tcp_port_filter(struct qed_dev *cdev, u16 src_port) in qed_llh_remove_src_tcp_port_filter() argument
5472 qed_llh_remove_protocol_filter(cdev, 0, in qed_llh_remove_src_tcp_port_filter()
5477 int qed_llh_add_dst_tcp_port_filter(struct qed_dev *cdev, u16 dest_port) in qed_llh_add_dst_tcp_port_filter() argument
5479 return qed_llh_add_protocol_filter(cdev, 0, in qed_llh_add_dst_tcp_port_filter()
5484 void qed_llh_remove_dst_tcp_port_filter(struct qed_dev *cdev, u16 dest_port) in qed_llh_remove_dst_tcp_port_filter() argument
5486 qed_llh_remove_protocol_filter(cdev, 0, in qed_llh_remove_dst_tcp_port_filter()
5491 void qed_llh_clear_all_filters(struct qed_dev *cdev) in qed_llh_clear_all_filters() argument
5495 if (!test_bit(QED_MF_LLH_PROTO_CLSS, &cdev->mf_bits) && in qed_llh_clear_all_filters()
5496 !test_bit(QED_MF_LLH_MAC_CLSS, &cdev->mf_bits)) in qed_llh_clear_all_filters()
5499 for (ppfid = 0; ppfid < cdev->p_llh_info->num_ppfid; ppfid++) in qed_llh_clear_all_filters()
5500 qed_llh_clear_ppfid_filters(cdev, ppfid); in qed_llh_clear_all_filters()