get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 80268,
    "url": "http://patches.dpdk.org/api/patches/80268/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201010041153.63921-13-ajit.khaparde@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": "<20201010041153.63921-13-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201010041153.63921-13-ajit.khaparde@broadcom.com",
    "date": "2020-10-10T04:11:53",
    "name": "[v2,12/12] net/bnxt: add parent child flow create and free",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6c2e672479446e837e06df459a54997ce59b8ea5",
    "submitter": {
        "id": 501,
        "url": "http://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@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/20201010041153.63921-13-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 12854,
            "url": "http://patches.dpdk.org/api/series/12854/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12854",
            "date": "2020-10-10T04:11:42",
            "name": "[v2,01/12] net/bnxt: fix the corruption of the session details",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/12854/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/80268/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/80268/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 E6C0DA04BC;\n\tSat, 10 Oct 2020 06:17:33 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0B4D51D8F4;\n\tSat, 10 Oct 2020 06:13:26 +0200 (CEST)",
            "from mail-pf1-f229.google.com (mail-pf1-f229.google.com\n [209.85.210.229]) by dpdk.org (Postfix) with ESMTP id 420AD1D8CE\n for <dev@dpdk.org>; Sat, 10 Oct 2020 06:13:18 +0200 (CEST)",
            "by mail-pf1-f229.google.com with SMTP id k8so8557559pfk.2\n for <dev@dpdk.org>; Fri, 09 Oct 2020 21:13:18 -0700 (PDT)",
            "from localhost.localdomain ([192.19.223.252])\n by smtp-relay.gmail.com with ESMTPS id b4sm1597022pjn.3.2020.10.09.21.13.15\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Fri, 09 Oct 2020 21:13:16 -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 :mime-version:content-transfer-encoding;\n bh=upxzZ7Vv72IAoBagG2l39uCsOvp11bM9AnE9nzP+mRM=;\n b=c/8Cr+e1xFZWya2WXCfoFyRNM9OASqIlWlDtuAMg41Ea3EmdRXeGuFha+p05F+DeQT\n 5ATkTzR2RAvRO5AEUeLO6K8rijhCHuuBE5/M8SaDHN2sNYHDFvFR6b0bGCSAER5pgDTj\n hePACrE4DAh4QxRMFkpllmvTW2iuXRrFY8SKI=",
        "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:mime-version:content-transfer-encoding;\n bh=upxzZ7Vv72IAoBagG2l39uCsOvp11bM9AnE9nzP+mRM=;\n b=dkfgPLaDYfeyUpnrsfX+KN2+4n0dXhSQMbvREXsQI+2mOvhRwrFKyEAuUD5pWkSLh8\n SU3q9GOfcK5SRzMFoiwqot9saHQMOoxRMhdj2eLG0rfXSU73U4ii9PNiJ6DGUhj0Hdje\n WF+0VLFpFBoVrhyMoMN7TImcW0Qi0s43XY2tT6ygsIZDiF3LpAC8OZW/Cw5NgwVZiNKF\n HnL+fhZhW8HGREQ4M89crslx0rxzjJeDDv1Eim/WwNQcjZqyxAd4H2aPgP8DirHNw9+M\n 5In2njL0EXUDCIuolQKkHqc/85JJrVSAh7m0LYK7eEfJoLYqw1GjUg8oIvFzUT5hUwyv\n JB/A==",
        "X-Gm-Message-State": "AOAM5321ex7Ccq9TJ7iJ5025StxoHVCSq9Sgxga8TARacBPFHoQ2qowV\n L9M2/FGSZJOBFZXNRDeR8rLG69z1fNRySfewlXaoyorDckO8lAFeG6nO9mU5V0CYSYgv6lvkqyC\n O2s1+GUsG4a8iCFmS9Xpboxm2F6XwyzvFPJYvDZaP5nOWzTCSRaEgZxCFEaquP2yj5Krr9zb21q\n of9w==",
        "X-Google-Smtp-Source": "\n ABdhPJxC0okhYTam0upN6lhR5+ZtOwMSpeNKau4OSlginzY6STdxmP8ikg/s7OzH4pyB05bsWC6N1izH4olz",
        "X-Received": "by 2002:a17:90a:ad98:: with SMTP id\n s24mr8079671pjq.199.1602303196309;\n Fri, 09 Oct 2020 21:13:16 -0700 (PDT)",
        "X-Relaying-Domain": "broadcom.com",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Kishore Padmanabha <kishore.padmanabha@broadcom.com>,\n Mike Baucom <michael.baucom@broadcom.com>",
        "Date": "Fri,  9 Oct 2020 21:11:53 -0700",
        "Message-Id": "<20201010041153.63921-13-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20201010041153.63921-1-ajit.khaparde@broadcom.com>",
        "References": "<20201009111130.10422-1-somnath.kotur@broadcom.com>\n <20201010041153.63921-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 12/12] net/bnxt: add parent child flow create\n\tand free",
        "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: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\n\nAdded support in the ULP mapper to enable parent child flow\ncreation and destroy. This feature enables support for the vxlan\ndecap functionality.\n\nSigned-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nReviewed-by: Mike Baucom <michael.baucom@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 177 +++++++++++++++++-\n drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  36 ++++\n drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  87 ++++++++-\n drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   7 +\n .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   5 +-\n 5 files changed, 302 insertions(+), 10 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 a1c39329f..3be748908 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n@@ -6,10 +6,10 @@\n #include <rte_malloc.h>\n #include \"bnxt.h\"\n #include \"bnxt_tf_common.h\"\n-#include \"ulp_flow_db.h\"\n #include \"ulp_utils.h\"\n #include \"ulp_template_struct.h\"\n #include \"ulp_mapper.h\"\n+#include \"ulp_flow_db.h\"\n #include \"ulp_fc_mgr.h\"\n \n #define ULP_FLOW_DB_RES_DIR_BIT\t\t31\n@@ -56,10 +56,10 @@ ulp_flow_db_active_flows_bit_set(struct bnxt_ulp_flow_db *flow_db,\n \t} else {\n \t\tif (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)\n \t\t\tULP_INDEX_BITMAP_RESET(f_tbl->active_reg_flows[a_idx],\n-\t\t\t\t\t     idx);\n+\t\t\t\t\t       idx);\n \t\telse\n \t\t\tULP_INDEX_BITMAP_RESET(f_tbl->active_dflt_flows[a_idx],\n-\t\t\t\t\t     idx);\n+\t\t\t\t\t       idx);\n \t}\n }\n \n@@ -89,6 +89,13 @@ ulp_flow_db_active_flows_bit_is_set(struct bnxt_ulp_flow_db *flow_db,\n \t\t\t\t\t    idx);\n }\n \n+static inline enum tf_dir\n+ulp_flow_db_resource_dir_get(struct ulp_fdb_resource_info *res_info)\n+{\n+\treturn ((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_DIR_MASK) >>\n+\t\tULP_FLOW_DB_RES_DIR_BIT);\n+}\n+\n static uint8_t\n ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)\n {\n@@ -157,11 +164,9 @@ 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 \n \t/* use the helper function to get the resource func */\n+\tparams->direction = ulp_flow_db_resource_dir_get(resource_info);\n \tparams->resource_func = ulp_flow_db_resource_func_get(resource_info);\n \n \tif (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EXT_EM_TABLE ||\n@@ -303,6 +308,9 @@ ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,\n \tstruct ulp_fdb_parent_child_db *p_db;\n \tuint32_t size, idx;\n \n+\tif (!num_entries)\n+\t\treturn 0;\n+\n \t/* update the sizes for the allocation */\n \tp_db = &flow_db->parent_child_db;\n \tp_db->child_bitset_size = (flow_db->flow_tbl.num_flows /\n@@ -1171,6 +1179,12 @@ ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* No support for parent child db then just exit */\n+\tif (!flow_db->parent_child_db.entries_count) {\n+\t\tBNXT_TF_DBG(ERR, \"parent child db not supported\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tp_pdb = &flow_db->parent_child_db;\n \tfor (idx = 0; idx <= p_pdb->entries_count; idx++) {\n \t\tif (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {\n@@ -1220,6 +1234,12 @@ ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* No support for parent child db then just exit */\n+\tif (!flow_db->parent_child_db.entries_count) {\n+\t\tBNXT_TF_DBG(ERR, \"parent child db not supported\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tp_pdb = &flow_db->parent_child_db;\n \tfor (idx = 0; idx <= p_pdb->entries_count; idx++) {\n \t\tif (p_pdb->parent_flow_tbl[idx].parent_fid == fid) {\n@@ -1273,6 +1293,12 @@ ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* No support for parent child db then just exit */\n+\tif (!flow_db->parent_child_db.entries_count) {\n+\t\tBNXT_TF_DBG(ERR, \"parent child db not supported\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tp_pdb = &flow_db->parent_child_db;\n \ta_idx = child_fid / ULP_INDEX_BITMAP_SIZE;\n \tfor (idx = 0; idx <= p_pdb->entries_count; idx++) {\n@@ -1320,6 +1346,12 @@ ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\treturn -EINVAL;\n \t}\n \n+\t/* No support for parent child db then just exit */\n+\tif (!flow_db->parent_child_db.entries_count) {\n+\t\tBNXT_TF_DBG(ERR, \"parent child db not supported\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tp_pdb = &flow_db->parent_child_db;\n \tfor (idx = 0; idx <= p_pdb->entries_count; idx++) {\n \t\tif (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {\n@@ -1392,3 +1424,136 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,\n \t*child_fid = next_fid;\n \treturn 0;\n }\n+\n+/*\n+ * Orphan the child flow entry\n+ * This is called only for child flows that have\n+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * flow_type [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\n+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t     enum bnxt_ulp_fdb_type flow_type,\n+\t\t\t     uint32_t fid)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct bnxt_ulp_flow_tbl *flow_tbl;\n+\tstruct ulp_fdb_resource_info *fid_res;\n+\tuint32_t res_id = 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 (flow_type > BNXT_ULP_FDB_TYPE_DEFAULT) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow type\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tflow_tbl = &flow_db->flow_tbl;\n+\t/* check for max flows */\n+\tif (fid >= flow_tbl->num_flows || !fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index %x\\n\", fid);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check if the flow is active or not */\n+\tif (!ulp_flow_db_active_flows_bit_is_set(flow_db, flow_type, fid)) {\n+\t\tBNXT_TF_DBG(ERR, \"flow does not exist\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Iterate the resource to get the resource handle */\n+\tres_id =  fid;\n+\twhile (res_id) {\n+\t\tfid_res = &flow_tbl->flow_resources[res_id];\n+\t\tif (ulp_flow_db_resource_func_get(fid_res) ==\n+\t\t    BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW) {\n+\t\t\t/* invalidate the resource details */\n+\t\t\tfid_res->resource_hndl = 0;\n+\t\t\treturn 0;\n+\t\t}\n+\t\tres_id = 0;\n+\t\tULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);\n+\t}\n+\t/* failed */\n+\treturn -1;\n+}\n+\n+/*\n+ * Create parent flow in the parent flow tbl\n+ *\n+ * parms [in] Ptr to mapper params\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms)\n+{\n+\tstruct ulp_flow_db_res_params fid_parms;\n+\tint32_t fid_idx;\n+\n+\t/* create the child flow entry in parent flow table */\n+\tfid_idx = ulp_flow_db_parent_flow_alloc(parms->ulp_ctx, parms->fid);\n+\tif (fid_idx < 0) {\n+\t\tBNXT_TF_DBG(ERR, \"Error in creating parent flow fid %x\\n\",\n+\t\t\t    parms->fid);\n+\t\treturn -1;\n+\t}\n+\n+\t/* Add the parent details in the resource list of the flow */\n+\tmemset(&fid_parms, 0, sizeof(fid_parms));\n+\tfid_parms.resource_func\t= BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW;\n+\tfid_parms.resource_hndl\t= fid_idx;\n+\tfid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;\n+\tif (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,\n+\t\t\t\t     parms->fid, &fid_parms)) {\n+\t\tBNXT_TF_DBG(ERR, \"Error in adding flow res for fid %x\\n\",\n+\t\t\t    parms->fid);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Create child flow in the parent flow tbl\n+ *\n+ * parms [in] Ptr to mapper params\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms)\n+{\n+\tstruct ulp_flow_db_res_params fid_parms;\n+\tint32_t rc;\n+\n+\t/* create the parent flow entry in parent flow table */\n+\trc = ulp_flow_db_parent_child_flow_set(parms->ulp_ctx,\n+\t\t\t\t\t       parms->parent_fid,\n+\t\t\t\t\t       parms->fid, 1);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Error in setting child fid %x\\n\", parms->fid);\n+\t\treturn -1;\n+\t}\n+\n+\t/* Add the parent details in the resource list of the flow */\n+\tmemset(&fid_parms, 0, sizeof(fid_parms));\n+\tfid_parms.resource_func\t= BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW;\n+\tfid_parms.resource_hndl\t= parms->parent_fid;\n+\tfid_parms.critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO;\n+\tif (ulp_flow_db_resource_add(parms->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR,\n+\t\t\t\t     parms->fid, &fid_parms)) {\n+\t\tBNXT_TF_DBG(ERR, \"Error in adding flow res for fid %x\\n\",\n+\t\t\t    parms->fid);\n+\t\treturn -1;\n+\t}\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 87bcd69ae..95fd1992d 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n@@ -8,6 +8,7 @@\n \n #include \"bnxt_ulp.h\"\n #include \"ulp_template_db_enum.h\"\n+#include \"ulp_mapper.h\"\n \n #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS\t\t512\n #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES\t8\n@@ -319,5 +320,40 @@ ulp_flow_db_parent_child_flow_next_entry_get(struct bnxt_ulp_flow_db *flow_db,\n \t\t\t\t\t     uint32_t parent_idx,\n \t\t\t\t\t     uint32_t *child_fid);\n \n+/*\n+ * Orphan the child flow entry\n+ * This is called only for child flows that have\n+ * BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW resource\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * flow_type [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\n+ulp_flow_db_child_flow_reset(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t     enum bnxt_ulp_fdb_type flow_type,\n+\t\t\t     uint32_t fid);\n+\n+/*\n+ * Create parent flow in the parent flow tbl\n+ *\n+ * parms [in] Ptr to mapper params\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_create(struct bnxt_ulp_mapper_parms *parms);\n+\n+/*\n+ * Create child flow in the parent flow tbl\n+ *\n+ * parms [in] Ptr to mapper params\n+ *\n+ * Returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_child_flow_create(struct bnxt_ulp_mapper_parms *parms);\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 cd289cc40..b74cb92f5 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n@@ -14,8 +14,8 @@\n #include \"tfp.h\"\n #include \"tf_ext_flow_handle.h\"\n #include \"ulp_mark_mgr.h\"\n-#include \"ulp_flow_db.h\"\n #include \"ulp_mapper.h\"\n+#include \"ulp_flow_db.h\"\n #include \"tf_util.h\"\n \n static struct bnxt_ulp_glb_resource_info *\n@@ -537,6 +537,65 @@ ulp_mapper_mark_free(struct bnxt_ulp_context *ulp,\n \t\t\t\t    res->resource_hndl);\n }\n \n+\n+static inline int32_t\n+ulp_mapper_parent_flow_free(struct bnxt_ulp_context *ulp,\n+\t\t\t    uint32_t parent_fid,\n+\t\t\t    struct ulp_flow_db_res_params *res)\n+{\n+\tuint32_t idx, child_fid = 0, parent_idx;\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\n+\tparent_idx = (uint32_t)res->resource_hndl;\n+\n+\t/* check the validity of the parent fid */\n+\tif (ulp_flow_db_parent_flow_idx_get(ulp, parent_fid, &idx) ||\n+\t    idx != parent_idx) {\n+\t\tBNXT_TF_DBG(ERR, \"invalid parent flow id %x\\n\", parent_fid);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Clear all the child flows parent index */\n+\tflow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp);\n+\twhile (!ulp_flow_db_parent_child_flow_next_entry_get(flow_db, idx,\n+\t\t\t\t\t\t\t     &child_fid)) {\n+\t\t/* update the child flows resource handle */\n+\t\tif (ulp_flow_db_child_flow_reset(ulp, BNXT_ULP_FDB_TYPE_REGULAR,\n+\t\t\t\t\t\t child_fid)) {\n+\t\t\tBNXT_TF_DBG(ERR, \"failed to reset child flow %x\\n\",\n+\t\t\t\t    child_fid);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\t/* free the parent entry in the parent table flow */\n+\tif (ulp_flow_db_parent_flow_free(ulp, parent_fid)) {\n+\t\tBNXT_TF_DBG(ERR, \"failed to free parent flow %x\\n\", parent_fid);\n+\t\treturn -EINVAL;\n+\t}\n+\treturn 0;\n+}\n+\n+static inline int32_t\n+ulp_mapper_child_flow_free(struct bnxt_ulp_context *ulp,\n+\t\t\t   uint32_t child_fid,\n+\t\t\t   struct ulp_flow_db_res_params *res)\n+{\n+\tuint32_t parent_fid;\n+\n+\tparent_fid = (uint32_t)res->resource_hndl;\n+\tif (!parent_fid)\n+\t\treturn 0; /* Already freed - orphan child*/\n+\n+\t/* reset the child flow bitset*/\n+\tif (ulp_flow_db_parent_child_flow_set(ulp, parent_fid, child_fid, 0)) {\n+\t\tBNXT_TF_DBG(ERR, \"error in resetting child flow bitset %x:%x\\n\",\n+\t\t\t    parent_fid, child_fid);\n+\t\treturn -EINVAL;\n+\t}\n+\treturn 0;\n+}\n+\n /*\n  * Process the identifier instruction and either store it in the flow database\n  * or return it in the val (if not NULL) on success.  If val is NULL, the\n@@ -2484,6 +2543,7 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, uint32_t tid)\n \n static int32_t\n ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,\n+\t\t\t uint32_t fid,\n \t\t\t struct ulp_flow_db_res_params *res)\n {\n \tstruct tf *tfp;\n@@ -2520,6 +2580,12 @@ ulp_mapper_resource_free(struct bnxt_ulp_context *ulp,\n \tcase BNXT_ULP_RESOURCE_FUNC_HW_FID:\n \t\trc = ulp_mapper_mark_free(ulp, res);\n \t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_PARENT_FLOW:\n+\t\trc = ulp_mapper_parent_flow_free(ulp, fid, res);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESOURCE_FUNC_CHILD_FLOW:\n+\t\trc = ulp_mapper_child_flow_free(ulp, fid, res);\n+\t\tbreak;\n \tdefault:\n \t\tbreak;\n \t}\n@@ -2558,7 +2624,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,\n \t}\n \n \twhile (!rc) {\n-\t\ttrc = ulp_mapper_resource_free(ulp_ctx, &res_parms);\n+\t\ttrc = ulp_mapper_resource_free(ulp_ctx, fid, &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@@ -2608,7 +2674,7 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx,\n \t\t\t/*convert it from BE to cpu */\n \t\t\tres.resource_hndl =\n \t\t\t\ttfp_be_to_cpu_64(ent->resource_hndl);\n-\t\t\tulp_mapper_resource_free(ulp_ctx, &res);\n+\t\t\tulp_mapper_resource_free(ulp_ctx, 0, &res);\n \t\t}\n \t}\n }\n@@ -2720,6 +2786,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,\n \tparms.act_tid = cparms->act_tid;\n \tparms.class_tid = cparms->class_tid;\n \tparms.flow_type = cparms->flow_type;\n+\tparms.parent_flow = cparms->parent_flow;\n+\tparms.parent_fid = cparms->parent_fid;\n \n \t/* Get the device id from the ulp context */\n \tif (bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &parms.dev_id)) {\n@@ -2797,6 +2865,19 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,\n \t\t\tgoto flow_error;\n \t}\n \n+\t/* setup the parent-child details */\n+\tif (parms.parent_flow) {\n+\t\t/* create a parent flow details */\n+\t\trc = ulp_flow_db_parent_flow_create(&parms);\n+\t\tif (rc)\n+\t\t\tgoto flow_error;\n+\t} else if (parms.parent_fid) {\n+\t\t/* create a child flow details */\n+\t\trc = ulp_flow_db_child_flow_create(&parms);\n+\t\tif (rc)\n+\t\t\tgoto flow_error;\n+\t}\n+\n \t*flowid = parms.fid;\n \tbnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);\n \ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\nindex 6f93bcdc1..542e41e5a 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n@@ -76,6 +76,8 @@ struct bnxt_ulp_mapper_parms {\n \tenum bnxt_ulp_cache_table_opc\t\ttcam_tbl_opc;\n \tstruct bnxt_ulp_mapper_cache_entry\t*cache_ptr;\n \tstruct bnxt_ulp_device_params           *device_params;\n+\tuint32_t\t\t\t\tparent_fid;\n+\tuint32_t\t\t\t\tparent_flow;\n };\n \n struct bnxt_ulp_mapper_create_parms {\n@@ -90,6 +92,11 @@ struct bnxt_ulp_mapper_create_parms {\n \tuint16_t\t\t\tfunc_id;\n \tuint32_t\t\t\tdir_attr;\n \tenum bnxt_ulp_fdb_type\t\tflow_type;\n+\n+\t/* if set then create it as a child flow with parent as parent_fid */\n+\tuint32_t\t\t\tparent_fid;\n+\t/* if set then create a parent flow */\n+\tuint32_t\t\t\tparent_flow;\n };\n \n /* Function to initialize any dynamic mapper data. */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\nindex 81da34e3a..168e308c2 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\n@@ -321,7 +321,10 @@ enum bnxt_ulp_resource_func {\n \tBNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,\n \tBNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,\n \tBNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,\n-\tBNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85\n+\tBNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85,\n+\tBNXT_ULP_RESOURCE_FUNC_SHARED_TABLE = 0x86,\n+\tBNXT_ULP_RESOURCE_FUNC_PARENT_FLOW = 0x87,\n+\tBNXT_ULP_RESOURCE_FUNC_CHILD_FLOW = 0x88\n };\n \n enum bnxt_ulp_resource_sub_type {\n",
    "prefixes": [
        "v2",
        "12/12"
    ]
}