get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 54713,
    "url": "http://patches.dpdk.org/api/patches/54713/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190611155221.2703-55-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": "<20190611155221.2703-55-leyi.rong@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190611155221.2703-55-leyi.rong@intel.com",
    "date": "2019-06-11T15:52:09",
    "name": "[v2,54/66] net/ice/base: add vxlan/generic tunnel management",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e4e2f927a6b65a093d5cd4cd9612be071638b613",
    "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/20190611155221.2703-55-leyi.rong@intel.com/mbox/",
    "series": [
        {
            "id": 4981,
            "url": "http://patches.dpdk.org/api/series/4981/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4981",
            "date": "2019-06-11T15:51:15",
            "name": "shared code update",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4981/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54713/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54713/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 178DF1C5F0;\n\tTue, 11 Jun 2019 17:55:36 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id C98CB1C548\n\tfor <dev@dpdk.org>; Tue, 11 Jun 2019 17:54:45 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Jun 2019 08:54:45 -0700",
            "from lrong-srv-03.sh.intel.com ([10.67.119.177])\n\tby orsmga001.jf.intel.com with ESMTP; 11 Jun 2019 08:54:44 -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, 11 Jun 2019 23:52:09 +0800",
        "Message-Id": "<20190611155221.2703-55-leyi.rong@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190611155221.2703-1-leyi.rong@intel.com>",
        "References": "<20190604054248.68510-1-leyi.rong@intel.com>\n\t<20190611155221.2703-1-leyi.rong@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 54/66] net/ice/base: add vxlan/generic tunnel\n\tmanagement",
        "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": "Added routines for handling tunnel management:\n\t- ice_tunnel_port_in_use()\n\t- ice_tunnel_get_type()\n\t- ice_find_free_tunnel_entry()\n\t- ice_create_tunnel()\n\t- ice_destroy_tunnel()\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 | 228 +++++++++++++++++++++++++++\n drivers/net/ice/base/ice_flex_pipe.h |   6 +\n 2 files changed, 234 insertions(+)",
    "diff": "diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c\nindex c136c03db..4206458e5 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.c\n+++ b/drivers/net/ice/base/ice_flex_pipe.c\n@@ -1711,6 +1711,234 @@ static struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld)\n \treturn &bld->buf;\n }\n \n+/**\n+ * ice_tunnel_port_in_use\n+ * @hw: pointer to the HW structure\n+ * @port: port to search for\n+ * @index: optionally returns index\n+ *\n+ * Returns whether a port is already in use as a tunnel, and optionally its\n+ * index\n+ */\n+bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index)\n+{\n+\tu16 i;\n+\n+\tfor (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\tif (hw->tnl.tbl[i].in_use && hw->tnl.tbl[i].port == port) {\n+\t\t\tif (index)\n+\t\t\t\t*index = i;\n+\t\t\treturn true;\n+\t\t}\n+\n+\treturn false;\n+}\n+\n+/**\n+ * ice_tunnel_get_type\n+ * @hw: pointer to the HW structure\n+ * @port: port to search for\n+ * @type: returns tunnel index\n+ *\n+ * For a given port number, will return the type of tunnel.\n+ */\n+bool\n+ice_tunnel_get_type(struct ice_hw *hw, u16 port, enum ice_tunnel_type *type)\n+{\n+\tu16 i;\n+\n+\tfor (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\tif (hw->tnl.tbl[i].in_use && hw->tnl.tbl[i].port == port) {\n+\t\t\t*type = hw->tnl.tbl[i].type;\n+\t\t\treturn true;\n+\t\t}\n+\n+\treturn false;\n+}\n+\n+/**\n+ * ice_find_free_tunnel_entry\n+ * @hw: pointer to the HW structure\n+ * @type: tunnel type\n+ * @index: optionally returns index\n+ *\n+ * Returns whether there is a free tunnel entry, and optionally its index\n+ */\n+static bool\n+ice_find_free_tunnel_entry(struct ice_hw *hw, enum ice_tunnel_type type,\n+\t\t\t   u16 *index)\n+{\n+\tu16 i;\n+\n+\tfor (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\tif (hw->tnl.tbl[i].valid && !hw->tnl.tbl[i].in_use &&\n+\t\t    hw->tnl.tbl[i].type == type) {\n+\t\t\tif (index)\n+\t\t\t\t*index = i;\n+\t\t\treturn true;\n+\t\t}\n+\n+\treturn false;\n+}\n+\n+/**\n+ * ice_create_tunnel\n+ * @hw: pointer to the HW structure\n+ * @type: type of tunnel\n+ * @port: port to use for vxlan tunnel\n+ *\n+ * Creates a tunnel\n+ */\n+enum ice_status\n+ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port)\n+{\n+\tstruct ice_boost_tcam_section *sect_rx, *sect_tx;\n+\tenum ice_status status = ICE_ERR_MAX_LIMIT;\n+\tstruct ice_buf_build *bld;\n+\tu16 index;\n+\n+\tif (ice_tunnel_port_in_use(hw, port, NULL))\n+\t\treturn ICE_ERR_ALREADY_EXISTS;\n+\n+\tif (!ice_find_free_tunnel_entry(hw, type, &index))\n+\t\treturn ICE_ERR_OUT_OF_RANGE;\n+\n+\tbld = ice_pkg_buf_alloc(hw);\n+\tif (!bld)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\t/* allocate 2 sections, one for RX parser, one for TX parser */\n+\tif (ice_pkg_buf_reserve_section(bld, 2))\n+\t\tgoto ice_create_tunnel_err;\n+\n+\tsect_rx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_RXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  sizeof(*sect_rx));\n+\tif (!sect_rx)\n+\t\tgoto ice_create_tunnel_err;\n+\tsect_rx->count = CPU_TO_LE16(1);\n+\n+\tsect_tx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_TXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  sizeof(*sect_tx));\n+\tif (!sect_tx)\n+\t\tgoto ice_create_tunnel_err;\n+\tsect_tx->count = CPU_TO_LE16(1);\n+\n+\t/* copy original boost entry to update package buffer */\n+\tice_memcpy(sect_rx->tcam, hw->tnl.tbl[index].boost_entry,\n+\t\t   sizeof(*sect_rx->tcam), ICE_NONDMA_TO_NONDMA);\n+\n+\t/* over-write the never-match dest port key bits with the encoded port\n+\t * bits\n+\t */\n+\tice_set_key((u8 *)&sect_rx->tcam[0].key, sizeof(sect_rx->tcam[0].key),\n+\t\t    (u8 *)&port, NULL, NULL, NULL,\n+\t\t    offsetof(struct ice_boost_key_value, hv_dst_port_key),\n+\t\t    sizeof(sect_rx->tcam[0].key.key.hv_dst_port_key));\n+\n+\t/* exact copy of entry to TX section entry */\n+\tice_memcpy(sect_tx->tcam, sect_rx->tcam, sizeof(*sect_tx->tcam),\n+\t\t   ICE_NONDMA_TO_NONDMA);\n+\n+\tstatus = ice_update_pkg(hw, ice_pkg_buf(bld), 1);\n+\tif (!status) {\n+\t\thw->tnl.tbl[index].port = port;\n+\t\thw->tnl.tbl[index].in_use = true;\n+\t}\n+\n+ice_create_tunnel_err:\n+\tice_pkg_buf_free(hw, bld);\n+\n+\treturn status;\n+}\n+\n+/**\n+ * ice_destroy_tunnel\n+ * @hw: pointer to the HW structure\n+ * @port: port of tunnel to destroy (ignored if the all parameter is true)\n+ * @all: flag that states to destroy all tunnels\n+ *\n+ * Destroys a tunnel or all tunnels by creating an update package buffer\n+ * targeting the specific updates requested and then performing an update\n+ * package.\n+ */\n+enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all)\n+{\n+\tstruct ice_boost_tcam_section *sect_rx, *sect_tx;\n+\tenum ice_status status = ICE_ERR_MAX_LIMIT;\n+\tstruct ice_buf_build *bld;\n+\tu16 count = 0;\n+\tu16 size;\n+\tu16 i;\n+\n+\t/* determine count */\n+\tfor (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\tif (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].in_use &&\n+\t\t    (all || hw->tnl.tbl[i].port == port))\n+\t\t\tcount++;\n+\n+\tif (!count)\n+\t\treturn ICE_ERR_PARAM;\n+\n+\t/* size of section - there is at least one entry */\n+\tsize = (count - 1) * sizeof(*sect_rx->tcam) + sizeof(*sect_rx);\n+\n+\tbld = ice_pkg_buf_alloc(hw);\n+\tif (!bld)\n+\t\treturn ICE_ERR_NO_MEMORY;\n+\n+\t/* allocate 2 sections, one for RX parser, one for TX parser */\n+\tif (ice_pkg_buf_reserve_section(bld, 2))\n+\t\tgoto ice_destroy_tunnel_err;\n+\n+\tsect_rx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_RXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  size);\n+\tif (!sect_rx)\n+\t\tgoto ice_destroy_tunnel_err;\n+\tsect_rx->count = CPU_TO_LE16(1);\n+\n+\tsect_tx = (struct ice_boost_tcam_section *)\n+\t\tice_pkg_buf_alloc_section(bld, ICE_SID_TXPARSER_BOOST_TCAM,\n+\t\t\t\t\t  size);\n+\tif (!sect_tx)\n+\t\tgoto ice_destroy_tunnel_err;\n+\tsect_tx->count = CPU_TO_LE16(1);\n+\n+\t/* copy original boost entry to update package buffer, one copy to RX\n+\t * section, another copy to the TX section\n+\t */\n+\tfor (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\tif (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].in_use &&\n+\t\t    (all || hw->tnl.tbl[i].port == port)) {\n+\t\t\tice_memcpy(sect_rx->tcam + i,\n+\t\t\t\t   hw->tnl.tbl[i].boost_entry,\n+\t\t\t\t   sizeof(*sect_rx->tcam),\n+\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\tice_memcpy(sect_tx->tcam + i,\n+\t\t\t\t   hw->tnl.tbl[i].boost_entry,\n+\t\t\t\t   sizeof(*sect_tx->tcam),\n+\t\t\t\t   ICE_NONDMA_TO_NONDMA);\n+\t\t\thw->tnl.tbl[i].marked = true;\n+\t\t}\n+\n+\tstatus = ice_update_pkg(hw, ice_pkg_buf(bld), 1);\n+\tif (!status)\n+\t\tfor (i = 0; i < hw->tnl.count &&\n+\t\t     i < ICE_TUNNEL_MAX_ENTRIES; i++)\n+\t\t\tif (hw->tnl.tbl[i].marked) {\n+\t\t\t\thw->tnl.tbl[i].port = 0;\n+\t\t\t\thw->tnl.tbl[i].in_use = false;\n+\t\t\t\thw->tnl.tbl[i].marked = false;\n+\t\t\t}\n+\n+\tice_pkg_buf_free(hw, bld);\n+\n+ice_destroy_tunnel_err:\n+\treturn status;\n+}\n+\n \n /**\n  * ice_find_prot_off - find prot ID and offset pair, based on prof and FV index\ndiff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h\nindex 7142ae7fe..13066808c 100644\n--- a/drivers/net/ice/base/ice_flex_pipe.h\n+++ b/drivers/net/ice/base/ice_flex_pipe.h\n@@ -33,6 +33,12 @@ ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type,\n enum ice_status\n ice_get_sw_fv_list(struct ice_hw *hw, u16 *prot_ids, u8 ids_cnt,\n \t\t   struct LIST_HEAD_TYPE *fv_list);\n+enum ice_status\n+ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port);\n+enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all);\n+bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index);\n+bool\n+ice_tunnel_get_type(struct ice_hw *hw, u16 port, enum ice_tunnel_type *type);\n \n \n /* XLT2/VSI group functions */\n",
    "prefixes": [
        "v2",
        "54/66"
    ]
}