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 CC06FA0544; Tue, 11 Oct 2022 02:54:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 729BB42C0D; Tue, 11 Oct 2022 02:53:07 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062.outbound.protection.outlook.com [40.107.94.62]) by mails.dpdk.org (Postfix) with ESMTP id 20A0942BE5 for ; Tue, 11 Oct 2022 02:53:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EPWpsUzMXWZnAHETZTj7XZ/NNTTMLhAzDnSd9rvafM/wPUOsVeekltfVjA5jox/XAVzroQ82tTKO7WSYxF/IkZSiDPnQNgqc1d3+rVBiLFxleypuaEON7/xv+dC5DD0VFbvu9MXPQggj5mSApb+rzOCnEN/s8JpJmCXhWo0FFSgIKnQEGL67gcTTpDIXxdEiaqiVIKohM5iGZ9hiMl3dNCVUnGVwglUTNzarGEoPfr3hk7KUcSx7RvZ3TfIGoBv564e58KFkJRzWZ4ByRFh3+MFi48rX/1ULpKI3Jz6PCYhUGs9t84vnhiL6R0N1JqvT8eXKIRiv5SDmaH6DqUaKVw== 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=lkEzexVPtokK4qFQ3tRIGvi+hcK4YjATsc6OBWISom4=; b=apeuv7BjUzceq87g4zwcdpAxIfziFZzTsfjhD/ueuAOazJ3zNCH4lTlL3RkJy5r2Bbk3Fs7x4Tfh49XKWfa5dQJyAVPFWO9W8R0WonIXaVz6X4ffN++oc4tWJF4dHyTL7XS7iZ1KZtLg001VMsutwDqZ6mN7ueyakCb8QI/6R13NLZoyzF1QR92asf7s5T8q+wRQ4K5x9CPN3pqrxQD6kHTmGNk80yLVH0z1QRuOuFZMRHNTV4JQAuBFw22aiqwkw/YklTeX7tdZeL9C9ua2YUlK0RmbHKLTAZ0lAoLkYjH+I1vEeM7+3vctRqbjyyo6dpgx1KW8kyEKJKF1hHeggg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lkEzexVPtokK4qFQ3tRIGvi+hcK4YjATsc6OBWISom4=; b=st/kq5k0lr6gdbyWTovHq1xhRv7JwAgBYXZ0L3npdKbX2KFf6DYzyG4/t2SUozviPQ3KaeEZmEl/s6JSU9q7ipUWAWaMS9vyHREKl+nxSJdqEuBc1JV7++McPHWB4B3NtZtTdtZ9q7hPdC7fw1e1naLYRjMwNresnGZu5MZe1Zs= Received: from BN9PR03CA0934.namprd03.prod.outlook.com (2603:10b6:408:108::9) by MW4PR12MB5643.namprd12.prod.outlook.com (2603:10b6:303:188::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 00:53:04 +0000 Received: from BN8NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::55) by BN9PR03CA0934.outlook.office365.com (2603:10b6:408:108::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19 via Frontend Transport; Tue, 11 Oct 2022 00:53:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT014.mail.protection.outlook.com (10.13.177.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 00:53:04 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 19:52:22 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v1 33/35] net/ionic: use a helper variable for page size Date: Mon, 10 Oct 2022 17:50:30 -0700 Message-ID: <20221011005032.47584-34-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221007174336.54354-1-andrew.boyer@amd.com> References: <20221007174336.54354-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT014:EE_|MW4PR12MB5643:EE_ X-MS-Office365-Filtering-Correlation-Id: 46f5ef03-ac67-4db7-e80d-08daab22f441 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bqa4AaBV4kFCnGOmpTAHxsHpuZQwus6vt3tcR9DmKuM/Ih1NZfAiU7CkQab5+/VRisy0S7lO1Um0CE0WjC0S6G5FAQHobyl/FHEAF1WRe+GSMgm0t6nwi8lJ0tY2D6tRou8Ew74mI6NFXpq0ccb7LA0pDf5eblPUJp0CTVMZIDvMixNWRBJ7UGwqWdArK8Awi2mTEO9bq5boJ5PY8OYokyrjuA9uHUuythBGB4mvzWdOcI0+TnUmvBnqJl8hxwQTSnRfe5L0H2s16vEO4d9zaKi9DjV+dzkUGCicR1potVd7Fj12D+fk8AlU6o6qY01Ya+CQo5+fMDYvNvg3EuFGIdCntZqUSuWmlaOqAr7HyMcWhGTeIhNdZaig7i+H/J1B1UafBQIX/rZFYF0nQZm3j5B5VLiqW+wYg8+H9MFjKl2k9+2mI9HMfIFQdrvkiZQ8A8CYlq6NMRqBm7I6AZOMhDHuxzyy8U9ql3BDIU5TuUqYkAYhMkc1Y6qt1SC1oqOAY5qWbEyuCsvgwz5vyZ3IsEcApSkPC25l/JNAbBXayOS857h+0jo9VfLFj7laeB/78ikbdqytedVgfyFO0BZmxu3wQ2rRY8sfllvzDBepsFa4E+t2D0DyefZwGU1ImX29eV26B1gPFZRR0jbmRl0v8lVab2ELiK3H57XPzQV+LNuhMO1saDSf14Ba8didmEFKrdXIcRoLUKxtIhYh4dPtn6bwFOYEHIccMPkoyAbTed87Tk1cjSG8oqiZN6Q+GAUgS40hONgO9ssN6vCK0soW7nhxBQCQJ9QKYa9G4+XT0xk7njGRV8+J2v+yyxXv4ziG X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(40470700004)(46966006)(36840700001)(478600001)(6916009)(316002)(8676002)(4326008)(70206006)(6666004)(41300700001)(5660300002)(26005)(8936002)(36756003)(70586007)(44832011)(2906002)(2616005)(47076005)(40460700003)(186003)(16526019)(1076003)(336012)(426003)(83380400001)(40480700001)(86362001)(36860700001)(82310400005)(81166007)(82740400003)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 00:53:04.1075 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46f5ef03-ac67-4db7-e80d-08daab22f441 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5643 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 This improves readability. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index affb6a44af..0affdd9dc4 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -576,6 +576,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, rte_iova_t q_base_pa = 0; rte_iova_t cq_base_pa = 0; rte_iova_t sg_base_pa = 0; + size_t page_size = rte_mem_page_size(); int err; *qcq = NULL; @@ -584,18 +585,18 @@ ionic_qcq_alloc(struct ionic_lif *lif, cq_size = num_descs * cq_desc_size; sg_size = num_descs * sg_desc_size; - total_size = RTE_ALIGN(q_size, rte_mem_page_size()) + - RTE_ALIGN(cq_size, rte_mem_page_size()); + total_size = RTE_ALIGN(q_size, page_size) + + RTE_ALIGN(cq_size, page_size); /* * Note: aligning q_size/cq_size is not enough due to cq_base address * aligning as q_base could be not aligned to the page. - * Adding rte_mem_page_size(). + * Adding page_size. */ - total_size += rte_mem_page_size(); + total_size += page_size; if (flags & IONIC_QCQ_F_SG) { - total_size += RTE_ALIGN(sg_size, rte_mem_page_size()); - total_size += rte_mem_page_size(); + total_size += RTE_ALIGN(sg_size, page_size); + total_size += page_size; } new = rte_zmalloc_socket("ionic", struct_size, @@ -610,7 +611,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, /* Most queue types will store 1 ptr per descriptor */ new->q.info = rte_calloc_socket("ionic", num_descs * num_segs, sizeof(void *), - rte_mem_page_size(), socket_id); + page_size, socket_id); if (!new->q.info) { IONIC_PRINT(ERR, "Cannot allocate queue info"); err = -ENOMEM; @@ -648,16 +649,13 @@ ionic_qcq_alloc(struct ionic_lif *lif, q_base = new->base; q_base_pa = new->base_pa; - cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, - rte_mem_page_size()); - cq_base_pa = RTE_ALIGN(q_base_pa + q_size, - rte_mem_page_size()); + cq_base = (void *)RTE_ALIGN((uintptr_t)q_base + q_size, page_size); + cq_base_pa = RTE_ALIGN(q_base_pa + q_size, page_size); if (flags & IONIC_QCQ_F_SG) { sg_base = (void *)RTE_ALIGN((uintptr_t)cq_base + cq_size, - rte_mem_page_size()); - sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, - rte_mem_page_size()); + page_size); + sg_base_pa = RTE_ALIGN(cq_base_pa + cq_size, page_size); ionic_q_sg_map(&new->q, sg_base, sg_base_pa); } -- 2.17.1