Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-06-27 16:07:52 +08:00
commit 7be25601b0
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
37 changed files with 168 additions and 1465 deletions

View File

@ -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
@ -44,13 +44,10 @@ define Build/Configure
endef
define Build/Compile
+$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
+$(KERNEL_MAKE) $(PKG_JOBS) \
-C "$(LINUX_DIR)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \
$(KERNEL_MAKE_FLAGS) \
$(PKG_JOBS) \
modules
endef

View File

@ -0,0 +1,48 @@
From 946381fd6fdabedf2b5a1d8647a49e3da8f1894e Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
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 <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
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__);

View File

@ -1,9 +1,12 @@
From 40979666b4371012405715ffa61ab5760fcdc6b3 Mon Sep 17 00:00:00 2001
Message-Id: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Mon, 3 May 2021 20:07:36 +0300
Subject: [PATCH 1/3] edma_tx_rx: support newer kernels time stamping API
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 <baruch@tkos.co.il>
---
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++
1 file changed, 11 insertions(+)

View File

@ -1,48 +0,0 @@
From cef7873a2d77df13ee702d902ed4e06b2248904b Mon Sep 17 00:00:00 2001
Message-Id: <cef7873a2d77df13ee702d902ed4e06b2248904b.1620066716.git.baruch@tkos.co.il>
In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
From: Baruch Siach <baruch@tkos.co.il>
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 <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/platform_device.h>
-#include <linux/switch.h>
+#include <linux/phy.h>
#include <linux/version.h>
#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) {

View File

@ -1,48 +0,0 @@
From c8c52512ff48bee578901c381a42f027e79eadf9 Mon Sep 17 00:00:00 2001
Message-Id: <c8c52512ff48bee578901c381a42f027e79eadf9.1620066716.git.baruch@tkos.co.il>
In-Reply-To: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
References: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
From: Baruch Siach <baruch@tkos.co.il>
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");

View File

@ -1,7 +1,7 @@
From d74920e2a7c413ef40eed72f9cf287cf6fbd5fb8 Mon Sep 17 00:00:00 2001
From c36420c219bf0e03842a11f69193c802eb42030a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 20 May 2021 14:56:46 +0200
Subject: [PATCH 1/2] EDMA: Fix NAPI packet counting
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.

View File

