get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73093,
    "url": "https://patches.dpdk.org/api/patches/73093/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200703210210.40568-45-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200703210210.40568-45-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200703210210.40568-45-ajit.khaparde@broadcom.com",
    "date": "2020-07-03T21:02:03",
    "name": "[v5,44/51] net/bnxt: fill mapper parameters with default rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3b529a497fa0dd528f8cb81a5044f2bd2e151fe0",
    "submitter": {
        "id": 501,
        "url": "https://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "https://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200703210210.40568-45-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10785,
            "url": "https://patches.dpdk.org/api/series/10785/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10785",
            "date": "2020-07-03T21:01:19",
            "name": "net/bnxt: add features for host-based flow management",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/10785/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73093/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/73093/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 B7619A0524;\n\tFri,  3 Jul 2020 23:12:49 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 18C711DDA6;\n\tFri,  3 Jul 2020 23:06:11 +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 A1F131DC92\n for <dev@dpdk.org>; Fri,  3 Jul 2020 23:05:12 +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 A1DCF30C03F;\n Fri,  3 Jul 2020 14:05:11 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id 10F71140402;\n Fri,  3 Jul 2020 14:05:11 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com A1DCF30C03F",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1593810311;\n bh=aDgu+MAfCzF24isGuBvcKsEB8Rb/GsVHAcHMAXS1NEE=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=eYyPdYYM25GKqqNNXRYi3/irilJ2155eTK5xb4/1+IPb3FdQtfDklDg4tYp1+DUaz\n i7NFYK90n7k0g9G1zZhYPNRdSZJSQgBlUVSQ6sCzKn0/syAd/ODNMxVtOWiaAjrcKF\n FNsJ8LjfGRBiAruUDXh2J82HfC+xAkCvLIm5QMsw=",
        "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": "Fri,  3 Jul 2020 14:02:03 -0700",
        "Message-Id": "<20200703210210.40568-45-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20200703210210.40568-1-ajit.khaparde@broadcom.com>",
        "References": "<1f5421dc-0453-6dc8-09c2-ddfff6eb4888@intel.com>\n <20200703210210.40568-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v5 44/51] net/bnxt: fill mapper parameters with\n\tdefault rules",
        "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\nDefault rules are needed for the packets to be punted between the\nfollowing entities in the non-offloaded path\n1. Device PORT to DPDK App\n2. DPDK App to Device PORT\n3. VF Representor to VF\n4. VF to VF Representor\n\nThis patch fills all the relevant information in the computed fields\n& the act_prop fields for the flow mapper to create the necessary\ntables in the hardware to enable the default rules.\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_ethdev.c                |   6 +-\n drivers/net/bnxt/meson.build                  |   1 +\n drivers/net/bnxt/tf_ulp/Makefile              |   1 +\n drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |  24 ++\n drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  30 +-\n drivers/net/bnxt/tf_ulp/ulp_def_rules.c       | 385 ++++++++++++++++++\n drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  10 +-\n drivers/net/bnxt/tf_ulp/ulp_mapper.h          |   3 +-\n .../net/bnxt/tf_ulp/ulp_template_db_enum.h    |   5 +\n 9 files changed, 444 insertions(+), 21 deletions(-)\n create mode 100644 drivers/net/bnxt/tf_ulp/ulp_def_rules.c",
    "diff": "diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex bf9f8fda1..678aa20e7 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -1274,9 +1274,6 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)\n \tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n \tstruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;\n \n-\tif (BNXT_TRUFLOW_EN(bp))\n-\t\tbnxt_ulp_deinit(bp);\n-\n \teth_dev->data->dev_started = 0;\n \t/* Prevent crashes when queues are still in use */\n \teth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;\n@@ -1332,6 +1329,9 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)\n \trte_eal_alarm_cancel(bnxt_dev_recover, (void *)bp);\n \tbnxt_cancel_fc_thread(bp);\n \n+\tif (BNXT_TRUFLOW_EN(bp))\n+\t\tbnxt_ulp_deinit(bp);\n+\n \tif (eth_dev->data->dev_started)\n \t\tbnxt_dev_stop_op(eth_dev);\n \ndiff --git a/drivers/net/bnxt/meson.build b/drivers/net/bnxt/meson.build\nindex 8f6ed419e..2939857ca 100644\n--- a/drivers/net/bnxt/meson.build\n+++ b/drivers/net/bnxt/meson.build\n@@ -61,6 +61,7 @@ sources = files('bnxt_cpr.c',\n \t'tf_ulp/ulp_rte_parser.c',\n \t'tf_ulp/bnxt_ulp_flow.c',\n \t'tf_ulp/ulp_port_db.c',\n+\t'tf_ulp/ulp_def_rules.c',\n \n \t'rte_pmd_bnxt.c')\n \ndiff --git a/drivers/net/bnxt/tf_ulp/Makefile b/drivers/net/bnxt/tf_ulp/Makefile\nindex 57341f876..3f1b43bae 100644\n--- a/drivers/net/bnxt/tf_ulp/Makefile\n+++ b/drivers/net/bnxt/tf_ulp/Makefile\n@@ -16,3 +16,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/bnxt_ulp.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_mark_mgr.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_flow_db.c\n SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_port_db.c\n+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += tf_ulp/ulp_def_rules.c\ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\nindex eecc09cea..3563f63fa 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h\n@@ -12,6 +12,8 @@\n \n #include \"rte_ethdev.h\"\n \n+#include \"ulp_template_db_enum.h\"\n+\n struct bnxt_ulp_data {\n \tuint32_t\t\t\ttbl_scope_id;\n \tstruct bnxt_ulp_mark_tbl\t*mark_tbl;\n@@ -49,6 +51,12 @@ struct rte_tf_flow {\n \tuint32_t\tflow_id;\n };\n \n+struct ulp_tlv_param {\n+\tenum bnxt_ulp_df_param_type type;\n+\tuint32_t length;\n+\tuint8_t value[16];\n+};\n+\n /*\n  * Allow the deletion of context only for the bnxt device that\n  * created the session\n@@ -127,4 +135,20 @@ bnxt_ulp_cntxt_ptr2_port_db_set(struct bnxt_ulp_context\t*ulp_ctx,\n struct bnxt_ulp_port_db *\n bnxt_ulp_cntxt_ptr2_port_db_get(struct bnxt_ulp_context\t*ulp_ctx);\n \n+/* Function to create default flows. */\n+int32_t\n+ulp_default_flow_create(struct rte_eth_dev *eth_dev,\n+\t\t\tstruct ulp_tlv_param *param_list,\n+\t\t\tuint32_t ulp_class_tid,\n+\t\t\tuint32_t *flow_id);\n+\n+/* Function to destroy default flows. */\n+int32_t\n+ulp_default_flow_destroy(struct rte_eth_dev *eth_dev,\n+\t\t\t uint32_t flow_id);\n+\n+int\n+bnxt_ulp_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,\n+\t\t      struct rte_flow_error *error);\n+\n #endif /* _BNXT_ULP_H_ */\ndiff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\nindex 138b0b73d..7ef306e58 100644\n--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\n+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c\n@@ -207,7 +207,7 @@ bnxt_ulp_flow_validate(struct rte_eth_dev *dev,\n }\n \n /* Function to destroy the rte flow. */\n-static int\n+int\n bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,\n \t\t      struct rte_flow *flow,\n \t\t      struct rte_flow_error *error)\n@@ -220,9 +220,10 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,\n \tulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);\n \tif (!ulp_ctx) {\n \t\tBNXT_TF_DBG(ERR, \"ULP context is not initialized\\n\");\n-\t\trte_flow_error_set(error, EINVAL,\n-\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n-\t\t\t\t   \"Failed to destroy flow.\");\n+\t\tif (error)\n+\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t\t   \"Failed to destroy flow.\");\n \t\treturn -EINVAL;\n \t}\n \n@@ -233,17 +234,22 @@ bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,\n \tif (ulp_flow_db_validate_flow_func(ulp_ctx, flow_id, func_id) ==\n \t    false) {\n \t\tBNXT_TF_DBG(ERR, \"Incorrect device params\\n\");\n-\t\trte_flow_error_set(error, EINVAL,\n-\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n-\t\t\t\t   \"Failed to destroy flow.\");\n+\t\tif (error)\n+\t\t\trte_flow_error_set(error, EINVAL,\n+\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t\t   \"Failed to destroy flow.\");\n \t\treturn -EINVAL;\n \t}\n \n-\tret = ulp_mapper_flow_destroy(ulp_ctx, flow_id);\n-\tif (ret)\n-\t\trte_flow_error_set(error, -ret,\n-\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n-\t\t\t\t   \"Failed to destroy flow.\");\n+\tret = ulp_mapper_flow_destroy(ulp_ctx, flow_id,\n+\t\t\t\t      BNXT_ULP_REGULAR_FLOW_TABLE);\n+\tif (ret) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to destroy flow.\\n\");\n+\t\tif (error)\n+\t\t\trte_flow_error_set(error, -ret,\n+\t\t\t\t\t   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n+\t\t\t\t\t   \"Failed to destroy flow.\");\n+\t}\n \n \treturn ret;\n }\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c\nnew file mode 100644\nindex 000000000..46b558f31\n--- /dev/null\n+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c\n@@ -0,0 +1,385 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2019-2020 Broadcom\n+ * All rights reserved.\n+ */\n+\n+#include \"bnxt_tf_common.h\"\n+#include \"ulp_template_struct.h\"\n+#include \"ulp_template_db_enum.h\"\n+#include \"ulp_template_db_field.h\"\n+#include \"ulp_utils.h\"\n+#include \"ulp_port_db.h\"\n+#include \"ulp_flow_db.h\"\n+#include \"ulp_mapper.h\"\n+\n+struct bnxt_ulp_def_param_handler {\n+\tint32_t (*vfr_func)(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t    struct ulp_tlv_param *param,\n+\t\t\t    struct bnxt_ulp_mapper_create_parms *mapper_params);\n+};\n+\n+static int32_t\n+ulp_set_svif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t uint32_t  ifindex, uint8_t svif_type,\n+\t\t\t struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t svif;\n+\tuint8_t idx;\n+\tint rc;\n+\n+\trc = ulp_port_db_svif_get(ulp_ctx, ifindex, svif_type, &svif);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (svif_type == BNXT_ULP_PHY_PORT_SVIF)\n+\t\tidx = BNXT_ULP_CF_IDX_PHY_PORT_SVIF;\n+\telse if (svif_type == BNXT_ULP_DRV_FUNC_SVIF)\n+\t\tidx = BNXT_ULP_CF_IDX_DRV_FUNC_SVIF;\n+\telse\n+\t\tidx = BNXT_ULP_CF_IDX_VF_FUNC_SVIF;\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, idx, svif);\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_spif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t uint32_t  ifindex, uint8_t spif_type,\n+\t\t\t struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t spif;\n+\tuint8_t idx;\n+\tint rc;\n+\n+\trc = ulp_port_db_spif_get(ulp_ctx, ifindex, spif_type, &spif);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (spif_type == BNXT_ULP_PHY_PORT_SPIF)\n+\t\tidx = BNXT_ULP_CF_IDX_PHY_PORT_SPIF;\n+\telse if (spif_type == BNXT_ULP_DRV_FUNC_SPIF)\n+\t\tidx = BNXT_ULP_CF_IDX_DRV_FUNC_SPIF;\n+\telse\n+\t\tidx = BNXT_ULP_CF_IDX_VF_FUNC_SPIF;\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, idx, spif);\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_parif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t  uint32_t  ifindex, uint8_t parif_type,\n+\t\t\t  struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t parif;\n+\tuint8_t idx;\n+\tint rc;\n+\n+\trc = ulp_port_db_parif_get(ulp_ctx, ifindex, parif_type, &parif);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (parif_type == BNXT_ULP_PHY_PORT_PARIF)\n+\t\tidx = BNXT_ULP_CF_IDX_PHY_PORT_PARIF;\n+\telse if (parif_type == BNXT_ULP_DRV_FUNC_PARIF)\n+\t\tidx = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF;\n+\telse\n+\t\tidx = BNXT_ULP_CF_IDX_VF_FUNC_PARIF;\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, idx, parif);\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_vport_in_comp_fld(struct bnxt_ulp_context *ulp_ctx, uint32_t ifindex,\n+\t\t\t  struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t vport;\n+\tint rc;\n+\n+\trc = ulp_port_db_vport_get(ulp_ctx, ifindex, &vport);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, BNXT_ULP_CF_IDX_PHY_PORT_VPORT,\n+\t\t\t    vport);\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_vnic_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t uint32_t  ifindex, uint8_t vnic_type,\n+\t\t\t struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t vnic;\n+\tuint8_t idx;\n+\tint rc;\n+\n+\trc = ulp_port_db_default_vnic_get(ulp_ctx, ifindex, vnic_type, &vnic);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tif (vnic_type == BNXT_ULP_DRV_FUNC_VNIC)\n+\t\tidx = BNXT_ULP_CF_IDX_DRV_FUNC_VNIC;\n+\telse\n+\t\tidx = BNXT_ULP_CF_IDX_VF_FUNC_VNIC;\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, idx, vnic);\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_vlan_in_act_prop(uint16_t port_id,\n+\t\t\t struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tstruct ulp_rte_act_prop *act_prop = mapper_params->act_prop;\n+\n+\tif (ULP_BITMAP_ISSET(mapper_params->act->bits,\n+\t\t\t     BNXT_ULP_ACTION_BIT_SET_VLAN_VID)) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"VLAN already set, multiple VLANs unsupported\\n\");\n+\t\treturn BNXT_TF_RC_ERROR;\n+\t}\n+\n+\tport_id = rte_cpu_to_be_16(port_id);\n+\n+\tULP_BITMAP_SET(mapper_params->act->bits,\n+\t\t       BNXT_ULP_ACTION_BIT_SET_VLAN_VID);\n+\n+\tmemcpy(&act_prop->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG],\n+\t       &port_id, sizeof(port_id));\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_set_mark_in_act_prop(uint16_t port_id,\n+\t\t\t struct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tif (ULP_BITMAP_ISSET(mapper_params->act->bits,\n+\t\t\t     BNXT_ULP_ACTION_BIT_MARK)) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t    \"MARK already set, multiple MARKs unsupported\\n\");\n+\t\treturn BNXT_TF_RC_ERROR;\n+\t}\n+\n+\tULP_COMP_FLD_IDX_WR(mapper_params, BNXT_ULP_CF_IDX_DEV_PORT_ID,\n+\t\t\t    port_id);\n+\n+\treturn 0;\n+}\n+\n+static int32_t\n+ulp_df_dev_port_handler(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\tstruct ulp_tlv_param *param,\n+\t\t\tstruct bnxt_ulp_mapper_create_parms *mapper_params)\n+{\n+\tuint16_t port_id;\n+\tuint32_t ifindex;\n+\tint rc;\n+\n+\tport_id = param->value[0] | param->value[1];\n+\n+\trc = ulp_port_db_dev_port_to_ulp_index(ulp_ctx, port_id, &ifindex);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR,\n+\t\t\t\t\"Invalid port id\\n\");\n+\t\treturn BNXT_TF_RC_ERROR;\n+\t}\n+\n+\t/* Set port SVIF */\n+\trc = ulp_set_svif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_PHY_PORT_SVIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set DRV Func SVIF */\n+\trc = ulp_set_svif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_DRV_FUNC_SVIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VF Func SVIF */\n+\trc = ulp_set_svif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_VF_FUNC_SVIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set port SPIF */\n+\trc = ulp_set_spif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_PHY_PORT_SPIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set DRV Func SPIF */\n+\trc = ulp_set_spif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_DRV_FUNC_SPIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VF Func SPIF */\n+\trc = ulp_set_spif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_DRV_FUNC_SPIF,\n+\t\t\t\t      mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set port PARIF */\n+\trc = ulp_set_parif_in_comp_fld(ulp_ctx, ifindex,\n+\t\t\t\t       BNXT_ULP_PHY_PORT_PARIF, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set DRV Func PARIF */\n+\trc = ulp_set_parif_in_comp_fld(ulp_ctx, ifindex,\n+\t\t\t\t       BNXT_ULP_DRV_FUNC_PARIF, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VF Func PARIF */\n+\trc = ulp_set_parif_in_comp_fld(ulp_ctx, ifindex, BNXT_ULP_VF_FUNC_PARIF,\n+\t\t\t\t       mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set uplink VNIC */\n+\trc = ulp_set_vnic_in_comp_fld(ulp_ctx, ifindex, true, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VF VNIC */\n+\trc = ulp_set_vnic_in_comp_fld(ulp_ctx, ifindex, false, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VPORT */\n+\trc = ulp_set_vport_in_comp_fld(ulp_ctx, ifindex, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set VLAN */\n+\trc = ulp_set_vlan_in_act_prop(port_id, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Set MARK */\n+\trc = ulp_set_mark_in_act_prop(port_id, mapper_params);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\treturn 0;\n+}\n+\n+struct bnxt_ulp_def_param_handler ulp_def_handler_tbl[] = {\n+\t[BNXT_ULP_DF_PARAM_TYPE_DEV_PORT_ID] = {\n+\t\t\t.vfr_func = ulp_df_dev_port_handler }\n+};\n+\n+/*\n+ * Function to create default rules for the following paths\n+ * 1) Device PORT to DPDK App\n+ * 2) DPDK App to Device PORT\n+ * 3) VF Representor to VF\n+ * 4) VF to VF Representor\n+ *\n+ * eth_dev [in] Ptr to rte eth device.\n+ * param_list [in] Ptr to a list of parameters (Currently, only DPDK port_id).\n+ * ulp_class_tid [in] Class template ID number.\n+ * flow_id [out] Ptr to flow identifier.\n+ *\n+ * Returns 0 on success or negative number on failure.\n+ */\n+int32_t\n+ulp_default_flow_create(struct rte_eth_dev *eth_dev,\n+\t\t\tstruct ulp_tlv_param *param_list,\n+\t\t\tuint32_t ulp_class_tid,\n+\t\t\tuint32_t *flow_id)\n+{\n+\tstruct ulp_rte_hdr_field\thdr_field[BNXT_ULP_PROTO_HDR_MAX];\n+\tuint32_t\t\t\tcomp_fld[BNXT_ULP_CF_IDX_LAST];\n+\tstruct bnxt_ulp_mapper_create_parms mapper_params = { 0 };\n+\tstruct ulp_rte_act_prop\t\tact_prop;\n+\tstruct ulp_rte_act_bitmap\tact = { 0 };\n+\tstruct bnxt_ulp_context\t\t*ulp_ctx;\n+\tuint32_t type;\n+\tint rc;\n+\n+\tmemset(&mapper_params, 0, sizeof(mapper_params));\n+\tmemset(hdr_field, 0, sizeof(hdr_field));\n+\tmemset(comp_fld, 0, sizeof(comp_fld));\n+\tmemset(&act_prop, 0, sizeof(act_prop));\n+\n+\tmapper_params.hdr_field = hdr_field;\n+\tmapper_params.act = &act;\n+\tmapper_params.act_prop = &act_prop;\n+\tmapper_params.comp_fld = comp_fld;\n+\n+\tulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(eth_dev);\n+\tif (!ulp_ctx) {\n+\t\tBNXT_TF_DBG(ERR, \"ULP context is not initialized. \"\n+\t\t\t\t \"Failed to create default flow.\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ttype = param_list->type;\n+\twhile (type != BNXT_ULP_DF_PARAM_TYPE_LAST) {\n+\t\tif (ulp_def_handler_tbl[type].vfr_func) {\n+\t\t\trc = ulp_def_handler_tbl[type].vfr_func(ulp_ctx,\n+\t\t\t\t\t\t\t\tparam_list,\n+\t\t\t\t\t\t\t\t&mapper_params);\n+\t\t\tif (rc) {\n+\t\t\t\tBNXT_TF_DBG(ERR,\n+\t\t\t\t\t    \"Failed to create default flow.\\n\");\n+\t\t\t\treturn rc;\n+\t\t\t}\n+\t\t}\n+\n+\t\tparam_list++;\n+\t\ttype = param_list->type;\n+\t}\n+\n+\tmapper_params.class_tid = ulp_class_tid;\n+\n+\trc = ulp_mapper_flow_create(ulp_ctx, &mapper_params, flow_id);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"Failed to create default flow.\\n\");\n+\t\treturn rc;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Function to destroy default rules for the following paths\n+ * 1) Device PORT to DPDK App\n+ * 2) DPDK App to Device PORT\n+ * 3) VF Representor to VF\n+ * 4) VF to VF Representor\n+ *\n+ * eth_dev [in] Ptr to rte eth device.\n+ * flow_id [in] Flow identifier.\n+ *\n+ * Returns 0 on success or negative number on failure.\n+ */\n+int32_t\n+ulp_default_flow_destroy(struct rte_eth_dev *eth_dev, uint32_t flow_id)\n+{\n+\tstruct bnxt_ulp_context *ulp_ctx;\n+\tint rc;\n+\n+\tulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(eth_dev);\n+\tif (!ulp_ctx) {\n+\t\tBNXT_TF_DBG(ERR, \"ULP context is not initialized\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\trc = ulp_mapper_flow_destroy(ulp_ctx, flow_id,\n+\t\t\t\t     BNXT_ULP_DEFAULT_FLOW_TABLE);\n+\tif (rc)\n+\t\tBNXT_TF_DBG(ERR, \"Failed to destroy flow.\\n\");\n+\n+\treturn rc;\n+}\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\nindex d0931d411..e39398a1b 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n@@ -2274,16 +2274,15 @@ ulp_mapper_glb_resource_info_deinit(struct bnxt_ulp_context *ulp_ctx,\n }\n \n int32_t\n-ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid)\n+ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid,\n+\t\t\tenum bnxt_ulp_flow_db_tables flow_tbl_type)\n {\n \tif (!ulp_ctx) {\n \t\tBNXT_TF_DBG(ERR, \"Invalid parms, unable to free flow\\n\");\n \t\treturn -EINVAL;\n \t}\n \n-\treturn ulp_mapper_resources_free(ulp_ctx,\n-\t\t\t\t\t fid,\n-\t\t\t\t\t BNXT_ULP_REGULAR_FLOW_TABLE);\n+\treturn ulp_mapper_resources_free(ulp_ctx, fid, flow_tbl_type);\n }\n \n /* Function to handle the default global templates that are allocated during\n@@ -2486,7 +2485,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,\n \n flow_error:\n \t/* Free all resources that were allocated during flow creation */\n-\ttrc = ulp_mapper_flow_destroy(ulp_ctx, parms.fid);\n+\ttrc = ulp_mapper_flow_destroy(ulp_ctx, parms.fid,\n+\t\t\t\t      BNXT_ULP_REGULAR_FLOW_TABLE);\n \tif (trc)\n \t\tBNXT_TF_DBG(ERR, \"Failed to free all resources rc=%d\\n\", trc);\n \ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\nindex 19134830a..b35065449 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h\n@@ -109,7 +109,8 @@ ulp_mapper_flow_create(struct bnxt_ulp_context\t*ulp_ctx,\n \n /* Function that frees all resources associated with the flow. */\n int32_t\n-ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid);\n+ulp_mapper_flow_destroy(struct bnxt_ulp_context\t*ulp_ctx, uint32_t fid,\n+\t\t\tenum bnxt_ulp_flow_db_tables flow_tbl_type);\n \n /*\n  * Function that frees all resources and can be called on default or regular\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\nindex 27628a510..2346797db 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h\n@@ -145,6 +145,11 @@ enum bnxt_ulp_device_id {\n \tBNXT_ULP_DEVICE_ID_LAST = 4\n };\n \n+enum bnxt_ulp_df_param_type {\n+\tBNXT_ULP_DF_PARAM_TYPE_DEV_PORT_ID = 0,\n+\tBNXT_ULP_DF_PARAM_TYPE_LAST = 1\n+};\n+\n enum bnxt_ulp_direction {\n \tBNXT_ULP_DIRECTION_INGRESS = 0,\n \tBNXT_ULP_DIRECTION_EGRESS = 1,\n",
    "prefixes": [
        "v5",
        "44/51"
    ]
}