nvethernet: fix compilation error with k6.4.5

Fix compilation error while building nvethernet driver with k6.4.5

Bug 4221847

Change-Id: I0f7158949da7371135e4b483aea5a0fc4dc33890
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990328
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Revanth Kumar Uppala
2023-10-03 14:23:30 +05:30
committed by mobile promotions
parent 2cc58560db
commit 9db9eb336c
3 changed files with 37 additions and 1 deletions

View File

@@ -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 <nvidia/conftest.h>
#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;

View File

@@ -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 ?=

View File

@@ -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 <net/pkt_sched.h>
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.