diff --git a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c index 28495c40..dd082670 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ethtool.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ethtool.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -1455,11 +1455,21 @@ static u32 ether_get_rxfh_indir_size(struct net_device *ndev) * * @retval 0 on success */ +#if defined(NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS) +static int ether_get_rxfh(struct net_device *ndev, + struct ethtool_rxfh_param *rxfh) +#else static int ether_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key, u8 *hfunc) +#endif { struct ether_priv_data *pdata = netdev_priv(ndev); struct osi_core_priv_data *osi_core = pdata->osi_core; +#if defined(NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS) + u32 *indir = rxfh->indir; + u8 *hfunc = &rxfh->hfunc; + u8 *key = rxfh->key; +#endif int i; if (indir) { @@ -1487,12 +1497,23 @@ static int ether_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key, * @retval 0 on success * @retval -1 on failure. */ +#if defined(NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS) +static int ether_set_rxfh(struct net_device *ndev, + struct ethtool_rxfh_param *rxfh, + struct netlink_ext_ack *extack) +#else static int ether_set_rxfh(struct net_device *ndev, const u32 *indir, const u8 *key, const u8 hfunc) +#endif { struct ether_priv_data *pdata = netdev_priv(ndev); struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_ioctl ioctl_data = {}; +#if defined(NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS) + u32 *indir = rxfh->indir; + u8 hfunc = rxfh->hfunc; + u8 *key = rxfh->key; +#endif int i; if (!netif_running(ndev)) { diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 3ade9d17..8b82b5af 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -115,6 +115,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_scdc_get_set_has_struct_drm_connector_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_coalesce_has_coal_and_extack_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringparam_and_extack_args +NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_rxfh_has_rxfh_param_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_probe_without_i2c_device_id_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index a2f5ea6f..2faed1c9 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6982,6 +6982,28 @@ compile_test() { compile_check_conftest "$CODE" "NV_ETHTOOL_OPS_GET_SET_RINGPARAM_HAS_RINGPARAM_AND_EXTACT_ARGS" "" "types" ;; + ethtool_ops_get_set_rxfh_has_rxfh_param_args) + # + # Determine if the 'get_rxfh' and 'set_rxfh' ethtool_ops functions + # support the 'ethtool_rxfh_param' argument. + # + # Added by commit fb6e30a72539 ("net: ethtool: pass a pointer to + # parameters to get/set_rxfh ethtool ops") in Linux v6.8. + # + CODE=" + #include + #include + #include + #include + void conftest_ethtool_ops_get_set_rxfh_has_rxfh_param_args(struct ethtool_ops *ops) { + int (*fn)(struct net_device *, + struct ethtool_rxfh_param *rxfh) = ops->get_rxfh; + }" + + compile_check_conftest "$CODE" \ + "NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS" "" "types" + ;; + netif_set_tso_max_size) # # Determine if netif_set_tso_max_size() function is present