get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68505,
    "url": "https://patches.dpdk.org/api/patches/68505/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1586938751-32808-20-git-send-email-venkatkumar.duvvuru@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": "<1586938751-32808-20-git-send-email-venkatkumar.duvvuru@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586938751-32808-20-git-send-email-venkatkumar.duvvuru@broadcom.com",
    "date": "2020-04-15T08:18:56",
    "name": "[v4,19/34] net/bnxt: add support to process action tables",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2a7a362eb7939036eb120d3acab4eb5ab7819c46",
    "submitter": {
        "id": 1635,
        "url": "https://patches.dpdk.org/api/people/1635/?format=api",
        "name": "Venkat Duvvuru",
        "email": "venkatkumar.duvvuru@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/1586938751-32808-20-git-send-email-venkatkumar.duvvuru@broadcom.com/mbox/",
    "series": [
        {
            "id": 9386,
            "url": "https://patches.dpdk.org/api/series/9386/?format=api",
            "web_url": "https://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": "https://patches.dpdk.org/series/9386/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68505/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/68505/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 A97A8A0563;\n\tWed, 15 Apr 2020 10:24:11 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 3AD791D5CC;\n\tWed, 15 Apr 2020 10:20:17 +0200 (CEST)",
            "from mail-pf1-f194.google.com (mail-pf1-f194.google.com\n [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 65B5F1D560\n for <dev@dpdk.org>; Wed, 15 Apr 2020 10:20:15 +0200 (CEST)",
            "by mail-pf1-f194.google.com with SMTP id c138so1206615pfc.0\n for <dev@dpdk.org>; Wed, 15 Apr 2020 01:20:15 -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.10\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Wed, 15 Apr 2020 01:20:12 -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=zb8KVfgjCwaD6/lNHV0J0jgYZSLNjFDtQeZ9yuUqcuc=;\n b=df+TTUU06bM0H31cIvTkp3j+CGdwO5ENX9ghiCqGDd/sEbtTDZ52suM05Xseh8dSGU\n 32Jb4Kt1/lpA3wOw8LgBp4N5acGFrGC3kh54nkcThZrmPMZHOz+ca+i0KOB5r7g2Df0z\n jqJUqelsCAhLchtmv7qRMiTxLBbYeZc0Sn7zA=",
        "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=zb8KVfgjCwaD6/lNHV0J0jgYZSLNjFDtQeZ9yuUqcuc=;\n b=Q76IKEDewNnEuzCxYfH3bhxcbNCGeToQslOS3K0IDc14PjD6eAXA585UdrGQzkz48w\n RrO9yMRoJmNPqWYcnBHidZd3/0BE8SgD5iClxu3952yBnJOaT0x264VfEePxBUWfeGXZ\n hgYksn6Jg6DCxdF+436hozWun4A4CM9N+8B9V0S2inmeY5YapoJOcTZops9ZDsG56UDU\n PSmEuFGNl36wvIVMynL95tiZbr79piEyWpnZsfvKtAx5rAUcT9/fvNeN0XFzTCWpf6AB\n yIuZQf8Jexki2JzfO9xFuMABiqO/Z6WQp6/9Lh7FDr7yZH0JNUE4e7r316yg6uySIG7c\n mxTA==",
        "X-Gm-Message-State": "AGi0PubFQujUbMEWwdsptkyQIFwi5EmcJAj19BxZEFPpPalhxCiBORN4\n el4nDjXYFQ51hPYoQbAFOkW9W2xnmBv7rocgeIvzq11m8T5biphXtjasXcf2iq76m5gLwTdWWJq\n JH1NSIV750C0FUHxRxCy2dXLHwCaS3VfL4D/VveBStKsbkfy0ypFK7rcfZpgtjlDUJXFF",
        "X-Google-Smtp-Source": "\n APiQypKrKhfThW8RhbDGB2hSxwtPCkdRNtPf/VAMB/kw8P3bt4Zcjlb0r2la1gVXu1yb5sSh+c9udg==",
        "X-Received": "by 2002:a62:e30f:: with SMTP id g15mr674777pfh.150.1586938813385;\n Wed, 15 Apr 2020 01:20:13 -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:56 +0530",
        "Message-Id": "\n <1586938751-32808-20-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 19/34] net/bnxt: add support to process action\n\ttables",
        "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 processes the action template. Iterates through the list\nof action info templates and processes it.\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>\n---\n drivers/net/bnxt/Makefile                     |   1 +\n drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 136 ++++++++++\n drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  25 ++\n drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 364 ++++++++++++++++++++++++++\n drivers/net/bnxt/tf_ulp/ulp_mapper.h          |  39 +++\n drivers/net/bnxt/tf_ulp/ulp_template_db.c     | 245 +++++++++++++++++\n drivers/net/bnxt/tf_ulp/ulp_template_db.h     | 104 ++++++++\n drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  48 +++-\n 8 files changed, 959 insertions(+), 3 deletions(-)\n create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.c\n create mode 100644 drivers/net/bnxt/tf_ulp/ulp_mapper.h",
    "diff": "diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile\nindex 4e0dea1..f464d9e 100644\n--- a/drivers/net/bnxt/Makefile\n+++ b/drivers/net/bnxt/Makefile\n@@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_template_db.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_utils.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mapper.c\n \n #\n # Export include files\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\nindex 3dd39c1..6e73f25 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n@@ -7,7 +7,68 @@\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+\n+#define ULP_FLOW_DB_RES_DIR_BIT\t\t31\n+#define ULP_FLOW_DB_RES_DIR_MASK\t0x80000000\n+#define ULP_FLOW_DB_RES_FUNC_BITS\t28\n+#define ULP_FLOW_DB_RES_FUNC_MASK\t0x70000000\n+#define ULP_FLOW_DB_RES_NXT_MASK\t0x0FFFFFFF\n+\n+/* Macro to copy the nxt_resource_idx */\n+#define ULP_FLOW_DB_RES_NXT_SET(dst, src)\t{(dst) |= ((src) &\\\n+\t\t\t\t\t ULP_FLOW_DB_RES_NXT_MASK); }\n+#define ULP_FLOW_DB_RES_NXT_RESET(dst)\t((dst) &= ~(ULP_FLOW_DB_RES_NXT_MASK))\n+\n+/*\n+ * Helper function to allocate the flow table and initialize\n+ *  is set.No validation being 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+ *\n+ * returns 1 on set or 0 if not set.\n+ */\n+static int32_t\n+ulp_flow_db_active_flow_is_set(struct bnxt_ulp_flow_tbl\t*flow_tbl,\n+\t\t\t       uint32_t\t\t\tidx)\n+{\n+\tuint32_t\t\tactive_index;\n+\n+\tactive_index = idx / ULP_INDEX_BITMAP_SIZE;\n+\treturn ULP_INDEX_BITMAP_GET(flow_tbl->active_flow_tbl[active_index],\n+\t\t\t\t    idx);\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 [out] Ptr to resource information\n+ * params [in] The input params from the caller\n+ * returns none\n+ */\n+static void\n+ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info   *resource_info,\n+\t\t\t       struct ulp_flow_db_res_params  *params)\n+{\n+\tresource_info->nxt_resource_idx |= ((params->direction <<\n+\t\t\t\t      ULP_FLOW_DB_RES_DIR_BIT) &\n+\t\t\t\t     ULP_FLOW_DB_RES_DIR_MASK);\n+\tresource_info->nxt_resource_idx |= ((params->resource_func <<\n+\t\t\t\t\t     ULP_FLOW_DB_RES_FUNC_BITS) &\n+\t\t\t\t\t    ULP_FLOW_DB_RES_FUNC_MASK);\n+\n+\tif (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {\n+\t\tresource_info->resource_hndl = (uint32_t)params->resource_hndl;\n+\t\tresource_info->resource_type = params->resource_type;\n+\n+\t} else {\n+\t\tresource_info->resource_em_handle = params->resource_hndl;\n+\t}\n+}\n \n /*\n  * Helper function to allocate the flow table and initialize\n@@ -185,3 +246,78 @@ int32_t\tulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt)\n \n \treturn 0;\n }\n+\n+/*\n+ * Allocate the flow database entry.\n+ * The params->critical_resource has to be set to 0 to allocate a new 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] The contents to be copied into resource\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_resource_add(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*resource, *fid_resource;\n+\tuint32_t\t\t\tidx;\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+\t/* check for max resource */\n+\tif ((flow_tbl->num_flows + 1) >= flow_tbl->tail_index) {\n+\t\tBNXT_TF_DBG(ERR, \"Flow db has reached max resources\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tfid_resource = &flow_tbl->flow_resources[fid];\n+\n+\tif (!params->critical_resource) {\n+\t\t/* Not the critical_resource so allocate a resource */\n+\t\tidx = flow_tbl->flow_tbl_stack[flow_tbl->tail_index];\n+\t\tresource = &flow_tbl->flow_resources[idx];\n+\t\tflow_tbl->tail_index--;\n+\n+\t\t/* Update the chain list of resource*/\n+\t\tULP_FLOW_DB_RES_NXT_SET(resource->nxt_resource_idx,\n+\t\t\t\t\tfid_resource->nxt_resource_idx);\n+\t\t/* update the contents */\n+\t\tulp_flow_db_res_params_to_info(resource, params);\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\tidx);\n+\t} else {\n+\t\t/* critical resource. Just update the fid resource */\n+\t\tulp_flow_db_res_params_to_info(fid_resource, params);\n+\t}\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 a2ee8fa..f6055a5 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n@@ -53,6 +53,15 @@ struct bnxt_ulp_flow_db {\n \tstruct bnxt_ulp_flow_tbl\tflow_tbl[BNXT_ULP_FLOW_TABLE_MAX];\n };\n \n+/* flow db resource params to add resources */\n+struct ulp_flow_db_res_params {\n+\tenum tf_dir\t\t\tdirection;\n+\tenum bnxt_ulp_resource_func\tresource_func;\n+\tuint64_t\t\t\tresource_hndl;\n+\tuint32_t\t\t\tresource_type;\n+\tuint32_t\t\t\tcritical_resource;\n+};\n+\n /*\n  * Initialize the flow database. Memory is allocated in this\n  * call and assigned to the flow database.\n@@ -74,4 +83,20 @@ int32_t\tulp_flow_db_init(struct bnxt_ulp_context *ulp_ctxt);\n  */\n int32_t\tulp_flow_db_deinit(struct bnxt_ulp_context *ulp_ctxt);\n \n+/*\n+ * Allocate the flow database entry.\n+ * The params->critical_resource has to be set to 0 to allocate a new 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] The contents to be copied into resource\n+ *\n+ * returns 0 on success and negative on failure.\n+ */\n+int32_t\tulp_flow_db_resource_add(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 #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\nnew file mode 100644\nindex 0000000..9cfc382\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n@@ -0,0 +1,364 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2014-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_log.h>\n+#include \"bnxt.h\"\n+#include \"ulp_template_db.h\"\n+#include \"ulp_template_struct.h\"\n+#include \"bnxt_tf_common.h\"\n+#include \"ulp_utils.h\"\n+#include \"bnxt_ulp.h\"\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+\n+int32_t\n+ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms);\n+\n+/*\n+ * Get the size of the action property for a given index.\n+ *\n+ * idx [in] The index for the action property\n+ *\n+ * returns the size of the action property.\n+ */\n+static uint32_t\n+ulp_mapper_act_prop_size_get(uint32_t idx)\n+{\n+\tif (idx >= BNXT_ULP_ACT_PROP_IDX_LAST)\n+\t\treturn 0;\n+\treturn ulp_act_prop_map_table[idx];\n+}\n+\n+/*\n+ * Get the list of result fields that implement the flow action\n+ *\n+ * tbl [in] A single table instance to get the results fields\n+ * from num_flds [out] The number of data fields in the returned\n+ * array\n+ * returns array of data fields, or NULL on error\n+ */\n+static struct bnxt_ulp_mapper_result_field_info *\n+ulp_mapper_act_result_fields_get(struct bnxt_ulp_mapper_act_tbl_info *tbl,\n+\t\t\t\t uint32_t *num_rslt_flds,\n+\t\t\t\t uint32_t *num_encap_flds)\n+{\n+\tuint32_t idx;\n+\n+\tif (!tbl || !num_rslt_flds || !num_encap_flds)\n+\t\treturn NULL;\n+\n+\tidx\t\t= tbl->result_start_idx;\n+\t*num_rslt_flds\t= tbl->result_num_fields;\n+\t*num_encap_flds = tbl->encap_num_fields;\n+\n+\t/* NOTE: Need template to provide range checking define */\n+\treturn &ulp_act_result_field_list[idx];\n+}\n+\n+static int32_t\n+ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,\n+\t\t\t\tstruct bnxt_ulp_mapper_result_field_info *fld,\n+\t\t\t\tstruct ulp_blob *blob)\n+{\n+\tuint16_t idx, size_idx;\n+\tuint8_t\t *val = NULL;\n+\tuint64_t regval;\n+\tuint32_t val_size = 0, field_size = 0;\n+\n+\tswitch (fld->result_opcode) {\n+\tcase BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT:\n+\t\tval = fld->result_operand;\n+\t\tif (!ulp_blob_push(blob, val, fld->field_bit_size)) {\n+\t\t\tBNXT_TF_DBG(ERR, \"Failed to add field\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tbreak;\n+\tcase BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP:\n+\t\tif (!ulp_operand_read(fld->result_operand,\n+\t\t\t\t      (uint8_t *)&idx, sizeof(uint16_t))) {\n+\t\t\tBNXT_TF_DBG(ERR, \"operand read failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tidx = tfp_be_to_cpu_16(idx);\n+\n+\t\tif (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) {\n+\t\t\tBNXT_TF_DBG(ERR, \"act_prop[%d] oob\\n\", idx);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tval = &parms->act_prop->act_details[idx];\n+\t\tfield_size = ulp_mapper_act_prop_size_get(idx);\n+\t\tif (fld->field_bit_size < ULP_BYTE_2_BITS(field_size)) {\n+\t\t\tfield_size  = field_size -\n+\t\t\t    ((fld->field_bit_size + 7) / 8);\n+\t\t\tval += field_size;\n+\t\t}\n+\t\tif (!ulp_blob_push(blob, val, fld->field_bit_size)) {\n+\t\t\tBNXT_TF_DBG(ERR, \"push field failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tbreak;\n+\tcase BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP_SZ:\n+\t\tif (!ulp_operand_read(fld->result_operand,\n+\t\t\t\t      (uint8_t *)&idx, sizeof(uint16_t))) {\n+\t\t\tBNXT_TF_DBG(ERR, \"operand read failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tidx = tfp_be_to_cpu_16(idx);\n+\n+\t\tif (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) {\n+\t\t\tBNXT_TF_DBG(ERR, \"act_prop[%d] oob\\n\", idx);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tval = &parms->act_prop->act_details[idx];\n+\n+\t\t/* get the size index next */\n+\t\tif (!ulp_operand_read(&fld->result_operand[sizeof(uint16_t)],\n+\t\t\t\t      (uint8_t *)&size_idx, sizeof(uint16_t))) {\n+\t\t\tBNXT_TF_DBG(ERR, \"operand read failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tsize_idx = tfp_be_to_cpu_16(size_idx);\n+\n+\t\tif (size_idx >= BNXT_ULP_ACT_PROP_IDX_LAST) {\n+\t\t\tBNXT_TF_DBG(ERR, \"act_prop[%d] oob\\n\", size_idx);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tmemcpy(&val_size, &parms->act_prop->act_details[size_idx],\n+\t\t       sizeof(uint32_t));\n+\t\tval_size = tfp_be_to_cpu_32(val_size);\n+\t\tval_size = ULP_BYTE_2_BITS(val_size);\n+\t\tulp_blob_push_encap(blob, val, val_size);\n+\t\tbreak;\n+\tcase BNXT_ULP_RESULT_OPC_SET_TO_REGFILE:\n+\t\tif (!ulp_operand_read(fld->result_operand,\n+\t\t\t\t      (uint8_t *)&idx, sizeof(uint16_t))) {\n+\t\t\tBNXT_TF_DBG(ERR, \"operand read failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tidx = tfp_be_to_cpu_16(idx);\n+\t\t/* Uninitialized regfile entries return 0 */\n+\t\tif (!ulp_regfile_read(parms->regfile, idx, &regval)) {\n+\t\t\tBNXT_TF_DBG(ERR, \"regfile[%d] read oob\\n\", idx);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tval = ulp_blob_push_64(blob, &regval, fld->field_bit_size);\n+\t\tif (!val) {\n+\t\t\tBNXT_TF_DBG(ERR, \"push field failed\\n\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/* Function to alloc action record and set the table. */\n+static int32_t\n+ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,\n+\t\t\t\tstruct ulp_blob *blob)\n+{\n+\tstruct ulp_flow_db_res_params\t\tfid_parms;\n+\tstruct tf_alloc_tbl_entry_parms\t\talloc_parms = { 0 };\n+\tstruct tf_free_tbl_entry_parms\t\tfree_parms = { 0 };\n+\tstruct bnxt_ulp_mapper_act_tbl_info\t*atbls = parms->atbls;\n+\tint32_t\t\t\t\t\trc = 0;\n+\tint32_t trc;\n+\tuint64_t\t\t\t\tidx;\n+\n+\t/* Set the allocation parameters for the table*/\n+\talloc_parms.dir = atbls->direction;\n+\talloc_parms.type = atbls->table_type;\n+\talloc_parms.search_enable = atbls->srch_b4_alloc;\n+\talloc_parms.result = ulp_blob_data_get(blob,\n+\t\t\t\t\t       &alloc_parms.result_sz_in_bytes);\n+\tif (!alloc_parms.result) {\n+\t\tBNXT_TF_DBG(ERR, \"blob is not populated\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\trc = tf_alloc_tbl_entry(parms->tfp, &alloc_parms);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"table type= [%d] dir = [%s] alloc failed\\n\",\n+\t\t\t    alloc_parms.type,\n+\t\t\t    (alloc_parms.dir == TF_DIR_RX) ? \"RX\" : \"TX\");\n+\t\treturn rc;\n+\t}\n+\n+\t/* Need to calculate the idx for the result record */\n+\t/*\n+\t * TBD: Need to get the stride from tflib instead of having to\n+\t * understand the constrution of the pointer\n+\t */\n+\tuint64_t tmpidx = alloc_parms.idx;\n+\n+\tif (atbls->table_type == TF_TBL_TYPE_EXT)\n+\t\ttmpidx = (alloc_parms.idx * TF_ACTION_RECORD_SZ) >> 4;\n+\telse\n+\t\ttmpidx = alloc_parms.idx;\n+\n+\tidx = tfp_cpu_to_be_64(tmpidx);\n+\n+\t/* Store the allocated index for future use in the regfile */\n+\trc = ulp_regfile_write(parms->regfile, atbls->regfile_wr_idx, idx);\n+\tif (!rc) {\n+\t\tBNXT_TF_DBG(ERR, \"regfile[%d] write failed\\n\",\n+\t\t\t    atbls->regfile_wr_idx);\n+\t\trc = -EINVAL;\n+\t\tgoto error;\n+\t}\n+\n+\t/*\n+\t * The set_tbl_entry API if search is not enabled or searched entry\n+\t * is not found.\n+\t */\n+\tif (!atbls->srch_b4_alloc || !alloc_parms.hit) {\n+\t\tstruct tf_set_tbl_entry_parms set_parm = { 0 };\n+\t\tuint16_t\tlength;\n+\n+\t\tset_parm.dir\t= atbls->direction;\n+\t\tset_parm.type\t= atbls->table_type;\n+\t\tset_parm.idx\t= alloc_parms.idx;\n+\t\tset_parm.data\t= ulp_blob_data_get(blob, &length);\n+\t\tset_parm.data_sz_in_bytes = length / 8;\n+\n+\t\tif (set_parm.type == TF_TBL_TYPE_EXT)\n+\t\t\tbnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,\n+\t\t\t\t\t\t\t&set_parm.tbl_scope_id);\n+\t\telse\n+\t\t\tset_parm.tbl_scope_id = 0;\n+\n+\t\t/* set the table entry */\n+\t\trc = tf_set_tbl_entry(parms->tfp, &set_parm);\n+\t\tif (rc) {\n+\t\t\tBNXT_TF_DBG(ERR, \"table[%d][%s][%d] set failed\\n\",\n+\t\t\t\t    set_parm.type,\n+\t\t\t\t    (set_parm.dir == TF_DIR_RX) ? \"RX\" : \"TX\",\n+\t\t\t\t    set_parm.idx);\n+\t\t\tgoto error;\n+\t\t}\n+\t}\n+\n+\t/* Link the resource to the flow in the flow db */\n+\tmemset(&fid_parms, 0, sizeof(fid_parms));\n+\tfid_parms.direction\t\t= atbls->direction;\n+\tfid_parms.resource_func\t\t= atbls->resource_func;\n+\tfid_parms.resource_type\t\t= atbls->table_type;\n+\tfid_parms.resource_hndl\t\t= alloc_parms.idx;\n+\tfid_parms.critical_resource\t= 0;\n+\n+\trc = ulp_flow_db_resource_add(parms->ulp_ctx,\n+\t\t\t\t      parms->tbl_idx,\n+\t\t\t\t      parms->fid,\n+\t\t\t\t      &fid_parms);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to link resource to flow rc = %d\\n\",\n+\t\t\t    rc);\n+\t\trc = -EINVAL;\n+\t\tgoto error;\n+\t}\n+\n+\treturn 0;\n+error:\n+\n+\tfree_parms.dir\t= alloc_parms.dir;\n+\tfree_parms.type\t= alloc_parms.type;\n+\tfree_parms.idx\t= alloc_parms.idx;\n+\n+\ttrc = tf_free_tbl_entry(parms->tfp, &free_parms);\n+\tif (trc)\n+\t\tBNXT_TF_DBG(ERR, \"Failed to free table entry on failure\\n\");\n+\n+\treturn rc;\n+}\n+\n+/*\n+ * Function to process the action Info. Iterate through the list\n+ * action info templates and process it.\n+ */\n+static int32_t\n+ulp_mapper_action_info_process(struct bnxt_ulp_mapper_parms *parms,\n+\t\t\t       struct bnxt_ulp_mapper_act_tbl_info *tbl)\n+{\n+\tstruct ulp_blob\t\t\t\t\tblob;\n+\tstruct bnxt_ulp_mapper_result_field_info\t*flds, *fld;\n+\tuint32_t\t\t\t\t\tnum_flds = 0;\n+\tuint32_t\t\t\t\t\tencap_flds = 0;\n+\tuint32_t\t\t\t\t\ti;\n+\tint32_t\t\t\t\t\t\trc;\n+\tuint16_t\t\t\t\t\tbit_size;\n+\n+\tif (!tbl || !parms->act_prop || !parms->act_bitmap || !parms->regfile)\n+\t\treturn -EINVAL;\n+\n+\t/* use the max size if encap is enabled */\n+\tif (tbl->encap_num_fields)\n+\t\tbit_size = BNXT_ULP_FLMP_BLOB_SIZE_IN_BITS;\n+\telse\n+\t\tbit_size = tbl->result_bit_size;\n+\tif (!ulp_blob_init(&blob, bit_size, parms->order)) {\n+\t\tBNXT_TF_DBG(ERR, \"action blob init failed\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tflds = ulp_mapper_act_result_fields_get(tbl, &num_flds, &encap_flds);\n+\tif (!flds || !num_flds) {\n+\t\tBNXT_TF_DBG(ERR, \"Template undefined for action\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (i = 0; i < (num_flds + encap_flds); i++) {\n+\t\tfld = &flds[i];\n+\t\trc = ulp_mapper_result_field_process(parms,\n+\t\t\t\t\t\t     fld,\n+\t\t\t\t\t\t     &blob);\n+\t\tif (rc) {\n+\t\t\tBNXT_TF_DBG(ERR, \"Action field failed\\n\");\n+\t\t\treturn rc;\n+\t\t}\n+\t\t/* set the swap index if 64 bit swap is enabled */\n+\t\tif (parms->encap_byte_swap && encap_flds) {\n+\t\t\tif ((i + 1) == num_flds)\n+\t\t\t\tulp_blob_encap_swap_idx_set(&blob);\n+\t\t\t/* if 64 bit swap is enabled perform the 64bit swap */\n+\t\t\tif ((i + 1) == (num_flds + encap_flds))\n+\t\t\t\tulp_blob_perform_encap_swap(&blob);\n+\t\t}\n+\t}\n+\n+\trc = ulp_mapper_action_alloc_and_set(parms, &blob);\n+\treturn rc;\n+}\n+\n+/*\n+ * Function to process the action template. Iterate through the list\n+ * action info templates and process it.\n+ */\n+int32_t\n+ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)\n+{\n+\tuint32_t\ti;\n+\tint32_t\t\trc = 0;\n+\n+\tif (!parms->atbls || !parms->num_atbls) {\n+\t\tBNXT_TF_DBG(ERR, \"No action tables for template[%d][%d].\\n\",\n+\t\t\t    parms->dev_id, parms->act_tid);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (i = 0; i < parms->num_atbls; i++) {\n+\t\trc = ulp_mapper_action_info_process(parms, &parms->atbls[i]);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t}\n+\n+\treturn rc;\n+}\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\nnew file mode 100644\nindex 0000000..adbcec2\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2014-2019 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _ULP_MAPPER_H_\n+#define _ULP_MAPPER_H_\n+\n+#include <tf_core.h>\n+#include <rte_log.h>\n+#include <rte_flow.h>\n+#include <rte_flow_driver.h>\n+#include \"ulp_template_db.h\"\n+#include \"ulp_template_struct.h\"\n+#include \"bnxt_ulp.h\"\n+#include \"ulp_utils.h\"\n+\n+/* Internal Structure for passing the arguments around */\n+struct bnxt_ulp_mapper_parms {\n+\tuint32_t\t\t\t\tdev_id;\n+\tenum bnxt_ulp_byte_order\t\torder;\n+\tuint32_t\t\t\t\tact_tid;\n+\tstruct bnxt_ulp_mapper_act_tbl_info\t*atbls;\n+\tuint32_t\t\t\t\tnum_atbls;\n+\tuint32_t\t\t\t\tclass_tid;\n+\tstruct bnxt_ulp_mapper_class_tbl_info\t*ctbls;\n+\tuint32_t\t\t\t\tnum_ctbls;\n+\tstruct ulp_rte_act_prop\t\t\t*act_prop;\n+\tstruct ulp_rte_act_bitmap\t\t*act_bitmap;\n+\tstruct ulp_rte_hdr_field\t\t*hdr_field;\n+\tstruct ulp_regfile\t\t\t*regfile;\n+\tstruct tf\t\t\t\t*tfp;\n+\tstruct bnxt_ulp_context\t\t\t*ulp_ctx;\n+\tuint8_t\t\t\t\t\tencap_byte_swap;\n+\tuint32_t\t\t\t\tfid;\n+\tenum bnxt_ulp_flow_db_tables\t\ttbl_idx;\n+};\n+\n+#endif /* _ULP_MAPPER_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c\nindex 9670635..fc77800 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c\n@@ -11,6 +11,89 @@\n #include \"ulp_template_db.h\"\n #include \"ulp_template_struct.h\"\n \n+uint32_t ulp_act_prop_map_table[] = {\n+\t[BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN_SZ] =\n+\t\tBNXT_ULP_ACT_PROP_SZ_ENCAP_TUN_SZ,\n+\t[BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SZ] =\n+\t\tBNXT_ULP_ACT_PROP_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P_DEVICE_ID_WH_PLUS] = {\n \t\t.global_fid_enable       = BNXT_ULP_SYM_YES,\n@@ -25,3 +108,165 @@ struct bnxt_ulp_device_params ulp_device_params[] = {\n \t\t.num_resources_per_flow  = 8\n \t}\n };\n+\n+struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[] = {\n+\t{\n+\t.field_bit_size = 14,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 8,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 11,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 10,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 16,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 10,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 16,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 10,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 4,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {BNXT_ULP_SYM_DECAP_FUNC_NONE,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 12,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP,\n+\t.result_operand = {(BNXT_ULP_ACT_PROP_IDX_VNIC >> 8) & 0xff,\n+\t\tBNXT_ULP_ACT_PROP_IDX_VNIC & 0xff,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 2,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t},\n+\t{\n+\t.field_bit_size = 1,\n+\t.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,\n+\t.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n+\t\t0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n+\t}\n+};\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h\nindex 1eed828..e52cc3f 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h\n@@ -39,9 +39,113 @@ enum bnxt_ulp_regfile_index {\n \tBNXT_ULP_REGFILE_INDEX_LAST\n };\n \n+enum bnxt_ulp_resource_func {\n+\tBNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0,\n+\tBNXT_ULP_RESOURCE_FUNC_EM_TABLE = 1,\n+\tBNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 2,\n+\tBNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 3,\n+\tBNXT_ULP_RESOURCE_FUNC_HW_FID = 4,\n+\tBNXT_ULP_RESOURCE_FUNC_LAST = 5\n+};\n+\n+enum bnxt_ulp_result_op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F_PUSH_MPLS_2 = 136,\n+\tBNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_3 = 140,\n+\tBNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_4 = 144,\n+\tBNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_5 = 148,\n+\tBNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_6 = 152,\n+\tBNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_7 = 156,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_L2_DMAC = 160,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_L2_SMAC = 166,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG = 172,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_IP = 180,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 212,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 228,\n+\tBNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 232,\n+\tBNXT_ULP_ACT_PROP_IDX_LAST = 264\n+};\n+\n #endif /* _ULP_TEMPLATE_DB_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\nindex 4b9d0b2..2b0a3d7 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h\n@@ -17,7 +17,15 @@\n #include \"rte_flow.h\"\n #include \"tf_core.h\"\n \n-/* Device specific parameters. */\n+/*\n+ * structure to hold the action property details\n+ * It is a array of 128 bytes\n+ */\n+struct ulp_rte_act_prop {\n+\tuint8_t\tact_details[BNXT_ULP_ACT_PROP_IDX_LAST];\n+};\n+\n+/* Device specific parameters */\n struct bnxt_ulp_device_params {\n \tuint8_t\t\t\t\tdescription[16];\n \tuint32_t\t\t\tglobal_fid_enable;\n@@ -31,10 +39,44 @@ struct bnxt_ulp_device_params {\n \tuint32_t\t\t\tnum_resources_per_flow;\n };\n \n+struct bnxt_ulp_mapper_act_tbl_info {\n+\tenum bnxt_ulp_resource_func\tresource_func;\n+\tenum tf_tbl_type table_type;\n+\tuint8_t\t\tdirection;\n+\tuint8_t\t\tsrch_b4_alloc;\n+\tuint32_t\tresult_start_idx;\n+\tuint16_t\tresult_bit_size;\n+\tuint16_t\tencap_num_fields;\n+\tuint16_t\tresult_num_fields;\n+\n+\tenum bnxt_ulp_regfile_index\tregfile_wr_idx;\n+};\n+\n+struct bnxt_ulp_mapper_result_field_info {\n+\tuint8_t\t\t\t\tname[64];\n+\tenum bnxt_ulp_result_opc\tresult_opcode;\n+\tuint16_t\t\t\tfield_bit_size;\n+\tuint8_t\t\t\t\tresult_operand[16];\n+};\n+\n /*\n- * The ulp_device_params is indexed by the dev_id.\n- * This table maintains the device specific parameters.\n+ * The ulp_device_params is indexed by the dev_id\n+ * This table maintains the device specific parameters\n  */\n extern struct bnxt_ulp_device_params ulp_device_params[];\n \n+/*\n+ * The ulp_data_field_list provides the instructions for creating an action\n+ * record.  It uses the same structure as the result list, but is only used for\n+ * actions.\n+ */\n+extern\n+struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[];\n+\n+/*\n+ * The ulp_act_prop_map_table provides the mapping to index and size of action\n+ * properties.\n+ */\n+extern uint32_t ulp_act_prop_map_table[];\n+\n #endif /* _ULP_TEMPLATE_STRUCT_H_ */\n",
    "prefixes": [
        "v4",
        "19/34"
    ]
}