net: nvethernet: Fix build for Linux v6.8

The ethtool_ops function pointers get_rxfh and set_rxfh were updated for
Linux v6.8 to pass arguments via a new 'ethtool_rxfh_param' structure.
Add a new test for conftest to detect if the get_rxfh and set_rxfh
functions support the 'ethtool_rxfh_param' structure and update the
nvethernet driver accordingly for Linux v6.8.

Bug 4448428

Change-Id: Ia1c49d88c4ac73539454b010af92c261e14be4bf
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037949
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-12-19 12:27:25 +00:00
committed by mobile promotions
parent 10fd025187
commit 0356a563b3
3 changed files with 45 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // 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 <nvidia/conftest.h> #include <nvidia/conftest.h>
@@ -1455,11 +1455,21 @@ static u32 ether_get_rxfh_indir_size(struct net_device *ndev)
* *
* @retval 0 on success * @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, static int ether_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key,
u8 *hfunc) u8 *hfunc)
#endif
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; 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; int i;
if (indir) { if (indir) {
@@ -1487,12 +1497,23 @@ static int ether_get_rxfh(struct net_device *ndev, u32 *indir, u8 *key,
* @retval 0 on success * @retval 0 on success
* @retval -1 on failure. * @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, static int ether_set_rxfh(struct net_device *ndev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
#endif
{ {
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
struct osi_ioctl ioctl_data = {}; 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; int i;
if (!netif_running(ndev)) { if (!netif_running(ndev)) {

View File

@@ -117,6 +117,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 += 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_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_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_file_rcu_has_double_ptr_file_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_new_client_device NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_new_client_device

View File

@@ -7035,6 +7035,28 @@ compile_test() {
compile_check_conftest "$CODE" "NV_ETHTOOL_OPS_GET_SET_RINGPARAM_HAS_RINGPARAM_AND_EXTACT_ARGS" "" "types" 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 <linux/ethtool.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <uapi/linux/ethtool.h>
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) netif_set_tso_max_size)
# #
# Determine if netif_set_tso_max_size() function is present # Determine if netif_set_tso_max_size() function is present