get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81621,
    "url": "https://patches.dpdk.org/api/patches/81621/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201020215538.59242-3-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": "<20201020215538.59242-3-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201020215538.59242-3-ajit.khaparde@broadcom.com",
    "date": "2020-10-20T21:55:29",
    "name": "[v2,02/11] net/bnxt: changes to support two table scopes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0e3dee7c580a5cb8a9b36424d49642f35cc3c9dd",
    "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/20201020215538.59242-3-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 13155,
            "url": "https://patches.dpdk.org/api/series/13155/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13155",
            "date": "2020-10-20T21:55:27",
            "name": "bnxt fixes and enhancements to TRUFLOW support",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/13155/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/81621/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/81621/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 7716BA04DD;\n\tTue, 20 Oct 2020 23:56:21 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 50FD7AC9F;\n\tTue, 20 Oct 2020 23:55:51 +0200 (CEST)",
            "from mail-pl1-f195.google.com (mail-pl1-f195.google.com\n [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id 20777AC95\n for <dev@dpdk.org>; Tue, 20 Oct 2020 23:55:48 +0200 (CEST)",
            "by mail-pl1-f195.google.com with SMTP id d23so97637pll.7\n for <dev@dpdk.org>; Tue, 20 Oct 2020 14:55:48 -0700 (PDT)",
            "from localhost.localdomain ([192.19.223.252])\n by smtp.gmail.com with ESMTPSA id e6sm24113pfn.190.2020.10.20.14.55.43\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Tue, 20 Oct 2020 14:55:45 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com;\n s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version; bh=BjMmyceqysztbaO1ivR3Nz/gWc9AK4jh12wY1VQP/TM=;\n b=eHv8+D/yJCFvdwh5W8Qp2EUG4B8EIeNv4MqK4F4C+QVpVHjvMzJAoK0vk590UBHuKT\n +DJS5uHq1gZ1Djttqm4TspMhqih5tS9iVJDkUAu3pfBpsSc00i0NXQpv2dLAucGsShAs\n 4Azbl4pepVsKY3i+7hDs8IA562kZ+MDWh7odY=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version;\n bh=BjMmyceqysztbaO1ivR3Nz/gWc9AK4jh12wY1VQP/TM=;\n b=HXQH65c3DGWiXI7qwezm9Tx6wrjHKM1YDQoLrJbsYsWOPu08phnsByjudi/F/xe4Bh\n tDgi8IWwoFNcesM7JYp36lYzLPqXd2BBeQVP+QPykqaDTHJ1LjJvWtls6P2U74iGX/Kf\n 2LBmerRw8BdZFJQfUk7oy8xugxV6Ti2fvYNTwfqnxS6eTXT4MF8XdsLXzACaCsZKeWmS\n OSaXIRk/r6G3LAlpBhIoN3Z1ELQ8K3nAYCV+BlYOF+z3bsSXRrI46tqloslzauOhUs4G\n k9G272sa0Py8XHWC1pl9Ol1fFpHkOFkKMqfcue3rBC5DSqvNXjfbS/QapFU7D2TGCZvX\n jqtw==",
        "X-Gm-Message-State": "AOAM5305OeNpis4ZaXnER+HOWtVY6wVKLxj3vbQslCVu+NyhzrOaUU7w\n 5tfhLcIvhgLKcVJVBk4EuYQ7lNmb6jBiG5/hAYESTnuEivYdpm9bjeDP7oEZJvFzLKYirbKKrU7\n DuibjsRdTfYbTnH0NWPX4r+GD9PGPysIsiaHVblbnYS3fGdnOCguSwur5gYEJpvvOzA==",
        "X-Google-Smtp-Source": "\n ABdhPJyVJggUP/8PDsdA3YUhrupChCw+HcQXAnkHWEpOQVZg+hRmp5CfsQNB0aRu6g4tJYPozJu9eQ==",
        "X-Received": "by 2002:a17:90a:8684:: with SMTP id\n p4mr154383pjn.232.1603230945596;\n Tue, 20 Oct 2020 14:55:45 -0700 (PDT)",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jay Ding <jay.ding@broadcom.com>, Farah Smith <farah.smith@broadcom.com>,\n Randy Schacher <stuart.schacher@broadcom.com>",
        "Date": "Tue, 20 Oct 2020 14:55:29 -0700",
        "Message-Id": "<20201020215538.59242-3-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20201020215538.59242-1-ajit.khaparde@broadcom.com>",
        "References": "\n <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com>\n <20201020215538.59242-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "Content-Transfer-Encoding": "8bit",
        "X-Content-Filtered-By": "Mailman/MimeDel 2.1.15",
        "Subject": "[dpdk-dev] [PATCH v2 02/11] net/bnxt: changes to support two table\n\tscopes",
        "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\nNew API to map a PARIF to an EEM table scope (set of Rx and Tx EEM\nbase addresses). It uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure.\nPARIF is handler to a partition of the physical port.\nAdjustments to tf_global_cfg_set() to reduce overhead and nominal\nname clarification.\n\nSigned-off-by: Jay Ding <jay.ding@broadcom.com>\nSigned-off-by: Farah Smith <farah.smith@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/tf_core/tf_core.c       |  54 +++++--\n drivers/net/bnxt/tf_core/tf_core.h       |  55 ++++++-\n drivers/net/bnxt/tf_core/tf_device.h     |  43 +++++-\n drivers/net/bnxt/tf_core/tf_device_p4.c  |  44 ++++++\n drivers/net/bnxt/tf_core/tf_em.h         |  19 ++-\n drivers/net/bnxt/tf_core/tf_em_common.c  | 174 ++++++++++++-----------\n drivers/net/bnxt/tf_core/tf_em_common.h  |  27 +---\n drivers/net/bnxt/tf_core/tf_em_host.c    |  23 ++-\n drivers/net/bnxt/tf_core/tf_global_cfg.c |   4 +-\n drivers/net/bnxt/tf_core/tf_global_cfg.h |  42 ++----\n drivers/net/bnxt/tf_core/tf_msg.c        |  13 +-\n drivers/net/bnxt/tf_core/tf_msg.h        |   4 +-\n 12 files changed, 326 insertions(+), 176 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c\nindex 788335b81..0f49a0025 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.c\n+++ b/drivers/net/bnxt/tf_core/tf_core.c\n@@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp,\n \tint rc = 0;\n \tstruct tf_session *tfs;\n \tstruct tf_dev_info *dev;\n-\tstruct tf_dev_global_cfg_parms gparms = { 0 };\n \n \tTF_CHECK_PARMS2(tfp, parms);\n \n@@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n-\tgparms.dir = parms->dir;\n-\tgparms.type = parms->type;\n-\tgparms.offset = parms->offset;\n-\tgparms.config = parms->config;\n-\tgparms.config_sz_in_bytes = parms->config_sz_in_bytes;\n-\trc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms);\n+\trc = dev->ops->tf_dev_get_global_cfg(tfp, parms);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"%s: Global Cfg get failed, rc:%s\\n\",\n@@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp,\n \tint rc = 0;\n \tstruct tf_session *tfs;\n \tstruct tf_dev_info *dev;\n-\tstruct tf_dev_global_cfg_parms gparms = { 0 };\n \n \tTF_CHECK_PARMS2(tfp, parms);\n \n@@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n-\tgparms.dir = parms->dir;\n-\tgparms.type = parms->type;\n-\tgparms.offset = parms->offset;\n-\tgparms.config = parms->config;\n-\tgparms.config_sz_in_bytes = parms->config_sz_in_bytes;\n-\trc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms);\n+\trc = dev->ops->tf_dev_set_global_cfg(tfp, parms);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"%s: Global Cfg set failed, rc:%s\\n\",\n@@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp,\n \n \treturn rc;\n }\n+int\n+tf_map_tbl_scope(struct tf *tfp,\n+\t\t   struct tf_map_tbl_scope_parms *parms)\n+{\n+\tstruct tf_session *tfs;\n+\tstruct tf_dev_info *dev;\n+\tint rc;\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    \"Failed to lookup session, rc:%s\\n\",\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    \"Failed to lookup device, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tif (dev->ops->tf_dev_map_tbl_scope != NULL) {\n+\t\trc = dev->ops->tf_dev_map_tbl_scope(tfp, parms);\n+\t} else {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Map table scope not supported by device\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn rc;\n+}\n \n int\n tf_free_tbl_scope(struct tf *tfp,\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h\nindex 65be8f54a..fa8ab52af 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.h\n+++ b/drivers/net/bnxt/tf_core/tf_core.h\n@@ -898,7 +898,9 @@ struct tf_alloc_tbl_scope_parms {\n \t */\n \tuint32_t tbl_scope_id;\n };\n-\n+/**\n+ * tf_free_tbl_scope_parms definition\n+ */\n struct tf_free_tbl_scope_parms {\n \t/**\n \t * [in] table scope identifier\n@@ -906,6 +908,21 @@ struct tf_free_tbl_scope_parms {\n \tuint32_t tbl_scope_id;\n };\n \n+/**\n+ * tf_map_tbl_scope_parms definition\n+ */\n+struct tf_map_tbl_scope_parms {\n+\t/**\n+\t * [in] table scope identifier\n+\t */\n+\tuint32_t tbl_scope_id;\n+\t/**\n+\t * [in] Which parifs are associated with this table scope.  Bit 0\n+\t *      indicates parif 0.\n+\t */\n+\tuint16_t parif_bitmask;\n+};\n+\n /**\n  * allocate a table scope\n  *\n@@ -915,13 +932,13 @@ struct tf_free_tbl_scope_parms {\n  * device constraints based upon calculations using either the number of flows\n  * requested or the size of memory indicated.  Other parameters passed in\n  * determine the configuration (maximum key size, maximum external action record\n- * size.\n+ * size).\n  *\n- * This API will allocate the table region in\n- * DRAM, program the PTU page table entries, and program the number of static\n- * buckets (if SR2) in the RX and TX CFAs.  Buckets are assumed to start at\n- * 0 in the EM memory for the scope.  Upon successful completion of this API,\n- * hash tables are fully initialized and ready for entries to be inserted.\n+ * This API will allocate the table region in DRAM, program the PTU page table\n+ * entries, and program the number of static buckets (if SR2) in the RX and TX\n+ * CFAs.  Buckets are assumed to start at 0 in the EM memory for the scope.\n+ * Upon successful completion of this API, hash tables are fully initialized and\n+ * ready for entries to be inserted.\n  *\n  * A single API is used to allocate a common table scope identifier in both\n  * receive and transmit CFA. The scope identifier is common due to nature of\n@@ -944,7 +961,25 @@ struct tf_free_tbl_scope_parms {\n int tf_alloc_tbl_scope(struct tf *tfp,\n \t\t       struct tf_alloc_tbl_scope_parms *parms);\n \n+/**\n+ * map a table scope (legacy device only Wh+/SR)\n+ *\n+ * Map a table scope to one or more partition interfaces (parifs).\n+ * The parif can be remapped in the L2 context lookup for legacy devices.  This\n+ * API allows a number of parifs to be mapped to the same table scope.  On\n+ * legacy devices a table scope identifies one of 16 sets of EEM table base\n+ * addresses and is associated with a PF communication channel.  The associated\n+ * PF must be configured for the table scope to operate.\n+ *\n+ * An L2 context TCAM lookup returns a remapped parif value used to\n+ * index into the set of 16 parif_to_pf registers which are used to map to one\n+ * of the 16 table scopes.  This API allows the user to map the parifs in the\n+ * mask to the previously allocated table scope (EEM table).\n \n+ * Returns success or failure code.\n+ */\n+int tf_map_tbl_scope(struct tf *tfp,\n+\t\t      struct tf_map_tbl_scope_parms *parms);\n /**\n  * free a table scope\n  *\n@@ -1908,6 +1943,12 @@ struct tf_global_cfg_parms {\n \t * get - Read the full configuration\n \t */\n \tuint8_t *config;\n+\t/**\n+\t * [in] Configuration mask\n+\t * set - Read, Modify with mask and Write\n+\t * get - unused\n+\t */\n+\tuint8_t *config_mask;\n \t/**\n \t * [in] struct containing size\n \t */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h\nindex fce7f25a8..cf7c36e0e 100644\n--- a/drivers/net/bnxt/tf_core/tf_device.h\n+++ b/drivers/net/bnxt/tf_core/tf_device.h\n@@ -573,6 +573,45 @@ struct tf_dev_ops {\n \t */\n \tint (*tf_dev_alloc_tbl_scope)(struct tf *tfp,\n \t\t\t\t      struct tf_alloc_tbl_scope_parms *parms);\n+\t/**\n+\t * Map EEM parif\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table scope map parameters\n+\t *\n+\t * [in/out] pointer to the parif_2_pf data to be updated\n+\t *\n+\t * [in/out] pointer to the parif_2_pf mask to be updated\n+\t *\n+\t * [in] sz_in_bytes - number of bytes to be written\n+\t *\n+\t *    returns:\n+\t *    0       - Success\n+\t *    -EINVAL - Error\n+\t */\n+\tint (*tf_dev_map_parif)(struct tf *tfp,\n+\t\t\t\tstruct tf_map_tbl_scope_parms *parms,\n+\t\t\t\tuint8_t *data,\n+\t\t\t\tuint8_t *mask,\n+\t\t\t\tuint16_t sz_in_bytes);\n+\t/**\n+\t * Map EEM table scope\n+\t *\n+\t * [in] tfp\n+\t *   Pointer to TF handle\n+\t *\n+\t * [in] parms\n+\t *   Pointer to table scope map parameters\n+\t *\n+\t *    returns:\n+\t *    0       - Success\n+\t *    -EINVAL - Error\n+\t */\n+\tint (*tf_dev_map_tbl_scope)(struct tf *tfp,\n+\t\t\t\t    struct tf_map_tbl_scope_parms *parms);\n \n \t/**\n \t * Free EEM table scope\n@@ -642,7 +681,7 @@ struct tf_dev_ops {\n \t *    -EINVAL - Error\n \t */\n \tint (*tf_dev_set_global_cfg)(struct tf *tfp,\n-\t\t\t\t     struct tf_dev_global_cfg_parms *parms);\n+\t\t\t\t     struct tf_global_cfg_parms *parms);\n \n \t/**\n \t * Get global cfg\n@@ -658,7 +697,7 @@ struct tf_dev_ops {\n \t *    -EINVAL - Error\n \t */\n \tint (*tf_dev_get_global_cfg)(struct tf *tfp,\n-\t\t\t\t     struct tf_dev_global_cfg_parms *parms);\n+\t\t\t\t     struct tf_global_cfg_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 0344565d7..07c8d02fa 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p4.c\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c\n@@ -12,6 +12,10 @@\n #include \"tf_tcam.h\"\n #include \"tf_em.h\"\n #include \"tf_if_tbl.h\"\n+#include \"tfp.h\"\n+\n+#define TF_DEV_P4_PARIF_MAX 16\n+#define TF_DEV_P4_PF_MASK 0xfUL\n \n /**\n  * Device specific function that retrieves the MAX number of HCAPI\n@@ -97,6 +101,42 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused,\n \treturn 0;\n }\n \n+static int\n+tf_dev_p4_map_parif(struct tf *tfp __rte_unused,\n+\t\t    struct tf_map_tbl_scope_parms *parms,\n+\t\t    uint8_t *data,\n+\t\t    uint8_t *mask,\n+\t\t    uint16_t sz_in_bytes)\n+{\n+\tuint32_t parif_pf[2] = { 0 };\n+\tuint32_t parif_pf_mask[2] = { 0 };\n+\tuint32_t parif;\n+\tuint32_t shift;\n+\tuint32_t scope_id = (uint32_t)(parms->tbl_scope_id);\n+\n+\tif (sz_in_bytes != sizeof(uint64_t))\n+\t\treturn -ENOTSUP;\n+\n+\tfor (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) {\n+\t\tif (parms->parif_bitmask & (1UL << parif)) {\n+\t\t\tif (parif < 8) {\n+\t\t\t\tshift = 4 * parif;\n+\t\t\t\tparif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift;\n+\t\t\t\tparif_pf[0] |= scope_id << shift;\n+\t\t\t} else {\n+\t\t\t\tshift = 4 * (parif - 8);\n+\t\t\t\tparif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift;\n+\t\t\t\tparif_pf[1] |= scope_id << shift;\n+\t\t\t}\n+\t\t}\n+\t}\n+\ttfp_memcpy(data, parif_pf, sz_in_bytes);\n+\ttfp_memcpy(mask, parif_pf_mask, sz_in_bytes);\n+\n+\treturn 0;\n+}\n+\n+\n /**\n  * Truflow P4 device specific functions\n  */\n@@ -125,6 +165,8 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {\n \t.tf_dev_insert_ext_em_entry = NULL,\n \t.tf_dev_delete_ext_em_entry = NULL,\n \t.tf_dev_alloc_tbl_scope = NULL,\n+\t.tf_dev_map_tbl_scope = NULL,\n+\t.tf_dev_map_parif = 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@@ -160,6 +202,8 @@ const struct tf_dev_ops tf_dev_ops_p4 = {\n \t.tf_dev_insert_ext_em_entry = tf_em_insert_ext_entry,\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_map_tbl_scope = tf_em_ext_map_tbl_scope,\n+\t.tf_dev_map_parif = tf_dev_p4_map_parif,\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,\ndiff --git a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h\nindex 51b08138e..8820b28ef 100644\n--- a/drivers/net/bnxt/tf_core/tf_em.h\n+++ b/drivers/net/bnxt/tf_core/tf_em.h\n@@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp,\n \t\t   struct tf_free_tbl_scope_parms *parms);\n \n /**\n- * Common free for external EEM using host or system memory\n+ * Common free table scope for external EEM using host or system memory\n  *\n  * [in] tfp\n  *   Pointer to TruFlow handle\n@@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp,\n \t\t\t  struct tf_free_tbl_scope_parms *parms);\n \n /**\n- * Common alloc for external EEM using host or system memory\n+ * Common alloc table scope for external EEM using host or system memory\n  *\n  * [in] tfp\n  *   Pointer to TruFlow handle\n@@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp,\n  */\n int tf_em_ext_common_alloc(struct tf *tfp,\n \t\t\t   struct tf_alloc_tbl_scope_parms *parms);\n+/**\n+ * Map a set of parifs to a set of EEM base addresses (table scope)\n+ *\n+ * [in] tfp\n+ *   Pointer to TruFlow handle\n+ *\n+ * [in] parms\n+ *   Pointer to input parameters\n+ *\n+ * Returns:\n+ *   0       - Success\n+ *   -EINVAL - Parameter error\n+ */\n+int tf_em_ext_map_tbl_scope(struct tf *tfp,\n+\t\t\t    struct tf_map_tbl_scope_parms *parms);\n \n /**\n  * Allocate External Tbl entry from the scope pool.\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c\nindex 0d8b90871..a6ddb4eaf 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_common.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_common.c\n@@ -44,28 +44,6 @@ static enum tf_mem_type mem_type;\n /** Table scope array */\n struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];\n \n-/** Table scope reversal table\n- *\n- * Table scope are allocated from 15 to 0 within HCAPI RM.  Because of the\n- * association between PFs and legacy table scopes, reverse table scope ids.\n- * 15 indicates 0, 14 indicates 1, etc... The application will only see the 0\n- * based number.  The firmware will only use the 0 based number.  Only HCAPI RM\n- * and Truflow RM believe the number is 15.  When HCAPI RM support allocation\n- * from low to high is supported, this adjust function can be removed.\n- */\n-const uint32_t tbl_scope_reverse[TF_NUM_TBL_SCOPE] = {\n-\t15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };\n-\n-static uint32_t\n-tf_tbl_scope_adjust(uint32_t tbl_scope_id)\n-{\n-\tif (tbl_scope_id < TF_NUM_TBL_SCOPE)\n-\t\treturn tbl_scope_reverse[tbl_scope_id];\n-\telse\n-\t\treturn TF_TBL_SCOPE_INVALID;\n-};\n-\n-\n /* API defined in tf_em.h */\n struct tf_tbl_scope_cb *\n tbl_scope_cb_find(uint32_t tbl_scope_id)\n@@ -73,17 +51,11 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)\n \tint i;\n \tstruct tf_rm_is_allocated_parms parms = { 0 };\n \tint allocated;\n-\tuint32_t rm_tbl_scope_id;\n-\n-\trm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);\n-\n-\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID)\n-\t\treturn NULL;\n \n \t/* Check that id is valid */\n \tparms.rm_db = eem_db[TF_DIR_RX];\n \tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tparms.index = rm_tbl_scope_id;\n+\tparms.index = tbl_scope_id;\n \tparms.allocated = &allocated;\n \n \ti = tf_rm_is_allocated(&parms);\n@@ -99,61 +71,6 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)\n \treturn NULL;\n }\n \n-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id)\n-{\n-\tint rc;\n-\tstruct tf_rm_allocate_parms parms = { 0 };\n-\tuint32_t rm_tbl_scope_id;\n-\tuint32_t usr_tbl_scope_id = TF_TBL_SCOPE_INVALID;\n-\n-\t/* Get Table Scope control block from the session pool */\n-\tparms.rm_db = eem_db[TF_DIR_RX];\n-\tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tparms.index = &rm_tbl_scope_id;\n-\n-\trc = tf_rm_allocate(&parms);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"Failed to allocate table scope rc:%s\\n\",\n-\t\t\t    strerror(-rc));\n-\t\treturn rc;\n-\t}\n-\n-\tusr_tbl_scope_id = tf_tbl_scope_adjust(rm_tbl_scope_id);\n-\n-\tif (usr_tbl_scope_id == TF_TBL_SCOPE_INVALID) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"Invalid table scope allocated id:%d\\n\",\n-\t\t\t    (int)rm_tbl_scope_id);\n-\t\treturn -EINVAL;\n-\t}\n-\t*tbl_scope_id = usr_tbl_scope_id;\n-\treturn 0;\n-};\n-\n-int tf_tbl_scope_free(uint32_t tbl_scope_id)\n-{\n-\tstruct tf_rm_free_parms parms = { 0 };\n-\tuint32_t rm_tbl_scope_id;\n-\tuint32_t rc;\n-\n-\trm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);\n-\n-\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t    \"Invalid table scope allocated id:%d\\n\",\n-\t\t\t    (int)tbl_scope_id);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tparms.rm_db = eem_db[TF_DIR_RX];\n-\tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tparms.index = rm_tbl_scope_id;\n-\n-\trc = tf_rm_free(&parms);\n-\treturn rc;\n-};\n-\n int\n tf_create_tbl_pool_external(enum tf_dir dir,\n \t\t\t    struct tf_tbl_scope_cb *tbl_scope_cb,\n@@ -1129,3 +1046,92 @@ tf_em_ext_common_free(struct tf *tfp,\n {\n \treturn tf_em_ext_free(tfp, parms);\n }\n+\n+int tf_em_ext_map_tbl_scope(struct tf *tfp,\n+\t\t\t    struct tf_map_tbl_scope_parms *parms)\n+{\n+\tint rc = 0;\n+\tstruct tf_session *tfs;\n+\tstruct tf_tbl_scope_cb *tbl_scope_cb;\n+\tstruct tf_global_cfg_parms gcfg_parms = { 0 };\n+\tstruct tfp_calloc_parms aparms;\n+\tuint32_t *data, *mask;\n+\tuint32_t sz_in_bytes = 8;\n+\tstruct tf_dev_info *dev;\n+\n+\ttbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);\n+\n+\tif (tbl_scope_cb == NULL) {\n+\t\tTFP_DRV_LOG(ERR, \"Invalid tbl_scope_cb tbl_scope_id(%d)\\n\",\n+\t\t\t    parms->tbl_scope_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Retrieve the session information */\n+\trc = tf_session_get_session_internal(tfp, &tfs);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Retrieve the device information */\n+\trc = tf_session_get_device(tfs, &dev);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (dev->ops->tf_dev_map_tbl_scope == NULL) {\n+\t\trc = -EOPNOTSUPP;\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Map table scope operation not supported, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\taparms.nitems = 2;\n+\taparms.size = sizeof(uint32_t);\n+\taparms.alignment = 0;\n+\n+\tif (tfp_calloc(&aparms) != 0) {\n+\t\tTFP_DRV_LOG(ERR, \"Map tbl scope alloc data error %s\\n\",\n+\t\t\t    strerror(ENOMEM));\n+\t\treturn -ENOMEM;\n+\t}\n+\tdata = aparms.mem_va;\n+\n+\tif (tfp_calloc(&aparms) != 0) {\n+\t\tTFP_DRV_LOG(ERR, \"Map tbl scope alloc mask error %s\\n\",\n+\t\t\t    strerror(ENOMEM));\n+\t\trc = -ENOMEM;\n+\t\tgoto clean;\n+\t}\n+\tmask = aparms.mem_va;\n+\n+\trc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data,\n+\t\t\t\t\t(uint8_t *)mask, sz_in_bytes);\n+\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Map table scope config failure, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\tgoto cleaner;\n+\t}\n+\n+\tgcfg_parms.type =\n+\t\t(enum tf_global_config_type) TF_GLOBAL_CFG_INTERNAL_PARIF_2_PF;\n+\tgcfg_parms.offset = 0;\n+\tgcfg_parms.config = (uint8_t *)data;\n+\tgcfg_parms.config_mask = (uint8_t *)mask;\n+\tgcfg_parms.config_sz_in_bytes = sizeof(uint64_t);\n+\n+\n+\trc = tf_msg_set_global_cfg(tfp, &gcfg_parms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Map tbl scope, set failed, rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t}\n+cleaner:\n+\ttfp_free(mask);\n+clean:\n+\ttfp_free(data);\n+\n+\treturn rc;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_common.h b/drivers/net/bnxt/tf_core/tf_em_common.h\nindex f71a48767..fa313c458 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_common.h\n+++ b/drivers/net/bnxt/tf_core/tf_em_common.h\n@@ -9,6 +9,7 @@\n #include \"tf_core.h\"\n #include \"tf_session.h\"\n \n+\n /**\n  * Function to search for table scope control block structure\n  * with specified table scope ID.\n@@ -22,32 +23,6 @@\n  */\n struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);\n \n-/**\n- * Table Scope Allocate\n- *\n- * Allocate a table scope\n- *\n- * [in/out] pointer to tbl_scope_id\n- *\n- * Returns:\n- *  0 - success\n- *  -EINVAL - error\n- */\n-int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);\n-\n-/**\n- * Table Scope Free\n- *\n- * Free a table scope\n- *\n- * [in] tbl_scope_id to free\n- *\n- * Returns:\n- *  0 - success\n- *  -EINVAL - error\n- */\n-int tf_tbl_scope_free(uint32_t tbl_scope_id);\n-\n /**\n  * Create and initialize a stack to use for action entries\n  *\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c\nindex cfcb12f3b..b5db94f3e 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_host.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_host.c\n@@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n \tstruct hcapi_cfa_em_table *em_tables;\n \tstruct tf_free_tbl_scope_parms free_parms;\n-\n-\trc = tf_tbl_scope_alloc(&parms->tbl_scope_id);\n+\tstruct tf_rm_allocate_parms aparms = { 0 };\n+\tstruct tf_rm_free_parms fparms = { 0 };\n+\n+\t/* Get Table Scope control block from the session pool */\n+\taparms.rm_db = eem_db[TF_DIR_RX];\n+\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n+\taparms.index = (uint32_t *)&parms->tbl_scope_id;\n+\trc = tf_rm_allocate(&aparms);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to allocate table scope\\n\");\n@@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)\n \treturn -EINVAL;\n \n cleanup:\n-\ttf_tbl_scope_free(parms->tbl_scope_id);\n+\t/* Free Table control block */\n+\tfparms.rm_db = eem_db[TF_DIR_RX];\n+\tfparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n+\tfparms.index = parms->tbl_scope_id;\n+\ttf_rm_free(&fparms);\n \treturn -EINVAL;\n }\n \n@@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp,\n \tint rc = 0;\n \tenum tf_dir  dir;\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n+\tstruct tf_rm_free_parms aparms = { 0 };\n \n \ttbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);\n \n@@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp,\n \t\treturn -EINVAL;\n \t}\n \n-\trc = tf_tbl_scope_free(parms->tbl_scope_id);\n+\t/* Free Table control block */\n+\taparms.rm_db = eem_db[TF_DIR_RX];\n+\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n+\taparms.index = parms->tbl_scope_id;\n+\trc = tf_rm_free(&aparms);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to free table scope\\n\");\ndiff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c\nindex 4ed4039db..ebd1a86ad 100644\n--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c\n+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c\n@@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused)\n \n int\n tf_global_cfg_set(struct tf *tfp,\n-\t\t  struct tf_dev_global_cfg_parms *parms)\n+\t\t  struct tf_global_cfg_parms *parms)\n {\n \tint rc;\n \tstruct tf_global_cfg_get_hcapi_parms hparms;\n@@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp,\n \n int\n tf_global_cfg_get(struct tf *tfp,\n-\t\t  struct tf_dev_global_cfg_parms *parms)\n+\t\t  struct tf_global_cfg_parms *parms)\n \n {\n \tint rc;\ndiff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.h b/drivers/net/bnxt/tf_core/tf_global_cfg.h\nindex 5c73bb115..685f38dc7 100644\n--- a/drivers/net/bnxt/tf_core/tf_global_cfg.h\n+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.h\n@@ -13,7 +13,15 @@\n  * The global cfg module provides processing of global cfg types.\n  */\n \n-struct tf;\n+/* struct tf; */\n+\n+/* Internal type not available to user\n+ * but available internally within Truflow\n+ */\n+enum tf_global_config_internal_type {\n+\tTF_GLOBAL_CFG_INTERNAL_PARIF_2_PF = TF_GLOBAL_CFG_TYPE_MAX,\n+\tTF_GLOBAL_CFG_INTERNAL_TYPE_MAX\n+};\n \n /**\n  * Global cfg configuration enumeration.\n@@ -61,34 +69,6 @@ struct tf_global_cfg_cfg_parms {\n \tstruct tf_global_cfg_cfg *cfg;\n };\n \n-/**\n- * global cfg parameters\n- */\n-struct tf_dev_global_cfg_parms {\n-\t/**\n-\t * [in] Receive or transmit direction\n-\t */\n-\tenum tf_dir dir;\n-\t/**\n-\t * [in] Global config type\n-\t */\n-\tenum tf_global_config_type type;\n-\t/**\n-\t * [in] Offset @ the type\n-\t */\n-\tuint32_t offset;\n-\t/**\n-\t * [in/out] Value of the configuration\n-\t * set - Read, Modify and Write\n-\t * get - Read the full configuration\n-\t */\n-\tuint8_t *config;\n-\t/**\n-\t * [in] struct containing size\n-\t */\n-\tuint16_t config_sz_in_bytes;\n-};\n-\n /**\n  * @page global cfg\n  *\n@@ -149,7 +129,7 @@ tf_global_cfg_unbind(struct tf *tfp);\n  *   - (-EINVAL) on failure.\n  */\n int tf_global_cfg_set(struct tf *tfp,\n-\t\t      struct tf_dev_global_cfg_parms *parms);\n+\t\t      struct tf_global_cfg_parms *parms);\n \n /**\n  * Get global configuration\n@@ -165,6 +145,6 @@ int tf_global_cfg_set(struct tf *tfp,\n  *   - (-EINVAL) on failure.\n  */\n int tf_global_cfg_get(struct tf *tfp,\n-\t\t      struct tf_dev_global_cfg_parms *parms);\n+\t\t      struct tf_global_cfg_parms *parms);\n \n #endif /* TF_GLOBAL_CFG_H */\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c\nindex 7c2ad172f..5615eedbb 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.c\n+++ b/drivers/net/bnxt/tf_core/tf_msg.c\n@@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,\n \n int\n tf_msg_get_global_cfg(struct tf *tfp,\n-\t\t      struct tf_dev_global_cfg_parms *params)\n+\t\t      struct tf_global_cfg_parms *params)\n {\n \tint rc = 0;\n \tstruct tfp_send_msg_parms parms = { 0 };\n@@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp,\n \n int\n tf_msg_set_global_cfg(struct tf *tfp,\n-\t\t      struct tf_dev_global_cfg_parms *params)\n+\t\t      struct tf_global_cfg_parms *params)\n {\n \tint rc = 0;\n \tstruct tfp_send_msg_parms parms = { 0 };\n@@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp,\n \n \ttfp_memcpy(req.data, params->config,\n \t\t   params->config_sz_in_bytes);\n+\n+\t/* Only set mask if pointer is provided\n+\t */\n+\tif (params->config_mask) {\n+\t\ttfp_memcpy(req.data + params->config_sz_in_bytes,\n+\t\t\t   params->config_mask,\n+\t\t\t   params->config_sz_in_bytes);\n+\t}\n+\n \treq.size = tfp_cpu_to_le_32(params->config_sz_in_bytes);\n \n \tparms.tf_type = HWRM_TF_GLOBAL_CFG_SET;\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h\nindex 195710eb8..72bf85048 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.h\n+++ b/drivers/net/bnxt/tf_core/tf_msg.h\n@@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp,\n  *   0 on Success else internal Truflow error\n  */\n int tf_msg_get_global_cfg(struct tf *tfp,\n-\t\t\t  struct tf_dev_global_cfg_parms *params);\n+\t\t\t  struct tf_global_cfg_parms *params);\n \n /**\n  * Sends global cfg update request to Firmware\n@@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp,\n  *   0 on Success else internal Truflow error\n  */\n int tf_msg_set_global_cfg(struct tf *tfp,\n-\t\t\t  struct tf_dev_global_cfg_parms *params);\n+\t\t\t  struct tf_global_cfg_parms *params);\n \n /**\n  * Sends bulk get message of a Table Type element to the firmware.\n",
    "prefixes": [
        "v2",
        "02/11"
    ]
}