From e48b52cbba687fab4f88dce0402db8b18a928070 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 3 Jun 2025 11:52:36 +0100 Subject: [PATCH] net: marvell: oak: Fix build for Linux v6.16 In Linux v6.16, the 'index' member of the 'page' structure was renamed to '__folio_index'. Add a test to conftest to detect this and update the Marvell OAK ethernet driver accordingly to fix the build for Linux v6.16. JIRA LINQPJ14-60 Change-Id: I64a8e60990ea03eb212e79bfde474cd87efdf064 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3375190 (cherry picked from commit 5b61fa9366558e7567dc6b432059e581f347ca1a) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461879 Reviewed-by: mobile promotions Reviewed-by: Brad Griffis Tested-by: mobile promotions GVS: buildbot_gerritrpt --- drivers/net/ethernet/marvell/oak/oak_net.c | 8 ++++++++ scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/drivers/net/ethernet/marvell/oak/oak_net.c b/drivers/net/ethernet/marvell/oak/oak_net.c index f76a2306..cbe9ab73 100644 --- a/drivers/net/ethernet/marvell/oak/oak_net.c +++ b/drivers/net/ethernet/marvell/oak/oak_net.c @@ -991,7 +991,11 @@ static void oak_net_rbr_unmap(oak_rx_chan_t *rxp, struct page *page, ++rxp->stat.rx_unmap_pages; /* Reset index, mapping and page_phys */ rxp->rba[rxp->rbr_ridx].page_phys = 0; +#if defined(NV_PAGE_STRUCT_HAS___FOLIO_INDEX) /* Linux v6.16 */ + page->__folio_index = 0; +#else page->index = 0; +#endif page->mapping = NULL; __free_page(page); } @@ -1454,7 +1458,11 @@ static void oak_net_unmap_and_free_page(oak_t *np, oak_rxa_t *rba, rba->page_virt, rba->page_phys); /* Reset index, mapping and page_phys */ rba->page_phys = 0; +#if defined(NV_PAGE_STRUCT_HAS___FOLIO_INDEX) /* Linux v6.16 */ + page->__folio_index = 0; +#else page->index = 0; +#endif page->mapping = NULL; if (good_frame == 0) __free_page(page); diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 22bee9ae..b9903f84 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -184,6 +184,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_chip_struct_has_of_node_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_find NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_get_chip NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_property_for_each_u32_removed_internal_args +NV_CONFTEST_FUNCTION_COMPILE_TESTS += page_struct_has___folio_index NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_alloc_irqs NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_free_irqs diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index e4e13fd3..a463b386 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -8060,6 +8060,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_PLATFORM_MSI_DOMAIN_ALLOC_IRQS_PRESENT" "" "functions" ;; + page_struct_has___folio_index) + # + # Determine if the 'page' structure has '__folio_index' member. + # + # This change was made in Linux v6.16 by commit ("acc53a0b4c15 mm: + # rename page->index to page->__folio_index"). + # + CODE=" + #include + int conftest_page_struct_has___folio_index(void) { + return offsetof(struct page, __folio_index); + }" + + compile_check_conftest "$CODE" "NV_PAGE_STRUCT_HAS___FOLIO_INDEX" "" "types" + ;; + platform_msi_domain_free_irqs) # # Determine if the platform_msi_domain_free_irqs() API available or not.