1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Add qualcommax kernel 6.12 support

This commit is contained in:
Ycarus (Yannick Chabanois) 2025-01-10 18:11:03 +01:00
parent cb0fb6be18
commit 2ac3cb3c06
55 changed files with 18140 additions and 0 deletions

View file

@ -0,0 +1,20 @@
From 078b67683613d8f066a2955802b46a4b27eb642e Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 10 Dec 2024 13:24:39 +0200
Subject: [PATCH 16/17] nss-dp: disable warnings to support linux-6.12
Linux 6.12 adds these new warnings which become build errors
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
--- a/Makefile
+++ b/Makefile
@@ -90,4 +90,5 @@ endif
ccflags-y += $(NSS_DP_INCLUDE)
ccflags-y += -Wall -Werror
+ccflags-y += -Wno-missing-prototypes -Wno-missing-declarations
ccflags-y += -DEDMA_DEBUG_LEVEL=2

View file

@ -0,0 +1,74 @@
From cdfdb0fd6407bb3a3a3c7bf9602d40928d950641 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
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 <mantas@8devices.com>
---
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 <net/netdev_rx_queue.h>
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0))
+#include <net/rps.h>
+#include <net/hotdata.h>
+#endif
#if defined(NSS_DP_MAC_POLL_SUPPORT)
#include <init/ssdk_init.h>
#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,

View file

