net: nvethernet: Use conftest for Linux v6.3

Add tests to conftest for detecting if the mii_bus structure has the
read_c45 and write_c45 function pointers and use the definitions
generated by conftest in the nvethernet driver.

This fixes support for nvethernet in 3rd party Linux kernels that have
backported the mii_bus structure changes to their kernel that have a
kernel version prior to Linux v6.3.

Bug 4014315

Change-Id: I5ae98fc5077337286921da6e9347df9781565a70
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3018935
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-11-17 16:00:05 +00:00
committed by mobile promotions
parent 856471d64f
commit 067fbd7bbc
3 changed files with 42 additions and 2 deletions

View File

@@ -116,6 +116,8 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data

View File

@@ -6896,6 +6896,40 @@ compile_test() {
compile_check_conftest "$CODE" "NV_KTHREAD_COMPLETE_AND_EXIT_PRESENT" "" "functions"
;;
mii_bus_struct_has_read_c45)
#
# Determine if the 'mii_bus' structure has 'read_c45' field.
#
# Added in commit 4e4aafcddbbf ("net: mdio: Add dedicated C45 API to
# MDIO bus drivers") in Linux v6.3.
#
CODE="
#include <linux/phy.h>
int conftest_mii_bus_struct_has_read_c45(void) {
return offsetof(struct mii_bus, read_c45);
}"
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_READ_C45" "" "types"
;;
mii_bus_struct_has_write_c45)
#
# Determine if the 'mii_bus' structure has 'write_c45' field.
#
# Added in commit 4e4aafcddbbf ("net: mdio: Add dedicated C45 API to
# MDIO bus drivers") in Linux v6.3.
#
CODE="
#include <linux/phy.h>
int conftest_mii_bus_struct_has_read_c45(void) {
return offsetof(struct mii_bus, write_c45);
}"
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types"
;;
register_shrinker_has_fmt_arg)
#
# Determine if the 'register_shrinker' function