Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/93855/?format=api
http://patches.dpdk.org/api/patches/93855/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210603165512.7357-2-david.marchand@redhat.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20210603165512.7357-2-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210603165512.7357-2-david.marchand@redhat.com", "date": "2021-06-03T16:55:11", "name": "[v2,1/2] net/ice: factorize firmware loading", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "acd46ab6e1934796fadcf3c85c3cb7d5777a35e2", "submitter": { "id": 1173, "url": "http://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210603165512.7357-2-david.marchand@redhat.com/mbox/", "series": [ { "id": 17228, "url": "http://patches.dpdk.org/api/series/17228/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=17228", "date": "2021-06-03T16:55:10", "name": "Support compressed firmwares", "version": 2, "mbox": "http://patches.dpdk.org/series/17228/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/93855/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/93855/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2EE3EA0A0C;\n\tThu, 3 Jun 2021 18:55:41 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 07202410E7;\n\tThu, 3 Jun 2021 18:55:37 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 6C4E1410E5\n for <dev@dpdk.org>; Thu, 3 Jun 2021 18:55:36 +0200 (CEST)", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-496-E8zG4oTLMLut0WjlGIwxAQ-1; Thu, 03 Jun 2021 12:55:34 -0400", "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 538181009461;\n Thu, 3 Jun 2021 16:55:33 +0000 (UTC)", "from dmarchan.remote.csb (unknown [10.40.193.172])\n by smtp.corp.redhat.com (Postfix) with ESMTP id BB0595D9F2;\n Thu, 3 Jun 2021 16:55:31 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1622739336;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=bVXse72thaudOt56LqRwaH31hc3Q/ogOXea1Dym4xJk=;\n b=GcIh8xcLY4zIocs7fBezoymFja97YUHJbLDdYxwQM83w8JDNwzOa0sH1Uik4FRWjnZYgrS\n 1ohewozgPi1A3QImxtVe9+qmvHscK+dN6RzMrQCeh2pX2AmLjrIuJ+5VynkgDYhlj3JUdZ\n o0Md5PkBmx7nGdpuFpCMHaRVXYhZdHA=", "X-MC-Unique": "E8zG4oTLMLut0WjlGIwxAQ-1", "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "Qiming Yang <qiming.yang@intel.com>,\n\tQi Zhang <qi.z.zhang@intel.com>", "Date": "Thu, 3 Jun 2021 18:55:11 +0200", "Message-Id": "<20210603165512.7357-2-david.marchand@redhat.com>", "In-Reply-To": "<20210603165512.7357-1-david.marchand@redhat.com>", "References": "<20210602095836.24901-1-david.marchand@redhat.com>\n <20210603165512.7357-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14", "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"", "Subject": "[dpdk-dev] [PATCH v2 1/2] net/ice: factorize firmware loading", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Both \"normal\" and \"dcf\" inits have their copy of some firmware loading\ncode.\n\nThe DSN query is moved in specific parts for the \"normal\" and \"dcf\" init.\n\nA common helper ice_load_pkg is then introduced and takes an adapter\npointer as its main input.\n\nThis helper takes care of finding the right firmware file and loading\nit.\nThe adapter active_pkg_type field is set by this helper.\n\nThe ice_access macro is removed from the osdep.h header: osdep.h should\nonly hosts wrappers for base driver code.\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n drivers/net/ice/base/ice_osdep.h | 6 --\n drivers/net/ice/ice_dcf_parent.c | 97 ++-----------------\n drivers/net/ice/ice_ethdev.c | 161 +++++++++++++++----------------\n drivers/net/ice/ice_ethdev.h | 3 +-\n 4 files changed, 88 insertions(+), 179 deletions(-)", "diff": "diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h\nindex 878c5597d4..78093adb00 100644\n--- a/drivers/net/ice/base/ice_osdep.h\n+++ b/drivers/net/ice/base/ice_osdep.h\n@@ -74,12 +74,6 @@ typedef uint64_t s64;\n #define min(a, b) RTE_MIN(a, b)\n #define max(a, b) RTE_MAX(a, b)\n \n-#ifdef RTE_EXEC_ENV_WINDOWS\n-#define ice_access _access\n-#else\n-#define ice_access access\n-#endif\n-\n #define FIELD_SIZEOF(t, f) RTE_SIZEOF_FIELD(t, f)\n #define ARRAY_SIZE(arr) RTE_DIM(arr)\n \ndiff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c\nindex 1d7aa8bc87..a30cfefaaf 100644\n--- a/drivers/net/ice/ice_dcf_parent.c\n+++ b/drivers/net/ice/ice_dcf_parent.c\n@@ -298,13 +298,14 @@ static void ice_dcf_uninit_parent_hw(struct ice_hw *hw)\n }\n \n static int\n-ice_dcf_request_pkg_name(struct ice_hw *hw, char *pkg_name)\n+ice_dcf_load_pkg(struct ice_adapter *adapter)\n {\n \tstruct ice_dcf_adapter *dcf_adapter =\n-\t\t\tcontainer_of(hw, struct ice_dcf_adapter, parent.hw);\n+\t\t\tcontainer_of(&adapter->hw, struct ice_dcf_adapter, parent.hw);\n \tstruct virtchnl_pkg_info pkg_info;\n \tstruct dcf_virtchnl_cmd vc_cmd;\n-\tuint64_t dsn;\n+\tbool use_dsn;\n+\tuint64_t dsn = 0;\n \n \tvc_cmd.v_op = VIRTCHNL_OP_DCF_GET_PKG_INFO;\n \tvc_cmd.req_msglen = 0;\n@@ -312,90 +313,11 @@ ice_dcf_request_pkg_name(struct ice_hw *hw, char *pkg_name)\n \tvc_cmd.rsp_buflen = sizeof(pkg_info);\n \tvc_cmd.rsp_msgbuf = (uint8_t *)&pkg_info;\n \n-\tif (ice_dcf_execute_virtchnl_cmd(&dcf_adapter->real_hw, &vc_cmd))\n-\t\tgoto pkg_file_direct;\n+\tuse_dsn = ice_dcf_execute_virtchnl_cmd(&dcf_adapter->real_hw, &vc_cmd) == 0;\n+\tif (use_dsn)\n+\t\trte_memcpy(&dsn, pkg_info.dsn, sizeof(dsn));\n \n-\trte_memcpy(&dsn, pkg_info.dsn, sizeof(dsn));\n-\n-\tsnprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,\n-\t\t ICE_PKG_FILE_SEARCH_PATH_UPDATES \"ice-%016llx.pkg\",\n-\t\t (unsigned long long)dsn);\n-\tif (!ice_access(pkg_name, 0))\n-\t\treturn 0;\n-\n-\tsnprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,\n-\t\t ICE_PKG_FILE_SEARCH_PATH_DEFAULT \"ice-%016llx.pkg\",\n-\t\t (unsigned long long)dsn);\n-\tif (!ice_access(pkg_name, 0))\n-\t\treturn 0;\n-\n-pkg_file_direct:\n-\tsnprintf(pkg_name,\n-\t\t ICE_MAX_PKG_FILENAME_SIZE, \"%s\", ICE_PKG_FILE_UPDATES);\n-\tif (!ice_access(pkg_name, 0))\n-\t\treturn 0;\n-\n-\tsnprintf(pkg_name,\n-\t\t ICE_MAX_PKG_FILENAME_SIZE, \"%s\", ICE_PKG_FILE_DEFAULT);\n-\tif (!ice_access(pkg_name, 0))\n-\t\treturn 0;\n-\n-\treturn -1;\n-}\n-\n-static int\n-ice_dcf_load_pkg(struct ice_hw *hw)\n-{\n-\tchar pkg_name[ICE_MAX_PKG_FILENAME_SIZE];\n-\tuint8_t *pkg_buf;\n-\tuint32_t buf_len;\n-\tstruct stat st;\n-\tFILE *fp;\n-\tint err;\n-\n-\tif (ice_dcf_request_pkg_name(hw, pkg_name)) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to locate the package file\");\n-\t\treturn -ENOENT;\n-\t}\n-\n-\tPMD_INIT_LOG(DEBUG, \"DDP package name: %s\", pkg_name);\n-\n-\terr = stat(pkg_name, &st);\n-\tif (err) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to get file status\");\n-\t\treturn err;\n-\t}\n-\n-\tbuf_len = st.st_size;\n-\tpkg_buf = rte_malloc(NULL, buf_len, 0);\n-\tif (!pkg_buf) {\n-\t\tPMD_INIT_LOG(ERR, \"failed to allocate buffer of size %u for package\",\n-\t\t\t buf_len);\n-\t\treturn -1;\n-\t}\n-\n-\tfp = fopen(pkg_name, \"rb\");\n-\tif (!fp) {\n-\t\tPMD_INIT_LOG(ERR, \"failed to open file: %s\", pkg_name);\n-\t\terr = -1;\n-\t\tgoto ret;\n-\t}\n-\n-\terr = fread(pkg_buf, buf_len, 1, fp);\n-\tfclose(fp);\n-\tif (err != 1) {\n-\t\tPMD_INIT_LOG(ERR, \"failed to read package data\");\n-\t\terr = -1;\n-\t\tgoto ret;\n-\t}\n-\n-\terr = ice_copy_and_init_pkg(hw, pkg_buf, buf_len);\n-\tif (err)\n-\t\tPMD_INIT_LOG(ERR, \"ice_copy_and_init_hw failed: %d\", err);\n-\n-ret:\n-\trte_free(pkg_buf);\n-\treturn err;\n+\treturn ice_load_pkg(adapter, use_dsn, dsn);\n }\n \n int\n@@ -436,13 +358,12 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev)\n \t\treturn err;\n \t}\n \n-\terr = ice_dcf_load_pkg(parent_hw);\n+\terr = ice_dcf_load_pkg(parent_adapter);\n \tif (err) {\n \t\tPMD_INIT_LOG(ERR, \"failed to load package with error %d\",\n \t\t\t err);\n \t\tgoto uninit_hw;\n \t}\n-\tparent_adapter->active_pkg_type = ice_load_pkg_type(parent_hw);\n \n \tparent_adapter->pf.main_vsi->idx = hw->num_vfs;\n \tice_dcf_update_pf_vsi_map(parent_hw,\ndiff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex 5fd5f99b6f..05ccc41d95 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -1649,57 +1649,7 @@ ice_pf_setup(struct ice_pf *pf)\n \treturn 0;\n }\n \n-/*\n- * Extract device serial number from PCIe Configuration Space and\n- * determine the pkg file path according to the DSN.\n- */\n-#ifndef RTE_EXEC_ENV_WINDOWS\n-static int\n-ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)\n-{\n-\toff_t pos;\n-\tchar opt_ddp_filename[ICE_MAX_PKG_FILENAME_SIZE];\n-\tuint32_t dsn_low, dsn_high;\n-\tmemset(opt_ddp_filename, 0, ICE_MAX_PKG_FILENAME_SIZE);\n-\n-\tpos = rte_pci_find_ext_capability(pci_dev, RTE_PCI_EXT_CAP_ID_DSN);\n-\n-\tif (pos) {\n-\t\tif (rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4) < 0) {\n-\t\t\tPMD_INIT_LOG(ERR, \"Failed to read pci config space\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tif (rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8) < 0) {\n-\t\t\tPMD_INIT_LOG(ERR, \"Failed to read pci config space\\n\");\n-\t\t\treturn -1;\n-\t\t}\n-\t\tsnprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,\n-\t\t\t \"ice-%08x%08x.pkg\", dsn_high, dsn_low);\n-\t} else {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to read device serial number\\n\");\n-\t\tgoto fail_dsn;\n-\t}\n-\n-\tstrncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES,\n-\t\tICE_MAX_PKG_FILENAME_SIZE);\n-\tif (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))\n-\t\treturn 0;\n-\n-\tstrncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_DEFAULT,\n-\t\tICE_MAX_PKG_FILENAME_SIZE);\n-\tif (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))\n-\t\treturn 0;\n-\n-fail_dsn:\n-\tstrncpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);\n-\tif (!ice_access(pkg_file, 0))\n-\t\treturn 0;\n-\tstrncpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);\n-\treturn 0;\n-}\n-#endif\n-\n-enum ice_pkg_type\n+static enum ice_pkg_type\n ice_load_pkg_type(struct ice_hw *hw)\n {\n \tenum ice_pkg_type package_type;\n@@ -1723,37 +1673,62 @@ ice_load_pkg_type(struct ice_hw *hw)\n \treturn package_type;\n }\n \n-#ifndef RTE_EXEC_ENV_WINDOWS\n-static int ice_load_pkg(struct rte_eth_dev *dev)\n+#ifdef RTE_EXEC_ENV_WINDOWS\n+#define ice_access _access\n+#else\n+#define ice_access access\n+#endif\n+\n+int ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn)\n {\n-\tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct ice_hw *hw = &adapter->hw;\n \tchar pkg_file[ICE_MAX_PKG_FILENAME_SIZE];\n+\tchar opt_ddp_filename[ICE_MAX_PKG_FILENAME_SIZE];\n \tint err;\n-\tuint8_t *buf;\n+\tuint8_t *buf = NULL;\n \tint buf_len;\n \tFILE *file;\n \tstruct stat fstat;\n-\tstruct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);\n-\tstruct ice_adapter *ad =\n-\t\tICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n \n-\terr = ice_pkg_file_search_path(pci_dev, pkg_file);\n-\tif (err) {\n+\tif (!use_dsn)\n+\t\tgoto no_dsn;\n+\n+\tmemset(opt_ddp_filename, 0, ICE_MAX_PKG_FILENAME_SIZE);\n+\tsnprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,\n+\t\t\"ice-%016\" PRIx64 \".pkg\", dsn);\n+\tstrncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES,\n+\t\tICE_MAX_PKG_FILENAME_SIZE);\n+\tif (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))\n+\t\tgoto load_fw;\n+\n+\tstrncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_DEFAULT,\n+\t\tICE_MAX_PKG_FILENAME_SIZE);\n+\tif (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))\n+\t\tgoto load_fw;\n+\n+no_dsn:\n+\tstrncpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);\n+\tif (!ice_access(pkg_file, 0))\n+\t\tgoto load_fw;\n+\tstrncpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);\n+\tif (ice_access(pkg_file, 0)) {\n \t\tPMD_INIT_LOG(ERR, \"failed to search file path\\n\");\n-\t\treturn err;\n+\t\treturn -1;\n \t}\n \n+load_fw:\n \tfile = fopen(pkg_file, \"rb\");\n \tif (!file) {\n \t\tPMD_INIT_LOG(ERR, \"failed to open file: %s\\n\", pkg_file);\n \t\treturn -1;\n \t}\n \n+\tPMD_INIT_LOG(DEBUG, \"DDP package name: %s\", pkg_file);\n+\n \terr = stat(pkg_file, &fstat);\n \tif (err) {\n \t\tPMD_INIT_LOG(ERR, \"failed to get file stats\\n\");\n-\t\tfclose(file);\n-\t\treturn err;\n+\t\tgoto out;\n \t}\n \n \tbuf_len = fstat.st_size;\n@@ -1762,44 +1737,33 @@ static int ice_load_pkg(struct rte_eth_dev *dev)\n \tif (!buf) {\n \t\tPMD_INIT_LOG(ERR, \"failed to allocate buf of size %d for package\\n\",\n \t\t\t\tbuf_len);\n-\t\tfclose(file);\n-\t\treturn -1;\n+\t\terr = -1;\n+\t\tgoto out;\n \t}\n \n \terr = fread(buf, buf_len, 1, file);\n \tif (err != 1) {\n \t\tPMD_INIT_LOG(ERR, \"failed to read package data\\n\");\n-\t\tfclose(file);\n \t\terr = -1;\n-\t\tgoto fail_exit;\n+\t\tgoto out;\n \t}\n \n-\tfclose(file);\n-\n \terr = ice_copy_and_init_pkg(hw, buf, buf_len);\n \tif (err) {\n \t\tPMD_INIT_LOG(ERR, \"ice_copy_and_init_hw failed: %d\\n\", err);\n-\t\tgoto fail_exit;\n+\t\tgoto out;\n \t}\n \n \t/* store the loaded pkg type info */\n-\tad->active_pkg_type = ice_load_pkg_type(hw);\n+\tadapter->active_pkg_type = ice_load_pkg_type(hw);\n \n-\terr = ice_init_hw_tbls(hw);\n-\tif (err) {\n-\t\tPMD_INIT_LOG(ERR, \"ice_init_hw_tbls failed: %d\\n\", err);\n-\t\tgoto fail_init_tbls;\n-\t}\n-\n-\treturn 0;\n-\n-fail_init_tbls:\n-\trte_free(hw->pkg_copy);\n-fail_exit:\n+out:\n+\tfclose(file);\n \trte_free(buf);\n \treturn err;\n }\n-#endif\n+\n+#undef ice_access\n \n static void\n ice_base_queue_get(struct ice_pf *pf)\n@@ -2030,6 +1994,12 @@ ice_dev_init(struct rte_eth_dev *dev)\n \t\tICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n \tstruct ice_vsi *vsi;\n \tint ret;\n+#ifndef RTE_EXEC_ENV_WINDOWS\n+\toff_t pos;\n+\tuint32_t dsn_low, dsn_high;\n+\tuint64_t dsn;\n+\tbool use_dsn;\n+#endif\n \n \tdev->dev_ops = &ice_eth_dev_ops;\n \tdev->rx_queue_count = ice_rx_queue_count;\n@@ -2081,7 +2051,30 @@ ice_dev_init(struct rte_eth_dev *dev)\n \t}\n \n #ifndef RTE_EXEC_ENV_WINDOWS\n-\tret = ice_load_pkg(dev);\n+\tuse_dsn = false;\n+\tdsn = 0;\n+\tpos = rte_pci_find_ext_capability(pci_dev, RTE_PCI_EXT_CAP_ID_DSN);\n+\tif (pos) {\n+\t\tif (rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4) < 0 ||\n+\t\t\t\trte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8) < 0) {\n+\t\t\tPMD_INIT_LOG(ERR, \"Failed to read pci config space\\n\");\n+\t\t} else {\n+\t\t\tuse_dsn = true;\n+\t\t\tdsn = (uint64_t)dsn_high << 32 | dsn_low;\n+\t\t}\n+\t} else {\n+\t\tPMD_INIT_LOG(ERR, \"Failed to read device serial number\\n\");\n+\t}\n+\n+\tret = ice_load_pkg(pf->adapter, use_dsn, dsn);\n+\tif (ret == 0) {\n+\t\tret = ice_init_hw_tbls(hw);\n+\t\tif (ret) {\n+\t\t\tPMD_INIT_LOG(ERR, \"ice_init_hw_tbls failed: %d\\n\", ret);\n+\t\t\trte_free(hw->pkg_copy);\n+\t\t}\n+\t}\n+\n \tif (ret) {\n \t\tif (ad->devargs.safe_mode_support == 0) {\n \t\t\tPMD_INIT_LOG(ERR, \"Failed to load the DDP package,\"\ndiff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h\nindex 2a8a8169d5..1997f9296f 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -531,7 +531,8 @@ struct ice_vsi_vlan_pvid_info {\n #define ICE_PF_TO_ETH_DEV(pf) \\\n \t(((struct ice_pf *)pf)->adapter->eth_dev)\n \n-enum ice_pkg_type ice_load_pkg_type(struct ice_hw *hw);\n+int\n+ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn);\n struct ice_vsi *\n ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type);\n int\n", "prefixes": [ "v2", "1/2" ] }{ "id": 93855, "url": "