Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/94099/?format=api
https://patches.dpdk.org/api/patches/94099/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210613000652.28191-5-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": "<20210613000652.28191-5-ajit.khaparde@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210613000652.28191-5-ajit.khaparde@broadcom.com", "date": "2021-06-13T00:05:58", "name": "[v2,04/58] net/bnxt: check resource reservation in TRUFLOW", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "2f2fbc82704ccf90218cc9aabada63a003eb58d2", "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/20210613000652.28191-5-ajit.khaparde@broadcom.com/mbox/", "series": [ { "id": 17305, "url": "https://patches.dpdk.org/api/series/17305/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17305", "date": "2021-06-13T00:05:54", "name": "enhancements to host based flow table management", "version": 2, "mbox": "https://patches.dpdk.org/series/17305/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/94099/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/94099/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 74A73A0C41;\n\tSun, 13 Jun 2021 02:07:34 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 67DE241125;\n\tSun, 13 Jun 2021 02:07:06 +0200 (CEST)", "from mail-pj1-f43.google.com (mail-pj1-f43.google.com\n [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id 84E5341103\n for <dev@dpdk.org>; Sun, 13 Jun 2021 02:07:03 +0200 (CEST)", "by mail-pj1-f43.google.com with SMTP id\n mp5-20020a17090b1905b029016dd057935fso7923564pjb.5\n for <dev@dpdk.org>; Sat, 12 Jun 2021 17:07:03 -0700 (PDT)", "from localhost.localdomain ([192.19.223.252])\n by smtp.gmail.com with ESMTPSA id gg22sm12774609pjb.17.2021.06.12.17.07.00\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Sat, 12 Jun 2021 17:07:01 -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=LdfXEouBjJ5vZbH1wE02ORHyDAvqVRvBPRlfUiYeel8=;\n b=JscdKz7E1QQ2IZjZQKMadGHPz2L4r5VlqkGtNmGK7Lh+qZ70Ki8RPSjTtF5l4qyn/m\n oHJaaAlNyJI97oi8wrG6DnYk3f8zYxfMpwF0o0uoZuyszLU4m3jwew6d6Uktp4ZJ9isI\n dh/lOtzewwOax+GHagtpVpSR0bMpm+WqELP6I=", "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=LdfXEouBjJ5vZbH1wE02ORHyDAvqVRvBPRlfUiYeel8=;\n b=YrxvPIIyZD2JB0hFUpscDUyc6EZNKZEo83aR/+mlYLQvgZ3RpKSjEiECGr7SvGMKCb\n u2TNWq1CpaBR2BkAfrrG1eGKcOGb3y+maTDWevATdPYWk8qT1QbuNMDSMWf41NmeZkj+\n AXfXc52WVIs1XxSoat+XAQzvSvC9SFe6O1E7LLRZI5djpJ3D9ib0CjzucOUuZo2pwP3y\n 6pTMXDmzI1t9keQNj4tLp9C9fDeawSLqxlnK8i7Pp6FhqIpmCbm1OWfFIqZkib6wwrsz\n 4VC0/MskQVzY99rcBxwEwNoq0WOOVsiMseGLCgWfSC0JkD3A7nhMopcJ9cdWAYpr1fb3\n JMTA==", "X-Gm-Message-State": "AOAM53141DbwM338ao3kEmp2VXCD2De9Zs75j8uG03JYPNEQu8cV6Mpn\n DTlJNABqbjrwzmYzXnMwcS/XhigICe5Be/eGBGqb1b9KoFDgKBD84CqwtHN9yHjGVb3wDtIEObd\n lkaqFNRV7R6bX+/7rDSpWxaU7+UDX+Bx8+NajASpnI0k3JRsL9ZaBPBFMiTjMkyA=", "X-Google-Smtp-Source": "\n ABdhPJxlee8vQBDD7cRPQ3A5Srdfpx3IjhRCzUEVflMfze1YxVvu/PQ5n0kACQ9HxPrIZ32v0XC+6g==", "X-Received": "by 2002:a17:902:265:b029:fa:9420:d2fd with SMTP id\n 92-20020a1709020265b02900fa9420d2fdmr10260024plc.39.1623542822222;\n Sat, 12 Jun 2021 17:07:02 -0700 (PDT)", "From": "Ajit Khaparde <ajit.khaparde@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>,\n Peter Spreadborough <peter.spreadborough@broadcom.com>", "Date": "Sat, 12 Jun 2021 17:05:58 -0700", "Message-Id": "<20210613000652.28191-5-ajit.khaparde@broadcom.com>", "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)", "In-Reply-To": "<20210613000652.28191-1-ajit.khaparde@broadcom.com>", "References": "<20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com>\n <20210613000652.28191-1-ajit.khaparde@broadcom.com>", "MIME-Version": "1.0", "Content-Type": "multipart/signed; protocol=\"application/pkcs7-signature\";\n micalg=sha-256; boundary=\"00000000000038fe8305c49a8541\"", "X-Content-Filtered-By": "Mailman/MimeDel 2.1.29", "Subject": "[dpdk-dev] [PATCH v2 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>\nAcked-by: Ajit Khaparde <ajit.khaparde@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": [ "v2", "04/58" ] }{ "id": 94099, "url": "