Thread (1 message) 1 message, 1 author, 2024-10-14
STALE657d

[RFC PATCH v1 26/57] net: hns3: Remove PAGE_SIZE compile-time constant assumption

From: Ryan Roberts <ryan.roberts@arm.com>
Date: 2024-10-14 11:00:49
Also in: linux-arm-kernel, linux-mm, lkml
Subsystem: hisilicon network subsystem 3 driver (hns3), hisilicon network subsystem driver, networking drivers, the rest · Maintainers: Jian Shen, Jijie Shao, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

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 <ryan.roberts@arm.com>
---

***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/ (local)

 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;
 }
 
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help