@ -0,0 +1,155 @@
From cdfdb0fd6407bb3a3a3c7bf9602d40928d950641 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 10 Dec 2024 13:32:04 +0200
Subject: [PATCH 18/18] nss-dp: update EEE support for 6.12
Linux 6.12 changed API for EEE link modes
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
nss_dp_ethtools.c | 8 ++++++--
2 files changed, 10 insertions(+), 8 deletions(-)
--- a/nss_dp_ethtools.c
+++ b/nss_dp_ethtools.c
@@ -206,6 +206,7 @@ static int32_t nss_dp_set_pauseparam(str
* nss_dp_fal_to_ethtool_linkmode_xlate()
* Translate linkmode from FAL type to ethtool type.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0))
static inline void nss_dp_fal_to_ethtool_linkmode_xlate(uint32_t *xlate_to, uint32_t *xlate_from)
{
uint32_t pos;
@@ -243,12 +244,26 @@ static inline void nss_dp_fal_to_ethtool
*xlate_from &= (~(1 << (pos - 1)));
}
}
+#else
+static inline void nss_dp_fal_to_ethtool_linkmode_xlate(unsigned long *to, uint32_t from)
+{
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, to, from & FAL_PHY_EEE_10BASE_T);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, to, from & FAL_PHY_EEE_100BASE_T);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, to, from & FAL_PHY_EEE_1000BASE_T);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, to, from & FAL_PHY_EEE_2500BASE_T);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, to, from & FAL_PHY_EEE_10000BASE_T);
+}
+#endif
/*
* nss_dp_get_eee()
* Get EEE settings.
*/
-static int32_t nss_dp_get_eee(struct net_device *netdev, struct ethtool_eee *eee)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0))
+static int nss_dp_get_eee(struct net_device *netdev, struct ethtool_eee *eee)
+#else
+static int nss_dp_get_eee(struct net_device *netdev, struct ethtool_keee *eee)
+#endif
{
struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(netdev);
fal_port_eee_cfg_t port_eee_cfg;
@@ -266,9 +281,15 @@ static int32_t nss_dp_get_eee(struct net
/*
* Translate the FAL linkmode types to ethtool linkmode types.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0))
nss_dp_fal_to_ethtool_linkmode_xlate(&eee->supported, &port_eee_cfg.capability);
nss_dp_fal_to_ethtool_linkmode_xlate(&eee->advertised, &port_eee_cfg.advertisement);
nss_dp_fal_to_ethtool_linkmode_xlate(&eee->lp_advertised, &port_eee_cfg.link_partner_advertisement);
+#else
+ nss_dp_fal_to_ethtool_linkmode_xlate(eee->supported, port_eee_cfg.capability);
+ nss_dp_fal_to_ethtool_linkmode_xlate(eee->advertised, port_eee_cfg.advertisement);
+ nss_dp_fal_to_ethtool_linkmode_xlate(eee->lp_advertised, port_eee_cfg.link_partner_advertisement);
+#endif
eee->eee_enabled = port_eee_cfg.enable;
eee->eee_active = port_eee_cfg.eee_status;
eee->tx_lpi_enabled = port_eee_cfg.lpi_tx_enable;
@@ -281,11 +302,15 @@ static int32_t nss_dp_get_eee(struct net
* nss_dp_set_eee()
* Set EEE settings.
*/
-static int32_t nss_dp_set_eee(struct net_device *netdev, struct ethtool_eee *eee)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0))
+static int nss_dp_set_eee(struct net_device *netdev, struct ethtool_eee *eee)
+#else
+static int nss_dp_set_eee(struct net_device *netdev, struct ethtool_keee *eee)
+#endif
{
struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(netdev);
fal_port_eee_cfg_t port_eee_cfg, port_eee_cur_cfg;
- uint32_t port_id, pos;
+ uint32_t port_id;
sw_error_t ret;
memset(&port_eee_cfg, 0, sizeof(fal_port_eee_cfg_t));
@@ -306,8 +331,9 @@ static int32_t nss_dp_set_eee(struct net
/*
* Translate the ethtool speed types to FAL speed types.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0))
while (eee->advertised) {
- pos = ffs(eee->advertised);
+ uint32_t pos = ffs(eee->advertised);
switch (1 << (pos - 1)) {
case ADVERTISED_10baseT_Full:
if (port_eee_cur_cfg.capability & FAL_PHY_EEE_10BASE_T) {
@@ -361,6 +387,48 @@ static int32_t nss_dp_set_eee(struct net
eee->advertised &= (~(1 << (pos - 1)));
}
+#else
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, eee->advertised)) {
+ if (port_eee_cur_cfg.capability & FAL_PHY_EEE_10BASE_T) {
+ port_eee_cfg.advertisement |= FAL_PHY_EEE_10BASE_T;
+ } else {
+ netdev_dbg(netdev, "Advertised value 10baseT_Full is not supported\n");
+ return -EIO;
+ }
+ }
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->advertised)) {
+ if (port_eee_cur_cfg.capability & FAL_PHY_EEE_100BASE_T) {
+ port_eee_cfg.advertisement |= FAL_PHY_EEE_100BASE_T;
+ } else {
+ netdev_dbg(netdev, "Advertised value 100baseT_Full is not supported\n");
+ return -EIO;
+ }
+ }
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->advertised)) {
+ if (port_eee_cur_cfg.capability & FAL_PHY_EEE_1000BASE_T) {
+ port_eee_cfg.advertisement |= FAL_PHY_EEE_1000BASE_T;
+ } else {
+ netdev_dbg(netdev, "Advertised value 1000baseT_Full is not supported\n");
+ return -EIO;
+ }
+ }
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, eee->advertised)) {
+ if (port_eee_cur_cfg.capability & FAL_PHY_EEE_2500BASE_T) {
+ port_eee_cfg.advertisement |= FAL_PHY_EEE_2500BASE_T;
+ } else {
+ netdev_dbg(netdev, "Advertised value 2500baseX_Full is not supported\n");
+ return -EIO;
+ }
+ }
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, eee->advertised)) {
+ if (port_eee_cur_cfg.capability & FAL_PHY_EEE_10000BASE_T) {
+ port_eee_cfg.advertisement |= FAL_PHY_EEE_10000BASE_T;
+ } else {
+ netdev_dbg(netdev, "Advertised value 1000baseT_Full is not supported\n");
+ return -EIO;
+ }
+ }
+#endif
port_eee_cfg.lpi_tx_enable = eee->tx_lpi_enabled;
port_eee_cfg.lpi_sleep_timer = eee->tx_lpi_timer;
@@ -482,8 +550,10 @@ struct ethtool_ops nss_dp_ethtool_ops =
#endif
.get_pauseparam = &nss_dp_get_pauseparam,
.set_pauseparam = &nss_dp_set_pauseparam,
+
.get_eee = &nss_dp_get_eee,
.set_eee = &nss_dp_set_eee,
+
.get_priv_flags = nss_dp_get_priv_flags,
.set_priv_flags = nss_dp_set_priv_flags,
};

View file

@ -0,0 +1,72 @@
From ef91390278b98b48adf65e6d3b772ddecfc4f6b0 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 10 Dec 2024 13:05:30 +0200
Subject: [PATCH 7/9] ssdk: replace deprecated strlcpy() with strscpy()
Since linux-6.12 strlcpy() is no longer available
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
src/shell_lib/shell_io.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/src/shell_lib/shell_io.c
+++ b/src/shell_lib/shell_io.c
@@ -951,16 +951,16 @@ cmd_sscanf(const char *buf, const char *
if(buf[0] == '0' && (buf[1] == 'x' || buf[1] == 'X'))
{
if(!fmt)
- strlcpy(fmt_tmp, "%x", sizeof(fmt_tmp));
+ strscpy(fmt_tmp, "%x", sizeof(fmt_tmp));
else
{
if(strspn(fmt, "%lLxXhH") != strlen(fmt))
return SW_BAD_VALUE;
if(fmt[0] == '%' && ((fmt[1] == 'l' || fmt[1] == 'L') &&
(fmt[2] == 'l' || fmt[2] == 'L')))
- strlcpy(fmt_tmp, "%llx", sizeof(fmt_tmp));
+ strscpy(fmt_tmp, "%llx", sizeof(fmt_tmp));
else
- strlcpy(fmt_tmp, fmt, sizeof(fmt_tmp));
+ strscpy(fmt_tmp, fmt, sizeof(fmt_tmp));
}
}
else
@@ -968,16 +968,16 @@ cmd_sscanf(const char *buf, const char *
if(strspn(buf, "1234567890") != strlen(buf))
return SW_BAD_VALUE;
if(!fmt)
- strlcpy(fmt_tmp, "%d", sizeof(fmt_tmp));
+ strscpy(fmt_tmp, "%d", sizeof(fmt_tmp));
else
{
if(strspn(fmt, "%lLdD") != strlen(fmt))
return SW_BAD_VALUE;
if(fmt[0] == '%' && ((fmt[1] == 'l' || fmt[1] == 'L') &&
(fmt[2] == 'l' || fmt[2] == 'L')))
- strlcpy(fmt_tmp, "%lld", sizeof(fmt_tmp));
+ strscpy(fmt_tmp, "%lld", sizeof(fmt_tmp));
else
- strlcpy(fmt_tmp, fmt, sizeof(fmt_tmp));
+ strscpy(fmt_tmp, fmt, sizeof(fmt_tmp));
}
}
if(sscanf(buf, fmt_tmp, arg_val) != 1)
@@ -2736,7 +2736,7 @@ cmd_data_check_portmap(char *cmdstr, fal
return SW_OK;
}
- strlcpy(tmp_str, cmdstr, sizeof(tmp_str));
+ strscpy(tmp_str, cmdstr, sizeof(tmp_str));
tmp = (void *) strsep(&cmdstr, ",");
while (tmp)
{
@@ -12818,7 +12818,7 @@ cmd_data_check_tunnel_encap_entry(char *
break;
}
/* copy 2 chars from cmd */
- strlcpy(cmd_byte, cmd, sizeof(cmd_byte));
+ strscpy(cmd_byte, cmd, sizeof(cmd_byte));
sscanf(cmd_byte, "%hhx",
&(entry.pkt_header.pkt_header_data[bytes]));
cmd += 2;

View file

@ -0,0 +1,25 @@
From 85c328ef31f3da7b2dab82c5a1c8559295620f76 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 10 Dec 2024 13:10:07 +0200
Subject: [PATCH 8/9] ssdk: disable warnings to support linux-6.12
Linux 6.12 adds these new warnings which become build errors with
default -Werror.
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
make/linux_opt.mk | 3 +++
1 file changed, 3 insertions(+)
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -314,6 +314,9 @@ endif
MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s"
+# Linux 6.12 compatibility
+MODULE_CFLAG += -Wno-missing-prototypes -Wno-missing-declarations -Wno-discarded-qualifiers
+
MODULE_INC += -I$(PRJ_PATH)/include \
-I$(PRJ_PATH)/include/common \
-I$(PRJ_PATH)/include/api \

View file

@ -0,0 +1,22 @@
From 01e7ad1b785b0662e9a2f41cb7dffbcea35ed0c1 Mon Sep 17 00:00:00 2001
From: Mantas Pucka <mantas@8devices.com>
Date: Tue, 10 Dec 2024 13:13:16 +0200
Subject: [PATCH 9/9] ssdk: add missing include
Fixes build with linux 6.12
Signed-off-by: Mantas Pucka <mantas@8devices.com>
---
src/init/ssdk_dts.c | 1 +
1 file changed, 1 insertion(+)
--- a/src/init/ssdk_dts.c
+++ b/src/init/ssdk_dts.c
@@ -38,6 +38,7 @@
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_platform.h>
+#include <linux/platform_device.h>
static ssdk_dt_global_t ssdk_dt_global = {0};
#ifdef HPPE

View file

@ -0,0 +1,50 @@
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,19 @@
-include ./config
-
ifndef PRJ_PATH
PRJ_PATH=$(shell pwd)
endif
export PRJ_PATH
-include ./make/config.mk
-include ./make/tools.mk
-include ./make/$(OS)_opt.mk
+include $(PRJ_PATH)/config
+
+include $(PRJ_PATH)/make/config.mk
+include $(PRJ_PATH)/make/tools.mk
+include $(PRJ_PATH)/make/$(OS)_opt.mk
SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile)))
SUB_LIB=$(subst src/, , $(SUB_DIR))
+include $(PRJ_PATH)/Makefile.modules
+
####################################################################
# SSDK-Style Makefile
####################################################################
@@ -27,11 +29,7 @@ all: $(BIN_DIR) kslib
# LNX Modules-Style Makefile
####################################################################
modules: $(BIN_DIR) kslib_c
- mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile;
- make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules
- cp $(PRJ_PATH)/temp/Module.symvers $(PRJ_PATH)/Module.symvers;
- cp temp/*.ko build/bin;
- rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a
+ @$(MAKE) -C $(SYS_PATH) M=$(PRJ_PATH) $(LNX_MAKEOPTS) modules
@echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
kslib_c:
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -785,6 +785,6 @@ LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_M
####################################################################
# cflags for LNX Modules-Style Makefile
####################################################################
-LNX_LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) ${EXTRA_INC} -DFALLTHROUGH
+LNX_LOCAL_CFLAGS = $(MODULE_INC) $(MODULE_CFLAG) ${EXTRA_INC} -DFALLTHROUGH
export LNX_LOCAL_CFLAGS