diff mbox series

brcmfmac: set interface carrier to off by default

Message ID 20191210113555.1868-1-zajec5@gmail.com (mailing list archive)
State Accepted
Commit 8d9627b05b2c33e4468e65739eb7caf9c3f274d8
Delegated to: Kalle Valo
Headers show
Series brcmfmac: set interface carrier to off by default | expand

Commit Message

Rafał Miłecki Dec. 10, 2019, 11:35 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

It's important as brcmfmac creates one main interface for each PHY and
doesn't allow deleting it. Not setting carrier could result in other
subsystems misbehaving (e.g. LEDs "netdev" trigger turning LED on).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
I noticed this problem when using "netdev" LED trigger with "wlan0" set
as "device_name". While my interface was down (unused) the "netdev"
trigger was checking it with netif_carrier_ok() and assuming it's up.

This solution affects initial state of all brcmfmac interfaces (not
only the first non-removable one) but I think it should be fine. Later
on brcmfmac takes care of updating carrier as needed.
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo Dec. 18, 2019, 7:05 p.m. UTC | #1
Rafał Miłecki wrote:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> It's important as brcmfmac creates one main interface for each PHY and
> doesn't allow deleting it. Not setting carrier could result in other
> subsystems misbehaving (e.g. LEDs "netdev" trigger turning LED on).
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

Patch applied to wireless-drivers-next.git, thanks.

8d9627b05b2c brcmfmac: set interface carrier to off by default
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 85cf96461dde..d3ddd97fe768 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -661,6 +661,8 @@  int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked)
 		goto fail;
 	}
 
+	netif_carrier_off(ndev);
+
 	ndev->priv_destructor = brcmf_cfg80211_free_netdev;
 	brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
 	return 0;