- if (ice_dcf_execute_virtchnl_cmd(&dcf_adapter->real_hw, &vc_cmd))
- goto pkg_file_direct;
-
- rte_memcpy(&dsn, pkg_info.dsn, sizeof(dsn));
-
- snprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,
- ICE_PKG_FILE_SEARCH_PATH_UPDATES "ice-%016llx.pkg",
- (unsigned long long)dsn);
- if (!ice_access(pkg_name, 0))
- return 0;
-
- snprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,
- ICE_PKG_FILE_SEARCH_PATH_DEFAULT "ice-%016llx.pkg",
- (unsigned long long)dsn);
- if (!ice_access(pkg_name, 0))
- return 0;
-
-pkg_file_direct:
- snprintf(pkg_name,
- ICE_MAX_PKG_FILENAME_SIZE, "%s", ICE_PKG_FILE_UPDATES);
- if (!ice_access(pkg_name, 0))
- return 0;
-
- snprintf(pkg_name,
- ICE_MAX_PKG_FILENAME_SIZE, "%s", ICE_PKG_FILE_DEFAULT);
- if (!ice_access(pkg_name, 0))
- return 0;
-
- return -1;
-}
-
-static int
-ice_dcf_load_pkg(struct ice_hw *hw)
-{
- char pkg_name[ICE_MAX_PKG_FILENAME_SIZE];
- uint8_t *pkg_buf;
- uint32_t buf_len;
- struct stat st;
- FILE *fp;
- int err;
-
- if (ice_dcf_request_pkg_name(hw, pkg_name)) {
- PMD_INIT_LOG(ERR, "Failed to locate the package file");
- return -ENOENT;
- }
-
- PMD_INIT_LOG(DEBUG, "DDP package name: %s", pkg_name);
-
- err = stat(pkg_name, &st);
- if (err) {
- PMD_INIT_LOG(ERR, "Failed to get file status");
- return err;
- }
-
- buf_len = st.st_size;
- pkg_buf = rte_malloc(NULL, buf_len, 0);
- if (!pkg_buf) {
- PMD_INIT_LOG(ERR, "failed to allocate buffer of size %u for package",
- buf_len);
- return -1;
- }
-
- fp = fopen(pkg_name, "rb");
- if (!fp) {
- PMD_INIT_LOG(ERR, "failed to open file: %s", pkg_name);
- err = -1;
- goto ret;
- }
-
- err = fread(pkg_buf, buf_len, 1, fp);
- fclose(fp);
- if (err != 1) {
- PMD_INIT_LOG(ERR, "failed to read package data");
- err = -1;
- goto ret;
- }