diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_tc.c b/drivers/net/ethernet/nvidia/nvethernet/ether_tc.c index 787577b7..54053a36 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_tc.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_tc.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ +/* Copyright (c) 2019-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved */ +#include #include "ether_linux.h" int ether_tc_setup_taprio(struct ether_priv_data *pdata, @@ -57,12 +58,29 @@ int ether_tc_setup_taprio(struct ether_priv_data *pdata, /* This code is to disable TSN, User space is asking to disable */ +#if defined(NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD) /* Linux v6.4.5 */ + if (qopt->cmd == TAPRIO_CMD_DESTROY) { +#else if (!qopt->enable) { +#endif //NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD goto disable; } tc_ioctl_data.est.llr = qopt->num_entries; +#if defined(NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD) /* Linux v6.4.5 */ + switch (qopt->cmd) { + case TAPRIO_CMD_REPLACE: + tc_ioctl_data.est.en_dis = true; + break; + case TAPRIO_CMD_DESTROY: + tc_ioctl_data.est.en_dis = false; + break; + default: + return -EOPNOTSUPP; + } +#else tc_ioctl_data.est.en_dis = qopt->enable; +#endif //NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD for (i = 0U; i < tc_ioctl_data.est.llr; i++) { cycle_time = qopt->entries[i].interval; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index f6a47b07..d511f350 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -110,6 +110,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_link_struct_has_c2c_params_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map NV_CONFTEST_GENERIC_COMPILE_TESTS ?= diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 75469013..afb650d5 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6702,6 +6702,23 @@ compile_test() { "NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG" "" "types" ;; + tc_taprio_qopt_offload_struct_has_cmd) + # + # Determine if struct tc_taprio_qopt_offload has a member named cmd + # + # Commit 2d800bc500fb ("net/sched: taprio: replace tc_taprio_qopt_offload + # :: enable with a "cmd" enum") replace tc_taprio_qopt_offload structure member + # 'enable' with 'cmd' in Linux v6.4.5. + # + CODE=" + #include + int conftest_tc_taprio_qopt_offload_struct_has_cmd(void) { + return offsetof(struct tc_taprio_qopt_offload, cmd); + } + " + compile_check_conftest "$CODE" "NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD" "" "types" + ;; + tegra_ivc_struct_has_iosys_map) # # Determine if the 'tegra_ivc' structure has the 'map' argument.