From patchwork Mon Oct 14 10:58:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B36D1A43B for ; Mon, 14 Oct 2024 11:00:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E5D26B00AD; Mon, 14 Oct 2024 07:00:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4952E6B00AE; Mon, 14 Oct 2024 07:00:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 333AD6B00AF; Mon, 14 Oct 2024 07:00:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1408A6B00AD for ; Mon, 14 Oct 2024 07:00:52 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E48CD140D34 for ; Mon, 14 Oct 2024 11:00:43 +0000 (UTC) X-FDA: 82671915018.11.4A649C4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf29.hostedemail.com (Postfix) with ESMTP id 0157F120011 for ; Mon, 14 Oct 2024 11:00:41 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903578; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e7pcQwcyCDB+vF+TDiljSktz52PqeG01ydw3eqf01m8=; b=PWLgAJ+u1vrKla4SKRkuw6wq+jU3wg+QIA9mRt30CYhwUUq3bqF8SUS4hELxceymL7jKDf a0msPzsXSY3mOhUE61/QIjbPX1zOfapC/GduuKWIlTDihIEwFuqPaKuxuMVczGBJQ2XbqF jH32eznO3rcpYHn86rpIao4c5b0/iFo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903578; a=rsa-sha256; cv=none; b=ga75XgV+K6sB2FLlR08KgoGjx/mexXPUfFtUafl2tKiNlANjWHGaWEf14lnuXrpCKoQeHT 6TFP8Dns67hhN79jlvoAaTxvnUJHbTJ6iMBsV4ps3c5abOna1Wu3cQ6dXjpq0PtRaNm9RV ovhs7jsmfEdaqeuPrSYwSxzcbztNrdk= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D37AC169C; Mon, 14 Oct 2024 04:01:18 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D25203F51B; Mon, 14 Oct 2024 04:00:45 -0700 (PDT) From: Ryan Roberts To: "David S. Miller" , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Eric Dumazet , Greg Marsden , Ivan Ivanov , Jakub Kicinski , Jijie Shao , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Paolo Abeni , Salil Mehta , Will Deacon , Yisen Zhuang Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org Subject: [RFC PATCH v1 26/57] net: hns3: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:33 +0100 Message-ID: <20241014105912.3207374-26-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 0157F120011 X-Stat-Signature: 3jakw1u5os8bkncmn5x3zm8ebogbox7t X-HE-Tag: 1728903641-213920 X-HE-Meta: U2FsdGVkX19NC4Psl6FHnSzaUoz1m6sEOjLF6U1LzumdHNvxEoNEjcGlTiSaRVaxalSw+snbZxQ0so4QwCgR/mYglg6rl4H5K0Hh5q2K3/mJ8Af4Y/jWm2QJLmoDiEsvKBiq1vbKV1LCdS6YfKTsiR1avmm7QVC5UsZA3ra99/8seNF7hDSet+t/cJzFuWXHAwT5Yze1lzHzM+qdOrfhphyglyPXNuIWjc7sJ3mZ9asSj+eb3YxofVBq3Bvy6BVejhJIUOWMSD1haJnY/nyDmGLvBd8leK7l7cm1n8UbGnQZTsYg176QvC0N1alI2utZtWpk3JqvHaU2RgBKwdGmgfX7qKmbYFV04qevNoiU2jm4iUt+mYnxnTA9CqASx51z1A+G71qTTCXBRUdX6ndY46Qm6Tqxysn3Xs9HhS2Lqv+5/MBohQI1zal1YoOFdMUBGg2dBCZV5lmnoyoOLcPy4RtRAB4Av8iCueE0AzV6udSJ3W8DACXWOS4DX9y8OYygPvy/agWYMjSBbCdihmPvPZue4M0bC9vN42g95jklfK7Vbg7q/wxjUcIlZdvDz6KjCaiRZyFsl7aGVHNuK+joiEl9qAprhR2nUVXjhisetr9TWof+FWUof0EjuxdLyHGZk+zGBG1UWMgTvcL6ZbblShmP/+hSGR7akdxCnMXSnLKUWdUnzIrOcD6CBxWvYmn3YhDfQf6sRmNxEPjvECRVYYIL1T0JGMOsbnMPAtVnzP+FZ9xpjKza6iam0qxgiXcBeMEh+OyBNi6YGNEFGH+tHu/rFLxgozgxYKhllMenrP6JMf3aYvM68ejN3NlUgjQjLj5CnIEZw1c+cJYT14S11UM92x5L9UfMmBPOj249bwxMm8DsRBW3qq+z5yNadEPIe+oqlopB2kFrcUevV7KBAJsGF3gCsJhuYUw6GIKvBEGeLpKdhN0KMJ0kgIsASYeeTRkWzPLznOmwD5koWKE Ya45cV2m UCHE9zC9AT7EkcmmaZk2XTdUNplZLATarRcW9yROamdmRZrGd/EGOOZJ/jXIfc2z+UdGu9XedyH/wFwcDql+vS7u08NPzcujig2fOU+iiSEG95ONpvWtXH6zYqhUR7mJUbewkZ3BmYxqcZSMzONHoeoiP5oNgcxpxA0D8HkCY+XzM8dNq6+MGZolUJnd78dF8Ul2RlYc9YB37OM3PDBOptWaJ3NjAqY4glJS1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To prepare for supporting boot-time page size selection, refactor code to remove assumptions about PAGE_SIZE being compile-time constant. Code intended to be equivalent when compile-time page size is active. Convert a CPP conditional to a C conditional. The compiler will dead code strip when doing a compile-time page size build, for the same end effect. But this will also work with boot-time page size builds. Signed-off-by: Ryan Roberts --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index d36c4ed16d8dd..5e675721b7364 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -681,10 +681,8 @@ static inline bool hns3_nic_resetting(struct net_device *netdev) static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring) { -#if (PAGE_SIZE < 8192) - if (ring->buf_size > (PAGE_SIZE / 2)) + if (PAGE_SIZE < 8192 && ring->buf_size > (PAGE_SIZE / 2)) return 1; -#endif return 0; }