mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
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 <robimarko@gmail.com>
This commit is contained in:
parent
b45562a69c
commit
4ee444b5da
@ -5,9 +5,9 @@ PKG_RELEASE:=1
|
|||||||
|
|
||||||
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git
|
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_DATE:=2022-04-30
|
PKG_SOURCE_DATE:=2023-06-06
|
||||||
PKG_SOURCE_VERSION:=72e9ec4187414461cbcf6ccff100e8b5ebe5f40b
|
PKG_SOURCE_VERSION:=fa67464466f69f00967cc373d1bdd6025f57eb89
|
||||||
PKG_MIRROR_HASH:=805f16e59c75511132922f97740ebf6bf953845b0bbfd2089c4615456893bb37
|
PKG_MIRROR_HASH:=51bf524382a5cb542c2c80d12a91f87b9736de3ac3c1d4a351c97b3502d68574
|
||||||
|
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
PKG_FLAGS:=nonshared
|
PKG_FLAGS:=nonshared
|
||||||
|
@ -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__);
|
@ -1,9 +1,12 @@
|
|||||||
From 40979666b4371012405715ffa61ab5760fcdc6b3 Mon Sep 17 00:00:00 2001
|
From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001
|
||||||
Message-Id: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
|
|
||||||
From: Baruch Siach <baruch@tkos.co.il>
|
From: Baruch Siach <baruch@tkos.co.il>
|
||||||
Date: Mon, 3 May 2021 20:07:36 +0300
|
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 +++++++++++
|
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++
|
||||||
1 file changed, 11 insertions(+)
|
1 file changed, 11 insertions(+)
|
@ -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) {
|
|
@ -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");
|
|
@ -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>
|
From: Robert Marko <robimarko@gmail.com>
|
||||||
Date: Thu, 20 May 2021 14:56:46 +0200
|
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
|
There is a bug in the NAPI packet counting that will
|
||||||
cause NAPI over budget warnings.
|
cause NAPI over budget warnings.
|
@ -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>
|
From: Robert Marko <robimarko@gmail.com>
|
||||||
Date: Thu, 20 May 2021 14:57:46 +0200
|
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
|
Currently a weight of 100 is used by the EDMA, according
|
||||||
to upstream max of 64 should be used and that is used for
|
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
|
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
|
||||||
+++ b/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) {
|
if (!edma_hw.napi_added) {
|
||||||
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
|
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
|
@ -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
|
@ -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);
|
|
@ -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>
|
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
||||||
Date: Sun, 5 Jun 2022 21:45:09 -0500
|
Date: Fri, 23 Jun 2023 13:34:56 +0200
|
||||||
Subject: [PATCH] nss_dp_main: Use a 'phy-handle' property to connect to the
|
Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to
|
||||||
PHY
|
the PHY
|
||||||
|
|
||||||
The original method of connecting a PHY to the ethernet controller
|
The original method of connecting a PHY to the ethernet controller
|
||||||
requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree
|
requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree
|
||||||
@ -18,21 +18,22 @@ as they are no longer used:
|
|||||||
* "qcom,forced-duplex"
|
* "qcom,forced-duplex"
|
||||||
|
|
||||||
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
||||||
|
Signed-off-by: Robert Marko <robimarko@gmail.com>
|
||||||
---
|
---
|
||||||
include/nss_dp_dev.h | 5 +--
|
include/nss_dp_dev.h | 5 +--
|
||||||
nss_dp_main.c | 91 +++++---------------------------------------
|
nss_dp_main.c | 91 +++++++-------------------------------------
|
||||||
2 files changed, 10 insertions(+), 86 deletions(-)
|
2 files changed, 14 insertions(+), 82 deletions(-)
|
||||||
|
|
||||||
--- a/include/nss_dp_dev.h
|
--- a/include/nss_dp_dev.h
|
||||||
+++ b/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 */
|
unsigned long drv_flags; /* Driver specific feature flags */
|
||||||
|
|
||||||
/* Phy related stuff */
|
/* Phy related stuff */
|
||||||
+ struct device_node *phy_node;
|
+ struct device_node *phy_node; /* Phy device OF node */
|
||||||
struct phy_device *phydev; /* Phy device */
|
struct phy_device *phydev; /* Phy device */
|
||||||
struct mii_bus *miibus; /* MII bus */
|
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 */
|
- uint32_t phy_mdio_addr; /* Mdio address */
|
||||||
- bool link_poll; /* Link polling enable? */
|
- bool link_poll; /* Link polling enable? */
|
||||||
- uint32_t forced_speed; /* Forced speed? */
|
- 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
|
--- a/nss_dp_main.c
|
||||||
+++ b/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);
|
netif_start_queue(netdev);
|
||||||
|
|
||||||
@ -51,19 +52,23 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
|||||||
/* Notify data plane link is up */
|
/* Notify data plane link is up */
|
||||||
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
|
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
|
||||||
netdev_dbg(netdev, "Data plane set link failed\n");
|
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;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
+ 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)) {
|
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
|
||||||
pr_err("%s: error reading mactype\n", np->name);
|
pr_err("%s: error reading mactype\n", np->name);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@@ -594,16 +596,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
@@ -635,18 +641,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
||||||
#else
|
return -EFAULT;
|
||||||
of_get_phy_mode(np, &dp_priv->phy_mii_type);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
|
- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
|
||||||
- if (of_property_read_u32(np, "qcom,phy-mdio-addr",
|
- if (of_property_read_u32(np, "qcom,phy-mdio-addr",
|
||||||
- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) {
|
- &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-speed", &dp_priv->forced_speed);
|
||||||
- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex);
|
- 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)) {
|
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
|
||||||
@@ -636,50 +628,6 @@ static int32_t nss_dp_of_get_pdata(struc
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +95,9 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
|||||||
-{
|
-{
|
||||||
- struct device_node *mdio_node;
|
- struct device_node *mdio_node;
|
||||||
- struct platform_device *mdio_plat;
|
- struct platform_device *mdio_plat;
|
||||||
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0))
|
||||||
- struct ipq40xx_mdio_data *mdio_data;
|
- struct ipq40xx_mdio_data *mdio_data;
|
||||||
|
-#endif
|
||||||
-
|
-
|
||||||
- /*
|
- /*
|
||||||
- * Find mii_bus using "mdio-bus" handle.
|
- * Find mii_bus using "mdio-bus" handle.
|
||||||
@ -115,6 +124,9 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
|||||||
- return NULL;
|
- 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);
|
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
|
||||||
- if (!mdio_data) {
|
- if (!mdio_data) {
|
||||||
- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n");
|
- 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;
|
- return mdio_data->mii_bus;
|
||||||
|
-#endif
|
||||||
-}
|
-}
|
||||||
-
|
-
|
||||||
#ifdef CONFIG_NET_SWITCHDEV
|
#ifdef CONFIG_NET_SWITCHDEV
|
||||||
/*
|
/*
|
||||||
* nss_dp_is_phy_dev()
|
* 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 device_node *np = pdev->dev.of_node;
|
||||||
struct nss_gmac_hal_platform_data gmac_hal_pdata;
|
struct nss_gmac_hal_platform_data gmac_hal_pdata;
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
@ -136,7 +149,7 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
|||||||
#if defined(NSS_DP_PPE_SUPPORT)
|
#if defined(NSS_DP_PPE_SUPPORT)
|
||||||
uint32_t vsi_id;
|
uint32_t vsi_id;
|
||||||
fal_port_t port_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);
|
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) {
|
+ if (dp_priv->phy_node) {
|
||||||
SET_NETDEV_DEV(netdev, &pdev->dev);
|
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||||
-
|
|
||||||
- dp_priv->phydev = phy_connect(netdev, phy_id,
|
- dp_priv->phydev = phy_connect(netdev, phy_id,
|
||||||
- &nss_dp_adjust_link,
|
- &nss_dp_adjust_link,
|
||||||
- dp_priv->phy_mii_type);
|
- dp_priv->phy_mii_type);
|
||||||
- if (IS_ERR(dp_priv->phydev)) {
|
- if (IS_ERR(dp_priv->phydev)) {
|
||||||
- netdev_dbg(netdev, "failed to connect to phy device\n");
|
- netdev_dbg(netdev, "failed to connect to phy device\n");
|
||||||
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
|
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
|
||||||
+ &nss_dp_adjust_link, 0,
|
+ &nss_dp_adjust_link, 0,
|
||||||
+ dp_priv->phy_mii_type);
|
+ dp_priv->phy_mii_type);
|
||||||
+ if (!(dp_priv->phydev)) {
|
+ 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;
|
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)
|
|
@ -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,
|
|
@ -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>
|
From: Robert Marko <robimarko@gmail.com>
|
||||||
Date: Thu, 23 Jun 2022 14:18:50 +0200
|
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.
|
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
|
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
|
||||||
+++ b/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)
|
static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc)
|
||||||
{
|
{
|
@ -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>
|
From: Robert Marko <robimarko@gmail.com>
|
||||||
Date: Sun, 4 Dec 2022 18:41:36 +0100
|
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
|
Allow reading the desired netdev name from DTS like DSA allows and then
|
||||||
set it as the netdev name during registration.
|
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
|
--- a/nss_dp_main.c
|
||||||
+++ b/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 nss_dp_dev *dp_priv;
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct nss_gmac_hal_platform_data gmac_hal_pdata;
|
struct nss_gmac_hal_platform_data gmac_hal_pdata;
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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;
|
|
||||||
|
|
@ -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);
|
|
@ -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;
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user