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 <jonathanh@nvidia.com>
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 <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-06-03 11:52:36 +01:00
committed by mobile promotions
parent 66ab02d7b9
commit e48b52cbba
3 changed files with 25 additions and 0 deletions

View File

@@ -991,7 +991,11 @@ static void oak_net_rbr_unmap(oak_rx_chan_t *rxp, struct page *page,
++rxp->stat.rx_unmap_pages; ++rxp->stat.rx_unmap_pages;
/* Reset index, mapping and page_phys */ /* Reset index, mapping and page_phys */
rxp->rba[rxp->rbr_ridx].page_phys = 0; 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; page->index = 0;
#endif
page->mapping = NULL; page->mapping = NULL;
__free_page(page); __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); rba->page_virt, rba->page_phys);
/* Reset index, mapping and page_phys */ /* Reset index, mapping and page_phys */
rba->page_phys = 0; rba->page_phys = 0;
#if defined(NV_PAGE_STRUCT_HAS___FOLIO_INDEX) /* Linux v6.16 */
page->__folio_index = 0;
#else
page->index = 0; page->index = 0;
#endif
page->mapping = NULL; page->mapping = NULL;
if (good_frame == 0) if (good_frame == 0)
__free_page(page); __free_page(page);

View File

@@ -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_find
NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_get_chip 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 += 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 += pde_data
NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_alloc_irqs NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_alloc_irqs
NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_free_irqs NV_CONFTEST_FUNCTION_COMPILE_TESTS += platform_msi_domain_free_irqs

View File

@@ -8060,6 +8060,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PLATFORM_MSI_DOMAIN_ALLOC_IRQS_PRESENT" "" "functions" 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 <linux/mm_types.h>
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) platform_msi_domain_free_irqs)
# #
# Determine if the platform_msi_domain_free_irqs() API available or not. # Determine if the platform_msi_domain_free_irqs() API available or not.