From cdfdb0fd6407bb3a3a3c7bf9602d40928d950641 Mon Sep 17 00:00:00 2001 From: Mantas Pucka Date: Tue, 10 Dec 2024 13:32:04 +0200 Subject: [PATCH 17/18] nss-dp: adapt to linux 6.12 API Add compatibility with 6.12 Signed-off-by: Mantas Pucka --- nss_dp_main.c | 10 ++++------ 2 files changed, 10 insertions(+), 8 deletions(-) --- a/nss_dp_main.c +++ b/nss_dp_main.c @@ -34,6 +34,10 @@ #if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 6, 0)) #include #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) +#include +#include +#endif #if defined(NSS_DP_MAC_POLL_SUPPORT) #include #endif @@ -496,14 +500,22 @@ static int nss_dp_rx_flow_steer(struct n rxflow = &flow_table->flows[hash & flow_table->mask]; rxcpu = (uint32_t)rxflow->cpu; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) + sock_flow_table = rcu_dereference(net_hotdata.rps_sock_flow_table); +#else sock_flow_table = rcu_dereference(rps_sock_flow_table); +#endif if (!sock_flow_table) { netdev_dbg(netdev, "Global RPS flow table not found\n"); return -EINVAL; } rfscpu = sock_flow_table->ents[hash & sock_flow_table->mask]; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)) + rfscpu &= net_hotdata.rps_cpu_mask; +#else rfscpu &= rps_cpu_mask; +#endif if (rxcpu == rfscpu) return 0; @@ -998,6 +1010,13 @@ static int nss_dp_remove(struct platform return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0) +static void nss_dp_remove_new(struct platform_device *pdev) +{ + nss_dp_remove(pdev); +} +#endif + static struct of_device_id nss_dp_dt_ids[] = { { .compatible = "qcom,nss-dp" }, {}, @@ -1006,7 +1025,11 @@ MODULE_DEVICE_TABLE(of, nss_dp_dt_ids); static struct platform_driver nss_dp_drv = { .probe = nss_dp_probe, +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,12,0) .remove = nss_dp_remove, +#else + .remove_new = nss_dp_remove_new, +#endif .driver = { .name = "nss-dp", .owner = THIS_MODULE,