1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2022-08-29 01:11:42 +08:00
parent e4955a3c0b
commit 00f51ecf79
114 changed files with 12104 additions and 0 deletions

View file

@ -0,0 +1,62 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-nss-dp
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/cc-qrdk/oss/lklm/nss-dp
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-03-26
PKG_SOURCE_VERSION:=e0c89348d5ad99559ce2fbe15d37b3b5bc66aa03
PKG_MIRROR_HASH:=f369f0c3b33b5f4ad6d0a6ad6ac5495f63c9ecaf94e4e7fa345169f3e44fcf45
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/qca-nss-dp
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
DEPENDS:=@(TARGET_ipq807x||TARGET_ipq60xx) +kmod-qca-ssdk-nohnat
TITLE:=Kernel driver for NSS data plane
FILES:=$(PKG_BUILD_DIR)/qca-nss-dp.ko
AUTOLOAD:=$(call AutoLoad,31,qca-nss-dp)
endef
define KernelPackage/qca-nss-dp/Description
This package contains a NSS data plane driver for QCA chipset
endef
define Build/InstallDev
mkdir -p $(1)/usr/include/qca-nss-dp
$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-dp/
endef
EXTRA_CFLAGS+= \
-I$(STAGING_DIR)/usr/include/qca-ssdk
NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal
define Build/Configure
$(LN) $(NSS_DP_HAL_DIR)/arch/$(CONFIG_TARGET_BOARD)/nss_$(CONFIG_TARGET_BOARD).h \
$(PKG_BUILD_DIR)/exports/nss_dp_arch.h
endef
ifeq ($(CONFIG_TARGET_BOARD), "ipq807x")
SOC="ipq807x_64"
else ifeq ($(CONFIG_TARGET_BOARD), "ipq60xx")
SOC="ipq60xx_64"
endif
define Build/Compile
+$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(SOC)" \
$(KERNEL_MAKE_FLAGS) \
$(PKG_JOBS) \
modules
endef
$(eval $(call KernelPackage,qca-nss-dp))

View file

@ -0,0 +1,44 @@
From 40979666b4371012405715ffa61ab5760fcdc6b3 Mon Sep 17 00:00:00 2001
Message-Id: <40979666b4371012405715ffa61ab5760fcdc6b3.1620066716.git.baruch@tkos.co.il>
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
---
hal/edma/edma_tx_rx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/hal/edma/edma_tx_rx.c
+++ b/hal/edma/edma_tx_rx.c
@@ -226,10 +226,16 @@ void nss_phy_tstamp_rx_buf(__attribute__
* set to the correct PTP class value by calling ptp_classify_raw
* in drv->rxtstamp function.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
if (ndev && ndev->phydev && ndev->phydev->drv &&
ndev->phydev->drv->rxtstamp)
if(ndev->phydev->drv->rxtstamp(ndev->phydev, skb, 0))
return;
+#else
+ if (ndev && phy_has_rxtstamp(ndev->phydev))
+ if (phy_rxtstamp(ndev->phydev, skb, 0))
+ return;
+#endif
netif_receive_skb(skb);
}
@@ -247,9 +253,14 @@ void nss_phy_tstamp_tx_buf(struct net_de
* set to the correct PTP class value by calling ptp_classify_raw
* in the drv->txtstamp function.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
if (ndev && ndev->phydev && ndev->phydev->drv &&
ndev->phydev->drv->txtstamp)
ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0);
+#else
+ if (ndev && phy_has_txtstamp(ndev->phydev))
+ phy_rxtstamp(ndev->phydev, skb, 0);
+#endif
}
EXPORT_SYMBOL(nss_phy_tstamp_tx_buf);

View file

@ -0,0 +1,48 @@
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
@@ -25,7 +25,7 @@
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/if_vlan.h>
-#include <linux/switch.h>
+#include <linux/phy.h>
#include "nss_dp_api_if.h"
#include "nss_dp_hal_if.h"
@@ -46,7 +46,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
@@ -463,7 +463,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

@ -0,0 +1,48 @@
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/edma/edma_data_plane.c | 2 +-
hal/gmac_hal_ops/qcom/qcom_if.c | 2 +-
hal/gmac_hal_ops/syn/xgmac/syn_if.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/hal/edma/edma_data_plane.c
+++ b/hal/edma/edma_data_plane.c
@@ -797,7 +797,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_hal_ops/qcom/qcom_if.c
+++ b/hal/gmac_hal_ops/qcom/qcom_if.c
@@ -400,7 +400,7 @@ static void *qcom_init(struct gmac_hal_p
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_hal_ops/syn/xgmac/syn_if.c
+++ b/hal/gmac_hal_ops/syn/xgmac/syn_if.c
@@ -422,7 +422,7 @@ static void *syn_init(struct gmac_hal_pl
/* 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

@ -0,0 +1,31 @@
From d74920e2a7c413ef40eed72f9cf287cf6fbd5fb8 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
There is a bug in the NAPI packet counting that will
cause NAPI over budget warnings.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/edma/edma_tx_rx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/hal/edma/edma_tx_rx.c
+++ b/hal/edma/edma_tx_rx.c
@@ -458,12 +458,12 @@ int edma_napi(struct napi_struct *napi,
for (i = 0; i < ehw->txcmpl_rings; i++) {
txcmpl_ring = &ehw->txcmpl_ring[i];
- work_done += edma_clean_tx(ehw, txcmpl_ring);
+ edma_clean_tx(ehw, txcmpl_ring);
}
for (i = 0; i < ehw->rxfill_rings; i++) {
rxfill_ring = &ehw->rxfill_ring[i];
- work_done += edma_alloc_rx_buffer(ehw, rxfill_ring);
+ edma_alloc_rx_buffer(ehw, rxfill_ring);
}
/*

View file

@ -0,0 +1,41 @@
From 44a30d94abcbb10aacc21db29be212518a6b1bf7 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
Currently a weight of 100 is used by the EDMA, according
to upstream max of 64 should be used and that is used for
almost any driver.
They also introduced NAPI_POLL_WEIGHT define which equals
to 64.
So use NAPI_POLL_WEIGHT as the weight.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/edma/edma_data_plane.c | 2 +-
hal/edma/edma_data_plane.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
--- a/hal/edma/edma_data_plane.c
+++ b/hal/edma/edma_data_plane.c
@@ -582,7 +582,7 @@ static int edma_register_netdevice(struc
*/
if (!edma_hw.napi_added) {
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
- EDMA_NAPI_WORK);
+ NAPI_POLL_WEIGHT);
/*
* Register the interrupt handlers and enable interrupts
*/
--- a/hal/edma/edma_data_plane.h
+++ b/hal/edma/edma_data_plane.h
@@ -27,7 +27,6 @@
#define EDMA_RX_PREHDR_SIZE (sizeof(struct edma_rx_preheader))
#define EDMA_TX_PREHDR_SIZE (sizeof(struct edma_tx_preheader))
#define EDMA_RING_SIZE 128
-#define EDMA_NAPI_WORK 100
#define EDMA_START_GMACS NSS_DP_START_IFNUM
#define EDMA_MAX_GMACS NSS_DP_HAL_MAX_PORTS
#define EDMA_TX_PKT_MIN_SIZE 33 /* IPQ807x EDMA needs a minimum packet size of 33 bytes */

View file

@ -0,0 +1,50 @@
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(-)
diff --git a/nss_dp_main.c b/nss_dp_main.c
index 5580b13..28df280 100644
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -434,9 +434,10 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np,
struct net_device *netdev,
struct 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);
@@ -475,14 +476,8 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np,
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);
--
2.31.1