From patchwork Mon Oct 14 10:58:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834695 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 11060D1A43B for ; Mon, 14 Oct 2024 11:00:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DD316B00AE; Mon, 14 Oct 2024 07:00:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 864A76B00B0; Mon, 14 Oct 2024 07:00:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DE136B00B1; Mon, 14 Oct 2024 07:00:55 -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 48A906B00AE for ; Mon, 14 Oct 2024 07:00:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7C8201C6153 for ; Mon, 14 Oct 2024 11:00:46 +0000 (UTC) X-FDA: 82671915060.26.A1F74FE Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id DE5E81A0028 for ; Mon, 14 Oct 2024 11:00:45 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903538; a=rsa-sha256; cv=none; b=vkBwMavT9nUK7IQFS1k3zaO2/QuqPXPW8QoJxkIJYBK+6BTob+iCNcTWd3l+r2QOOMqQrf 1SHVFWJ64UU1yVGPdcvAzt5eewwDoOobtemZNIefjHetV4/zGOW4mUs1JUoeomT7gJG2a5 YqvFa4cbXDz81PaWkJB5+tTvxN+CQdY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf19.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903538; 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=cjEGbvB+Gk2WgjQzVrxDcv3CTXI9xiLVm+8stz+1Wsc=; b=4A7OSBaNKRQLpvFmm87e7FXQtQzq27Nn0/k4TY14/V6DCKQxVmdNt1v0sYSoza4mt794Rw ZXmS4f8oUjnP20QYfAY04hTcI6cSPsL76Kf/yj6xmAR+xcIK7uBEaw3tUPMr/B2yEyoTv2 fJklWQ0lwqU+UrPl2lNQFR6/mout6Ck= 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 47DC9169E; Mon, 14 Oct 2024 04:01:22 -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 84C1A3F51B; Mon, 14 Oct 2024 04:00:49 -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 , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Paolo Abeni , Will Deacon Cc: Ryan Roberts , intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org Subject: [RFC PATCH v1 27/57] net: e1000: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:34 +0100 Message-ID: <20241014105912.3207374-27-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: rspam12 X-Rspamd-Queue-Id: DE5E81A0028 X-Stat-Signature: qs47wnnchyt6xyshjd7obphcr517nqd3 X-Rspam-User: X-HE-Tag: 1728903645-457802 X-HE-Meta: U2FsdGVkX1/HGddPOJqXefwqPExwowsgdvd37gncvs8zBi9JPYsMwkoI7xcZ+MfZn5AyxyXafhJ+6h8jBoUtTbiMaQg6JWkWREI37Dao/xIwORz1uIM3+tUAQ2xp4fIMVUhdh9anEneHMZUpn1VuCU2YXjjP05FBobq86qHV3XerPlyIUUGzUr5GTBK4Q66H7vQkUFtnRsMCtyBdHUDvdpcTM2cuCnYFxhytjqkEq0EUttEKdtmod+p1Ypj/TJaSTjfjsGzRy2H3tglBJuIVWzcgEtxw0FfgyIOPbSdocKCGshvGrPYwCBEYfi8Ka55f/u1zmQ0vCHteRSe6OB1Q0tO4Zi8FrDRPaS4Jch39lRzkyjAWUQLKsULKDEiTZXjvdrHb9vepkMFatNcdjdCz8i4Ybm/YCZg+HzA6BuJGT3Z+yyRa2W9J0ZLgxxgscfchRuJTO694vwPViakxnk44kKxlrim2RetzdgMrTWjlN9EcO1HIdMNTxBZkX0mWtVZXkr2k7OET3klFSTiG9xtBAkYH74LfZeYWSTvPd4dA+iiZ72LNQ2x2MdL/QOWrq8s2U75/7dSpgPbGSwYqlELIFAZUrfLDeXNbDRuN57E6t3t1j94W39MEtfqcQq7nKLQQacSuEUAw9YYAeanFdicQUov40zvJWVDjrzhvart/o9f/CntfJ4lX+B+Yi+y061zQXDsawdTId5SB2zhb7NCRuSDvJbBOXK8RZcvf+I9LDDhybehEE+XBwpbtkpGNZ66tHAu4tQYTXCJ7AgIzewamBfIX0U8q0HORaFowtP/sSPbDX75XB290qjGpp3X8mASv+RxuK9Tnhhb45ypjK4qv82au8v28Z+wbPhlbNLbjk6OOm/I1gaHM0JuaE/5ZMfQOzfri3pooFM3r3130i07qyIqcMQbUjgiLGbn/coY2c1U8MjGU/mQ4RuJrcH8+vCKne0Ru+oVzP6XfsTZgZ+r e7VSKWH6 y7eLyOuViWVIpwcgekNVYp0ALyIFkN+cDmo03pIW/z37p9em5lJcSc87hVJz8ylqSqOcW9u+1JvTJHF0CFSziXAFfaoCAU9NCAtd4eRHosxKj2H+RwzPeOfl22FzgPYUDujCrB6jbDdRVVMZX3P62a+eYXtiSM1l81RQadH1YbJnPL2PW0Ch5UVAU5lvAQCTrTQ4OVZ2d9Nxz8d6+V74GuDR1JNLgiWKOjnzl 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 CPP conditionals to C conditionals. 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/intel/e1000/e1000_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index ab7ae418d2948..cc14788f5bb04 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c @@ -3553,12 +3553,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) if (max_frame <= E1000_RXBUFFER_2048) adapter->rx_buffer_len = E1000_RXBUFFER_2048; - else -#if (PAGE_SIZE >= E1000_RXBUFFER_16384) + else if (PAGE_SIZE >= E1000_RXBUFFER_16384) adapter->rx_buffer_len = E1000_RXBUFFER_16384; -#elif (PAGE_SIZE >= E1000_RXBUFFER_4096) + else if (PAGE_SIZE >= E1000_RXBUFFER_4096) adapter->rx_buffer_len = PAGE_SIZE; -#endif /* adjust allocation if LPE protects us, and we aren't using SBP */ if (!hw->tbi_compatibility_on &&