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: 13834856 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CE3DD1624E for ; Mon, 14 Oct 2024 12:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e7pcQwcyCDB+vF+TDiljSktz52PqeG01ydw3eqf01m8=; b=xMF9zqTAkfdeDlH1HpgJe6qj2f Q9q+TjGkuKK2H7pz+c4o5I9uvCEwPHrreW7L3HZjUsP2iXnyRSXlBoDPWwa+TD58+Q+jTiHBDrheY bj/PU74DYqN3HHLoUMIuzpalieZBTsUm4bl4eVfPp9oeWeCsPu2QS+OyWl2Ls1rWMQpXPXH10Ot7H MvG60N5koxyerS2Bt6a2xGU4F9TW8v9+NqKv4zCzOBdgzB+b3TI5sDZZU4qtDX2saVOMtr9lm415R AarKYJrD/38MrbHoc70Bp7PzMoyv0FhATpO2ceSYqA+/F7sWOf6VF0686b2IbIhdkKW1fT9TR178/ mzqRlVhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0JkL-000000050pu-1ZJj; Mon, 14 Oct 2024 12:00:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Ioj-00000004o1B-2Uuu for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2024 11:00:51 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_040049_704493_E13429AB X-CRM114-Status: GOOD ( 11.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; }