get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 72565,
    "url": "http://patches.dpdk.org/api/patches/72565/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200701065212.41391-42-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "http://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-42-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200701065212.41391-42-ajit.khaparde@broadcom.com",
    "date": "2020-07-01T06:52:02",
    "name": "[v2,41/51] net/bnxt: enhancements for port db",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "f9f5339a67f09bf3987ea6611c98455225e79b72",
    "submitter": {
        "id": 501,
        "url": "http://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200701065212.41391-42-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10703,
            "url": "http://patches.dpdk.org/api/series/10703/?format=api",
            "web_url": "http://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": "http://patches.dpdk.org/series/10703/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/72565/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/72565/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 18E75A0350;\n\tWed,  1 Jul 2020 09:02:21 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E8AA31D53B;\n\tWed,  1 Jul 2020 08:53:16 +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 4E5431C0D2\n for <dev@dpdk.org>; Wed,  1 Jul 2020 08:52:30 +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 9A15730C348;\n Tue, 30 Jun 2020 23:52:29 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id 1939214008B;\n Tue, 30 Jun 2020 23:52:29 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 9A15730C348",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1593586349;\n bh=fDMMy0VJTFxPp0t7Jlc8v5BGyMkM8+hwKc+K1OCdslg=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=oLNOwWtVgVIYetJJVIPWU2R/kRMUg7TpcYwdYVRkDGKF23uIvZnl2FyVsPyira7l+\n myHKTivtCmEv4WWb5TfkjyfSatDySjP/Ewi1mBtpr3iiYGt0bp55l6pZafgzJW2iCE\n R/7DSLYLfi62ka88ty1Egm5v21bgvCjTwPRo2MBs=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>,\n Somnath Kotur <somnath.kotur@broadcom.com>",
        "Date": "Tue, 30 Jun 2020 23:52:02 -0700",
        "Message-Id": "<20200701065212.41391-42-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-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 41/51] net/bnxt: enhancements for port db",
        "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: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\n\n1. Add \"enum bnxt_ulp_intf_type” as the second parameter for the\n   port & func helper functions\n2. Return vfrep related port & func information in the helper functions\n3. Allocate phy_port_list dynamically based on port count\n4. Introduce ulp_func_id_tbl array for book keeping func related\n   information indexed by func_id\n\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nSigned-off-by: Somnath Kotur <somnath.kotur@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h                  |  10 +-\n drivers/net/bnxt/bnxt_ethdev.c           |  64 ++++++++--\n drivers/net/bnxt/tf_ulp/bnxt_tf_common.h |   6 +\n drivers/net/bnxt/tf_ulp/bnxt_ulp.c       |   2 +-\n drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c  |   9 +-\n drivers/net/bnxt/tf_ulp/ulp_port_db.c    | 143 +++++++++++++++++------\n drivers/net/bnxt/tf_ulp/ulp_port_db.h    |  56 +++++++--\n drivers/net/bnxt/tf_ulp/ulp_rte_parser.c |  22 +++-\n 8 files changed, 250 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex 43e5e7162..32acced60 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -23,6 +23,7 @@\n \n #include \"tf_core.h\"\n #include \"bnxt_ulp.h\"\n+#include \"bnxt_tf_common.h\"\n \n /* Vendor ID */\n #define PCI_VENDOR_ID_BROADCOM\t\t0x14E4\n@@ -879,10 +880,11 @@ extern const struct rte_flow_ops bnxt_ulp_rte_flow_ops;\n int32_t bnxt_ulp_init(struct bnxt *bp);\n void bnxt_ulp_deinit(struct bnxt *bp);\n \n-uint16_t bnxt_get_vnic_id(uint16_t port);\n-uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);\n-uint16_t bnxt_get_fw_func_id(uint16_t port);\n-uint16_t bnxt_get_parif(uint16_t port);\n+uint16_t bnxt_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type);\n+uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif,\n+\t\t       enum bnxt_ulp_intf_type type);\n+uint16_t bnxt_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type);\n+uint16_t bnxt_get_parif(uint16_t port, enum bnxt_ulp_intf_type type);\n uint16_t bnxt_get_phy_port_id(uint16_t port);\n uint16_t bnxt_get_vport(uint16_t port);\n enum bnxt_ulp_intf_type\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex 355025741..332644d77 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -5067,25 +5067,48 @@ static void bnxt_config_vf_req_fwd(struct bnxt *bp)\n }\n \n uint16_t\n-bnxt_get_svif(uint16_t port_id, bool func_svif)\n+bnxt_get_svif(uint16_t port_id, bool func_svif,\n+\t      enum bnxt_ulp_intf_type type)\n {\n \tstruct rte_eth_dev *eth_dev;\n \tstruct bnxt *bp;\n \n \teth_dev = &rte_eth_devices[port_id];\n+\tif (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {\n+\t\tstruct bnxt_vf_representor *vfr = eth_dev->data->dev_private;\n+\t\tif (!vfr)\n+\t\t\treturn 0;\n+\n+\t\tif (type == BNXT_ULP_INTF_TYPE_VF_REP)\n+\t\t\treturn vfr->svif;\n+\n+\t\teth_dev = vfr->parent_dev;\n+\t}\n+\n \tbp = eth_dev->data->dev_private;\n \n \treturn func_svif ? bp->func_svif : bp->port_svif;\n }\n \n uint16_t\n-bnxt_get_vnic_id(uint16_t port)\n+bnxt_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type)\n {\n \tstruct rte_eth_dev *eth_dev;\n \tstruct bnxt_vnic_info *vnic;\n \tstruct bnxt *bp;\n \n \teth_dev = &rte_eth_devices[port];\n+\tif (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {\n+\t\tstruct bnxt_vf_representor *vfr = eth_dev->data->dev_private;\n+\t\tif (!vfr)\n+\t\t\treturn 0;\n+\n+\t\tif (type == BNXT_ULP_INTF_TYPE_VF_REP)\n+\t\t\treturn vfr->dflt_vnic_id;\n+\n+\t\teth_dev = vfr->parent_dev;\n+\t}\n+\n \tbp = eth_dev->data->dev_private;\n \n \tvnic = BNXT_GET_DEFAULT_VNIC(bp);\n@@ -5094,12 +5117,23 @@ bnxt_get_vnic_id(uint16_t port)\n }\n \n uint16_t\n-bnxt_get_fw_func_id(uint16_t port)\n+bnxt_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type)\n {\n \tstruct rte_eth_dev *eth_dev;\n \tstruct bnxt *bp;\n \n \teth_dev = &rte_eth_devices[port];\n+\tif (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {\n+\t\tstruct bnxt_vf_representor *vfr = eth_dev->data->dev_private;\n+\t\tif (!vfr)\n+\t\t\treturn 0;\n+\n+\t\tif (type == BNXT_ULP_INTF_TYPE_VF_REP)\n+\t\t\treturn vfr->fw_fid;\n+\n+\t\teth_dev = vfr->parent_dev;\n+\t}\n+\n \tbp = eth_dev->data->dev_private;\n \n \treturn bp->fw_fid;\n@@ -5116,8 +5150,14 @@ bnxt_get_interface_type(uint16_t port)\n \t\treturn BNXT_ULP_INTF_TYPE_VF_REP;\n \n \tbp = eth_dev->data->dev_private;\n-\treturn BNXT_PF(bp) ? BNXT_ULP_INTF_TYPE_PF\n-\t\t\t   : BNXT_ULP_INTF_TYPE_VF;\n+\tif (BNXT_PF(bp))\n+\t\treturn BNXT_ULP_INTF_TYPE_PF;\n+\telse if (BNXT_VF_IS_TRUSTED(bp))\n+\t\treturn BNXT_ULP_INTF_TYPE_TRUSTED_VF;\n+\telse if (BNXT_VF(bp))\n+\t\treturn BNXT_ULP_INTF_TYPE_VF;\n+\n+\treturn BNXT_ULP_INTF_TYPE_INVALID;\n }\n \n uint16_t\n@@ -5130,6 +5170,9 @@ bnxt_get_phy_port_id(uint16_t port_id)\n \teth_dev = &rte_eth_devices[port_id];\n \tif (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {\n \t\tvfr = eth_dev->data->dev_private;\n+\t\tif (!vfr)\n+\t\t\treturn 0;\n+\n \t\teth_dev = vfr->parent_dev;\n \t}\n \n@@ -5139,15 +5182,20 @@ bnxt_get_phy_port_id(uint16_t port_id)\n }\n \n uint16_t\n-bnxt_get_parif(uint16_t port_id)\n+bnxt_get_parif(uint16_t port_id, enum bnxt_ulp_intf_type type)\n {\n-\tstruct bnxt_vf_representor *vfr;\n \tstruct rte_eth_dev *eth_dev;\n \tstruct bnxt *bp;\n \n \teth_dev = &rte_eth_devices[port_id];\n \tif (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {\n-\t\tvfr = eth_dev->data->dev_private;\n+\t\tstruct bnxt_vf_representor *vfr = eth_dev->data->dev_private;\n+\t\tif (!vfr)\n+\t\t\treturn 0;\n+\n+\t\tif (type == BNXT_ULP_INTF_TYPE_VF_REP)\n+\t\t\treturn vfr->fw_fid - 1;\n+\n \t\teth_dev = vfr->parent_dev;\n \t}\n \ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h\nindex f772d4919..ebb71405b 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_tf_common.h\n@@ -6,6 +6,11 @@\n #ifndef _BNXT_TF_COMMON_H_\n #define _BNXT_TF_COMMON_H_\n \n+#include <inttypes.h>\n+\n+#include \"bnxt_ulp.h\"\n+#include \"ulp_template_db_enum.h\"\n+\n #define BNXT_TF_DBG(lvl, fmt, args...)\tPMD_DRV_LOG(lvl, fmt, ## args)\n \n #define BNXT_ULP_EM_FLOWS\t\t\t8192\n@@ -48,6 +53,7 @@ enum ulp_direction_type {\n enum bnxt_ulp_intf_type {\n \tBNXT_ULP_INTF_TYPE_INVALID = 0,\n \tBNXT_ULP_INTF_TYPE_PF,\n+\tBNXT_ULP_INTF_TYPE_TRUSTED_VF,\n \tBNXT_ULP_INTF_TYPE_VF,\n \tBNXT_ULP_INTF_TYPE_PF_REP,\n \tBNXT_ULP_INTF_TYPE_VF_REP,\ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\nindex 1b52861d4..e5e7e5f43 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c\n@@ -658,7 +658,7 @@ bnxt_ulp_init(struct bnxt *bp)\n \trc = ulp_dparms_init(bp, bp->ulp_ctx);\n \n \t/* create the port database */\n-\trc = ulp_port_db_init(bp->ulp_ctx);\n+\trc = ulp_port_db_init(bp->ulp_ctx, bp->port_cnt);\n \tif (rc) {\n \t\tBNXT_TF_DBG(ERR, \"Failed to create the port database\\n\");\n \t\tgoto jump_to_error;\ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\nindex 6eb2d6146..138b0b73d 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\n@@ -128,7 +128,8 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,\n \tmapper_cparms.act_prop = &params.act_prop;\n \tmapper_cparms.class_tid = class_id;\n \tmapper_cparms.act_tid = act_tmpl;\n-\tmapper_cparms.func_id = bnxt_get_fw_func_id(dev->data->port_id);\n+\tmapper_cparms.func_id = bnxt_get_fw_func_id(dev->data->port_id,\n+\t\t\t\t\t\t    BNXT_ULP_INTF_TYPE_INVALID);\n \tmapper_cparms.dir = params.dir;\n \n \t/* Call the ulp mapper to create the flow in the hardware. */\n@@ -226,7 +227,8 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,\n \t}\n \n \tflow_id = (uint32_t)(uintptr_t)flow;\n-\tfunc_id = bnxt_get_fw_func_id(dev->data->port_id);\n+\tfunc_id = bnxt_get_fw_func_id(dev->data->port_id,\n+\t\t\t\t      BNXT_ULP_INTF_TYPE_INVALID);\n \n \tif (ulp_flow_db_validate_flow_func(ulp_ctx, flow_id, func_id) ==\n \t    false) {\n@@ -270,7 +272,8 @@ bnxt_ulp_flow_flush(struct rte_eth_dev *eth_dev,\n \tif (ulp_ctx_deinit_allowed(bp)) {\n \t\tret = ulp_flow_db_session_flow_flush(ulp_ctx);\n \t} else if (bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctx)) {\n-\t\tfunc_id = bnxt_get_fw_func_id(eth_dev->data->port_id);\n+\t\tfunc_id = bnxt_get_fw_func_id(eth_dev->data->port_id,\n+\t\t\t\t\t      BNXT_ULP_INTF_TYPE_INVALID);\n \t\tret = ulp_flow_db_function_flow_flush(ulp_ctx, func_id);\n \t}\n \tif (ret)\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c\nindex ea27ef41f..659cefa07 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.c\n@@ -33,7 +33,7 @@ ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)\n  *\n  * Returns 0 on success or negative number on failure.\n  */\n-int32_t\tulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt)\n+int32_t\tulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt, uint8_t port_cnt)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n \n@@ -60,6 +60,18 @@ int32_t\tulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt)\n \t\t\t    \"Failed to allocate mem for port interface list\\n\");\n \t\tgoto error_free;\n \t}\n+\n+\t/* Allocate the phy port list */\n+\tport_db->phy_port_list = rte_zmalloc(\"bnxt_ulp_phy_port_list\",\n+\t\t\t\t\t     port_cnt *\n+\t\t\t\t\t     sizeof(struct ulp_phy_port_info),\n+\t\t\t\t\t     0);\n+\tif (!port_db->phy_port_list) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"Failed to allocate mem for phy port list\\n\");\n+\t\tgoto error_free;\n+\t}\n+\n \treturn 0;\n \n error_free:\n@@ -89,6 +101,7 @@ int32_t\tulp_port_db_deinit(struct bnxt_ulp_context *ulp_ctxt)\n \tbnxt_ulp_cntxt_ptr2_port_db_set(ulp_ctxt, NULL);\n \n \t/* Free up all the memory. */\n+\trte_free(port_db->phy_port_list);\n \trte_free(port_db->ulp_intf_list);\n \trte_free(port_db);\n \treturn 0;\n@@ -110,6 +123,7 @@ int32_t\tulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,\n \tstruct ulp_phy_port_info *port_data;\n \tstruct bnxt_ulp_port_db *port_db;\n \tstruct ulp_interface_info *intf;\n+\tstruct ulp_func_if_info *func;\n \tuint32_t ifindex;\n \tint32_t rc;\n \n@@ -134,20 +148,48 @@ int32_t\tulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,\n \tintf = &port_db->ulp_intf_list[ifindex];\n \n \tintf->type = bnxt_get_interface_type(port_id);\n+\tintf->drv_func_id = bnxt_get_fw_func_id(port_id,\n+\t\t\t\t\t\tBNXT_ULP_INTF_TYPE_INVALID);\n+\n+\tfunc = &port_db->ulp_func_id_tbl[intf->drv_func_id];\n+\tif (!func->func_valid) {\n+\t\tfunc->func_svif = bnxt_get_svif(port_id, true,\n+\t\t\t\t\t\tBNXT_ULP_INTF_TYPE_INVALID);\n+\t\tfunc->func_spif = bnxt_get_phy_port_id(port_id);\n+\t\tfunc->func_parif =\n+\t\t\tbnxt_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);\n+\t\tfunc->func_vnic =\n+\t\t\tbnxt_get_vnic_id(port_id, BNXT_ULP_INTF_TYPE_INVALID);\n+\t\tfunc->phy_port_id = bnxt_get_phy_port_id(port_id);\n+\t\tfunc->func_valid = true;\n+\t}\n \n-\tintf->func_id = bnxt_get_fw_func_id(port_id);\n-\tintf->func_svif = bnxt_get_svif(port_id, 1);\n-\tintf->func_spif = bnxt_get_phy_port_id(port_id);\n-\tintf->func_parif = bnxt_get_parif(port_id);\n-\tintf->default_vnic = bnxt_get_vnic_id(port_id);\n-\tintf->phy_port_id = bnxt_get_phy_port_id(port_id);\n+\tif (intf->type == BNXT_ULP_INTF_TYPE_VF_REP) {\n+\t\tintf->vf_func_id =\n+\t\t\tbnxt_get_fw_func_id(port_id, BNXT_ULP_INTF_TYPE_VF_REP);\n+\n+\t\tfunc = &port_db->ulp_func_id_tbl[intf->vf_func_id];\n+\t\tfunc->func_svif =\n+\t\t\tbnxt_get_svif(port_id, true, BNXT_ULP_INTF_TYPE_VF_REP);\n+\t\tfunc->func_spif =\n+\t\t\tbnxt_get_phy_port_id(port_id);\n+\t\tfunc->func_parif =\n+\t\t\tbnxt_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);\n+\t\tfunc->func_vnic =\n+\t\t\tbnxt_get_vnic_id(port_id, BNXT_ULP_INTF_TYPE_VF_REP);\n+\t\tfunc->phy_port_id = bnxt_get_phy_port_id(port_id);\n+\t}\n \n-\tif (intf->type == BNXT_ULP_INTF_TYPE_PF) {\n-\t\tport_data = &port_db->phy_port_list[intf->phy_port_id];\n-\t\tport_data->port_svif = bnxt_get_svif(port_id, 0);\n+\tport_data = &port_db->phy_port_list[func->phy_port_id];\n+\tif (!port_data->port_valid) {\n+\t\tport_data->port_svif =\n+\t\t\tbnxt_get_svif(port_id, false,\n+\t\t\t\t      BNXT_ULP_INTF_TYPE_INVALID);\n \t\tport_data->port_spif = bnxt_get_phy_port_id(port_id);\n-\t\tport_data->port_parif = bnxt_get_parif(port_id);\n+\t\tport_data->port_parif =\n+\t\t\tbnxt_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);\n \t\tport_data->port_vport = bnxt_get_vport(port_id);\n+\t\tport_data->port_valid = true;\n \t}\n \n \treturn 0;\n@@ -194,6 +236,7 @@ ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,\n int32_t\n ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t\t    uint32_t ifindex,\n+\t\t\t    uint32_t fid_type,\n \t\t\t    uint16_t *func_id)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n@@ -203,7 +246,12 @@ ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\t*func_id =  port_db->ulp_intf_list[ifindex].func_id;\n+\n+\tif (fid_type == BNXT_ULP_DRV_FUNC_FID)\n+\t\t*func_id =  port_db->ulp_intf_list[ifindex].drv_func_id;\n+\telse\n+\t\t*func_id =  port_db->ulp_intf_list[ifindex].vf_func_id;\n+\n \treturn 0;\n }\n \n@@ -212,7 +260,7 @@ ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,\n  *\n  * ulp_ctxt [in] Ptr to ulp context\n  * ifindex [in] ulp ifindex\n- * dir [in] the direction for the flow.\n+ * svif_type [in] the svif type of the given ifindex.\n  * svif [out] the svif of the given ifindex.\n  *\n  * Returns 0 on success or negative number on failure.\n@@ -220,21 +268,27 @@ ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,\n int32_t\n ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t     uint32_t ifindex,\n-\t\t     uint32_t dir,\n+\t\t     uint32_t svif_type,\n \t\t     uint16_t *svif)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n-\tuint16_t phy_port_id;\n+\tuint16_t phy_port_id, func_id;\n \n \tport_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);\n \tif (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\tif (dir == ULP_DIR_EGRESS) {\n-\t\t*svif = port_db->ulp_intf_list[ifindex].func_svif;\n+\n+\tif (svif_type == BNXT_ULP_DRV_FUNC_SVIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\t*svif = port_db->ulp_func_id_tbl[func_id].func_svif;\n+\t} else if (svif_type == BNXT_ULP_VF_FUNC_SVIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].vf_func_id;\n+\t\t*svif = port_db->ulp_func_id_tbl[func_id].func_svif;\n \t} else {\n-\t\tphy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id;\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\tphy_port_id = port_db->ulp_func_id_tbl[func_id].phy_port_id;\n \t\t*svif = port_db->phy_port_list[phy_port_id].port_svif;\n \t}\n \n@@ -246,7 +300,7 @@ ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt,\n  *\n  * ulp_ctxt [in] Ptr to ulp context\n  * ifindex [in] ulp ifindex\n- * dir [in] the direction for the flow.\n+ * spif_type [in] the spif type of the given ifindex.\n  * spif [out] the spif of the given ifindex.\n  *\n  * Returns 0 on success or negative number on failure.\n@@ -254,21 +308,27 @@ ulp_port_db_svif_get(struct bnxt_ulp_context *ulp_ctxt,\n int32_t\n ulp_port_db_spif_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t     uint32_t ifindex,\n-\t\t     uint32_t dir,\n+\t\t     uint32_t spif_type,\n \t\t     uint16_t *spif)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n-\tuint16_t phy_port_id;\n+\tuint16_t phy_port_id, func_id;\n \n \tport_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);\n \tif (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\tif (dir == ULP_DIR_EGRESS) {\n-\t\t*spif = port_db->ulp_intf_list[ifindex].func_spif;\n+\n+\tif (spif_type == BNXT_ULP_DRV_FUNC_SPIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\t*spif = port_db->ulp_func_id_tbl[func_id].func_spif;\n+\t} else if (spif_type == BNXT_ULP_VF_FUNC_SPIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].vf_func_id;\n+\t\t*spif = port_db->ulp_func_id_tbl[func_id].func_spif;\n \t} else {\n-\t\tphy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id;\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\tphy_port_id = port_db->ulp_func_id_tbl[func_id].phy_port_id;\n \t\t*spif = port_db->phy_port_list[phy_port_id].port_spif;\n \t}\n \n@@ -280,7 +340,7 @@ ulp_port_db_spif_get(struct bnxt_ulp_context *ulp_ctxt,\n  *\n  * ulp_ctxt [in] Ptr to ulp context\n  * ifindex [in] ulp ifindex\n- * dir [in] the direction for the flow.\n+ * parif_type [in] the parif type of the given ifindex.\n  * parif [out] the parif of the given ifindex.\n  *\n  * Returns 0 on success or negative number on failure.\n@@ -288,21 +348,26 @@ ulp_port_db_spif_get(struct bnxt_ulp_context *ulp_ctxt,\n int32_t\n ulp_port_db_parif_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t     uint32_t ifindex,\n-\t\t     uint32_t dir,\n+\t\t     uint32_t parif_type,\n \t\t     uint16_t *parif)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n-\tuint16_t phy_port_id;\n+\tuint16_t phy_port_id, func_id;\n \n \tport_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);\n \tif (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\tif (dir == ULP_DIR_EGRESS) {\n-\t\t*parif = port_db->ulp_intf_list[ifindex].func_parif;\n+\tif (parif_type == BNXT_ULP_DRV_FUNC_PARIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\t*parif = port_db->ulp_func_id_tbl[func_id].func_parif;\n+\t} else if (parif_type == BNXT_ULP_VF_FUNC_PARIF) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].vf_func_id;\n+\t\t*parif = port_db->ulp_func_id_tbl[func_id].func_parif;\n \t} else {\n-\t\tphy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id;\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\tphy_port_id = port_db->ulp_func_id_tbl[func_id].phy_port_id;\n \t\t*parif = port_db->phy_port_list[phy_port_id].port_parif;\n \t}\n \n@@ -321,16 +386,26 @@ ulp_port_db_parif_get(struct bnxt_ulp_context *ulp_ctxt,\n int32_t\n ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t\t     uint32_t ifindex,\n+\t\t\t     uint32_t vnic_type,\n \t\t\t     uint16_t *vnic)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n+\tuint16_t func_id;\n \n \tport_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);\n \tif (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\t*vnic = port_db->ulp_intf_list[ifindex].default_vnic;\n+\n+\tif (vnic_type == BNXT_ULP_DRV_FUNC_VNIC) {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\t\t*vnic = port_db->ulp_func_id_tbl[func_id].func_vnic;\n+\t} else {\n+\t\tfunc_id = port_db->ulp_intf_list[ifindex].vf_func_id;\n+\t\t*vnic = port_db->ulp_func_id_tbl[func_id].func_vnic;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -348,14 +423,16 @@ ulp_port_db_vport_get(struct bnxt_ulp_context *ulp_ctxt,\n \t\t      uint32_t ifindex, uint16_t *vport)\n {\n \tstruct bnxt_ulp_port_db *port_db;\n-\tuint16_t phy_port_id;\n+\tuint16_t phy_port_id, func_id;\n \n \tport_db = bnxt_ulp_cntxt_ptr2_port_db_get(ulp_ctxt);\n \tif (!port_db || ifindex >= port_db->ulp_intf_list_size || !ifindex) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n \t\treturn -EINVAL;\n \t}\n-\tphy_port_id = port_db->ulp_intf_list[ifindex].phy_port_id;\n+\n+\tfunc_id = port_db->ulp_intf_list[ifindex].drv_func_id;\n+\tphy_port_id = port_db->ulp_func_id_tbl[func_id].phy_port_id;\n \t*vport = port_db->phy_port_list[phy_port_id].port_vport;\n \treturn 0;\n }\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.h b/drivers/net/bnxt/tf_ulp/ulp_port_db.h\nindex 87de3bcbc..b1419a34c 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.h\n@@ -9,19 +9,54 @@\n #include \"bnxt_ulp.h\"\n \n #define BNXT_PORT_DB_MAX_INTF_LIST\t\t256\n+#define BNXT_PORT_DB_MAX_FUNC\t\t\t2048\n \n-/* Structure for the Port database resource information. */\n-struct ulp_interface_info {\n-\tenum bnxt_ulp_intf_type\ttype;\n-\tuint16_t\t\tfunc_id;\n+enum bnxt_ulp_svif_type {\n+\tBNXT_ULP_DRV_FUNC_SVIF = 0,\n+\tBNXT_ULP_VF_FUNC_SVIF,\n+\tBNXT_ULP_PHY_PORT_SVIF\n+};\n+\n+enum bnxt_ulp_spif_type {\n+\tBNXT_ULP_DRV_FUNC_SPIF = 0,\n+\tBNXT_ULP_VF_FUNC_SPIF,\n+\tBNXT_ULP_PHY_PORT_SPIF\n+};\n+\n+enum bnxt_ulp_parif_type {\n+\tBNXT_ULP_DRV_FUNC_PARIF = 0,\n+\tBNXT_ULP_VF_FUNC_PARIF,\n+\tBNXT_ULP_PHY_PORT_PARIF\n+};\n+\n+enum bnxt_ulp_vnic_type {\n+\tBNXT_ULP_DRV_FUNC_VNIC = 0,\n+\tBNXT_ULP_VF_FUNC_VNIC\n+};\n+\n+enum bnxt_ulp_fid_type {\n+\tBNXT_ULP_DRV_FUNC_FID,\n+\tBNXT_ULP_VF_FUNC_FID\n+};\n+\n+struct ulp_func_if_info {\n+\tuint16_t\t\tfunc_valid;\n \tuint16_t\t\tfunc_svif;\n \tuint16_t\t\tfunc_spif;\n \tuint16_t\t\tfunc_parif;\n-\tuint16_t\t\tdefault_vnic;\n+\tuint16_t\t\tfunc_vnic;\n \tuint16_t\t\tphy_port_id;\n };\n \n+/* Structure for the Port database resource information. */\n+struct ulp_interface_info {\n+\tenum bnxt_ulp_intf_type\ttype;\n+\tuint16_t\t\tdrv_func_id;\n+\tuint16_t\t\tvf_func_id;\n+};\n+\n struct ulp_phy_port_info {\n+\tuint16_t\tport_valid;\n \tuint16_t\tport_svif;\n \tuint16_t\tport_spif;\n \tuint16_t\tport_parif;\n@@ -35,7 +70,8 @@ struct bnxt_ulp_port_db {\n \n \t/* dpdk device external port list */\n \tuint16_t\t\t\tdev_port_list[RTE_MAX_ETHPORTS];\n-\tstruct ulp_phy_port_info\tphy_port_list[RTE_MAX_ETHPORTS];\n+\tstruct ulp_phy_port_info\t*phy_port_list;\n+\tstruct ulp_func_if_info\t\tulp_func_id_tbl[BNXT_PORT_DB_MAX_FUNC];\n };\n \n /*\n@@ -46,7 +82,7 @@ struct bnxt_ulp_port_db {\n  *\n  * Returns 0 on success or negative number on failure.\n  */\n-int32_t\tulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt);\n+int32_t\tulp_port_db_init(struct bnxt_ulp_context *ulp_ctxt, uint8_t port_cnt);\n \n /*\n  * Deinitialize the port database. Memory is deallocated in\n@@ -94,7 +130,8 @@ ulp_port_db_dev_port_to_ulp_index(struct bnxt_ulp_context *ulp_ctxt,\n  */\n int32_t\n ulp_port_db_function_id_get(struct bnxt_ulp_context *ulp_ctxt,\n-\t\t\t    uint32_t ifindex, uint16_t *func_id);\n+\t\t\t    uint32_t ifindex, uint32_t fid_type,\n+\t\t\t    uint16_t *func_id);\n \n /*\n  * Api to get the svif for a given ulp ifindex.\n@@ -150,7 +187,8 @@ ulp_port_db_parif_get(struct bnxt_ulp_context *ulp_ctxt,\n  */\n int32_t\n ulp_port_db_default_vnic_get(struct bnxt_ulp_context *ulp_ctxt,\n-\t\t\t     uint32_t ifindex, uint16_t *vnic);\n+\t\t\t     uint32_t ifindex, uint32_t vnic_type,\n+\t\t\t     uint16_t *vnic);\n \n /*\n  * Api to get the vport id for a given ulp ifindex.\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c\nindex 8fffaecce..073b3537f 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c\n@@ -166,6 +166,8 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,\n \tuint16_t port_id = svif;\n \tuint32_t dir = 0;\n \tstruct ulp_rte_hdr_field *hdr_field;\n+\tenum bnxt_ulp_svif_type svif_type;\n+\tenum bnxt_ulp_intf_type if_type;\n \tuint32_t ifindex;\n \tint32_t rc;\n \n@@ -187,7 +189,18 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,\n \t\t\t\t    \"Invalid port id\\n\");\n \t\t\treturn BNXT_TF_RC_ERROR;\n \t\t}\n-\t\tulp_port_db_svif_get(params->ulp_ctx, ifindex, dir, &svif);\n+\n+\t\tif (dir == ULP_DIR_INGRESS) {\n+\t\t\tsvif_type = BNXT_ULP_PHY_PORT_SVIF;\n+\t\t} else {\n+\t\t\tif_type = bnxt_get_interface_type(port_id);\n+\t\t\tif (if_type == BNXT_ULP_INTF_TYPE_VF_REP)\n+\t\t\t\tsvif_type = BNXT_ULP_VF_FUNC_SVIF;\n+\t\t\telse\n+\t\t\t\tsvif_type = BNXT_ULP_DRV_FUNC_SVIF;\n+\t\t}\n+\t\tulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type,\n+\t\t\t\t     &svif);\n \t\tsvif = rte_cpu_to_be_16(svif);\n \t}\n \thdr_field = &params->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];\n@@ -1256,7 +1269,7 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused,\n \n \t/* copy the PF of the current device into VNIC Property */\n \tsvif = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_INCOMING_IF);\n-\tsvif = bnxt_get_vnic_id(svif);\n+\tsvif = bnxt_get_vnic_id(svif, BNXT_ULP_INTF_TYPE_INVALID);\n \tsvif = rte_cpu_to_be_32(svif);\n \tmemcpy(&params->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC],\n \t       &svif, BNXT_ULP_ACT_PROP_SZ_VNIC);\n@@ -1280,7 +1293,8 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,\n \t\t\treturn BNXT_TF_RC_PARSE_ERR;\n \t\t}\n \t\t/* TBD: Update the computed VNIC using VF conversion */\n-\t\tpid = bnxt_get_vnic_id(vf_action->id);\n+\t\tpid = bnxt_get_vnic_id(vf_action->id,\n+\t\t\t\t       BNXT_ULP_INTF_TYPE_INVALID);\n \t\tpid = rte_cpu_to_be_32(pid);\n \t\tmemcpy(&param->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC],\n \t\t       &pid, BNXT_ULP_ACT_PROP_SZ_VNIC);\n@@ -1307,7 +1321,7 @@ ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item,\n \t\t\treturn BNXT_TF_RC_PARSE_ERR;\n \t\t}\n \t\t/* TBD: Update the computed VNIC using port conversion */\n-\t\tpid = bnxt_get_vnic_id(port_id->id);\n+\t\tpid = bnxt_get_vnic_id(port_id->id, BNXT_ULP_INTF_TYPE_INVALID);\n \t\tpid = rte_cpu_to_be_32(pid);\n \t\tmemcpy(&param->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC],\n \t\t       &pid, BNXT_ULP_ACT_PROP_SZ_VNIC);\n",
    "prefixes": [
        "v2",
        "41/51"
    ]
}