lede/package/kernel/mac80211/patches/brcm/999-backport-to-linux-5.18.patch
2022-11-09 19:40:00 +08:00

122 lines
4.0 KiB
Diff

--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -245,7 +245,11 @@ static int brcmf_netdev_set_mac_address(
} else {
brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
memcpy(ifp->mac_addr, sa->sa_data, 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;
}
@@ -424,6 +428,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp
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 {
@@ -433,6 +438,9 @@ void brcmf_netif_rx(struct brcmf_if *ifp
*/
netif_rx_ni(skb);
}
+#else
+ netif_rx(skb);
+#endif
}
void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb)
@@ -673,7 +681,11 @@ int brcmf_net_attach(struct brcmf_if *if
ndev->ethtool_ops = &brcmf_ethtool_ops;
/* set the mac address & netns */
+#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);
@@ -848,7 +860,11 @@ static int brcmf_net_p2p_attach(struct b
ndev->netdev_ops = &brcmf_netdev_ops_p2p;
/* set the mac address */
+#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");
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -2125,7 +2125,7 @@ static int brcmf_p2p_disable_p2p_if(stru
struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev);
struct net_device *pri_ndev = cfg_to_ndev(cfg);
struct brcmf_if *ifp = netdev_priv(pri_ndev);
- u8 *addr = vif->wdev.netdev->dev_addr;
+ const u8 *addr = vif->wdev.netdev->dev_addr;
return brcmf_fil_iovar_data_set(ifp, "p2p_ifdis", addr, ETH_ALEN);
}
@@ -2135,7 +2135,7 @@ static int brcmf_p2p_release_p2p_if(stru
struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev);
struct net_device *pri_ndev = cfg_to_ndev(cfg);
struct brcmf_if *ifp = netdev_priv(pri_ndev);
- u8 *addr = vif->wdev.netdev->dev_addr;
+ const u8 *addr = vif->wdev.netdev->dev_addr;
return brcmf_fil_iovar_data_set(ifp, "p2p_ifdel", addr, ETH_ALEN);
}
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5555,7 +5555,7 @@ struct wireless_dev {
unsigned long unprot_beacon_reported;
};
-static inline u8 *wdev_address(struct wireless_dev *wdev)
+static inline const u8 *wdev_address(struct wireless_dev *wdev)
{
if (wdev->netdev)
return wdev->netdev->dev_addr;
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1274,9 +1274,13 @@ int ieee80211_do_open(struct wireless_de
* this interface, if it has the special null one.
*/
if (dev && is_zero_ether_addr(dev->dev_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(dev, local->hw.wiphy->perm_addr);
+#endif
memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -2136,9 +2140,17 @@ int ieee80211_if_add(struct ieee80211_lo
ieee80211_assign_perm_addr(local, ndev->perm_addr, type);
if (is_valid_ether_addr(params->macaddr))
+#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
+#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 */