get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 72549,
    "url": "https://patches.dpdk.org/api/patches/72549/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200701065212.41391-29-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": "<20200701065212.41391-29-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200701065212.41391-29-ajit.khaparde@broadcom.com",
    "date": "2020-07-01T06:51:49",
    "name": "[v2,28/51] net/bnxt: implement IF tables set and get",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "9f92c79d70fd418e33387379fc19c2f86fe37cc8",
    "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/20200701065212.41391-29-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10703,
            "url": "https://patches.dpdk.org/api/series/10703/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10703",
            "date": "2020-07-01T06:51:22",
            "name": "add features for host-based flow management",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/10703/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/72549/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/72549/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 00EEFA0523;\n\tWed,  1 Jul 2020 08:58:42 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DC2D01D405;\n\tWed,  1 Jul 2020 08:52:56 +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 B78A21C139\n for <dev@dpdk.org>; Wed,  1 Jul 2020 08:52:26 +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 0202930C336;\n Tue, 30 Jun 2020 23:52:26 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id B27E714008B;\n Tue, 30 Jun 2020 23:52:25 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 0202930C336",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1593586346;\n bh=PW9vVwxdnIDV3G04UJQeuRuKZd7K+0e5MCBsGfUZKQk=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=YuWMW4qCFgwtaYQjxd5PujnBE2q3WwQDWWzPAWcFFMDwH9tsYn0juK5ela/j3YBx7\n yHcAYwtAI0FCkG1tIDo/SvK6qlw0bhQbIulrq7n7tsfr9qYK+hRqSyeN0kipCs2uyD\n 90gjwScaELTIYWJMe5T+iCqlJR8kBsJq5B0yFPGg=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jay Ding <jay.ding@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>,\n Randy Schacher <stuart.schacher@broadcom.com>",
        "Date": "Tue, 30 Jun 2020 23:51:49 -0700",
        "Message-Id": "<20200701065212.41391-29-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20200701065212.41391-1-ajit.khaparde@broadcom.com>",
        "References": "<20200612132934.16488-1-somnath.kotur@broadcom.com>\n <20200701065212.41391-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 28/51] net/bnxt: implement IF tables set and\n\tget",
        "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: Jay Ding <jay.ding@broadcom.com>\n\n- Implement set/get for PROF_SPIF_CTXT, LKUP_PF_DFLT_ARP,\n  PROF_PF_ERR_ARP with tunneled HWRM messages\n- Add IF table for PROF_PARIF_DFLT_ARP\n- Fix page size offset in the HCAPI code\n- Fix Entry offset calculation\n\nSigned-off-by: Jay Ding <jay.ding@broadcom.com>\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/hcapi/cfa_p40_tbl.h     |  53 +++++\n drivers/net/bnxt/hcapi/hcapi_cfa_defs.h  |  12 +-\n drivers/net/bnxt/hcapi/hcapi_cfa_p4.c    |   8 +-\n drivers/net/bnxt/hcapi/hcapi_cfa_p4.h    |  18 +-\n drivers/net/bnxt/meson.build             |   2 +-\n drivers/net/bnxt/tf_core/Makefile        |   2 +\n drivers/net/bnxt/tf_core/hwrm_tf.h       |  63 +++++-\n drivers/net/bnxt/tf_core/tf_core.c       | 116 +++++++++++\n drivers/net/bnxt/tf_core/tf_core.h       | 104 ++++++++++\n drivers/net/bnxt/tf_core/tf_device.c     |  21 ++\n drivers/net/bnxt/tf_core/tf_device.h     |  39 ++++\n drivers/net/bnxt/tf_core/tf_device_p4.c  |   5 +\n drivers/net/bnxt/tf_core/tf_device_p4.h  |  10 +\n drivers/net/bnxt/tf_core/tf_em_common.c  |   5 +-\n drivers/net/bnxt/tf_core/tf_em_host.c    |  12 +-\n drivers/net/bnxt/tf_core/tf_identifier.c |   3 +-\n drivers/net/bnxt/tf_core/tf_if_tbl.c     | 178 +++++++++++++++++\n drivers/net/bnxt/tf_core/tf_if_tbl.h     | 236 +++++++++++++++++++++++\n drivers/net/bnxt/tf_core/tf_msg.c        | 186 +++++++++++++++---\n drivers/net/bnxt/tf_core/tf_msg.h        |  30 +++\n drivers/net/bnxt/tf_core/tf_session.c    |  14 +-\n 21 files changed, 1060 insertions(+), 57 deletions(-)\n create mode 100644 drivers/net/bnxt/tf_core/tf_if_tbl.c\n create mode 100644 drivers/net/bnxt/tf_core/tf_if_tbl.h",
    "diff": "diff --git a/drivers/net/bnxt/hcapi/cfa_p40_tbl.h b/drivers/net/bnxt/hcapi/cfa_p40_tbl.h\nindex c30e4f49c..3243b3f2b 100644\n--- a/drivers/net/bnxt/hcapi/cfa_p40_tbl.h\n+++ b/drivers/net/bnxt/hcapi/cfa_p40_tbl.h\n@@ -127,6 +127,11 @@ const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_remap_mem_layout[] = {\n \t CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_PROFILE_ID_NUM_BITS},\n \t{CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_BITPOS,\n \t CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_TCAM_KEY_ID_NUM_BITS},\n+\t/* Fields below not generated through automation */\n+\t{CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_BYPASS_OPT_BITPOS,\n+\t CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_BYPASS_OPT_NUM_BITS},\n+\t{CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_ACT_REC_PTR_BITPOS,\n+\t CFA_P40_PROF_PROFILE_TCAM_REMAP_MEM_ACT_REC_PTR_NUM_BITS},\n };\n \n const struct hcapi_cfa_field cfa_p40_prof_profile_tcam_layout[] = {\n@@ -247,4 +252,52 @@ const struct hcapi_cfa_field cfa_p40_eem_key_tbl_layout[] = {\n \t CFA_P40_EEM_KEY_TBL_AR_PTR_NUM_BITS},\n \n };\n+\n+const struct hcapi_cfa_field cfa_p40_mirror_tbl_layout[] = {\n+\t{CFA_P40_MIRROR_TBL_SP_PTR_BITPOS,\n+\t CFA_P40_MIRROR_TBL_SP_PTR_NUM_BITS},\n+\n+\t{CFA_P40_MIRROR_TBL_IGN_DROP_BITPOS,\n+\t CFA_P40_MIRROR_TBL_IGN_DROP_NUM_BITS},\n+\n+\t{CFA_P40_MIRROR_TBL_COPY_BITPOS,\n+\t CFA_P40_MIRROR_TBL_COPY_NUM_BITS},\n+\n+\t{CFA_P40_MIRROR_TBL_EN_BITPOS,\n+\t CFA_P40_MIRROR_TBL_EN_NUM_BITS},\n+\n+\t{CFA_P40_MIRROR_TBL_AR_PTR_BITPOS,\n+\t CFA_P40_MIRROR_TBL_AR_PTR_NUM_BITS},\n+};\n+\n+/* P45 Defines */\n+\n+const struct hcapi_cfa_field cfa_p45_prof_l2_ctxt_tcam_layout[] = {\n+\t{CFA_P45_PROF_L2_CTXT_TCAM_VALID_BITPOS,\n+\t CFA_P45_PROF_L2_CTXT_TCAM_VALID_NUM_BITS},\n+\t{CFA_P45_PROF_L2_CTXT_TCAM_SPARIF_BITPOS,\n+\t CFA_P45_PROF_L2_CTXT_TCAM_SPARIF_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_KEY_TYPE_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_TUN_HDR_TYPE_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_T_L2_NUMTAGS_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_L2_NUMTAGS_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_MAC1_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_MAC1_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_T_OVID_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_T_IVID_NUM_BITS},\n+\t{CFA_P45_PROF_L2_CTXT_TCAM_SVIF_BITPOS,\n+\t CFA_P45_PROF_L2_CTXT_TCAM_SVIF_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_MAC0_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_MAC0_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_OVID_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_OVID_NUM_BITS},\n+\t{CFA_P40_PROF_L2_CTXT_TCAM_IVID_BITPOS,\n+\t CFA_P40_PROF_L2_CTXT_TCAM_IVID_NUM_BITS},\n+};\n #endif /* _CFA_P40_TBL_H_ */\ndiff --git a/drivers/net/bnxt/hcapi/hcapi_cfa_defs.h b/drivers/net/bnxt/hcapi/hcapi_cfa_defs.h\nindex ea8d99d01..53a284887 100644\n--- a/drivers/net/bnxt/hcapi/hcapi_cfa_defs.h\n+++ b/drivers/net/bnxt/hcapi/hcapi_cfa_defs.h\n@@ -35,10 +35,6 @@\n \n #define CFA_GLOBAL_CFG_DATA_SZ (100)\n \n-#if SUPPORT_CFA_HW_P4 && SUPPORT_CFA_HW_P58 && SUPPORT_CFA_HW_P59\n-#define SUPPORT_CFA_HW_ALL (1)\n-#endif\n-\n #include \"hcapi_cfa_p4.h\"\n #define CFA_PROF_L2CTXT_TCAM_MAX_FIELD_CNT CFA_P40_PROF_L2_CTXT_TCAM_MAX_FLD\n #define CFA_PROF_L2CTXT_REMAP_MAX_FIELD_CNT CFA_P40_PROF_L2_CTXT_RMP_DR_MAX_FLD\n@@ -121,6 +117,8 @@ struct hcapi_cfa_layout {\n \tconst struct hcapi_cfa_field *field_array;\n \t/** [out] number of HW field entries in the HW layout field array */\n \tuint32_t array_sz;\n+\t/** [out] layout_id - layout id associated with the layout */\n+\tuint16_t layout_id;\n };\n \n /**\n@@ -247,6 +245,8 @@ struct hcapi_cfa_key_tbl {\n \t *  applicable for newer chip\n \t */\n \tuint8_t *base1;\n+\t/** [in] Page size for EEM tables */\n+\tuint32_t page_size;\n };\n \n /**\n@@ -267,7 +267,7 @@ struct hcapi_cfa_key_obj {\n struct hcapi_cfa_key_data {\n \t/** [in] For on-chip key table, it is the offset in unit of smallest\n \t *  key. For off-chip key table, it is the byte offset relative\n-\t *  to the key record memory base.\n+\t *  to the key record memory base and adjusted for page and entry size.\n \t */\n \tuint32_t offset;\n \t/** [in] HW key data buffer pointer */\n@@ -668,5 +668,5 @@ int hcapi_cfa_key_hw_op(struct hcapi_cfa_hwop *op,\n \t\t\tstruct hcapi_cfa_key_loc *key_loc);\n \n uint64_t hcapi_get_table_page(struct hcapi_cfa_em_table *mem,\n-\t\t\t      uint32_t offset);\n+\t\t\t      uint32_t page);\n #endif /* HCAPI_CFA_DEFS_H_ */\ndiff --git a/drivers/net/bnxt/hcapi/hcapi_cfa_p4.c b/drivers/net/bnxt/hcapi/hcapi_cfa_p4.c\nindex 42b37da0f..a01bbdbbb 100644\n--- a/drivers/net/bnxt/hcapi/hcapi_cfa_p4.c\n+++ b/drivers/net/bnxt/hcapi/hcapi_cfa_p4.c\n@@ -13,7 +13,6 @@\n #include \"hcapi_cfa_defs.h\"\n \n #define HCAPI_CFA_LKUP_SEED_MEM_SIZE 512\n-#define TF_EM_PAGE_SIZE (1 << 21)\n uint32_t hcapi_cfa_lkup_lkup3_init_cfg;\n uint32_t hcapi_cfa_lkup_em_seed_mem[HCAPI_CFA_LKUP_SEED_MEM_SIZE];\n bool hcapi_cfa_lkup_init;\n@@ -199,10 +198,9 @@ static uint32_t hcapi_cfa_lookup3_hash(uint8_t *in_key)\n \n \n uint64_t hcapi_get_table_page(struct hcapi_cfa_em_table *mem,\n-\t\t\t      uint32_t offset)\n+\t\t\t      uint32_t page)\n {\n \tint level = 0;\n-\tint page = offset / TF_EM_PAGE_SIZE;\n \tuint64_t addr;\n \n \tif (mem == NULL)\n@@ -362,7 +360,9 @@ int hcapi_cfa_key_hw_op(struct hcapi_cfa_hwop *op,\n \top->hw.base_addr =\n \t\thcapi_get_table_page((struct hcapi_cfa_em_table *)\n \t\t\t\t     key_tbl->base0,\n-\t\t\t\t     key_obj->offset);\n+\t\t\t\t     key_obj->offset / key_tbl->page_size);\n+\t/* Offset is adjusted to be the offset into the page */\n+\tkey_obj->offset = key_obj->offset % key_tbl->page_size;\n \n \tif (op->hw.base_addr == 0)\n \t\treturn -1;\ndiff --git a/drivers/net/bnxt/hcapi/hcapi_cfa_p4.h b/drivers/net/bnxt/hcapi/hcapi_cfa_p4.h\nindex 0661d6363..c6113707f 100644\n--- a/drivers/net/bnxt/hcapi/hcapi_cfa_p4.h\n+++ b/drivers/net/bnxt/hcapi/hcapi_cfa_p4.h\n@@ -21,6 +21,10 @@ enum cfa_p4_tbl_id {\n \tCFA_P4_TBL_WC_TCAM_REMAP,\n \tCFA_P4_TBL_VEB_TCAM,\n \tCFA_P4_TBL_SP_TCAM,\n+\tCFA_P4_TBL_PROF_SPIF_DFLT_L2CTXT,\n+\tCFA_P4_TBL_PROF_PARIF_DFLT_ACT_REC_PTR,\n+\tCFA_P4_TBL_PROF_PARIF_ERR_ACT_REC_PTR,\n+\tCFA_P4_TBL_LKUP_PARIF_DFLT_ACT_REC_PTR,\n \tCFA_P4_TBL_MAX\n };\n \n@@ -333,17 +337,29 @@ enum cfa_p4_action_sram_entry_type {\n \t */\n \n \t/** SRAM Action Record */\n-\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_ACT,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FULL_ACTION,\n+\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_0_ACTION,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_1_ACTION,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_2_ACTION,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_3_ACTION,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_FORMAT_4_ACTION,\n+\n \t/** SRAM Action Encap 8 Bytes */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_8B,\n \t/** SRAM Action Encap 16 Bytes */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_16B,\n \t/** SRAM Action Encap 64 Bytes */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_ENCAP_64B,\n+\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_PORT_SRC,\n+\tCFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_PORT_DEST,\n+\n \t/** SRAM Action Modify IPv4 Source */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_SRC,\n \t/** SRAM Action Modify IPv4 Destination */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_DEST,\n+\n \t/** SRAM Action Source Properties SMAC */\n \tCFA_P4_ACTION_SRAM_ENTRY_TYPE_SP_SMAC,\n \t/** SRAM Action Source Properties SMAC IPv4 */\ndiff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build\nindex 7f3ec6204..f25a9448d 100644\n--- a/drivers/net/bnxt/meson.build\n+++ b/drivers/net/bnxt/meson.build\n@@ -43,7 +43,7 @@ sources = files('bnxt_cpr.c',\n \t'tf_core/tf_shadow_tcam.c',\n \t'tf_core/tf_tcam.c',\n \t'tf_core/tf_util.c',\n-\t'tf_core/tf_rm.c',\n+\t'tf_core/tf_if_tbl.c',\n \n \t'hcapi/hcapi_cfa_p4.c',\n \ndiff --git a/drivers/net/bnxt/tf_core/Makefile b/drivers/net/bnxt/tf_core/Makefile\nindex 9ba60e1c2..1924bef02 100644\n--- a/drivers/net/bnxt/tf_core/Makefile\n+++ b/drivers/net/bnxt/tf_core/Makefile\n@@ -25,6 +25,7 @@ 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_tcam.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_util.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_core/tf_if_tbl.c\n \n SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_core.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_project.h\n@@ -33,3 +34,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_identifier.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tbl.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/stack.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_tcam.h\n+SYMLINK-$(CONFIG_RTE_LIBRTE_BNXT_PMD)-include += tf_core/tf_if_tbl.h\ndiff --git a/drivers/net/bnxt/tf_core/hwrm_tf.h b/drivers/net/bnxt/tf_core/hwrm_tf.h\nindex 26836e488..32f152314 100644\n--- a/drivers/net/bnxt/tf_core/hwrm_tf.h\n+++ b/drivers/net/bnxt/tf_core/hwrm_tf.h\n@@ -16,7 +16,9 @@ typedef enum tf_subtype {\n \tHWRM_TFT_REG_GET = 821,\n \tHWRM_TFT_REG_SET = 822,\n \tHWRM_TFT_TBL_TYPE_BULK_GET = 825,\n-\tTF_SUBTYPE_LAST = HWRM_TFT_TBL_TYPE_BULK_GET,\n+\tHWRM_TFT_IF_TBL_SET = 827,\n+\tHWRM_TFT_IF_TBL_GET = 828,\n+\tTF_SUBTYPE_LAST = HWRM_TFT_IF_TBL_GET,\n } tf_subtype_t;\n \n /* Request and Response compile time checking */\n@@ -46,7 +48,17 @@ typedef enum tf_subtype {\n /* WC DMA Address Type */\n #define TF_DEV_DATA_TYPE_TF_WC_DMA_ADDR\t\t\t0x30d0UL\n /* WC Entry */\n-#define TF_DEV_DATA_TYPE_TF_WC_ENTRY\t\t\t0x30d1UL\n+#define TF_DEV_DATA_TYPE_TF_WC_ENTRY\t\t\t\t0x30d1UL\n+/* SPIF DFLT L2 CTXT Entry */\n+#define TF_DEV_DATA_TYPE_SPIF_DFLT_L2_CTXT\t\t  0x3131UL\n+/* PARIF DFLT ACT REC PTR Entry */\n+#define TF_DEV_DATA_TYPE_PARIF_DFLT_ACT_REC\t\t0x3132UL\n+/* PARIF ERR DFLT ACT REC PTR Entry */\n+#define TF_DEV_DATA_TYPE_PARIF_ERR_DFLT_ACT_REC\t 0x3133UL\n+/* ILT Entry */\n+#define TF_DEV_DATA_TYPE_ILT\t\t\t\t0x3134UL\n+/* VNIC SVIF entry */\n+#define TF_DEV_DATA_TYPE_VNIC_SVIF\t\t\t0x3135UL\n /* Action Data */\n #define TF_DEV_DATA_TYPE_TF_ACTION_DATA\t\t\t0x3170UL\n #define TF_DEV_DATA_TYPE_LAST   TF_DEV_DATA_TYPE_TF_ACTION_DATA\n@@ -56,6 +68,9 @@ typedef enum tf_subtype {\n \n struct tf_tbl_type_bulk_get_input;\n struct tf_tbl_type_bulk_get_output;\n+struct tf_if_tbl_set_input;\n+struct tf_if_tbl_get_input;\n+struct tf_if_tbl_get_output;\n \n /* Input params for table type get */\n typedef struct tf_tbl_type_bulk_get_input {\n@@ -85,4 +100,48 @@ typedef struct tf_tbl_type_bulk_get_output {\n \tuint16_t\t\t\t size;\n } tf_tbl_type_bulk_get_output_t, *ptf_tbl_type_bulk_get_output_t;\n \n+/* Input params for if tbl set */\n+typedef struct tf_if_tbl_set_input {\n+\t/* Session Id */\n+\tuint32_t\t\t\t fw_session_id;\n+\t/* flags */\n+\tuint16_t\t\t\t flags;\n+\t/* When set to 0, indicates the query apply to RX */\n+#define TF_IF_TBL_SET_INPUT_FLAGS_DIR_RX\t\t\t  (0x0)\n+\t/* When set to 1, indicates the query apply to TX */\n+#define TF_IF_TBL_SET_INPUT_FLAGS_DIR_TX\t\t\t  (0x1)\n+\t/* if table type */\n+\tuint16_t\t\t\t tf_if_tbl_type;\n+\t/* index of table entry */\n+\tuint16_t\t\t\t idx;\n+\t/* size of the data write to table entry */\n+\tuint32_t\t\t\t data_sz_in_bytes;\n+\t/* data to write into table entry */\n+\tuint32_t\t\t\t data[2];\n+} tf_if_tbl_set_input_t, *ptf_if_tbl_set_input_t;\n+\n+/* Input params for if tbl get */\n+typedef struct tf_if_tbl_get_input {\n+\t/* Session Id */\n+\tuint32_t\t\t\t fw_session_id;\n+\t/* flags */\n+\tuint16_t\t\t\t flags;\n+\t/* When set to 0, indicates the query apply to RX */\n+#define TF_IF_TBL_GET_INPUT_FLAGS_DIR_RX\t\t\t  (0x0)\n+\t/* When set to 1, indicates the query apply to TX */\n+#define TF_IF_TBL_GET_INPUT_FLAGS_DIR_TX\t\t\t  (0x1)\n+\t/* if table type */\n+\tuint16_t\t\t\t tf_if_tbl_type;\n+\t/* size of the data get from table entry */\n+\tuint32_t\t\t\t data_sz_in_bytes;\n+\t/* index of table entry */\n+\tuint16_t\t\t\t idx;\n+} tf_if_tbl_get_input_t, *ptf_if_tbl_get_input_t;\n+\n+/* output params for if tbl get */\n+typedef struct tf_if_tbl_get_output {\n+\t/* Value read from table entry */\n+\tuint32_t\t\t\t data[2];\n+} tf_if_tbl_get_output_t, *ptf_if_tbl_get_output_t;\n+\n #endif /* _HWRM_TF_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c\nindex 45accb0ab..a980a2056 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.c\n+++ b/drivers/net/bnxt/tf_core/tf_core.c\n@@ -1039,3 +1039,119 @@ tf_free_tbl_scope(struct tf *tfp,\n \n \treturn rc;\n }\n+\n+int\n+tf_set_if_tbl_entry(struct tf *tfp,\n+\t\t    struct tf_set_if_tbl_entry_parms *parms)\n+{\n+\tint rc;\n+\tstruct tf_session *tfs;\n+\tstruct tf_dev_info *dev;\n+\tstruct tf_if_tbl_set_parms sparms = { 0 };\n+\n+\tTF_CHECK_PARMS2(tfp, parms);\n+\n+\t/* Retrieve the session information */\n+\trc = tf_session_get_session(tfp, &tfs);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\t/* Retrieve the device information */\n+\trc = tf_session_get_device(tfs, &dev);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup device, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tif (dev->ops->tf_dev_set_if_tbl == NULL) {\n+\t\trc = -EOPNOTSUPP;\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Operation not supported, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tsparms.dir = parms->dir;\n+\tsparms.type = parms->type;\n+\tsparms.idx = parms->idx;\n+\tsparms.data_sz_in_bytes = parms->data_sz_in_bytes;\n+\tsparms.data = parms->data;\n+\n+\trc = dev->ops->tf_dev_set_if_tbl(tfp, &sparms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: If_tbl set failed, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_get_if_tbl_entry(struct tf *tfp,\n+\t\t    struct tf_get_if_tbl_entry_parms *parms)\n+{\n+\tint rc;\n+\tstruct tf_session *tfs;\n+\tstruct tf_dev_info *dev;\n+\tstruct tf_if_tbl_get_parms gparms = { 0 };\n+\n+\tTF_CHECK_PARMS2(tfp, parms);\n+\n+\t/* Retrieve the session information */\n+\trc = tf_session_get_session(tfp, &tfs);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\t/* Retrieve the device information */\n+\trc = tf_session_get_device(tfs, &dev);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup device, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tif (dev->ops->tf_dev_get_if_tbl == NULL) {\n+\t\trc = -EOPNOTSUPP;\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Operation not supported, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tgparms.dir = parms->dir;\n+\tgparms.type = parms->type;\n+\tgparms.idx = parms->idx;\n+\tgparms.data_sz_in_bytes = parms->data_sz_in_bytes;\n+\tgparms.data = parms->data;\n+\n+\trc = dev->ops->tf_dev_get_if_tbl(tfp, &gparms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: If_tbl get failed, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h\nindex e898f19a0..e3d46bd45 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.h\n+++ b/drivers/net/bnxt/tf_core/tf_core.h\n@@ -1556,4 +1556,108 @@ int tf_delete_em_entry(struct tf *tfp,\n int tf_search_em_entry(struct tf *tfp,\n \t\t       struct tf_search_em_entry_parms *parms);\n \n+/**\n+ * @page if_tbl Interface Table Access\n+ *\n+ * @ref tf_set_if_tbl_entry\n+ *\n+ * @ref tf_get_if_tbl_entry\n+ *\n+ * @ref tf_restore_if_tbl_entry\n+ */\n+/**\n+ * Enumeration of TruFlow interface table types.\n+ */\n+enum tf_if_tbl_type {\n+\t/** Default Profile L2 Context Entry */\n+\tTF_IF_TBL_TYPE_PROF_SPIF_DFLT_L2_CTXT,\n+\t/** Default Profile TCAM/Lookup Action Record Pointer Table */\n+\tTF_IF_TBL_TYPE_PROF_PARIF_DFLT_ACT_REC_PTR,\n+\t/** Error Profile TCAM Miss Action Record Pointer Table */\n+\tTF_IF_TBL_TYPE_PROF_PARIF_ERR_ACT_REC_PTR,\n+\t/** Default Error Profile TCAM Miss Action Record Pointer Table */\n+\tTF_IF_TBL_TYPE_LKUP_PARIF_DFLT_ACT_REC_PTR,\n+\t/** SR2 Ingress lookup table */\n+\tTF_IF_TBL_TYPE_ILT,\n+\t/** SR2 VNIC/SVIF Table */\n+\tTF_IF_TBL_TYPE_VNIC_SVIF,\n+\tTF_IF_TBL_TYPE_MAX\n+};\n+\n+/**\n+ * tf_set_if_tbl_entry parameter definition\n+ */\n+struct tf_set_if_tbl_entry_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_if_tbl_type type;\n+\t/**\n+\t * [in] Entry data\n+\t */\n+\tuint32_t *data;\n+\t/**\n+\t * [in] Entry size\n+\t */\n+\tuint16_t data_sz_in_bytes;\n+\t/**\n+\t * [in] Interface to write\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * set interface table entry\n+ *\n+ * Used to set an interface table. This API is used for managing tables indexed\n+ * by SVIF/SPIF/PARIF interfaces. In current implementation only the value is\n+ * set.\n+ * Returns success or failure code.\n+ */\n+int tf_set_if_tbl_entry(struct tf *tfp,\n+\t\t\tstruct tf_set_if_tbl_entry_parms *parms);\n+\n+/**\n+ * tf_get_if_tbl_entry parameter definition\n+ */\n+struct tf_get_if_tbl_entry_parms {\n+\t/**\n+\t * [in] Receive or transmit direction\n+\t */\n+\tenum tf_dir dir;\n+\t/**\n+\t * [in] Type of table to get\n+\t */\n+\tenum tf_if_tbl_type type;\n+\t/**\n+\t * [out] Entry data\n+\t */\n+\tuint32_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 read\n+\t */\n+\tuint32_t idx;\n+};\n+\n+/**\n+ * get interface table entry\n+ *\n+ * Used to retrieve an interface table entry.\n+ *\n+ * Reads the interface table entry value\n+ *\n+ * Returns success or failure code. Failure will be returned if the\n+ * provided data buffer is too small for the data type requested.\n+ */\n+int tf_get_if_tbl_entry(struct tf *tfp,\n+\t\t\tstruct tf_get_if_tbl_entry_parms *parms);\n+\n #endif /* _TF_CORE_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c\nindex 20b0c5948..a3073c826 100644\n--- a/drivers/net/bnxt/tf_core/tf_device.c\n+++ b/drivers/net/bnxt/tf_core/tf_device.c\n@@ -44,6 +44,7 @@ tf_dev_bind_p4(struct tf *tfp,\n \tstruct tf_tbl_cfg_parms tbl_cfg;\n \tstruct tf_tcam_cfg_parms tcam_cfg;\n \tstruct tf_em_cfg_parms em_cfg;\n+\tstruct tf_if_tbl_cfg_parms if_tbl_cfg;\n \n \tdev_handle->type = TF_DEVICE_TYPE_WH;\n \t/* Initial function initialization */\n@@ -114,6 +115,19 @@ tf_dev_bind_p4(struct tf *tfp,\n \t\tgoto fail;\n \t}\n \n+\t/*\n+\t * IF_TBL\n+\t */\n+\tif_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX;\n+\tif_tbl_cfg.cfg = tf_if_tbl_p4;\n+\tif_tbl_cfg.shadow_copy = shadow_copy;\n+\trc = tf_if_tbl_bind(tfp, &if_tbl_cfg);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"IF Table initialization failure\\n\");\n+\t\tgoto fail;\n+\t}\n+\n \t/* Final function initialization */\n \tdev_handle->ops = &tf_dev_ops_p4;\n \n@@ -186,6 +200,13 @@ tf_dev_unbind_p4(struct tf *tfp)\n \t\tfail = true;\n \t}\n \n+\trc = tf_if_tbl_unbind(tfp);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Device unbind failed, IF Table Type\\n\");\n+\t\tfail = true;\n+\t}\n+\n \tif (fail)\n \t\treturn -1;\n \ndiff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h\nindex 58b7a4ab2..5a0943ad7 100644\n--- a/drivers/net/bnxt/tf_core/tf_device.h\n+++ b/drivers/net/bnxt/tf_core/tf_device.h\n@@ -10,6 +10,7 @@\n #include \"tf_identifier.h\"\n #include \"tf_tbl.h\"\n #include \"tf_tcam.h\"\n+#include \"tf_if_tbl.h\"\n \n struct tf;\n struct tf_session;\n@@ -567,6 +568,44 @@ struct tf_dev_ops {\n \t */\n \tint (*tf_dev_free_tbl_scope)(struct tf *tfp,\n \t\t\t\t     struct tf_free_tbl_scope_parms *parms);\n+\n+\t/**\n+\t * Sets the specified interface 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 interface table set parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_set_if_tbl)(struct tf *tfp,\n+\t\t\t\t struct tf_if_tbl_set_parms *parms);\n+\n+\t/**\n+\t * Retrieves the specified interface 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 get parameters\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_get_if_tbl)(struct tf *tfp,\n+\t\t\t\t struct tf_if_tbl_get_parms *parms);\n };\n \n /**\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c\nindex 9a3230787..2dc34b853 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p4.c\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c\n@@ -11,6 +11,7 @@\n #include \"tf_tbl.h\"\n #include \"tf_tcam.h\"\n #include \"tf_em.h\"\n+#include \"tf_if_tbl.h\"\n \n /**\n  * Device specific function that retrieves the MAX number of HCAPI\n@@ -105,6 +106,8 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {\n \t.tf_dev_delete_ext_em_entry = NULL,\n \t.tf_dev_alloc_tbl_scope = NULL,\n \t.tf_dev_free_tbl_scope = NULL,\n+\t.tf_dev_set_if_tbl = NULL,\n+\t.tf_dev_get_if_tbl = NULL,\n };\n \n /**\n@@ -135,4 +138,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {\n \t.tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry,\n \t.tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc,\n \t.tf_dev_free_tbl_scope = tf_em_ext_common_free,\n+\t.tf_dev_set_if_tbl = tf_if_tbl_set,\n+\t.tf_dev_get_if_tbl = tf_if_tbl_get,\n };\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.h b/drivers/net/bnxt/tf_core/tf_device_p4.h\nindex 298e100f3..3b03a7c4e 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p4.h\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.h\n@@ -10,6 +10,7 @@\n \n #include \"tf_core.h\"\n #include \"tf_rm.h\"\n+#include \"tf_if_tbl.h\"\n \n struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX] = {\n \t{ TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP },\n@@ -86,4 +87,13 @@ struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = {\n \t{ TF_RM_ELEM_CFG_NULL, CFA_RESOURCE_TYPE_INVALID },\n };\n \n+struct tf_if_tbl_cfg tf_if_tbl_p4[TF_IF_TBL_TYPE_MAX] = {\n+\t{ TF_IF_TBL_CFG, CFA_P4_TBL_PROF_SPIF_DFLT_L2CTXT },\n+\t{ TF_IF_TBL_CFG, CFA_P4_TBL_PROF_PARIF_DFLT_ACT_REC_PTR },\n+\t{ TF_IF_TBL_CFG, CFA_P4_TBL_PROF_PARIF_ERR_ACT_REC_PTR },\n+\t{ TF_IF_TBL_CFG, CFA_P4_TBL_LKUP_PARIF_DFLT_ACT_REC_PTR },\n+\t{ TF_IF_TBL_CFG_NULL, CFA_IF_TBL_TYPE_INVALID },\n+\t{ TF_IF_TBL_CFG_NULL, CFA_IF_TBL_TYPE_INVALID }\n+};\n+\n #endif /* _TF_DEVICE_P4_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c\nindex 39a8412b3..23a7fc9c2 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_common.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_common.c\n@@ -337,11 +337,10 @@ tf_em_ext_common_bind(struct tf *tfp,\n \t\tdb_exists = 1;\n \t}\n \n-\tif (db_exists) {\n-\t\tmem_type = parms->mem_type;\n+\tif (db_exists)\n \t\tinit = 1;\n-\t}\n \n+\tmem_type = parms->mem_type;\n \treturn 0;\n }\n \ndiff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c\nindex d7c147a15..2626a59fe 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_host.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_host.c\n@@ -831,7 +831,8 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,\n \top.opcode = HCAPI_CFA_HWOPS_ADD;\n \tkey_tbl.base0 = (uint8_t *)\n \t\t&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY0_TABLE];\n-\tkey_obj.offset = (index * TF_EM_KEY_RECORD_SIZE) % TF_EM_PAGE_SIZE;\n+\tkey_tbl.page_size = TF_EM_PAGE_SIZE;\n+\tkey_obj.offset = index * TF_EM_KEY_RECORD_SIZE;\n \tkey_obj.data = (uint8_t *)&key_entry;\n \tkey_obj.size = TF_EM_KEY_RECORD_SIZE;\n \n@@ -847,8 +848,7 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,\n \n \t\tkey_tbl.base0 = (uint8_t *)\n \t\t&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_KEY1_TABLE];\n-\t\tkey_obj.offset =\n-\t\t\t(index * TF_EM_KEY_RECORD_SIZE) % TF_EM_PAGE_SIZE;\n+\t\tkey_obj.offset = index * TF_EM_KEY_RECORD_SIZE;\n \n \t\trc = hcapi_cfa_key_hw_op(&op,\n \t\t\t\t\t &key_tbl,\n@@ -914,7 +914,8 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,\n \t&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[(hash_type == 0 ?\n \t\t\t\t\t\t\t  TF_KEY0_TABLE :\n \t\t\t\t\t\t\t  TF_KEY1_TABLE)];\n-\tkey_obj.offset = (index * TF_EM_KEY_RECORD_SIZE) % TF_EM_PAGE_SIZE;\n+\tkey_tbl.page_size = TF_EM_PAGE_SIZE;\n+\tkey_obj.offset = index * TF_EM_KEY_RECORD_SIZE;\n \tkey_obj.data = NULL;\n \tkey_obj.size = TF_EM_KEY_RECORD_SIZE;\n \n@@ -1195,7 +1196,8 @@ int tf_tbl_ext_host_set(struct tf *tfp,\n \top.opcode = HCAPI_CFA_HWOPS_PUT;\n \tkey_tbl.base0 =\n \t\t(uint8_t *)&tbl_scope_cb->em_ctx_info[parms->dir].em_tables[TF_RECORD_TABLE];\n-\tkey_obj.offset = parms->idx % TF_EM_PAGE_SIZE;\n+\tkey_tbl.page_size = TF_EM_PAGE_SIZE;\n+\tkey_obj.offset = parms->idx;\n \tkey_obj.data = parms->data;\n \tkey_obj.size = parms->data_sz_in_bytes;\n \ndiff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c\nindex 2cc43b40f..90aeaa468 100644\n--- a/drivers/net/bnxt/tf_core/tf_identifier.c\n+++ b/drivers/net/bnxt/tf_core/tf_identifier.c\n@@ -68,7 +68,7 @@ tf_ident_bind(struct tf *tfp,\n int\n tf_ident_unbind(struct tf *tfp)\n {\n-\tint rc;\n+\tint rc = 0;\n \tint i;\n \tstruct tf_rm_free_db_parms fparms = { 0 };\n \n@@ -89,7 +89,6 @@ tf_ident_unbind(struct tf *tfp)\n \t\t\tTFP_DRV_LOG(ERR,\n \t\t\t\t    \"rm free failed on unbind\\n\");\n \t\t}\n-\n \t\tident_db[i] = NULL;\n \t}\n \ndiff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c\nnew file mode 100644\nindex 000000000..dc73ba2d0\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c\n@@ -0,0 +1,178 @@\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_if_tbl.h\"\n+#include \"tf_common.h\"\n+#include \"tf_rm.h\"\n+#include \"tf_util.h\"\n+#include \"tf_msg.h\"\n+#include \"tfp.h\"\n+\n+struct tf;\n+\n+/**\n+ * IF Table DBs.\n+ */\n+static void *if_tbl_db[TF_DIR_MAX];\n+\n+/**\n+ * IF Table Shadow DBs\n+ */\n+/* static void *shadow_if_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+/**\n+ * Convert if_tbl_type to hwrm type.\n+ *\n+ * [in] if_tbl_type\n+ *   Interface table type\n+ *\n+ * [out] hwrm_type\n+ *   HWRM device data type\n+ *\n+ * Returns:\n+ *    0          - Success\n+ *   -EOPNOTSUPP - Type not supported\n+ */\n+static int\n+tf_if_tbl_get_hcapi_type(struct tf_if_tbl_get_hcapi_parms *parms)\n+{\n+\tstruct tf_if_tbl_cfg *tbl_cfg;\n+\tenum tf_if_tbl_cfg_type cfg_type;\n+\n+\ttbl_cfg = (struct tf_if_tbl_cfg *)parms->tbl_db;\n+\tcfg_type = tbl_cfg[parms->db_index].cfg_type;\n+\n+\tif (cfg_type != TF_IF_TBL_CFG)\n+\t\treturn -ENOTSUP;\n+\n+\t*parms->hcapi_type = tbl_cfg[parms->db_index].hcapi_type;\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_if_tbl_bind(struct tf *tfp __rte_unused,\n+\t       struct tf_if_tbl_cfg_parms *parms)\n+{\n+\tTF_CHECK_PARMS2(tfp, parms);\n+\n+\tif (init) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"IF TBL DB already initialized\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif_tbl_db[TF_DIR_RX] = parms->cfg;\n+\tif_tbl_db[TF_DIR_TX] = parms->cfg;\n+\n+\tinit = 1;\n+\n+\tTFP_DRV_LOG(INFO,\n+\t\t    \"Table Type - initialized\\n\");\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_if_tbl_unbind(struct tf *tfp __rte_unused)\n+{\n+\t/* Bail if nothing has been initialized */\n+\tif (!init) {\n+\t\tTFP_DRV_LOG(INFO,\n+\t\t\t    \"No Table DBs created\\n\");\n+\t\treturn 0;\n+\t}\n+\n+\tif_tbl_db[TF_DIR_RX] = NULL;\n+\tif_tbl_db[TF_DIR_TX] = NULL;\n+\tinit = 0;\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_if_tbl_set(struct tf *tfp,\n+\t      struct tf_if_tbl_set_parms *parms)\n+{\n+\tint rc;\n+\tstruct tf_if_tbl_get_hcapi_parms hparms;\n+\n+\tTF_CHECK_PARMS3(tfp, parms, parms->data);\n+\n+\tif (!init) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: No Table DBs created\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir));\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Convert TF type to HCAPI type */\n+\thparms.tbl_db = if_tbl_db[parms->dir];\n+\thparms.db_index = parms->type;\n+\thparms.hcapi_type = &parms->hcapi_type;\n+\trc = tf_if_tbl_get_hcapi_type(&hparms);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\trc = tf_msg_set_if_tbl_entry(tfp, parms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s, If Tbl set failed, type:%d, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    parms->type,\n+\t\t\t    strerror(-rc));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int\n+tf_if_tbl_get(struct tf *tfp,\n+\t      struct tf_if_tbl_get_parms *parms)\n+{\n+\tint rc;\n+\tstruct tf_if_tbl_get_hcapi_parms hparms;\n+\n+\tTF_CHECK_PARMS3(tfp, parms, parms->data);\n+\n+\tif (!init) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: No Table DBs created\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir));\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Convert TF type to HCAPI type */\n+\thparms.tbl_db = if_tbl_db[parms->dir];\n+\thparms.db_index = parms->type;\n+\thparms.hcapi_type = &parms->hcapi_type;\n+\trc = tf_if_tbl_get_hcapi_type(&hparms);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Get the entry */\n+\trc = tf_msg_get_if_tbl_entry(tfp, parms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s, If Tbl get failed, type:%d, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(parms->dir),\n+\t\t\t    parms->type,\n+\t\t\t    strerror(-rc));\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.h b/drivers/net/bnxt/tf_core/tf_if_tbl.h\nnew file mode 100644\nindex 000000000..54d4c37f5\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.h\n@@ -0,0 +1,236 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#ifndef TF_IF_TBL_TYPE_H_\n+#define TF_IF_TBL_TYPE_H_\n+\n+#include \"tf_core.h\"\n+#include \"stack.h\"\n+\n+/*\n+ * This is the constant used to define invalid CFA\n+ * types across all devices.\n+ */\n+#define CFA_IF_TBL_TYPE_INVALID 65535\n+\n+struct tf;\n+\n+/**\n+ * The IF Table module provides processing of Internal TF interface table types.\n+ */\n+\n+/**\n+ * IF table configuration enumeration.\n+ */\n+enum tf_if_tbl_cfg_type {\n+\t/**\n+\t * No configuration\n+\t */\n+\tTF_IF_TBL_CFG_NULL,\n+\t/**\n+\t * HCAPI 'controlled'\n+\t */\n+\tTF_IF_TBL_CFG,\n+};\n+\n+/**\n+ * IF table configuration structure, used by the Device to configure\n+ * how an individual TF type is configured in regard to the HCAPI type.\n+ */\n+struct tf_if_tbl_cfg {\n+\t/**\n+\t * IF table config controls how the DB for that element is\n+\t * processed.\n+\t */\n+\tenum tf_if_tbl_cfg_type cfg_type;\n+\n+\t/**\n+\t * HCAPI Type for the element. Used for TF to HCAPI type\n+\t * conversion.\n+\t */\n+\tuint16_t hcapi_type;\n+};\n+\n+/**\n+ * Get HCAPI type parameters for a single element\n+ */\n+struct tf_if_tbl_get_hcapi_parms {\n+\t/**\n+\t * [in] IF Tbl DB Handle\n+\t */\n+\tvoid *tbl_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+ * Table configuration parameters\n+ */\n+struct tf_if_tbl_cfg_parms {\n+\t/**\n+\t * Number of table types in each of the configuration arrays\n+\t */\n+\tuint16_t num_elements;\n+\t/**\n+\t * Table Type element configuration array\n+\t */\n+\tstruct tf_if_tbl_cfg *cfg;\n+\t/**\n+\t * Shadow table type configuration array\n+\t */\n+\tstruct tf_shadow_if_tbl_cfg *shadow_cfg;\n+\t/**\n+\t * Boolean controlling the request shadow copy.\n+\t */\n+\tbool shadow_copy;\n+};\n+\n+/**\n+ * IF Table set parameters\n+ */\n+struct tf_if_tbl_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_if_tbl_type type;\n+\t/**\n+\t * [in] Type of HCAPI\n+\t */\n+\tuint16_t hcapi_type;\n+\t/**\n+\t * [in] Entry data\n+\t */\n+\tuint32_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+ * IF Table get parameters\n+ */\n+struct tf_if_tbl_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_if_tbl_type type;\n+\t/**\n+\t * [in] Type of HCAPI\n+\t */\n+\tuint16_t hcapi_type;\n+\t/**\n+\t * [out] Entry data\n+\t */\n+\tuint32_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 if tbl Table\n+ *\n+ * @ref tf_if_tbl_bind\n+ *\n+ * @ref tf_if_tbl_unbind\n+ *\n+ * @ref tf_tbl_set\n+ *\n+ * @ref tf_tbl_get\n+ *\n+ * @ref tf_tbl_restore\n+ */\n+/**\n+ * Initializes the Table 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 Table configuration parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_if_tbl_bind(struct tf *tfp,\n+\t\t   struct tf_if_tbl_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_if_tbl_unbind(struct tf *tfp);\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 Interface Table set parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_if_tbl_set(struct tf *tfp,\n+\t\t  struct tf_if_tbl_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 Table get parameters\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+int tf_if_tbl_get(struct tf *tfp,\n+\t\t  struct tf_if_tbl_get_parms *parms);\n+\n+#endif /* TF_IF_TBL_TYPE_H */\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c\nindex 659065de3..6600a14c8 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.c\n+++ b/drivers/net/bnxt/tf_core/tf_msg.c\n@@ -125,12 +125,19 @@ tf_msg_session_close(struct tf *tfp)\n \tint rc;\n \tstruct hwrm_tf_session_close_input req = { 0 };\n \tstruct hwrm_tf_session_close_output resp = { 0 };\n-\tstruct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);\n \tstruct tfp_send_msg_parms parms = { 0 };\n+\tuint8_t fw_session_id;\n+\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Unable to lookup FW id, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n \n \t/* Populate the request */\n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \n \tparms.tf_type = HWRM_TF_SESSION_CLOSE;\n \tparms.req_data = (uint32_t *)&req;\n@@ -150,12 +157,19 @@ tf_msg_session_qcfg(struct tf *tfp)\n \tint rc;\n \tstruct hwrm_tf_session_qcfg_input req = { 0 };\n \tstruct hwrm_tf_session_qcfg_output resp = { 0 };\n-\tstruct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);\n \tstruct tfp_send_msg_parms parms = { 0 };\n+\tuint8_t fw_session_id;\n+\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Unable to lookup FW id, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n \n \t/* Populate the request */\n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \n \tparms.tf_type = HWRM_TF_SESSION_QCFG,\n \tparms.req_data = (uint32_t *)&req;\n@@ -448,13 +462,22 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,\n \tstruct tfp_send_msg_parms parms = { 0 };\n \tstruct hwrm_tf_em_insert_input req = { 0 };\n \tstruct hwrm_tf_em_insert_output resp = { 0 };\n-\tstruct tf_session *tfs = (struct tf_session *)(tfp->session->core_data);\n \tstruct tf_em_64b_entry *em_result =\n \t\t(struct tf_em_64b_entry *)em_parms->em_record;\n \tuint16_t flags;\n+\tuint8_t fw_session_id;\n \n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Unable to lookup FW id, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(em_parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\t/* Populate the request */\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \ttfp_memcpy(req.em_key,\n \t\t   em_parms->key,\n \t\t   ((em_parms->key_sz_in_bits + 7) / 8));\n@@ -498,11 +521,19 @@ tf_msg_delete_em_entry(struct tf *tfp,\n \tstruct hwrm_tf_em_delete_input req = { 0 };\n \tstruct hwrm_tf_em_delete_output resp = { 0 };\n \tuint16_t flags;\n-\tstruct tf_session *tfs =\n-\t\t(struct tf_session *)(tfp->session->core_data);\n+\tuint8_t fw_session_id;\n \n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Unable to lookup FW id, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(em_parms->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\t/* Populate the request */\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \n \tflags = (em_parms->dir == TF_DIR_TX ?\n \t\t HWRM_TF_EM_DELETE_INPUT_FLAGS_DIR_TX :\n@@ -789,21 +820,19 @@ tf_msg_set_tbl_entry(struct tf *tfp,\n \tstruct hwrm_tf_tbl_type_set_input req = { 0 };\n \tstruct hwrm_tf_tbl_type_set_output resp = { 0 };\n \tstruct tfp_send_msg_parms parms = { 0 };\n-\tstruct tf_session *tfs;\n+\tuint8_t fw_session_id;\n \n-\t/* Retrieve the session information */\n-\trc = tf_session_get_session(tfp, &tfs);\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    \"%s: Unable to lookup FW id, rc:%s\\n\",\n \t\t\t    tf_dir_2_str(dir),\n \t\t\t    strerror(-rc));\n \t\treturn rc;\n \t}\n \n \t/* Populate the request */\n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \treq.flags = tfp_cpu_to_le_16(dir);\n \treq.type = tfp_cpu_to_le_32(hcapi_type);\n \treq.size = tfp_cpu_to_le_16(size);\n@@ -840,21 +869,19 @@ tf_msg_get_tbl_entry(struct tf *tfp,\n \tstruct hwrm_tf_tbl_type_get_input req = { 0 };\n \tstruct hwrm_tf_tbl_type_get_output resp = { 0 };\n \tstruct tfp_send_msg_parms parms = { 0 };\n-\tstruct tf_session *tfs;\n+\tuint8_t fw_session_id;\n \n-\t/* Retrieve the session information */\n-\trc = tf_session_get_session(tfp, &tfs);\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    \"%s: Unable to lookup FW id, rc:%s\\n\",\n \t\t\t    tf_dir_2_str(dir),\n \t\t\t    strerror(-rc));\n \t\treturn rc;\n \t}\n \n \t/* Populate the request */\n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \treq.flags = tfp_cpu_to_le_16(dir);\n \treq.type = tfp_cpu_to_le_32(hcapi_type);\n \treq.index = tfp_cpu_to_le_32(index);\n@@ -897,22 +924,20 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,\n \tstruct tfp_send_msg_parms parms = { 0 };\n \tstruct tf_tbl_type_bulk_get_input req = { 0 };\n \tstruct tf_tbl_type_bulk_get_output resp = { 0 };\n-\tstruct tf_session *tfs;\n \tint data_size = 0;\n+\tuint8_t fw_session_id;\n \n-\t/* Retrieve the session information */\n-\trc = tf_session_get_session(tfp, &tfs);\n+\trc = tf_session_get_fw_session_id(tfp, &fw_session_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    \"%s: Unable to lookup FW id, rc:%s\\n\",\n \t\t\t    tf_dir_2_str(dir),\n \t\t\t    strerror(-rc));\n \t\treturn rc;\n \t}\n \n \t/* Populate the request */\n-\treq.fw_session_id =\n-\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.fw_session_id = tfp_cpu_to_le_32(fw_session_id);\n \treq.flags = tfp_cpu_to_le_16(dir);\n \treq.type = tfp_cpu_to_le_32(hcapi_type);\n \treq.start_index = tfp_cpu_to_le_32(starting_idx);\n@@ -939,3 +964,102 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,\n \n \treturn tfp_le_to_cpu_32(parms.tf_resp_code);\n }\n+\n+int\n+tf_msg_get_if_tbl_entry(struct tf *tfp,\n+\t\t\tstruct tf_if_tbl_get_parms *params)\n+{\n+\tint rc = 0;\n+\tstruct tfp_send_msg_parms parms = { 0 };\n+\ttf_if_tbl_get_input_t req = { 0 };\n+\ttf_if_tbl_get_output_t resp;\n+\tuint32_t flags = 0;\n+\tstruct tf_session *tfs;\n+\n+\t/* Retrieve the session information */\n+\trc = tf_session_get_session(tfp, &tfs);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(params->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tflags = (params->dir == TF_DIR_TX ? TF_IF_TBL_SET_INPUT_FLAGS_DIR_TX :\n+\t\t TF_IF_TBL_SET_INPUT_FLAGS_DIR_RX);\n+\n+\t/* Populate the request */\n+\treq.fw_session_id =\n+\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.flags = flags;\n+\treq.tf_if_tbl_type = params->hcapi_type;\n+\treq.idx = tfp_cpu_to_le_16(params->idx);\n+\treq.data_sz_in_bytes = tfp_cpu_to_le_16(params->data_sz_in_bytes);\n+\n+\tMSG_PREP(parms,\n+\t\t TF_KONG_MB,\n+\t\t HWRM_TF,\n+\t\t HWRM_TFT_IF_TBL_GET,\n+\t\t req,\n+\t\t resp);\n+\n+\trc = tfp_send_msg_tunneled(tfp, &parms);\n+\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tif (parms.tf_resp_code != 0)\n+\t\treturn tfp_le_to_cpu_32(parms.tf_resp_code);\n+\n+\ttfp_memcpy(&params->data[0], resp.data, req.data_sz_in_bytes);\n+\n+\treturn tfp_le_to_cpu_32(parms.tf_resp_code);\n+}\n+\n+int\n+tf_msg_set_if_tbl_entry(struct tf *tfp,\n+\t\t\tstruct tf_if_tbl_set_parms *params)\n+{\n+\tint rc = 0;\n+\tstruct tfp_send_msg_parms parms = { 0 };\n+\ttf_if_tbl_set_input_t req = { 0 };\n+\tuint32_t flags = 0;\n+\tstruct tf_session *tfs;\n+\n+\t/* Retrieve the session information */\n+\trc = tf_session_get_session(tfp, &tfs);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"%s: Failed to lookup session, rc:%s\\n\",\n+\t\t\t    tf_dir_2_str(params->dir),\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\n+\tflags = (params->dir == TF_DIR_TX ? TF_IF_TBL_SET_INPUT_FLAGS_DIR_TX :\n+\t\t TF_IF_TBL_SET_INPUT_FLAGS_DIR_RX);\n+\n+\t/* Populate the request */\n+\treq.fw_session_id =\n+\t\ttfp_cpu_to_le_32(tfs->session_id.internal.fw_session_id);\n+\treq.flags = flags;\n+\treq.tf_if_tbl_type = params->hcapi_type;\n+\treq.idx = tfp_cpu_to_le_32(params->idx);\n+\treq.data_sz_in_bytes = tfp_cpu_to_le_32(params->data_sz_in_bytes);\n+\ttfp_memcpy(&req.data[0], params->data, params->data_sz_in_bytes);\n+\n+\tMSG_PREP_NO_RESP(parms,\n+\t\t\t TF_KONG_MB,\n+\t\t\t HWRM_TF,\n+\t\t\t HWRM_TFT_IF_TBL_SET,\n+\t\t\t req);\n+\n+\trc = tfp_send_msg_tunneled(tfp, &parms);\n+\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn tfp_le_to_cpu_32(parms.tf_resp_code);\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h\nindex 7432873d7..37f291016 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.h\n+++ b/drivers/net/bnxt/tf_core/tf_msg.h\n@@ -428,4 +428,34 @@ int tf_msg_bulk_get_tbl_entry(struct tf *tfp,\n \t\t\t      uint16_t entry_sz_in_bytes,\n \t\t\t      uint64_t physical_mem_addr);\n \n+/**\n+ * Sends Set message of a IF Table Type element to the firmware.\n+ *\n+ * [in] tfp\n+ *   Pointer to session handle\n+ *\n+ * [in] parms\n+ *   Pointer to IF table set parameters\n+ *\n+ * Returns:\n+ *  0 on Success else internal Truflow error\n+ */\n+int tf_msg_set_if_tbl_entry(struct tf *tfp,\n+\t\t\t    struct tf_if_tbl_set_parms *params);\n+\n+/**\n+ * Sends get message of a IF Table Type element to the firmware.\n+ *\n+ * [in] tfp\n+ *   Pointer to session handle\n+ *\n+ * [in] parms\n+ *   Pointer to IF table get parameters\n+ *\n+ * Returns:\n+ *  0 on Success else internal Truflow error\n+ */\n+int tf_msg_get_if_tbl_entry(struct tf *tfp,\n+\t\t\t    struct tf_if_tbl_get_parms *params);\n+\n #endif  /* _TF_MSG_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c\nindex ab9e05f2d..6c07e4745 100644\n--- a/drivers/net/bnxt/tf_core/tf_session.c\n+++ b/drivers/net/bnxt/tf_core/tf_session.c\n@@ -70,14 +70,24 @@ tf_session_open_session(struct tf *tfp,\n \t\tgoto cleanup;\n \t}\n \ttfp->session->core_data = cparms.mem_va;\n+\tsession_id = &parms->open_cfg->session_id;\n+\n+\t/* Update Session Info, which is what is visible to the caller */\n+\ttfp->session->ver.major = 0;\n+\ttfp->session->ver.minor = 0;\n+\ttfp->session->ver.update = 0;\n \n-\t/* Initialize Session and Device */\n+\ttfp->session->session_id.internal.domain = session_id->internal.domain;\n+\ttfp->session->session_id.internal.bus = session_id->internal.bus;\n+\ttfp->session->session_id.internal.device = session_id->internal.device;\n+\ttfp->session->session_id.internal.fw_session_id = fw_session_id;\n+\n+\t/* Initialize Session and Device, which is private */\n \tsession = (struct tf_session *)tfp->session->core_data;\n \tsession->ver.major = 0;\n \tsession->ver.minor = 0;\n \tsession->ver.update = 0;\n \n-\tsession_id = &parms->open_cfg->session_id;\n \tsession->session_id.internal.domain = session_id->internal.domain;\n \tsession->session_id.internal.bus = session_id->internal.bus;\n \tsession->session_id.internal.device = session_id->internal.device;\n",
    "prefixes": [
        "v2",
        "28/51"
    ]
}