From 83c2394ea1d9935e769c581a1a0d0c90740ed663 Mon Sep 17 00:00:00 2001 From: Hugo Yuan <429632952@163.com> Date: Thu, 11 Aug 2022 19:31:22 +0800 Subject: [PATCH] mac80211: fix compile error (#9917) --- .../brcm/999-backport-to-linux-5.18.patch | 69 ++++++++++++------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/package/kernel/mac80211/patches/brcm/999-backport-to-linux-5.18.patch b/package/kernel/mac80211/patches/brcm/999-backport-to-linux-5.18.patch index 8e1a7438a..4187db38f 100644 --- a/package/kernel/mac80211/patches/brcm/999-backport-to-linux-5.18.patch +++ b/package/kernel/mac80211/patches/brcm/999-backport-to-linux-5.18.patch @@ -2,50 +2,58 @@ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/n index 44a11b0..178e692 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -244,7 +244,7 @@ static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr) +@@ -245,7 +245,11 @@ } else { brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); -- memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); ++#else + eth_hw_addr_set(ifp->ndev, ifp->mac_addr); ++#endif } return err; } -@@ -423,6 +423,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq) +@@ -424,6 +428,7 @@ ifp->ndev->stats.rx_packets++; - + brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol)); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) if (inirq) { netif_rx(skb); } else { -@@ -432,6 +433,10 @@ void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq) +@@ -433,6 +438,9 @@ */ netif_rx_ni(skb); } +#else + netif_rx(skb); +#endif -+ } - + void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb) -@@ -672,7 +677,7 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool locked) +@@ -673,7 +681,11 @@ ndev->ethtool_ops = &brcmf_ethtool_ops; - + /* set the mac address & netns */ -- memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); +++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); ++#else + eth_hw_addr_set(ifp->ndev, ifp->mac_addr); ++#endif dev_net_set(ndev, wiphy_net(cfg_to_wiphy(drvr->config))); - + INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list); -@@ -847,7 +852,7 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp) +@@ -848,7 +860,11 @@ ndev->netdev_ops = &brcmf_netdev_ops_p2p; - + /* set the mac address */ -- memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); ++#else + eth_hw_addr_set(ndev, ifp->mac_addr); - ++#endif + if (register_netdev(ndev) != 0) { bphy_err(drvr, "couldn't register the p2p net device\n"); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c @@ -100,26 +108,35 @@ diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 57aa863..f5ebb5a 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -1272,9 +1272,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) +@@ -1274,9 +1274,13 @@ * this interface, if it has the special null one. */ if (dev && is_zero_ether_addr(dev->dev_addr)) { -- memcpy(dev->dev_addr, -- local->hw.wiphy->perm_addr, -- ETH_ALEN); -+ eth_hw_addr_set(dev, local->hw.wiphy->perm_addr); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(dev->dev_addr, + local->hw.wiphy->perm_addr, + ETH_ALEN); ++#else ++ eth_hw_addr_set(ndev, params->macaddr); ++#endif memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); - + if (!is_valid_ether_addr(dev->dev_addr)) { -@@ -2134,9 +2132,9 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, - +@@ -2136,9 +2140,17 @@ + ieee80211_assign_perm_addr(local, ndev->perm_addr, type); if (is_valid_ether_addr(params->macaddr)) -- memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN); ++#else + eth_hw_addr_set(ndev, params->macaddr); ++#endif else -- memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); ++#else + eth_hw_addr_set(ndev, ndev->perm_addr); ++#endif SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); - + /* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */