get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54291,
    "url": "http://patches.dpdk.org/api/patches/54291/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-16-leyi.rong@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": "<20190604054248.68510-16-leyi.rong@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190604054248.68510-16-leyi.rong@intel.com",
    "date": "2019-06-04T05:42:14",
    "name": "[15/49] net/ice/base: add compatibility check for package version",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8020bec6f77f6cc522a0ad5b1b9e5e5f55067905",
    "submitter": {
        "id": 1204,
        "url": "http://patches.dpdk.org/api/people/1204/?format=api",
        "name": "Leyi Rong",
        "email": "leyi.rong@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190604054248.68510-16-leyi.rong@intel.com/mbox/",
    "series": [
        {
            "id": 4879,
            "url": "http://patches.dpdk.org/api/series/4879/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4879",
            "date": "2019-06-04T05:41:59",
            "name": "shared code update",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4879/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54291/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54291/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 3B2E31BB0F;\n\tTue,  4 Jun 2019 07:44:27 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id B1C641B9F3\n\tfor <dev@dpdk.org>; Tue,  4 Jun 2019 07:44:10 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t03 Jun 2019 22:44:10 -0700",
            "from lrong-srv-03.sh.intel.com ([10.67.119.177])\n\tby fmsmga008.fm.intel.com with ESMTP; 03 Jun 2019 22:44:09 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Leyi Rong <leyi.rong@intel.com>",
        "To": "qi.z.zhang@intel.com",
        "Cc": "dev@dpdk.org, Leyi Rong <leyi.rong@intel.com>,\n\tDan Nowlin <dan.nowlin@intel.com>,\n\tPaul M Stillwell Jr <paul.m.stillwell.jr@intel.com>",
        "Date": "Tue,  4 Jun 2019 13:42:14 +0800",
        "Message-Id": "<20190604054248.68510-16-leyi.rong@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "References": "<20190604054248.68510-1-leyi.rong@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 15/49] net/ice/base: add compatibility check for\n\tpackage version",
        "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": "1. Perform a check against the package version to make sure that\nit will be compatible with the shared code implementation. There\nwill be points in time when the shared code and package will need\nto be changed in lock step; the mechanism added here is meant to\ndeal with those situations.\n2. Support package tunnel labels owned by PF. VXLAN and GENEVE\ntunnel labels names in the package are changing to incorporate\nthe PF that owns them.\n\nSigned-off-by: Dan Nowlin <dan.nowlin@intel.com>\nSigned-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>\nSigned-off-by: Leyi Rong <leyi.rong@intel.com>\n---\n drivers/net/ice/base/ice_flex_pipe.c | 96 ++++++++++++++++++++++------\n drivers/net/ice/base/ice_flex_pipe.h |  8 +++\n drivers/net/ice/base/ice_flex_type.h | 10 ---\n 3 files changed, 85 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c\nindex 93e056853..5faee6d52 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.c\n+++ b/drivers/net/ice/base/ice_flex_pipe.c\n@@ -7,19 +7,12 @@\n #include \"ice_protocol_type.h\"\n #include \"ice_flow.h\"\n \n+/* To support tunneling entries by PF, the package will append the PF number to\n+ * the label; for example TNL_VXLAN_PF0, TNL_VXLAN_PF1, TNL_VXLAN_PF2, etc.\n+ */\n static const struct ice_tunnel_type_scan tnls[] = {\n-\t{ TNL_VXLAN,\t\t\"TNL_VXLAN\" },\n-\t{ TNL_GTPC,\t\t\"TNL_GTPC\" },\n-\t{ TNL_GTPC_TEID,\t\"TNL_GTPC_TEID\" },\n-\t{ TNL_GTPU,\t\t\"TNL_GTPC\" },\n-\t{ TNL_GTPU_TEID,\t\"TNL_GTPU_TEID\" },\n-\t{ TNL_VXLAN_GPE,\t\"TNL_VXLAN_GPE\" },\n-\t{ TNL_GENEVE,\t\t\"TNL_GENEVE\" },\n-\t{ TNL_NAT,\t\t\"TNL_NAT\" },\n-\t{ TNL_ROCE_V2,\t\t\"TNL_ROCE_V2\" },\n-\t{ TNL_MPLSO_UDP,\t\"TNL_MPLSO_UDP\" },\n-\t{ TNL_UDP2_END,\t\t\"TNL_UDP2_END\" },\n-\t{ TNL_UPD_END,\t\t\"TNL_UPD_END\" },\n+\t{ TNL_VXLAN,\t\t\"TNL_VXLAN_PF\" },\n+\t{ TNL_GENEVE,\t\t\"TNL_GENEVE_PF\" },\n \t{ TNL_LAST,\t\t\"\" }\n };\n \n@@ -485,8 +478,17 @@ void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg)\n \n \twhile (label_name && hw->tnl.count < ICE_TUNNEL_MAX_ENTRIES) {\n \t\tfor (i = 0; tnls[i].type != TNL_LAST; i++) {\n-\t\t\tif (!strncmp(label_name, tnls[i].label_prefix,\n-\t\t\t\t     strlen(tnls[i].label_prefix))) {\n+\t\t\tsize_t len = strlen(tnls[i].label_prefix);\n+\n+\t\t\t/* Look for matching label start, before continuing */\n+\t\t\tif (strncmp(label_name, tnls[i].label_prefix, len))\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* Make sure this label matches our PF. Note that the PF\n+\t\t\t * character ('0' - '7') will be located where our\n+\t\t\t * prefix string's null terminator is located.\n+\t\t\t */\n+\t\t\tif ((label_name[len] - '0') == hw->pf_id) {\n \t\t\t\thw->tnl.tbl[hw->tnl.count].type = tnls[i].type;\n \t\t\t\thw->tnl.tbl[hw->tnl.count].valid = false;\n \t\t\t\thw->tnl.tbl[hw->tnl.count].in_use = false;\n@@ -1083,12 +1085,8 @@ enum ice_status ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)\n enum ice_status\n ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)\n {\n-\tstruct ice_aqc_get_pkg_info_resp *pkg_info;\n \tstruct ice_global_metadata_seg *meta_seg;\n \tstruct ice_generic_seg_hdr *seg_hdr;\n-\tenum ice_status status;\n-\tu16 size;\n-\tu32 i;\n \n \tice_debug(hw, ICE_DBG_TRACE, \"%s\\n\", __func__);\n \tif (!pkg_hdr)\n@@ -1127,7 +1125,25 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)\n \t\treturn ICE_ERR_CFG;\n \t}\n \n-#define ICE_PKG_CNT\t4\n+\treturn ICE_SUCCESS;\n+}\n+\n+/**\n+ * ice_get_pkg_info\n+ * @hw: pointer to the hardware structure\n+ *\n+ * Store details of the package currently loaded in HW into the HW structure.\n+ */\n+enum ice_status\n+ice_get_pkg_info(struct ice_hw *hw)\n+{\n+\tstruct ice_aqc_get_pkg_info_resp *pkg_info;\n+\tenum ice_status status;\n+\tu16 size;\n+\tu32 i;\n+\n+\tice_debug(hw, ICE_DBG_TRACE, \"ice_init_pkg_info\\n\");\n+\n \tsize = sizeof(*pkg_info) + (sizeof(pkg_info->pkg_info[0]) *\n \t\t\t\t    (ICE_PKG_CNT - 1));\n \tpkg_info = (struct ice_aqc_get_pkg_info_resp *)ice_malloc(hw, size);\n@@ -1310,6 +1326,32 @@ static void ice_init_pkg_regs(struct ice_hw *hw)\n \tice_init_fd_mask_regs(hw);\n }\n \n+/**\n+ * ice_chk_pkg_version - check package version for compatibility with driver\n+ * @hw: pointer to the hardware structure\n+ * @pkg_ver: pointer to a version structure to check\n+ *\n+ * Check to make sure that the package about to be downloaded is compatible with\n+ * the driver. To be compatible, the major and minor components of the package\n+ * version must match our ICE_PKG_SUPP_VER_MAJ and ICE_PKG_SUPP_VER_MNR\n+ * definitions.\n+ */\n+static enum ice_status\n+ice_chk_pkg_version(struct ice_hw *hw, struct ice_pkg_ver *pkg_ver)\n+{\n+\tif (pkg_ver->major != ICE_PKG_SUPP_VER_MAJ ||\n+\t    pkg_ver->minor != ICE_PKG_SUPP_VER_MNR) {\n+\t\tice_info(hw, \"ERROR: Incompatible package: %d.%d.%d.%d - requires package version: %d.%d.*.*\\n\",\n+\t\t\t pkg_ver->major, pkg_ver->minor, pkg_ver->update,\n+\t\t\t pkg_ver->draft, ICE_PKG_SUPP_VER_MAJ,\n+\t\t\t ICE_PKG_SUPP_VER_MNR);\n+\n+\t\treturn ICE_ERR_NOT_SUPPORTED;\n+\t}\n+\n+\treturn ICE_SUCCESS;\n+}\n+\n /**\n  * ice_init_pkg - initialize/download package\n  * @hw: pointer to the hardware structure\n@@ -1357,6 +1399,13 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)\n \tif (status)\n \t\treturn status;\n \n+\t/* before downloading the package, check package version for\n+\t * compatibility with driver\n+\t */\n+\tstatus = ice_chk_pkg_version(hw, &hw->pkg_ver);\n+\tif (status)\n+\t\treturn status;\n+\n \t/* find segment in given package */\n \tseg = (struct ice_seg *)ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg);\n \tif (!seg) {\n@@ -1373,6 +1422,15 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)\n \t\tstatus = ICE_SUCCESS;\n \t}\n \n+\t/* Get information on the package currently loaded in HW, then make sure\n+\t * the driver is compatible with this version.\n+\t */\n+\tif (!status) {\n+\t\tstatus = ice_get_pkg_info(hw);\n+\t\tif (!status)\n+\t\t\tstatus = ice_chk_pkg_version(hw, &hw->active_pkg_ver);\n+\t}\n+\n \tif (!status) {\n \t\thw->seg = seg;\n \t\t/* on successful package download update other required\ndiff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h\nindex e8cc9cef3..375758c8d 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.h\n+++ b/drivers/net/ice/base/ice_flex_pipe.h\n@@ -7,12 +7,18 @@\n \n #include \"ice_type.h\"\n \n+/* Package minimal version supported */\n+#define ICE_PKG_SUPP_VER_MAJ\t1\n+#define ICE_PKG_SUPP_VER_MNR\t2\n+\n /* Package format version */\n #define ICE_PKG_FMT_VER_MAJ\t1\n #define ICE_PKG_FMT_VER_MNR\t0\n #define ICE_PKG_FMT_VER_UPD\t0\n #define ICE_PKG_FMT_VER_DFT\t0\n \n+#define ICE_PKG_CNT 4\n+\n enum ice_status\n ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);\n enum ice_status\n@@ -28,6 +34,8 @@ enum ice_status ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg);\n \n enum ice_status\n ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_header);\n+enum ice_status\n+ice_get_pkg_info(struct ice_hw *hw);\n \n void ice_init_pkg_hints(struct ice_hw *hw, struct ice_seg *ice_seg);\n \ndiff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h\nindex 7133983ff..d23b2ae82 100644\n--- a/drivers/net/ice/base/ice_flex_type.h\n+++ b/drivers/net/ice/base/ice_flex_type.h\n@@ -455,17 +455,7 @@ struct ice_pkg_enum {\n \n enum ice_tunnel_type {\n \tTNL_VXLAN = 0,\n-\tTNL_GTPC,\n-\tTNL_GTPC_TEID,\n-\tTNL_GTPU,\n-\tTNL_GTPU_TEID,\n-\tTNL_VXLAN_GPE,\n \tTNL_GENEVE,\n-\tTNL_NAT,\n-\tTNL_ROCE_V2,\n-\tTNL_MPLSO_UDP,\n-\tTNL_UDP2_END,\n-\tTNL_UPD_END,\n \tTNL_LAST = 0xFF,\n \tTNL_ALL = 0xFF,\n };\n",
    "prefixes": [
        "15/49"
    ]
}