Lines Matching +full:non +full:- +full:operational
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
3 * Copyright (c) 2015-2017 QLogic Corporation
4 * Copyright (c) 2019-2020 Marvell International Ltd.
39 ((u32)(prio_tc_tbl >> ((7 - prio) * 4)) & 0x7)
152 p_data->dcbx_enabled); in qed_dcbx_dp_protocol()
159 qed_dcbx_app_update[i].name, p_data->arr[id].update, in qed_dcbx_dp_protocol()
160 p_data->arr[id].enable, p_data->arr[id].priority, in qed_dcbx_dp_protocol()
161 p_data->arr[id].tc, p_hwfn->hw_info.num_active_tc); in qed_dcbx_dp_protocol()
173 p_data->arr[type].enable = enable; in qed_dcbx_set_params()
174 p_data->arr[type].priority = prio; in qed_dcbx_set_params()
175 p_data->arr[type].tc = tc; in qed_dcbx_set_params()
177 p_data->arr[type].update = UPDATE_DCB; in qed_dcbx_set_params()
179 p_data->arr[type].update = DONT_UPDATE_DCB_DSCP; in qed_dcbx_set_params()
181 if (test_bit(QED_MF_DONT_ADD_VLAN0_TAG, &p_hwfn->cdev->mf_bits)) in qed_dcbx_set_params()
182 p_data->arr[type].dont_add_vlan0 = true; in qed_dcbx_set_params()
185 if (app_tlv && p_hwfn->hw_info.personality == personality) in qed_dcbx_set_params()
186 qed_hw_info_set_offload_tc(&p_hwfn->hw_info, tc); in qed_dcbx_set_params()
189 if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) && in qed_dcbx_set_params()
272 priority = ffs(priority_map) - 1; in qed_dcbx_process_tlv()
275 return -EINVAL; in qed_dcbx_process_tlv()
300 if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) && !eth_tlv) in qed_dcbx_process_tlv()
301 p_data->arr[DCBX_PROTOCOL_ETH].tc = p_hwfn->ufp_info.tc; in qed_dcbx_process_tlv()
309 tc = p_data->arr[DCBX_PROTOCOL_ETH].tc; in qed_dcbx_process_tlv()
310 priority = p_data->arr[DCBX_PROTOCOL_ETH].priority; in qed_dcbx_process_tlv()
312 if (p_data->arr[type].update) in qed_dcbx_process_tlv()
339 flags = p_hwfn->p_dcbx_info->operational.flags; in qed_dcbx_process_mib_info()
342 p_app = &p_hwfn->p_dcbx_info->operational.features.app; in qed_dcbx_process_mib_info()
343 p_tbl = p_app->app_pri_tbl; in qed_dcbx_process_mib_info()
345 p_ets = &p_hwfn->p_dcbx_info->operational.features.ets; in qed_dcbx_process_mib_info()
346 pri_tc_tbl = p_ets->pri_tc_tbl[0]; in qed_dcbx_process_mib_info()
348 p_info = &p_hwfn->hw_info; in qed_dcbx_process_mib_info()
349 num_entries = QED_MFW_GET_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES); in qed_dcbx_process_mib_info()
356 p_info->num_active_tc = QED_MFW_GET_FIELD(p_ets->flags, in qed_dcbx_process_mib_info()
358 p_hwfn->qm_info.ooo_tc = QED_MFW_GET_FIELD(p_ets->flags, DCBX_OOO_TC); in qed_dcbx_process_mib_info()
359 data.pf_id = p_hwfn->rel_pf_id; in qed_dcbx_process_mib_info()
364 memcpy(&p_hwfn->p_dcbx_info->results, &data, in qed_dcbx_process_mib_info()
385 qed_memcpy_from(p_hwfn, p_ptt, p_data->lldp_remote, in qed_dcbx_copy_mib()
386 p_data->addr, p_data->size); in qed_dcbx_copy_mib()
387 prefix_seq_num = p_data->lldp_remote->prefix_seq_num; in qed_dcbx_copy_mib()
388 suffix_seq_num = p_data->lldp_remote->suffix_seq_num; in qed_dcbx_copy_mib()
390 qed_memcpy_from(p_hwfn, p_ptt, p_data->mib, in qed_dcbx_copy_mib()
391 p_data->addr, p_data->size); in qed_dcbx_copy_mib()
392 prefix_seq_num = p_data->mib->prefix_seq_num; in qed_dcbx_copy_mib()
393 suffix_seq_num = p_data->mib->suffix_seq_num; in qed_dcbx_copy_mib()
408 rc = -EIO; in qed_dcbx_copy_mib()
421 p_prio->roce = QED_DCBX_INVALID_PRIORITY; in qed_dcbx_get_priority_info()
422 p_prio->roce_v2 = QED_DCBX_INVALID_PRIORITY; in qed_dcbx_get_priority_info()
423 p_prio->iscsi = QED_DCBX_INVALID_PRIORITY; in qed_dcbx_get_priority_info()
424 p_prio->fcoe = QED_DCBX_INVALID_PRIORITY; in qed_dcbx_get_priority_info()
426 if (p_results->arr[DCBX_PROTOCOL_ROCE].update && in qed_dcbx_get_priority_info()
427 p_results->arr[DCBX_PROTOCOL_ROCE].enable) in qed_dcbx_get_priority_info()
428 p_prio->roce = p_results->arr[DCBX_PROTOCOL_ROCE].priority; in qed_dcbx_get_priority_info()
430 if (p_results->arr[DCBX_PROTOCOL_ROCE_V2].update && in qed_dcbx_get_priority_info()
431 p_results->arr[DCBX_PROTOCOL_ROCE_V2].enable) { in qed_dcbx_get_priority_info()
432 val = p_results->arr[DCBX_PROTOCOL_ROCE_V2].priority; in qed_dcbx_get_priority_info()
433 p_prio->roce_v2 = val; in qed_dcbx_get_priority_info()
436 if (p_results->arr[DCBX_PROTOCOL_ISCSI].update && in qed_dcbx_get_priority_info()
437 p_results->arr[DCBX_PROTOCOL_ISCSI].enable) in qed_dcbx_get_priority_info()
438 p_prio->iscsi = p_results->arr[DCBX_PROTOCOL_ISCSI].priority; in qed_dcbx_get_priority_info()
440 if (p_results->arr[DCBX_PROTOCOL_FCOE].update && in qed_dcbx_get_priority_info()
441 p_results->arr[DCBX_PROTOCOL_FCOE].enable) in qed_dcbx_get_priority_info()
442 p_prio->fcoe = p_results->arr[DCBX_PROTOCOL_FCOE].priority; in qed_dcbx_get_priority_info()
444 if (p_results->arr[DCBX_PROTOCOL_ETH].update && in qed_dcbx_get_priority_info()
445 p_results->arr[DCBX_PROTOCOL_ETH].enable) in qed_dcbx_get_priority_info()
446 p_prio->eth = p_results->arr[DCBX_PROTOCOL_ETH].priority; in qed_dcbx_get_priority_info()
450 p_prio->iscsi, p_prio->roce, p_prio->roce_v2, p_prio->fcoe, in qed_dcbx_get_priority_info()
451 p_prio->eth); in qed_dcbx_get_priority_info()
464 p_params->app_willing = QED_MFW_GET_FIELD(p_app->flags, in qed_dcbx_get_app_data()
466 p_params->app_valid = QED_MFW_GET_FIELD(p_app->flags, DCBX_APP_ENABLED); in qed_dcbx_get_app_data()
467 p_params->app_error = QED_MFW_GET_FIELD(p_app->flags, DCBX_APP_ERROR); in qed_dcbx_get_app_data()
468 p_params->num_app_entries = QED_MFW_GET_FIELD(p_app->flags, in qed_dcbx_get_app_data()
471 entry = &p_params->app_entry[i]; in qed_dcbx_get_app_data()
483 entry->sf_ieee = val ? in qed_dcbx_get_app_data()
488 entry->sf_ieee = QED_DCBX_SF_IEEE_ETHTYPE; in qed_dcbx_get_app_data()
491 entry->sf_ieee = QED_DCBX_SF_IEEE_TCP_PORT; in qed_dcbx_get_app_data()
494 entry->sf_ieee = QED_DCBX_SF_IEEE_UDP_PORT; in qed_dcbx_get_app_data()
497 entry->sf_ieee = QED_DCBX_SF_IEEE_TCP_UDP_PORT; in qed_dcbx_get_app_data()
501 entry->ethtype = !(QED_MFW_GET_FIELD(p_tbl[i].entry, in qed_dcbx_get_app_data()
506 entry->prio = ffs(pri_map) - 1; in qed_dcbx_get_app_data()
507 entry->proto_id = QED_MFW_GET_FIELD(p_tbl[i].entry, in qed_dcbx_get_app_data()
510 entry->proto_id, in qed_dcbx_get_app_data()
511 &entry->proto_type, ieee); in qed_dcbx_get_app_data()
516 p_params->app_willing, p_params->app_valid, in qed_dcbx_get_app_data()
517 p_params->app_error); in qed_dcbx_get_app_data()
526 p_params->pfc.willing = QED_MFW_GET_FIELD(pfc, DCBX_PFC_WILLING); in qed_dcbx_get_pfc_data()
527 p_params->pfc.max_tc = QED_MFW_GET_FIELD(pfc, DCBX_PFC_CAPS); in qed_dcbx_get_pfc_data()
528 p_params->pfc.enabled = QED_MFW_GET_FIELD(pfc, DCBX_PFC_ENABLED); in qed_dcbx_get_pfc_data()
530 p_params->pfc.prio[0] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_0); in qed_dcbx_get_pfc_data()
531 p_params->pfc.prio[1] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_1); in qed_dcbx_get_pfc_data()
532 p_params->pfc.prio[2] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_2); in qed_dcbx_get_pfc_data()
533 p_params->pfc.prio[3] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_3); in qed_dcbx_get_pfc_data()
534 p_params->pfc.prio[4] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_4); in qed_dcbx_get_pfc_data()
535 p_params->pfc.prio[5] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_5); in qed_dcbx_get_pfc_data()
536 p_params->pfc.prio[6] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_6); in qed_dcbx_get_pfc_data()
537 p_params->pfc.prio[7] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_7); in qed_dcbx_get_pfc_data()
541 p_params->pfc.willing, pfc_map, p_params->pfc.max_tc, in qed_dcbx_get_pfc_data()
542 p_params->pfc.enabled); in qed_dcbx_get_pfc_data()
554 p_params->ets_willing = QED_MFW_GET_FIELD(p_ets->flags, in qed_dcbx_get_ets_data()
556 p_params->ets_enabled = QED_MFW_GET_FIELD(p_ets->flags, in qed_dcbx_get_ets_data()
558 p_params->ets_cbs = QED_MFW_GET_FIELD(p_ets->flags, DCBX_ETS_CBS); in qed_dcbx_get_ets_data()
559 p_params->max_ets_tc = QED_MFW_GET_FIELD(p_ets->flags, in qed_dcbx_get_ets_data()
563 p_params->ets_willing, p_params->ets_enabled, in qed_dcbx_get_ets_data()
564 p_params->ets_cbs, p_ets->pri_tc_tbl[0], in qed_dcbx_get_ets_data()
565 p_params->max_ets_tc); in qed_dcbx_get_ets_data()
567 if (p_params->ets_enabled && !p_params->max_ets_tc) { in qed_dcbx_get_ets_data()
568 p_params->max_ets_tc = QED_MAX_PFC_PRIORITIES; in qed_dcbx_get_ets_data()
571 p_params->max_ets_tc); in qed_dcbx_get_ets_data()
577 cpu_to_be32_array(bw_map, p_ets->tc_bw_tbl, 2); in qed_dcbx_get_ets_data()
578 cpu_to_be32_array(tsa_map, p_ets->tc_tsa_tbl, 2); in qed_dcbx_get_ets_data()
579 pri_map = p_ets->pri_tc_tbl[0]; in qed_dcbx_get_ets_data()
582 p_params->ets_tc_bw_tbl[i] = ((u8 *)bw_map)[i]; in qed_dcbx_get_ets_data()
583 p_params->ets_tc_tsa_tbl[i] = ((u8 *)tsa_map)[i]; in qed_dcbx_get_ets_data()
584 p_params->ets_pri_tc_tbl[i] = QED_DCBX_PRIO2TC(pri_map, i); in qed_dcbx_get_ets_data()
587 i, p_params->ets_tc_bw_tbl[i], in qed_dcbx_get_ets_data()
588 p_params->ets_tc_tsa_tbl[i]); in qed_dcbx_get_ets_data()
609 p_feat = &p_hwfn->p_dcbx_info->local_admin.features; in qed_dcbx_get_local_params()
610 qed_dcbx_get_common_params(p_hwfn, &p_feat->app, in qed_dcbx_get_local_params()
611 p_feat->app.app_pri_tbl, &p_feat->ets, in qed_dcbx_get_local_params()
612 p_feat->pfc, ¶ms->local.params, false); in qed_dcbx_get_local_params()
613 params->local.valid = true; in qed_dcbx_get_local_params()
621 p_feat = &p_hwfn->p_dcbx_info->remote.features; in qed_dcbx_get_remote_params()
622 qed_dcbx_get_common_params(p_hwfn, &p_feat->app, in qed_dcbx_get_remote_params()
623 p_feat->app.app_pri_tbl, &p_feat->ets, in qed_dcbx_get_remote_params()
624 p_feat->pfc, ¶ms->remote.params, false); in qed_dcbx_get_remote_params()
625 params->remote.valid = true; in qed_dcbx_get_remote_params()
639 flags = p_hwfn->p_dcbx_info->operational.flags; in qed_dcbx_get_operational_params()
641 /* If DCBx version is non zero, then negotiation in qed_dcbx_get_operational_params()
644 p_operational = ¶ms->operational; in qed_dcbx_get_operational_params()
648 p_operational->enabled = enabled; in qed_dcbx_get_operational_params()
649 p_operational->valid = false; in qed_dcbx_get_operational_params()
654 p_feat = &p_hwfn->p_dcbx_info->operational.features; in qed_dcbx_get_operational_params()
655 p_results = &p_hwfn->p_dcbx_info->results; in qed_dcbx_get_operational_params()
659 p_operational->ieee = val; in qed_dcbx_get_operational_params()
662 p_operational->cee = val; in qed_dcbx_get_operational_params()
666 p_operational->local = val; in qed_dcbx_get_operational_params()
670 p_operational->ieee, p_operational->cee, in qed_dcbx_get_operational_params()
671 p_operational->local); in qed_dcbx_get_operational_params()
673 qed_dcbx_get_common_params(p_hwfn, &p_feat->app, in qed_dcbx_get_operational_params()
674 p_feat->app.app_pri_tbl, &p_feat->ets, in qed_dcbx_get_operational_params()
675 p_feat->pfc, ¶ms->operational.params, in qed_dcbx_get_operational_params()
676 p_operational->ieee); in qed_dcbx_get_operational_params()
677 qed_dcbx_get_priority_info(p_hwfn, &p_operational->app_prio, p_results); in qed_dcbx_get_operational_params()
678 err = QED_MFW_GET_FIELD(p_feat->app.flags, DCBX_APP_ERROR); in qed_dcbx_get_operational_params()
679 p_operational->err = err; in qed_dcbx_get_operational_params()
680 p_operational->enabled = enabled; in qed_dcbx_get_operational_params()
681 p_operational->valid = true; in qed_dcbx_get_operational_params()
690 p_local = &p_hwfn->p_dcbx_info->lldp_local[LLDP_NEAREST_BRIDGE]; in qed_dcbx_get_local_lldp_params()
692 memcpy(params->lldp_local.local_chassis_id, p_local->local_chassis_id, in qed_dcbx_get_local_lldp_params()
693 sizeof(p_local->local_chassis_id)); in qed_dcbx_get_local_lldp_params()
694 memcpy(params->lldp_local.local_port_id, p_local->local_port_id, in qed_dcbx_get_local_lldp_params()
695 sizeof(p_local->local_port_id)); in qed_dcbx_get_local_lldp_params()
704 p_remote = &p_hwfn->p_dcbx_info->lldp_remote[LLDP_NEAREST_BRIDGE]; in qed_dcbx_get_remote_lldp_params()
706 memcpy(params->lldp_remote.peer_chassis_id, p_remote->peer_chassis_id, in qed_dcbx_get_remote_lldp_params()
707 sizeof(p_remote->peer_chassis_id)); in qed_dcbx_get_remote_lldp_params()
708 memcpy(params->lldp_remote.peer_port_id, p_remote->peer_port_id, in qed_dcbx_get_remote_lldp_params()
709 sizeof(p_remote->peer_port_id)); in qed_dcbx_get_remote_lldp_params()
734 return -EINVAL; in qed_dcbx_get_params()
746 data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, in qed_dcbx_read_local_lldp_mib()
748 data.lldp_local = p_hwfn->p_dcbx_info->lldp_local; in qed_dcbx_read_local_lldp_mib()
764 data.addr = p_hwfn->mcp_info->port_addr + offsetof(struct public_port, in qed_dcbx_read_remote_lldp_mib()
766 data.lldp_remote = p_hwfn->p_dcbx_info->lldp_remote; in qed_dcbx_read_remote_lldp_mib()
782 data.addr = p_hwfn->mcp_info->port_addr + in qed_dcbx_read_operational_mib()
784 data.mib = &p_hwfn->p_dcbx_info->operational; in qed_dcbx_read_operational_mib()
799 data.addr = p_hwfn->mcp_info->port_addr + in qed_dcbx_read_remote_mib()
801 data.mib = &p_hwfn->p_dcbx_info->remote; in qed_dcbx_read_remote_mib()
814 data.addr = p_hwfn->mcp_info->port_addr + in qed_dcbx_read_local_mib()
816 data.local_admin = &p_hwfn->p_dcbx_info->local_admin; in qed_dcbx_read_local_mib()
826 int rc = -EINVAL; in qed_dcbx_read_mib()
853 struct qed_common_cb_ops *op = hwfn->cdev->protocol_ops.common; in qed_dcbx_aen()
854 void *cookie = hwfn->cdev->ops_cookie; in qed_dcbx_aen()
856 if (cookie && op->dcbx_aen) in qed_dcbx_aen()
857 op->dcbx_aen(cookie, &hwfn->p_dcbx_info->get, mib_type); in qed_dcbx_aen()
861 * Reconfigure QM and invoke PF update ramrod command if operational MIB
888 if (p_hwfn->hw_info.personality == in qed_dcbx_mib_update_event()
894 qed_dcbx_get_params(p_hwfn, &p_hwfn->p_dcbx_info->get, type); in qed_dcbx_mib_update_event()
903 p_data = &p_hwfn->p_dcbx_info->results; in qed_dcbx_mib_update_event()
904 val = (0x1 << p_data->arr[DCBX_PROTOCOL_ROCE].tc) | in qed_dcbx_mib_update_event()
905 (0x1 << p_data->arr[DCBX_PROTOCOL_ROCE_V2].tc); in qed_dcbx_mib_update_event()
918 p_hwfn->p_dcbx_info = kzalloc(sizeof(*p_hwfn->p_dcbx_info), GFP_KERNEL); in qed_dcbx_info_alloc()
919 if (!p_hwfn->p_dcbx_info) in qed_dcbx_info_alloc()
920 return -ENOMEM; in qed_dcbx_info_alloc()
927 kfree(p_hwfn->p_dcbx_info); in qed_dcbx_info_free()
928 p_hwfn->p_dcbx_info = NULL; in qed_dcbx_info_free()
935 p_data->dcb_enable_flag = p_src->arr[type].enable; in qed_dcbx_update_protocol_data()
936 p_data->dcb_priority = p_src->arr[type].priority; in qed_dcbx_update_protocol_data()
937 p_data->dcb_tc = p_src->arr[type].tc; in qed_dcbx_update_protocol_data()
938 p_data->dcb_dont_add_vlan0 = p_src->arr[type].dont_add_vlan0; in qed_dcbx_update_protocol_data()
948 update_flag = p_src->arr[DCBX_PROTOCOL_FCOE].update; in qed_dcbx_set_pf_update_params()
949 p_dest->update_fcoe_dcb_data_mode = update_flag; in qed_dcbx_set_pf_update_params()
951 update_flag = p_src->arr[DCBX_PROTOCOL_ROCE].update; in qed_dcbx_set_pf_update_params()
952 p_dest->update_roce_dcb_data_mode = update_flag; in qed_dcbx_set_pf_update_params()
954 update_flag = p_src->arr[DCBX_PROTOCOL_ROCE_V2].update; in qed_dcbx_set_pf_update_params()
955 p_dest->update_rroce_dcb_data_mode = update_flag; in qed_dcbx_set_pf_update_params()
957 update_flag = p_src->arr[DCBX_PROTOCOL_ISCSI].update; in qed_dcbx_set_pf_update_params()
958 p_dest->update_iscsi_dcb_data_mode = update_flag; in qed_dcbx_set_pf_update_params()
959 update_flag = p_src->arr[DCBX_PROTOCOL_ETH].update; in qed_dcbx_set_pf_update_params()
960 p_dest->update_eth_dcb_data_mode = update_flag; in qed_dcbx_set_pf_update_params()
962 p_dcb_data = &p_dest->fcoe_dcb_data; in qed_dcbx_set_pf_update_params()
964 p_dcb_data = &p_dest->roce_dcb_data; in qed_dcbx_set_pf_update_params()
966 p_dcb_data = &p_dest->rroce_dcb_data; in qed_dcbx_set_pf_update_params()
968 p_dcb_data = &p_dest->iscsi_dcb_data; in qed_dcbx_set_pf_update_params()
970 p_dcb_data = &p_dest->eth_dcb_data; in qed_dcbx_set_pf_update_params()
976 struct qed_dcbx_get *dcbx_info = &p_hwfn->p_dcbx_info->get; in qed_dcbx_get_priority_tc()
983 if (!dcbx_info->operational.valid) { in qed_dcbx_get_priority_tc()
989 return dcbx_info->operational.params.ets_pri_tc_tbl[pri]; in qed_dcbx_get_priority_tc()
1000 if (IS_VF(p_hwfn->cdev)) in qed_dcbx_query_params()
1001 return -EINVAL; in qed_dcbx_query_params()
1005 return -EBUSY; in qed_dcbx_query_params()
1027 if (p_params->pfc.willing) in qed_dcbx_set_pfc_data()
1032 if (p_params->pfc.enabled) in qed_dcbx_set_pfc_data()
1038 *pfc |= (u32)p_params->pfc.max_tc << DCBX_PFC_CAPS_SHIFT; in qed_dcbx_set_pfc_data()
1041 if (p_params->pfc.prio[i]) in qed_dcbx_set_pfc_data()
1059 if (p_params->ets_willing) in qed_dcbx_set_ets_data()
1060 p_ets->flags |= DCBX_ETS_WILLING_MASK; in qed_dcbx_set_ets_data()
1062 p_ets->flags &= ~DCBX_ETS_WILLING_MASK; in qed_dcbx_set_ets_data()
1064 if (p_params->ets_cbs) in qed_dcbx_set_ets_data()
1065 p_ets->flags |= DCBX_ETS_CBS_MASK; in qed_dcbx_set_ets_data()
1067 p_ets->flags &= ~DCBX_ETS_CBS_MASK; in qed_dcbx_set_ets_data()
1069 if (p_params->ets_enabled) in qed_dcbx_set_ets_data()
1070 p_ets->flags |= DCBX_ETS_ENABLED_MASK; in qed_dcbx_set_ets_data()
1072 p_ets->flags &= ~DCBX_ETS_ENABLED_MASK; in qed_dcbx_set_ets_data()
1074 p_ets->flags &= ~DCBX_ETS_MAX_TCS_MASK; in qed_dcbx_set_ets_data()
1075 p_ets->flags |= (u32)p_params->max_ets_tc << DCBX_ETS_MAX_TCS_SHIFT; in qed_dcbx_set_ets_data()
1077 p_ets->pri_tc_tbl[0] = 0; in qed_dcbx_set_ets_data()
1080 ((u8 *)bw_map)[i] = p_params->ets_tc_bw_tbl[i]; in qed_dcbx_set_ets_data()
1081 ((u8 *)tsa_map)[i] = p_params->ets_tc_tsa_tbl[i]; in qed_dcbx_set_ets_data()
1086 val = (((u32)p_params->ets_pri_tc_tbl[i]) << ((7 - i) * 4)); in qed_dcbx_set_ets_data()
1087 p_ets->pri_tc_tbl[0] |= val; in qed_dcbx_set_ets_data()
1090 be32_to_cpu_array(p_ets->tc_bw_tbl, bw_map, 2); in qed_dcbx_set_ets_data()
1091 be32_to_cpu_array(p_ets->tc_tsa_tbl, tsa_map, 2); in qed_dcbx_set_ets_data()
1102 if (p_params->app_willing) in qed_dcbx_set_app_data()
1103 p_app->flags |= DCBX_APP_WILLING_MASK; in qed_dcbx_set_app_data()
1105 p_app->flags &= ~DCBX_APP_WILLING_MASK; in qed_dcbx_set_app_data()
1107 if (p_params->app_valid) in qed_dcbx_set_app_data()
1108 p_app->flags |= DCBX_APP_ENABLED_MASK; in qed_dcbx_set_app_data()
1110 p_app->flags &= ~DCBX_APP_ENABLED_MASK; in qed_dcbx_set_app_data()
1112 p_app->flags &= ~DCBX_APP_NUM_ENTRIES_MASK; in qed_dcbx_set_app_data()
1113 p_app->flags |= (u32)p_params->num_app_entries << in qed_dcbx_set_app_data()
1117 entry = &p_app->app_pri_tbl[i].entry; in qed_dcbx_set_app_data()
1121 switch (p_params->app_entry[i].sf_ieee) { in qed_dcbx_set_app_data()
1149 if (p_params->app_entry[i].ethtype) in qed_dcbx_set_app_data()
1158 *entry |= ((u32)p_params->app_entry[i].proto_id << in qed_dcbx_set_app_data()
1161 *entry |= ((u32)(p_params->app_entry[i].prio) << in qed_dcbx_set_app_data()
1173 local_admin->flags = 0; in qed_dcbx_set_local_params()
1174 memcpy(&local_admin->features, in qed_dcbx_set_local_params()
1175 &p_hwfn->p_dcbx_info->operational.features, in qed_dcbx_set_local_params()
1176 sizeof(local_admin->features)); in qed_dcbx_set_local_params()
1178 if (params->enabled) { in qed_dcbx_set_local_params()
1179 local_admin->config = params->ver_num; in qed_dcbx_set_local_params()
1180 ieee = !!(params->ver_num & DCBX_CONFIG_VERSION_IEEE); in qed_dcbx_set_local_params()
1182 local_admin->config = DCBX_CONFIG_VERSION_DISABLED; in qed_dcbx_set_local_params()
1186 local_admin->config); in qed_dcbx_set_local_params()
1188 if (params->override_flags & QED_DCBX_OVERRIDE_PFC_CFG) in qed_dcbx_set_local_params()
1189 qed_dcbx_set_pfc_data(p_hwfn, &local_admin->features.pfc, in qed_dcbx_set_local_params()
1190 ¶ms->config.params); in qed_dcbx_set_local_params()
1192 if (params->override_flags & QED_DCBX_OVERRIDE_ETS_CFG) in qed_dcbx_set_local_params()
1193 qed_dcbx_set_ets_data(p_hwfn, &local_admin->features.ets, in qed_dcbx_set_local_params()
1194 ¶ms->config.params); in qed_dcbx_set_local_params()
1196 if (params->override_flags & QED_DCBX_OVERRIDE_APP_CFG) in qed_dcbx_set_local_params()
1197 qed_dcbx_set_app_data(p_hwfn, &local_admin->features.app, in qed_dcbx_set_local_params()
1198 ¶ms->config.params, ieee); in qed_dcbx_set_local_params()
1210 memcpy(&p_hwfn->p_dcbx_info->set, params, in qed_dcbx_config_params()
1215 /* clear set-parmas cache */ in qed_dcbx_config_params()
1216 memset(&p_hwfn->p_dcbx_info->set, 0, sizeof(p_hwfn->p_dcbx_info->set)); in qed_dcbx_config_params()
1221 data.addr = p_hwfn->mcp_info->port_addr + in qed_dcbx_config_params()
1241 if (p_hwfn->p_dcbx_info->set.config.valid) { in qed_dcbx_get_config_params()
1242 memcpy(params, &p_hwfn->p_dcbx_info->set, in qed_dcbx_get_config_params()
1249 return -ENOMEM; in qed_dcbx_get_config_params()
1257 p_hwfn->p_dcbx_info->set.override_flags = 0; in qed_dcbx_get_config_params()
1258 p_hwfn->p_dcbx_info->set.ver_num = DCBX_CONFIG_VERSION_DISABLED; in qed_dcbx_get_config_params()
1259 if (dcbx_info->operational.cee) in qed_dcbx_get_config_params()
1260 p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_CEE; in qed_dcbx_get_config_params()
1261 if (dcbx_info->operational.ieee) in qed_dcbx_get_config_params()
1262 p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_IEEE; in qed_dcbx_get_config_params()
1263 if (dcbx_info->operational.local) in qed_dcbx_get_config_params()
1264 p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_STATIC; in qed_dcbx_get_config_params()
1266 p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled; in qed_dcbx_get_config_params()
1267 BUILD_BUG_ON(sizeof(dcbx_info->operational.params) != in qed_dcbx_get_config_params()
1268 sizeof(p_hwfn->p_dcbx_info->set.config.params)); in qed_dcbx_get_config_params()
1269 memcpy(&p_hwfn->p_dcbx_info->set.config.params, in qed_dcbx_get_config_params()
1270 &dcbx_info->operational.params, in qed_dcbx_get_config_params()
1271 sizeof(p_hwfn->p_dcbx_info->set.config.params)); in qed_dcbx_get_config_params()
1272 p_hwfn->p_dcbx_info->set.config.valid = true; in qed_dcbx_get_config_params()
1274 memcpy(params, &p_hwfn->p_dcbx_info->set, sizeof(struct qed_dcbx_set)); in qed_dcbx_get_config_params()
1296 !dcbx_info->operational.enabled) { in qed_dcbnl_get_dcbx()
1297 DP_INFO(hwfn, "DCBX is not enabled/operational\n"); in qed_dcbnl_get_dcbx()
1315 enabled = dcbx_info->operational.enabled; in qed_dcbnl_getstate()
1366 *pgid = dcbx_info->operational.params.ets_pri_tc_tbl[tc]; in qed_dcbnl_getpgtccfgtx()
1386 *bw_pct = dcbx_info->operational.params.ets_tc_bw_tbl[pgid]; in qed_dcbnl_getpgbwgcfgtx()
1421 *setting = dcbx_info->operational.params.pfc.prio[priority]; in qed_dcbnl_getpfccfg()
1503 return -EINVAL; in qed_dcbnl_getnumtcs()
1507 *num = dcbx_info->operational.params.max_ets_tc; in qed_dcbnl_getnumtcs()
1510 *num = dcbx_info->operational.params.pfc.max_tc; in qed_dcbnl_getnumtcs()
1513 rc = -EINVAL; in qed_dcbnl_getnumtcs()
1532 enabled = dcbx_info->operational.params.pfc.enabled; in qed_dcbnl_getpfcstate()
1549 if (dcbx_info->operational.ieee) in qed_dcbnl_getdcbx()
1551 if (dcbx_info->operational.cee) in qed_dcbnl_getdcbx()
1553 if (dcbx_info->operational.local) in qed_dcbnl_getdcbx()
1685 return -EINVAL; in qed_dcbnl_setnumtcs()
1690 return -EINVAL; in qed_dcbnl_setnumtcs()
1736 return -EINVAL; in qed_dcbnl_getapp()
1740 entry = &dcbx_info->operational.params.app_entry[i]; in qed_dcbnl_getapp()
1741 if ((entry->ethtype == ethtype) && (entry->proto_id == idval)) { in qed_dcbnl_getapp()
1742 prio = entry->prio; in qed_dcbnl_getapp()
1750 return -EINVAL; in qed_dcbnl_getapp()
1771 return -EINVAL; in qed_dcbnl_setapp()
1776 if ((entry->ethtype == ethtype) && (entry->proto_id == idval)) in qed_dcbnl_setapp()
1779 if (!entry->proto_id) { in qed_dcbnl_setapp()
1787 return -EBUSY; in qed_dcbnl_setapp()
1797 return -EBUSY; in qed_dcbnl_setapp()
1866 if (dcbx_info->operational.params.ets_enabled) in qed_dcbnl_getfeatcfg()
1872 if (dcbx_info->operational.params.pfc.enabled) in qed_dcbnl_getfeatcfg()
1878 if (dcbx_info->operational.params.app_valid) in qed_dcbnl_getfeatcfg()
1884 DP_INFO(hwfn, "Invalid feature-ID %d\n", featid); in qed_dcbnl_getfeatcfg()
1928 DP_INFO(hwfn, "Invalid feature-ID %d\n", featid); in qed_dcbnl_setfeatcfg()
1952 return -EINVAL; in qed_dcbnl_peer_getappinfo()
1954 info->willing = dcbx_info->remote.params.app_willing; in qed_dcbnl_peer_getappinfo()
1955 info->error = dcbx_info->remote.params.app_error; in qed_dcbnl_peer_getappinfo()
1956 *app_count = dcbx_info->remote.params.num_app_entries; in qed_dcbnl_peer_getappinfo()
1971 return -EINVAL; in qed_dcbnl_peer_getapptable()
1973 for (i = 0; i < dcbx_info->remote.params.num_app_entries; i++) { in qed_dcbnl_peer_getapptable()
1974 if (dcbx_info->remote.params.app_entry[i].ethtype) in qed_dcbnl_peer_getapptable()
1978 table[i].priority = dcbx_info->remote.params.app_entry[i].prio; in qed_dcbnl_peer_getapptable()
1980 dcbx_info->remote.params.app_entry[i].proto_id; in qed_dcbnl_peer_getapptable()
1996 return -EINVAL; in qed_dcbnl_cee_peer_getpfc()
1999 if (dcbx_info->remote.params.pfc.prio[i]) in qed_dcbnl_cee_peer_getpfc()
2000 pfc->pfc_en |= BIT(i); in qed_dcbnl_cee_peer_getpfc()
2002 pfc->tcs_supported = dcbx_info->remote.params.pfc.max_tc; in qed_dcbnl_cee_peer_getpfc()
2004 pfc->pfc_en, pfc->tcs_supported); in qed_dcbnl_cee_peer_getpfc()
2018 return -EINVAL; in qed_dcbnl_cee_peer_getpg()
2020 pg->willing = dcbx_info->remote.params.ets_willing; in qed_dcbnl_cee_peer_getpg()
2022 pg->pg_bw[i] = dcbx_info->remote.params.ets_tc_bw_tbl[i]; in qed_dcbnl_cee_peer_getpg()
2023 pg->prio_pg[i] = dcbx_info->remote.params.ets_pri_tc_tbl[i]; in qed_dcbnl_cee_peer_getpg()
2026 DP_VERBOSE(hwfn, QED_MSG_DCB, "willing = %d", pg->willing); in qed_dcbnl_cee_peer_getpg()
2042 return -EINVAL; in qed_dcbnl_get_ieee_pfc()
2044 if (!dcbx_info->operational.ieee) { in qed_dcbnl_get_ieee_pfc()
2045 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_get_ieee_pfc()
2047 return -EINVAL; in qed_dcbnl_get_ieee_pfc()
2056 return -EINVAL; in qed_dcbnl_get_ieee_pfc()
2059 params = &dcbx_info->remote.params; in qed_dcbnl_get_ieee_pfc()
2061 params = &dcbx_info->operational.params; in qed_dcbnl_get_ieee_pfc()
2064 pfc->pfc_cap = params->pfc.max_tc; in qed_dcbnl_get_ieee_pfc()
2065 pfc->pfc_en = 0; in qed_dcbnl_get_ieee_pfc()
2067 if (params->pfc.prio[i]) in qed_dcbnl_get_ieee_pfc()
2068 pfc->pfc_en |= BIT(i); in qed_dcbnl_get_ieee_pfc()
2090 return -EINVAL; in qed_dcbnl_ieee_setpfc()
2092 if (!dcbx_info->operational.ieee) { in qed_dcbnl_ieee_setpfc()
2093 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_ieee_setpfc()
2095 return -EINVAL; in qed_dcbnl_ieee_setpfc()
2103 return -EINVAL; in qed_dcbnl_ieee_setpfc()
2107 dcbx_set.config.params.pfc.prio[i] = !!(pfc->pfc_en & BIT(i)); in qed_dcbnl_ieee_setpfc()
2109 dcbx_set.config.params.pfc.max_tc = pfc->pfc_cap; in qed_dcbnl_ieee_setpfc()
2113 return -EINVAL; in qed_dcbnl_ieee_setpfc()
2132 return -EINVAL; in qed_dcbnl_get_ieee_ets()
2134 if (!dcbx_info->operational.ieee) { in qed_dcbnl_get_ieee_ets()
2135 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_get_ieee_ets()
2137 return -EINVAL; in qed_dcbnl_get_ieee_ets()
2146 return -EINVAL; in qed_dcbnl_get_ieee_ets()
2149 params = &dcbx_info->remote.params; in qed_dcbnl_get_ieee_ets()
2151 params = &dcbx_info->operational.params; in qed_dcbnl_get_ieee_ets()
2154 ets->ets_cap = params->max_ets_tc; in qed_dcbnl_get_ieee_ets()
2155 ets->willing = params->ets_willing; in qed_dcbnl_get_ieee_ets()
2156 ets->cbs = params->ets_cbs; in qed_dcbnl_get_ieee_ets()
2157 memcpy(ets->tc_tx_bw, params->ets_tc_bw_tbl, sizeof(ets->tc_tx_bw)); in qed_dcbnl_get_ieee_ets()
2158 memcpy(ets->tc_tsa, params->ets_tc_tsa_tbl, sizeof(ets->tc_tsa)); in qed_dcbnl_get_ieee_ets()
2159 memcpy(ets->prio_tc, params->ets_pri_tc_tbl, sizeof(ets->prio_tc)); in qed_dcbnl_get_ieee_ets()
2180 return -EINVAL; in qed_dcbnl_ieee_setets()
2182 if (!dcbx_info->operational.ieee) { in qed_dcbnl_ieee_setets()
2183 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_ieee_setets()
2185 return -EINVAL; in qed_dcbnl_ieee_setets()
2193 return -EINVAL; in qed_dcbnl_ieee_setets()
2196 dcbx_set.config.params.max_ets_tc = ets->ets_cap; in qed_dcbnl_ieee_setets()
2197 dcbx_set.config.params.ets_willing = ets->willing; in qed_dcbnl_ieee_setets()
2198 dcbx_set.config.params.ets_cbs = ets->cbs; in qed_dcbnl_ieee_setets()
2199 memcpy(dcbx_set.config.params.ets_tc_bw_tbl, ets->tc_tx_bw, in qed_dcbnl_ieee_setets()
2200 sizeof(ets->tc_tx_bw)); in qed_dcbnl_ieee_setets()
2201 memcpy(dcbx_set.config.params.ets_tc_tsa_tbl, ets->tc_tsa, in qed_dcbnl_ieee_setets()
2202 sizeof(ets->tc_tsa)); in qed_dcbnl_ieee_setets()
2203 memcpy(dcbx_set.config.params.ets_pri_tc_tbl, ets->prio_tc, in qed_dcbnl_ieee_setets()
2204 sizeof(ets->prio_tc)); in qed_dcbnl_ieee_setets()
2208 return -EINVAL; in qed_dcbnl_ieee_setets()
2245 return -EINVAL; in qed_get_sf_ieee_value()
2261 app->selector, app->protocol); in qed_dcbnl_ieee_getapp()
2263 if (qed_get_sf_ieee_value(app->selector, &sf_ieee)) { in qed_dcbnl_ieee_getapp()
2265 app->selector); in qed_dcbnl_ieee_getapp()
2266 return -EINVAL; in qed_dcbnl_ieee_getapp()
2271 return -EINVAL; in qed_dcbnl_ieee_getapp()
2273 if (!dcbx_info->operational.ieee) { in qed_dcbnl_ieee_getapp()
2274 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_ieee_getapp()
2276 return -EINVAL; in qed_dcbnl_ieee_getapp()
2280 entry = &dcbx_info->operational.params.app_entry[i]; in qed_dcbnl_ieee_getapp()
2281 if ((entry->sf_ieee == sf_ieee) && in qed_dcbnl_ieee_getapp()
2282 (entry->proto_id == app->protocol)) { in qed_dcbnl_ieee_getapp()
2283 prio = entry->prio; in qed_dcbnl_ieee_getapp()
2289 DP_ERR(cdev, "App entry (%d, %d) not found\n", app->selector, in qed_dcbnl_ieee_getapp()
2290 app->protocol); in qed_dcbnl_ieee_getapp()
2292 return -EINVAL; in qed_dcbnl_ieee_getapp()
2295 app->priority = ffs(prio) - 1; in qed_dcbnl_ieee_getapp()
2313 app->selector, app->protocol, app->priority); in qed_dcbnl_ieee_setapp()
2314 if (app->priority >= QED_MAX_PFC_PRIORITIES) { in qed_dcbnl_ieee_setapp()
2315 DP_INFO(hwfn, "Invalid priority %d\n", app->priority); in qed_dcbnl_ieee_setapp()
2316 return -EINVAL; in qed_dcbnl_ieee_setapp()
2319 if (qed_get_sf_ieee_value(app->selector, &sf_ieee)) { in qed_dcbnl_ieee_setapp()
2321 app->selector); in qed_dcbnl_ieee_setapp()
2322 return -EINVAL; in qed_dcbnl_ieee_setapp()
2327 return -EINVAL; in qed_dcbnl_ieee_setapp()
2329 if (!dcbx_info->operational.ieee) { in qed_dcbnl_ieee_setapp()
2330 DP_INFO(hwfn, "DCBX is not enabled/operational in IEEE mode\n"); in qed_dcbnl_ieee_setapp()
2332 return -EINVAL; in qed_dcbnl_ieee_setapp()
2340 return -EINVAL; in qed_dcbnl_ieee_setapp()
2344 if ((entry->sf_ieee == sf_ieee) && in qed_dcbnl_ieee_setapp()
2345 (entry->proto_id == app->protocol)) in qed_dcbnl_ieee_setapp()
2348 if (!entry->proto_id) { in qed_dcbnl_ieee_setapp()
2356 return -EBUSY; in qed_dcbnl_ieee_setapp()
2361 dcbx_set.config.params.app_entry[i].proto_id = app->protocol; in qed_dcbnl_ieee_setapp()
2362 dcbx_set.config.params.app_entry[i].prio = BIT(app->priority); in qed_dcbnl_ieee_setapp()
2366 return -EBUSY; in qed_dcbnl_ieee_setapp()