Lines Matching +full:dcb +full:- +full:algorithm

1 // SPDX-License-Identifier: GPL-2.0
39 put_unaligned_be64(pci_get_dsn(pf->pdev), dsn); in ice_info_get_dsn()
41 snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn); in ice_info_get_dsn()
46 struct ice_hw *hw = &pf->hw; in ice_info_pba()
49 status = ice_read_pba_string(hw, (u8 *)ctx->buf, sizeof(ctx->buf)); in ice_info_pba()
58 struct ice_hw *hw = &pf->hw; in ice_info_fw_mgmt()
60 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", in ice_info_fw_mgmt()
61 hw->fw_maj_ver, hw->fw_min_ver, hw->fw_patch); in ice_info_fw_mgmt()
66 struct ice_hw *hw = &pf->hw; in ice_info_fw_api()
68 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", hw->api_maj_ver, in ice_info_fw_api()
69 hw->api_min_ver, hw->api_patch); in ice_info_fw_api()
74 struct ice_hw *hw = &pf->hw; in ice_info_fw_build()
76 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build); in ice_info_fw_build()
81 struct ice_orom_info *orom = &pf->hw.flash.orom; in ice_info_orom_ver()
83 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", in ice_info_orom_ver()
84 orom->major, orom->build, orom->patch); in ice_info_orom_ver()
91 struct ice_orom_info *orom = &ctx->pending_orom; in ice_info_pending_orom_ver()
93 if (ctx->dev_caps.common_cap.nvm_update_pending_orom) in ice_info_pending_orom_ver()
94 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", in ice_info_pending_orom_ver()
95 orom->major, orom->build, orom->patch); in ice_info_pending_orom_ver()
100 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_nvm_ver()
102 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor); in ice_info_nvm_ver()
109 struct ice_nvm_info *nvm = &ctx->pending_nvm; in ice_info_pending_nvm_ver()
111 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) in ice_info_pending_nvm_ver()
112 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", in ice_info_pending_nvm_ver()
113 nvm->major, nvm->minor); in ice_info_pending_nvm_ver()
118 struct ice_nvm_info *nvm = &pf->hw.flash.nvm; in ice_info_eetrack()
120 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm->eetrack); in ice_info_eetrack()
126 struct ice_nvm_info *nvm = &ctx->pending_nvm; in ice_info_pending_eetrack()
128 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) in ice_info_pending_eetrack()
129 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm->eetrack); in ice_info_pending_eetrack()
134 struct ice_hw *hw = &pf->hw; in ice_info_ddp_pkg_name()
136 snprintf(ctx->buf, sizeof(ctx->buf), "%s", hw->active_pkg_name); in ice_info_ddp_pkg_name()
142 struct ice_pkg_ver *pkg = &pf->hw.active_pkg_ver; in ice_info_ddp_pkg_version()
144 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u.%u", in ice_info_ddp_pkg_version()
145 pkg->major, pkg->minor, pkg->update, pkg->draft); in ice_info_ddp_pkg_version()
151 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", pf->hw.active_track_id); in ice_info_ddp_pkg_bundle_id()
156 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_ver()
159 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x", in ice_info_netlist_ver()
160 netlist->major, netlist->minor, in ice_info_netlist_ver()
161 netlist->type >> 16, netlist->type & 0xFFFF, in ice_info_netlist_ver()
162 netlist->rev, netlist->cust_ver); in ice_info_netlist_ver()
167 struct ice_netlist_info *netlist = &pf->hw.flash.netlist; in ice_info_netlist_build()
169 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash); in ice_info_netlist_build()
176 struct ice_netlist_info *netlist = &ctx->pending_netlist; in ice_info_pending_netlist_ver()
179 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) in ice_info_pending_netlist_ver()
180 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x", in ice_info_pending_netlist_ver()
181 netlist->major, netlist->minor, in ice_info_pending_netlist_ver()
182 netlist->type >> 16, netlist->type & 0xFFFF, in ice_info_pending_netlist_ver()
183 netlist->rev, netlist->cust_ver); in ice_info_pending_netlist_ver()
190 struct ice_netlist_info *netlist = &ctx->pending_netlist; in ice_info_pending_netlist_build()
192 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) in ice_info_pending_netlist_build()
193 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash); in ice_info_pending_netlist_build()
202 if (ice_aq_get_cgu_info(&pf->hw, &id, &cfg_ver, &fw_ver)) in ice_info_cgu_fw_build()
204 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", id, cfg_ver, fw_ver); in ice_info_cgu_fw_build()
211 snprintf(ctx->buf, sizeof(ctx->buf), "%u", pf->hw.cgu_part_number); in ice_info_cgu_id()
261 * ice_devlink_info_get - .info_get devlink handler
277 struct ice_hw *hw = &pf->hw; in ice_devlink_info_get()
290 return -ENOMEM; in ice_devlink_info_get()
293 err = ice_discover_dev_caps(hw, &ctx->dev_caps); in ice_devlink_info_get()
296 err, ice_aq_str(hw->adminq.sq_last_status)); in ice_devlink_info_get()
301 if (ctx->dev_caps.common_cap.nvm_update_pending_orom) { in ice_devlink_info_get()
302 err = ice_get_inactive_orom_ver(hw, &ctx->pending_orom); in ice_devlink_info_get()
305 err, ice_aq_str(hw->adminq.sq_last_status)); in ice_devlink_info_get()
308 ctx->dev_caps.common_cap.nvm_update_pending_orom = false; in ice_devlink_info_get()
312 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) { in ice_devlink_info_get()
313 err = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm); in ice_devlink_info_get()
316 err, ice_aq_str(hw->adminq.sq_last_status)); in ice_devlink_info_get()
319 ctx->dev_caps.common_cap.nvm_update_pending_nvm = false; in ice_devlink_info_get()
323 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) { in ice_devlink_info_get()
324 err = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist); in ice_devlink_info_get()
327 err, ice_aq_str(hw->adminq.sq_last_status)); in ice_devlink_info_get()
330 ctx->dev_caps.common_cap.nvm_update_pending_netlist = false; in ice_devlink_info_get()
336 err = devlink_info_serial_number_put(req, ctx->buf); in ice_devlink_info_get()
346 memset(ctx->buf, 0, sizeof(ctx->buf)); in ice_devlink_info_get()
355 if (ctx->buf[0] == '\0' && ice_devlink_versions[i].fallback) in ice_devlink_info_get()
359 if (ctx->buf[0] == '\0') in ice_devlink_info_get()
364 err = devlink_info_version_fixed_put(req, key, ctx->buf); in ice_devlink_info_get()
371 err = devlink_info_version_running_put(req, key, ctx->buf); in ice_devlink_info_get()
378 err = devlink_info_version_stored_put(req, key, ctx->buf); in ice_devlink_info_get()
393 * ice_devlink_reload_empr_start - Start EMP reset to activate new firmware
411 struct ice_hw *hw = &pf->hw; in ice_devlink_reload_empr_start()
426 return -ECANCELED; in ice_devlink_reload_empr_start()
429 if (pf->fw_emp_reset_disabled) { in ice_devlink_reload_empr_start()
431 return -ECANCELED; in ice_devlink_reload_empr_start()
439 err, ice_aq_str(hw->adminq.sq_last_status)); in ice_devlink_reload_empr_start()
448 * ice_devlink_reinit_down - unload given PF
462 * ice_devlink_reload_down - prepare for reload
482 return -EOPNOTSUPP; in ice_devlink_reload_down()
487 return -EOPNOTSUPP; in ice_devlink_reload_down()
492 return -EOPNOTSUPP; in ice_devlink_reload_down()
500 return -EOPNOTSUPP; in ice_devlink_reload_down()
505 * ice_devlink_reload_empr_finish - Wait for EMP reset to finish
529 * ice_get_tx_topo_user_sel - Read user's choice from flash
540 struct ice_hw *hw = &pf->hw; in ice_get_tx_topo_user_sel()
564 * ice_update_tx_topo_user_sel - Save user's preference in flash
577 struct ice_hw *hw = &pf->hw; in ice_update_tx_topo_user_sel()
604 * ice_devlink_tx_sched_layers_get - Get tx_scheduling_layers parameter
617 err = ice_get_tx_topo_user_sel(pf, &ctx->val.vu8); in ice_devlink_tx_sched_layers_get()
625 * ice_devlink_tx_sched_layers_set - Set tx_scheduling_layers parameter
640 err = ice_update_tx_topo_user_sel(pf, ctx->val.vu8); in ice_devlink_tx_sched_layers_set()
651 * ice_devlink_tx_sched_layers_validate - Validate passed tx_scheduling_layers
659 * - 5 - five layers Tx Scheduler Topology Tree
660 * - 9 - nine layers Tx Scheduler Topology Tree
672 return -EINVAL; in ice_devlink_tx_sched_layers_validate()
679 * ice_tear_down_devlink_rate_tree - removes devlink-rate exported tree
693 mutex_lock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
695 if (vf->devlink_port.devlink_rate) in ice_tear_down_devlink_rate_tree()
696 devl_rate_leaf_destroy(&vf->devlink_port); in ice_tear_down_devlink_rate_tree()
698 mutex_unlock(&pf->vfs.table_lock); in ice_tear_down_devlink_rate_tree()
705 * ice_enable_custom_tx - try to enable custom Tx feature
709 * it's not possible to enable it, if DCB or ADQ is active.
713 struct ice_port_info *pi = ice_get_main_vsi(pf)->port_info; in ice_enable_custom_tx()
716 if (pi->is_custom_tx_enabled) in ice_enable_custom_tx()
726 dev_err(dev, "DCB active, can't modify Tx scheduler tree\n"); in ice_enable_custom_tx()
730 pi->is_custom_tx_enabled = true; in ice_enable_custom_tx()
736 * ice_traverse_tx_tree - traverse Tx scheduler tree
743 * entire structure to the devlink-rate.
753 if (node->rate_node) in ice_traverse_tx_tree()
757 if (node->parent == tc_node) { in ice_traverse_tx_tree()
759 rate_node = devl_rate_node_create(devlink, node, node->name, NULL); in ice_traverse_tx_tree()
760 } else if (node->vsi_handle && in ice_traverse_tx_tree()
761 pf->vsi[node->vsi_handle]->type == ICE_VSI_VF && in ice_traverse_tx_tree()
762 pf->vsi[node->vsi_handle]->vf) { in ice_traverse_tx_tree()
763 vf = pf->vsi[node->vsi_handle]->vf; in ice_traverse_tx_tree()
764 if (!vf->devlink_port.devlink_rate) in ice_traverse_tx_tree()
768 devl_rate_leaf_create(&vf->devlink_port, node, in ice_traverse_tx_tree()
769 node->parent->rate_node); in ice_traverse_tx_tree()
770 } else if (node->vsi_handle && in ice_traverse_tx_tree()
771 pf->vsi[node->vsi_handle]->type == ICE_VSI_SF && in ice_traverse_tx_tree()
772 pf->vsi[node->vsi_handle]->sf) { in ice_traverse_tx_tree()
773 sf = pf->vsi[node->vsi_handle]->sf; in ice_traverse_tx_tree()
774 if (!sf->devlink_port.devlink_rate) in ice_traverse_tx_tree()
778 devl_rate_leaf_create(&sf->devlink_port, node, in ice_traverse_tx_tree()
779 node->parent->rate_node); in ice_traverse_tx_tree()
780 } else if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF && in ice_traverse_tx_tree()
781 node->parent->rate_node) { in ice_traverse_tx_tree()
782 rate_node = devl_rate_node_create(devlink, node, node->name, in ice_traverse_tx_tree()
783 node->parent->rate_node); in ice_traverse_tx_tree()
787 node->rate_node = rate_node; in ice_traverse_tx_tree()
790 for (i = 0; i < node->num_children; i++) in ice_traverse_tx_tree()
791 ice_traverse_tx_tree(devlink, node->children[i], tc_node, pf); in ice_traverse_tx_tree()
795 * ice_devlink_rate_init_tx_topology - export Tx scheduler tree to devlink rate
804 struct ice_port_info *pi = vsi->port_info; in ice_devlink_rate_init_tx_topology()
806 struct ice_pf *pf = vsi->back; in ice_devlink_rate_init_tx_topology()
809 tc_node = pi->root->children[0]; in ice_devlink_rate_init_tx_topology()
810 mutex_lock(&pi->sched_lock); in ice_devlink_rate_init_tx_topology()
811 for (i = 0; i < tc_node->num_children; i++) in ice_devlink_rate_init_tx_topology()
812 ice_traverse_tx_tree(devlink, tc_node->children[i], tc_node, pf); in ice_devlink_rate_init_tx_topology()
813 mutex_unlock(&pi->sched_lock); in ice_devlink_rate_init_tx_topology()
820 node->rate_node = NULL; in ice_clear_rate_nodes()
822 for (int i = 0; i < node->num_children; i++) in ice_clear_rate_nodes()
823 ice_clear_rate_nodes(node->children[i]); in ice_clear_rate_nodes()
827 * ice_devlink_rate_clear_tx_topology - clear node->rate_node
835 struct ice_port_info *pi = vsi->port_info; in ice_devlink_rate_clear_tx_topology()
837 mutex_lock(&pi->sched_lock); in ice_devlink_rate_clear_tx_topology()
838 ice_clear_rate_nodes(pi->root->children[0]); in ice_devlink_rate_clear_tx_topology()
839 mutex_unlock(&pi->sched_lock); in ice_devlink_rate_clear_tx_topology()
843 * ice_set_object_tx_share - sets node scheduling parameter
856 mutex_lock(&pi->sched_lock); in ice_set_object_tx_share()
858 node->tx_share = div_u64(bw, 125); in ice_set_object_tx_share()
859 status = ice_sched_set_node_bw_lmt(pi, node, ICE_MIN_BW, node->tx_share); in ice_set_object_tx_share()
860 mutex_unlock(&pi->sched_lock); in ice_set_object_tx_share()
869 * ice_set_object_tx_max - sets node scheduling parameter
882 mutex_lock(&pi->sched_lock); in ice_set_object_tx_max()
884 node->tx_max = div_u64(bw, 125); in ice_set_object_tx_max()
885 status = ice_sched_set_node_bw_lmt(pi, node, ICE_MAX_BW, node->tx_max); in ice_set_object_tx_max()
886 mutex_unlock(&pi->sched_lock); in ice_set_object_tx_max()
895 * ice_set_object_tx_priority - sets node scheduling parameter
910 return -EINVAL; in ice_set_object_tx_priority()
913 mutex_lock(&pi->sched_lock); in ice_set_object_tx_priority()
914 node->tx_priority = priority; in ice_set_object_tx_priority()
915 status = ice_sched_set_node_priority(pi, node, node->tx_priority); in ice_set_object_tx_priority()
916 mutex_unlock(&pi->sched_lock); in ice_set_object_tx_priority()
925 * ice_set_object_tx_weight - sets node scheduling parameter
931 * This function sets node weight for WFQ algorithm.
940 return -EINVAL; in ice_set_object_tx_weight()
943 mutex_lock(&pi->sched_lock); in ice_set_object_tx_weight()
944 node->tx_weight = weight; in ice_set_object_tx_weight()
945 status = ice_sched_set_node_weight(pi, node, node->tx_weight); in ice_set_object_tx_weight()
946 mutex_unlock(&pi->sched_lock); in ice_set_object_tx_weight()
955 * ice_get_pi_from_dev_rate - get port info from devlink_rate
962 struct ice_pf *pf = devlink_priv(rate_node->devlink); in ice_get_pi_from_dev_rate()
964 return ice_get_main_vsi(pf)->port_info; in ice_get_pi_from_dev_rate()
975 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_new()
976 return -EBUSY; in ice_devlink_rate_node_new()
979 node = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*node), GFP_KERNEL); in ice_devlink_rate_node_new()
992 tc_node = pi->root->children[0]; in ice_devlink_rate_node_del()
995 if (!rate_node->parent || !node || tc_node == node || !extack) in ice_devlink_rate_node_del()
998 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_del()
999 return -EBUSY; in ice_devlink_rate_node_del()
1002 if (node->num_children) in ice_devlink_rate_node_del()
1003 return -EINVAL; in ice_devlink_rate_node_del()
1005 mutex_lock(&pi->sched_lock); in ice_devlink_rate_node_del()
1007 mutex_unlock(&pi->sched_lock); in ice_devlink_rate_node_del()
1017 if (!ice_enable_custom_tx(devlink_priv(rate_leaf->devlink))) in ice_devlink_rate_leaf_tx_max_set()
1018 return -EBUSY; in ice_devlink_rate_leaf_tx_max_set()
1032 if (!ice_enable_custom_tx(devlink_priv(rate_leaf->devlink))) in ice_devlink_rate_leaf_tx_share_set()
1033 return -EBUSY; in ice_devlink_rate_leaf_tx_share_set()
1047 if (!ice_enable_custom_tx(devlink_priv(rate_leaf->devlink))) in ice_devlink_rate_leaf_tx_priority_set()
1048 return -EBUSY; in ice_devlink_rate_leaf_tx_priority_set()
1062 if (!ice_enable_custom_tx(devlink_priv(rate_leaf->devlink))) in ice_devlink_rate_leaf_tx_weight_set()
1063 return -EBUSY; in ice_devlink_rate_leaf_tx_weight_set()
1077 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_tx_max_set()
1078 return -EBUSY; in ice_devlink_rate_node_tx_max_set()
1092 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_tx_share_set()
1093 return -EBUSY; in ice_devlink_rate_node_tx_share_set()
1107 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_tx_priority_set()
1108 return -EBUSY; in ice_devlink_rate_node_tx_priority_set()
1122 if (!ice_enable_custom_tx(devlink_priv(rate_node->devlink))) in ice_devlink_rate_node_tx_weight_set()
1123 return -EBUSY; in ice_devlink_rate_node_tx_weight_set()
1144 tc_node = pi->root->children[0]; in ice_devlink_set_parent()
1150 if (!ice_enable_custom_tx(devlink_priv(devlink_rate->devlink))) in ice_devlink_set_parent()
1151 return -EBUSY; in ice_devlink_set_parent()
1154 if (!node || tc_node == node || node->num_children) in ice_devlink_set_parent()
1155 return -EINVAL; in ice_devlink_set_parent()
1157 mutex_lock(&pi->sched_lock); in ice_devlink_set_parent()
1159 mutex_unlock(&pi->sched_lock); in ice_devlink_set_parent()
1167 if (!node->parent) { in ice_devlink_set_parent()
1168 mutex_lock(&pi->sched_lock); in ice_devlink_set_parent()
1170 parent_node->tx_sched_layer + 1, in ice_devlink_set_parent()
1173 mutex_unlock(&pi->sched_lock); in ice_devlink_set_parent()
1180 if (devlink_rate->tx_share) in ice_devlink_set_parent()
1181 ice_set_object_tx_share(pi, node, devlink_rate->tx_share, extack); in ice_devlink_set_parent()
1182 if (devlink_rate->tx_max) in ice_devlink_set_parent()
1183 ice_set_object_tx_max(pi, node, devlink_rate->tx_max, extack); in ice_devlink_set_parent()
1184 if (devlink_rate->tx_priority) in ice_devlink_set_parent()
1185 ice_set_object_tx_priority(pi, node, devlink_rate->tx_priority, extack); in ice_devlink_set_parent()
1186 if (devlink_rate->tx_weight) in ice_devlink_set_parent()
1187 ice_set_object_tx_weight(pi, node, devlink_rate->tx_weight, extack); in ice_devlink_set_parent()
1189 node_teid = le32_to_cpu(node->info.node_teid); in ice_devlink_set_parent()
1190 mutex_lock(&pi->sched_lock); in ice_devlink_set_parent()
1192 mutex_unlock(&pi->sched_lock); in ice_devlink_set_parent()
1202 * ice_devlink_reinit_up - do reinit of the given PF
1214 vsi->flags = ICE_VSI_FLAG_INIT; in ice_devlink_reinit_up()
1239 * ice_devlink_reload_up - do reload up after reinit
1264 return -EOPNOTSUPP; in ice_devlink_reload_up()
1306 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2 ? true : false; in ice_devlink_enable_roce_get()
1316 bool roce_ena = ctx->val.vbool; in ice_devlink_enable_roce_set()
1321 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1325 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1328 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_ROCEV2; in ice_devlink_enable_roce_set()
1340 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_roce_validate()
1341 return -EOPNOTSUPP; in ice_devlink_enable_roce_validate()
1343 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP) { in ice_devlink_enable_roce_validate()
1345 return -EOPNOTSUPP; in ice_devlink_enable_roce_validate()
1357 ctx->val.vbool = pf->rdma_mode & IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_get()
1367 bool iw_ena = ctx->val.vbool; in ice_devlink_enable_iw_set()
1372 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1376 pf->rdma_mode |= IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1379 pf->rdma_mode &= ~IIDC_RDMA_PROTOCOL_IWARP; in ice_devlink_enable_iw_set()
1391 if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) in ice_devlink_enable_iw_validate()
1392 return -EOPNOTSUPP; in ice_devlink_enable_iw_validate()
1394 if (pf->rdma_mode & IIDC_RDMA_PROTOCOL_ROCEV2) { in ice_devlink_enable_iw_validate()
1396 return -EOPNOTSUPP; in ice_devlink_enable_iw_validate()
1407 * ice_devlink_local_fwd_mode_to_str - Get string for local_fwd mode.
1428 * ice_devlink_local_fwd_str_to_mode - Get local_fwd mode from string name.
1442 return -EINVAL; in ice_devlink_local_fwd_str_to_mode()
1446 * ice_devlink_local_fwd_get - Get local_fwd parameter.
1460 pi = pf->hw.port_info; in ice_devlink_local_fwd_get()
1461 mode_str = ice_devlink_local_fwd_mode_to_str(pi->local_fwd_mode); in ice_devlink_local_fwd_get()
1462 snprintf(ctx->val.vstr, sizeof(ctx->val.vstr), "%s", mode_str); in ice_devlink_local_fwd_get()
1468 * ice_devlink_local_fwd_set - Set local_fwd parameter.
1480 int new_local_fwd_mode = ice_devlink_local_fwd_str_to_mode(ctx->val.vstr); in ice_devlink_local_fwd_set()
1485 pi = pf->hw.port_info; in ice_devlink_local_fwd_set()
1486 if (pi->local_fwd_mode != new_local_fwd_mode) { in ice_devlink_local_fwd_set()
1487 pi->local_fwd_mode = new_local_fwd_mode; in ice_devlink_local_fwd_set()
1488 dev_info(dev, "Setting local_fwd to %s\n", ctx->val.vstr); in ice_devlink_local_fwd_set()
1496 * ice_devlink_local_fwd_validate - Validate passed local_fwd parameter value.
1503 * "enabled" - local_fwd is enabled, "disabled" - local_fwd is disabled
1504 * "prioritized" - local_fwd traffic is prioritized in scheduling.
1515 return -EINVAL; in ice_devlink_local_fwd_validate()
1560 * ice_allocate_pf - Allocate devlink and return PF structure pointer
1583 * ice_allocate_sf - Allocate devlink and return SF structure pointer
1599 return ERR_PTR(-ENOMEM); in ice_allocate_sf()
1611 * ice_devlink_register - Register devlink interface for this PF
1626 * ice_devlink_unregister - Unregister devlink resources for this PF.
1639 struct ice_hw *hw = &pf->hw; in ice_devlink_register_params()
1647 if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) in ice_devlink_register_params()
1657 struct ice_hw *hw = &pf->hw; in ice_devlink_unregister_params()
1662 if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) in ice_devlink_unregister_params()
1673 * ice_devlink_nvm_snapshot - Capture a snapshot of the NVM flash contents
1680 * the nvm-flash or shadow-ram region.
1686 * @returns zero on success, and updates the data pointer. Returns a non-zero
1695 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_snapshot()
1704 nvm_size = hw->flash.flash_size; in ice_devlink_nvm_snapshot()
1707 nvm_size = hw->flash.sr_words * 2u; in ice_devlink_nvm_snapshot()
1710 return -EOPNOTSUPP; in ice_devlink_nvm_snapshot()
1715 return -ENOMEM; in ice_devlink_nvm_snapshot()
1733 status, hw->adminq.sq_last_status); in ice_devlink_nvm_snapshot()
1736 return -EIO; in ice_devlink_nvm_snapshot()
1743 read_sz, status, hw->adminq.sq_last_status); in ice_devlink_nvm_snapshot()
1747 return -EIO; in ice_devlink_nvm_snapshot()
1752 left -= read_sz; in ice_devlink_nvm_snapshot()
1761 * ice_devlink_nvm_read - Read a portion of NVM flash contents
1772 * It reads from either the nvm-flash or shadow-ram region contents.
1774 * @returns zero on success, and updates the data pointer. Returns a non-zero
1784 struct ice_hw *hw = &pf->hw; in ice_devlink_nvm_read()
1791 nvm_size = hw->flash.flash_size; in ice_devlink_nvm_read()
1794 nvm_size = hw->flash.sr_words * 2u; in ice_devlink_nvm_read()
1797 return -EOPNOTSUPP; in ice_devlink_nvm_read()
1802 return -ERANGE; in ice_devlink_nvm_read()
1808 status, hw->adminq.sq_last_status); in ice_devlink_nvm_read()
1810 return -EIO; in ice_devlink_nvm_read()
1817 size, status, hw->adminq.sq_last_status); in ice_devlink_nvm_read()
1820 return -EIO; in ice_devlink_nvm_read()
1828 * ice_devlink_devcaps_snapshot - Capture snapshot of device capabilities
1835 * the device-caps devlink region. It captures a snapshot of the device
1838 * @returns zero on success, and updates the data pointer. Returns a non-zero
1848 struct ice_hw *hw = &pf->hw; in ice_devlink_devcaps_snapshot()
1854 return -ENOMEM; in ice_devlink_devcaps_snapshot()
1860 status, hw->adminq.sq_last_status); in ice_devlink_devcaps_snapshot()
1872 .name = "nvm-flash",
1879 .name = "shadow-ram",
1886 .name = "device-caps",
1892 * ice_devlink_init_regions - Initialize devlink regions
1904 nvm_size = pf->hw.flash.flash_size; in ice_devlink_init_regions()
1905 pf->nvm_region = devl_region_create(devlink, &ice_nvm_region_ops, 1, in ice_devlink_init_regions()
1907 if (IS_ERR(pf->nvm_region)) { in ice_devlink_init_regions()
1909 PTR_ERR(pf->nvm_region)); in ice_devlink_init_regions()
1910 pf->nvm_region = NULL; in ice_devlink_init_regions()
1913 sram_size = pf->hw.flash.sr_words * 2u; in ice_devlink_init_regions()
1914 pf->sram_region = devl_region_create(devlink, &ice_sram_region_ops, in ice_devlink_init_regions()
1916 if (IS_ERR(pf->sram_region)) { in ice_devlink_init_regions()
1917 dev_err(dev, "failed to create shadow-ram devlink region, err %ld\n", in ice_devlink_init_regions()
1918 PTR_ERR(pf->sram_region)); in ice_devlink_init_regions()
1919 pf->sram_region = NULL; in ice_devlink_init_regions()
1922 pf->devcaps_region = devl_region_create(devlink, in ice_devlink_init_regions()
1925 if (IS_ERR(pf->devcaps_region)) { in ice_devlink_init_regions()
1926 dev_err(dev, "failed to create device-caps devlink region, err %ld\n", in ice_devlink_init_regions()
1927 PTR_ERR(pf->devcaps_region)); in ice_devlink_init_regions()
1928 pf->devcaps_region = NULL; in ice_devlink_init_regions()
1933 * ice_devlink_destroy_regions - Destroy devlink regions
1940 if (pf->nvm_region) in ice_devlink_destroy_regions()
1941 devl_region_destroy(pf->nvm_region); in ice_devlink_destroy_regions()
1943 if (pf->sram_region) in ice_devlink_destroy_regions()
1944 devl_region_destroy(pf->sram_region); in ice_devlink_destroy_regions()
1946 if (pf->devcaps_region) in ice_devlink_destroy_regions()
1947 devl_region_destroy(pf->devcaps_region); in ice_devlink_destroy_regions()