mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
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/+/3018212 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8ca3fa5c51
commit
243e54b69e
@@ -2477,12 +2477,14 @@ static int ether_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
|
||||
(unsigned int)phyreg);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_MII_BUS_STRUCT_HAS_WRITE_C45) /* Linux v6.3 */
|
||||
static int ether_mdio_write_c45(struct mii_bus *bus, int phyaddr, int devad, int regnum, u16 val)
|
||||
{
|
||||
return ether_mdio_write(bus, phyaddr, ether_mdio_c45_addr(devad, regnum), val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(NV_MII_BUS_STRUCT_HAS_READ_C45) /* Linux v6.3 */
|
||||
static int ether_mdio_read_c45(struct mii_bus *bus, int phyaddr, int devad, int regnum)
|
||||
{
|
||||
return ether_mdio_read(bus, phyaddr, ether_mdio_c45_addr(devad, regnum));
|
||||
@@ -2521,8 +2523,10 @@ static int ether_mdio_register(struct ether_priv_data *pdata)
|
||||
new_bus->name = "nvethernet_mdio_bus";
|
||||
new_bus->read = ether_mdio_read;
|
||||
new_bus->write = ether_mdio_write;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
#if defined(NV_MII_BUS_STRUCT_HAS_READ_C45) /* Linux v6.3 */
|
||||
new_bus->read_c45 = ether_mdio_read_c45;
|
||||
#endif
|
||||
#if defined(NV_MII_BUS_STRUCT_HAS_WRITE_C45) /* Linux v6.3 */
|
||||
new_bus->write_c45 = ether_mdio_write_c45;
|
||||
#endif
|
||||
ret = snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));
|
||||
|
||||
@@ -117,6 +117,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
|
||||
|
||||
@@ -6916,6 +6916,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
|
||||
|
||||
Reference in New Issue
Block a user