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 B8320A04FD; Fri, 7 Oct 2022 19:48:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C518742C24; Fri, 7 Oct 2022 19:45:16 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by mails.dpdk.org (Postfix) with ESMTP id EAA7142C02 for ; Fri, 7 Oct 2022 19:45:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W3QmxsQFdwQZZPqxJBztWA7j+CXjSuNebeCZq6zWkjoYbWl3tjhm7GYVULcyzxmfms0JZhFBdHp10JosQsL/nDbz9o18/vQfhrepE2RZl3tdAIzi9BiUUE8Z7ON9j2huSBCTlp55EQoG0uaZp1pvot4e2rX8+mbKDRftyQP/JSoXX1XW3OodPLCg56RftVNagJvEwvl0h9AyJvQA1D7NFdVnZduVdDFyXWxf0wobZRUBo5pf6Xzsl7z3j4f2nuZZ88opld+NAJnIiF1JjrT+NTeUAAiu3AWIfuVeR3uMOHRbPFDh9rYTWD/+T1JMh0buce2TFeCGezQU7nzXcQybtQ== 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=ZNS/kOnyXcvuTEdFMm4D3y3GCCn3y6RqZ0pCJLf+VnQWfnzt0tKJ2d/iBGydZGS9EukF/lo9aTXucUnaNKRdE+cv1uy6kzvoOk8OkPy2O/nKdNfEOgw6RyZ81rPKLY1OtNwx5tea6NzggsIbfl8HmYv10iPKEOMdXUMT6fHktIX/ATrXz9A6AgCnZRbaO1W7HnMH+calrKbz1gzI4kgOzWvBVPSh1J0CNU+J3UnJpChPMu5XWYWwf/ZRBDC3Q39sFQe3zHYTDuvWaZF28H+0M0W3kv3xly0f4iZ0YpK+PVrpj+Wz7E9rTpFWqICu8QLW8RRCUXhpBqVGqlAb+MtwJg== 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=ya8UkeDdQYf7JXoYnMqlVXt33bNacy7EmOF17fb/Ou/OKVmuDC39gbbzCr7SRKsaR3rH0gZ2Kub8nniNdgghK8hSd2DG1xpp1hdv/kywC3GNhr8wAHisNkV4RsC4Duhspq81wcHNDBngfwZp54K0dUBkwhrlM4KrGzK2YzDH+Lo= Received: from MW4PR03CA0342.namprd03.prod.outlook.com (2603:10b6:303:dc::17) by SN7PR12MB6672.namprd12.prod.outlook.com (2603:10b6:806:26c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Fri, 7 Oct 2022 17:45:09 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::2f) by MW4PR03CA0342.outlook.office365.com (2603:10b6:303:dc::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24 via Frontend Transport; Fri, 7 Oct 2022 17:45:09 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.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; Fri, 7 Oct 2022 17:45:08 +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; Fri, 7 Oct 2022 12:45:06 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH 33/35] net/ionic: use a helper variable for page size Date: Fri, 7 Oct 2022 10:43:34 -0700 Message-ID: <20221007174336.54354-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: CO1NAM11FT068:EE_|SN7PR12MB6672:EE_ X-MS-Office365-Filtering-Correlation-Id: 15b70c15-64d7-4d41-520a-08daa88bad72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3exthnHidznAFwyx7sHq4HYXxhjohao3Vhd3vm78ezkRCgh9CQHQzEsJk432o+r1ZhFfK2k5WlsT61wyv3OSOX6K/VS+HDp7WwGQkLELThWOpuI2bp2TBkLPhdomhpV71We/P8SF0Ho5saRcPBUrzh7dMXj8+4bJPNak6+6MkZ5vIkjn8yr9usi8jiJblWpY4+V4JrR+cCWPf3PHqUNYb0Qocky8EEqk5F10LR9jfVKesJW8FL9D+bpcNGlzO50xm8SVoidpZGh1SHcE4Di/UYTttyRG/DhA9o00FHNIx9eNdFoIRXahDycI01+Zlvgy9gVNydMeA8QvSvB+MA9fuOywuRBLWNl1NRQcBvGQCGn9oKFDGqrr1t411h5X/RIO2WCrB1Vy80xljrMwvR3gcLyvrVErUr4jXZmYt0HguFuX4qkSR/5500OorDSN8ZmrcdTFJ3V6lALN2p4Z9Dvu4ddCBV/akLHzQHUmXRTHjEdrfBpZ1bE4Aw0p52njWhn1w+SWFkSa9V9cQFc0KN8aW5DT0FEmlc1QxmCMEn5ZLUikbudZXWqy/9oMqfyzHA9lj+0GDqN6twD6Ql2KDlJ3cDp1MDyEYE3GaOGSfLHGDL/IFHatkNyqYV1Q39cHSEmZX+uNyZf98jl/xoUColMQTghElyi+wwAHL6o/We1EbbgkLVH+KpyKrVEKE7hMWDNj0nOb47yuxW/bEJ43zVz+an7hj36C8QigK6qSia7sUok7Ore4W3c6xWApvlgjDiMyZ/iGzcYiOBcEqYxvPHr4KaDGD1c78o/5i470GkbBMrqdYzTOlC/FrB3+usQxoyNn 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)(396003)(39860400002)(346002)(136003)(376002)(451199015)(36840700001)(46966006)(40470700004)(186003)(70586007)(70206006)(2616005)(41300700001)(36860700001)(40480700001)(8936002)(1076003)(16526019)(36756003)(2906002)(6666004)(40460700003)(86362001)(26005)(82740400003)(5660300002)(316002)(6916009)(81166007)(44832011)(356005)(478600001)(426003)(82310400005)(336012)(4326008)(83380400001)(47076005)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 17:45:08.8498 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15b70c15-64d7-4d41-520a-08daa88bad72 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6672 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