Skip to content

Commit

Permalink
kernel: qca-ssdk/qca-nss-dp: update to 12.5 for kernel 6.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Nov 9, 2024
1 parent f2e1532 commit 2b10822
Show file tree
Hide file tree
Showing 40 changed files with 4,750 additions and 127 deletions.
11 changes: 5 additions & 6 deletions package/qca/qca-nss-dp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ PKG_RELEASE:=2

PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2023-06-06
PKG_SOURCE_VERSION:=fa67464466f69f00967cc373d1bdd6025f57eb89
PKG_MIRROR_HASH:=51bf524382a5cb542c2c80d12a91f87b9736de3ac3c1d4a351c97b3502d68574
PKG_SOURCE_DATE:=2024-04-16
PKG_SOURCE_VERSION:=5bf8b91e9fc209f175f9a58723b03055ace3d581
PKG_MIRROR_HASH:=c50fefd3debbc01040f900c20da9a9bb6ae36aa72a532362aae1152e83c203a0

PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared
Expand Down Expand Up @@ -39,16 +39,15 @@ EXTRA_CFLAGS+= \

NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal
define Build/Configure
$(LN) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h \
$(CP) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h \
$(PKG_BUILD_DIR)/exports/nss_dp_arch.h
endef

define Build/Compile
+$(KERNEL_MAKE) $(PKG_JOBS) \
-C "$(LINUX_DIR)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
SoC="$(CONFIG_TARGET_SUBTARGET)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \
modules
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Signed-off-by: Baruch Siach <baruch@tkos.co.il>
ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0);
+#else
+ if (ndev && phy_has_txtstamp(ndev->phydev))
+ phy_rxtstamp(ndev->phydev, skb, 0);
+ phy_txtstamp(ndev->phydev, skb, 0);
+#endif
}
EXPORT_SYMBOL(nss_phy_tstamp_tx_buf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>

--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -202,13 +202,10 @@ struct nss_dp_dev {
@@ -225,13 +225,10 @@ struct nss_dp_dev {
unsigned long drv_flags; /* Driver specific feature flags */

/* Phy related stuff */
Expand All @@ -43,7 +43,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -418,7 +418,7 @@ static int nss_dp_open(struct net_device
@@ -436,7 +436,7 @@ static int nss_dp_open(struct net_device

netif_start_queue(netdev);

Expand All @@ -52,7 +52,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
/* Notify data plane link is up */
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
netdev_dbg(netdev, "Data plane set link failed\n");
@@ -615,6 +615,12 @@ static int32_t nss_dp_of_get_pdata(struc
@@ -633,6 +633,12 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
}

Expand All @@ -65,7 +65,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
pr_err("%s: error reading mactype\n", np->name);
return -EFAULT;
@@ -635,18 +641,6 @@ static int32_t nss_dp_of_get_pdata(struc
@@ -653,18 +659,6 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
#endif

Expand All @@ -84,7 +84,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
maddr = (uint8_t *)of_get_mac_address(np);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0))
@@ -695,56 +689,6 @@ static int32_t nss_dp_of_get_pdata(struc
@@ -753,56 +747,6 @@ static int32_t nss_dp_of_get_pdata(struc
return 0;
}

Expand Down Expand Up @@ -141,15 +141,15 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#ifdef CONFIG_NET_SWITCHDEV
/*
* nss_dp_is_phy_dev()
@@ -803,7 +747,6 @@ static int32_t nss_dp_probe(struct platf
@@ -861,7 +805,6 @@ static int32_t nss_dp_probe(struct platf
struct device_node *np = pdev->dev.of_node;
struct nss_gmac_hal_platform_data gmac_hal_pdata;
int32_t ret = 0;
- uint8_t phy_id[MII_BUS_ID_SIZE + 3];
#if defined(NSS_DP_PPE_SUPPORT)
uint32_t vsi_id;
fal_port_t port_id;
@@ -880,22 +823,14 @@ static int32_t nss_dp_probe(struct platf
@@ -940,22 +883,16 @@ static int32_t nss_dp_probe(struct platf

dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE);

Expand All @@ -161,20 +161,23 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
- }
- snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
- dp_priv->miibus->id, dp_priv->phy_mdio_addr);
-
+ if (dp_priv->phy_node) {
SET_NETDEV_DEV(netdev, &pdev->dev);

- dp_priv->phydev = phy_connect(netdev, phy_id,
- &nss_dp_adjust_link,
- dp_priv->phy_mii_type);
- if (IS_ERR(dp_priv->phydev)) {
- netdev_dbg(netdev, "failed to connect to phy device\n");
- goto phy_setup_fail;
- }
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
+ if (!(dp_priv->phydev)) {
+ netdev_err(netdev, "failed to connect to phy device\n");
goto phy_setup_fail;
}
+ goto phy_setup_fail;
+ }
+ phy_attached_info(dp_priv->phydev);
}

#if defined(NSS_DP_PPE_SUPPORT)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -746,18 +746,29 @@ static int32_t nss_dp_probe(struct platf
@@ -804,18 +804,29 @@ static int32_t nss_dp_probe(struct platf
struct nss_dp_dev *dp_priv;
struct device_node *np = pdev->dev.of_node;
struct nss_gmac_hal_platform_data gmac_hal_pdata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>

#define NSS_DP_SWITCH_ID 0
#define NSS_DP_SW_ETHTYPE_PID 0 /* PPE ethtype profile ID for slow protocols */
@@ -521,7 +523,76 @@ static struct notifier_block *nss_dp_sw_
@@ -534,7 +536,76 @@ static struct notifier_block *nss_dp_sw_

#else

Expand Down
10 changes: 10 additions & 0 deletions package/qca/qca-nss-dp/patches/0010-nss-dp-add-vlan-if.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -18,6 +18,7 @@

#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/if_vlan.h>
#include <linux/version.h>
#include <linux/of.h>
#include <linux/of_net.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From c318c90b824c59539bf2e33618e381293398616c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 15:02:49 +0200
Subject: [PATCH 1/6] edma_v1: rework hw_reset logic to permit rmmod and insmod

Rework hw_reset logic for edma v1 to permit rmmod and insmod by using
get_exclusive_released variant (assuming the reset control was released)
and manually acquire and release it.

This permits rmmod and insmod without triggering warning or receiving
-EBUSY errors.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_cfg.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--- a/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c
@@ -719,18 +719,22 @@ int edma_hw_reset(struct edma_hw *ehw)
struct reset_control *rst;
struct platform_device *pdev = ehw->pdev;

- rst = devm_reset_control_get(&pdev->dev, EDMA_HW_RESET_ID);
+ rst = devm_reset_control_get_exclusive_released(&pdev->dev, EDMA_HW_RESET_ID);
if (IS_ERR(rst)) {
pr_warn("DTS Node: %s does not exist\n", EDMA_HW_RESET_ID);
return -EINVAL;
}

+ reset_control_acquire(rst);
+
reset_control_assert(rst);
udelay(100);

reset_control_deassert(rst);
udelay(100);

+ reset_control_release(rst);
+
pr_info("EDMA HW Reset completed succesfully\n");

return 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From 079bfe441b274a8c06474be82e4ccc88599a5e0e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:08:46 +0200
Subject: [PATCH 2/6] nss_dp_switchdev: correctly unregister notifier on
dp_remove

Correctly unregister notifier on dp_remove to fix kernel panic on system
reboot.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
include/nss_dp_dev.h | 1 +
nss_dp_main.c | 4 ++++
nss_dp_switchdev.c | 13 +++++++++++++
3 files changed, 18 insertions(+)

--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -349,6 +349,7 @@ void nss_dp_set_ethtool_ops(struct net_d
*/
#ifdef CONFIG_NET_SWITCHDEV
void nss_dp_switchdev_setup(struct net_device *dev);
+void nss_dp_switchdev_remove(struct net_device *dev);
bool nss_dp_is_phy_dev(struct net_device *dev);
#endif

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -970,6 +970,10 @@ static int nss_dp_remove(struct platform
if (!dp_priv)
continue;

+ #ifdef CONFIG_NET_SWITCHDEV
+ nss_dp_switchdev_remove(dp_priv->netdev);
+ #endif
+
dp_ops = dp_priv->data_plane_ops;
hal_ops = dp_priv->gmac_hal_ops;

--- a/nss_dp_switchdev.c
+++ b/nss_dp_switchdev.c
@@ -648,4 +648,17 @@ void nss_dp_switchdev_setup(struct net_d

switch_init_done = true;
}
+
+void nss_dp_switchdev_remove(struct net_device *dev)
+{
+ if (!switch_init_done)
+ return;
+
+ if (nss_dp_sw_ev_nb)
+ unregister_switchdev_notifier(nss_dp_sw_ev_nb);
+
+ unregister_switchdev_blocking_notifier(&nss_dp_switchdev_notifier);
+
+ switch_init_done = false;
+}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From ab7b1a361d51157118e1a61ce6530a59bcef4b61 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:10:09 +0200
Subject: [PATCH 3/6] nss_dp_main: swap dp_exit function call

First unregister nss_dp platform devices then cleanup the HAL.

This is to fix kernel panic by cleaning data that needs to be used by
platform driver unregister functions.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -1161,6 +1161,8 @@ int __init nss_dp_init(void)
*/
void __exit nss_dp_exit(void)
{
+ platform_driver_unregister(&nss_dp_drv);
+
/*
* TODO Move this to soc_ops
*/
@@ -1168,8 +1170,6 @@ void __exit nss_dp_exit(void)
nss_dp_hal_cleanup();
dp_global_ctx.common_init_done = false;
}
-
- platform_driver_unregister(&nss_dp_drv);
}

module_init(nss_dp_init);
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 33dd3aa6d0f9cd240d63f53a49157ae44ebccf87 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:12:11 +0200
Subject: [PATCH 4/6] nss_dp_main: call unregister_netdev first in dp_remove
and carrifer_off

In dp_remove move unregister_netdev up before calling exit and deinit
and first call netif_carrier_off to stop any traffic from happening and
prevent kernel panics for napi in the middle of transfer.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -977,6 +977,9 @@ static int nss_dp_remove(struct platform
dp_ops = dp_priv->data_plane_ops;
hal_ops = dp_priv->gmac_hal_ops;

+ netif_carrier_off(dp_priv->netdev);
+ unregister_netdev(dp_priv->netdev);
+
if (dp_priv->phydev)
phy_disconnect(dp_priv->phydev);

@@ -988,7 +991,6 @@ static int nss_dp_remove(struct platform
#endif
hal_ops->exit(dp_priv->gmac_hal_ctx);
dp_ops->deinit(dp_priv->dpc);
- unregister_netdev(dp_priv->netdev);
free_netdev(dp_priv->netdev);
dp_global_ctx.nss_dp[i] = NULL;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 655b07b701271bc00952fe64aeb14f993a48a50e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:17:36 +0200
Subject: [PATCH 5/6] nss_dp_main: use phy_detach instead of disconnect in
dp_remove

Use phy_detach instead of disconnect in dp_remove. On Module remove, phy
are already disconnected but they need to be detached to be correctly
reattached later with an insmod.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -981,7 +981,7 @@ static int nss_dp_remove(struct platform
unregister_netdev(dp_priv->netdev);

if (dp_priv->phydev)
- phy_disconnect(dp_priv->phydev);
+ phy_detach(dp_priv->phydev);

#if defined(NSS_DP_PPE_SUPPORT)
/*
Loading

0 comments on commit 2b10822

Please sign in to comment.