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 BC9A3A00C5; Mon, 14 Feb 2022 11:52:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 595A740DDA; Mon, 14 Feb 2022 11:52:01 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by mails.dpdk.org (Postfix) with ESMTP id 1EC5A4068C for ; Mon, 14 Feb 2022 11:52:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TlgacSeNDyROVdGwkpeZXn0TZNyXxy/ULObEk9eEfmVVwvJtYtso4gyUN291kgCWyWzAREqvLlTolXDisXkrDCA4gEbBlTKZSe4AOppJKZdu4pddakWL4WM6f8z2S5GA0MsU7Dz4FwEn1RSl5YoODeOxM+j1YNptLXQNKiVFpevcBNYeW/LVc4W0lUN6ydneypQLdG8CF7hoNhAbSao/Pr/KNd7wLut67mfaMO3r2mO9leO/gcB10xWVbXy70M75s2vpxb9jHvZCmIkBa8IEZQ5p9+rwDAjqUYx6m/L1dBdDmDovtQfZW21Gmwcapq8hbbWhdvVkNxQFljUtJJ+l9A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EImbpoAnl2ux0KH2Zj2zIIIgH7iUoUlu1Zlc+oetSG8=; b=bnuwvyphyELUQKNlQzrLK81TalVM0Ccm4oxrookhldqS5MlKWc/5nSBEOE/ngCl/MntwUgwZPlLdOlyJXlpZWu5HSgz1vuFS3nOmXPKKbZszYuPg89QqnY7tXKhDQSbWP6Hl4TQk7Yman3V9nxMkExai2M9bEn2rk/HzK641wos4BNp+r+/4URUWE7kfBghU9j3kUw5eR93Grq85LkqCDpQK8chlQlXQ3T8+TtwEb3ZAVEtwdM5UQcwgVRqOOFpoyrcG7Z5gMU67P9fusHMM+7pMZdsirFQs+RgUxJznF9W/HDbU48GrYtnW9J1gaAo/FpesFMX1WxTpaOtccRuqhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=dpdk.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EImbpoAnl2ux0KH2Zj2zIIIgH7iUoUlu1Zlc+oetSG8=; b=tLPHal6+4EvJqVV5jj5NU1hEePIGQrE0i0kZq8htEukGNVmPorGQLINJ1BiKheyYH2k4bXMvuWePvAVAO5hCxQO+gzHA2SPAjwNxnZiDSHLB1QzRaiZTrzI2iJ4XGAAtndDkkbuwHKaMpmMSSBgtKGPUIlOTBUOG+6Ho99X7X18= Received: from DM5PR17CA0052.namprd17.prod.outlook.com (2603:10b6:3:13f::14) by SN6PR02MB5469.namprd02.prod.outlook.com (2603:10b6:805:e7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.18; Mon, 14 Feb 2022 10:51:58 +0000 Received: from DM3NAM02FT007.eop-nam02.prod.protection.outlook.com (2603:10b6:3:13f:cafe::67) by DM5PR17CA0052.outlook.office365.com (2603:10b6:3:13f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19 via Frontend Transport; Mon, 14 Feb 2022 10:51:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT007.mail.protection.outlook.com (10.13.4.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:51:57 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 14 Feb 2022 02:51:56 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 14 Feb 2022 02:51:56 -0800 Envelope-to: dev@dpdk.org, chenbo.xia@intel.com, maxime.coquelin@redhat.com, andrew.rybchenko@oktetlabs.ru Received: from [10.170.66.118] (port=56592 helo=xndengvm004118.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nJYxY-000Gds-31; Mon, 14 Feb 2022 02:51:56 -0800 From: To: CC: , , , Abhimanyu Saini Subject: [PATCH v3] vdpa/sfc: make MCDI memzone name unique Date: Mon, 14 Feb 2022 16:21:48 +0530 Message-ID: <20220214105148.18414-1-asaini@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20220117112906.23823-1-asaini@xilinx.com> References: <20220117112906.23823-1-asaini@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9902f7a-e388-4317-7cf6-08d9efa805af X-MS-TrafficTypeDiagnostic: SN6PR02MB5469:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KLBLvEyc8V2eB9JjlIfm9ncRhfBd9uKME+2hN8AH0cSo3tWZdASHb5NTjBKxgxFpzoKQCjz0zhlBhOE9bh2Gyoo8wOqmBTADUM11ReqH9OglusaK7s1HJT32ShI7DDMEs9ccJPYvINsWNo0739d+rKSqPuyOvd20ypb9aasQokN2XtP1r7xTiZmn7uvmeRFir7JHkuI2C/I7G7odTiE2uLV5dIoxrjYLqOQKpCYfYnRkO2WE5y1ygcx/KeRmpJRb37xwKi8pA5dQtXn4vThfwjx7vt0hMUEo2jcWsqS1f5IwYyscvG9kgZmO28Twi5pthSu/j5gG6l4ZBQILQsWpCCqCzjNF5pPrwLA8wb06TaLRhTP13fdybMnPbFSxEpUTZIsCQUNPoX5abbQfeLDDGCqmHJ58/A9kg/obkmg2WJrrqz+KjxX6nHKonxRbAvpXlzBcJFAEgNSi6+Io/kd4/bq4TCatyQKsOeiFHOrInjs2xCLPoq190nYMnUmPai4EOFUeIptfGt5PlithXB8IBMerHH36m83ZwHaqW6gK7jYOznEjR8aeWSLCBPL3jkM1DSN0h2IapJnWvDM1ag3Zto2uIoMAtzopi7vml6W8XLlz3lVysz9ZIp6eAZiazkSvfYVLY2D9x301bZ3oC4M9ObRfMMggM1PeYoKM3NFYhhJZY8/KjES1EXIMLqV1S6Vc X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(508600001)(4326008)(6666004)(82310400004)(107886003)(7696005)(5660300002)(70586007)(70206006)(8936002)(8676002)(9786002)(316002)(6916009)(54906003)(36860700001)(83380400001)(7636003)(336012)(426003)(356005)(2616005)(1076003)(2876002)(2906002)(26005)(36756003)(186003)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 10:51:57.7785 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9902f7a-e388-4317-7cf6-08d9efa805af X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT007.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5469 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Abhimanyu Saini Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned with zone name 'mcdi'. Since multiple MCDI channels are needed to support multiple VF(s) and rte_memzone_reserve_aligned expects unique zone names, append PCI address to zone name to make it unique. Signed-off-by: Abhimanyu Saini --- v2: - Formatting changes v3: - Formatting changes drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c index fd1fee7..a7018b1 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_hw.c +++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c @@ -25,21 +25,30 @@ { uint64_t mcdi_iova; size_t mcdi_buff_size; + char mz_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz = NULL; int numa_node = sva->pdev->device.numa_node; int ret; mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE); + ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s", + sva->pdev->name, name); + if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) { + sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name", + sva->pdev->name, name); + return -EINVAL; + } - sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len); + sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len); - mz = rte_memzone_reserve_aligned(name, mcdi_buff_size, + mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size, numa_node, RTE_MEMZONE_IOVA_CONTIG, PAGE_SIZE); if (mz == NULL) { sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s", - name, (unsigned int)len, rte_strerror(rte_errno)); + mz_name, (unsigned int)len, + rte_strerror(rte_errno)); return -ENOMEM; } -- 1.8.3.1