@ -1,7 +1,7 @@
From 44a30d94abcbb10aacc21db29be212518a6b1bf7 Mon Sep 17 00:00:00 2001
From 158032d3d4e5089afa2aa38c27c6e222ac427820 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 20 May 2021 14:57:46 +0200
Subject: [PATCH] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight
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
@ -20,7 +20,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- 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
@@ -845,7 +845,7 @@ static int edma_register_netdevice(struc
*/
if (!edma_hw.napi_added) {
netif_napi_add(netdev, &edma_hw.napi, edma_napi,

View File

@ -0,0 +1,46 @@
From e46c4d526d77916c00fff4fff3237b9c9d0d774d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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

View File

@ -1,46 +0,0 @@
From cadeb62a42296563141d6954eec58e34ef86778d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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);

View File

@ -1,8 +1,8 @@
From 8293a26ca56ee2e9a88e4efb5dcc7f647803cd8c Mon Sep 17 00:00:00 2001
From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Sun, 5 Jun 2022 21:45:09 -0500
Subject: [PATCH] nss_dp_main: Use a 'phy-handle' property to connect to the
PHY
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
@ -18,21 +18,22 @@ as they are no longer used:
* "qcom,forced-duplex"
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
include/nss_dp_dev.h | 5 +--
nss_dp_main.c | 91 +++++---------------------------------------
2 files changed, 10 insertions(+), 86 deletions(-)
nss_dp_main.c | 91 +++++++-------------------------------------
2 files changed, 14 insertions(+), 82 deletions(-)
--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -100,13 +100,10 @@ struct nss_dp_dev {
@@ -202,13 +202,10 @@ struct nss_dp_dev {
unsigned long drv_flags; /* Driver specific feature flags */
/* Phy related stuff */
+ struct device_node *phy_node;
+ struct device_node *phy_node; /* Phy device OF 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_mii_type; /* RGMII/SGMII/QSGMII */
- uint32_t phy_mdio_addr; /* Mdio address */
- bool link_poll; /* Link polling enable? */
- uint32_t forced_speed; /* Forced speed? */
@ -42,7 +43,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -399,7 +399,7 @@ static int nss_dp_open(struct net_device
@@ -418,7 +418,7 @@ static int nss_dp_open(struct net_device
netif_start_queue(netdev);
@ -51,19 +52,23 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@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");
@@ -576,6 +576,8 @@ static int32_t nss_dp_of_get_pdata(struc
@@ -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;
@@ -594,16 +596,6 @@ static int32_t nss_dp_of_get_pdata(struc
#else
of_get_phy_mode(np, &dp_priv->phy_mii_type);
@@ -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) {
@ -74,10 +79,12 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
-
- 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
-
-
#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;
}
@ -88,7 +95,9 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
-{
- 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.
@ -115,6 +124,9 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
- 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");
@ -123,12 +135,13 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
- }
-
- return mdio_data->mii_bus;
-#endif
-}
-
#ifdef CONFIG_NET_SWITCHDEV
/*
* nss_dp_is_phy_dev()
@@ -738,7 +686,6 @@ static int32_t nss_dp_probe(struct platf
@@ -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;
@ -136,7 +149,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
#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
@@ -880,22 +823,14 @@ static int32_t nss_dp_probe(struct platf
dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE);
@ -151,33 +164,17 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
-
+ 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);
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
+ if (!(dp_priv->phydev)) {
+ dev_err(&pdev->dev, "Could not attach to PHY\n");
+ netdev_err(netdev, "failed to connect to phy device\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)

View File

@ -1,29 +0,0 @@
From 5da62ba19f554bf437752a44360fb5ae9f1a7f5e Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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,

View File

@ -1,7 +1,7 @@
From ae4fe8fb79b68f4cf4a887434ab6a8a9a1c65bfc Mon Sep 17 00:00:00 2001
From c2df713569fe3bb671d1444c7bf758681081053c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 23 Jun 2022 14:18:50 +0200
Subject: [PATCH] nss-dp: edma-v1: use NAPI GRO by default
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.
@ -20,7 +20,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- 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:
@@ -597,10 +597,12 @@ drop:
*/
static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc)
{

View File

@ -1,7 +1,7 @@
From 358b93e40d0c6b6d381fe0e9d2a63c45a10321b3 Mon Sep 17 00:00:00 2001
From 53b044f7a21d5cd65ada90a228910e6efbad00fa Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 4 Dec 2022 18:41:36 +0100
Subject: [PATCH] nss-dp: allow setting netdev name from DTS
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.
@ -15,7 +15,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -685,18 +685,29 @@ static int32_t nss_dp_probe(struct platf
@@ -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;

View File

@ -1,48 +0,0 @@
From c9afdcdd2642485a6476906be9da2e811090fc7a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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);

View File

@ -1,51 +0,0 @@
From f95868d54301c0f54e968ec9d978c9caa02ee425 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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 <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+#include <net/switchdev.h>
+#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);

View File

@ -1,110 +0,0 @@
From d16102cad769f430144ca8094d928762b445e9b0 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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);

View File

@ -1,41 +0,0 @@
From 7e4ae2d6285095794d73d2f2ce61404f61d4e633 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
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 <ansuelsmth@gmail.com>
---
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;

View File

@ -1,23 +0,0 @@
From fee52ef165e9fab2fca15492677082fd8e9e891f Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
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 <ansuelsmth@gmail.com>
---
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);

View File

@ -1,57 +0,0 @@
From ff9284e3a59982c78a0132e6f2c5e3f04ba11472 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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;
}

View File

@ -1,27 +0,0 @@
From 704706969301076961c15423dedce9e2e6f1026e Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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);
}

View File

@ -1,84 +0,0 @@
From ba748ab91a62db57f9bdf69dd306e6557315db85 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
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 <robimarko@gmail.com>
---
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

View File

@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-ssdk
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2022-09-12
PKG_SOURCE_VERSION:=628b22bc3d5ee81414b75ab3de6a255c82754dec
PKG_MIRROR_HASH:=859344f79504b9953639dc5aa27042249f68e3a9a269e66d7f7a25e1ab38c110
PKG_SOURCE_DATE:=2023-06-06
PKG_SOURCE_VERSION:=74caf88aa3b6793c300f676e4fb1c62da7507be9
PKG_MIRROR_HASH:=6bdb90919b773f5fb432c8b374c9419feac32ba6583ad82dfec5e41628a32dd9
PKG_FLAGS:=nonshared
PKG_BUILD_FLAGS:=no-lto
@ -75,6 +75,9 @@ define Build/InstallDev
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_init.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_init.h $(1)/usr/include/qca-ssdk/init/; \
fi
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h $(1)/usr/include/qca-ssdk/init/; \
fi
$(CP) -rf $(PKG_BUILD_DIR)/include/fal $(1)/usr/include/qca-ssdk
$(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk
$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk

View File

@ -1,102 +0,0 @@
From 1e46d596701fedb751a669666a74677344fb8724 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 12 May 2021 13:45:45 +0200
Subject: [PATCH 01/14] SSDK: replace ioremap_nocache with ioremap
ioremap_nocache was dropped upstream, simply use the
generic variety.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
src/init/ssdk_clk.c | 10 +++++-----
src/init/ssdk_init.c | 2 +-
src/init/ssdk_plat.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
--- a/src/init/ssdk_clk.c
+++ b/src/init/ssdk_clk.c
@@ -721,7 +721,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset,
{
void __iomem *tcsr_base = NULL;
- tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+ tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
if (!tcsr_base)
{
SSDK_ERROR("Failed to map tcsr eth address!\n");
@@ -738,7 +738,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset,
{
void __iomem *tcsr_base = NULL;
- tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+ tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
if (!tcsr_base)
{
SSDK_ERROR("Failed to map tcsr eth address!\n");
@@ -786,7 +786,7 @@ ssdk_mp_cmnblk_stable_check(void)
a_uint32_t reg_val;
int i, loops = 20;
- pll_lock = ioremap_nocache(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
+ pll_lock = ioremap(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
if (!pll_lock) {
SSDK_ERROR("Failed to map CMN PLL LOCK register!\n");
return A_FALSE;
@@ -843,7 +843,7 @@ static void ssdk_cmnblk_pll_src_set(enum
void __iomem *cmn_pll_src_base = NULL;
a_uint32_t reg_val;
- cmn_pll_src_base = ioremap_nocache(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
+ cmn_pll_src_base = ioremap(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
if (!cmn_pll_src_base) {
SSDK_ERROR("Failed to map cmn pll source address!\n");
return;
@@ -869,7 +869,7 @@ static void ssdk_cmnblk_init(enum cmnblk
return;
}
- gcc_pll_base = ioremap_nocache(CMN_BLK_ADDR, CMN_BLK_SIZE);
+ gcc_pll_base = ioremap(CMN_BLK_ADDR, CMN_BLK_SIZE);
if (!gcc_pll_base) {
SSDK_ERROR("Failed to map gcc pll address!\n");
return;
--- a/src/init/ssdk_init.c
+++ b/src/init/ssdk_init.c
@@ -3134,7 +3134,7 @@ static int ssdk_dess_mac_mode_init(a_uin
(a_uint8_t *)&reg_value, 4);
mdelay(10);
/*softreset psgmii, fixme*/
- gcc_addr = ioremap_nocache(0x1812000, 0x200);
+ gcc_addr = ioremap(0x1812000, 0x200);
if (!gcc_addr) {
SSDK_ERROR("gcc map fail!\n");
return 0;
--- a/src/init/ssdk_plat.c
+++ b/src/init/ssdk_plat.c
@@ -1708,7 +1708,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
reg_mode = ssdk_uniphy_reg_access_mode_get(dev_id);
if(reg_mode == HSL_REG_LOCAL_BUS) {
ssdk_uniphy_reg_map_info_get(dev_id, &map);
- qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap_nocache(map.base_addr,
+ qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap(map.base_addr,
map.size);
if (!qca_phy_priv_global[dev_id]->uniphy_hw_addr) {
SSDK_ERROR("%s ioremap fail.", __func__);
@@ -1723,7 +1723,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
reg_mode = ssdk_switch_reg_access_mode_get(dev_id);
if (reg_mode == HSL_REG_LOCAL_BUS) {
ssdk_switch_reg_map_info_get(dev_id, &map);
- qca_phy_priv_global[dev_id]->hw_addr = ioremap_nocache(map.base_addr,
+ qca_phy_priv_global[dev_id]->hw_addr = ioremap(map.base_addr,
map.size);
if (!qca_phy_priv_global[dev_id]->hw_addr) {
SSDK_ERROR("%s ioremap fail.", __func__);
@@ -1764,7 +1764,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
return -1;
}
- qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap_nocache(map.base_addr,
+ qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap(map.base_addr,
map.size);
if (!qca_phy_priv_global[dev_id]->psgmii_hw_addr) {
SSDK_ERROR("%s ioremap fail.", __func__);

View File

@ -1,7 +1,7 @@
From 37255b97a9170f6dd1604931f0d7a8f847be5b5d Mon Sep 17 00:00:00 2001
From cdcafa28c857e4d04c9210feb54dc84e427061fe Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Tue, 11 Jan 2022 00:28:42 +0100
Subject: [PATCH 05/14] qca807x: add a LED quirk for Xiaomi AX9000
Subject: [PATCH 1/2] qca807x: add a LED quirk for Xiaomi AX9000
Xiaomi AX9000 has a single LED for each of 4 gigabit ethernet ports that
are connected to QCA8075, and that LED is connected to the 100M LED pin.
@ -49,7 +49,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#include "sw.h"
#include "fal_port_ctrl.h"
#include "hsl_api.h"
@@ -2708,6 +2710,15 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
@@ -2716,6 +2718,15 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
led_status |= MALIBU_LED_1000_CTRL1_100_10_MASK;
malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
MALIBU_PHY_MMD7_LED_1000_CTRL1, led_status);

View File

@ -1,40 +0,0 @@
From 60d2b72cacd43796def9b4bd69a9e0e84be9d2e1 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 12 May 2021 17:15:46 +0200
Subject: [PATCH 02/14] SSDK: platform: use of_mdio_find_bus() to get MDIO bus
Kernel has a generic of_mdio_find_bus() which can get the appropriate
MDIO bus based on the DT node.
So, drop the getting MDIO from platform data, which no longer works
in 5.4 and later and use of_mdio_find_bus().
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
src/init/ssdk_plat.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
--- a/src/init/ssdk_plat.c
+++ b/src/init/ssdk_plat.c
@@ -753,7 +753,6 @@ static int miibus_get(a_uint32_t dev_id)
struct device_node *mdio_node = NULL;
struct device_node *switch_node = NULL;
struct platform_device *mdio_plat = NULL;
- struct qca_mdio_data *mdio_data = NULL;
struct qca_phy_priv *priv;
hsl_reg_mode reg_mode = HSL_REG_LOCAL_BUS;
priv = qca_phy_priv_global[dev_id];
@@ -788,12 +787,7 @@ static int miibus_get(a_uint32_t dev_id)
if(reg_mode == HSL_REG_LOCAL_BUS)
{
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
- if (!mdio_data) {
- SSDK_ERROR("cannot get mdio_data reference from device data\n");
- return 1;
- }
- priv->miibus = mdio_data->mii_bus;
+ priv->miibus = of_mdio_find_bus(mdio_node);
}
else
priv->miibus = dev_get_drvdata(&mdio_plat->dev);

View File

@ -1,7 +1,7 @@
From 1eaed6c8d72cb07e221a94d05615ae45b60ffd82 Mon Sep 17 00:00:00 2001
From a750e569aeb4f7b454dbde18cd6d0f2bb1875dfa Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 26 Jan 2022 14:47:33 +0100
Subject: [PATCH 06/14] qca807x: add a LED quirk for Xiaomi AX3600
Subject: [PATCH 2/2] qca807x: add a LED quirk for Xiaomi AX3600
AX3600 requires the same LED quirk so that PHY LED-s will blink even
once Linux resets the PHY.
@ -15,7 +15,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- a/src/hsl/phy/malibu_phy.c
+++ b/src/hsl/phy/malibu_phy.c
@@ -2710,8 +2710,9 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
@@ -2718,8 +2718,9 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
led_status |= MALIBU_LED_1000_CTRL1_100_10_MASK;
malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
MALIBU_PHY_MMD7_LED_1000_CTRL1, led_status);

View File

@ -1,42 +0,0 @@
From c1b6fa42a160763b574dd52aa4845718e4cd0ea6 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 13 Aug 2021 20:03:21 +0200
Subject: [PATCH 03/14] SSDK: dts: 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 <robimarko@gmail.com>
---
src/init/ssdk_dts.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/src/init/ssdk_dts.c
+++ b/src/init/ssdk_dts.c
@@ -921,8 +921,9 @@ static void ssdk_dt_parse_intf_mac(void)
{
struct device_node *dp_node = NULL;
a_uint32_t dp = 0;
- a_uint8_t *maddr = NULL;
+ u8 maddr[ETH_ALEN];
char dp_name[8] = {0};
+ int ret;
for (dp = 1; dp <= SSDK_MAX_NR_ETH; dp++) {
snprintf(dp_name, sizeof(dp_name), "dp%d", dp);
@@ -930,11 +931,11 @@ static void ssdk_dt_parse_intf_mac(void)
if (!dp_node) {
continue;
}
- maddr = (a_uint8_t *)of_get_mac_address(dp_node);
+ ret = of_get_mac_address(dp_node, maddr);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
if (maddr && is_valid_ether_addr(maddr)) {
#else
- if (!IS_ERR(maddr) && is_valid_ether_addr(maddr)) {
+ if (!ret && is_valid_ether_addr(maddr)) {
#endif
ssdk_dt_global.num_intf_mac++;
ether_addr_copy(ssdk_dt_global.intf_mac[dp-1].uc, maddr);

View File

@ -1,83 +0,0 @@
From aaac91b5e8756dce1c0242d58074a0b5d4607b57 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 24 Dec 2021 20:02:32 +0100
Subject: [PATCH 04/14] qca8081: convert to 5.11 IRQ model
Kernel 5.11 introduced new IRQ handling model for PHY-s,
so provide those if 5.11 or later is used.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
src/hsl/phy/qca808x.c | 46 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
--- a/src/hsl/phy/qca808x.c
+++ b/src/hsl/phy/qca808x.c
@@ -247,6 +247,7 @@ static int qca808x_config_intr(struct ph
return err;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
static int qca808x_ack_interrupt(struct phy_device *phydev)
{
int err;
@@ -266,6 +267,47 @@ static int qca808x_ack_interrupt(struct
return (err < 0) ? err : 0;
}
+#endif
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0))
+static irqreturn_t qca808x_handle_interrupt(struct phy_device *phydev)
+{
+ a_uint16_t irq_status, int_enabled;
+ a_uint32_t dev_id = 0, phy_id = 0;
+ qca808x_priv *priv = phydev->priv;
+ const struct qca808x_phy_info *pdata = priv->phy_info;
+
+ if (!pdata) {
+ return SW_FAIL;
+ }
+
+ dev_id = pdata->dev_id;
+ phy_id = pdata->phy_addr;
+
+ irq_status = qca808x_phy_reg_read(dev_id, phy_id,
+ QCA808X_PHY_INTR_STATUS);
+ if (irq_status < 0) {
+ phy_error(phydev);
+ return IRQ_NONE;
+ }
+
+ /* Read the current enabled interrupts */
+ int_enabled = qca808x_phy_reg_read(dev_id, phy_id,
+ QCA808X_PHY_INTR_MASK);
+ if (int_enabled < 0) {
+ phy_error(phydev);
+ return IRQ_NONE;
+ }
+
+ /* See if this was one of our enabled interrupts */
+ if (!(irq_status & int_enabled))
+ return IRQ_NONE;
+
+ phy_trigger_machine(phydev);
+
+ return IRQ_HANDLED;
+}
+#endif
/* switch linux negtiation capability to fal avariable */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
@@ -638,7 +680,11 @@ struct phy_driver qca808x_phy_driver = {
.config_intr = qca808x_config_intr,
.config_aneg = qca808x_config_aneg,
.aneg_done = qca808x_aneg_done,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
.ack_interrupt = qca808x_ack_interrupt,
+#else
+ .handle_interrupt = qca808x_handle_interrupt,
+#endif
.read_status = qca808x_read_status,
.suspend = qca808x_suspend,
.resume = qca808x_resume,

View File

@ -1,22 +0,0 @@
From adc75660a50c5b7a16032921a30a0eaedc8b826f Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sat, 7 May 2022 19:03:55 +0200
Subject: [PATCH 07/14] include: fix compilation error for parse_uci_option
Fix missing include for parse_uci_option
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
include/ref/ref_uci.h | 1 +
1 file changed, 1 insertion(+)
--- a/include/ref/ref_uci.h
+++ b/include/ref/ref_uci.h
@@ -22,6 +22,7 @@
extern "C" {
#endif /* __cplusplus */
+#include <linux/switch.h>
#if defined(IN_SWCONFIG)
int

View File

@ -1,30 +0,0 @@
From d70d013ac1090565ebb71875f5bdc70840807428 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Sep 2022 08:21:13 -0500
Subject: [PATCH 08/14] QSDK: config: Avoid -Werror heroics
Trying to compile the QSDK with warnings as errors is a very brave
endeavor. It's also stupid as it doesn't work on ipq60xx:
isisc_acl_prv.h:99: error: "FIELD_GET" redefined [-Werror]
99 | #define FIELD_GET(reg, field, val) \
|
Instead of dealing with the braindead code, just disable Werror.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/config
+++ b/config
@@ -133,7 +133,7 @@ endif
ifeq ($(ARCH), arm64)
ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
- CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+ CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
endif
endif

View File

@ -1,48 +0,0 @@
From 0582c76ce9c35ce8d49cba598e0e17073dd875b5 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Sep 2022 08:30:03 -0500
Subject: [PATCH 09/14] Revert "qca-ssdk: remove bridge fdb entry for the
authentication failed mac"
This change causes an undefined reference to "br_fdb_delete_by_netdev".
This reverts commit 144f02b982c8c707aaf84b57d8c277d03d877236.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
src/ref/ref_acl.c | 11 -----------
1 file changed, 11 deletions(-)
--- a/src/ref/ref_acl.c
+++ b/src/ref/ref_acl.c
@@ -23,7 +23,6 @@
#include "ssdk_init.h"
#include "ssdk_plat.h"
#include <linux/etherdevice.h>
-#include <linux/if_bridge.h>
/* entry 0-1 is for global deny all and accept eapol rule
entry 2-9 is for phy port1 specific mac accept rule
@@ -128,7 +127,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_
{
sw_error_t rv = SW_OK;
fal_acl_rule_t rule = {0};
- struct net_device *eth_dev = NULL;
a_uint32_t port_id = ssdk_ifname_to_port(dev_id, entry->ifname);
SSDK_DEBUG("port_id %d entry_idx %d\n", port_id, entry_idx);
@@ -224,15 +222,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_
ref_acl_mac_entry[dev_id][entry_idx].port_map = BIT(port_id);
ref_acl_mac_entry[dev_id][entry_idx].acl_policy = 1;
}
- else if (!is_deny_all_mac(entry->src_mac.uc) && !entry->acl_policy)
- {
- eth_dev = dev_get_by_name(&init_net, entry->ifname);
- if (eth_dev)
- {
- br_fdb_delete_by_netdev(eth_dev, entry->src_mac.uc, 0);
- dev_put(eth_dev);
- }
- }
return rv;
}

View File

@ -1,281 +0,0 @@
From 2276a0b93751f015ef719dedf9a0d4b55ae684d5 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Tue, 15 Nov 2022 18:50:01 +0800
Subject: [PATCH 10/14] Support Linux-Style Makefile for SSDK
Change-Id: I8c4399433b6422ef6192f70bf08b0d3023cc94b6
Signed-off-by: crao <quic_crao@quicinc.com>
---
Makefile | 15 +++++++++++++
Makefile.modules | 16 ++++++++++++++
make/defs.mk | 1 +
make/linux_opt.mk | 54 ++++++++++++++++++++++++++++-------------------
make/target.mk | 12 +++++++++++
src/api/Makefile | 2 +-
6 files changed, 77 insertions(+), 23 deletions(-)
create mode 100644 Makefile.modules
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,9 @@ include ./make/$(OS)_opt.mk
SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile)))
SUB_LIB=$(subst src/, , $(SUB_DIR))
+####################################################################
+# SSDK-Style Makefile
+####################################################################
all: $(BIN_DIR) kslib
mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile;
make -C $(SYS_PATH) M=$(PRJ_PATH)/temp/ CROSS_COMPILE=$(TOOLPREFIX) modules
@@ -20,6 +23,18 @@ all: $(BIN_DIR) kslib
rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a
@echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
+####################################################################
+# LNX Modules-Style Makefile
+####################################################################
+modules: $(BIN_DIR) kslib_c
+ cp Makefile.modules ./Makefile;
+ make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules
+ cp *.ko build/bin;
+ @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
+
+kslib_c:
+ $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i src_list_loop || exit 1;)
+
kslib:kslib_o
$(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o)
--- /dev/null
+++ b/Makefile.modules
@@ -0,0 +1,16 @@
+####################################################################
+# Add All Local Flags
+####################################################################
+ccflags-y += $(LNX_LOCAL_CFLAGS) -Wno-error
+
+####################################################################
+# Build Object List
+####################################################################
+SRC_LIST := $(shell cat $(PRJ_PATH)/src_list.dep)
+OBJ_LIST := $(patsubst %.c,%.o,$(SRC_LIST))
+
+####################################################################
+# Linux Kernel Module
+####################################################################
+obj-m := qca-ssdk.o
+qca-ssdk-objs := $(OBJ_LIST)
--- a/make/defs.mk
+++ b/make/defs.mk
@@ -7,6 +7,7 @@ ifeq (,$(findstring $(LIB), $(COMPONENTS
endif
SRC_FILE=$(addprefix $(PRJ_PATH)/$(LOC_DIR)/, $(SRC_LIST))
+LOC_SRC_FILE=$(addprefix $(LOC_DIR)/, $(SRC_LIST))
OBJ_LIST=$(SRC_LIST:.c=.o)
OBJ_FILE=$(addprefix $(DST_DIR)/, $(OBJ_LIST))
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -295,7 +295,7 @@ ifeq (TRUE, $(DEBUG_ON))
MODULE_CFLAG += -g
endif
-MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s" -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)"
+MODULE_CFLAG += $(OPT_FLAG) -Wall -DVERSION=\"$(VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\" -DOS=\"$(OS)\" -D"KBUILD_STR(s)=\#s"
MODULE_INC += -I$(PRJ_PATH)/include \
-I$(PRJ_PATH)/include/common \
@@ -450,7 +450,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER34
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/source/include \
@@ -473,7 +473,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22
ifeq ($(ARCH), arm64)
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/source \
@@ -492,13 +492,13 @@ ifeq (KSLIB, $(MODULE_TYPE))
-I$(SYS_PATH)/source/include/uapi
ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),)
- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h
+ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h
else
- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h
+ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h
endif
else ifeq ($(ARCH), arm)
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/7.5.0/include/ \
-I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \
@@ -522,13 +522,13 @@ ifeq (KSLIB, $(MODULE_TYPE))
-I$(TOOL_PATH)/../../lib/arm-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/9.3.0/include/
ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),)
- MODULE_INC += -include $(SYS_PATH)/include/linux/kconfig.h
+ SYS_INC += -include $(SYS_PATH)/include/linux/kconfig.h
else
- MODULE_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h
+ SYS_INC += -include $(KERNEL_SRC)/include/linux/kconfig.h
endif
else
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/source \
@@ -564,7 +564,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DLNX26_22
ifeq ($(ARCH), arm64)
KCONF_FILE = $(SYS_PATH)/source/include/linux/kconfig.h
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/source/include \
@@ -581,7 +581,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
-I$(SYS_PATH)/source/arch/arm64/include/asm/mach \
-include $(KCONF_FILE)
else ifeq ($(ARCH), arm)
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \
-I$(SYS_PATH)/include \
@@ -604,7 +604,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER34
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(TOOL_PATH)/../lib/gcc/$(TARGET_NAME)/$(GCC_VERSION)/include/ \
-I$(TOOL_PATH)/../../lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/5.3.0/include/ \
-I$(TOOL_PATH)/../../lib/armv7a-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.8.4/include/ \
@@ -627,10 +627,10 @@ ifeq (KSLIB, $(MODULE_TYPE))
-I$(EXT_PATH) \
-I$(SYS_PATH)/source/arch/arm/include/asm/mach
ifneq ($(wildcard $(SYS_PATH)/include/linux/kconfig.h),)
- MODULE_INC += \
+ SYS_INC += \
-include $(SYS_PATH)/include/linux/kconfig.h
else
- MODULE_INC += \
+ SYS_INC += \
-include $(SYS_PATH)/source/include/linux/kconfig.h
endif
@@ -641,7 +641,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22
MODULE_CFLAG += -Werror
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/source/include \
-I$(SYS_PATH)/source/arch/arm/mach-msm/include \
@@ -657,7 +657,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22
ifeq (mips, $(CPU))
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/arch/mips/include \
-I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \
@@ -678,7 +678,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
-O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
endif
else
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/arch/arm/include \
-I$(SYS_PATH)/arch/arm/include/asm \
@@ -695,7 +695,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
MODULE_CFLAG += -DKVER26
MODULE_CFLAG += -DLNX26_22
ifeq (mips, $(CPU))
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/arch/mips/include \
-I$(SYS_PATH)/arch/mips/include/asm/mach-ar7240 \
@@ -708,7 +708,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
-O2 -fno-pic -pipe -mabi=32 -march=mips32r2 -DMODULE -mlong-calls -DEXPORT_SYMTAB
endif
else
- MODULE_INC += -I$(SYS_PATH) \
+ SYS_INC += -I$(SYS_PATH) \
-I$(SYS_PATH)/include \
-I$(SYS_PATH)/arch/arm/include \
-I$(SYS_PATH)/arch/arm/include/asm \
@@ -721,8 +721,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
endif
- MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE $(CPU_CFLAG)
-
+ MODULE_CFLAG += -D__KERNEL__ -DKERNEL_MODULE
endif
@@ -748,4 +747,15 @@ ifneq (TRUE, $(KERNEL_MODE))
endif
endif
-LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS)
+LOCAL_CFLAGS += $(MODULE_INC) $(SYS_INC) $(MODULE_CFLAG) $(EXTRA_CFLAGS)
+
+####################################################################
+# cflags for SSDK-Style Makefile
+####################################################################
+LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_MODNAME=KBUILD_STR(qca-ssdk)"
+
+####################################################################
+# cflags for LNX Modules-Style Makefile
+####################################################################
+LNX_LOCAL_CFLAGS += $(MODULE_INC) $(MODULE_CFLAG) ${EXTRA_INC}
+export LNX_LOCAL_CFLAGS
--- a/make/target.mk
+++ b/make/target.mk
@@ -3,6 +3,18 @@ include $(PRJ_PATH)/make/$(OS)_opt.mk
include $(PRJ_PATH)/make/tools.mk
+####################################################################
+# LNX Modules-Style Makefile
+####################################################################
+src_list_loop: src_list
+ $(foreach i, $(SUB_DIR), $(MAKE) -C $(i) src_list_loop || exit 1;)
+
+src_list:
+ echo -n "$(LOC_SRC_FILE) " >> $(PRJ_PATH)/src_list.dep
+
+####################################################################
+# SSDK-Style Makefile
+####################################################################
obj: $(OBJ_LIST)
$(OBJ_LOOP)
--- a/src/api/Makefile
+++ b/src/api/Makefile
@@ -1,4 +1,4 @@
-LOC_DIR=src/sal
+LOC_DIR=src/api
LIB=API
include $(PRJ_PATH)/make/config.mk

View File

@ -1,26 +0,0 @@
From 46a5dd73195081b5d78582f2a13f83e49f36e917 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Tue, 7 Mar 2023 17:15:07 +0800
Subject: [PATCH 11/14] fix compilation issue in Linux-Style Makefile
Change-Id: If38251fc0a2bf4abc666d30f4812c0d9507310dc
Signed-off-by: crao <quic_crao@quicinc.com>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -27,9 +27,9 @@ all: $(BIN_DIR) kslib
# LNX Modules-Style Makefile
####################################################################
modules: $(BIN_DIR) kslib_c
- cp Makefile.modules ./Makefile;
- make -C $(SYS_PATH) M=$(PRJ_PATH)/ $(LNX_MAKEOPTS) modules
- cp *.ko build/bin;
+ mkdir -p ./temp/;cp * ./temp -a;cd ./temp;cp ../Makefile.modules ./Makefile;
+ make -C $(SYS_PATH) M=$(PRJ_PATH)/temp $(LNX_MAKEOPTS) modules
+ cp temp/*.ko build/bin;
@echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
kslib_c:

View File

@ -1,23 +0,0 @@
From 0060aa1b0d2530672e64708d8062b3f33d007ed3 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Wed, 15 Mar 2023 11:19:39 +0800
Subject: [PATCH 12/14] fix compilation issue in Miami yocto
Change-Id: I8526b9e43667d72ae9afa4ef8a13167088d194ba
Signed-off-by: crao <quic_crao@quicinc.com>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,9 @@ all: $(BIN_DIR) kslib
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
@echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
kslib_c:

View File

@ -1,6 +1,6 @@
--- a/src/hsl/phy/hsl_phy.c
+++ b/src/hsl/phy/hsl_phy.c
@@ -761,7 +761,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_
@@ -785,7 +785,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_
*phydev = miibus->phy_map[phy_addr];
if(*phydev == NULL)
{
@ -9,7 +9,7 @@
return SW_NOT_INITIALIZED;
}
pdev_addr = (*phydev)->addr;
@@ -770,7 +770,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_
@@ -795,7 +795,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_
*phydev = mdiobus_get_phy(miibus, phy_addr);
if(*phydev == NULL)
{

View File

@ -1,55 +0,0 @@
From 05aba6d6dfd49fe10b33cf221b7e81250a67033c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 29 Sep 2022 09:59:20 +0200
Subject: [PATCH 13/14] SSDK: config: add kernel 6.1
Allow kernel 6.1 to be recognized and compiled under it.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
config | 6 +++++-
make/linux_opt.mk | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
--- a/config
+++ b/config
@@ -24,6 +24,10 @@ ifeq ($(KVER),$(filter 5.4%,$(KVER)))
OS_VER=5_4
endif
+ifeq ($(KVER),$(filter 6.1%,$(KVER)))
+ OS_VER=6_1
+endif
+
ifeq ($(KVER), 3.4.0)
OS_VER=3_4
endif
@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm)
endif
ifeq ($(ARCH), arm64)
- ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
+ ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 6.1%,$(KVER)))
CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
endif
endif
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
KASAN_SHADOW_SCALE_SHIFT := 3
endif
- ifeq (5_4, $(OS_VER))
+ ifeq (5_4 6_1, $(OS_VER))
ifeq ($(ARCH), arm64)
KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
endif
@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
endif
- ifeq ($(OS_VER),$(filter 4_4 5_4, $(OS_VER)))
+ ifeq ($(OS_VER),$(filter 4_4 5_4 6_1, $(OS_VER)))
MODULE_CFLAG += -DKVER34
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22

View File

@ -1,27 +0,0 @@
From 6a49dd6bb2e40ce49351adb6100599f176d80494 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 21 Oct 2022 13:40:15 +0200
Subject: [PATCH 14/14] SSDK: qca808x: use get_random_u32
prandom has been removed from the kernel in 6.1-rc1, so use get_random_u32
instead as its the drop-in replacement.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
src/hsl/phy/qca808x_phy.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/src/hsl/phy/qca808x_phy.c
+++ b/src/hsl/phy/qca808x_phy.c
@@ -299,7 +299,11 @@ qca808x_phy_ms_random_seed_set(a_uint32_
phy_data = qca808x_phy_debug_read(dev_id, phy_id,
QCA808X_DEBUG_LOCAL_SEED);
phy_data &= ~(QCA808X_MASTER_SLAVE_SEED_CFG);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
phy_data |= (prandom_u32()%QCA808X_MASTER_SLAVE_SEED_RANGE) << 2;
+#else
+ phy_data |= (get_random_u32()%QCA808X_MASTER_SLAVE_SEED_RANGE) << 2;
+#endif
SSDK_DEBUG("QCA808X_DEBUG_LOCAL_SEED:%x\n", phy_data);
rv = qca808x_phy_debug_write(dev_id, phy_id,
QCA808X_DEBUG_LOCAL_SEED, phy_data);