get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 80264,
    "url": "https://patches.dpdk.org/api/patches/80264/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201010041153.63921-10-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "https://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-10-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201010041153.63921-10-ajit.khaparde@broadcom.com",
    "date": "2020-10-10T04:11:50",
    "name": "[v2,09/12] net/bnxt: add support for parent child flow database",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1c88b58513a67059629f4645c6753804a80491b4",
    "submitter": {
        "id": 501,
        "url": "https://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "https://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201010041153.63921-10-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 12854,
            "url": "https://patches.dpdk.org/api/series/12854/?format=api",
            "web_url": "https://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": "https://patches.dpdk.org/series/12854/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/80264/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/80264/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 CEBDFA04BC;\n\tSat, 10 Oct 2020 06:15:46 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C3AF81D8CC;\n\tSat, 10 Oct 2020 06:13:18 +0200 (CEST)",
            "from mail-pg1-f227.google.com (mail-pg1-f227.google.com\n [209.85.215.227]) by dpdk.org (Postfix) with ESMTP id 296B91D72D\n for <dev@dpdk.org>; Sat, 10 Oct 2020 06:13:16 +0200 (CEST)",
            "by mail-pg1-f227.google.com with SMTP id u24so8908022pgi.1\n for <dev@dpdk.org>; Fri, 09 Oct 2020 21:13:16 -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.13\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Fri, 09 Oct 2020 21:13:14 -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=1JTuNz1KjhM7urS5RkczyXAXBGorh3BOx8aFzyFHpio=;\n b=M72wa2KKs6S5NAa3OvNWQwePqGd+P4qAFzbIuVUJ5Mw3D92i+JnO0CmEjtPJW+vHC5\n 9Bv23lrqJE3L1QVH6C3X+N/EOQTMUWZqsFcJ6344V53a+IhVXjZyIJUtDJe0Cuky9wUn\n y38d9DNYnHB5ZVpH36UGwyvR37PXy9yGuN8k4=",
        "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=1JTuNz1KjhM7urS5RkczyXAXBGorh3BOx8aFzyFHpio=;\n b=YQ68Q4BB/kpQs17b+NlrLNGEUwihZl0j6p9j9r6EC2vRTpaU/yUP1wQV2x3Q7cOUk/\n eM6ETqFi/AYmIskCjSnWWzNR6jv813vFVd9G/YiHJwrW7JF5dyCjj4oGb38g8FrWrM2r\n LujiuFA7H2I8JYf6tF3ylq7mJKba+dGi79pI3vCxjjDjukfWjAJ/e1IjC+CihWHUYwWK\n cY++PXN2rSCIZcSP1k1QYlUAiC7+RKRv3Tv5IYgrL51xmbI59+0HFpVIK/WMhMYiG01c\n di/Qh6KhmQdZcLP5kgi446jI7mKAghmQqohzxBMfCqw2INfC36OGYxCMjzes5wms/c+e\n Yf3g==",
        "X-Gm-Message-State": "AOAM532soUDBWA5/i1fUHypXVtUepBTGVRcYTII/Z6Kd9K5zFzSzCLVF\n 3HMNHVF++Tu5MqnWWM0GSoP7glG6bIZ8xBHYQ9W94JhfCdULaW+jASAm2VciF+SDqA4yTGD6/xI\n 8nL82HLlYzRSp+xAqgc5bQNy7cwgTV+Et6rVw2HzVNsgiTL0eC0bkUlPCBuwmB4eIY/VxkZOlzi\n rzDQ==",
        "X-Google-Smtp-Source": "\n ABdhPJyNvdozOB/MYndISuRUmuxO8Nq2a84ci0nni4euUj1tngRRtA0EcN3/EBbuoGuthQCPTEhL3Yp73bgM",
        "X-Received": "by 2002:aa7:854a:0:b029:154:f2fd:c70a with SMTP id\n y10-20020aa7854a0000b0290154f2fdc70amr15078148pfn.39.1602303194160;\n Fri, 09 Oct 2020 21:13:14 -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:50 -0700",
        "Message-Id": "<20201010041153.63921-10-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 09/12] net/bnxt: add support for parent child\n\tflow database",
        "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 for parent child flow database apis. This\nfeature adds support to enable vxlan decap support where\nflows needs to maintain parent-child flow relationship.\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         | 348 +++++++++++++++++-\n drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  84 +++++\n drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c |   1 +\n drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   1 +\n drivers/net/bnxt/tf_ulp/ulp_utils.h           |   4 +\n 5 files changed, 435 insertions(+), 3 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 da012451d..a1c39329f 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n@@ -207,13 +207,16 @@ ulp_flow_db_alloc_resource(struct bnxt_ulp_flow_db *flow_db)\n \t\treturn -ENOMEM;\n \t}\n \tsize = (flow_tbl->num_flows / sizeof(uint64_t)) + 1;\n-\tflow_tbl->active_reg_flows = rte_zmalloc(\"active reg flows\", size, 0);\n+\tsize =  ULP_BYTE_ROUND_OFF_8(size);\n+\tflow_tbl->active_reg_flows = rte_zmalloc(\"active reg flows\", size,\n+\t\t\t\t\t\t ULP_BUFFER_ALIGN_64_BYTE);\n \tif (!flow_tbl->active_reg_flows) {\n \t\tBNXT_TF_DBG(ERR, \"Failed to alloc memory active reg flows\\n\");\n \t\treturn -ENOMEM;\n \t}\n \n-\tflow_tbl->active_dflt_flows = rte_zmalloc(\"active dflt flows\", size, 0);\n+\tflow_tbl->active_dflt_flows = rte_zmalloc(\"active dflt flows\", size,\n+\t\t\t\t\t\t  ULP_BUFFER_ALIGN_64_BYTE);\n \tif (!flow_tbl->active_dflt_flows) {\n \t\tBNXT_TF_DBG(ERR, \"Failed to alloc memory active dflt flows\\n\");\n \t\treturn -ENOMEM;\n@@ -284,6 +287,86 @@ ulp_flow_db_func_id_set(struct bnxt_ulp_flow_db *flow_db,\n \t\tBNXT_TF_DBG(ERR, \"Invalid flow id, flowdb corrupt\\n\");\n }\n \n+/*\n+ * Initialize the parent-child database. Memory is allocated in this\n+ * call and assigned to the database\n+ *\n+ * flow_db [in] Ptr to flow table\n+ * num_entries[in] - number of entries to allocate\n+ *\n+ * Returns 0 on success or negative number on failure.\n+ */\n+static int32_t\n+ulp_flow_db_parent_tbl_init(struct bnxt_ulp_flow_db *flow_db,\n+\t\t\t    uint32_t num_entries)\n+{\n+\tstruct ulp_fdb_parent_child_db *p_db;\n+\tuint32_t size, idx;\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+\t\t\t\t   sizeof(uint64_t)) + 1; /* size in bytes */\n+\tp_db->child_bitset_size = ULP_BYTE_ROUND_OFF_8(p_db->child_bitset_size);\n+\tp_db->entries_count = num_entries;\n+\n+\t/* allocate the memory */\n+\tp_db->parent_flow_tbl = rte_zmalloc(\"fdb parent flow tbl\",\n+\t\t\t\t\t    sizeof(struct ulp_fdb_parent_info) *\n+\t\t\t\t\t    p_db->entries_count, 0);\n+\tif (!p_db->parent_flow_tbl) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"Failed to allocate memory fdb parent flow tbl\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tsize = p_db->child_bitset_size * p_db->entries_count;\n+\n+\t/*\n+\t * allocate the big chunk of memory to be statically carved into\n+\t * child_fid_bitset pointer.\n+\t */\n+\tp_db->parent_flow_tbl_mem = rte_zmalloc(\"fdb parent flow tbl mem\",\n+\t\t\t\t\t\tsize,\n+\t\t\t\t\t\tULP_BUFFER_ALIGN_64_BYTE);\n+\tif (!p_db->parent_flow_tbl_mem) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"Failed to allocate memory fdb parent flow mem\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\t/* set the pointers in parent table to their offsets */\n+\tfor (idx = 0 ; idx < p_db->entries_count; idx++) {\n+\t\tp_db->parent_flow_tbl[idx].child_fid_bitset =\n+\t\t\t(uint64_t *)&p_db->parent_flow_tbl_mem[idx *\n+\t\t\tp_db->child_bitset_size];\n+\t}\n+\t/* success */\n+\treturn 0;\n+}\n+\n+/*\n+ * Deinitialize the parent-child database. Memory is deallocated in\n+ * this call and all flows should have been purged before this\n+ * call.\n+ *\n+ * flow_db [in] Ptr to flow table\n+ *\n+ * Returns none\n+ */\n+static void\n+ulp_flow_db_parent_tbl_deinit(struct bnxt_ulp_flow_db *flow_db)\n+{\n+\t/* free the memory related to parent child database */\n+\tif (flow_db->parent_child_db.parent_flow_tbl_mem) {\n+\t\trte_free(flow_db->parent_child_db.parent_flow_tbl_mem);\n+\t\tflow_db->parent_child_db.parent_flow_tbl_mem = NULL;\n+\t}\n+\tif (flow_db->parent_child_db.parent_flow_tbl) {\n+\t\trte_free(flow_db->parent_child_db.parent_flow_tbl);\n+\t\tflow_db->parent_child_db.parent_flow_tbl = NULL;\n+\t}\n+}\n+\n /*\n  * Initialize the flow database. Memory is allocated in this\n  * call and assigned to the flow database.\n@@ -357,6 +440,14 @@ ulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt)\n \t\t\t    \"Failed to allocate mem for flow table func id\\n\");\n \t\tgoto error_free;\n \t}\n+\t/* initialize the parent child database */\n+\tif (ulp_flow_db_parent_tbl_init(flow_db,\n+\t\t\t\t\tdparms->fdb_parent_flow_entries)) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"Failed to allocate mem for parent child db\\n\");\n+\t\tgoto error_free;\n+\t}\n+\n \t/* All good so return. */\n \tBNXT_TF_DBG(INFO, \"FlowDB initialized with %d flows.\\n\",\n \t\t    flow_tbl->num_flows);\n@@ -388,6 +479,7 @@ ulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)\n \tbnxt_ulp_cntxt_ptr2_flow_db_set(ulp_ctxt, NULL);\n \n \t/* Free up all the memory. */\n+\tulp_flow_db_parent_tbl_deinit(flow_db);\n \tulp_flow_db_dealloc_resource(flow_db);\n \trte_free(flow_db->func_id_tbl);\n \trte_free(flow_db);\n@@ -578,7 +670,7 @@ ulp_flow_db_resource_del(struct bnxt_ulp_context *ulp_ctxt,\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\\n\");\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index %x\\n\", fid);\n \t\treturn -EINVAL;\n \t}\n \n@@ -1050,3 +1142,253 @@ ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,\n \t*cfa_action = hndl;\n \treturn 0;\n }\n+\n+/*\n+ * Allocate the entry in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * fid [in] The flow id to the flow entry\n+ *\n+ * returns index on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t      uint32_t fid)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct ulp_fdb_parent_child_db *p_pdb;\n+\tuint32_t idx, free_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+\t/* check for max flows */\n+\tif (fid >= flow_db->flow_tbl.num_flows || !fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index\\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+\t\t\tBNXT_TF_DBG(ERR, \"fid is already allocated\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tif (!p_pdb->parent_flow_tbl[idx].parent_fid && !free_idx)\n+\t\t\tfree_idx = idx + 1;\n+\t}\n+\t/* no free slots */\n+\tif (!free_idx) {\n+\t\tBNXT_TF_DBG(ERR, \"parent child db is full\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tfree_idx -= 1;\n+\t/* set the Fid in the parent child */\n+\tp_pdb->parent_flow_tbl[free_idx].parent_fid = fid;\n+\treturn free_idx;\n+}\n+\n+/*\n+ * Free the entry in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * fid [in] The flow id to the flow entry\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t     uint32_t fid)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct ulp_fdb_parent_child_db *p_pdb;\n+\tuint32_t idx;\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+\t/* check for max flows */\n+\tif (fid >= flow_db->flow_tbl.num_flows || !fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index\\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+\t\t\t/* free the contents */\n+\t\t\tp_pdb->parent_flow_tbl[idx].parent_fid = 0;\n+\t\t\tmemset(p_pdb->parent_flow_tbl[idx].child_fid_bitset,\n+\t\t\t       0, p_pdb->child_bitset_size);\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\tBNXT_TF_DBG(ERR, \"parent entry not found = %x\\n\", fid);\n+\treturn -EINVAL;\n+}\n+\n+/*\n+ * Set or reset the child flow in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * child_fid [in] The flow id of the child flow entry\n+ * set_flag [in] Use 1 for setting child, 0 to reset\n+ *\n+ * returns zero on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t\t  uint32_t parent_fid,\n+\t\t\t\t  uint32_t child_fid,\n+\t\t\t\t  uint32_t set_flag)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct ulp_fdb_parent_child_db *p_pdb;\n+\tuint32_t idx, a_idx;\n+\tuint64_t *t;\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+\t/* check for fid validity */\n+\tif (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid parent flow index %x\\n\", parent_fid);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check for fid validity */\n+\tif (child_fid >= flow_db->flow_tbl.num_flows || !child_fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid child flow index %x\\n\", child_fid);\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+\t\tif (p_pdb->parent_flow_tbl[idx].parent_fid == parent_fid) {\n+\t\t\tt = p_pdb->parent_flow_tbl[idx].child_fid_bitset;\n+\t\t\tif (set_flag)\n+\t\t\t\tULP_INDEX_BITMAP_SET(t[a_idx], child_fid);\n+\t\t\telse\n+\t\t\t\tULP_INDEX_BITMAP_RESET(t[a_idx], child_fid);\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\tBNXT_TF_DBG(ERR, \"Unable to set the parent-child flow %x:%x\\n\",\n+\t\t    parent_fid, child_fid);\n+\treturn -1;\n+}\n+\n+/*\n+ * Get the parent index from the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * parent_idx [out] The parent index of parent flow entry\n+ *\n+ * returns zero on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t\tuint32_t parent_fid,\n+\t\t\t\tuint32_t *parent_idx)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct ulp_fdb_parent_child_db *p_pdb;\n+\tuint32_t idx;\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+\t/* check for fid validity */\n+\tif (parent_fid >= flow_db->flow_tbl.num_flows || !parent_fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid parent flow index %x\\n\", parent_fid);\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+\t\t\t*parent_idx = idx;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\tBNXT_TF_DBG(ERR, \"Unable to get the parent flow %x\\n\", parent_fid);\n+\treturn -1;\n+}\n+\n+/*\n+ * Get the next child flow in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * child_fid [in/out] The flow id of the child flow entry\n+ *\n+ * returns zero on success and negative on failure.\n+ * Pass child_fid as zero for first entry.\n+ */\n+int32_t\n+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+\tstruct ulp_fdb_parent_child_db *p_pdb;\n+\tuint32_t idx, s_idx, mod_fid;\n+\tuint32_t next_fid = *child_fid;\n+\tuint64_t *child_bitset;\n+\tuint64_t bs;\n+\n+\t/* check for fid validity */\n+\tp_pdb = &flow_db->parent_child_db;\n+\tif (parent_idx >= p_pdb->entries_count ||\n+\t    !p_pdb->parent_flow_tbl[parent_idx].parent_fid) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid parent flow index %x\\n\", parent_idx);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tchild_bitset = p_pdb->parent_flow_tbl[parent_idx].child_fid_bitset;\n+\tdo {\n+\t\t/* increment the flow id to find the next valid flow id */\n+\t\tnext_fid++;\n+\t\tif (next_fid >= flow_db->flow_tbl.num_flows)\n+\t\t\treturn -ENOENT;\n+\t\tidx = next_fid / ULP_INDEX_BITMAP_SIZE;\n+\t\tmod_fid = next_fid % ULP_INDEX_BITMAP_SIZE;\n+\t\ts_idx = idx;\n+\t\twhile (!(bs = child_bitset[idx])) {\n+\t\t\tidx++;\n+\t\t\tif ((idx * ULP_INDEX_BITMAP_SIZE) >=\n+\t\t\t    flow_db->flow_tbl.num_flows)\n+\t\t\t\treturn -ENOENT;\n+\t\t}\n+\t\t/*\n+\t\t * remove the previous bits in the bitset bs to find the\n+\t\t * next non zero bit in the bitset. This needs to be done\n+\t\t * only if the idx is same as he one you started.\n+\t\t */\n+\t\tif (s_idx == idx)\n+\t\t\tbs &= (-1UL >> mod_fid);\n+\t\tnext_fid = (idx * ULP_INDEX_BITMAP_SIZE) + __builtin_clzl(bs);\n+\t\tif (*child_fid >= next_fid) {\n+\t\t\tBNXT_TF_DBG(ERR, \"Parent Child Database is corrupt\\n\");\n+\t\t\treturn -ENOENT;\n+\t\t}\n+\t\tidx = next_fid / ULP_INDEX_BITMAP_SIZE;\n+\t} while (!ULP_INDEX_BITMAP_GET(child_bitset[idx], next_fid));\n+\t*child_fid = next_fid;\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 7ec4b8ae0..87bcd69ae 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n@@ -52,11 +52,26 @@ struct bnxt_ulp_flow_tbl {\n \tuint32_t\tnum_resources;\n };\n \n+/* Structure to maintain parent-child flow relationships */\n+struct ulp_fdb_parent_info {\n+\tuint32_t\tparent_fid;\n+\tuint64_t\t*child_fid_bitset;\n+};\n+\n+/* Structure to maintain parent-child flow relationships */\n+struct ulp_fdb_parent_child_db {\n+\tstruct ulp_fdb_parent_info\t*parent_flow_tbl;\n+\tuint32_t\t\t\tchild_bitset_size;\n+\tuint32_t\t\t\tentries_count;\n+\tuint8_t\t\t\t\t*parent_flow_tbl_mem;\n+};\n+\n /* Structure for the flow database resource information. */\n struct bnxt_ulp_flow_db {\n \tstruct bnxt_ulp_flow_tbl\tflow_tbl;\n \tuint16_t\t\t\t*func_id_tbl;\n \tuint32_t\t\t\tfunc_id_tbl_size;\n+\tstruct ulp_fdb_parent_child_db\tparent_child_db;\n };\n \n /* flow db resource params to add resources */\n@@ -235,5 +250,74 @@ int32_t\n ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,\n \t\t\t\t   uint32_t flow_id,\n \t\t\t\t   uint16_t *cfa_action);\n+/*\n+ * Allocate the entry in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * fid [in] The flow id to the flow entry\n+ *\n+ * returns index on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_alloc(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t      uint32_t fid);\n+\n+/*\n+ * Free the entry in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * fid [in] The flow id to the flow entry\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_free(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t     uint32_t fid);\n+\n+/*\n+ * Set or reset the child flow in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * child_fid [in] The flow id of the child flow entry\n+ * set_flag [in] Use 1 for setting child, 0 to reset\n+ *\n+ * returns zero on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_child_flow_set(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t\t  uint32_t parent_fid,\n+\t\t\t\t  uint32_t child_fid,\n+\t\t\t\t  uint32_t set_flag);\n+\n+/*\n+ * Get the parent index from the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * parent_idx [out] The parent index of parent flow entry\n+ *\n+ * returns zero on success and negative on failure.\n+ */\n+int32_t\n+ulp_flow_db_parent_flow_idx_get(struct bnxt_ulp_context *ulp_ctxt,\n+\t\t\t\tuint32_t parent_fid,\n+\t\t\t\tuint32_t *parent_idx);\n+\n+/*\n+ * Get the next child flow in the parent-child database\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ * parent_fid [in] The flow id of the parent flow entry\n+ * child_fid [in/out] The flow id of the child flow entry\n+ *\n+ * returns zero on success and negative on failure.\n+ * Pass child_fid as zero for first entry.\n+ */\n+int32_t\n+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 #endif /* _ULP_FLOW_DB_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c\nindex 4904a41c3..a677b0ca5 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c\n@@ -368,6 +368,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {\n \t.mark_db_lfid_entries    = 65536,\n \t.mark_db_gfid_entries    = 65536,\n \t.flow_count_db_entries   = 16384,\n+\t.fdb_parent_flow_entries = 2,\n \t.num_resources_per_flow  = 8,\n \t.num_phy_ports           = 2,\n \t.ext_cntr_table_type     = 0,\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\nindex 50a986c89..2e94b6f19 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\n@@ -160,6 +160,7 @@ struct bnxt_ulp_device_params {\n \tuint64_t\t\t\tint_flow_db_num_entries;\n \tuint64_t\t\t\text_flow_db_num_entries;\n \tuint32_t\t\t\tflow_count_db_entries;\n+\tuint32_t\t\t\tfdb_parent_flow_entries;\n \tuint32_t\t\t\tnum_resources_per_flow;\n \tuint32_t\t\t\text_cntr_table_type;\n \tuint64_t\t\t\tbyte_count_mask;\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h\nindex c054a77a9..898e85123 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_utils.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.h\n@@ -11,6 +11,7 @@\n \n #define ULP_BUFFER_ALIGN_8_BYTE\t\t8\n #define ULP_BUFFER_ALIGN_16_BYTE\t16\n+#define ULP_BUFFER_ALIGN_64_BYTE\t64\n \n /*\n  * Macros for bitmap sets and gets\n@@ -53,6 +54,9 @@\n /* Macro to convert bits to bytes with no round off*/\n #define ULP_BITS_2_BYTE_NR(bits_x)\t((bits_x) / 8)\n \n+/* Macro to round off to next multiple of 8*/\n+#define ULP_BYTE_ROUND_OFF_8(x)\t(((x) + 7) & ~7)\n+\n /* Macros to read the computed fields */\n #define ULP_COMP_FLD_IDX_RD(params, idx) \\\n \trte_be_to_cpu_32((params)->comp_fld[(idx)])\n",
    "prefixes": [
        "v2",
        "09/12"
    ]
}