openwrt/package/kernel/qca-nss-dp/patches/0006-NSS-DP-fix-of_get_mac_address.patch
Robert Marko 2558e7b443 kernel: add Qualcomm NSS dataplane ethernet driver
Qualcomm NSS-DP is as its name says Qualcomms ethernet driver for the NSS
subsystem (Networking subsystem) built-into various Qualcomm SoCs.

It has 2 modes of operation:
* Without NSS FW and rest of code required for offloading

This is the one that we will use as the amount of kernel patching required
for NSS offloading and the fact that its not upstreamable at all makes it
unusable for us.

Driver in this mode is rather basic, it currently only offers NAPI GRO
(Added by us as part of the fixup) and basically relies on the powerfull
CPU to get good throughput.

* With NSS FW and rest of code required for offloading

In this mode, driver just registers the interfaces and hooks them into
NSS-ECM to allow offloading.
This mode is not viable for use in OpenWrt due to reasons already described
above.

This driver is required for ipq807x to have wired networking until a better
one is available, so lets add the fixed-up version for 5.15 for now.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-01-16 12:42:23 +01:00

47 lines
1.4 KiB
Diff

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);