get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68507,
    "url": "http://patches.dpdk.org/api/patches/68507/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1586938751-32808-22-git-send-email-venkatkumar.duvvuru@broadcom.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": "<1586938751-32808-22-git-send-email-venkatkumar.duvvuru@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586938751-32808-22-git-send-email-venkatkumar.duvvuru@broadcom.com",
    "date": "2020-04-15T08:18:58",
    "name": "[v4,21/34] net/bnxt: add support to free key and action tables",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2956fcb30565da04a1f4bfbc11304dc5805453e3",
    "submitter": {
        "id": 1635,
        "url": "http://patches.dpdk.org/api/people/1635/?format=api",
        "name": "Venkat Duvvuru",
        "email": "venkatkumar.duvvuru@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1586938751-32808-22-git-send-email-venkatkumar.duvvuru@broadcom.com/mbox/",
    "series": [
        {
            "id": 9386,
            "url": "http://patches.dpdk.org/api/series/9386/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9386",
            "date": "2020-04-15T08:18:37",
            "name": "add support for host based flow table management",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/9386/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/68507/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/68507/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 96321A0563;\n\tWed, 15 Apr 2020 10:24:46 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 773181D5E0;\n\tWed, 15 Apr 2020 10:20:23 +0200 (CEST)",
            "from mail-pg1-f194.google.com (mail-pg1-f194.google.com\n [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id C5F571D5BF\n for <dev@dpdk.org>; Wed, 15 Apr 2020 10:20:20 +0200 (CEST)",
            "by mail-pg1-f194.google.com with SMTP id 2so1125063pgp.11\n for <dev@dpdk.org>; Wed, 15 Apr 2020 01:20:20 -0700 (PDT)",
            "from S60.dhcp.broadcom.net ([192.19.234.250])\n by smtp.gmail.com with ESMTPSA id fy21sm3819019pjb.25.2020.04.15.01.20.16\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Wed, 15 Apr 2020 01:20:18 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com;\n s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references;\n bh=fc7qiOGh3e5v8Z039LY0fci+vxvyIcJfagSznXFdUDE=;\n b=XKRXS4lWQ1enNFtPtj00oi/DvnAo8CAOoGUDfA6Qz0PluzoJpKz0a62wwlss+X20XV\n wDO6C+f6rN6zd24TrJSA0cHxjuKPOW10n3uCotKw05WZmOFoO+0UW0163Kw/BbZtW4++\n 9rz520Kq5Ftda8MnRIvwQZS4ilt0eZPc/EHDo=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references;\n bh=fc7qiOGh3e5v8Z039LY0fci+vxvyIcJfagSznXFdUDE=;\n b=mNICQt+Dvah0YkMRF5hd2LjvbD1E4v+LsDXLnAhSWxZUSTprzEgNPk65Q8oqBkS20P\n psF8bZ53n8Mka1qgjtBfDuwmntp3bJrScwPYrIr+cJjOhKRpmC4xOWZUeRlqhlD3SVqp\n HI9W7Ay7KWr6I0Kf4+QXnBjS9iClKtiukmFWv2zOWogKYxSkbDTN9lC6liVsShsxM6vb\n qeeGKo+oQ7pca2C3J1xshhkkLjBFdBGjLZzDHK4aQAr5Saq6W5Kn72wX/2773Iw9TGbg\n Fuw2+XHg2b3Q/T85Sk0bORvRgvtY97JdkBhjtvDCc5cGRz2Sj6Pygzkr9a1u9T4jzYVo\n NmcA==",
        "X-Gm-Message-State": "AGi0PuaH9NTO8DXOaWq46e5xyw0F03+43Ph3dsLpIKWtmHj4JmlfAjRi\n 5UzQgpmRWkMzcR6XbWE7c0SOeNYB47Mu5yckUAolk/UnPsjLNELVlAvNEjKA28K4gK4J+XvMQPz\n 3q5aldqd2fi7xS1HRm7/Ox3DJuy8L+0jMUgyJww6QbawULmClpYBERQ206YsevOIOB6S9",
        "X-Google-Smtp-Source": "\n APiQypIpEy5rymtg/rEGJ+WDCjCdwWCe1I3V4eZKnB4q0PLWkuwTbmR6094Xag1pSUpoM3ln/Q15YA==",
        "X-Received": "by 2002:a62:5289:: with SMTP id\n g131mr25768155pfb.210.1586938819273;\n Wed, 15 Apr 2020 01:20:19 -0700 (PDT)",
        "From": "Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Mike Baucom <michael.baucom@broadcom.com>,\n Kishore Padmanabha <kishore.padmanabha@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>",
        "Date": "Wed, 15 Apr 2020 13:48:58 +0530",
        "Message-Id": "\n <1586938751-32808-22-git-send-email-venkatkumar.duvvuru@broadcom.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "\n <1586938751-32808-1-git-send-email-venkatkumar.duvvuru@broadcom.com>",
        "References": "\n <1586852011-37536-1-git-send-email-venkatkumar.duvvuru@broadcom.com>\n <1586938751-32808-1-git-send-email-venkatkumar.duvvuru@broadcom.com>",
        "Subject": "[dpdk-dev] [PATCH v4 21/34] net/bnxt: add support to free key and\n\taction tables",
        "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 <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": "From: Mike Baucom <michael.baucom@broadcom.com>\n\nThis patch does the following\n1. Gets all the flow resources from the flow id\n2. Frees all the table resources\n3. Frees the flow in the flow table\n\nSigned-off-by: Mike Baucom <michael.baucom@broadcom.com>\nSigned-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nReviewed-by: Lance Richardson <lance.richardson@broadcom.com>\nReviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/ulp_flow_db.c  | 199 ++++++++++++++++++++++++++++++++-\n drivers/net/bnxt/tf_ulp/ulp_flow_db.h  |  30 +++++\n drivers/net/bnxt/tf_ulp/ulp_mapper.c   | 193 ++++++++++++++++++++++++++++++++\n drivers/net/bnxt/tf_ulp/ulp_mapper.h   |  13 +++\n drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c |  23 +++-\n drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h |  18 +++\n 6 files changed, 474 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\nindex 6e73f25..eecee6b 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n@@ -23,6 +23,32 @@\n #define ULP_FLOW_DB_RES_NXT_RESET(dst)\t((dst) &= ~(ULP_FLOW_DB_RES_NXT_MASK))\n \n /*\n+ * Helper function to set the bit in the active flow table\n+ * No validation is done in this function.\n+ *\n+ * flow_tbl [in] Ptr to flow table\n+ * idx [in] The index to bit to be set or reset.\n+ * flag [in] 1 to set and 0 to reset.\n+ *\n+ * returns none\n+ */\n+static void\n+ulp_flow_db_active_flow_set(struct bnxt_ulp_flow_tbl\t*flow_tbl,\n+\t\t\t    uint32_t\t\t\tidx,\n+\t\t\t    uint32_t\t\t\tflag)\n+{\n+\tuint32_t\t\tactive_index;\n+\n+\tactive_index = idx / ULP_INDEX_BITMAP_SIZE;\n+\tif (flag)\n+\t\tULP_INDEX_BITMAP_SET(flow_tbl->active_flow_tbl[active_index],\n+\t\t\t\t     idx);\n+\telse\n+\t\tULP_INDEX_BITMAP_RESET(flow_tbl->active_flow_tbl[active_index],\n+\t\t\t\t       idx);\n+}\n+\n+/*\n  * Helper function to allocate the flow table and initialize\n  *  is set.No validation being done in this function.\n  *\n@@ -71,6 +97,35 @@ ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info   *resource_info,\n }\n \n /*\n+ * Helper function to copy the resource params to resource info\n+ *  No validation being done in this function.\n+ *\n+ * resource_info [in] Ptr to resource information\n+ * params [out] The output params to the caller\n+ *\n+ * returns none\n+ */\n+static void\n+ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info   *resource_info,\n+\t\t\t       struct ulp_flow_db_res_params  *params)\n+{\n+\tmemset(params, 0, sizeof(struct ulp_flow_db_res_params));\n+\tparams->direction = ((resource_info->nxt_resource_idx &\n+\t\t\t\t ULP_FLOW_DB_RES_DIR_MASK) >>\n+\t\t\t\t ULP_FLOW_DB_RES_DIR_BIT);\n+\tparams->resource_func = ((resource_info->nxt_resource_idx &\n+\t\t\t\t ULP_FLOW_DB_RES_FUNC_MASK) >>\n+\t\t\t\t ULP_FLOW_DB_RES_FUNC_BITS);\n+\n+\tif (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {\n+\t\tparams->resource_hndl = resource_info->resource_hndl;\n+\t\tparams->resource_type = resource_info->resource_type;\n+\t} else {\n+\t\tparams->resource_hndl = resource_info->resource_em_handle;\n+\t}\n+}\n+\n+/*\n  * Helper function to allocate the flow table and initialize\n  * the stack for allocation operations.\n  *\n@@ -122,7 +177,7 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db,\n }\n \n /*\n- * Helper function to de allocate the flow table.\n+ * Helper function to deallocate the flow table.\n  *\n  * flow_db [in] Ptr to flow database structure\n  * tbl_idx [in] The index to table creation.\n@@ -321,3 +376,145 @@ int32_t\tulp_flow_db_resource_add(struct bnxt_ulp_context\t*ulp_ctxt,\n \t/* all good, return success */\n \treturn 0;\n }\n+\n+/*\n+ * Free the flow database entry.\n+ * The params->critical_resource has to be set to 1 to free the first resource.\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * tbl_idx [in] Specify it is regular or default flow\n+ * fid [in] The index to the flow entry\n+ * params [in/out] The contents to be copied into params.\n+ * Onlythe critical_resource needs to be set by the caller.\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_resource_del(struct bnxt_ulp_context\t*ulp_ctxt,\n+\t\t\t\t enum bnxt_ulp_flow_db_tables\ttbl_idx,\n+\t\t\t\t uint32_t\t\t\tfid,\n+\t\t\t\t struct ulp_flow_db_res_params\t*params)\n+{\n+\tstruct bnxt_ulp_flow_db\t\t*flow_db;\n+\tstruct bnxt_ulp_flow_tbl\t*flow_tbl;\n+\tstruct ulp_fdb_resource_info\t*nxt_resource, *fid_resource;\n+\tuint32_t\t\t\tnxt_idx = 0;\n+\n+\tflow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);\n+\tif (!flow_db) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid table index\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tflow_tbl = &flow_db->flow_tbl[tbl_idx];\n+\n+\t/* check for max flows */\n+\tif (fid >= flow_tbl->num_flows || !fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check if the flow is active or not */\n+\tif (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {\n+\t\tBNXT_TF_DBG(ERR, \"flow does not exist\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfid_resource = &flow_tbl->flow_resources[fid];\n+\tif (!params->critical_resource) {\n+\t\t/* Not the critical resource so free the resource */\n+\t\tULP_FLOW_DB_RES_NXT_SET(nxt_idx,\n+\t\t\t\t\tfid_resource->nxt_resource_idx);\n+\t\tif (!nxt_idx) {\n+\t\t\t/* reached end of resources */\n+\t\t\treturn -ENOENT;\n+\t\t}\n+\t\tnxt_resource = &flow_tbl->flow_resources[nxt_idx];\n+\n+\t\t/* connect the fid resource to the next resource */\n+\t\tULP_FLOW_DB_RES_NXT_RESET(fid_resource->nxt_resource_idx);\n+\t\tULP_FLOW_DB_RES_NXT_SET(fid_resource->nxt_resource_idx,\n+\t\t\t\t\tnxt_resource->nxt_resource_idx);\n+\n+\t\t/* update the contents to be given to caller */\n+\t\tulp_flow_db_res_info_to_params(nxt_resource, params);\n+\n+\t\t/* Delete the nxt_resource */\n+\t\tmemset(nxt_resource, 0, sizeof(struct ulp_fdb_resource_info));\n+\n+\t\t/* add it to the free list */\n+\t\tflow_tbl->tail_index++;\n+\t\tif (flow_tbl->tail_index >= flow_tbl->num_resources) {\n+\t\t\tBNXT_TF_DBG(ERR, \"FlowDB:Tail reached max\\n\");\n+\t\t\treturn -ENOENT;\n+\t\t}\n+\t\tflow_tbl->flow_tbl_stack[flow_tbl->tail_index] = nxt_idx;\n+\n+\t} else {\n+\t\t/* Critical resource. copy the contents and exit */\n+\t\tulp_flow_db_res_info_to_params(fid_resource, params);\n+\t\tULP_FLOW_DB_RES_NXT_SET(nxt_idx,\n+\t\t\t\t\tfid_resource->nxt_resource_idx);\n+\t\tmemset(fid_resource, 0, sizeof(struct ulp_fdb_resource_info));\n+\t\tULP_FLOW_DB_RES_NXT_SET(fid_resource->nxt_resource_idx,\n+\t\t\t\t\tnxt_idx);\n+\t}\n+\n+\t/* all good, return success */\n+\treturn 0;\n+}\n+\n+/*\n+ * Free the flow database entry\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * tbl_idx [in] Specify it is regular or default flow\n+ * fid [in] The index to the flow entry\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_fid_free(struct bnxt_ulp_context\t\t*ulp_ctxt,\n+\t\t\t     enum bnxt_ulp_flow_db_tables\ttbl_idx,\n+\t\t\t     uint32_t\t\t\t\tfid)\n+{\n+\tstruct bnxt_ulp_flow_db\t\t*flow_db;\n+\tstruct bnxt_ulp_flow_tbl\t*flow_tbl;\n+\n+\tflow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);\n+\tif (!flow_db) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid table index\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tflow_tbl = &flow_db->flow_tbl[tbl_idx];\n+\n+\t/* check for limits of fid */\n+\tif (fid >= flow_tbl->num_flows || !fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check if the flow is active or not */\n+\tif (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {\n+\t\tBNXT_TF_DBG(ERR, \"flow does not exist\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tflow_tbl->head_index--;\n+\tif (!flow_tbl->head_index) {\n+\t\tBNXT_TF_DBG(ERR, \"FlowDB: Head Ptr is zero\\n\");\n+\t\treturn -ENOENT;\n+\t}\n+\tflow_tbl->flow_tbl_stack[flow_tbl->head_index] = fid;\n+\tulp_flow_db_active_flow_set(flow_tbl, fid, 0);\n+\n+\t/* all good, return success */\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\nindex f6055a5..20109b9 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n@@ -99,4 +99,34 @@ int32_t\tulp_flow_db_resource_add(struct bnxt_ulp_context\t*ulp_ctxt,\n \t\t\t\t uint32_t\t\t\tfid,\n \t\t\t\t struct ulp_flow_db_res_params\t*params);\n \n+/*\n+ * Free the flow database entry.\n+ * The params->critical_resource has to be set to 1 to free the first resource.\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * tbl_idx [in] Specify it is regular or default flow\n+ * fid [in] The index to the flow entry\n+ * params [in/out] The contents to be copied into params.\n+ * Only the critical_resource needs to be set by the caller.\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_resource_del(struct bnxt_ulp_context\t*ulp_ctxt,\n+\t\t\t\t enum bnxt_ulp_flow_db_tables\ttbl_idx,\n+\t\t\t\t uint32_t\t\t\tfid,\n+\t\t\t\t struct ulp_flow_db_res_params\t*params);\n+\n+/*\n+ * Free the flow database entry\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * tbl_idx [in] Specify it is regular or default flow\n+ * fid [in] The index to the flow entry\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_fid_free(struct bnxt_ulp_context\t\t*ulp_ctxt,\n+\t\t\t     enum bnxt_ulp_flow_db_tables\ttbl_idx,\n+\t\t\t     uint32_t\t\t\t\tfid);\n+\n #endif /* _ULP_FLOW_DB_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\nindex f378f8e..b3d981e 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n@@ -143,6 +143,87 @@ ulp_mapper_ident_fields_get(struct bnxt_ulp_mapper_class_tbl_info *tbl,\n \treturn &ulp_ident_list[idx];\n }\n \n+static inline int32_t\n+ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp  __rte_unused,\n+\t\t\t   struct tf *tfp,\n+\t\t\t   struct ulp_flow_db_res_params *res)\n+{\n+\tstruct tf_free_tcam_entry_parms fparms = {\n+\t\t.dir\t\t= res->direction,\n+\t\t.tcam_tbl_type\t= res->resource_type,\n+\t\t.idx\t\t= (uint16_t)res->resource_hndl\n+\t};\n+\n+\treturn tf_free_tcam_entry(tfp, &fparms);\n+}\n+\n+static inline int32_t\n+ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp  __rte_unused,\n+\t\t\t    struct tf *tfp,\n+\t\t\t    struct ulp_flow_db_res_params *res)\n+{\n+\tstruct tf_free_tbl_entry_parms fparms = {\n+\t\t.dir\t= res->direction,\n+\t\t.type\t= res->resource_type,\n+\t\t.idx\t= (uint32_t)res->resource_hndl\n+\t};\n+\n+\treturn tf_free_tbl_entry(tfp, &fparms);\n+}\n+\n+static inline int32_t\n+ulp_mapper_eem_entry_free(struct bnxt_ulp_context *ulp,\n+\t\t\t  struct tf *tfp,\n+\t\t\t  struct ulp_flow_db_res_params *res)\n+{\n+\tstruct tf_delete_em_entry_parms fparms = { 0 };\n+\tint32_t rc;\n+\n+\tfparms.dir\t\t= res->direction;\n+\tfparms.mem\t\t= TF_MEM_EXTERNAL;\n+\tfparms.flow_handle\t= res->resource_hndl;\n+\n+\trc = bnxt_ulp_cntxt_tbl_scope_id_get(ulp, &fparms.tbl_scope_id);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to get table scope\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn tf_delete_em_entry(tfp, &fparms);\n+}\n+\n+static inline int32_t\n+ulp_mapper_ident_free(struct bnxt_ulp_context *ulp __rte_unused,\n+\t\t      struct tf *tfp,\n+\t\t      struct ulp_flow_db_res_params *res)\n+{\n+\tstruct tf_free_identifier_parms fparms = {\n+\t\t.dir\t\t= res->direction,\n+\t\t.ident_type\t= res->resource_type,\n+\t\t.id\t\t= (uint16_t)res->resource_hndl\n+\t};\n+\n+\treturn tf_free_identifier(tfp, &fparms);\n+}\n+\n+static inline int32_t\n+ulp_mapper_mark_free(struct bnxt_ulp_context *ulp,\n+\t\t     struct ulp_flow_db_res_params *res)\n+{\n+\tuint32_t flag;\n+\tuint32_t fid;\n+\tuint32_t gfid;\n+\n+\tfid\t  = (uint32_t)res->resource_hndl;\n+\tTF_GET_FLAG_FROM_FLOW_ID(fid, flag);\n+\tTF_GET_GFID_FROM_FLOW_ID(fid, gfid);\n+\n+\treturn ulp_mark_db_mark_del(ulp,\n+\t\t\t\t    (flag == TF_GFID_TABLE_EXTERNAL),\n+\t\t\t\t    gfid,\n+\t\t\t\t    0);\n+}\n+\n static int32_t\n ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms,\n \t\t\t struct bnxt_ulp_mapper_class_tbl_info *tbl,\n@@ -1142,3 +1223,115 @@ ulp_mapper_class_tbls_process(struct bnxt_ulp_mapper_parms *parms)\n \n \treturn rc;\n }\n+\n+static int32_t\n+ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,\n+\t\t\t struct ulp_flow_db_res_params *res)\n+{\n+\tstruct tf *tfp;\n+\tint32_t\trc = 0;\n+\n+\tif (!res || !ulp) {\n+\t\tBNXT_TF_DBG(ERR, \"Unable to free resource\\n \");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttfp = bnxt_ulp_cntxt_tfp_get(ulp);\n+\tif (!tfp) {\n+\t\tBNXT_TF_DBG(ERR, \"Unable to free resource failed to get tfp\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tswitch (res->resource_func) {\n+\tcase BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE:\n+\t\trc = ulp_mapper_tcam_entry_free(ulp, tfp, res);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_EM_TABLE:\n+\t\trc = ulp_mapper_eem_entry_free(ulp, tfp, res);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:\n+\t\trc = ulp_mapper_index_entry_free(ulp, tfp, res);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_IDENTIFIER:\n+\t\trc = ulp_mapper_ident_free(ulp, tfp, res);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_HW_FID:\n+\t\trc = ulp_mapper_mark_free(ulp, res);\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\treturn rc;\n+}\n+\n+int32_t\n+ulp_mapper_resources_free(struct bnxt_ulp_context\t*ulp_ctx,\n+\t\t\t  uint32_t fid,\n+\t\t\t  enum bnxt_ulp_flow_db_tables\ttbl_type)\n+{\n+\tstruct ulp_flow_db_res_params\tres_parms = { 0 };\n+\tint32_t\t\t\t\trc, trc;\n+\n+\tif (!ulp_ctx) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid parms, unable to free flow\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * Set the critical resource on the first resource del, then iterate\n+\t * while status is good\n+\t */\n+\tres_parms.critical_resource = 1;\n+\trc = ulp_flow_db_resource_del(ulp_ctx, tbl_type, fid, &res_parms);\n+\n+\tif (rc) {\n+\t\t/*\n+\t\t * This is unexpected on the first call to resource del.\n+\t\t * It likely means that the flow did not exist in the flow db.\n+\t\t */\n+\t\tBNXT_TF_DBG(ERR, \"Flow[%d][0x%08x] failed to free (rc=%d)\\n\",\n+\t\t\t    tbl_type, fid, rc);\n+\t\treturn rc;\n+\t}\n+\n+\twhile (!rc) {\n+\t\ttrc = ulp_mapper_resource_free(ulp_ctx, &res_parms);\n+\t\tif (trc)\n+\t\t\t/*\n+\t\t\t * On fail, we still need to attempt to free the\n+\t\t\t * remaining resources.  Don't return\n+\t\t\t */\n+\t\t\tBNXT_TF_DBG(ERR,\n+\t\t\t\t    \"Flow[%d][0x%x] Res[%d][0x%016\" PRIx64\n+\t\t\t\t    \"] failed rc=%d.\\n\",\n+\t\t\t\t    tbl_type, fid, res_parms.resource_func,\n+\t\t\t\t    res_parms.resource_hndl, trc);\n+\n+\t\t/* All subsequent call require the critical_resource be zero */\n+\t\tres_parms.critical_resource = 0;\n+\n+\t\trc = ulp_flow_db_resource_del(ulp_ctx,\n+\t\t\t\t\t      tbl_type,\n+\t\t\t\t\t      fid,\n+\t\t\t\t\t      &res_parms);\n+\t}\n+\n+\t/* Free the Flow ID since we've removed all resources */\n+\trc = ulp_flow_db_fid_free(ulp_ctx, tbl_type, fid);\n+\n+\treturn rc;\n+}\n+\n+int32_t\n+ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid)\n+{\n+\tif (!ulp_ctx) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid parms, unable to free flow\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn ulp_mapper_resources_free(ulp_ctx,\n+\t\t\t\t\t fid,\n+\t\t\t\t\t BNXT_ULP_REGULAR_FLOW_TABLE);\n+}\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\nindex 2221e12..8655728 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n@@ -38,4 +38,17 @@ struct bnxt_ulp_mapper_parms {\n \tenum bnxt_ulp_flow_db_tables\t\ttbl_idx;\n };\n \n+/* Function that frees all resources associated with the flow. */\n+int32_t\n+ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid);\n+\n+/*\n+ * Function that frees all resources and can be called on default or regular\n+ * flows\n+ */\n+int32_t\n+ulp_mapper_resources_free(struct bnxt_ulp_context\t*ulp_ctx,\n+\t\t\t  uint32_t fid,\n+\t\t\t  enum bnxt_ulp_flow_db_tables\ttbl_type);\n+\n #endif /* _ULP_MAPPER_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c\nindex 837064e..566668e 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c\n@@ -135,7 +135,7 @@ ulp_mark_db_init(struct bnxt_ulp_context *ctxt)\n \t\t    mark_tbl->gfid_max,\n \t\t    mark_tbl->gfid_mask);\n \n-\t/* Add the mart tbl to the ulp context. */\n+\t/* Add the mark tbl to the ulp context. */\n \tbnxt_ulp_cntxt_ptr2_mark_db_set(ctxt, mark_tbl);\n \n \treturn 0;\n@@ -195,3 +195,24 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,\n {\n \treturn ulp_mark_db_mark_set(ctxt, is_gfid, gfid, mark);\n }\n+\n+/*\n+ * Removes a Mark from the Mark Manager\n+ *\n+ * ctxt [in] The ulp context for the mark manager\n+ *\n+ * is_gfid [in] The type of fid (GFID or LFID)\n+ *\n+ * fid [in] The flow id that is returned by HW in BD\n+ *\n+ * mark [in] The mark to be associated with the FID\n+ *\n+ */\n+int32_t\n+ulp_mark_db_mark_del(struct bnxt_ulp_context *ctxt,\n+\t\t     bool is_gfid,\n+\t\t     uint32_t gfid,\n+\t\t     uint32_t mark  __rte_unused)\n+{\n+\treturn ulp_mark_db_mark_set(ctxt, is_gfid, gfid, ULP_MARK_INVALID);\n+}\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h\nindex 18abea4..f0d1515 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.h\n@@ -72,4 +72,22 @@ ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,\n \t\t     uint32_t gfid,\n \t\t     uint32_t mark);\n \n+/*\n+ * Removes a Mark from the Mark Manager\n+ *\n+ * ctxt [in] The ulp context for the mark manager\n+ *\n+ * is_gfid [in] The type of fid (GFID or LFID)\n+ *\n+ * fid [in] The flow id that is returned by HW in BD\n+ *\n+ * mark [in] The mark to be associated with the FID\n+ *\n+ */\n+int32_t\n+ulp_mark_db_mark_del(struct bnxt_ulp_context *ctxt,\n+\t\t     bool is_gfid,\n+\t\t     uint32_t gfid,\n+\t\t     uint32_t mark);\n+\n #endif /* _ULP_MARK_MGR_H_ */\n",
    "prefixes": [
        "v4",
        "21/34"
    ]
}