mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
mac80211: brcm: backport APIs to support kernel 5.18+
This commit is contained in:
parent
f6c1512c10
commit
f66ea169c0
@ -0,0 +1,125 @@
|
|||||||
|
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
|
||||||
|
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)
|
||||||
|
} 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);
|
||||||
|
+ eth_hw_addr_set(ifp->ndev, ifp->mac_addr);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
@@ -423,6 +423,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq)
|
||||||
|
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)
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
ndev->ethtool_ops = &brcmf_ethtool_ops;
|
||||||
|
|
||||||
|
/* set the mac address & netns */
|
||||||
|
- memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
|
||||||
|
+ eth_hw_addr_set(ifp->ndev, ifp->mac_addr);
|
||||||
|
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)
|
||||||
|
ndev->netdev_ops = &brcmf_netdev_ops_p2p;
|
||||||
|
|
||||||
|
/* set the mac address */
|
||||||
|
- memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
|
||||||
|
+ eth_hw_addr_set(ndev, ifp->mac_addr);
|
||||||
|
|
||||||
|
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
|
||||||
|
index 9ac0d8c..4735063 100644
|
||||||
|
--- 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(struct brcmf_cfg80211_vif *vif)
|
||||||
|
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(struct brcmf_cfg80211_vif *vif)
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||||
|
index 8effeb7..04362e2 100644
|
||||||
|
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||||
|
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
|
||||||
|
@@ -4165,7 +4165,7 @@ static int brcmf_sdio_bus_reset(struct device *dev)
|
||||||
|
|
||||||
|
/* reset the adapter */
|
||||||
|
sdio_claim_host(sdiodev->func1);
|
||||||
|
- mmc_hw_reset(sdiodev->func1->card->host);
|
||||||
|
+ mmc_hw_reset(sdiodev->func1->card);
|
||||||
|
sdio_release_host(sdiodev->func1);
|
||||||
|
|
||||||
|
brcmf_bus_change_state(sdiodev->bus_if, BRCMF_BUS_DOWN);
|
||||||
|
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
|
||||||
|
index ab83553..7941d28 100644
|
||||||
|
--- 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;
|
||||||
|
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)
|
||||||
|
* 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);
|
||||||
|
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,
|
||||||
|
|
||||||
|
ieee80211_assign_perm_addr(local, ndev->perm_addr, type);
|
||||||
|
if (is_valid_ether_addr(params->macaddr))
|
||||||
|
- memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN);
|
||||||
|
+ eth_hw_addr_set(ndev, params->macaddr);
|
||||||
|
else
|
||||||
|
- memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
|
||||||
|
+ eth_hw_addr_set(ndev, ndev->perm_addr);
|
||||||
|
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
|
||||||
|
|
||||||
|
/* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */
|
Loading…
Reference in New Issue
Block a user