From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE2BAA0A0E for ; Mon, 10 May 2021 18:12:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E269B40140; Mon, 10 May 2021 18:12:54 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2064.outbound.protection.outlook.com [40.107.102.64]) by mails.dpdk.org (Postfix) with ESMTP id 8893340140 for ; Mon, 10 May 2021 18:12:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iL/pNhtcFvV1hlM72OQhth0TZe4cNLfjRWKWcwLrbCjgoKX4mZeS4sUSSnuCzARS7XkO0TY57PuLaSPcxkIu0lagZQhZ8Vo+qHCo7vsw3AEl11YOd34K/Q+13/t3KP1H2DoVl3f5JmpZPl78cznDtL4hKmt3OOZy7R1j/KUV2MFnEvnC5Sh0rJCK4BUOLBTE06N/ipOczm4JHpM9RZ9DdE8xg1W44XGdJYpYLGO7V0kBoGjcPtyF50NjMLgQVYmFIsMq2IR0oRpfiWdr3YCWea+zshn4McfhPihnVCr20wfKp8i6kuO57i4FCwgNhvChBoPZelOVpdFyE1FJ/95fjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R/88bXDXOfk3RF40xsKah8QzlakzNEt1bXjxGz6OET8=; b=llSNe9ewyYjQV/Rierd5R6BTMa2UtaAlzHLyxaG8sydjSZ3cPO0TPO+B1e0ZVAWnJbkRkQ/gxD2D74LEZlKRlRFj5dNb1nynkim6sG1Qi+hG+MYgqZn3KMFpPwfXmCa/F2J5Osm+HDNpNCzMHJfs7Ue5lgECEPqoGUfn9gw271xAufjKG1VEjZrqLU1DUaaipPah/Cqyhos3t8ruyVaDlveg/6a9QFETXA7o8VLAA0wxq28IAqi7y4ZscZMhBr2AEq2SlCYhEBui6FbekdX+F5/5s73jtsN0uXHZWaLB93T2fm3WcATQDxvxTbK9//+A/yLBzCRwsNu7KZ00I4IXIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=broadcom.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R/88bXDXOfk3RF40xsKah8QzlakzNEt1bXjxGz6OET8=; b=a/TGX2vAoUyXcjvf9znlE7pSkax1gMH68oFvAYyZfJG6nQX9ECHLm3OePFHUu0s4y9/fWkUXsHIylElfT/wIxpDA+zfVGLfQKmWBcCMS/CMUZi32VVMr5irZjhcc8IgnK1kOcnFdubyoCM+W29FbohgGtj0vKLgmKC/DN65EEkMPI6nX2CZ37N5b9IMCrzeAsdqX86ak03BgBdDO5dGszOKr9Wuf88tk0/t8zTU8qF157VMeYrR8oC8SjubmAjVKRFZ7AogLk/WTcHP6bH2+/MB+zPYX/m3tUe4j6fzh5w710CjxyP1pHiJh8Y5us+zpkDiGx/WmvK5sREkKcFOLDg== Received: from MW4PR03CA0296.namprd03.prod.outlook.com (2603:10b6:303:b5::31) by BN6PR12MB1428.namprd12.prod.outlook.com (2603:10b6:404:21::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31; Mon, 10 May 2021 16:12:52 +0000 Received: from CO1NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::32) by MW4PR03CA0296.outlook.office365.com (2603:10b6:303:b5::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:12:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; broadcom.com; dkim=none (message not signed) header.d=none;broadcom.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT013.mail.protection.outlook.com (10.13.174.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:12:51 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:12:49 +0000 From: Xueming Li To: Kalesh AP CC: Luca Boccassi , Somnath Kotur , Ajit Khaparde , Lance Richardson , dpdk stable Date: Tue, 11 May 2021 00:00:45 +0800 Message-ID: <20210510160258.30982-96-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8ea63f2-f91e-4235-31ad-08d913ce765c X-MS-TrafficTypeDiagnostic: BN6PR12MB1428: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wTEf0c0FKUQ8KKX/83s9ro+/9ew5YnSo5co7X952sU7enb/q1Lz+KlXlnU426Xznn7/VnXfrJ6KMVUlHdnShw8eQPYnnHb12B770EI+mtBO+9lr+Rc6lzIuf98q9Oe4Cn1D8pObNNLTfb+9yPRB2favFrV/I38QZMDqzu2PnVlpU+/NRzx/joX7a7d4njBnh5zXF4bS7tCafyfSxY4uh4ptoDQ9c2kTtzKJfxVLp2KIEY4Gjgi2FxR/J2XByeM9KfGqWGRIzynSjvxIrvH39SMGVvF5NN1K9u5VeJN/q0EpaFTmCVOEb3mwQfqYzr3teCXtMbkFBtxzseymZ/owhYIlvFczmUxPxijntKp+Ppb+J+UMhKy9DbCSFpZbzfEQkUwNH///Fl/w1epI/Y3OABhHVT+WzAiqDvmw+lPbmlvRcvI6BLuFHIQTZzc7dwmGP/jCOgoXdLASbNYF4pDWmJ5mhApiYhBBBG74NQCUkkLsLHqjRPgwheG4MSdNbYSJxZon2JECaaSdz+UIf+kB4dc/HaND5Qh4mJRneYk/H61HJz1I84RYZmK80SvuU7sTdG/2LlEsp72X8wHivGZj9Fe0yIfCPsXyAwHKPmsPNYGJLzUxUm32Wk6pk8vCjMcsXMz1kqVWu1868XWWHcVd8sIFe9jyHMwoHVEHEEAPJC8IeJfqrTWVgsHD7ULsWT4rXNIMGBRV5jnt81XIgmizWKSd7wTSDsVvBI/Ou0Qrw6yx2OLeIYtSRgaA94vOrPD71GcxRJxfQO8wMZJLXJ7zmPA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(346002)(396003)(376002)(39860400002)(46966006)(36840700001)(1076003)(6916009)(36906005)(54906003)(316002)(70206006)(36756003)(83380400001)(86362001)(2906002)(6666004)(478600001)(186003)(82740400003)(2616005)(16526019)(336012)(426003)(82310400003)(4326008)(55016002)(70586007)(7636003)(8676002)(53546011)(26005)(356005)(8936002)(7696005)(6286002)(47076005)(5660300002)(36860700001)(966005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:12:51.8480 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8ea63f2-f91e-4235-31ad-08d913ce765c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1428 Subject: [dpdk-stable] patch 'net/bnxt: fix memory allocation for command response' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/75f780af8b8e931756c5943d38a6789525e4e078 Thanks. Xueming Li --- >From 75f780af8b8e931756c5943d38a6789525e4e078 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Sat, 20 Mar 2021 12:19:17 +0530 Subject: [PATCH] net/bnxt: fix memory allocation for command response Cc: Luca Boccassi [ upstream commit 4f1d8fdc3f4234857c1e78af564fcfd92f602f70 ] Driver re-allocates memory for the command response buffer when the installed firmware version is newer (and has a larger max response length) than the version of HWRM that was used to build the PMD. This change helps to avoid the re-allocation by allocating the memory for the command response buffer with PAGE_SIZE. Coverity issue: 366256, 366204, 366180 Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde Reviewed-by: Lance Richardson --- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 27 ++++----------------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index e97a3ab8f6..85c711b71f 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -5363,7 +5363,7 @@ static int bnxt_drv_init(struct rte_eth_dev *eth_dev) rc = bnxt_alloc_hwrm_resources(bp); if (rc) { PMD_DRV_LOG(ERR, - "Failed to allocate hwrm resource rc: %x\n", rc); + "Failed to allocate response buffer rc: %x\n", rc); return rc; } rc = bnxt_alloc_leds_info(bp); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 284699b2dc..2e2460b71a 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1160,28 +1160,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout) max_resp_len = rte_le_to_cpu_16(resp->max_resp_len); dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg); - if (bp->max_resp_len != max_resp_len) { - sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT, - bp->pdev->addr.domain, bp->pdev->addr.bus, - bp->pdev->addr.devid, bp->pdev->addr.function); - - rte_free(bp->hwrm_cmd_resp_addr); - - bp->hwrm_cmd_resp_addr = rte_malloc(type, max_resp_len, 0); - if (bp->hwrm_cmd_resp_addr == NULL) { - rc = -ENOMEM; - goto error; - } - bp->hwrm_cmd_resp_dma_addr = - rte_malloc_virt2iova(bp->hwrm_cmd_resp_addr); - if (bp->hwrm_cmd_resp_dma_addr == RTE_BAD_IOVA) { - PMD_DRV_LOG(ERR, - "Unable to map response buffer to physical memory.\n"); - rc = -ENOMEM; - goto error; - } - bp->max_resp_len = max_resp_len; - } + RTE_VERIFY(max_resp_len <= bp->max_resp_len); + bp->max_resp_len = max_resp_len; if ((dev_caps_cfg & HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) && @@ -2667,7 +2647,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp) sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT, pdev->addr.domain, pdev->addr.bus, pdev->addr.devid, pdev->addr.function); - bp->max_resp_len = HWRM_MAX_RESP_LEN; + bp->max_resp_len = BNXT_PAGE_SIZE; bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0); if (bp->hwrm_cmd_resp_addr == NULL) return -ENOMEM; @@ -5842,6 +5822,7 @@ int bnxt_hwrm_poll_ver_get(struct bnxt *bp) int rc = 0; bp->max_req_len = HWRM_MAX_REQ_LEN; + bp->max_resp_len = BNXT_PAGE_SIZE; bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT; HWRM_PREP(&req, HWRM_VER_GET, BNXT_USE_CHIMP_MB); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:29.103375900 +0800 +++ 0097-net-bnxt-fix-memory-allocation-for-command-response.patch 2021-05-10 23:59:26.460000000 +0800 @@ -1 +1 @@ -From 4f1d8fdc3f4234857c1e78af564fcfd92f602f70 Mon Sep 17 00:00:00 2001 +From 75f780af8b8e931756c5943d38a6789525e4e078 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 4f1d8fdc3f4234857c1e78af564fcfd92f602f70 ] @@ -16 +18,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index 372475231d..ed2ae45757 100644 +index e97a3ab8f6..85c711b71f 100644 @@ -31 +33 @@ -@@ -5608,7 +5608,7 @@ static int bnxt_drv_init(struct rte_eth_dev *eth_dev) +@@ -5363,7 +5363,7 @@ static int bnxt_drv_init(struct rte_eth_dev *eth_dev) @@ -41 +43 @@ -index e3a07314f8..6a70b6e663 100644 +index 284699b2dc..2e2460b71a 100644 @@ -44 +46 @@ -@@ -1284,28 +1284,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout) +@@ -1160,28 +1160,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout) @@ -75 +77 @@ -@@ -2804,7 +2784,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp) +@@ -2667,7 +2647,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp) @@ -84 +86 @@ -@@ -6057,6 +6037,7 @@ int bnxt_hwrm_poll_ver_get(struct bnxt *bp) +@@ -5842,6 +5822,7 @@ int bnxt_hwrm_poll_ver_get(struct bnxt *bp)