Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/93553/?format=api
http://patches.dpdk.org/api/patches/93553/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210530085929.29695-5-venkatkumar.duvvuru@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": "<20210530085929.29695-5-venkatkumar.duvvuru@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210530085929.29695-5-venkatkumar.duvvuru@broadcom.com", "date": "2021-05-30T08:58:35", "name": "[04/58] net/bnxt: check resource reservation in TRUFLOW", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2f2fbc82704ccf90218cc9aabada63a003eb58d2", "submitter": { "id": 1635, "url": "http://patches.dpdk.org/api/people/1635/?format=api", "name": "Venkat Duvvuru", "email": "venkatkumar.duvvuru@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/20210530085929.29695-5-venkatkumar.duvvuru@broadcom.com/mbox/", "series": [ { "id": 17161, "url": "http://patches.dpdk.org/api/series/17161/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=17161", "date": "2021-05-30T08:58:31", "name": "enhancements to host based flow table management", "version": 1, "mbox": "http://patches.dpdk.org/series/17161/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/93553/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/93553/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 517A1A0524;\n\tSun, 30 May 2021 11:01:05 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 58BF9410F8;\n\tSun, 30 May 2021 11:00:35 +0200 (CEST)", "from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com\n [192.19.11.229]) by mails.dpdk.org (Postfix) with ESMTP id DAF0540E78\n for <dev@dpdk.org>; Sun, 30 May 2021 11:00:32 +0200 (CEST)", "from S60.dhcp.broadcom.net (unknown [10.123.66.170])\n (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n (No client certificate requested)\n by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 420007DAF;\n Sun, 30 May 2021 02:00:31 -0700 (PDT)" ], "DKIM-Filter": "OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 420007DAF", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1622365232;\n bh=A1e6vLUuzQDuJBTnyBuxC3EGpFX0mtmAJma+GXcA7Ow=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=a9gtrSxwssaLJgGh3hK5ZCZztZVEyijUFuBZOtlhmD8U57And3BaydXgJEKllgOfV\n IqxDjv8T/KNGBFCnzanvuz273S8c+8bis4XVPim73gv8YjuPH1WVfGH0f4bD5pRU8k\n bSNuzNfdG4VmOYFgHq3kG16hgcIIsxeNLFSnafsk=", "From": "Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>", "To": "dev@dpdk.org", "Cc": "Jay Ding <jay.ding@broadcom.com>,\n Randy Schacher <stuart.schacher@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>", "Date": "Sun, 30 May 2021 14:28:35 +0530", "Message-Id": "<20210530085929.29695-5-venkatkumar.duvvuru@broadcom.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com>", "References": "<20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com>", "Subject": "[dpdk-dev] [PATCH 04/58] net/bnxt: check resource reservation in\n TRUFLOW", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "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- Allow tf_open to continue if no resource is allocated\n for some table type.\n- Close the session if binding fails for any table.\n- Close the session if no resource is allocated for all tables.\n\nSigned-off-by: Jay Ding <jay.ding@broadcom.com>\nSigned-off-by: Randy Schacher <stuart.schacher@broadcom.com>\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nReviewed-by: Peter Spreadborough <peter.spreadborough@broadcom.com>\n---\n drivers/net/bnxt/tf_core/tf_device.c | 284 +++++++++++++++++++-------\n drivers/net/bnxt/tf_core/tf_session.c | 2 +-\n 2 files changed, 207 insertions(+), 79 deletions(-)", "diff": "diff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c\nindex 5116601a69..d4c93439ec 100644\n--- a/drivers/net/bnxt/tf_core/tf_device.c\n+++ b/drivers/net/bnxt/tf_core/tf_device.c\n@@ -15,6 +15,44 @@ struct tf;\n static int tf_dev_unbind_p4(struct tf *tfp);\n static int tf_dev_unbind_p58(struct tf *tfp);\n \n+/**\n+ * Resource Reservation Check function\n+ *\n+ * [in] tfp\n+ * Pointer to TF handle\n+ *\n+ * [in] cfg\n+ * Pointer to rm element config\n+ *\n+ * [in] reservations\n+ * Pointer to resource reservation array\n+ *\n+ * Returns\n+ * - (n) number of tables that have non-zero reservation count.\n+ */\n+static int\n+tf_dev_reservation_check(struct tf *tfp __rte_unused,\n+\t\t\t uint16_t count,\n+\t\t\t struct tf_rm_element_cfg *cfg,\n+\t\t\t uint16_t *reservations)\n+{\n+\tuint16_t cnt = 0;\n+\tuint16_t *rm_num;\n+\tint i, j;\n+\n+\tfor (i = 0; i < TF_DIR_MAX; i++) {\n+\t\trm_num = (uint16_t *)reservations + i * count;\n+\t\tfor (j = 0; j < count; j++) {\n+\t\t\tif ((cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI ||\n+\t\t\t cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA) &&\n+\t\t\t rm_num[j] > 0)\n+\t\t\t\tcnt++;\n+\t\t}\n+\t}\n+\n+\treturn cnt;\n+}\n+\n /**\n * Device specific bind function, WH+\n *\n@@ -42,6 +80,8 @@ tf_dev_bind_p4(struct tf *tfp,\n {\n \tint rc;\n \tint frc;\n+\tint rsv_cnt;\n+\tbool no_rsv_flag = true;\n \tstruct tf_ident_cfg_parms ident_cfg;\n \tstruct tf_tbl_cfg_parms tbl_cfg;\n \tstruct tf_tcam_cfg_parms tcam_cfg;\n@@ -54,69 +94,117 @@ tf_dev_bind_p4(struct tf *tfp,\n \n \t/* Initialize the modules */\n \n-\tident_cfg.num_elements = TF_IDENT_TYPE_MAX;\n-\tident_cfg.cfg = tf_ident_p4;\n-\tident_cfg.shadow_copy = shadow_copy;\n-\tident_cfg.resources = resources;\n-\trc = tf_ident_bind(tfp, &ident_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"Identifier initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_IDENT_TYPE_MAX,\n+\t\t\t\t\t tf_ident_p4,\n+\t\t\t\t\t (uint16_t *)resources->ident_cnt);\n+\tif (rsv_cnt) {\n+\t\tident_cfg.num_elements = TF_IDENT_TYPE_MAX;\n+\t\tident_cfg.cfg = tf_ident_p4;\n+\t\tident_cfg.shadow_copy = shadow_copy;\n+\t\tident_cfg.resources = resources;\n+\t\trc = tf_ident_bind(tfp, &ident_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"Identifier initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\tno_rsv_flag = false;\n \t}\n \n-\ttbl_cfg.num_elements = TF_TBL_TYPE_MAX;\n-\ttbl_cfg.cfg = tf_tbl_p4;\n-\ttbl_cfg.shadow_copy = shadow_copy;\n-\ttbl_cfg.resources = resources;\n-\trc = tf_tbl_bind(tfp, &tbl_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"Table initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_tbl_p4,\n+\t\t\t\t\t (uint16_t *)resources->tbl_cnt);\n+\tif (rsv_cnt) {\n+\t\ttbl_cfg.num_elements = TF_TBL_TYPE_MAX;\n+\t\ttbl_cfg.cfg = tf_tbl_p4;\n+\t\ttbl_cfg.shadow_copy = shadow_copy;\n+\t\ttbl_cfg.resources = resources;\n+\t\trc = tf_tbl_bind(tfp, &tbl_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"Table initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\tno_rsv_flag = false;\n \t}\n \n-\ttcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;\n-\ttcam_cfg.cfg = tf_tcam_p4;\n-\ttcam_cfg.shadow_copy = shadow_copy;\n-\ttcam_cfg.resources = resources;\n-\trc = tf_tcam_bind(tfp, &tcam_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"TCAM initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_TCAM_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_tcam_p4,\n+\t\t\t\t\t (uint16_t *)resources->tcam_cnt);\n+\tif (rsv_cnt) {\n+\t\ttcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;\n+\t\ttcam_cfg.cfg = tf_tcam_p4;\n+\t\ttcam_cfg.shadow_copy = shadow_copy;\n+\t\ttcam_cfg.resources = resources;\n+\t\trc = tf_tcam_bind(tfp, &tcam_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"TCAM initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n \t}\n \n \t/*\n \t * EEM\n \t */\n-\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n \tif (dev_handle->type == TF_DEVICE_TYPE_WH)\n \t\tem_cfg.cfg = tf_em_ext_p4;\n \telse\n \t\tem_cfg.cfg = tf_em_ext_p45;\n-\tem_cfg.resources = resources;\n-\tem_cfg.mem_type = TF_EEM_MEM_TYPE_HOST;\n-\trc = tf_em_ext_common_bind(tfp, &em_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"EEM initialization failure\\n\");\n-\t\tgoto fail;\n+\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_EM_TBL_TYPE_MAX,\n+\t\t\t\t\t em_cfg.cfg,\n+\t\t\t\t\t (uint16_t *)resources->em_cnt);\n+\tif (rsv_cnt) {\n+\t\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n+\t\tem_cfg.resources = resources;\n+\t\tem_cfg.mem_type = TF_EEM_MEM_TYPE_HOST;\n+\t\trc = tf_em_ext_common_bind(tfp, &em_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"EEM initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n \t}\n \n \t/*\n \t * EM\n \t */\n-\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n-\tem_cfg.cfg = tf_em_int_p4;\n-\tem_cfg.resources = resources;\n-\tem_cfg.mem_type = 0; /* Not used by EM */\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_EM_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_em_int_p4,\n+\t\t\t\t\t (uint16_t *)resources->em_cnt);\n+\tif (rsv_cnt) {\n+\t\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n+\t\tem_cfg.cfg = tf_em_int_p4;\n+\t\tem_cfg.resources = resources;\n+\t\tem_cfg.mem_type = 0; /* Not used by EM */\n+\n+\t\trc = tf_em_int_bind(tfp, &em_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"EM initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n+\t}\n \n-\trc = tf_em_int_bind(tfp, &em_cfg);\n-\tif (rc) {\n+\t/*\n+\t * There is no rm reserved for any tables\n+\t *\n+\t */\n+\tif (no_rsv_flag) {\n \t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"EM initialization failure\\n\");\n-\t\tgoto fail;\n+\t\t\t \"No rm reserved for any tables\\n\");\n+\t\treturn -ENOMEM;\n \t}\n \n \t/*\n@@ -263,6 +351,8 @@ tf_dev_bind_p58(struct tf *tfp,\n {\n \tint rc;\n \tint frc;\n+\tint rsv_cnt;\n+\tbool no_rsv_flag = true;\n \tstruct tf_ident_cfg_parms ident_cfg;\n \tstruct tf_tbl_cfg_parms tbl_cfg;\n \tstruct tf_tcam_cfg_parms tcam_cfg;\n@@ -275,52 +365,90 @@ tf_dev_bind_p58(struct tf *tfp,\n \n \t/* Initialize the modules */\n \n-\tident_cfg.num_elements = TF_IDENT_TYPE_MAX;\n-\tident_cfg.cfg = tf_ident_p58;\n-\tident_cfg.shadow_copy = shadow_copy;\n-\tident_cfg.resources = resources;\n-\trc = tf_ident_bind(tfp, &ident_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"Identifier initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_IDENT_TYPE_MAX,\n+\t\t\t\t\t tf_ident_p58,\n+\t\t\t\t\t (uint16_t *)resources->ident_cnt);\n+\tif (rsv_cnt) {\n+\t\tident_cfg.num_elements = TF_IDENT_TYPE_MAX;\n+\t\tident_cfg.cfg = tf_ident_p58;\n+\t\tident_cfg.shadow_copy = shadow_copy;\n+\t\tident_cfg.resources = resources;\n+\t\trc = tf_ident_bind(tfp, &ident_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"Identifier initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n \t}\n \n-\ttbl_cfg.num_elements = TF_TBL_TYPE_MAX;\n-\ttbl_cfg.cfg = tf_tbl_p58;\n-\ttbl_cfg.shadow_copy = shadow_copy;\n-\ttbl_cfg.resources = resources;\n-\trc = tf_tbl_bind(tfp, &tbl_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"Table initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_tbl_p58,\n+\t\t\t\t\t (uint16_t *)resources->tbl_cnt);\n+\tif (rsv_cnt) {\n+\t\ttbl_cfg.num_elements = TF_TBL_TYPE_MAX;\n+\t\ttbl_cfg.cfg = tf_tbl_p58;\n+\t\ttbl_cfg.shadow_copy = shadow_copy;\n+\t\ttbl_cfg.resources = resources;\n+\t\trc = tf_tbl_bind(tfp, &tbl_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"Table initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n \t}\n \n-\ttcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;\n-\ttcam_cfg.cfg = tf_tcam_p58;\n-\ttcam_cfg.shadow_copy = shadow_copy;\n-\ttcam_cfg.resources = resources;\n-\trc = tf_tcam_bind(tfp, &tcam_cfg);\n-\tif (rc) {\n-\t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"TCAM initialization failure\\n\");\n-\t\tgoto fail;\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_TCAM_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_tcam_p58,\n+\t\t\t\t\t (uint16_t *)resources->tcam_cnt);\n+\tif (rsv_cnt) {\n+\t\ttcam_cfg.num_elements = TF_TCAM_TBL_TYPE_MAX;\n+\t\ttcam_cfg.cfg = tf_tcam_p58;\n+\t\ttcam_cfg.shadow_copy = shadow_copy;\n+\t\ttcam_cfg.resources = resources;\n+\t\trc = tf_tcam_bind(tfp, &tcam_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"TCAM initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n \t}\n \n \t/*\n \t * EM\n \t */\n-\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n-\tem_cfg.cfg = tf_em_int_p58;\n-\tem_cfg.resources = resources;\n-\tem_cfg.mem_type = 0; /* Not used by EM */\n+\trsv_cnt = tf_dev_reservation_check(tfp,\n+\t\t\t\t\t TF_EM_TBL_TYPE_MAX,\n+\t\t\t\t\t tf_em_int_p58,\n+\t\t\t\t\t (uint16_t *)resources->em_cnt);\n+\tif (rsv_cnt) {\n+\t\tem_cfg.num_elements = TF_EM_TBL_TYPE_MAX;\n+\t\tem_cfg.cfg = tf_em_int_p58;\n+\t\tem_cfg.resources = resources;\n+\t\tem_cfg.mem_type = 0; /* Not used by EM */\n+\n+\t\trc = tf_em_int_bind(tfp, &em_cfg);\n+\t\tif (rc) {\n+\t\t\tTFP_DRV_LOG(ERR,\n+\t\t\t\t \"EM initialization failure\\n\");\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tno_rsv_flag = false;\n+\t}\n \n-\trc = tf_em_int_bind(tfp, &em_cfg);\n-\tif (rc) {\n+\t/*\n+\t * There is no rm reserved for any tables\n+\t *\n+\t */\n+\tif (no_rsv_flag) {\n \t\tTFP_DRV_LOG(ERR,\n-\t\t\t \"EM initialization failure\\n\");\n-\t\tgoto fail;\n+\t\t\t \"No rm reserved for any tables\\n\");\n+\t\treturn -ENOMEM;\n \t}\n \n \t/*\ndiff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c\nindex b3fa7e13ff..d2b24f5e20 100644\n--- a/drivers/net/bnxt/tf_core/tf_session.c\n+++ b/drivers/net/bnxt/tf_core/tf_session.c\n@@ -180,7 +180,7 @@ tf_session_create(struct tf *tfp,\n \t\t\t &session->dev);\n \t/* Logging handled by dev_bind */\n \tif (rc)\n-\t\treturn rc;\n+\t\tgoto cleanup;\n \n \tif (session->dev.ops->tf_dev_get_mailbox == NULL) {\n \t\t/* Log error */\n", "prefixes": [ "04/58" ] }{ "id": 93553, "url": "