get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73060,
    "url": "https://patches.dpdk.org/api/patches/73060/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200703210210.40568-12-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": "<20200703210210.40568-12-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200703210210.40568-12-ajit.khaparde@broadcom.com",
    "date": "2020-07-03T21:01:30",
    "name": "[v5,11/51] net/bnxt: add multi device support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6d391369dcdbbeaefc828cb9156556e11340989d",
    "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/20200703210210.40568-12-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10785,
            "url": "https://patches.dpdk.org/api/series/10785/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10785",
            "date": "2020-07-03T21:01:19",
            "name": "net/bnxt: add features for host-based flow management",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/10785/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73060/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/73060/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 B9A45A0524;\n\tFri,  3 Jul 2020 23:06:48 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 7C4ED1DCD3;\n\tFri,  3 Jul 2020 23:05:20 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com\n [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id D036A1DBED\n for <dev@dpdk.org>; Fri,  3 Jul 2020 23:04:59 +0200 (CEST)",
            "from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net\n [10.75.242.48])\n by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 2601B30C05D;\n Fri,  3 Jul 2020 14:04:59 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id 3EDAB14008D;\n Fri,  3 Jul 2020 14:04:58 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 2601B30C05D",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1593810299;\n bh=KYHOI1Ksa4uC9upjLnnghdbnBNgee2lHRzKO/gfUZN4=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=oZd0iubYs+i7P42muoEQpea26Zt5QF02A0uOC7I9org85SW++qu98yRZ5sIPC4+VN\n Oqy1Xaig4/U4fdk+keY9l0xgZVbKUHhq20vMpQpJ9XWyWr+z/MDbT54DmDerQ1poCS\n xx+pnvib9/6rCiCuFdYfeKqOJnjimftzlnA6G8WU=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Michael Wildt <michael.wildt@broadcom.com>,\n Randy Schacher <stuart.schacher@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>",
        "Date": "Fri,  3 Jul 2020 14:01:30 -0700",
        "Message-Id": "<20200703210210.40568-12-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20200703210210.40568-1-ajit.khaparde@broadcom.com>",
        "References": "<1f5421dc-0453-6dc8-09c2-ddfff6eb4888@intel.com>\n <20200703210210.40568-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v5 11/51] net/bnxt: add multi device support",
        "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: Michael Wildt <michael.wildt@broadcom.com>\n\nIntroduce new modules for Device, Resource Manager, Identifier,\nTable Types, and TCAM for multi device support.\n\nSigned-off-by: Michael Wildt <michael.wildt@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/meson.build                  |   8 +\n drivers/net/bnxt/tf_core/Makefile             |   9 +\n drivers/net/bnxt/tf_core/cfa_resource_types.h | 266 +++++++++++++\n drivers/net/bnxt/tf_core/tf_core.c            |   2 +\n drivers/net/bnxt/tf_core/tf_core.h            |  56 +--\n drivers/net/bnxt/tf_core/tf_device.c          |  50 +++\n drivers/net/bnxt/tf_core/tf_device.h          | 331 ++++++++++++++++\n drivers/net/bnxt/tf_core/tf_device_p4.c       |  24 ++\n drivers/net/bnxt/tf_core/tf_device_p4.h       |  64 +++\n drivers/net/bnxt/tf_core/tf_identifier.c      |  47 +++\n drivers/net/bnxt/tf_core/tf_identifier.h      | 140 +++++++\n drivers/net/bnxt/tf_core/tf_rm.c              |  54 +--\n drivers/net/bnxt/tf_core/tf_rm.h              |  18 -\n drivers/net/bnxt/tf_core/tf_rm_new.c          | 102 +++++\n drivers/net/bnxt/tf_core/tf_rm_new.h          | 368 ++++++++++++++++++\n drivers/net/bnxt/tf_core/tf_session.c         |  31 ++\n drivers/net/bnxt/tf_core/tf_session.h         |  54 +++\n drivers/net/bnxt/tf_core/tf_shadow_tbl.c      |  63 +++\n drivers/net/bnxt/tf_core/tf_shadow_tbl.h      | 240 ++++++++++++\n drivers/net/bnxt/tf_core/tf_shadow_tcam.c     |  63 +++\n drivers/net/bnxt/tf_core/tf_shadow_tcam.h     | 239 ++++++++++++\n drivers/net/bnxt/tf_core/tf_tbl.c             |   1 +\n drivers/net/bnxt/tf_core/tf_tbl_type.c        |  78 ++++\n drivers/net/bnxt/tf_core/tf_tbl_type.h        | 309 +++++++++++++++\n drivers/net/bnxt/tf_core/tf_tcam.c            |  78 ++++\n drivers/net/bnxt/tf_core/tf_tcam.h            | 314 +++++++++++++++\n drivers/net/bnxt/tf_core/tf_util.c            | 145 +++++++\n drivers/net/bnxt/tf_core/tf_util.h            |  41 ++\n 28 files changed, 3101 insertions(+), 94 deletions(-)\n create mode 100644 drivers/net/bnxt/tf_core/cfa_resource_types.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_device.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_device.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_device_p4.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_device_p4.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_identifier.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_identifier.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_rm_new.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_session.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tbl.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tcam.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_shadow_tcam.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_type.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_tcam.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_tcam.h\n create mode 100644 drivers/net/bnxt/tf_core/tf_util.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_util.h",
    "diff": "diff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build\nindex 5c7859cb5..a50cb261d 100644\n--- a/drivers/net/bnxt/meson.build\n+++ b/drivers/net/bnxt/meson.build\n@@ -32,6 +32,14 @@ sources = files('bnxt_cpr.c',\n \t'tf_core/tf_rm.c',\n \t'tf_core/tf_tbl.c',\n \t'tf_core/tfp.c',\n+\t'tf_core/tf_device_p4.c',\n+\t'tf_core/tf_identifier.c',\n+\t'tf_core/tf_shadow_tbl.c',\n+\t'tf_core/tf_shadow_tcam.c',\n+\t'tf_core/tf_tbl_type.c',\n+\t'tf_core/tf_tcam.c',\n+\t'tf_core/tf_util.c',\n+\t'tf_core/tf_rm_new.c',\n \n \t'tf_ulp/bnxt_ulp.c',\n \t'tf_ulp/ulp_mark_mgr.c',\ndiff --git a/drivers/net/bnxt/tf_core/Makefile b/drivers/net/bnxt/tf_core/Makefile\nindex aa2d964e9..7a3c325a6 100644\n--- a/drivers/net/bnxt/tf_core/Makefile\n+++ b/drivers/net/bnxt/tf_core/Makefile\n@@ -14,3 +14,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tfp.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_msg.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_em.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_device_p4.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_identifier.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tbl.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_shadow_tcam.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tbl_type.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_tcam.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_rm_new.c\ndiff --git a/drivers/net/bnxt/tf_core/cfa_resource_types.h b/drivers/net/bnxt/tf_core/cfa_resource_types.h\nnew file mode 100644\nindex 000000000..c0c1e754e\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/cfa_resource_types.h\n@@ -0,0 +1,266 @@\n+/*\n+ * Copyright(c) 2001-2020, Broadcom. All rights reserved. The\n+ * term Broadcom refers to Broadcom Inc. and/or its subsidiaries.\n+ * Proprietary and Confidential Information.\n+ *\n+ * This source file is the property of Broadcom Corporation, and\n+ * may not be copied or distributed in any isomorphic form without\n+ * the prior written consent of Broadcom Corporation.\n+ *\n+ * DO NOT MODIFY!!! This file is automatically generated.\n+ */\n+\n+#ifndef _CFA_RESOURCE_TYPES_H_\n+#define _CFA_RESOURCE_TYPES_H_\n+\n+/* L2 Context TCAM */\n+#define CFA_RESOURCE_TYPE_P59_L2_CTXT_TCAM    0x0UL\n+/* Profile Func */\n+#define CFA_RESOURCE_TYPE_P59_PROF_FUNC       0x1UL\n+/* Profile TCAM */\n+#define CFA_RESOURCE_TYPE_P59_PROF_TCAM       0x2UL\n+/* Exact Match Profile Id */\n+#define CFA_RESOURCE_TYPE_P59_EM_PROF_ID      0x3UL\n+/* Wildcard TCAM Profile Id */\n+#define CFA_RESOURCE_TYPE_P59_WC_TCAM_PROF_ID 0x4UL\n+/* Wildcard TCAM */\n+#define CFA_RESOURCE_TYPE_P59_WC_TCAM         0x5UL\n+/* Meter Profile */\n+#define CFA_RESOURCE_TYPE_P59_METER_PROF      0x6UL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P59_METER           0x7UL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P59_MIRROR          0x8UL\n+/* Source Properties TCAM */\n+#define CFA_RESOURCE_TYPE_P59_SP_TCAM         0x9UL\n+/* Exact Match Flexible Key Builder */\n+#define CFA_RESOURCE_TYPE_P59_EM_FKB          0xaUL\n+/* Wildcard Flexible Key Builder */\n+#define CFA_RESOURCE_TYPE_P59_WC_FKB          0xbUL\n+/* Table Scope */\n+#define CFA_RESOURCE_TYPE_P59_TBL_SCOPE       0xcUL\n+/* L2 Func */\n+#define CFA_RESOURCE_TYPE_P59_L2_FUNC         0xdUL\n+/* EPOCH */\n+#define CFA_RESOURCE_TYPE_P59_EPOCH           0xeUL\n+/* Metadata */\n+#define CFA_RESOURCE_TYPE_P59_METADATA        0xfUL\n+/* Connection Tracking Rule TCAM */\n+#define CFA_RESOURCE_TYPE_P59_CT_RULE_TCAM    0x10UL\n+/* Range Profile */\n+#define CFA_RESOURCE_TYPE_P59_RANGE_PROF      0x11UL\n+/* Range */\n+#define CFA_RESOURCE_TYPE_P59_RANGE           0x12UL\n+/* Link Aggrigation */\n+#define CFA_RESOURCE_TYPE_P59_LAG             0x13UL\n+/* VEB TCAM */\n+#define CFA_RESOURCE_TYPE_P59_VEB_TCAM        0x14UL\n+#define CFA_RESOURCE_TYPE_P59_LAST           CFA_RESOURCE_TYPE_P59_VEB_TCAM\n+\n+\n+/* SRAM Multicast Group */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_MCG             0x0UL\n+/* SRAM Encap 8 byte record */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_ENCAP_8B        0x1UL\n+/* SRAM Encap 16 byte record */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_ENCAP_16B       0x2UL\n+/* SRAM Encap 64 byte record */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_ENCAP_64B       0x3UL\n+/* SRAM Source Property MAC */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_SP_MAC          0x4UL\n+/* SRAM Source Property MAC and IPv4 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_SP_MAC_IPV4     0x5UL\n+/* SRAM Source Property MAC and IPv6 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_SP_MAC_IPV6     0x6UL\n+/* SRAM Network Address Translation Source Port */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_SPORT       0x7UL\n+/* SRAM Network Address Translation Destination Port */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_DPORT       0x8UL\n+/* SRAM Network Address Translation Source IPv4 address */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_S_IPV4      0x9UL\n+/* SRAM Network Address Translation Destination IPv4 address */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_D_IPV4      0xaUL\n+/* SRAM Network Address Translation Source IPv4 address */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_S_IPV6      0xbUL\n+/* SRAM Network Address Translation Destination IPv4 address */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_NAT_D_IPV6      0xcUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_METER           0xdUL\n+/* Flow State */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FLOW_STATE      0xeUL\n+/* Full Action Records */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FULL_ACTION     0xfUL\n+/* Action Record Format 0 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FORMAT_0_ACTION 0x10UL\n+/* Action Record Format 2 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FORMAT_2_ACTION 0x11UL\n+/* Action Record Format 3 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FORMAT_3_ACTION 0x12UL\n+/* Action Record Format 4 */\n+#define CFA_RESOURCE_TYPE_P58_SRAM_FORMAT_4_ACTION 0x13UL\n+/* L2 Context TCAM */\n+#define CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM         0x14UL\n+/* Profile Func */\n+#define CFA_RESOURCE_TYPE_P58_PROF_FUNC            0x15UL\n+/* Profile TCAM */\n+#define CFA_RESOURCE_TYPE_P58_PROF_TCAM            0x16UL\n+/* Exact Match Profile Id */\n+#define CFA_RESOURCE_TYPE_P58_EM_PROF_ID           0x17UL\n+/* Wildcard Profile Id */\n+#define CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID      0x18UL\n+/* Wildcard TCAM */\n+#define CFA_RESOURCE_TYPE_P58_WC_TCAM              0x19UL\n+/* Meter profile */\n+#define CFA_RESOURCE_TYPE_P58_METER_PROF           0x1aUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P58_METER                0x1bUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P58_MIRROR               0x1cUL\n+/* Source Property TCAM */\n+#define CFA_RESOURCE_TYPE_P58_SP_TCAM              0x1dUL\n+/* Exact Match Flexible Key Builder */\n+#define CFA_RESOURCE_TYPE_P58_EM_FKB               0x1eUL\n+/* Wildcard Flexible Key Builder */\n+#define CFA_RESOURCE_TYPE_P58_WC_FKB               0x1fUL\n+/* VEB TCAM */\n+#define CFA_RESOURCE_TYPE_P58_VEB_TCAM             0x20UL\n+#define CFA_RESOURCE_TYPE_P58_LAST                CFA_RESOURCE_TYPE_P58_VEB_TCAM\n+\n+\n+/* SRAM Multicast Group */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_MCG             0x0UL\n+/* SRAM Encap 8 byte record */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_ENCAP_8B        0x1UL\n+/* SRAM Encap 16 byte record */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_ENCAP_16B       0x2UL\n+/* SRAM Encap 64 byte record */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_ENCAP_64B       0x3UL\n+/* SRAM Source Property MAC */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_SP_MAC          0x4UL\n+/* SRAM Source Property MAC and IPv4 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_SP_MAC_IPV4     0x5UL\n+/* SRAM Source Property MAC and IPv6 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_SP_MAC_IPV6     0x6UL\n+/* SRAM 64B Counters */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_COUNTER_64B     0x7UL\n+/* SRAM Network Address Translation Source Port */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_SPORT       0x8UL\n+/* SRAM Network Address Translation Destination Port */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_DPORT       0x9UL\n+/* SRAM Network Address Translation Source IPv4 address */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_S_IPV4      0xaUL\n+/* SRAM Network Address Translation Destination IPv4 address */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_D_IPV4      0xbUL\n+/* SRAM Network Address Translation Source IPv6 address */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_S_IPV6      0xcUL\n+/* SRAM Network Address Translation Destination IPv6 address */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_NAT_D_IPV6      0xdUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_METER           0xeUL\n+/* Flow State */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FLOW_STATE      0xfUL\n+/* Full Action Records */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FULL_ACTION     0x10UL\n+/* Action Record Format 0 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FORMAT_0_ACTION 0x11UL\n+/* Action Record Format 2 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FORMAT_2_ACTION 0x12UL\n+/* Action Record Format 3 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FORMAT_3_ACTION 0x13UL\n+/* Action Record Format 4 */\n+#define CFA_RESOURCE_TYPE_P45_SRAM_FORMAT_4_ACTION 0x14UL\n+/* L2 Context TCAM */\n+#define CFA_RESOURCE_TYPE_P45_L2_CTXT_TCAM         0x15UL\n+/* Profile Func */\n+#define CFA_RESOURCE_TYPE_P45_PROF_FUNC            0x16UL\n+/* Profile TCAM */\n+#define CFA_RESOURCE_TYPE_P45_PROF_TCAM            0x17UL\n+/* Exact Match Profile Id */\n+#define CFA_RESOURCE_TYPE_P45_EM_PROF_ID           0x18UL\n+/* Exact Match Record */\n+#define CFA_RESOURCE_TYPE_P45_EM_REC               0x19UL\n+/* Wildcard Profile Id */\n+#define CFA_RESOURCE_TYPE_P45_WC_TCAM_PROF_ID      0x1aUL\n+/* Wildcard TCAM */\n+#define CFA_RESOURCE_TYPE_P45_WC_TCAM              0x1bUL\n+/* Meter profile */\n+#define CFA_RESOURCE_TYPE_P45_METER_PROF           0x1cUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P45_METER                0x1dUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P45_MIRROR               0x1eUL\n+/* Source Property TCAM */\n+#define CFA_RESOURCE_TYPE_P45_SP_TCAM              0x1fUL\n+/* VEB TCAM */\n+#define CFA_RESOURCE_TYPE_P45_VEB_TCAM             0x20UL\n+#define CFA_RESOURCE_TYPE_P45_LAST                CFA_RESOURCE_TYPE_P45_VEB_TCAM\n+\n+\n+/* SRAM Multicast Group */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_MCG             0x0UL\n+/* SRAM Encap 8 byte record */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_8B        0x1UL\n+/* SRAM Encap 16 byte record */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_16B       0x2UL\n+/* SRAM Encap 64 byte record */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_64B       0x3UL\n+/* SRAM Source Property MAC */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_SP_MAC          0x4UL\n+/* SRAM Source Property MAC and IPv4 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_SP_MAC_IPV4     0x5UL\n+/* SRAM Source Property MAC and IPv6 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_SP_MAC_IPV6     0x6UL\n+/* SRAM 64B Counters */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_COUNTER_64B     0x7UL\n+/* SRAM Network Address Translation Source Port */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_SPORT       0x8UL\n+/* SRAM Network Address Translation Destination Port */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_DPORT       0x9UL\n+/* SRAM Network Address Translation Source IPv4 address */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_S_IPV4      0xaUL\n+/* SRAM Network Address Translation Destination IPv4 address */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_D_IPV4      0xbUL\n+/* SRAM Network Address Translation Source IPv6 address */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_S_IPV6      0xcUL\n+/* SRAM Network Address Translation Destination IPv6 address */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_NAT_D_IPV6      0xdUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_METER           0xeUL\n+/* Flow State */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FLOW_STATE      0xfUL\n+/* Full Action Records */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FULL_ACTION     0x10UL\n+/* Action Record Format 0 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FORMAT_0_ACTION 0x11UL\n+/* Action Record Format 2 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FORMAT_2_ACTION 0x12UL\n+/* Action Record Format 3 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FORMAT_3_ACTION 0x13UL\n+/* Action Record Format 4 */\n+#define CFA_RESOURCE_TYPE_P4_SRAM_FORMAT_4_ACTION 0x14UL\n+/* L2 Context TCAM */\n+#define CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM         0x15UL\n+/* Profile Func */\n+#define CFA_RESOURCE_TYPE_P4_PROF_FUNC            0x16UL\n+/* Profile TCAM */\n+#define CFA_RESOURCE_TYPE_P4_PROF_TCAM            0x17UL\n+/* Exact Match Profile Id */\n+#define CFA_RESOURCE_TYPE_P4_EM_PROF_ID           0x18UL\n+/* Exact Match Record */\n+#define CFA_RESOURCE_TYPE_P4_EM_REC               0x19UL\n+/* Wildcard Profile Id */\n+#define CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID      0x1aUL\n+/* Wildcard TCAM */\n+#define CFA_RESOURCE_TYPE_P4_WC_TCAM              0x1bUL\n+/* Meter profile */\n+#define CFA_RESOURCE_TYPE_P4_METER_PROF           0x1cUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P4_METER                0x1dUL\n+/* Meter */\n+#define CFA_RESOURCE_TYPE_P4_MIRROR               0x1eUL\n+/* Source Property TCAM */\n+#define CFA_RESOURCE_TYPE_P4_SP_TCAM              0x1fUL\n+#define CFA_RESOURCE_TYPE_P4_LAST                CFA_RESOURCE_TYPE_P4_SP_TCAM\n+\n+\n+#endif /* _CFA_RESOURCE_TYPES_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c\nindex 1f6c33ab5..6e15a4c5c 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.c\n+++ b/drivers/net/bnxt/tf_core/tf_core.c\n@@ -6,6 +6,7 @@\n #include <stdio.h>\n \n #include \"tf_core.h\"\n+#include \"tf_util.h\"\n #include \"tf_session.h\"\n #include \"tf_tbl.h\"\n #include \"tf_em.h\"\n@@ -229,6 +230,7 @@ tf_open_session(struct tf                    *tfp,\n \n \t/* Initialize Session */\n \tsession->device_type = parms->device_type;\n+\tsession->dev = NULL;\n \ttf_rm_init(tfp);\n \n \t/* Construct the Session ID */\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h\nindex 81ff7602f..becc50c7f 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.h\n+++ b/drivers/net/bnxt/tf_core/tf_core.h\n@@ -371,6 +371,35 @@ struct tf {\n \tstruct tf_session_info *session;\n };\n \n+/**\n+ * tf_session_resources parameter definition.\n+ */\n+struct tf_session_resources {\n+\t/** [in] Requested Identifier Resources\n+\t *\n+\t * The number of identifier resources requested for the session.\n+\t * The index used is tf_identifier_type.\n+\t */\n+\tuint16_t identifer_cnt[TF_DIR_MAX][TF_IDENT_TYPE_MAX];\n+\t/** [in] Requested Index Table resource counts\n+\t *\n+\t * The number of index table resources requested for the session.\n+\t * The index used is tf_tbl_type.\n+\t */\n+\tuint16_t tbl_cnt[TF_TBL_TYPE_MAX][TF_DIR_MAX];\n+\t/** [in] Requested TCAM Table resource counts\n+\t *\n+\t * The number of TCAM table resources requested for the session.\n+\t * The index used is tf_tcam_tbl_type.\n+\t */\n+\tuint16_t tcam_tbl_cnt[TF_TCAM_TBL_TYPE_MAX][TF_DIR_MAX];\n+\t/** [in] Requested EM resource counts\n+\t *\n+\t * The number of internal EM table resources requested for the session\n+\t * The index used is tf_em_tbl_type.\n+\t */\n+\tuint16_t em_tbl_cnt[TF_EM_TBL_TYPE_MAX][TF_DIR_MAX];\n+};\n \n /**\n  * tf_open_session parameters definition.\n@@ -414,33 +443,14 @@ struct tf_open_session_parms {\n \tunion tf_session_id session_id;\n \t/** [in] device type\n \t *\n-\t * Device type is passed, one of Wh+, Brd2, Brd3, Brd4\n+\t * Device type is passed, one of Wh+, SR, Thor, SR2\n \t */\n \tenum tf_device_type device_type;\n-\t/** [in] Requested Identifier Resources\n-\t *\n-\t * The number of identifier resources requested for the session.\n-\t * The index used is tf_identifier_type.\n-\t */\n-\tuint16_t identifer_cnt[TF_IDENT_TYPE_MAX];\n-\t/** [in] Requested Index Table resource counts\n-\t *\n-\t * The number of index table resources requested for the session.\n-\t * The index used is tf_tbl_type.\n-\t */\n-\tuint16_t tbl_cnt[TF_TBL_TYPE_MAX];\n-\t/** [in] Requested TCAM Table resource counts\n-\t *\n-\t * The number of TCAM table resources requested for the session.\n-\t * The index used is tf_tcam_tbl_type.\n-\t */\n-\tuint16_t tcam_tbl_cnt[TF_TCAM_TBL_TYPE_MAX];\n-\t/** [in] Requested EM resource counts\n+\t/** [in] resources\n \t *\n-\t * The number of internal EM table resources requested for the session\n-\t * The index used is tf_em_tbl_type.\n+\t * Resource allocation\n \t */\n-\tuint16_t em_tbl_cnt[TF_EM_TBL_TYPE_MAX];\n+\tstruct tf_session_resources resources;\n };\n \n /**\ndiff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c\nnew file mode 100644\nindex 000000000..3b368313e\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_device.c\n@@ -0,0 +1,50 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include \"tf_device.h\"\n+#include \"tf_device_p4.h\"\n+#include \"tfp.h\"\n+#include \"bnxt.h\"\n+\n+struct tf;\n+\n+/**\n+ * Device specific bind function\n+ */\n+static int\n+dev_bind_p4(struct tf *tfp __rte_unused,\n+\t    struct tf_session_resources *resources __rte_unused,\n+\t    struct tf_dev_info *dev_info)\n+{\n+\t/* Initialize the modules */\n+\n+\tdev_info->ops = &tf_dev_ops_p4;\n+\treturn 0;\n+}\n+\n+int\n+dev_bind(struct tf *tfp __rte_unused,\n+\t enum tf_device_type type,\n+\t struct tf_session_resources *resources,\n+\t struct tf_dev_info *dev_info)\n+{\n+\tswitch (type) {\n+\tcase TF_DEVICE_TYPE_WH:\n+\t\treturn dev_bind_p4(tfp,\n+\t\t\t\t   resources,\n+\t\t\t\t   dev_info);\n+\tdefault:\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Device type not supported\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+}\n+\n+int\n+dev_unbind(struct tf *tfp __rte_unused,\n+\t   struct tf_dev_info *dev_handle __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h\nnew file mode 100644\nindex 000000000..8b63ff178\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_device.h\n@@ -0,0 +1,331 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_DEVICE_H_\n+#define _TF_DEVICE_H_\n+\n+#include \"tf_core.h\"\n+#include \"tf_identifier.h\"\n+#include \"tf_tbl_type.h\"\n+#include \"tf_tcam.h\"\n+\n+struct tf;\n+struct tf_session;\n+\n+/**\n+ * The Device module provides a general device template. A supported\n+ * device type should implement one or more of the listed function\n+ * pointers according to its capabilities.\n+ *\n+ * If a device function pointer is NULL the device capability is not\n+ * supported.\n+ */\n+\n+/**\n+ * TF device information\n+ */\n+struct tf_dev_info {\n+\tconst struct tf_dev_ops *ops;\n+};\n+\n+/**\n+ * @page device Device\n+ *\n+ * @ref tf_dev_bind\n+ *\n+ * @ref tf_dev_unbind\n+ */\n+\n+/**\n+ * Device bind handles the initialization of the specified device\n+ * type.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle\n+ *\n+ * [in] type\n+ *   Device type\n+ *\n+ * [in] resources\n+ *   Pointer to resource allocation information\n+ *\n+ * [out] dev_handle\n+ *   Device handle\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int dev_bind(struct tf *tfp,\n+\t     enum tf_device_type type,\n+\t     struct tf_session_resources *resources,\n+\t     struct tf_dev_info *dev_handle);\n+\n+/**\n+ * Device release handles cleanup of the device specific information.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle\n+ *\n+ * [in] dev_handle\n+ *   Device handle\n+ */\n+int dev_unbind(struct tf *tfp,\n+\t       struct tf_dev_info *dev_handle);\n+\n+/**\n+ * Truflow device specific function hooks structure\n+ *\n+ * The following device hooks can be defined; unless noted otherwise,\n+ * they are optional and can be filled with a null pointer. The\n+ * purpose of these hooks is to support Truflow device operations for\n+ * different device variants.\n+ */\n+struct tf_dev_ops {\n+\t/**\n+\t * Allocation of an identifier element.\n+\t *\n+\t * This API allocates the specified identifier element from a\n+\t * device specific identifier DB. The allocated element is\n+\t * returned.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to identifier allocation parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_alloc_ident)(struct tf *tfp,\n+\t\t\t\t  struct tf_ident_alloc_parms *parms);\n+\n+\t/**\n+\t * Free of an identifier element.\n+\t *\n+\t * This API free's a previous allocated identifier element from a\n+\t * device specific identifier DB.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to identifier free parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_free_ident)(struct tf *tfp,\n+\t\t\t\t struct tf_ident_free_parms *parms);\n+\n+\t/**\n+\t * Allocation of a table type element.\n+\t *\n+\t * This API allocates the specified table type element from a\n+\t * device specific table type DB. The allocated element is\n+\t * returned.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table type allocation parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_alloc_tbl_type)(struct tf *tfp,\n+\t\t\t\t     struct tf_tbl_type_alloc_parms *parms);\n+\n+\t/**\n+\t * Free of a table type element.\n+\t *\n+\t * This API free's a previous allocated table type element from a\n+\t * device specific table type DB.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table type free parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_free_tbl_type)(struct tf *tfp,\n+\t\t\t\t    struct tf_tbl_type_free_parms *parms);\n+\n+\t/**\n+\t * Searches for the specified table type element in a shadow DB.\n+\t *\n+\t * This API searches for the specified table type element in a\n+\t * device specific shadow DB. If the element is found the\n+\t * reference count for the element is updated. If the element\n+\t * is not found a new element is allocated from the table type\n+\t * DB and then inserted into the shadow DB.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table type allocation and search parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_alloc_search_tbl_type)\n+\t\t\t(struct tf *tfp,\n+\t\t\tstruct tf_tbl_type_alloc_search_parms *parms);\n+\n+\t/**\n+\t * Sets the specified table type element.\n+\t *\n+\t * This API sets the specified element data by invoking the\n+\t * firmware.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table type set parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_set_tbl_type)(struct tf *tfp,\n+\t\t\t\t   struct tf_tbl_type_set_parms *parms);\n+\n+\t/**\n+\t * Retrieves the specified table type element.\n+\t *\n+\t * This API retrieves the specified element data by invoking the\n+\t * firmware.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table type get parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_get_tbl_type)(struct tf *tfp,\n+\t\t\t\t   struct tf_tbl_type_get_parms *parms);\n+\n+\t/**\n+\t * Allocation of a tcam element.\n+\t *\n+\t * This API allocates the specified tcam element from a device\n+\t * specific tcam DB. The allocated element is returned.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to tcam allocation parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_alloc_tcam)(struct tf *tfp,\n+\t\t\t\t struct tf_tcam_alloc_parms *parms);\n+\n+\t/**\n+\t * Free of a tcam element.\n+\t *\n+\t * This API free's a previous allocated tcam element from a\n+\t * device specific tcam DB.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to tcam free parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_free_tcam)(struct tf *tfp,\n+\t\t\t\tstruct tf_tcam_free_parms *parms);\n+\n+\t/**\n+\t * Searches for the specified tcam element in a shadow DB.\n+\t *\n+\t * This API searches for the specified tcam element in a\n+\t * device specific shadow DB. If the element is found the\n+\t * reference count for the element is updated. If the element\n+\t * is not found a new element is allocated from the tcam DB\n+\t * and then inserted into the shadow DB.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to tcam allocation and search parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_alloc_search_tcam)\n+\t\t\t(struct tf *tfp,\n+\t\t\tstruct tf_tcam_alloc_search_parms *parms);\n+\n+\t/**\n+\t * Sets the specified tcam element.\n+\t *\n+\t * This API sets the specified element data by invoking the\n+\t * firmware.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to tcam set parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_set_tcam)(struct tf *tfp,\n+\t\t\t       struct tf_tcam_set_parms *parms);\n+\n+\t/**\n+\t * Retrieves the specified tcam element.\n+\t *\n+\t * This API retrieves the specified element data by invoking the\n+\t * firmware.\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to tcam get parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_get_tcam)(struct tf *tfp,\n+\t\t\t       struct tf_tcam_get_parms *parms);\n+};\n+\n+/**\n+ * Supported device operation structures\n+ */\n+extern const struct tf_dev_ops tf_dev_ops_p4;\n+\n+#endif /* _TF_DEVICE_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c\nnew file mode 100644\nindex 000000000..c3c4d1e05\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include \"tf_device.h\"\n+#include \"tf_identifier.h\"\n+#include \"tf_tbl_type.h\"\n+#include \"tf_tcam.h\"\n+\n+const struct tf_dev_ops tf_dev_ops_p4 = {\n+\t.tf_dev_alloc_ident = tf_ident_alloc,\n+\t.tf_dev_free_ident = tf_ident_free,\n+\t.tf_dev_alloc_tbl_type = tf_tbl_type_alloc,\n+\t.tf_dev_free_tbl_type = tf_tbl_type_free,\n+\t.tf_dev_alloc_search_tbl_type = tf_tbl_type_alloc_search,\n+\t.tf_dev_set_tbl_type = tf_tbl_type_set,\n+\t.tf_dev_get_tbl_type = tf_tbl_type_get,\n+\t.tf_dev_alloc_tcam = tf_tcam_alloc,\n+\t.tf_dev_free_tcam = tf_tcam_free,\n+\t.tf_dev_alloc_search_tcam = tf_tcam_alloc_search,\n+\t.tf_dev_set_tcam = tf_tcam_set,\n+\t.tf_dev_get_tcam = tf_tcam_get,\n+};\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.h b/drivers/net/bnxt/tf_core/tf_device_p4.h\nnew file mode 100644\nindex 000000000..84d90e3a7\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.h\n@@ -0,0 +1,64 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_DEVICE_P4_H_\n+#define _TF_DEVICE_P4_H_\n+\n+#include <cfa_resource_types.h>\n+\n+#include \"tf_core.h\"\n+#include \"tf_rm_new.h\"\n+\n+struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX] = {\n+\t{ TF_RM_ELEM_CFG_PRIVATE, 0 /* CFA_RESOURCE_TYPE_P4_INVALID */ },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_PROF_FUNC },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_PROF_ID },\n+\t{ TF_RM_ELEM_CFG_NULL, 0    /* CFA_RESOURCE_TYPE_P4_L2_FUNC */ }\n+};\n+\n+struct tf_rm_element_cfg tf_tcam_p4[TF_TCAM_TBL_TYPE_MAX] = {\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_PROF_TCAM },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_WC_TCAM },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SP_TCAM },\n+\t{ TF_RM_ELEM_CFG_NULL, 0 /* CFA_RESOURCE_TYPE_P4_CT_RULE_TCAM */ },\n+\t{ TF_RM_ELEM_CFG_NULL, 0  /* CFA_RESOURCE_TYPE_P4_VEB_TCAM */ }\n+};\n+\n+struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = {\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_FULL_ACTION },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_MCG },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_8B },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_16B },\n+\t{ TF_RM_ELEM_CFG_NULL, 0, /* CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_32B */ },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_ENCAP_64B },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_SP_MAC },\n+\t{ TF_RM_ELEM_CFG_NULL, 0 /* CFA_RESOURCE_TYPE_P4_SRAM_SP_SMAC_IPV4 */ },\n+\t{ TF_RM_ELEM_CFG_NULL, 0 /* CFA_RESOURCE_TYPE_P4_SRAM_SP_SMAC_IPV6 */ },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_COUNTER_64B },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_SPORT },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_DPORT },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_S_IPV4 },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_D_IPV4 },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_S_IPV6 },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_SRAM_NAT_D_IPV6 },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_METER_PROF },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_METER },\n+\t{ TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_MIRROR },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_UPAR */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_EPOC */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_METADATA */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_CT_STATE */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_RANGE_PROF */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_RANGE_ENTRY */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_LAG */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_VNIC_SVIF */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_EM_FBK */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_WC_FKB */ },\n+\t{ TF_RM_ELEM_CFG_NULL, /* CFA_RESOURCE_TYPE_P4_EXT */ }\n+};\n+\n+#endif /* _TF_DEVICE_P4_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c\nnew file mode 100644\nindex 000000000..726d0b406\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_identifier.c\n@@ -0,0 +1,47 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_identifier.h\"\n+\n+struct tf;\n+\n+/**\n+ * Identifier DBs.\n+ */\n+/* static void *ident_db[TF_DIR_MAX]; */\n+\n+/**\n+ * Init flag, set on bind and cleared on unbind\n+ */\n+/* static uint8_t init; */\n+\n+int\n+tf_ident_bind(struct tf *tfp __rte_unused,\n+\t      struct tf_ident_cfg *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_ident_unbind(struct tf *tfp __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_ident_alloc(struct tf *tfp __rte_unused,\n+\t       struct tf_ident_alloc_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_ident_free(struct tf *tfp __rte_unused,\n+\t      struct tf_ident_free_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_identifier.h b/drivers/net/bnxt/tf_core/tf_identifier.h\nnew file mode 100644\nindex 000000000..b77c91b9d\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_identifier.h\n@@ -0,0 +1,140 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_IDENTIFIER_H_\n+#define _TF_IDENTIFIER_H_\n+\n+#include \"tf_core.h\"\n+\n+/**\n+ * The Identifier module provides processing of Identifiers.\n+ */\n+\n+struct tf_ident_cfg {\n+\t/**\n+\t * Number of identifier types in each of the configuration\n+\t * arrays\n+\t */\n+\tuint16_t num_elements;\n+\n+\t/**\n+\t * TCAM configuration array\n+\t */\n+\tstruct tf_rm_element_cfg *ident_cfg[TF_DIR_MAX];\n+};\n+\n+/**\n+ * Identifier allcoation parameter definition\n+ */\n+struct tf_ident_alloc_parms {\n+\t/**\n+\t * [in] receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Identifier type\n+\t */\n+\tenum tf_identifier_type ident_type;\n+\t/**\n+\t * [out] Identifier allocated\n+\t */\n+\tuint16_t id;\n+};\n+\n+/**\n+ * Identifier free parameter definition\n+ */\n+struct tf_ident_free_parms {\n+\t/**\n+\t * [in]\t receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Identifier type\n+\t */\n+\tenum tf_identifier_type ident_type;\n+\t/**\n+\t * [in] ID to free\n+\t */\n+\tuint16_t id;\n+};\n+\n+/**\n+ * @page ident Identity Management\n+ *\n+ * @ref tf_ident_bind\n+ *\n+ * @ref tf_ident_unbind\n+ *\n+ * @ref tf_ident_alloc\n+ *\n+ * @ref tf_ident_free\n+ */\n+\n+/**\n+ * Initializes the Identifier module with the requested DBs. Must be\n+ * invoked as the first thing before any of the access functions.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_ident_bind(struct tf *tfp,\n+\t\t  struct tf_ident_cfg *parms);\n+\n+/**\n+ * Cleans up the private DBs and releases all the data.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_ident_unbind(struct tf *tfp);\n+\n+/**\n+ * Allocates a single identifier type.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_ident_alloc(struct tf *tfp,\n+\t\t   struct tf_ident_alloc_parms *parms);\n+\n+/**\n+ * Free's a single identifier type.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_ident_free(struct tf *tfp,\n+\t\t  struct tf_ident_free_parms *parms);\n+\n+#endif /* _TF_IDENTIFIER_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c\nindex 38b1e71cd..2264704d2 100644\n--- a/drivers/net/bnxt/tf_core/tf_rm.c\n+++ b/drivers/net/bnxt/tf_core/tf_rm.c\n@@ -9,6 +9,7 @@\n \n #include \"tf_rm.h\"\n #include \"tf_core.h\"\n+#include \"tf_util.h\"\n #include \"tf_session.h\"\n #include \"tf_resources.h\"\n #include \"tf_msg.h\"\n@@ -76,59 +77,6 @@\n \t\t\t(dtype) = type ## _TX;\t\\\n \t} while (0)\n \n-const char\n-*tf_dir_2_str(enum tf_dir dir)\n-{\n-\tswitch (dir) {\n-\tcase TF_DIR_RX:\n-\t\treturn \"RX\";\n-\tcase TF_DIR_TX:\n-\t\treturn \"TX\";\n-\tdefault:\n-\t\treturn \"Invalid direction\";\n-\t}\n-}\n-\n-const char\n-*tf_ident_2_str(enum tf_identifier_type id_type)\n-{\n-\tswitch (id_type) {\n-\tcase TF_IDENT_TYPE_L2_CTXT:\n-\t\treturn \"l2_ctxt_remap\";\n-\tcase TF_IDENT_TYPE_PROF_FUNC:\n-\t\treturn \"prof_func\";\n-\tcase TF_IDENT_TYPE_WC_PROF:\n-\t\treturn \"wc_prof\";\n-\tcase TF_IDENT_TYPE_EM_PROF:\n-\t\treturn \"em_prof\";\n-\tcase TF_IDENT_TYPE_L2_FUNC:\n-\t\treturn \"l2_func\";\n-\tdefault:\n-\t\treturn \"Invalid identifier\";\n-\t}\n-}\n-\n-const char\n-*tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type)\n-{\n-\tswitch (tcam_type) {\n-\tcase TF_TCAM_TBL_TYPE_L2_CTXT_TCAM:\n-\t\treturn \"l2_ctxt_tcam\";\n-\tcase TF_TCAM_TBL_TYPE_PROF_TCAM:\n-\t\treturn \"prof_tcam\";\n-\tcase TF_TCAM_TBL_TYPE_WC_TCAM:\n-\t\treturn \"wc_tcam\";\n-\tcase TF_TCAM_TBL_TYPE_VEB_TCAM:\n-\t\treturn \"veb_tcam\";\n-\tcase TF_TCAM_TBL_TYPE_SP_TCAM:\n-\t\treturn \"sp_tcam\";\n-\tcase TF_TCAM_TBL_TYPE_CT_RULE_TCAM:\n-\t\treturn \"ct_rule_tcam\";\n-\tdefault:\n-\t\treturn \"Invalid tcam table type\";\n-\t}\n-}\n-\n const char\n *tf_hcapi_hw_2_str(enum tf_resource_type_hw hw_type)\n {\ndiff --git a/drivers/net/bnxt/tf_core/tf_rm.h b/drivers/net/bnxt/tf_core/tf_rm.h\nindex e69d443a8..1a09f13a7 100644\n--- a/drivers/net/bnxt/tf_core/tf_rm.h\n+++ b/drivers/net/bnxt/tf_core/tf_rm.h\n@@ -124,24 +124,6 @@ struct tf_rm_db {\n \tstruct tf_rm_resc tx;\n };\n \n-/**\n- * Helper function converting direction to text string\n- */\n-const char\n-*tf_dir_2_str(enum tf_dir dir);\n-\n-/**\n- * Helper function converting identifier to text string\n- */\n-const char\n-*tf_ident_2_str(enum tf_identifier_type id_type);\n-\n-/**\n- * Helper function converting tcam type to text string\n- */\n-const char\n-*tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type);\n-\n /**\n  * Helper function used to convert HW HCAPI resource type to a string.\n  */\ndiff --git a/drivers/net/bnxt/tf_core/tf_rm_new.c b/drivers/net/bnxt/tf_core/tf_rm_new.c\nnew file mode 100644\nindex 000000000..51bb9ba3a\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_rm_new.c\n@@ -0,0 +1,102 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_rm_new.h\"\n+\n+/**\n+ * Resource query single entry. Used when accessing HCAPI RM on the\n+ * firmware.\n+ */\n+struct tf_rm_query_entry {\n+\t/** Minimum guaranteed number of elements */\n+\tuint16_t min;\n+\t/** Maximum non-guaranteed number of elements */\n+\tuint16_t max;\n+};\n+\n+/**\n+ * Generic RM Element data type that an RM DB is build upon.\n+ */\n+struct tf_rm_element {\n+\t/**\n+\t * RM Element configuration type. If Private then the\n+\t * hcapi_type can be ignored. If Null then the element is not\n+\t * valid for the device.\n+\t */\n+\tenum tf_rm_elem_cfg_type type;\n+\n+\t/**\n+\t * HCAPI RM Type for the element.\n+\t */\n+\tuint16_t hcapi_type;\n+\n+\t/**\n+\t * HCAPI RM allocated range information for the element.\n+\t */\n+\tstruct tf_rm_alloc_info alloc;\n+\n+\t/**\n+\t * Bit allocator pool for the element. Pool size is controlled\n+\t * by the struct tf_session_resources at time of session creation.\n+\t * Null indicates that the element is not used for the device.\n+\t */\n+\tstruct bitalloc *pool;\n+};\n+\n+/**\n+ * TF RM DB definition\n+ */\n+struct tf_rm_db {\n+\t/**\n+\t * The DB consists of an array of elements\n+\t */\n+\tstruct tf_rm_element *db;\n+};\n+\n+int\n+tf_rm_create_db(struct tf *tfp __rte_unused,\n+\t\tstruct tf_rm_create_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_free_db(struct tf *tfp __rte_unused,\n+\t      struct tf_rm_free_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_allocate(struct tf_rm_allocate_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_free(struct tf_rm_free_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_is_allocated(struct tf_rm_is_allocated_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_get_info(struct tf_rm_get_alloc_info_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_rm_get_hcapi_type(struct tf_rm_get_hcapi_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_rm_new.h b/drivers/net/bnxt/tf_core/tf_rm_new.h\nnew file mode 100644\nindex 000000000..72dba0984\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_rm_new.h\n@@ -0,0 +1,368 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef TF_RM_H_\n+#define TF_RM_H_\n+\n+#include \"tf_core.h\"\n+#include \"bitalloc.h\"\n+\n+struct tf;\n+\n+/**\n+ * The Resource Manager (RM) module provides basic DB handling for\n+ * internal resources. These resources exists within the actual device\n+ * and are controlled by the HCAPI Resource Manager running on the\n+ * firmware.\n+ *\n+ * The RM DBs are all intended to be indexed using TF types there for\n+ * a lookup requires no additional conversion. The DB configuration\n+ * specifies the TF Type to HCAPI Type mapping and it becomes the\n+ * responsibility of the DB initialization to handle this static\n+ * mapping.\n+ *\n+ * Accessor functions are providing access to the DB, thus hiding the\n+ * implementation.\n+ *\n+ * The RM DB will work on its initial allocated sizes so the\n+ * capability of dynamically growing a particular resource is not\n+ * possible. If this capability later becomes a requirement then the\n+ * MAX pool size of the Chip œneeds to be added to the tf_rm_elem_info\n+ * structure and several new APIs would need to be added to allow for\n+ * growth of a single TF resource type.\n+ */\n+\n+/**\n+ * Resource reservation single entry result. Used when accessing HCAPI\n+ * RM on the firmware.\n+ */\n+struct tf_rm_entry {\n+\t/** Starting index of the allocated resource */\n+\tuint16_t start;\n+\t/** Number of allocated elements */\n+\tuint16_t stride;\n+};\n+\n+/**\n+ * RM Element configuration enumeration. Used by the Device to\n+ * indicate how the RM elements the DB consists off, are to be\n+ * configured at time of DB creation. The TF may present types to the\n+ * ULP layer that is not controlled by HCAPI within the Firmware.\n+ */\n+enum tf_rm_elem_cfg_type {\n+\tTF_RM_ELEM_CFG_NULL,    /**< No configuration */\n+\tTF_RM_ELEM_CFG_HCAPI,   /**< HCAPI 'controlled' */\n+\tTF_RM_ELEM_CFG_PRIVATE, /**< Private thus not HCAPI 'controlled' */\n+\tTF_RM_TYPE_MAX\n+};\n+\n+/**\n+ * RM Element configuration structure, used by the Device to configure\n+ * how an individual TF type is configured in regard to the HCAPI RM\n+ * of same type.\n+ */\n+struct tf_rm_element_cfg {\n+\t/**\n+\t * RM Element config controls how the DB for that element is\n+\t * processed.\n+\t */\n+\tenum tf_rm_elem_cfg_type cfg;\n+\n+\t/* If a HCAPI to TF type conversion is required then TF type\n+\t * can be added here.\n+\t */\n+\n+\t/**\n+\t * HCAPI RM Type for the element. Used for TF to HCAPI type\n+\t * conversion.\n+\t */\n+\tuint16_t hcapi_type;\n+};\n+\n+/**\n+ * Allocation information for a single element.\n+ */\n+struct tf_rm_alloc_info {\n+\t/**\n+\t * HCAPI RM allocated range information.\n+\t *\n+\t * NOTE:\n+\t * In case of dynamic allocation support this would have\n+\t * to be changed to linked list of tf_rm_entry instead.\n+\t */\n+\tstruct tf_rm_entry entry;\n+};\n+\n+/**\n+ * Create RM DB parameters\n+ */\n+struct tf_rm_create_db_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Number of elements in the parameter structure\n+\t */\n+\tuint16_t num_elements;\n+\t/**\n+\t * [in] Parameter structure\n+\t */\n+\tstruct tf_rm_element_cfg *parms;\n+\t/**\n+\t * [out] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+};\n+\n+/**\n+ * Free RM DB parameters\n+ */\n+struct tf_rm_free_db_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+};\n+\n+/**\n+ * Allocate RM parameters for a single element\n+ */\n+struct tf_rm_allocate_parms {\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+\t/**\n+\t * [in] DB Index, indicates which DB entry to perform the\n+\t * action on.\n+\t */\n+\tuint16_t db_index;\n+\t/**\n+\t * [in] Pointer to the allocated index in normalized\n+\t * form. Normalized means the index has been adjusted,\n+\t * i.e. Full Action Record offsets.\n+\t */\n+\tuint32_t *index;\n+};\n+\n+/**\n+ * Free RM parameters for a single element\n+ */\n+struct tf_rm_free_parms {\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+\t/**\n+\t * [in] DB Index, indicates which DB entry to perform the\n+\t * action on.\n+\t */\n+\tuint16_t db_index;\n+\t/**\n+\t * [in] Index to free\n+\t */\n+\tuint32_t index;\n+};\n+\n+/**\n+ * Is Allocated parameters for a single element\n+ */\n+struct tf_rm_is_allocated_parms {\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+\t/**\n+\t * [in] DB Index, indicates which DB entry to perform the\n+\t * action on.\n+\t */\n+\tuint16_t db_index;\n+\t/**\n+\t * [in] Index to free\n+\t */\n+\tuint32_t index;\n+\t/**\n+\t * [in] Pointer to flag that indicates the state of the query\n+\t */\n+\tuint8_t *allocated;\n+};\n+\n+/**\n+ * Get Allocation information for a single element\n+ */\n+struct tf_rm_get_alloc_info_parms {\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+\t/**\n+\t * [in] DB Index, indicates which DB entry to perform the\n+\t * action on.\n+\t */\n+\tuint16_t db_index;\n+\t/**\n+\t * [out] Pointer to the requested allocation information for\n+\t * the specified db_index\n+\t */\n+\tstruct tf_rm_alloc_info *info;\n+};\n+\n+/**\n+ * Get HCAPI type parameters for a single element\n+ */\n+struct tf_rm_get_hcapi_parms {\n+\t/**\n+\t * [in] RM DB Handle\n+\t */\n+\tvoid *tf_rm_db;\n+\t/**\n+\t * [in] DB Index, indicates which DB entry to perform the\n+\t * action on.\n+\t */\n+\tuint16_t db_index;\n+\t/**\n+\t * [out] Pointer to the hcapi type for the specified db_index\n+\t */\n+\tuint16_t *hcapi_type;\n+};\n+\n+/**\n+ * @page rm Resource Manager\n+ *\n+ * @ref tf_rm_create_db\n+ *\n+ * @ref tf_rm_free_db\n+ *\n+ * @ref tf_rm_allocate\n+ *\n+ * @ref tf_rm_free\n+ *\n+ * @ref tf_rm_is_allocated\n+ *\n+ * @ref tf_rm_get_info\n+ *\n+ * @ref tf_rm_get_hcapi_type\n+ */\n+\n+/**\n+ * Creates and fills a Resource Manager (RM) DB with requested\n+ * elements. The DB is indexed per the parms structure.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to create parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+/*\n+ * NOTE:\n+ * - Fail on parameter check\n+ * - Fail on DB creation, i.e. alloc amount is not possible or validation fails\n+ * - Fail on DB creation if DB already exist\n+ *\n+ * - Allocs local DB\n+ * - Does hcapi qcaps\n+ * - Does hcapi reservation\n+ * - Populates the pool with allocated elements\n+ * - Returns handle to the created DB\n+ */\n+int tf_rm_create_db(struct tf *tfp,\n+\t\t    struct tf_rm_create_db_parms *parms);\n+\n+/**\n+ * Closes the Resource Manager (RM) DB and frees all allocated\n+ * resources per the associated database.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to free parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_rm_free_db(struct tf *tfp,\n+\t\t  struct tf_rm_free_db_parms *parms);\n+\n+/**\n+ * Allocates a single element for the type specified, within the DB.\n+ *\n+ * [in] parms\n+ *   Pointer to allocate parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_rm_allocate(struct tf_rm_allocate_parms *parms);\n+\n+/**\n+ * Free's a single element for the type specified, within the DB.\n+ *\n+ * [in] parms\n+ *   Pointer to free parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EpINVAL) on failure.\n+ */\n+int tf_rm_free(struct tf_rm_free_parms *parms);\n+\n+/**\n+ * Performs an allocation verification check on a specified element.\n+ *\n+ * [in] parms\n+ *   Pointer to is allocated parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+/*\n+ * NOTE:\n+ *  - If pool is set to Chip MAX, then the query index must be checked\n+ *    against the allocated range and query index must be allocated as well.\n+ *  - If pool is allocated size only, then check if query index is allocated.\n+ */\n+int tf_rm_is_allocated(struct tf_rm_is_allocated_parms *parms);\n+\n+/**\n+ * Retrieves an elements allocation information from the Resource\n+ * Manager (RM) DB.\n+ *\n+ * [in] parms\n+ *   Pointer to get info parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_rm_get_info(struct tf_rm_get_alloc_info_parms *parms);\n+\n+/**\n+ * Performs a lookup in the Resource Manager DB and retrives the\n+ * requested HCAPI type.\n+ *\n+ * [in] parms\n+ *   Pointer to get hcapi parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_rm_get_hcapi_type(struct tf_rm_get_hcapi_parms *parms);\n+\n+#endif /* TF_RM_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c\nnew file mode 100644\nindex 000000000..c74994546\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_session.c\n@@ -0,0 +1,31 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+int\n+tf_session_get_session(struct tf *tfp,\n+\t\t       struct tf_session *tfs)\n+{\n+\tif (tfp->session == NULL || tfp->session->core_data == NULL) {\n+\t\tTFP_DRV_LOG(ERR, \"Session not created\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttfs = (struct tf_session *)(tfp->session->core_data);\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_session_get_device(struct tf_session *tfs,\n+\t\t      struct tf_device *tfd)\n+{\n+\tif (tfs->dev == NULL) {\n+\t\tTFP_DRV_LOG(ERR, \"Device not created\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\ttfd = tfs->dev;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h\nindex c9f4f8f04..b1cc7a4a7 100644\n--- a/drivers/net/bnxt/tf_core/tf_session.h\n+++ b/drivers/net/bnxt/tf_core/tf_session.h\n@@ -11,10 +11,21 @@\n \n #include \"bitalloc.h\"\n #include \"tf_core.h\"\n+#include \"tf_device.h\"\n #include \"tf_rm.h\"\n #include \"tf_tbl.h\"\n #include \"stack.h\"\n \n+/**\n+ * The Session module provides session control support. A session is\n+ * to the ULP layer known as a session_info instance. The session\n+ * private data is the actual session.\n+ *\n+ * Session manages:\n+ *   - The device and all the resources related to the device.\n+ *   - Any session sharing between ULP applications\n+ */\n+\n /** Session defines\n  */\n #define TF_SESSIONS_MAX\t          1          /** max # sessions */\n@@ -90,6 +101,9 @@ struct tf_session {\n \t */\n \tuint8_t ref_count;\n \n+\t/** Device */\n+\tstruct tf_dev_info *dev;\n+\n \t/** Session HW and SRAM resources */\n \tstruct tf_rm_db resc;\n \n@@ -309,4 +323,44 @@ struct tf_session {\n \tstruct stack em_pool[TF_DIR_MAX];\n };\n \n+/**\n+ * @page session Session Management\n+ *\n+ * @ref tf_session_get_session\n+ *\n+ * @ref tf_session_get_device\n+ */\n+\n+/**\n+ * Looks up the private session information from the TF session info.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle\n+ *\n+ * [out] tfs\n+ *   Pointer to the session\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_session_get_session(struct tf *tfp,\n+\t\t\t   struct tf_session *tfs);\n+\n+/**\n+ * Looks up the device information from the TF Session.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle\n+ *\n+ * [out] tfd\n+ *   Pointer to the device\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_session_get_device(struct tf_session *tfs,\n+\t\t\t  struct tf_dev_info *tfd);\n+\n #endif /* _TF_SESSION_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_shadow_tbl.c b/drivers/net/bnxt/tf_core/tf_shadow_tbl.c\nnew file mode 100644\nindex 000000000..8f2b6de70\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_shadow_tbl.c\n@@ -0,0 +1,63 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_shadow_tbl.h\"\n+\n+/**\n+ * Shadow table DB element\n+ */\n+struct tf_shadow_tbl_element {\n+\t/**\n+\t * Hash table\n+\t */\n+\tvoid *hash;\n+\n+\t/**\n+\t * Reference count, array of number of table type entries\n+\t */\n+\tuint16_t *ref_count;\n+};\n+\n+/**\n+ * Shadow table DB definition\n+ */\n+struct tf_shadow_tbl_db {\n+\t/**\n+\t * The DB consists of an array of elements\n+\t */\n+\tstruct tf_shadow_tbl_element *db;\n+};\n+\n+int\n+tf_shadow_tbl_create_db(struct tf_shadow_tbl_create_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tbl_free_db(struct tf_shadow_tbl_free_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tbl_search(struct tf_shadow_tbl_search_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tbl_insert(struct tf_shadow_tbl_insert_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tbl_remove(struct tf_shadow_tbl_remove_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_shadow_tbl.h b/drivers/net/bnxt/tf_core/tf_shadow_tbl.h\nnew file mode 100644\nindex 000000000..dfd336e53\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_shadow_tbl.h\n@@ -0,0 +1,240 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_SHADOW_TBL_H_\n+#define _TF_SHADOW_TBL_H_\n+\n+#include \"tf_core.h\"\n+\n+struct tf;\n+\n+/**\n+ * The Shadow Table module provides shadow DB handling for table based\n+ * TF types. A shadow DB provides the capability that allows for reuse\n+ * of TF resources.\n+ *\n+ * A Shadow table DB is intended to be used by the Table Type module\n+ * only.\n+ */\n+\n+/**\n+ * Shadow DB configuration information for a single table type.\n+ *\n+ * During Device initialization the HCAPI device specifics are learned\n+ * and as well as the RM DB creation. From that those initial steps\n+ * this structure can be populated.\n+ *\n+ * NOTE:\n+ * If used in an array of table types then such array must be ordered\n+ * by the TF type is represents.\n+ */\n+struct tf_shadow_tbl_cfg_parms {\n+\t/**\n+\t * TF Table type\n+\t */\n+\tenum tf_tbl_type type;\n+\n+\t/**\n+\t * Number of entries the Shadow DB needs to hold\n+\t */\n+\tint num_entries;\n+\n+\t/**\n+\t * Element width for this table type\n+\t */\n+\tint element_width;\n+};\n+\n+/**\n+ * Shadow table DB creation parameters\n+ */\n+struct tf_shadow_tbl_create_db_parms {\n+\t/**\n+\t * [in] Configuration information for the shadow db\n+\t */\n+\tstruct tf_shadow_tbl_cfg_parms *cfg;\n+\t/**\n+\t * [in] Number of elements in the parms structure\n+\t */\n+\tuint16_t num_elements;\n+\t/**\n+\t * [out] Shadow table DB handle\n+\t */\n+\tvoid *tf_shadow_tbl_db;\n+};\n+\n+/**\n+ * Shadow table DB free parameters\n+ */\n+struct tf_shadow_tbl_free_db_parms {\n+\t/**\n+\t * Shadow table DB handle\n+\t */\n+\tvoid *tf_shadow_tbl_db;\n+};\n+\n+/**\n+ * Shadow table search parameters\n+ */\n+struct tf_shadow_tbl_search_parms {\n+\t/**\n+\t * [in] Shadow table DB handle\n+\t */\n+\tvoid *tf_shadow_tbl_db;\n+\t/**\n+\t * [in] Table type\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Pointer to entry blob value in remap table to match\n+\t */\n+\tuint8_t *entry;\n+\t/**\n+\t * [in] Size of the entry blob passed in bytes\n+\t */\n+\tuint16_t entry_sz;\n+\t/**\n+\t * [out] Index of the found element returned if hit\n+\t */\n+\tuint16_t *index;\n+\t/**\n+\t * [out] Reference count incremented if hit\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * Shadow table insert parameters\n+ */\n+struct tf_shadow_tbl_insert_parms {\n+\t/**\n+\t * [in] Shadow table DB handle\n+\t */\n+\tvoid *tf_shadow_tbl_db;\n+\t/**\n+\t * [in] Tbl type\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Pointer to entry blob value in remap table to match\n+\t */\n+\tuint8_t *entry;\n+\t/**\n+\t * [in] Size of the entry blob passed in bytes\n+\t */\n+\tuint16_t entry_sz;\n+\t/**\n+\t * [in] Entry to update\n+\t */\n+\tuint16_t index;\n+\t/**\n+\t * [out] Reference count after insert\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * Shadow table remove parameters\n+ */\n+struct tf_shadow_tbl_remove_parms {\n+\t/**\n+\t * [in] Shadow table DB handle\n+\t */\n+\tvoid *tf_shadow_tbl_db;\n+\t/**\n+\t * [in] Tbl type\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Entry to update\n+\t */\n+\tuint16_t index;\n+\t/**\n+\t * [out] Reference count after removal\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * @page shadow_tbl Shadow table DB\n+ *\n+ * @ref tf_shadow_tbl_create_db\n+ *\n+ * @ref tf_shadow_tbl_free_db\n+ *\n+ * @reg tf_shadow_tbl_search\n+ *\n+ * @reg tf_shadow_tbl_insert\n+ *\n+ * @reg tf_shadow_tbl_remove\n+ */\n+\n+/**\n+ * Creates and fills a Shadow table DB. The DB is indexed per the\n+ * parms structure.\n+ *\n+ * [in] parms\n+ *   Pointer to create db parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tbl_create_db(struct tf_shadow_tbl_create_db_parms *parms);\n+\n+/**\n+ * Closes the Shadow table DB and frees all allocated\n+ * resources per the associated database.\n+ *\n+ * [in] parms\n+ *   Pointer to the free DB parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tbl_free_db(struct tf_shadow_tbl_free_db_parms *parms);\n+\n+/**\n+ * Search Shadow table db for matching result\n+ *\n+ * [in] parms\n+ *   Pointer to the search parameters\n+ *\n+ * Returns\n+ *   - (0) if successful, element was found.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tbl_search(struct tf_shadow_tbl_search_parms *parms);\n+\n+/**\n+ * Inserts an element into the Shadow table DB. Will fail if the\n+ * elements ref_count is different from 0. Ref_count after insert will\n+ * be incremented.\n+ *\n+ * [in] parms\n+ *   Pointer to insert parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tbl_insert(struct tf_shadow_tbl_insert_parms *parms);\n+\n+/**\n+ * Removes an element from the Shadow table DB. Will fail if the\n+ * elements ref_count is 0. Ref_count after removal will be\n+ * decremented.\n+ *\n+ * [in] parms\n+ *   Pointer to remove parameter\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tbl_remove(struct tf_shadow_tbl_remove_parms *parms);\n+\n+#endif /* _TF_SHADOW_TBL_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_shadow_tcam.c b/drivers/net/bnxt/tf_core/tf_shadow_tcam.c\nnew file mode 100644\nindex 000000000..c61b833d7\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_shadow_tcam.c\n@@ -0,0 +1,63 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_shadow_tcam.h\"\n+\n+/**\n+ * Shadow tcam DB element\n+ */\n+struct tf_shadow_tcam_element {\n+\t/**\n+\t * Hash table\n+\t */\n+\tvoid *hash;\n+\n+\t/**\n+\t * Reference count, array of number of tcam entries\n+\t */\n+\tuint16_t *ref_count;\n+};\n+\n+/**\n+ * Shadow tcam DB definition\n+ */\n+struct tf_shadow_tcam_db {\n+\t/**\n+\t * The DB consists of an array of elements\n+\t */\n+\tstruct tf_shadow_tcam_element *db;\n+};\n+\n+int\n+tf_shadow_tcam_create_db(struct tf_shadow_tcam_create_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tcam_free_db(struct tf_shadow_tcam_free_db_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tcam_insert(struct tf_shadow_tcam_insert_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_shadow_tcam_remove(struct tf_shadow_tcam_remove_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_shadow_tcam.h b/drivers/net/bnxt/tf_core/tf_shadow_tcam.h\nnew file mode 100644\nindex 000000000..e2c4e06c0\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_shadow_tcam.h\n@@ -0,0 +1,239 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_SHADOW_TCAM_H_\n+#define _TF_SHADOW_TCAM_H_\n+\n+#include \"tf_core.h\"\n+\n+struct tf;\n+\n+/**\n+ * The Shadow tcam module provides shadow DB handling for tcam based\n+ * TF types. A shadow DB provides the capability that allows for reuse\n+ * of TF resources.\n+ *\n+ * A Shadow tcam DB is intended to be used by the Tcam module only.\n+ */\n+\n+/**\n+ * Shadow DB configuration information for a single tcam type.\n+ *\n+ * During Device initialization the HCAPI device specifics are learned\n+ * and as well as the RM DB creation. From that those initial steps\n+ * this structure can be populated.\n+ *\n+ * NOTE:\n+ * If used in an array of tcam types then such array must be ordered\n+ * by the TF type is represents.\n+ */\n+struct tf_shadow_tcam_cfg_parms {\n+\t/**\n+\t * TF tcam type\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\n+\t/**\n+\t * Number of entries the Shadow DB needs to hold\n+\t */\n+\tint num_entries;\n+\n+\t/**\n+\t * Element width for this table type\n+\t */\n+\tint element_width;\n+};\n+\n+/**\n+ * Shadow tcam DB creation parameters\n+ */\n+struct tf_shadow_tcam_create_db_parms {\n+\t/**\n+\t * [in] Configuration information for the shadow db\n+\t */\n+\tstruct tf_shadow_tcam_cfg_parms *cfg;\n+\t/**\n+\t * [in] Number of elements in the parms structure\n+\t */\n+\tuint16_t num_elements;\n+\t/**\n+\t * [out] Shadow tcam DB handle\n+\t */\n+\tvoid *tf_shadow_tcam_db;\n+};\n+\n+/**\n+ * Shadow tcam DB free parameters\n+ */\n+struct tf_shadow_tcam_free_db_parms {\n+\t/**\n+\t * Shadow tcam DB handle\n+\t */\n+\tvoid *tf_shadow_tcam_db;\n+};\n+\n+/**\n+ * Shadow tcam search parameters\n+ */\n+struct tf_shadow_tcam_search_parms {\n+\t/**\n+\t * [in] Shadow tcam DB handle\n+\t */\n+\tvoid *tf_shadow_tcam_db;\n+\t/**\n+\t * [in] TCAM tbl type\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [in] Pointer to entry blob value in remap table to match\n+\t */\n+\tuint8_t *entry;\n+\t/**\n+\t * [in] Size of the entry blob passed in bytes\n+\t */\n+\tuint16_t entry_sz;\n+\t/**\n+\t * [out] Index of the found element returned if hit\n+\t */\n+\tuint16_t *index;\n+\t/**\n+\t * [out] Reference count incremented if hit\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * Shadow tcam insert parameters\n+ */\n+struct tf_shadow_tcam_insert_parms {\n+\t/**\n+\t * [in] Shadow tcam DB handle\n+\t */\n+\tvoid *tf_shadow_tcam_db;\n+\t/**\n+\t * [in] TCAM tbl type\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [in] Pointer to entry blob value in remap table to match\n+\t */\n+\tuint8_t *entry;\n+\t/**\n+\t * [in] Size of the entry blob passed in bytes\n+\t */\n+\tuint16_t entry_sz;\n+\t/**\n+\t * [in] Entry to update\n+\t */\n+\tuint16_t index;\n+\t/**\n+\t * [out] Reference count after insert\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * Shadow tcam remove parameters\n+ */\n+struct tf_shadow_tcam_remove_parms {\n+\t/**\n+\t * [in] Shadow tcam DB handle\n+\t */\n+\tvoid *tf_shadow_tcam_db;\n+\t/**\n+\t * [in] TCAM tbl type\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [in] Entry to update\n+\t */\n+\tuint16_t index;\n+\t/**\n+\t * [out] Reference count after removal\n+\t */\n+\tuint16_t *ref_cnt;\n+};\n+\n+/**\n+ * @page shadow_tcam Shadow tcam DB\n+ *\n+ * @ref tf_shadow_tcam_create_db\n+ *\n+ * @ref tf_shadow_tcam_free_db\n+ *\n+ * @reg tf_shadow_tcam_search\n+ *\n+ * @reg tf_shadow_tcam_insert\n+ *\n+ * @reg tf_shadow_tcam_remove\n+ */\n+\n+/**\n+ * Creates and fills a Shadow tcam DB. The DB is indexed per the\n+ * parms structure.\n+ *\n+ * [in] parms\n+ *   Pointer to create db parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tcam_create_db(struct tf_shadow_tcam_create_db_parms *parms);\n+\n+/**\n+ * Closes the Shadow tcam DB and frees all allocated\n+ * resources per the associated database.\n+ *\n+ * [in] parms\n+ *   Pointer to the free DB parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tcam_free_db(struct tf_shadow_tcam_free_db_parms *parms);\n+\n+/**\n+ * Search Shadow tcam db for matching result\n+ *\n+ * [in] parms\n+ *   Pointer to the search parameters\n+ *\n+ * Returns\n+ *   - (0) if successful, element was found.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tcam_search(struct tf_shadow_tcam_search_parms *parms);\n+\n+/**\n+ * Inserts an element into the Shadow tcam DB. Will fail if the\n+ * elements ref_count is different from 0. Ref_count after insert will\n+ * be incremented.\n+ *\n+ * [in] parms\n+ *   Pointer to insert parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tcam_insert(struct tf_shadow_tcam_insert_parms *parms);\n+\n+/**\n+ * Removes an element from the Shadow tcam DB. Will fail if the\n+ * elements ref_count is 0. Ref_count after removal will be\n+ * decremented.\n+ *\n+ * [in] parms\n+ *   Pointer to remove parameter\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_shadow_tcam_remove(struct tf_shadow_tcam_remove_parms *parms);\n+\n+#endif /* _TF_SHADOW_TCAM_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c\nindex dda72c3d5..17399a5b2 100644\n--- a/drivers/net/bnxt/tf_core/tf_tbl.c\n+++ b/drivers/net/bnxt/tf_core/tf_tbl.c\n@@ -15,6 +15,7 @@\n #include \"hsi_struct_def_dpdk.h\"\n \n #include \"tf_core.h\"\n+#include \"tf_util.h\"\n #include \"tf_em.h\"\n #include \"tf_msg.h\"\n #include \"tfp.h\"\ndiff --git a/drivers/net/bnxt/tf_core/tf_tbl_type.c b/drivers/net/bnxt/tf_core/tf_tbl_type.c\nnew file mode 100644\nindex 000000000..a57a5ddf2\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_tbl_type.c\n@@ -0,0 +1,78 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_tbl_type.h\"\n+\n+struct tf;\n+\n+/**\n+ * Table Type DBs.\n+ */\n+/* static void *tbl_db[TF_DIR_MAX]; */\n+\n+/**\n+ * Table Type Shadow DBs\n+ */\n+/* static void *shadow_tbl_db[TF_DIR_MAX]; */\n+\n+/**\n+ * Init flag, set on bind and cleared on unbind\n+ */\n+/* static uint8_t init; */\n+\n+/**\n+ * Shadow init flag, set on bind and cleared on unbind\n+ */\n+/* static uint8_t shadow_init; */\n+\n+int\n+tf_tbl_type_bind(struct tf *tfp __rte_unused,\n+\t\t struct tf_tbl_type_cfg_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_unbind(struct tf *tfp __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_alloc(struct tf *tfp __rte_unused,\n+\t\t  struct tf_tbl_type_alloc_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_free(struct tf *tfp __rte_unused,\n+\t\t struct tf_tbl_type_free_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_alloc_search(struct tf *tfp __rte_unused,\n+\t\t\t struct tf_tbl_type_alloc_search_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_set(struct tf *tfp __rte_unused,\n+\t\tstruct tf_tbl_type_set_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tbl_type_get(struct tf *tfp __rte_unused,\n+\t\tstruct tf_tbl_type_get_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_tbl_type.h b/drivers/net/bnxt/tf_core/tf_tbl_type.h\nnew file mode 100644\nindex 000000000..c880b368b\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_tbl_type.h\n@@ -0,0 +1,309 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef TF_TBL_TYPE_H_\n+#define TF_TBL_TYPE_H_\n+\n+#include \"tf_core.h\"\n+\n+struct tf;\n+\n+/**\n+ * The Table Type module provides processing of Internal TF table types.\n+ */\n+\n+/**\n+ * Table Type configuration parameters\n+ */\n+struct tf_tbl_type_cfg_parms {\n+\t/**\n+\t * Number of table types in each of the configuration arrays\n+\t */\n+\tuint16_t num_elements;\n+\n+\t/**\n+\t * Table Type element configuration array\n+\t */\n+\tstruct tf_rm_element_cfg *tbl_cfg[TF_DIR_MAX];\n+\n+\t/**\n+\t * Shadow table type configuration array\n+\t */\n+\tstruct tf_shadow_tbl_type_cfg *tbl_shadow_cfg[TF_DIR_MAX];\n+};\n+\n+/**\n+ * Table Type allocation parameters\n+ */\n+struct tf_tbl_type_alloc_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of the allocation\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [out] Idx of allocated entry or found entry (if search_enable)\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * Table Type free parameters\n+ */\n+struct tf_tbl_type_free_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of the allocation type\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Index to free\n+\t */\n+\tuint32_t idx;\n+\t/**\n+\t * [out] Reference count after free, only valid if session has been\n+\t * created with shadow_copy.\n+\t */\n+\tuint16_t ref_cnt;\n+};\n+\n+struct tf_tbl_type_alloc_search_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of the allocation\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)\n+\t */\n+\tuint32_t tbl_scope_id;\n+\t/**\n+\t * [in] Enable search for matching entry. If the table type is\n+\t * internal the shadow copy will be searched before\n+\t * alloc. Session must be configured with shadow copy enabled.\n+\t */\n+\tuint8_t search_enable;\n+\t/**\n+\t * [in] Result data to search for (if search_enable)\n+\t */\n+\tuint8_t *result;\n+\t/**\n+\t * [in] Result data size in bytes (if search_enable)\n+\t */\n+\tuint16_t result_sz_in_bytes;\n+\t/**\n+\t * [out] If search_enable, set if matching entry found\n+\t */\n+\tuint8_t hit;\n+\t/**\n+\t * [out] Current ref count after allocation (if search_enable)\n+\t */\n+\tuint16_t ref_cnt;\n+\t/**\n+\t * [out] Idx of allocated entry or found entry (if search_enable)\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * Table Type set parameters\n+ */\n+struct tf_tbl_type_set_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of object to set\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [in] Entry data\n+\t */\n+\tuint8_t *data;\n+\t/**\n+\t * [in] Entry size\n+\t */\n+\tuint16_t data_sz_in_bytes;\n+\t/**\n+\t * [in] Entry index to write to\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * Table Type get parameters\n+ */\n+struct tf_tbl_type_get_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of object to get\n+\t */\n+\tenum tf_tbl_type type;\n+\t/**\n+\t * [out] Entry data\n+\t */\n+\tuint8_t *data;\n+\t/**\n+\t * [out] Entry size\n+\t */\n+\tuint16_t data_sz_in_bytes;\n+\t/**\n+\t * [in] Entry index to read\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * @page tbl_type Table Type\n+ *\n+ * @ref tf_tbl_type_bind\n+ *\n+ * @ref tf_tbl_type_unbind\n+ *\n+ * @ref tf_tbl_type_alloc\n+ *\n+ * @ref tf_tbl_type_free\n+ *\n+ * @ref tf_tbl_type_alloc_search\n+ *\n+ * @ref tf_tbl_type_set\n+ *\n+ * @ref tf_tbl_type_get\n+ */\n+\n+/**\n+ * Initializes the Table Type module with the requested DBs. Must be\n+ * invoked as the first thing before any of the access functions.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_bind(struct tf *tfp,\n+\t\t     struct tf_tbl_type_cfg_parms *parms);\n+\n+/**\n+ * Cleans up the private DBs and releases all the data.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_unbind(struct tf *tfp);\n+\n+/**\n+ * Allocates the requested table type from the internal RM DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_alloc(struct tf *tfp,\n+\t\t      struct tf_tbl_type_alloc_parms *parms);\n+\n+/**\n+ * Free's the requested table type and returns it to the DB. If shadow\n+ * DB is enabled its searched first and if found the element refcount\n+ * is decremented. If refcount goes to 0 then its returned to the\n+ * table type DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_free(struct tf *tfp,\n+\t\t     struct tf_tbl_type_free_parms *parms);\n+\n+/**\n+ * Supported if Shadow DB is configured. Searches the Shadow DB for\n+ * any matching element. If found the refcount in the shadow DB is\n+ * updated accordingly. If not found a new element is allocated and\n+ * installed into the shadow DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_alloc_search(struct tf *tfp,\n+\t\t\t     struct tf_tbl_type_alloc_search_parms *parms);\n+\n+/**\n+ * Configures the requested element by sending a firmware request which\n+ * then installs it into the device internal structures.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_set(struct tf *tfp,\n+\t\t    struct tf_tbl_type_set_parms *parms);\n+\n+/**\n+ * Retrieves the requested element by sending a firmware request to get\n+ * the element.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tbl_type_get(struct tf *tfp,\n+\t\t    struct tf_tbl_type_get_parms *parms);\n+\n+#endif /* TF_TBL_TYPE_H */\ndiff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c\nnew file mode 100644\nindex 000000000..3ad99dd0d\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_tcam.c\n@@ -0,0 +1,78 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <rte_common.h>\n+\n+#include \"tf_tcam.h\"\n+\n+struct tf;\n+\n+/**\n+ * TCAM DBs.\n+ */\n+/* static void *tcam_db[TF_DIR_MAX]; */\n+\n+/**\n+ * TCAM Shadow DBs\n+ */\n+/* static void *shadow_tcam_db[TF_DIR_MAX]; */\n+\n+/**\n+ * Init flag, set on bind and cleared on unbind\n+ */\n+/* static uint8_t init; */\n+\n+/**\n+ * Shadow init flag, set on bind and cleared on unbind\n+ */\n+/* static uint8_t shadow_init; */\n+\n+int\n+tf_tcam_bind(struct tf *tfp __rte_unused,\n+\t     struct tf_tcam_cfg_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_unbind(struct tf *tfp __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_alloc(struct tf *tfp __rte_unused,\n+\t      struct tf_tcam_alloc_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_free(struct tf *tfp __rte_unused,\n+\t     struct tf_tcam_free_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_alloc_search(struct tf *tfp __rte_unused,\n+\t\t     struct tf_tcam_alloc_search_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_set(struct tf *tfp __rte_unused,\n+\t    struct tf_tcam_set_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\n+\n+int\n+tf_tcam_get(struct tf *tfp __rte_unused,\n+\t    struct tf_tcam_get_parms *parms __rte_unused)\n+{\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_tcam.h b/drivers/net/bnxt/tf_core/tf_tcam.h\nnew file mode 100644\nindex 000000000..1420c9ed5\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_tcam.h\n@@ -0,0 +1,314 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_TCAM_H_\n+#define _TF_TCAM_H_\n+\n+#include \"tf_core.h\"\n+\n+/**\n+ * The TCAM module provides processing of Internal TCAM types.\n+ */\n+\n+/**\n+ * TCAM configuration parameters\n+ */\n+struct tf_tcam_cfg_parms {\n+\t/**\n+\t * Number of tcam types in each of the configuration arrays\n+\t */\n+\tuint16_t num_elements;\n+\n+\t/**\n+\t * TCAM configuration array\n+\t */\n+\tstruct tf_rm_element_cfg *tcam_cfg[TF_DIR_MAX];\n+\n+\t/**\n+\t * Shadow table type configuration array\n+\t */\n+\tstruct tf_shadow_tcam_cfg *tcam_shadow_cfg[TF_DIR_MAX];\n+};\n+\n+/**\n+ * TCAM allocation parameters\n+ */\n+struct tf_tcam_alloc_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of the allocation\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [out] Idx of allocated entry or found entry (if search_enable)\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * TCAM free parameters\n+ */\n+struct tf_tcam_free_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of the allocation type\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [in] Index to free\n+\t */\n+\tuint32_t idx;\n+\t/**\n+\t * [out] Reference count after free, only valid if session has been\n+\t * created with shadow_copy.\n+\t */\n+\tuint16_t ref_cnt;\n+};\n+\n+/**\n+ * TCAM allocate search parameters\n+ */\n+struct tf_tcam_alloc_search_parms {\n+\t/**\n+\t * [in] receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] TCAM table type\n+\t */\n+\tenum tf_tcam_tbl_type tcam_tbl_type;\n+\t/**\n+\t * [in] Enable search for matching entry\n+\t */\n+\tuint8_t search_enable;\n+\t/**\n+\t * [in] Key data to match on (if search)\n+\t */\n+\tuint8_t *key;\n+\t/**\n+\t * [in] key size in bits (if search)\n+\t */\n+\tuint16_t key_sz_in_bits;\n+\t/**\n+\t * [in] Mask data to match on (if search)\n+\t */\n+\tuint8_t *mask;\n+\t/**\n+\t * [in] Priority of entry requested (definition TBD)\n+\t */\n+\tuint32_t priority;\n+\t/**\n+\t * [out] If search, set if matching entry found\n+\t */\n+\tuint8_t hit;\n+\t/**\n+\t * [out] Current refcnt after allocation\n+\t */\n+\tuint16_t ref_cnt;\n+\t/**\n+\t * [out] Idx allocated\n+\t *\n+\t */\n+\tuint16_t idx;\n+};\n+\n+/**\n+ * TCAM set parameters\n+ */\n+struct tf_tcam_set_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of object to set\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [in] Entry data\n+\t */\n+\tuint8_t *data;\n+\t/**\n+\t * [in] Entry size\n+\t */\n+\tuint16_t data_sz_in_bytes;\n+\t/**\n+\t * [in] Entry index to write to\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * TCAM get parameters\n+ */\n+struct tf_tcam_get_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of object to get\n+\t */\n+\tenum tf_tcam_tbl_type type;\n+\t/**\n+\t * [out] Entry data\n+\t */\n+\tuint8_t *data;\n+\t/**\n+\t * [out] Entry size\n+\t */\n+\tuint16_t data_sz_in_bytes;\n+\t/**\n+\t * [in] Entry index to read\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * @page tcam TCAM\n+ *\n+ * @ref tf_tcam_bind\n+ *\n+ * @ref tf_tcam_unbind\n+ *\n+ * @ref tf_tcam_alloc\n+ *\n+ * @ref tf_tcam_free\n+ *\n+ * @ref tf_tcam_alloc_search\n+ *\n+ * @ref tf_tcam_set\n+ *\n+ * @ref tf_tcam_get\n+ *\n+ */\n+\n+/**\n+ * Initializes the TCAM module with the requested DBs. Must be\n+ * invoked as the first thing before any of the access functions.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_bind(struct tf *tfp,\n+\t\t struct tf_tcam_cfg_parms *parms);\n+\n+/**\n+ * Cleans up the private DBs and releases all the data.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_unbind(struct tf *tfp);\n+\n+/**\n+ * Allocates the requested tcam type from the internal RM DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_alloc(struct tf *tfp,\n+\t\t  struct tf_tcam_alloc_parms *parms);\n+\n+/**\n+ * Free's the requested table type and returns it to the DB. If shadow\n+ * DB is enabled its searched first and if found the element refcount\n+ * is decremented. If refcount goes to 0 then its returned to the\n+ * table type DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_free(struct tf *tfp,\n+\t\t struct tf_tcam_free_parms *parms);\n+\n+/**\n+ * Supported if Shadow DB is configured. Searches the Shadow DB for\n+ * any matching element. If found the refcount in the shadow DB is\n+ * updated accordingly. If not found a new element is allocated and\n+ * installed into the shadow DB.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_alloc_search(struct tf *tfp,\n+\t\t\t struct tf_tcam_alloc_search_parms *parms);\n+\n+/**\n+ * Configures the requested element by sending a firmware request which\n+ * then installs it into the device internal structures.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_set(struct tf *tfp,\n+\t\tstruct tf_tcam_set_parms *parms);\n+\n+/**\n+ * Retrieves the requested element by sending a firmware request to get\n+ * the element.\n+ *\n+ * [in] tfp\n+ *   Pointer to TF handle, used for HCAPI communication\n+ *\n+ * [in] parms\n+ *   Pointer to parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_tcam_get(struct tf *tfp,\n+\t\tstruct tf_tcam_get_parms *parms);\n+\n+#endif /* _TF_TCAM_H */\ndiff --git a/drivers/net/bnxt/tf_core/tf_util.c b/drivers/net/bnxt/tf_core/tf_util.c\nnew file mode 100644\nindex 000000000..a9010543d\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_util.c\n@@ -0,0 +1,145 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2014-2019 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include <string.h>\n+\n+#include \"tf_util.h\"\n+\n+const char\n+*tf_dir_2_str(enum tf_dir dir)\n+{\n+\tswitch (dir) {\n+\tcase TF_DIR_RX:\n+\t\treturn \"RX\";\n+\tcase TF_DIR_TX:\n+\t\treturn \"TX\";\n+\tdefault:\n+\t\treturn \"Invalid direction\";\n+\t}\n+}\n+\n+const char\n+*tf_ident_2_str(enum tf_identifier_type id_type)\n+{\n+\tswitch (id_type) {\n+\tcase TF_IDENT_TYPE_L2_CTXT:\n+\t\treturn \"l2_ctxt_remap\";\n+\tcase TF_IDENT_TYPE_PROF_FUNC:\n+\t\treturn \"prof_func\";\n+\tcase TF_IDENT_TYPE_WC_PROF:\n+\t\treturn \"wc_prof\";\n+\tcase TF_IDENT_TYPE_EM_PROF:\n+\t\treturn \"em_prof\";\n+\tcase TF_IDENT_TYPE_L2_FUNC:\n+\t\treturn \"l2_func\";\n+\tdefault:\n+\t\treturn \"Invalid identifier\";\n+\t}\n+}\n+\n+const char\n+*tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type)\n+{\n+\tswitch (tcam_type) {\n+\tcase TF_TCAM_TBL_TYPE_L2_CTXT_TCAM:\n+\t\treturn \"l2_ctxt_tcam\";\n+\tcase TF_TCAM_TBL_TYPE_PROF_TCAM:\n+\t\treturn \"prof_tcam\";\n+\tcase TF_TCAM_TBL_TYPE_WC_TCAM:\n+\t\treturn \"wc_tcam\";\n+\tcase TF_TCAM_TBL_TYPE_VEB_TCAM:\n+\t\treturn \"veb_tcam\";\n+\tcase TF_TCAM_TBL_TYPE_SP_TCAM:\n+\t\treturn \"sp_tcam\";\n+\tcase TF_TCAM_TBL_TYPE_CT_RULE_TCAM:\n+\t\treturn \"ct_rule_tcam\";\n+\tdefault:\n+\t\treturn \"Invalid tcam table type\";\n+\t}\n+}\n+\n+const char\n+*tf_tbl_type_2_str(enum tf_tbl_type tbl_type)\n+{\n+\tswitch (tbl_type) {\n+\tcase TF_TBL_TYPE_FULL_ACT_RECORD:\n+\t\treturn \"Full Action record\";\n+\tcase TF_TBL_TYPE_MCAST_GROUPS:\n+\t\treturn \"Multicast Groups\";\n+\tcase TF_TBL_TYPE_ACT_ENCAP_8B:\n+\t\treturn \"Encap 8B\";\n+\tcase TF_TBL_TYPE_ACT_ENCAP_16B:\n+\t\treturn \"Encap 16B\";\n+\tcase TF_TBL_TYPE_ACT_ENCAP_32B:\n+\t\treturn \"Encap 32B\";\n+\tcase TF_TBL_TYPE_ACT_ENCAP_64B:\n+\t\treturn \"Encap 64B\";\n+\tcase TF_TBL_TYPE_ACT_SP_SMAC:\n+\t\treturn \"Source Properties SMAC\";\n+\tcase TF_TBL_TYPE_ACT_SP_SMAC_IPV4:\n+\t\treturn \"Source Properties SMAC IPv4\";\n+\tcase TF_TBL_TYPE_ACT_SP_SMAC_IPV6:\n+\t\treturn \"Source Properties SMAC IPv6\";\n+\tcase TF_TBL_TYPE_ACT_STATS_64:\n+\t\treturn \"Stats 64B\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_SPORT:\n+\t\treturn \"NAT Source Port\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_DPORT:\n+\t\treturn \"NAT Destination Port\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_IPV4_SRC:\n+\t\treturn \"NAT IPv4 Source\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_IPV4_DEST:\n+\t\treturn \"NAT IPv4 Destination\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC:\n+\t\treturn \"NAT IPv6 Source\";\n+\tcase TF_TBL_TYPE_ACT_MODIFY_IPV6_DEST:\n+\t\treturn \"NAT IPv6 Destination\";\n+\tcase TF_TBL_TYPE_METER_PROF:\n+\t\treturn \"Meter Profile\";\n+\tcase TF_TBL_TYPE_METER_INST:\n+\t\treturn \"Meter\";\n+\tcase TF_TBL_TYPE_MIRROR_CONFIG:\n+\t\treturn \"Mirror\";\n+\tcase TF_TBL_TYPE_UPAR:\n+\t\treturn \"UPAR\";\n+\tcase TF_TBL_TYPE_EPOCH0:\n+\t\treturn \"EPOCH0\";\n+\tcase TF_TBL_TYPE_EPOCH1:\n+\t\treturn \"EPOCH1\";\n+\tcase TF_TBL_TYPE_METADATA:\n+\t\treturn \"Metadata\";\n+\tcase TF_TBL_TYPE_CT_STATE:\n+\t\treturn \"Connection State\";\n+\tcase TF_TBL_TYPE_RANGE_PROF:\n+\t\treturn \"Range Profile\";\n+\tcase TF_TBL_TYPE_RANGE_ENTRY:\n+\t\treturn \"Range\";\n+\tcase TF_TBL_TYPE_LAG:\n+\t\treturn \"Link Aggregation\";\n+\tcase TF_TBL_TYPE_VNIC_SVIF:\n+\t\treturn \"VNIC SVIF\";\n+\tcase TF_TBL_TYPE_EM_FKB:\n+\t\treturn \"EM Flexible Key Builder\";\n+\tcase TF_TBL_TYPE_WC_FKB:\n+\t\treturn \"WC Flexible Key Builder\";\n+\tcase TF_TBL_TYPE_EXT:\n+\t\treturn \"External\";\n+\tdefault:\n+\t\treturn \"Invalid tbl type\";\n+\t}\n+}\n+\n+const char\n+*tf_em_tbl_type_2_str(enum tf_em_tbl_type em_type)\n+{\n+\tswitch (em_type) {\n+\tcase TF_EM_TBL_TYPE_EM_RECORD:\n+\t\treturn \"EM Record\";\n+\tcase TF_EM_TBL_TYPE_TBL_SCOPE:\n+\t\treturn \"Table Scope\";\n+\tdefault:\n+\t\treturn \"Invalid EM type\";\n+\t}\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_util.h b/drivers/net/bnxt/tf_core/tf_util.h\nnew file mode 100644\nindex 000000000..4099629ea\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_util.h\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2014-2019 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef _TF_UTIL_H_\n+#define _TF_UTIL_H_\n+\n+#include \"tf_core.h\"\n+\n+/**\n+ * Helper function converting direction to text string\n+ */\n+const char\n+*tf_dir_2_str(enum tf_dir dir);\n+\n+/**\n+ * Helper function converting identifier to text string\n+ */\n+const char\n+*tf_ident_2_str(enum tf_identifier_type id_type);\n+\n+/**\n+ * Helper function converting tcam type to text string\n+ */\n+const char\n+*tf_tcam_tbl_2_str(enum tf_tcam_tbl_type tcam_type);\n+\n+/**\n+ * Helper function converting tbl type to text string\n+ */\n+const char\n+*tf_tbl_type_2_str(enum tf_tbl_type tbl_type);\n+\n+/**\n+ * Helper function converting em tbl type to text string\n+ */\n+const char\n+*tf_em_tbl_type_2_str(enum tf_em_tbl_type em_type);\n+\n+#endif /* _TF_UTIL_H_ */\n",
    "prefixes": [
        "v5",
        "11/51"
    ]
}