1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020, Intel Corporation. */
6 #include "ice_devlink.h"
7 #include "ice_eswitch.h"
8 #include "ice_fw_update.h"
10 /* context for devlink info version reporting */
13 struct ice_orom_info pending_orom;
14 struct ice_nvm_info pending_nvm;
15 struct ice_netlist_info pending_netlist;
16 struct ice_hw_dev_caps dev_caps;
19 /* The following functions are used to format specific strings for various
20 * devlink info versions. The ctx parameter is used to provide the storage
21 * buffer, as well as any ancillary information calculated when the info
24 * If a version does not exist, for example when attempting to get the
25 * inactive version of flash when there is no pending update, the function
26 * should leave the buffer in the ctx structure empty.
29 static void ice_info_get_dsn(struct ice_pf *pf, struct ice_info_ctx *ctx)
33 /* Copy the DSN into an array in Big Endian format */
34 put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
36 snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
39 static void ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx)
41 struct ice_hw *hw = &pf->hw;
42 enum ice_status status;
44 status = ice_read_pba_string(hw, (u8 *)ctx->buf, sizeof(ctx->buf));
46 /* We failed to locate the PBA, so just skip this entry */
47 dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %s\n",
48 ice_stat_str(status));
51 static void ice_info_fw_mgmt(struct ice_pf *pf, struct ice_info_ctx *ctx)
53 struct ice_hw *hw = &pf->hw;
55 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
56 hw->fw_maj_ver, hw->fw_min_ver, hw->fw_patch);
59 static void ice_info_fw_api(struct ice_pf *pf, struct ice_info_ctx *ctx)
61 struct ice_hw *hw = &pf->hw;
63 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", hw->api_maj_ver,
64 hw->api_min_ver, hw->api_patch);
67 static void ice_info_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx)
69 struct ice_hw *hw = &pf->hw;
71 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build);
74 static void ice_info_orom_ver(struct ice_pf *pf, struct ice_info_ctx *ctx)
76 struct ice_orom_info *orom = &pf->hw.flash.orom;
78 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
79 orom->major, orom->build, orom->patch);
83 ice_info_pending_orom_ver(struct ice_pf __always_unused *pf,
84 struct ice_info_ctx *ctx)
86 struct ice_orom_info *orom = &ctx->pending_orom;
88 if (ctx->dev_caps.common_cap.nvm_update_pending_orom)
89 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
90 orom->major, orom->build, orom->patch);
93 static void ice_info_nvm_ver(struct ice_pf *pf, struct ice_info_ctx *ctx)
95 struct ice_nvm_info *nvm = &pf->hw.flash.nvm;
97 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor);
101 ice_info_pending_nvm_ver(struct ice_pf __always_unused *pf,
102 struct ice_info_ctx *ctx)
104 struct ice_nvm_info *nvm = &ctx->pending_nvm;
106 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm)
107 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x",
108 nvm->major, nvm->minor);
111 static void ice_info_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx)
113 struct ice_nvm_info *nvm = &pf->hw.flash.nvm;
115 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm->eetrack);
119 ice_info_pending_eetrack(struct ice_pf *pf, struct ice_info_ctx *ctx)
121 struct ice_nvm_info *nvm = &ctx->pending_nvm;
123 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm)
124 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm->eetrack);
127 static void ice_info_ddp_pkg_name(struct ice_pf *pf, struct ice_info_ctx *ctx)
129 struct ice_hw *hw = &pf->hw;
131 snprintf(ctx->buf, sizeof(ctx->buf), "%s", hw->active_pkg_name);
135 ice_info_ddp_pkg_version(struct ice_pf *pf, struct ice_info_ctx *ctx)
137 struct ice_pkg_ver *pkg = &pf->hw.active_pkg_ver;
139 snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u.%u",
140 pkg->major, pkg->minor, pkg->update, pkg->draft);
144 ice_info_ddp_pkg_bundle_id(struct ice_pf *pf, struct ice_info_ctx *ctx)
146 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", pf->hw.active_track_id);
149 static void ice_info_netlist_ver(struct ice_pf *pf, struct ice_info_ctx *ctx)
151 struct ice_netlist_info *netlist = &pf->hw.flash.netlist;
153 /* The netlist version fields are BCD formatted */
154 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x",
155 netlist->major, netlist->minor,
156 netlist->type >> 16, netlist->type & 0xFFFF,
157 netlist->rev, netlist->cust_ver);
160 static void ice_info_netlist_build(struct ice_pf *pf, struct ice_info_ctx *ctx)
162 struct ice_netlist_info *netlist = &pf->hw.flash.netlist;
164 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash);
168 ice_info_pending_netlist_ver(struct ice_pf __always_unused *pf,
169 struct ice_info_ctx *ctx)
171 struct ice_netlist_info *netlist = &ctx->pending_netlist;
173 /* The netlist version fields are BCD formatted */
174 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist)
175 snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x-%x.%x.%x",
176 netlist->major, netlist->minor,
177 netlist->type >> 16, netlist->type & 0xFFFF,
178 netlist->rev, netlist->cust_ver);
182 ice_info_pending_netlist_build(struct ice_pf __always_unused *pf,
183 struct ice_info_ctx *ctx)
185 struct ice_netlist_info *netlist = &ctx->pending_netlist;
187 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist)
188 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash);
191 #define fixed(key, getter) { ICE_VERSION_FIXED, key, getter, NULL }
192 #define running(key, getter) { ICE_VERSION_RUNNING, key, getter, NULL }
193 #define stored(key, getter, fallback) { ICE_VERSION_STORED, key, getter, fallback }
195 /* The combined() macro inserts both the running entry as well as a stored
196 * entry. The running entry will always report the version from the active
197 * handler. The stored entry will first try the pending handler, and fallback
198 * to the active handler if the pending function does not report a version.
199 * The pending handler should check the status of a pending update for the
200 * relevant flash component. It should only fill in the buffer in the case
201 * where a valid pending version is available. This ensures that the related
202 * stored and running versions remain in sync, and that stored versions are
203 * correctly reported as expected.
205 #define combined(key, active, pending) \
206 running(key, active), \
207 stored(key, pending, active)
209 enum ice_version_type {
215 static const struct ice_devlink_version {
216 enum ice_version_type type;
218 void (*getter)(struct ice_pf *pf, struct ice_info_ctx *ctx);
219 void (*fallback)(struct ice_pf *pf, struct ice_info_ctx *ctx);
220 } ice_devlink_versions[] = {
221 fixed(DEVLINK_INFO_VERSION_GENERIC_BOARD_ID, ice_info_pba),
222 running(DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, ice_info_fw_mgmt),
223 running("fw.mgmt.api", ice_info_fw_api),
224 running("fw.mgmt.build", ice_info_fw_build),
225 combined(DEVLINK_INFO_VERSION_GENERIC_FW_UNDI, ice_info_orom_ver, ice_info_pending_orom_ver),
226 combined("fw.psid.api", ice_info_nvm_ver, ice_info_pending_nvm_ver),
227 combined(DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID, ice_info_eetrack, ice_info_pending_eetrack),
228 running("fw.app.name", ice_info_ddp_pkg_name),
229 running(DEVLINK_INFO_VERSION_GENERIC_FW_APP, ice_info_ddp_pkg_version),
230 running("fw.app.bundle_id", ice_info_ddp_pkg_bundle_id),
231 combined("fw.netlist", ice_info_netlist_ver, ice_info_pending_netlist_ver),
232 combined("fw.netlist.build", ice_info_netlist_build, ice_info_pending_netlist_build),
236 * ice_devlink_info_get - .info_get devlink handler
237 * @devlink: devlink instance structure
238 * @req: the devlink info request
239 * @extack: extended netdev ack structure
241 * Callback for the devlink .info_get operation. Reports information about the
244 * Return: zero on success or an error code on failure.
246 static int ice_devlink_info_get(struct devlink *devlink,
247 struct devlink_info_req *req,
248 struct netlink_ext_ack *extack)
250 struct ice_pf *pf = devlink_priv(devlink);
251 struct device *dev = ice_pf_to_dev(pf);
252 struct ice_hw *hw = &pf->hw;
253 struct ice_info_ctx *ctx;
254 enum ice_status status;
258 err = ice_wait_for_reset(pf, 10 * HZ);
260 NL_SET_ERR_MSG_MOD(extack, "Device is busy resetting");
264 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
268 /* discover capabilities first */
269 status = ice_discover_dev_caps(hw, &ctx->dev_caps);
271 dev_dbg(dev, "Failed to discover device capabilities, status %s aq_err %s\n",
272 ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
273 NL_SET_ERR_MSG_MOD(extack, "Unable to discover device capabilities");
278 if (ctx->dev_caps.common_cap.nvm_update_pending_orom) {
279 status = ice_get_inactive_orom_ver(hw, &ctx->pending_orom);
281 dev_dbg(dev, "Unable to read inactive Option ROM version data, status %s aq_err %s\n",
282 ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
284 /* disable display of pending Option ROM */
285 ctx->dev_caps.common_cap.nvm_update_pending_orom = false;
289 if (ctx->dev_caps.common_cap.nvm_update_pending_nvm) {
290 status = ice_get_inactive_nvm_ver(hw, &ctx->pending_nvm);
292 dev_dbg(dev, "Unable to read inactive NVM version data, status %s aq_err %s\n",
293 ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
295 /* disable display of pending Option ROM */
296 ctx->dev_caps.common_cap.nvm_update_pending_nvm = false;
300 if (ctx->dev_caps.common_cap.nvm_update_pending_netlist) {
301 status = ice_get_inactive_netlist_ver(hw, &ctx->pending_netlist);
303 dev_dbg(dev, "Unable to read inactive Netlist version data, status %s aq_err %s\n",
304 ice_stat_str(status), ice_aq_str(hw->adminq.sq_last_status));
306 /* disable display of pending Option ROM */
307 ctx->dev_caps.common_cap.nvm_update_pending_netlist = false;
311 err = devlink_info_driver_name_put(req, KBUILD_MODNAME);
313 NL_SET_ERR_MSG_MOD(extack, "Unable to set driver name");
317 ice_info_get_dsn(pf, ctx);
319 err = devlink_info_serial_number_put(req, ctx->buf);
321 NL_SET_ERR_MSG_MOD(extack, "Unable to set serial number");
325 for (i = 0; i < ARRAY_SIZE(ice_devlink_versions); i++) {
326 enum ice_version_type type = ice_devlink_versions[i].type;
327 const char *key = ice_devlink_versions[i].key;
329 memset(ctx->buf, 0, sizeof(ctx->buf));
331 ice_devlink_versions[i].getter(pf, ctx);
333 /* If the default getter doesn't report a version, use the
334 * fallback function. This is primarily useful in the case of
335 * "stored" versions that want to report the same value as the
336 * running version in the normal case of no pending update.
338 if (ctx->buf[0] == '\0' && ice_devlink_versions[i].fallback)
339 ice_devlink_versions[i].fallback(pf, ctx);
341 /* Do not report missing versions */
342 if (ctx->buf[0] == '\0')
346 case ICE_VERSION_FIXED:
347 err = devlink_info_version_fixed_put(req, key, ctx->buf);
349 NL_SET_ERR_MSG_MOD(extack, "Unable to set fixed version");
353 case ICE_VERSION_RUNNING:
354 err = devlink_info_version_running_put(req, key, ctx->buf);
356 NL_SET_ERR_MSG_MOD(extack, "Unable to set running version");
360 case ICE_VERSION_STORED:
361 err = devlink_info_version_stored_put(req, key, ctx->buf);
363 NL_SET_ERR_MSG_MOD(extack, "Unable to set stored version");
376 * ice_devlink_flash_update - Update firmware stored in flash on the device
377 * @devlink: pointer to devlink associated with device to update
378 * @params: flash update parameters
379 * @extack: netlink extended ACK structure
381 * Perform a device flash update. The bulk of the update logic is contained
382 * within the ice_flash_pldm_image function.
384 * Returns: zero on success, or an error code on failure.
387 ice_devlink_flash_update(struct devlink *devlink,
388 struct devlink_flash_update_params *params,
389 struct netlink_ext_ack *extack)
391 struct ice_pf *pf = devlink_priv(devlink);
392 struct ice_hw *hw = &pf->hw;
396 if (!params->overwrite_mask) {
397 /* preserve all settings and identifiers */
398 preservation = ICE_AQC_NVM_PRESERVE_ALL;
399 } else if (params->overwrite_mask == DEVLINK_FLASH_OVERWRITE_SETTINGS) {
400 /* overwrite settings, but preserve the vital device identifiers */
401 preservation = ICE_AQC_NVM_PRESERVE_SELECTED;
402 } else if (params->overwrite_mask == (DEVLINK_FLASH_OVERWRITE_SETTINGS |
403 DEVLINK_FLASH_OVERWRITE_IDENTIFIERS)) {
404 /* overwrite both settings and identifiers, preserve nothing */
405 preservation = ICE_AQC_NVM_NO_PRESERVATION;
407 NL_SET_ERR_MSG_MOD(extack, "Requested overwrite mask is not supported");
411 if (!hw->dev_caps.common_cap.nvm_unified_update) {
412 NL_SET_ERR_MSG_MOD(extack, "Current firmware does not support unified update");
416 err = ice_check_for_pending_update(pf, NULL, extack);
420 devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0);
422 return ice_flash_pldm_image(pf, params->fw, preservation, extack);
425 static const struct devlink_ops ice_devlink_ops = {
426 .supported_flash_update_params = DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK,
427 .eswitch_mode_get = ice_eswitch_mode_get,
428 .eswitch_mode_set = ice_eswitch_mode_set,
429 .info_get = ice_devlink_info_get,
430 .flash_update = ice_devlink_flash_update,
433 static void ice_devlink_free(void *devlink_ptr)
435 devlink_free((struct devlink *)devlink_ptr);
439 * ice_allocate_pf - Allocate devlink and return PF structure pointer
440 * @dev: the device to allocate for
442 * Allocate a devlink instance for this device and return the private area as
443 * the PF structure. The devlink memory is kept track of through devres by
444 * adding an action to remove it when unwinding.
446 struct ice_pf *ice_allocate_pf(struct device *dev)
448 struct devlink *devlink;
450 devlink = devlink_alloc(&ice_devlink_ops, sizeof(struct ice_pf), dev);
454 /* Add an action to teardown the devlink when unwinding the driver */
455 if (devm_add_action_or_reset(dev, ice_devlink_free, devlink))
458 return devlink_priv(devlink);
462 * ice_devlink_register - Register devlink interface for this PF
463 * @pf: the PF to register the devlink for.
465 * Register the devlink instance associated with this physical function.
467 * Return: zero on success or an error code on failure.
469 void ice_devlink_register(struct ice_pf *pf)
471 struct devlink *devlink = priv_to_devlink(pf);
473 devlink_register(devlink);
477 * ice_devlink_unregister - Unregister devlink resources for this PF.
478 * @pf: the PF structure to cleanup
480 * Releases resources used by devlink and cleans up associated memory.
482 void ice_devlink_unregister(struct ice_pf *pf)
484 devlink_unregister(priv_to_devlink(pf));
488 * ice_devlink_create_pf_port - Create a devlink port for this PF
489 * @pf: the PF to create a devlink port for
491 * Create and register a devlink_port for this PF.
493 * Return: zero on success or an error code on failure.
495 int ice_devlink_create_pf_port(struct ice_pf *pf)
497 struct devlink_port_attrs attrs = {};
498 struct devlink_port *devlink_port;
499 struct devlink *devlink;
504 dev = ice_pf_to_dev(pf);
506 devlink_port = &pf->devlink_port;
508 vsi = ice_get_main_vsi(pf);
512 attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
513 attrs.phys.port_number = pf->hw.bus.func;
514 devlink_port_attrs_set(devlink_port, &attrs);
515 devlink = priv_to_devlink(pf);
517 err = devlink_port_register(devlink, devlink_port, vsi->idx);
519 dev_err(dev, "Failed to create devlink port for PF %d, error %d\n",
528 * ice_devlink_destroy_pf_port - Destroy the devlink_port for this PF
529 * @pf: the PF to cleanup
531 * Unregisters the devlink_port structure associated with this PF.
533 void ice_devlink_destroy_pf_port(struct ice_pf *pf)
535 struct devlink_port *devlink_port;
537 devlink_port = &pf->devlink_port;
539 devlink_port_type_clear(devlink_port);
540 devlink_port_unregister(devlink_port);
544 * ice_devlink_create_vf_port - Create a devlink port for this VF
545 * @vf: the VF to create a port for
547 * Create and register a devlink_port for this VF.
549 * Return: zero on success or an error code on failure.
551 int ice_devlink_create_vf_port(struct ice_vf *vf)
553 struct devlink_port_attrs attrs = {};
554 struct devlink_port *devlink_port;
555 struct devlink *devlink;
562 dev = ice_pf_to_dev(pf);
563 vsi = ice_get_vf_vsi(vf);
564 devlink_port = &vf->devlink_port;
566 attrs.flavour = DEVLINK_PORT_FLAVOUR_PCI_VF;
567 attrs.pci_vf.pf = pf->hw.bus.func;
568 attrs.pci_vf.vf = vf->vf_id;
570 devlink_port_attrs_set(devlink_port, &attrs);
571 devlink = priv_to_devlink(pf);
573 err = devlink_port_register(devlink, devlink_port, vsi->idx);
575 dev_err(dev, "Failed to create devlink port for VF %d, error %d\n",
584 * ice_devlink_destroy_vf_port - Destroy the devlink_port for this VF
585 * @vf: the VF to cleanup
587 * Unregisters the devlink_port structure associated with this VF.
589 void ice_devlink_destroy_vf_port(struct ice_vf *vf)
591 struct devlink_port *devlink_port;
593 devlink_port = &vf->devlink_port;
595 devlink_port_type_clear(devlink_port);
596 devlink_port_unregister(devlink_port);
600 * ice_devlink_nvm_snapshot - Capture a snapshot of the Shadow RAM contents
601 * @devlink: the devlink instance
602 * @ops: the devlink region being snapshotted
603 * @extack: extended ACK response structure
604 * @data: on exit points to snapshot data buffer
606 * This function is called in response to the DEVLINK_CMD_REGION_TRIGGER for
607 * the shadow-ram devlink region. It captures a snapshot of the shadow ram
608 * contents. This snapshot can later be viewed via the devlink-region
611 * @returns zero on success, and updates the data pointer. Returns a non-zero
612 * error code on failure.
614 static int ice_devlink_nvm_snapshot(struct devlink *devlink,
615 const struct devlink_region_ops *ops,
616 struct netlink_ext_ack *extack, u8 **data)
618 struct ice_pf *pf = devlink_priv(devlink);
619 struct device *dev = ice_pf_to_dev(pf);
620 struct ice_hw *hw = &pf->hw;
621 enum ice_status status;
625 nvm_size = hw->flash.flash_size;
626 nvm_data = vzalloc(nvm_size);
630 status = ice_acquire_nvm(hw, ICE_RES_READ);
632 dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n",
633 status, hw->adminq.sq_last_status);
634 NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
639 status = ice_read_flat_nvm(hw, 0, &nvm_size, nvm_data, false);
641 dev_dbg(dev, "ice_read_flat_nvm failed after reading %u bytes, err %d aq_err %d\n",
642 nvm_size, status, hw->adminq.sq_last_status);
643 NL_SET_ERR_MSG_MOD(extack, "Failed to read NVM contents");
657 * ice_devlink_devcaps_snapshot - Capture snapshot of device capabilities
658 * @devlink: the devlink instance
659 * @ops: the devlink region being snapshotted
660 * @extack: extended ACK response structure
661 * @data: on exit points to snapshot data buffer
663 * This function is called in response to the DEVLINK_CMD_REGION_TRIGGER for
664 * the device-caps devlink region. It captures a snapshot of the device
665 * capabilities reported by firmware.
667 * @returns zero on success, and updates the data pointer. Returns a non-zero
668 * error code on failure.
671 ice_devlink_devcaps_snapshot(struct devlink *devlink,
672 const struct devlink_region_ops *ops,
673 struct netlink_ext_ack *extack, u8 **data)
675 struct ice_pf *pf = devlink_priv(devlink);
676 struct device *dev = ice_pf_to_dev(pf);
677 struct ice_hw *hw = &pf->hw;
678 enum ice_status status;
681 devcaps = vzalloc(ICE_AQ_MAX_BUF_LEN);
685 status = ice_aq_list_caps(hw, devcaps, ICE_AQ_MAX_BUF_LEN, NULL,
686 ice_aqc_opc_list_dev_caps, NULL);
688 dev_dbg(dev, "ice_aq_list_caps: failed to read device capabilities, err %d aq_err %d\n",
689 status, hw->adminq.sq_last_status);
690 NL_SET_ERR_MSG_MOD(extack, "Failed to read device capabilities");
695 *data = (u8 *)devcaps;
700 static const struct devlink_region_ops ice_nvm_region_ops = {
703 .snapshot = ice_devlink_nvm_snapshot,
706 static const struct devlink_region_ops ice_devcaps_region_ops = {
707 .name = "device-caps",
709 .snapshot = ice_devlink_devcaps_snapshot,
713 * ice_devlink_init_regions - Initialize devlink regions
714 * @pf: the PF device structure
716 * Create devlink regions used to enable access to dump the contents of the
717 * flash memory on the device.
719 void ice_devlink_init_regions(struct ice_pf *pf)
721 struct devlink *devlink = priv_to_devlink(pf);
722 struct device *dev = ice_pf_to_dev(pf);
725 nvm_size = pf->hw.flash.flash_size;
726 pf->nvm_region = devlink_region_create(devlink, &ice_nvm_region_ops, 1,
728 if (IS_ERR(pf->nvm_region)) {
729 dev_err(dev, "failed to create NVM devlink region, err %ld\n",
730 PTR_ERR(pf->nvm_region));
731 pf->nvm_region = NULL;
734 pf->devcaps_region = devlink_region_create(devlink,
735 &ice_devcaps_region_ops, 10,
737 if (IS_ERR(pf->devcaps_region)) {
738 dev_err(dev, "failed to create device-caps devlink region, err %ld\n",
739 PTR_ERR(pf->devcaps_region));
740 pf->devcaps_region = NULL;
745 * ice_devlink_destroy_regions - Destroy devlink regions
746 * @pf: the PF device structure
748 * Remove previously created regions for this PF.
750 void ice_devlink_destroy_regions(struct ice_pf *pf)
753 devlink_region_destroy(pf->nvm_region);
754 if (pf->devcaps_region)
755 devlink_region_destroy(pf->devcaps_region);