From: Robert Marko Date: Fri, 23 Jun 2023 12:18:14 +0000 (+0200) Subject: kernel: qca-nss-dp: update to 12.4.5.r1 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4ee444b5dae775784039dedd138079d0675bfd5e;p=openwrt%2Fstaging%2Fblocktrron.git kernel: qca-nss-dp: update to 12.4.5.r1 Qualcomm has finally started the preparatory work in order to support kernel 6.1, so lets make use of that and update NSS-DP 12.4.5.r1 which allows us to drop almost some of the patches. Signed-off-by: Robert Marko --- diff --git a/package/kernel/qca-nss-dp/Makefile b/package/kernel/qca-nss-dp/Makefile index 8e9e9c4f09..d135ea52d4 100644 --- a/package/kernel/qca-nss-dp/Makefile +++ b/package/kernel/qca-nss-dp/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2022-04-30 -PKG_SOURCE_VERSION:=72e9ec4187414461cbcf6ccff100e8b5ebe5f40b -PKG_MIRROR_HASH:=805f16e59c75511132922f97740ebf6bf953845b0bbfd2089c4615456893bb37 +PKG_SOURCE_DATE:=2023-06-06 +PKG_SOURCE_VERSION:=fa67464466f69f00967cc373d1bdd6025f57eb89 +PKG_MIRROR_HASH:=51bf524382a5cb542c2c80d12a91f87b9736de3ac3c1d4a351c97b3502d68574 PKG_BUILD_PARALLEL:=1 PKG_FLAGS:=nonshared diff --git a/package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch b/package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch deleted file mode 100644 index 1fed4ba8ab..0000000000 --- a/package/kernel/qca-nss-dp/patches/0001-edma_tx_rx-support-newer-kernels-time-stamping-API.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 40979666b4371012405715ffa61ab5760fcdc6b3 Mon Sep 17 00:00:00 2001 -Message-Id: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -From: Baruch Siach -Date: Mon, 3 May 2021 20:07:36 +0300 -Subject: [PATCH 1/3] edma_tx_rx: support newer kernels time stamping API - ---- - hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -@@ -227,10 +227,16 @@ void nss_phy_tstamp_rx_buf(__attribute__ - * set to the correct PTP class value by calling ptp_classify_raw - * in drv->rxtstamp function. - */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)) - if (ndev && ndev->phydev && ndev->phydev->drv && - ndev->phydev->drv->rxtstamp) - if(ndev->phydev->drv->rxtstamp(ndev->phydev, skb, 0)) - return; -+#else -+ if (ndev && phy_has_rxtstamp(ndev->phydev)) -+ if (phy_rxtstamp(ndev->phydev, skb, 0)) -+ return; -+#endif - - netif_receive_skb(skb); - } -@@ -248,9 +254,14 @@ void nss_phy_tstamp_tx_buf(struct net_de - * set to the correct PTP class value by calling ptp_classify_raw - * in the drv->txtstamp function. - */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)) - if (ndev && ndev->phydev && ndev->phydev->drv && - ndev->phydev->drv->txtstamp) - ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0); -+#else -+ if (ndev && phy_has_txtstamp(ndev->phydev)) -+ phy_rxtstamp(ndev->phydev, skb, 0); -+#endif - } - EXPORT_SYMBOL(nss_phy_tstamp_tx_buf); - diff --git a/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch b/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch new file mode 100644 index 0000000000..c998874d4e --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0001-nss-dp-Drop-_nocache-variants-of-ioremap.patch @@ -0,0 +1,48 @@ +From 946381fd6fdabedf2b5a1d8647a49e3da8f1894e Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Fri, 23 Jun 2023 11:28:02 +0200 +Subject: [PATCH 1/8] nss-dp: Drop _nocache variants of ioremap() + +ioremap_nocache was made equivelant to ioremap and was dropped. + +Signed-off-by: Baruch Siach +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- + hal/gmac_ops/syn/gmac/syn_if.c | 2 +- + hal/soc_ops/ipq50xx/nss_ipq50xx.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -279,7 +279,7 @@ int edma_init(void) + /* + * Remap register resource + */ +- edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start, ++ edma_hw.reg_base = ioremap((edma_hw.reg_resource)->start, + resource_size(edma_hw.reg_resource)); + if (!edma_hw.reg_base) { + pr_warn("Unable to remap EDMA register memory.\n"); +--- a/hal/gmac_ops/syn/gmac/syn_if.c ++++ b/hal/gmac_ops/syn/gmac/syn_if.c +@@ -806,7 +806,7 @@ static void *syn_init(struct nss_gmac_ha + * Populate the mac base addresses + */ + shd->nghd.mac_base = +- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start, ++ devm_ioremap(&dp_priv->pdev->dev, res->start, + resource_size(res)); + if (!shd->nghd.mac_base) { + netdev_dbg(ndev, "ioremap fail.\n"); +--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c ++++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c +@@ -89,7 +89,7 @@ static void nss_dp_hal_tcsr_set(void) + pr_err("%s: SCM TCSR write error: %d\n", __func__, err); + } + } else { +- tcsr_addr = ioremap_nocache((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET), ++ tcsr_addr = ioremap((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET), + TCSR_GMAC_AXI_CACHE_OVERRIDE_REG_SIZE); + if (!tcsr_addr) { + pr_err("%s: ioremap failed\n", __func__); diff --git a/package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch b/package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch new file mode 100644 index 0000000000..d84e9a98d5 --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0002-edma_tx_rx-support-newer-kernels-time-stamping-API.patch @@ -0,0 +1,47 @@ +From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Mon, 3 May 2021 20:07:36 +0300 +Subject: [PATCH 2/8] edma_tx_rx: support newer kernels time stamping API + +Timestamping API has changed in kernel 5.6, so update the implementation +for newer kernels. + +Signed-off-by: Baruch Siach +--- + hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c +@@ -227,10 +227,16 @@ void nss_phy_tstamp_rx_buf(__attribute__ + * set to the correct PTP class value by calling ptp_classify_raw + * in drv->rxtstamp function. + */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)) + if (ndev && ndev->phydev && ndev->phydev->drv && + ndev->phydev->drv->rxtstamp) + if(ndev->phydev->drv->rxtstamp(ndev->phydev, skb, 0)) + return; ++#else ++ if (ndev && phy_has_rxtstamp(ndev->phydev)) ++ if (phy_rxtstamp(ndev->phydev, skb, 0)) ++ return; ++#endif + + netif_receive_skb(skb); + } +@@ -248,9 +254,14 @@ void nss_phy_tstamp_tx_buf(struct net_de + * set to the correct PTP class value by calling ptp_classify_raw + * in the drv->txtstamp function. + */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)) + if (ndev && ndev->phydev && ndev->phydev->drv && + ndev->phydev->drv->txtstamp) + ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0); ++#else ++ if (ndev && phy_has_txtstamp(ndev->phydev)) ++ phy_rxtstamp(ndev->phydev, skb, 0); ++#endif + } + EXPORT_SYMBOL(nss_phy_tstamp_tx_buf); + diff --git a/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch b/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch deleted file mode 100644 index 04adad86f6..0000000000 --- a/package/kernel/qca-nss-dp/patches/0002-nss_dp_main-make-phy-mode-code-compatible-with-newer.patch +++ /dev/null @@ -1,48 +0,0 @@ -From cef7873a2d77df13ee702d902ed4e06b2248904b Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -From: Baruch Siach -Date: Mon, 3 May 2021 20:17:22 +0300 -Subject: [PATCH 2/3] nss_dp_main: make phy mode code compatible with newer - kernels - ---- - include/nss_dp_dev.h | 4 ++-- - nss_dp_main.c | 4 ++++ - 2 files changed, 6 insertions(+), 2 deletions(-) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -22,7 +22,7 @@ - #include - #include - #include --#include -+#include - #include - - #include "nss_dp_api_if.h" -@@ -99,7 +99,7 @@ struct nss_dp_dev { - /* Phy related stuff */ - struct phy_device *phydev; /* Phy device */ - struct mii_bus *miibus; /* MII bus */ -- uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */ -+ phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */ - uint32_t phy_mdio_addr; /* Mdio address */ - bool link_poll; /* Link polling enable? */ - uint32_t forced_speed; /* Forced speed? */ ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -584,7 +584,11 @@ static int32_t nss_dp_of_get_pdata(struc - hal_pdata->netdev = netdev; - hal_pdata->macid = dp_priv->macid; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)) - dp_priv->phy_mii_type = of_get_phy_mode(np); -+#else -+ of_get_phy_mode(np, &dp_priv->phy_mii_type); -+#endif - dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll"); - if (of_property_read_u32(np, "qcom,phy-mdio-addr", - &dp_priv->phy_mdio_addr) && dp_priv->link_poll) { diff --git a/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch b/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch deleted file mode 100644 index 18bd85c8c3..0000000000 --- a/package/kernel/qca-nss-dp/patches/0003-Drop-_nocache-variants-of-ioremap.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c8c52512ff48bee578901c381a42f027e79eadf9 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il> -From: Baruch Siach -Date: Mon, 3 May 2021 20:20:29 +0300 -Subject: [PATCH 3/3] Drop _nocache variants of ioremap() - -Recent kernels removed them. ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- - hal/gmac_ops/qcom/qcom_if.c | 2 +- - hal/gmac_ops/syn/xgmac/syn_if.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -279,7 +279,7 @@ int edma_init(void) - /* - * Remap register resource - */ -- edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start, -+ edma_hw.reg_base = ioremap((edma_hw.reg_resource)->start, - resource_size(edma_hw.reg_resource)); - if (!edma_hw.reg_base) { - pr_warn("Unable to remap EDMA register memory.\n"); ---- a/hal/gmac_ops/qcom/qcom_if.c -+++ b/hal/gmac_ops/qcom/qcom_if.c -@@ -418,7 +418,7 @@ static void *qcom_init(struct nss_gmac_h - qhd->nghd.mac_id = gmacpdata->macid; - - /* Populate the mac base addresses */ -- qhd->nghd.mac_base = devm_ioremap_nocache(&dp_priv->pdev->dev, -+ qhd->nghd.mac_base = devm_ioremap(&dp_priv->pdev->dev, - res->start, resource_size(res)); - if (!qhd->nghd.mac_base) { - netdev_dbg(ndev, "ioremap fail.\n"); ---- a/hal/gmac_ops/syn/xgmac/syn_if.c -+++ b/hal/gmac_ops/syn/xgmac/syn_if.c -@@ -432,7 +432,7 @@ static void *syn_init(struct nss_gmac_ha - - /* Populate the mac base addresses */ - shd->nghd.mac_base = -- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start, -+ devm_ioremap(&dp_priv->pdev->dev, res->start, - resource_size(res)); - if (!shd->nghd.mac_base) { - netdev_dbg(ndev, "ioremap fail.\n"); diff --git a/package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch b/package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch new file mode 100644 index 0000000000..a2268010d4 --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0003-EDMA-Fix-NAPI-packet-counting.patch @@ -0,0 +1,31 @@ +From c36420c219bf0e03842a11f69193c802eb42030a Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 20 May 2021 14:56:46 +0200 +Subject: [PATCH 3/8] EDMA: Fix NAPI packet counting + +There is a bug in the NAPI packet counting that will +cause NAPI over budget warnings. + +Signed-off-by: Baruch Siach +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c +@@ -459,12 +459,12 @@ int edma_napi(struct napi_struct *napi, + + for (i = 0; i < ehw->txcmpl_rings; i++) { + txcmpl_ring = &ehw->txcmpl_ring[i]; +- work_done += edma_clean_tx(ehw, txcmpl_ring); ++ edma_clean_tx(ehw, txcmpl_ring); + } + + for (i = 0; i < ehw->rxfill_rings; i++) { + rxfill_ring = &ehw->rxfill_ring[i]; +- work_done += edma_alloc_rx_buffer(ehw, rxfill_ring); ++ edma_alloc_rx_buffer(ehw, rxfill_ring); + } + + /* diff --git a/package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch b/package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch deleted file mode 100644 index f7653729a0..0000000000 --- a/package/kernel/qca-nss-dp/patches/0004-EDMA-Fix-NAPI-packet-counting.patch +++ /dev/null @@ -1,31 +0,0 @@ -From d74920e2a7c413ef40eed72f9cf287cf6fbd5fb8 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 20 May 2021 14:56:46 +0200 -Subject: [PATCH 1/2] EDMA: Fix NAPI packet counting - -There is a bug in the NAPI packet counting that will -cause NAPI over budget warnings. - -Signed-off-by: Baruch Siach -Signed-off-by: Robert Marko ---- - hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -@@ -459,12 +459,12 @@ int edma_napi(struct napi_struct *napi, - - for (i = 0; i < ehw->txcmpl_rings; i++) { - txcmpl_ring = &ehw->txcmpl_ring[i]; -- work_done += edma_clean_tx(ehw, txcmpl_ring); -+ edma_clean_tx(ehw, txcmpl_ring); - } - - for (i = 0; i < ehw->rxfill_rings; i++) { - rxfill_ring = &ehw->rxfill_ring[i]; -- work_done += edma_alloc_rx_buffer(ehw, rxfill_ring); -+ edma_alloc_rx_buffer(ehw, rxfill_ring); - } - - /* diff --git a/package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch b/package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch new file mode 100644 index 0000000000..84fb02a92a --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0004-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch @@ -0,0 +1,41 @@ +From 158032d3d4e5089afa2aa38c27c6e222ac427820 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 20 May 2021 14:57:46 +0200 +Subject: [PATCH 4/8] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight + +Currently a weight of 100 is used by the EDMA, according +to upstream max of 64 should be used and that is used for +almost any driver. + +They also introduced NAPI_POLL_WEIGHT define which equals +to 64. + +So use NAPI_POLL_WEIGHT as the weight. + +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -845,7 +845,7 @@ static int edma_register_netdevice(struc + */ + if (!edma_hw.napi_added) { + netif_napi_add(netdev, &edma_hw.napi, edma_napi, +- EDMA_NAPI_WORK); ++ NAPI_POLL_WEIGHT); + /* + * Register the interrupt handlers and enable interrupts + */ +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h +@@ -26,7 +26,6 @@ + #define EDMA_RX_PREHDR_SIZE (sizeof(struct edma_rx_preheader)) + #define EDMA_TX_PREHDR_SIZE (sizeof(struct edma_tx_preheader)) + #define EDMA_RING_SIZE 128 +-#define EDMA_NAPI_WORK 100 + #define EDMA_START_GMACS NSS_DP_HAL_START_IFNUM + #define EDMA_MAX_GMACS NSS_DP_HAL_MAX_PORTS + #define EDMA_TX_PKT_MIN_SIZE 33 /* IPQ807x EDMA needs a minimum packet size of 33 bytes */ diff --git a/package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch b/package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch deleted file mode 100644 index 9c22fa7904..0000000000 --- a/package/kernel/qca-nss-dp/patches/0005-EDMA-Use-NAPI_POLL_WEIGHT-as-NAPI-weight.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 44a30d94abcbb10aacc21db29be212518a6b1bf7 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 20 May 2021 14:57:46 +0200 -Subject: [PATCH] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight - -Currently a weight of 100 is used by the EDMA, according -to upstream max of 64 should be used and that is used for -almost any driver. - -They also introduced NAPI_POLL_WEIGHT define which equals -to 64. - -So use NAPI_POLL_WEIGHT as the weight. - -Signed-off-by: Robert Marko ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h | 1 - - 2 files changed, 1 insertion(+), 2 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -837,7 +837,7 @@ static int edma_register_netdevice(struc - */ - if (!edma_hw.napi_added) { - netif_napi_add(netdev, &edma_hw.napi, edma_napi, -- EDMA_NAPI_WORK); -+ NAPI_POLL_WEIGHT); - /* - * Register the interrupt handlers and enable interrupts - */ ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h -@@ -26,7 +26,6 @@ - #define EDMA_RX_PREHDR_SIZE (sizeof(struct edma_rx_preheader)) - #define EDMA_TX_PREHDR_SIZE (sizeof(struct edma_tx_preheader)) - #define EDMA_RING_SIZE 128 --#define EDMA_NAPI_WORK 100 - #define EDMA_START_GMACS NSS_DP_HAL_START_IFNUM - #define EDMA_MAX_GMACS NSS_DP_HAL_MAX_PORTS - #define EDMA_TX_PKT_MIN_SIZE 33 /* IPQ807x EDMA needs a minimum packet size of 33 bytes */ diff --git a/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch b/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch new file mode 100644 index 0000000000..d5b0f62478 --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0005-nss-dp-adapt-to-netif_napi_add-changes.patch @@ -0,0 +1,46 @@ +From e46c4d526d77916c00fff4fff3237b9c9d0d774d Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Fri, 23 Jun 2023 12:04:11 +0200 +Subject: [PATCH 5/8] nss-dp: adapt to netif_napi_add() changes + +netif_napi_add() removed the weight argument and just uses the default +NAPI_POLL_WEIGHT in background, so for those requiring custom weight use +netif_napi_add_weight() instead. + +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 4 ++++ + hal/dp_ops/syn_gmac_dp/syn_dp.c | 5 +++++ + 2 files changed, 9 insertions(+) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -844,8 +844,12 @@ static int edma_register_netdevice(struc + * NAPI add + */ + if (!edma_hw.napi_added) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) + netif_napi_add(netdev, &edma_hw.napi, edma_napi, + NAPI_POLL_WEIGHT); ++#else ++ netif_napi_add(netdev, &edma_hw.napi, edma_napi); ++#endif + /* + * Register the interrupt handlers and enable interrupts + */ +--- a/hal/dp_ops/syn_gmac_dp/syn_dp.c ++++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c +@@ -189,8 +189,13 @@ static int syn_dp_if_init(struct nss_dp_ + } + + if (!dev_info->napi_added) { ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) + netif_napi_add(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); + netif_napi_add(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); ++#else ++ netif_napi_add_weight(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); ++ netif_napi_add_weight(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); ++#endif + + /* + * Requesting irq. Set IRQ_DISABLE_UNLAZY flag, this flag diff --git a/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch b/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch deleted file mode 100644 index 1d7b49129f..0000000000 --- a/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch +++ /dev/null @@ -1,46 +0,0 @@ -From cadeb62a42296563141d6954eec58e34ef86778d Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 13 Aug 2021 20:12:08 +0200 -Subject: [PATCH] NSS-DP: fix of_get_mac_address() - -Recently OpenWrt backported the updated of_get_mac_address() -function which returns and error code instead. - -So, patch the SSDK to use it and fix the compilation error. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 13 ++++--------- - 1 file changed, 4 insertions(+), 9 deletions(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -555,9 +555,10 @@ static int32_t nss_dp_of_get_pdata(struc - struct net_device *netdev, - struct nss_gmac_hal_platform_data *hal_pdata) - { -- uint8_t *maddr; -+ u8 maddr[ETH_ALEN]; - struct nss_dp_dev *dp_priv; - struct resource memres_devtree = {0}; -+ int ret; - - dp_priv = netdev_priv(netdev); - -@@ -600,14 +601,8 @@ static int32_t nss_dp_of_get_pdata(struc - of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); - of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); - -- maddr = (uint8_t *)of_get_mac_address(np); --#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)) -- if (IS_ERR((void *)maddr)) { -- maddr = NULL; -- } --#endif -- -- if (maddr && is_valid_ether_addr(maddr)) { -+ ret = of_get_mac_address(np, maddr); -+ if (!ret && is_valid_ether_addr(maddr)) { - ether_addr_copy(netdev->dev_addr, maddr); - } else { - random_ether_addr(netdev->dev_addr); diff --git a/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch new file mode 100644 index 0000000000..0432b82dda --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch @@ -0,0 +1,180 @@ +From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001 +From: Alexandru Gagniuc +Date: Fri, 23 Jun 2023 13:34:56 +0200 +Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to + the PHY + +The original method of connecting a PHY to the ethernet controller +requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree +properties. This is redundant. The PHY node already contains the MDIO +address, and attaching a PHY implies "link-poll". + +Allow using a "phy-handle" property. Remove the following properties, +as they are no longer used: + * "qcom,link-poll" + * "qcom,phy-mdio-addr" + * "mdio-bus" + * "qcom,forced-speed" + * "qcom,forced-duplex" + +Signed-off-by: Alexandru Gagniuc +Signed-off-by: Robert Marko +--- + include/nss_dp_dev.h | 5 +-- + nss_dp_main.c | 91 +++++++------------------------------------- + 2 files changed, 14 insertions(+), 82 deletions(-) + +--- a/include/nss_dp_dev.h ++++ b/include/nss_dp_dev.h +@@ -202,13 +202,10 @@ struct nss_dp_dev { + unsigned long drv_flags; /* Driver specific feature flags */ + + /* Phy related stuff */ ++ struct device_node *phy_node; /* Phy device OF node */ + struct phy_device *phydev; /* Phy device */ + struct mii_bus *miibus; /* MII bus */ + uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */ +- uint32_t phy_mdio_addr; /* Mdio address */ +- bool link_poll; /* Link polling enable? */ +- uint32_t forced_speed; /* Forced speed? */ +- uint32_t forced_duplex; /* Forced duplex? */ + uint32_t link_state; /* Current link state */ + uint32_t pause; /* Current flow control settings */ + +--- a/nss_dp_main.c ++++ b/nss_dp_main.c +@@ -418,7 +418,7 @@ static int nss_dp_open(struct net_device + + netif_start_queue(netdev); + +- if (!dp_priv->link_poll) { ++ if (!dp_priv->phydev) { + /* 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 + return -EFAULT; + } + ++ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0); ++ if (!dp_priv->phy_node) { ++ pr_err("%s: error parsing phy-handle\n", np->name); ++ return -EFAULT; ++ } ++ + 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 + return -EFAULT; + #endif + +- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll"); +- if (of_property_read_u32(np, "qcom,phy-mdio-addr", +- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) { +- pr_err("%s: mdio addr required if link polling is enabled\n", +- np->name); +- return -EFAULT; +- } +- +- of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); +- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); +- +- + #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 + return 0; + } + +-/* +- * nss_dp_mdio_attach() +- */ +-static struct mii_bus *nss_dp_mdio_attach(struct platform_device *pdev) +-{ +- struct device_node *mdio_node; +- struct platform_device *mdio_plat; +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0)) +- struct ipq40xx_mdio_data *mdio_data; +-#endif +- +- /* +- * Find mii_bus using "mdio-bus" handle. +- */ +- mdio_node = of_parse_phandle(pdev->dev.of_node, "mdio-bus", 0); +- if (mdio_node) { +- return of_mdio_find_bus(mdio_node); +- } +- +- mdio_node = of_find_compatible_node(NULL, NULL, "qcom,qca-mdio"); +- if (!mdio_node) { +- mdio_node = of_find_compatible_node(NULL, NULL, +- "qcom,ipq40xx-mdio"); +- if (!mdio_node) { +- dev_err(&pdev->dev, "cannot find mdio node by phandle\n"); +- return NULL; +- } +- } +- +- mdio_plat = of_find_device_by_node(mdio_node); +- if (!mdio_plat) { +- dev_err(&pdev->dev, "cannot find platform device from mdio node\n"); +- of_node_put(mdio_node); +- return NULL; +- } +- +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) +- return dev_get_drvdata(&mdio_plat->dev); +-#else +- mdio_data = dev_get_drvdata(&mdio_plat->dev); +- if (!mdio_data) { +- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n"); +- of_node_put(mdio_node); +- return NULL; +- } +- +- return mdio_data->mii_bus; +-#endif +-} +- + #ifdef CONFIG_NET_SWITCHDEV + /* + * nss_dp_is_phy_dev() +@@ -803,7 +747,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 + + dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE); + +- if (dp_priv->link_poll) { +- dp_priv->miibus = nss_dp_mdio_attach(pdev); +- if (!dp_priv->miibus) { +- netdev_dbg(netdev, "failed to find miibus\n"); +- goto phy_setup_fail; +- } +- 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"); ++ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node, ++ &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; + } + } diff --git a/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch b/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch deleted file mode 100644 index 824f18634b..0000000000 --- a/package/kernel/qca-nss-dp/patches/0007-NSS-DP-implement-ethernet-IOCTL-s.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5da62ba19f554bf437752a44360fb5ae9f1a7f5e Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Tue, 8 Mar 2022 10:48:32 +0100 -Subject: [PATCH] NSS-DP: implement ethernet IOCTL-s - -Since kernel 5.15 ethernet/PHY related IOCTL-s have been split from the -generic IOCTL netdev op. -So, implement the new op instead of the generic one which is considered -for private IOCTL-s only now for 5.15+. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -532,7 +532,11 @@ static const struct net_device_ops nss_d - .ndo_set_mac_address = nss_dp_set_mac_address, - .ndo_validate_addr = eth_validate_addr, - .ndo_change_mtu = nss_dp_change_mtu, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) - .ndo_do_ioctl = nss_dp_do_ioctl, -+#else -+ .ndo_eth_ioctl = nss_dp_do_ioctl, -+#endif - - #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) - .ndo_bridge_setlink = switchdev_port_bridge_setlink, diff --git a/package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch b/package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch new file mode 100644 index 0000000000..6fbe75dc1c --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0007-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch @@ -0,0 +1,56 @@ +From c2df713569fe3bb671d1444c7bf758681081053c Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Thu, 23 Jun 2022 14:18:50 +0200 +Subject: [PATCH 7/8] nss-dp: edma-v1: use NAPI GRO by default + +Utilize napi_gro_receive instead of plain netif_receive_skb on EDMA v1. + +Usually it provides quite a lot of RX speed improvements, however in some +cases it may lead to decreased performance as there is no checksum +offloading implemented. + +In cases where reduced performance is experienced its possible to disable +GRO by using ethtool. + +Signed-off-by: Robert Marko +--- + hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 10 ++++++---- + hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 8 ++++++-- + 2 files changed, 12 insertions(+), 6 deletions(-) + +--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c +@@ -597,10 +597,12 @@ drop: + */ + static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc) + { +- /* +- * TODO - add flags to support HIGHMEM/cksum offload VLAN +- * the features are enabled. +- */ ++ struct net_device *netdev = dpc->dev; ++ ++ netdev->features |= NETIF_F_GRO; ++ netdev->hw_features |= NETIF_F_GRO; ++ netdev->vlan_features |= NETIF_F_GRO; ++ netdev->wanted_features |= NETIF_F_GRO; + } + + /* TODO - check if this is needed */ +--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c ++++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c +@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edm + if (unlikely(EDMA_RXPH_SERVICE_CODE_GET(rxph) == + NSS_PTP_EVENT_SERVICE_CODE)) + nss_phy_tstamp_rx_buf(ndev, skb); +- else +- netif_receive_skb(skb); ++ else { ++ if (likely(ndev->features & NETIF_F_GRO)) ++ napi_gro_receive(&ehw->napi, skb); ++ else ++ netif_receive_skb(skb); ++ } + + next_rx_desc: + /* diff --git a/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch new file mode 100644 index 0000000000..e90bf32ced --- /dev/null +++ b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch @@ -0,0 +1,50 @@ +From 53b044f7a21d5cd65ada90a228910e6efbad00fa Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Sun, 4 Dec 2022 18:41:36 +0100 +Subject: [PATCH 8/8] nss-dp: allow setting netdev name from DTS + +Allow reading the desired netdev name from DTS like DSA allows and then +set it as the netdev name during registration. + +If label is not defined, simply fallback to kernel ethN enumeration. + +Signed-off-by: Robert Marko +--- + nss_dp_main.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +--- a/nss_dp_main.c ++++ b/nss_dp_main.c +@@ -746,18 +746,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; ++ const char *name = of_get_property(np, "label", NULL); + int32_t ret = 0; ++ int assign_type; + #if defined(NSS_DP_PPE_SUPPORT) + uint32_t vsi_id; + fal_port_t port_id; + #endif + ++ if (name) { ++ assign_type = NET_NAME_PREDICTABLE; ++ } else { ++ name = "eth%d"; ++ assign_type = NET_NAME_ENUM; ++ } ++ + /* TODO: See if we need to do some SoC level common init */ + +- netdev = alloc_etherdev_mqs(sizeof(struct nss_dp_dev), +- NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM); ++ netdev = alloc_netdev_mqs(sizeof(struct nss_dp_dev), ++ name, assign_type, ++ ether_setup, ++ NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM); + if (!netdev) { +- pr_info("alloc_etherdev() failed\n"); ++ dev_err(&pdev->dev, "alloc_netdev_mqs() failed\n"); + return -ENOMEM; + } + diff --git a/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch b/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch deleted file mode 100644 index 220be961ab..0000000000 --- a/package/kernel/qca-nss-dp/patches/0008-switchdev-remove-the-transaction-structure.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c9afdcdd2642485a6476906be9da2e811090fc7a Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 18 Mar 2022 18:06:03 +0100 -Subject: [PATCH] switchdev: remove the transaction structure - -Since 5.12 there is no transaction structure anymore, so drop it for -5.12 and newer. - -Signed-off-by: Robert Marko ---- - nss_dp_switchdev.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -279,13 +279,19 @@ void nss_dp_switchdev_setup(struct net_d - * Sets attributes - */ - static int nss_dp_port_attr_set(struct net_device *dev, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - const struct switchdev_attr *attr, - struct switchdev_trans *trans) -+#else -+ const struct switchdev_attr *attr) -+#endif - { - struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(dev); - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - if (switchdev_trans_ph_prepare(trans)) - return 0; -+#endif - - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: -@@ -309,8 +315,12 @@ static int nss_dp_switchdev_port_attr_se - { - int err; - -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - err = nss_dp_port_attr_set(netdev, port_attr_info->attr, - port_attr_info->trans); -+#else -+ err = nss_dp_port_attr_set(netdev, port_attr_info->attr); -+#endif - - port_attr_info->handled = true; - return notifier_from_errno(err); diff --git a/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch b/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch deleted file mode 100644 index ecc84c1741..0000000000 --- a/package/kernel/qca-nss-dp/patches/0009-switchdev-use-new-switchdev-flags.patch +++ /dev/null @@ -1,51 +0,0 @@ -From f95868d54301c0f54e968ec9d978c9caa02ee425 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 18 Mar 2022 18:24:18 +0100 -Subject: [PATCH] switchdev: use new switchdev flags - -Since kernel 5.12 switched utilizes a new way of setting the flags by -using a dedicated structure with flags and mask. - -So fix using kernels 5.12 and later. - -Signed-off-by: Robert Marko ---- - include/nss_dp_dev.h | 7 +++++++ - nss_dp_switchdev.c | 2 +- - 2 files changed, 8 insertions(+), 1 deletion(-) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -24,6 +24,9 @@ - #include - #include - #include -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) -+#include -+#endif - - #include "nss_dp_api_if.h" - #include "nss_dp_hal_if.h" -@@ -126,7 +129,11 @@ struct nss_dp_dev { - /* switchdev related attributes */ - #ifdef CONFIG_NET_SWITCHDEV - u8 stp_state; /* STP state of this physical port */ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)) - unsigned long brport_flags; /* bridge port flags */ -+#else -+ struct switchdev_brport_flags brport_flags; /* bridge port flags */ -+#endif - #endif - uint32_t rx_page_mode; /* page mode for Rx processing */ - uint32_t rx_jumbo_mru; /* Jumbo mru value for Rx processing */ ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -296,7 +296,7 @@ static int nss_dp_port_attr_set(struct n - switch (attr->id) { - case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: - dp_priv->brport_flags = attr->u.brport_flags; -- netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags); -+ netdev_dbg(dev, "set brport_flags %lu\n", attr->u.brport_flags.val); - return 0; - case SWITCHDEV_ATTR_ID_PORT_STP_STATE: - return nss_dp_stp_state_set(dp_priv, attr->u.stp_state); diff --git a/package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch b/package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch deleted file mode 100644 index 19395ac42c..0000000000 --- a/package/kernel/qca-nss-dp/patches/0010-switchdev-fix-FDB-roaming.patch +++ /dev/null @@ -1,110 +0,0 @@ -From d16102cad769f430144ca8094d928762b445e9b0 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Fri, 18 Mar 2022 22:02:01 +0100 -Subject: [PATCH] switchdev: fix FDB roaming - -Try and solve the roaming issue by trying to replicate what NSS bridge -module is doing, but by utilizing switchdev FDB notifiers instead of -adding new notifiers to the bridge code. - -We register a new non-blocking switchdev notifier and simply wait for -notification, and then process the SWITCHDEV_FDB_DEL_TO_DEVICE -notifications. - -Those tell us that a certain FDB entry should be removed, then a VSI ID -is fetched for the physical PPE port and using that VSI ID and the -notification provided MAC adress existing FDB entry gets removed. - -Signed-off-by: Robert Marko ---- - nss_dp_switchdev.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -24,6 +24,8 @@ - #include "nss_dp_dev.h" - #include "fal/fal_stp.h" - #include "fal/fal_ctrlpkt.h" -+#include "fal/fal_fdb.h" -+#include "ref/ref_vsi.h" - - #define NSS_DP_SWITCH_ID 0 - #define NSS_DP_SW_ETHTYPE_PID 0 /* PPE ethtype profile ID for slow protocols */ -@@ -348,10 +350,64 @@ static int nss_dp_switchdev_event(struct - return NOTIFY_DONE; - } - -+static int nss_dp_switchdev_fdb_del_event(struct net_device *netdev, -+ struct switchdev_notifier_fdb_info *fdb_info) -+{ -+ struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(netdev); -+ fal_fdb_entry_t entry; -+ a_uint32_t vsi_id; -+ sw_error_t rv; -+ -+ netdev_dbg(netdev, "FDB DEL %pM port %d\n", fdb_info->addr, dp_priv->macid); -+ -+ rv = ppe_port_vsi_get(NSS_DP_SWITCH_ID, dp_priv->macid, &vsi_id); -+ if (rv) { -+ netdev_err(netdev, "cannot get VSI ID for port %d\n", dp_priv->macid); -+ return notifier_from_errno(rv); -+ } -+ -+ memset(&entry, 0, sizeof(entry)); -+ memcpy(&entry.addr, fdb_info->addr, ETH_ALEN); -+ entry.fid = vsi_id; -+ -+ rv = fal_fdb_entry_del_bymac(NSS_DP_SWITCH_ID, &entry); -+ if (rv) { -+ netdev_err(netdev, "FDB entry delete failed with MAC %pM and fid %d\n", -+ &entry.addr, entry.fid); -+ return notifier_from_errno(rv); -+ } -+ -+ return notifier_from_errno(rv); -+} -+ -+static int nss_dp_fdb_switchdev_event(struct notifier_block *nb, -+ unsigned long event, void *ptr) -+{ -+ struct net_device *dev = switchdev_notifier_info_to_dev(ptr); -+ -+ /* -+ * Handle switchdev event only for physical devices -+ */ -+ if (!nss_dp_is_phy_dev(dev)) { -+ return NOTIFY_DONE; -+ } -+ -+ switch (event) { -+ case SWITCHDEV_FDB_DEL_TO_DEVICE: -+ return nss_dp_switchdev_fdb_del_event(dev, ptr); -+ } -+ -+ return NOTIFY_DONE; -+} -+ - static struct notifier_block nss_dp_switchdev_notifier = { - .notifier_call = nss_dp_switchdev_event, - }; - -+static struct notifier_block nss_dp_switchdev_fdb_notifier = { -+ .notifier_call = nss_dp_fdb_switchdev_event, -+}; -+ - static bool switch_init_done; - - /* -@@ -366,6 +422,11 @@ void nss_dp_switchdev_setup(struct net_d - return; - } - -+ err = register_switchdev_notifier(&nss_dp_switchdev_fdb_notifier); -+ if (err) { -+ netdev_dbg(dev, "%px:Failed to register switchdev FDB notifier\n", dev); -+ } -+ - err = register_switchdev_blocking_notifier(&nss_dp_switchdev_notifier); - if (err) { - netdev_dbg(dev, "%px:Failed to register switchdev notifier\n", dev); diff --git a/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch b/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch deleted file mode 100644 index 726ca304df..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-treewide-fix-confusing-printing-of-registered-netdev.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e4ae2d6285095794d73d2f2ce61404f61d4e633 Mon Sep 17 00:00:00 2001 -From: Ansuel Smith -Date: Tue, 17 May 2022 15:55:36 +0200 -Subject: [PATCH 11/11] treewide: fix confusing printing of registered netdev - -Net core implementation changed and now printing the netdev name cause -confusing printing if done before register_netdev. Move the old printing -to dbg and add an additional info log right after register_netdev to -give the user some info on correct nss-dp probe. - -Signed-off-by: Ansuel Smith ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 4 ++-- - nss_dp_main.c | 3 +++ - 2 files changed, 5 insertions(+), 2 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -822,8 +822,8 @@ static int edma_register_netdevice(struc - return -EINVAL; - } - -- netdev_info(netdev, "nss_dp_edma: Registering netdev %s(qcom-id:%d) with EDMA\n", -- netdev->name, macid); -+ netdev_dbg(netdev, "nss_dp_edma: Registering netdev %s(qcom-id:%d) with EDMA\n", -+ netdev->name, macid); - - /* - * We expect 'macid' to correspond to ports numbers on ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -875,6 +875,9 @@ static int32_t nss_dp_probe(struct platf - goto phy_setup_fail; - } - -+ netdev_info(netdev, "Registered netdev %s(qcom-id:%d)\n", -+ netdev->name, port_id); -+ - dp_global_ctx.nss_dp[dp_priv->macid - 1] = dp_priv; - dp_global_ctx.slowproto_acl_bm = 0; - diff --git a/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch b/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch deleted file mode 100644 index 3c1c8ab83b..0000000000 --- a/package/kernel/qca-nss-dp/patches/0012-gmac-syn-xgmac-silence-debug-log-on-probe.patch +++ /dev/null @@ -1,23 +0,0 @@ -From fee52ef165e9fab2fca15492677082fd8e9e891f Mon Sep 17 00:00:00 2001 -From: Ansuel Smith -Date: Thu, 19 May 2022 23:40:24 +0200 -Subject: [PATCH 12/12] gmac: syn: xgmac: silence debug log on probe - -Silence debug log set as info in xgmac port probe. - -Signed-off-by: Ansuel Smith ---- - hal/gmac_ops/syn/xgmac/syn_if.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/hal/gmac_ops/syn/xgmac/syn_if.c -+++ b/hal/gmac_ops/syn/xgmac/syn_if.c -@@ -445,7 +445,7 @@ static void *syn_init(struct nss_gmac_ha - - spin_lock_init(&shd->nghd.slock); - -- netdev_info(ndev, "ioremap OK.Size 0x%x Ndev base 0x%lx macbase 0x%px\n", -+ netdev_dbg(ndev, "ioremap OK.Size 0x%x Ndev base 0x%lx macbase 0x%px\n", - gmacpdata->reg_len, - ndev->base_addr, - shd->nghd.mac_base); diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch deleted file mode 100644 index 276c87adfc..0000000000 --- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch +++ /dev/null @@ -1,183 +0,0 @@ -From 8293a26ca56ee2e9a88e4efb5dcc7f647803cd8c Mon Sep 17 00:00:00 2001 -From: Alexandru Gagniuc -Date: Sun, 5 Jun 2022 21:45:09 -0500 -Subject: [PATCH] nss_dp_main: Use a 'phy-handle' property to connect to the - PHY - -The original method of connecting a PHY to the ethernet controller -requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree -properties. This is redundant. The PHY node already contains the MDIO -address, and attaching a PHY implies "link-poll". - -Allow using a "phy-handle" property. Remove the following properties, -as they are no longer used: - * "qcom,link-poll" - * "qcom,phy-mdio-addr" - * "mdio-bus" - * "qcom,forced-speed" - * "qcom,forced-duplex" - -Signed-off-by: Alexandru Gagniuc ---- - include/nss_dp_dev.h | 5 +-- - nss_dp_main.c | 91 +++++--------------------------------------- - 2 files changed, 10 insertions(+), 86 deletions(-) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -100,13 +100,10 @@ struct nss_dp_dev { - unsigned long drv_flags; /* Driver specific feature flags */ - - /* Phy related stuff */ -+ struct device_node *phy_node; - struct phy_device *phydev; /* Phy device */ - struct mii_bus *miibus; /* MII bus */ - phy_interface_t phy_mii_type; /* RGMII/SGMII/QSGMII */ -- uint32_t phy_mdio_addr; /* Mdio address */ -- bool link_poll; /* Link polling enable? */ -- uint32_t forced_speed; /* Forced speed? */ -- uint32_t forced_duplex; /* Forced duplex? */ - uint32_t link_state; /* Current link state */ - uint32_t pause; /* Current flow control settings */ - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -399,7 +399,7 @@ static int nss_dp_open(struct net_device - - netif_start_queue(netdev); - -- if (!dp_priv->link_poll) { -+ if (!dp_priv->phydev) { - /* 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"); -@@ -576,6 +576,8 @@ static int32_t nss_dp_of_get_pdata(struc - return -EFAULT; - } - -+ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0); -+ - if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) { - pr_err("%s: error reading mactype\n", np->name); - return -EFAULT; -@@ -594,16 +596,6 @@ static int32_t nss_dp_of_get_pdata(struc - #else - of_get_phy_mode(np, &dp_priv->phy_mii_type); - #endif -- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll"); -- if (of_property_read_u32(np, "qcom,phy-mdio-addr", -- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) { -- pr_err("%s: mdio addr required if link polling is enabled\n", -- np->name); -- return -EFAULT; -- } -- -- of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed); -- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex); - - ret = of_get_mac_address(np, maddr); - if (!ret && is_valid_ether_addr(maddr)) { -@@ -636,50 +628,6 @@ static int32_t nss_dp_of_get_pdata(struc - return 0; - } - --/* -- * nss_dp_mdio_attach() -- */ --static struct mii_bus *nss_dp_mdio_attach(struct platform_device *pdev) --{ -- struct device_node *mdio_node; -- struct platform_device *mdio_plat; -- struct ipq40xx_mdio_data *mdio_data; -- -- /* -- * Find mii_bus using "mdio-bus" handle. -- */ -- mdio_node = of_parse_phandle(pdev->dev.of_node, "mdio-bus", 0); -- if (mdio_node) { -- return of_mdio_find_bus(mdio_node); -- } -- -- mdio_node = of_find_compatible_node(NULL, NULL, "qcom,qca-mdio"); -- if (!mdio_node) { -- mdio_node = of_find_compatible_node(NULL, NULL, -- "qcom,ipq40xx-mdio"); -- if (!mdio_node) { -- dev_err(&pdev->dev, "cannot find mdio node by phandle\n"); -- return NULL; -- } -- } -- -- mdio_plat = of_find_device_by_node(mdio_node); -- if (!mdio_plat) { -- dev_err(&pdev->dev, "cannot find platform device from mdio node\n"); -- of_node_put(mdio_node); -- return NULL; -- } -- -- mdio_data = dev_get_drvdata(&mdio_plat->dev); -- if (!mdio_data) { -- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n"); -- of_node_put(mdio_node); -- return NULL; -- } -- -- return mdio_data->mii_bus; --} -- - #ifdef CONFIG_NET_SWITCHDEV - /* - * nss_dp_is_phy_dev() -@@ -738,7 +686,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; -@@ -813,37 +760,17 @@ static int32_t nss_dp_probe(struct platf - - dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE); - -- if (dp_priv->link_poll) { -- dp_priv->miibus = nss_dp_mdio_attach(pdev); -- if (!dp_priv->miibus) { -- netdev_dbg(netdev, "failed to find miibus\n"); -- goto phy_setup_fail; -- } -- 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"); -+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node, -+ &nss_dp_adjust_link, 0, -+ dp_priv->phy_mii_type); -+ if (!(dp_priv->phydev)) { -+ dev_err(&pdev->dev, "Could not attach to PHY\n"); - goto phy_setup_fail; - } - --#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)) -- dp_priv->phydev->advertising |= -- (ADVERTISED_Pause | ADVERTISED_Asym_Pause); -- dp_priv->phydev->supported |= -- (SUPPORTED_Pause | SUPPORTED_Asym_Pause); --#else -- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->advertising); -- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->advertising); -- -- linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, dp_priv->phydev->supported); -- linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, dp_priv->phydev->supported); --#endif -+ phy_attached_info(dp_priv->phydev); - } - - #if defined(NSS_DP_PPE_SUPPORT) diff --git a/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch b/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch deleted file mode 100644 index f3a0948dfa..0000000000 --- a/package/kernel/qca-nss-dp/patches/0014-nss-dp-edma-v1-use-NAPI-GRO-by-default.patch +++ /dev/null @@ -1,56 +0,0 @@ -From ae4fe8fb79b68f4cf4a887434ab6a8a9a1c65bfc Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 23 Jun 2022 14:18:50 +0200 -Subject: [PATCH] nss-dp: edma-v1: use NAPI GRO by default - -Utilize napi_gro_receive instead of plain netif_receive_skb on EDMA v1. - -Usually it provides quite a lot of RX speed improvements, however in some -cases it may lead to decreased performance as there is no checksum -offloading implemented. - -In cases where reduced performance is experienced its possible to disable -GRO by using ethtool. - -Signed-off-by: Robert Marko ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 10 ++++++---- - hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 8 ++++++-- - 2 files changed, 12 insertions(+), 6 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -589,10 +589,12 @@ drop: - */ - static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc) - { -- /* -- * TODO - add flags to support HIGHMEM/cksum offload VLAN -- * the features are enabled. -- */ -+ struct net_device *netdev = dpc->dev; -+ -+ netdev->features |= NETIF_F_GRO; -+ netdev->hw_features |= NETIF_F_GRO; -+ netdev->vlan_features |= NETIF_F_GRO; -+ netdev->wanted_features |= NETIF_F_GRO; - } - - /* TODO - check if this is needed */ ---- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c -@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edm - if (unlikely(EDMA_RXPH_SERVICE_CODE_GET(rxph) == - NSS_PTP_EVENT_SERVICE_CODE)) - nss_phy_tstamp_rx_buf(ndev, skb); -- else -- netif_receive_skb(skb); -+ else { -+ if (likely(ndev->features & NETIF_F_GRO)) -+ napi_gro_receive(&ehw->napi, skb); -+ else -+ netif_receive_skb(skb); -+ } - - next_rx_desc: - /* diff --git a/package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch b/package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch deleted file mode 100644 index 906e5ee762..0000000000 --- a/package/kernel/qca-nss-dp/patches/0015-nss-dp-allow-setting-netdev-name-from-DTS.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 358b93e40d0c6b6d381fe0e9d2a63c45a10321b3 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Sun, 4 Dec 2022 18:41:36 +0100 -Subject: [PATCH] nss-dp: allow setting netdev name from DTS - -Allow reading the desired netdev name from DTS like DSA allows and then -set it as the netdev name during registration. - -If label is not defined, simply fallback to kernel ethN enumeration. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -685,18 +685,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; -+ const char *name = of_get_property(np, "label", NULL); - int32_t ret = 0; -+ int assign_type; - #if defined(NSS_DP_PPE_SUPPORT) - uint32_t vsi_id; - fal_port_t port_id; - #endif - -+ if (name) { -+ assign_type = NET_NAME_PREDICTABLE; -+ } else { -+ name = "eth%d"; -+ assign_type = NET_NAME_ENUM; -+ } -+ - /* TODO: See if we need to do some SoC level common init */ - -- netdev = alloc_etherdev_mqs(sizeof(struct nss_dp_dev), -- NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM); -+ netdev = alloc_netdev_mqs(sizeof(struct nss_dp_dev), -+ name, assign_type, -+ ether_setup, -+ NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM); - if (!netdev) { -- pr_info("alloc_etherdev() failed\n"); -+ dev_err(&pdev->dev, "alloc_netdev_mqs() failed\n"); - return -ENOMEM; - } - diff --git a/package/kernel/qca-nss-dp/patches/0016-nss-dp-netdev-mac_addr-is-const.patch b/package/kernel/qca-nss-dp/patches/0016-nss-dp-netdev-mac_addr-is-const.patch deleted file mode 100644 index 6957f14609..0000000000 --- a/package/kernel/qca-nss-dp/patches/0016-nss-dp-netdev-mac_addr-is-const.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ff9284e3a59982c78a0132e6f2c5e3f04ba11472 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 29 Sep 2022 20:37:46 +0200 -Subject: [PATCH 15/16] nss-dp: netdev mac_addr is const - -Signed-off-by: Robert Marko ---- - exports/nss_dp_api_if.h | 2 +- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +- - hal/dp_ops/edma_dp/edma_v2/edma_dp.c | 2 +- - hal/dp_ops/syn_gmac_dp/syn_dp.c | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - ---- a/exports/nss_dp_api_if.h -+++ b/exports/nss_dp_api_if.h -@@ -83,7 +83,7 @@ struct nss_dp_data_plane_ops { - int (*close)(struct nss_dp_data_plane_ctx *dpc); - int (*link_state)(struct nss_dp_data_plane_ctx *dpc, - uint32_t link_state); -- int (*mac_addr)(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr); -+ int (*mac_addr)(struct nss_dp_data_plane_ctx *dpc, const uint8_t *addr); - int (*change_mtu)(struct nss_dp_data_plane_ctx *dpc, uint32_t mtu); - netdev_tx_t (*xmit)(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *os_buf); - void (*set_features)(struct nss_dp_data_plane_ctx *dpc); ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -494,7 +494,7 @@ static int edma_if_link_state(struct nss - /* - * edma_if_mac_addr() - */ --static int edma_if_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr) -+static int edma_if_mac_addr(struct nss_dp_data_plane_ctx *dpc, const uint8_t *addr) - { - return NSS_DP_SUCCESS; - } ---- a/hal/dp_ops/edma_dp/edma_v2/edma_dp.c -+++ b/hal/dp_ops/edma_dp/edma_v2/edma_dp.c -@@ -99,7 +99,7 @@ static int edma_dp_link_state(struct nss - * edma_dp_mac_addr() - * EDMA data plane MAC address change API - */ --static int edma_dp_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr) -+static int edma_dp_mac_addr(struct nss_dp_data_plane_ctx *dpc, const uint8_t *addr) - { - return NSS_DP_SUCCESS; - } ---- a/hal/dp_ops/syn_gmac_dp/syn_dp.c -+++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c -@@ -289,7 +289,7 @@ static int syn_dp_if_link_state(struct n - /* - * syn_dp_if_mac_addr() - */ --static int syn_dp_if_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr) -+static int syn_dp_if_mac_addr(struct nss_dp_data_plane_ctx *dpc, const uint8_t *addr) - { - return NSS_DP_SUCCESS; - } diff --git a/package/kernel/qca-nss-dp/patches/0017-nss-dp-use-proper-netdev-MAC-helpers.patch b/package/kernel/qca-nss-dp/patches/0017-nss-dp-use-proper-netdev-MAC-helpers.patch deleted file mode 100644 index beb6db4996..0000000000 --- a/package/kernel/qca-nss-dp/patches/0017-nss-dp-use-proper-netdev-MAC-helpers.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 704706969301076961c15423dedce9e2e6f1026e Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Thu, 29 Sep 2022 20:39:07 +0200 -Subject: [PATCH 16/16] nss-dp: use proper netdev MAC helpers - -mac_addr is const, so utilize proper helpers for setting random and -desired MAC addres as old ones were dropped in newer kernels. - -Signed-off-by: Robert Marko ---- - nss_dp_main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -599,9 +599,9 @@ static int32_t nss_dp_of_get_pdata(struc - - ret = of_get_mac_address(np, maddr); - if (!ret && is_valid_ether_addr(maddr)) { -- ether_addr_copy(netdev->dev_addr, maddr); -+ eth_hw_addr_set(netdev, maddr); - } else { -- random_ether_addr(netdev->dev_addr); -+ eth_hw_addr_random(netdev); - pr_info("GMAC%d(%px) Invalid MAC@ - using %pM\n", dp_priv->macid, - dp_priv, netdev->dev_addr); - } diff --git a/package/kernel/qca-nss-dp/patches/0018-nss-dp-adapt-to-netif_napi_add-changes.patch b/package/kernel/qca-nss-dp/patches/0018-nss-dp-adapt-to-netif_napi_add-changes.patch deleted file mode 100644 index 084f30da13..0000000000 --- a/package/kernel/qca-nss-dp/patches/0018-nss-dp-adapt-to-netif_napi_add-changes.patch +++ /dev/null @@ -1,84 +0,0 @@ -From ba748ab91a62db57f9bdf69dd306e6557315db85 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 3 Oct 2022 23:05:14 +0200 -Subject: [PATCH] nss-dp: adapt to netif_napi_add() changes - -netif_napi_add() removed the weight argument and just uses the default -NAPI_POLL_WEIGHT in background, so for those requiring custom weight use -netif_napi_add_weight() instead. - -Signed-off-by: Robert Marko ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 6 +++++- - hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c | 8 +++++++- - hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c | 7 ++++++- - hal/dp_ops/syn_gmac_dp/syn_dp.c | 5 +++++ - 4 files changed, 23 insertions(+), 3 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -838,8 +838,12 @@ static int edma_register_netdevice(struc - * NAPI add - */ - if (!edma_hw.napi_added) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) - netif_napi_add(netdev, &edma_hw.napi, edma_napi, -- NAPI_POLL_WEIGHT); -+ NAPI_POLL_WEIGHT); -+#else -+ netif_napi_add(netdev, &edma_hw.napi, edma_napi); -+#endif - /* - * Register the interrupt handlers and enable interrupts - */ ---- a/hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c -+++ b/hal/dp_ops/edma_dp/edma_v2/edma_cfg_rx.c -@@ -1097,8 +1097,14 @@ void edma_cfg_rx_napi_add(struct edma_gb - - for (i = 0; i < egc->num_rxdesc_rings; i++) { - struct edma_rxdesc_ring *rxdesc_ring = &egc->rxdesc_rings[i]; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) - netif_napi_add(netdev, &rxdesc_ring->napi, -- edma_rx_napi_poll, nss_dp_rx_napi_budget); -+ edma_rx_napi_poll, nss_dp_rx_napi_budget); -+ -+#else -+ netif_napi_add_weight(netdev, &rxdesc_ring->napi, -+ edma_rx_napi_poll, nss_dp_rx_napi_budget); -+#endif - rxdesc_ring->napi_added = true; - } - edma_info("%s: Rx NAPI budget: %d\n", netdev->name, nss_dp_rx_napi_budget); ---- a/hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c -+++ b/hal/dp_ops/edma_dp/edma_v2/edma_cfg_tx.c -@@ -672,8 +672,13 @@ void edma_cfg_tx_napi_add(struct edma_gb - for (i = 0; i < egc->num_txcmpl_rings; i++) { - struct edma_txcmpl_ring *txcmpl_ring = &egc->txcmpl_rings[i]; - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) - netif_napi_add(netdev, &txcmpl_ring->napi, -- edma_tx_napi_poll, nss_dp_tx_napi_budget); -+ edma_tx_napi_poll, nss_dp_tx_napi_budget); -+#else -+ netif_napi_add_weight(netdev, &txcmpl_ring->napi, -+ edma_tx_napi_poll, nss_dp_tx_napi_budget); -+#endif - txcmpl_ring->napi_added = true; - } - edma_info("Tx NAPI budget: %d\n", nss_dp_tx_napi_budget); ---- a/hal/dp_ops/syn_gmac_dp/syn_dp.c -+++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c -@@ -189,8 +189,13 @@ static int syn_dp_if_init(struct nss_dp_ - } - - if (!dev_info->napi_added) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) - netif_napi_add(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); - netif_napi_add(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); -+#else -+ netif_napi_add_weight(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX); -+ netif_napi_add_weight(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX); -+#endif - - /* - * Requesting irq. Set IRQ_DISABLE_UNLAZY flag, this flag