get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/59109/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 59109,
    "url": "http://patches.dpdk.org/api/patches/59109/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/8560c4c7f3547a2a9263a916d03b9f76a1bd9602.1568204462.git.ting.xu@intel.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": "<8560c4c7f3547a2a9263a916d03b9f76a1bd9602.1568204462.git.ting.xu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/8560c4c7f3547a2a9263a916d03b9f76a1bd9602.1568204462.git.ting.xu@intel.com",
    "date": "2019-09-11T12:35:35",
    "name": "[v6] net/ice: support device-specific DDP package loading",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8f219f180aef2e9c6727063d9cc0a1861b3d93b7",
    "submitter": {
        "id": 1363,
        "url": "http://patches.dpdk.org/api/people/1363/?format=api",
        "name": "Xu, Ting",
        "email": "ting.xu@intel.com"
    },
    "delegate": {
        "id": 31221,
        "url": "http://patches.dpdk.org/api/users/31221/?format=api",
        "username": "yexl",
        "first_name": "xiaolong",
        "last_name": "ye",
        "email": "xiaolong.ye@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/8560c4c7f3547a2a9263a916d03b9f76a1bd9602.1568204462.git.ting.xu@intel.com/mbox/",
    "series": [
        {
            "id": 6366,
            "url": "http://patches.dpdk.org/api/series/6366/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6366",
            "date": "2019-09-11T12:35:35",
            "name": "[v6] net/ice: support device-specific DDP package loading",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/6366/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/59109/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/59109/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 00C011EA9D;\n\tWed, 11 Sep 2019 07:34:55 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id A51A41EA96\n\tfor <dev@dpdk.org>; Wed, 11 Sep 2019 07:34:52 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t10 Sep 2019 22:34:51 -0700",
            "from dpdk-xuting-main.sh.intel.com ([10.67.117.43])\n\tby orsmga006.jf.intel.com with ESMTP; 10 Sep 2019 22:34:49 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,492,1559545200\"; d=\"scan'208\";a=\"189567100\"",
        "From": "Ting Xu <ting.xu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "xiaolong.ye@intel.com, qi.z.zhang@intel.com, john.mcnamara@intel.com,\n\tmarko.kovacevic@intel.com",
        "Date": "Wed, 11 Sep 2019 12:35:35 +0000",
        "Message-Id": "<8560c4c7f3547a2a9263a916d03b9f76a1bd9602.1568204462.git.ting.xu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<6c47d7e03e43713756e746b3c459798283b13993.1567694027.git.ting.xu@intel.com>",
        "References": "<6c47d7e03e43713756e746b3c459798283b13993.1567694027.git.ting.xu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6] net/ice: support device-specific DDP package\n\tloading",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds the feature that supports loading DDP package\naccording to the device serial number. Prior to loading the\ndefault DDP package (ice.pkg), the driver will check for the\npresence of a device-specific DDP package with the name containing\n64-bit PCIe Device Serial Number (ice-xxxxxxxxxxxxxxxx.pkg)\nduring initialization. Users can use \"lspci -vs\" to get the device\nserial number.\nThe pkg search path are /lib/firmware/updates/intel/ice/ddp/\nand /lib/firmware/intel/ice/ddp/. If the package exists,\nthe driver will download it to the device instead of the default\none. The loaded package type (OS default and COMMS) will be\nstored in ice_adapter->active_pkg_type. The package version is\nstored in ice_hw->active_pkg_ver.\n\nSigned-off-by: Ting Xu <ting.xu@intel.com>\n\n---\nv6: update doc and release note; reduce redundant variables;\nchange some log levels.\nv5: optimize the operation when dsn is not found.\nv4: correct the commit message format.\nv3: fix compile error; modify to change the pkg loading order.\nv2: modify codes according to the comments.\n---\n doc/guides/nics/ice.rst                |  20 +++-\n doc/guides/rel_notes/release_19_11.rst |   5 +\n drivers/net/ice/ice_ethdev.c           | 134 ++++++++++++++++++++++++-\n drivers/net/ice/ice_ethdev.h           |   8 ++\n 4 files changed, 161 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst\nindex 45b6749a1..161e1452c 100644\n--- a/doc/guides/nics/ice.rst\n+++ b/doc/guides/nics/ice.rst\n@@ -125,10 +125,22 @@ The Intel E810 requires a programmable pipeline package be downloaded\n by the driver to support normal operations. The E810 has a limited\n functionality built in to allow PXE boot and other use cases, but the\n driver must download a package file during the driver initialization\n-stage. The file must be in the /lib/firmware/intel/ice/ddp directory\n-and it must be named ice.pkg. A symbolic link to this file is also ok.\n-The same package file is used by both the kernel driver and the DPDK PMD.\n-\n+stage.\n+\n+The default DDP package file name is ice.pkg. For a specific NIC, the\n+DDP package supposed to be loaded can have a filename: ice-xxxxxx.pkg,\n+where 'xxxxxx' is the 64-bit PCIe Device Serial Number of the NIC. For\n+example, if the NIC's device serial number is 00-CC-BB-FF-FF-AA-05-68,\n+the device-specific DDP package filename is ice-00ccbbffffaa0568.pkg\n+(in hex and all low case). During initialization, the driver searches\n+in the following paths in order: /lib/firmware/updates/intel/ice/ddp\n+and /lib/firmware/intel/ice/ddp. The correponding device-specific DDP\n+package will be downloaded first if the file exists. If not, then the\n+driver tries to load the default package. The type of loaded package\n+is stored in ``ice_adapter->active_pkg_type``.\n+\n+A symbolic link to the DDP package file is also ok. The same package\n+file is used by both the kernel driver and the DPDK PMD.\n \n 19.02 limitation\n ~~~~~~~~~~~~~~~~\ndiff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst\nindex 8490d897c..ef5048829 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -56,6 +56,11 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =========================================================\n \n+* **Support device-specific DDP package loading.**\n+\n+  Added support to load device-specific DDP package. The package file\n+  with name including NIC's device serial number would be searched and\n+  loaded (if existed) prior to the default package (ice.pkg).\n \n Removed Items\n -------------\ndiff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c\nindex 686d6f00f..0811d8053 100644\n--- a/drivers/net/ice/ice_ethdev.c\n+++ b/drivers/net/ice/ice_ethdev.c\n@@ -28,7 +28,16 @@ static const char * const ice_valid_args[] = {\n };\n \n #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100\n-#define ICE_DFLT_PKG_FILE \"/lib/firmware/intel/ice/ddp/ice.pkg\"\n+\n+/* DDP package search path */\n+#define ICE_PKG_FILE_DEFAULT \"/lib/firmware/intel/ice/ddp/ice.pkg\"\n+#define ICE_PKG_FILE_UPDATES \"/lib/firmware/updates/intel/ice/ddp/ice.pkg\"\n+#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT \"/lib/firmware/intel/ice/ddp/\"\n+#define ICE_PKG_FILE_SEARCH_PATH_UPDATES \"/lib/firmware/updates/intel/ice/ddp/\"\n+\n+#define ICE_OS_DEFAULT_PKG_NAME\t\t\"ICE OS Default Package\"\n+#define ICE_COMMS_PKG_NAME\t\t\t\"ICE COMMS Package\"\n+#define ICE_MAX_PKG_FILENAME_SIZE   256\n \n int ice_logtype_init;\n int ice_logtype_driver;\n@@ -1265,15 +1274,132 @@ ice_pf_setup(struct ice_pf *pf)\n \treturn 0;\n }\n \n+/* PCIe configuration space setting */\n+#define PCI_CFG_SPACE_SIZE          256\n+#define PCI_CFG_SPACE_EXP_SIZE      4096\n+#define PCI_EXT_CAP_ID(header)      (int)((header) & 0x0000ffff)\n+#define PCI_EXT_CAP_NEXT(header)    (((header) >> 20) & 0xffc)\n+#define PCI_EXT_CAP_ID_DSN          0x03\n+\n+static int\n+ice_pci_find_next_ext_capability(struct rte_pci_device *dev, int cap)\n+{\n+\tuint32_t header;\n+\tint ttl;\n+\tint pos = PCI_CFG_SPACE_SIZE;\n+\n+\t/* minimum 8 bytes per capability */\n+\tttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;\n+\n+\tif (rte_pci_read_config(dev, &header, 4, pos) < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"ice error reading extended capabilities\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\t/*\n+\t * If we have no capabilities, this is indicated by cap ID,\n+\t * cap version and next pointer all being 0.\n+\t */\n+\tif (header == 0)\n+\t\treturn 0;\n+\n+\twhile (ttl-- > 0) {\n+\t\tif (PCI_EXT_CAP_ID(header) == cap)\n+\t\t\treturn pos;\n+\n+\t\tpos = PCI_EXT_CAP_NEXT(header);\n+\n+\t\tif (pos < PCI_CFG_SPACE_SIZE)\n+\t\t\tbreak;\n+\n+\t\tif (rte_pci_read_config(dev, &header, 4, pos) < 0) {\n+\t\t\tPMD_INIT_LOG(ERR, \"ice error reading extended capabilities\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\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+static int\n+ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)\n+{\n+\tint 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 = ice_pci_find_next_ext_capability(pci_dev, PCI_EXT_CAP_ID_DSN);\n+\n+\tif (pos) {\n+\t\trte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4);\n+\t\trte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8);\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 (!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 (!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 (!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+\n+static enum ice_pkg_type\n+ice_load_pkg_type(struct ice_hw *hw)\n+{\n+\tenum ice_pkg_type package_type;\n+\n+\t/* store the activated package type (OS default or Comms) */\n+\tif (!strncmp((char *)hw->active_pkg_name, ICE_OS_DEFAULT_PKG_NAME,\n+\t\tICE_PKG_NAME_SIZE))\n+\t\tpackage_type = ICE_PKG_TYPE_OS_DEFAULT;\n+\telse if (!strncmp((char *)hw->active_pkg_name, ICE_COMMS_PKG_NAME,\n+\t\tICE_PKG_NAME_SIZE))\n+\t\tpackage_type = ICE_PKG_TYPE_COMMS;\n+\telse\n+\t\tpackage_type = ICE_PKG_TYPE_UNKNOWN;\n+\n+\tPMD_INIT_LOG(NOTICE, \"Active package is: %d.%d.%d.%d, %s\",\n+\t\thw->active_pkg_ver.major, hw->active_pkg_ver.minor,\n+\t\thw->active_pkg_ver.update, hw->active_pkg_ver.draft,\n+\t\thw->active_pkg_name);\n+\n+\treturn package_type;\n+}\n+\n static int ice_load_pkg(struct rte_eth_dev *dev)\n {\n \tstruct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tconst char *pkg_file = ICE_DFLT_PKG_FILE;\n+\tchar pkg_file[ICE_MAX_PKG_FILENAME_SIZE];\n \tint err;\n \tuint8_t *buf;\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+\tice_pkg_file_search_path(pci_dev, pkg_file);\n \n \tfile = fopen(pkg_file, \"rb\");\n \tif (!file)  {\n@@ -1313,6 +1439,10 @@ static int ice_load_pkg(struct rte_eth_dev *dev)\n \t\tPMD_INIT_LOG(ERR, \"ice_copy_and_init_hw failed: %d\\n\", err);\n \t\tgoto fail_exit;\n \t}\n+\n+\t/* store the loaded pkg type info */\n+\tad->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);\ndiff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h\nindex 5063960a8..d1d07641d 100644\n--- a/drivers/net/ice/ice_ethdev.h\n+++ b/drivers/net/ice/ice_ethdev.h\n@@ -124,6 +124,13 @@\n #define ICE_ETH_OVERHEAD \\\n \t(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)\n \n+/* DDP package type */\n+enum ice_pkg_type {\n+\tICE_PKG_TYPE_UNKNOWN,\n+\tICE_PKG_TYPE_OS_DEFAULT,\n+\tICE_PKG_TYPE_COMMS,\n+};\n+\n struct ice_adapter;\n \n /**\n@@ -296,6 +303,7 @@ struct ice_adapter {\n \tuint32_t ptype_tbl[ICE_MAX_PKT_TYPE] __rte_cache_min_aligned;\n \tbool is_safe_mode;\n \tstruct ice_devargs devargs;\n+\tenum ice_pkg_type active_pkg_type; /* loaded ddp package type */\n };\n \n struct ice_vsi_vlan_pvid_info {\n",
    "prefixes": [
        "v6"
    ]
}