From b5ec750ebb138b730871a07b95700030539e8d26 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 22 Mar 2023 10:39:41 +0000 Subject: [PATCH] marvell: oak: Fix build for Linux v5.14 The functions eth_hw_addr_set() and dev_addr_mod() do not exist for Linux v5.14 and so compiling the marvell oak driver fails for Linux v5.14. Fix this by calling memcpy() instead of eth_hw_addr_set() and dev_addr_mod() for Linux v5.14. Note that both eth_hw_addr_set() and dev_addr_mod() internally call memcpy() and so this is equivalent. Bug 3820317 Change-Id: I4b49e031383adf62a55f1d01e8de2fcc0ad47862 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2875022 Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/net/ethernet/marvell/oak/oak.c | 6 ++++++ drivers/net/ethernet/marvell/oak/oak_net.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/oak/oak.c b/drivers/net/ethernet/marvell/oak/oak.c index 09c4bfaf..d5378c47 100644 --- a/drivers/net/ethernet/marvell/oak/oak.c +++ b/drivers/net/ethernet/marvell/oak/oak.c @@ -12,6 +12,8 @@ * disclaimer. * */ +#include + #include "oak.h" /* private function prototypes */ @@ -646,7 +648,11 @@ static void oak_read_set_mac_address(struct pci_dev *pdev) if (rc != 0) { pr_info("Device MAC address : %pM\n", device_mac); ether_addr_copy(np->mac_address, nic_mac); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) eth_hw_addr_set(netdev, nic_mac); +#else + memcpy(netdev->dev_addr, nic_mac, ETH_ALEN); +#endif pr_info("MAC address of NIC : %pM\n", nic_mac); } } diff --git a/drivers/net/ethernet/marvell/oak/oak_net.c b/drivers/net/ethernet/marvell/oak/oak_net.c index 5d58b21d..4c637c75 100644 --- a/drivers/net/ethernet/marvell/oak/oak_net.c +++ b/drivers/net/ethernet/marvell/oak/oak_net.c @@ -12,6 +12,8 @@ * disclaimer. * */ +#include + #include "oak_net.h" #include "oak_ethtool.h" #include "oak_chksum.h" @@ -630,8 +632,11 @@ int oak_net_set_mac_addr(struct net_device *dev, void *p_addr) if (rc == 0) { rc = -EINVAL; } else { - //memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) dev_addr_mod(dev, 0, addr->sa_data, ETH_ALEN); +#else + memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); +#endif /* When an interface come up we need to remember the * MAC address of an interface. Because the same MAC