brcmfmac: cfg80211 callbacks and coredump
cover brcmfmac: cfg80211 callbacks and coredump
This series provides following:
* using netdev carrier state.
* add and rework some cfg80211 callbacks mainly for AP mode.
* use devcoredump when triggered by firmware event.
The series is intended for 4.4 kernel and applies to the master branch of wireless-drivers-next repository.
Arend van Spriel (2):
brcmfmac: expose device memory to devcoredump subsystem
brcmfmac: remove conversational comment
Franky Lin (1):
brcmfmac: rename firmware_path to alternative_fw_path
Hante Meuleman (8):
brcmfmac: Fix race condition between USB probe/load and disconnect.
brcmfmac: Rework p2p attach, use single method for p2p dev creation.
brcmfmac: Fix station info rate information.
brcmfmac: Add RSSI information to get_station.
brcmfmac: Add dump_station support to cfg80221 ops.
brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct file.
brcmfmac: Remove unused state AP creating.
brcmfmac: Properly set carrier state of netdev.
drivers/net/wireless/brcm80211/Kconfig | 1 + drivers/net/wireless/brcm80211/brcmfmac/bus.h | 21 ++++++ drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 86 ++++++++++++++++++++-- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h | 3 +- drivers/net/wireless/brcm80211/brcmfmac/common.h | 3 + drivers/net/wireless/brcm80211/brcmfmac/core.c | 65 ++++++++-------- drivers/net/wireless/brcm80211/brcmfmac/core.h | 11 +-- drivers/net/wireless/brcm80211/brcmfmac/debug.c | 42 ++++++++++- drivers/net/wireless/brcm80211/brcmfmac/debug.h | 8 +- drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 2 +- drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 3 +- drivers/net/wireless/brcm80211/brcmfmac/fwil.h | 1 + .../net/wireless/brcm80211/brcmfmac/fwil_types.h | 13 ++++ drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 3 - drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 71 +++--------------- drivers/net/wireless/brcm80211/brcmfmac/pcie.c | 65 ++++++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 49 +++++++++++- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 29 +++++++- 18 files changed, 355 insertions(+), 121 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/11 brcmfmac: expose device memory to devcoredump subsystem
Upon PSM watchdog event received from firmware the driver will obtain a memory snapshot of the device and expose it to user-space through the devcoredump framework. This will trigger a uevent.
--- drivers/net/wireless/brcm80211/Kconfig | 1 + drivers/net/wireless/brcm80211/brcmfmac/bus.h | 21 ++++++++ drivers/net/wireless/brcm80211/brcmfmac/core.c | 6 +-- drivers/net/wireless/brcm80211/brcmfmac/debug.c | 42 ++++++++++++++-- drivers/net/wireless/brcm80211/brcmfmac/debug.h | 8 +-- drivers/net/wireless/brcm80211/brcmfmac/pcie.c | 65 +++++++++++++++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/sdio.c | 49 ++++++++++++++++++- 7 files changed, 181 insertions(+), 11 deletions(-)
drivers/net/wireless/brcm80211/Kconfig +1 -0
@@ -82,5 +82,6 @@ config BRCM_TRACING config BRCMDBG bool "Broadcom driver debug functions" depends on BRCMSMAC || BRCMFMAC + select WANT_DEV_COREDUMP ---help--- Selecting this enables additional code for debug purposes.
drivers/net/wireless/brcm80211/brcmfmac/bus.h +21 -0
@@ -65,6 +65,8 @@ struct brcmf_bus_dcmd {* @rxctl: receive a control response message from dongle. * @gettxq: obtain a reference of bus transmit queue (optional). * @wowl_config: specify if dongle is configured for wowl when going to suspend +* @get_ramsize: obtain size of device memory. +* @get_memdump: obtain device memory dump in provided buffer. * * This structure provides an abstract interface towards the * bus specific driver. For control messages to common driver
@@ -79,6 +81,8 @@ struct brcmf_bus_ops {int (*rxctl)(struct device *dev,unsigned char *msg,uint len);struct pktq * (*gettxq)(struct device *dev);void (*wowl_config)(struct device *dev,bool enabled); +size_t (*get_ramsize)(struct device *dev); +int (*get_memdump)(struct device *dev,void *data,size_t len); };
@@ -185,6 +189,23 @@ void brcmf_bus_wowl_config(struct brcmf_bus *bus, bool enabled) bus->ops->wowl_config (bus->dev, enabled); } +static inline size_t brcmf_bus_get_ramsize (struct brcmf_bus *bus) +{ +if (!bus->ops->get_ramsize) +return 0 ; + +return bus->ops->get_ramsize (bus->dev); +} + +static inline +int brcmf_bus_get_memdump (struct brcmf_bus *bus,void *data,size_t len) +{ +if (!bus->ops->get_memdump) +return -EOPNOTSUPP ; + +return bus->ops->get_memdump (bus->dev, data, len); +} +/* * interface functions from common layer */
drivers/net/wireless/brcm80211/brcmfmac/core.c +3 -3
@@ -957,8 +957,8 @@ int brcmf_attach(struct device *dev) drvr->bus_if =dev_get_drvdata (dev); drvr->bus_if->drvr = drvr; -/* create device debugfs folder */ -brcmf_debugfs_attach (drvr); +/* attach debug facilities */ +brcmf_debug_attach (drvr);/* Attach and link in the protocol */ ret =brcmf_proto_attach (drvr);
@@ -1155,7 +1155,7 @@ void brcmf_detach(struct device *dev)brcmf_proto_detach (drvr); -brcmf_debugfs_detach (drvr); +brcmf_debug_detach (drvr); bus_if->drvr =NULL ;kfree (drvr); }
drivers/net/wireless/brcm80211/brcmfmac/debug.c +39 -3
73 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/debug.h +4 -4
@@ -109,8 +109,8 @@ struct brcmf_pub;#ifdef DEBUG void brcmf_debugfs_init (void );void brcmf_debugfs_exit (void ); -int brcmf_debugfs_attach (struct brcmf_pub *drvr); -void brcmf_debugfs_detach (struct brcmf_pub *drvr); +int brcmf_debug_attach (struct brcmf_pub *drvr); +void brcmf_debug_detach (struct brcmf_pub *drvr);struct dentry *brcmf_debugfs_get_devdir (struct brcmf_pub *drvr);int brcmf_debugfs_add_entry (struct brcmf_pub *drvr,const char *fn,int (*read_fn)(struct seq_file *seq,void *data));
@@ -121,11 +121,11 @@ static inline void brcmf_debugfs_init(void)static inline void brcmf_debugfs_exit (void ) { } -static inline int brcmf_debugfs_attach (struct brcmf_pub *drvr) +static inline int brcmf_debug_attach (struct brcmf_pub *drvr) {return 0 ; } -static inline void brcmf_debugfs_detach (struct brcmf_pub *drvr) +static inline void brcmf_debug_detach (struct brcmf_pub *drvr) { } static inline
drivers/net/wireless/brcm80211/brcmfmac/pcie.c +65 -0
83 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/sdio.c +48 -1
61 lines not on this page · raw message
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
Hi Arend,
[auto build test ERROR on next-20151008 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All errors (new ones prefixed by >>):
drivers/net/wireless/brcm80211/brcmfmac/debug.c:58:6: error: redefinition of 'brcmf_debugfs_init'
void brcmf_debugfs_init(void)
^
In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:118:20: note: previous definition of 'brcmf_debugfs_init' was here
static inline void brcmf_debugfs_init(void)
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c:65:6: error: redefinition of 'brcmf_debugfs_exit'
void brcmf_debugfs_exit(void)
^
In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:121:20: note: previous definition of 'brcmf_debugfs_exit' was here
static inline void brcmf_debugfs_exit(void)
^
>> drivers/net/wireless/brcm80211/brcmfmac/debug.c:74:5: error: redefinition of 'brcmf_debug_attach'
int brcmf_debug_attach(struct brcmf_pub *drvr)
^
In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:124:19: note: previous definition of 'brcmf_debug_attach' was here
static inline int brcmf_debug_attach(struct brcmf_pub *drvr)
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: In function 'brcmf_debug_attach':
drivers/net/wireless/brcm80211/brcmfmac/debug.c:81:6: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c:82:17: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
if (IS_ERR(drvr->dbgfs_dir))
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c:83:22: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
return PTR_ERR(drvr->dbgfs_dir);
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: At top level:
>> drivers/net/wireless/brcm80211/brcmfmac/debug.c:90:6: error: redefinition of 'brcmf_debug_detach'
void brcmf_debug_detach(struct brcmf_pub *drvr)
^
In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:128:20: note: previous definition of 'brcmf_debug_detach' was here
static inline void brcmf_debug_detach(struct brcmf_pub *drvr)
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: In function 'brcmf_debug_detach':
drivers/net/wireless/brcm80211/brcmfmac/debug.c:94:26: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
if (!IS_ERR_OR_NULL(drvr->dbgfs_dir))
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c:95:32: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
debugfs_remove_recursive(drvr->dbgfs_dir);
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: In function 'brcmf_debugfs_get_devdir':
drivers/net/wireless/brcm80211/brcmfmac/debug.c:100:13: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
return drvr->dbgfs_dir;
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: At top level:
drivers/net/wireless/brcm80211/brcmfmac/debug.c:103:5: error: redefinition of 'brcmf_debugfs_add_entry'
int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
^
In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:132:5: note: previous definition of 'brcmf_debugfs_add_entry' was here
int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: In function 'brcmf_debugfs_add_entry':
drivers/net/wireless/brcm80211/brcmfmac/debug.c:109:10: error: 'struct brcmf_pub' has no member named 'dbgfs_dir'
drvr->dbgfs_dir, read_fn);
^
drivers/net/wireless/brcm80211/brcmfmac/debug.c: In function 'brcmf_debugfs_get_devdir':
drivers/net/wireless/brcm80211/brcmfmac/debug.c:101:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^vim +/brcmf_debug_attach +74 drivers/net/wireless/brcm80211/brcmfmac/debug.c
59 {
60 root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
61 if (IS_ERR(root_folder))
62 root_folder = NULL;
63 }
64
> 65 void brcmf_debugfs_exit(void)
66 {
67 if (!root_folder)
68 return;
69
70 debugfs_remove_recursive(root_folder);
71 root_folder = NULL;
72 }
73
> 74 int brcmf_debug_attach(struct brcmf_pub *drvr)
75 {
76 struct device *dev = drvr->bus_if->dev;
77
78 if (!root_folder)
79 return -ENODEV;
80
81 drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
> 82 if (IS_ERR(drvr->dbgfs_dir))
83 return PTR_ERR(drvr->dbgfs_dir);
84
85
86 return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
87 brcmf_debug_psm_watchdog_notify);
88 }
89
> 90 void brcmf_debug_detach(struct brcmf_pub *drvr)
91 {
92 brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG);
93 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
Quoted 11 lines · kbuild test robot
Hi Arend,
[auto build test ERROR on next-20151008 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
# save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
Quoted 8 lines
drivers/net/wireless/brcm80211/brcmfmac/debug.c:58:6: error: redefinition of 'brcmf_debugfs_init'void brcmf_debugfs_init(void) ^ In file included from drivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0, from drivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:118:20: note: previous definition of 'brcmf_debugfs_init' was here
static inline voidbrcmf_debugfs_init(void)
^
Arend, are the kbuild errors valid? I would guess they are as wireless-drivers-next should be in linux-next.
Signature · 1 line
Kalle Valo
Re: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
Quoted 22 lines · Kalle Valo
Quoted 11 lines · kbuild test robot
Hi Arend,
[auto build test ERROR on next-20151008 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
# save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
Quoted 8 lines
drivers/net/wireless/brcm80211/brcmfmac/debug.c:58:6: error: redefinition of 'brcmf_debugfs_init'
voidbrcmf_debugfs_init(void)
^
In file included fromdrivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
fromdrivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:118:20: note: previous definition of 'brcmf_debugfs_init' was here
static inline voidbrcmf_debugfs_init(void)
^
Quoted 2 lines
Arend, are the kbuild errors valid? I would guess they are as wireless-drivers-next should be in linux-next.
Hi Kalle,
Actually they are not. I am not sure about the build infrastructure, but the errors above can only occur when CONFIG_BRCMDBG is set, but DEBUG is not. However, that can not happen as we have following line in drivers/net/wireless/brcm80211/Makefile:
subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
Regards,
Arend
Re: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
Quoted 26 lines · Arend van Spriel
Quoted 22 lines · Kalle Valo
Quoted 11 lines · kbuild test robot
Hi Arend,
[auto build test ERROR on next-20151008 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
# save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
Quoted 8 lines
drivers/net/wireless/brcm80211/brcmfmac/debug.c:58:6: error: redefinition of 'brcmf_debugfs_init'
voidbrcmf_debugfs_init(void)
^
In file included fromdrivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
fromdrivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:118:20: note: previous definition of 'brcmf_debugfs_init' was here
static inline voidbrcmf_debugfs_init(void)
^Quoted 2 lines
Arend, are the kbuild errors valid? I would guess they are as wireless-drivers-next should be in linux-next.
Quoted 6 lines
Actually they are not. I am not sure about the build infrastructure, but the errors above can only occur when
CONFIG_BRCMDBGis set, but DEBUG is not. However, that can not happen as we have following line indrivers/net/wireless/brcm80211/Makefile:subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
I didn't check the details but I'm still not convinced :) In my opinion the code should always compile, with and without -DDEBUG. Anyways, I pushed this script to the pending branch to get kbuild test this patch once again.
Signature · 1 line
Kalle Valo
Re: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
Quoted 33 lines · Kalle Valo
Quoted 31 lines · Arend van Spriel
Quoted 22 lines · Kalle Valo
Quoted 11 lines · kbuild test robot
Hi Arend,
[auto build test ERROR on next-20151008 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x011-201540 (attached as .config) reproduce:
# save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
Quoted 8 lines
drivers/net/wireless/brcm80211/brcmfmac/debug.c:58:6: error: redefinition of 'brcmf_debugfs_init'
voidbrcmf_debugfs_init(void)
^
In file included fromdrivers/net/wireless/brcm80211/brcmfmac/bus.h:20:0,
fromdrivers/net/wireless/brcm80211/brcmfmac/debug.c:24:
drivers/net/wireless/brcm80211/brcmfmac/debug.h:118:20: note: previous definition of 'brcmf_debugfs_init' was here
static inline voidbrcmf_debugfs_init(void)
^Quoted 2 lines
Arend, are the kbuild errors valid? I would guess they are as wireless-drivers-next should be in linux-next.
Actually they are not. I am not sure about the build infrastructure, but the errors above can only occur when
CONFIG_BRCMDBGis set, but DEBUG is not. However, that can not happen as we have following line indrivers/net/wireless/brcm80211/Makefile:
Quoted 6 lines
Quoted 1 line
subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
I didn't check the details but I'm still not convinced :) In my opinion the code should always compile, with and without -DDEBUG. Anyways, I pushed this script to the pending branch to get kbuild test this patch once again.
Ok, Kalle
Let me try to be a bit more convincing ;-)
I checked out linux-next/master, taken the provided .config and ran:
$ make prepare $ make M=scripts $ make M=drivers/net/wireless/brcm80211
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
CC drivers/net/wireless/brcm80211/brcmfmac/cfg80211.o CC drivers/net/wireless/brcm80211/brcmfmac/chip.o CC drivers/net/wireless/brcm80211/brcmfmac/fwil.o CC drivers/net/wireless/brcm80211/brcmfmac/fweh.o CC drivers/net/wireless/brcm80211/brcmfmac/fwsignal.o CC drivers/net/wireless/brcm80211/brcmfmac/p2p.o CC drivers/net/wireless/brcm80211/brcmfmac/proto.o CC drivers/net/wireless/brcm80211/brcmfmac/common.o CC drivers/net/wireless/brcm80211/brcmfmac/core.o CC drivers/net/wireless/brcm80211/brcmfmac/firmware.o CC drivers/net/wireless/brcm80211/brcmfmac/feature.o CC drivers/net/wireless/brcm80211/brcmfmac/btcoex.o CC drivers/net/wireless/brcm80211/brcmfmac/vendor.o CC drivers/net/wireless/brcm80211/brcmfmac/bcdc.o CC drivers/net/wireless/brcm80211/brcmfmac/sdio.o CC drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.o CC drivers/net/wireless/brcm80211/brcmfmac/debug.o CC drivers/net/wireless/brcm80211/brcmfmac/tracepoint.o CC drivers/net/wireless/brcm80211/brcmfmac/of.o LD drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.o LD drivers/net/wireless/brcm80211/brcmfmac/built-in.o CC drivers/net/wireless/brcm80211/brcmutil/utils.o CC drivers/net/wireless/brcm80211/brcmutil/d11.o LD drivers/net/wireless/brcm80211/brcmutil/brcmutil.o LD drivers/net/wireless/brcm80211/brcmutil/built-in.o LD drivers/net/wireless/brcm80211/built-in.o
Building modules, stage 2.
MODPOST 0 modules
No compile issues.
Regards,
Arend
Re: [PATCH 01/11] brcmfmac: expose device memory to devcoredump subsystem
Quoted 22 lines · Arend van Spriel
Quoted 12 lines · Kalle Valo
Quoted 10 lines · Arend van Spriel
Quoted 2 lines · Kalle Valo
Arend, are the kbuild errors valid? I would guess they are as wireless-drivers-next should be in linux-next.
Actually they are not. I am not sure about the build infrastructure, but the errors above can only occur when
CONFIG_BRCMDBGis set, but DEBUG is not. However, that can not happen as we have following line indrivers/net/wireless/brcm80211/Makefile:Quoted 6 lines
Quoted 1 line
subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
I didn't check the details but I'm still not convinced :) In my opinion the code should always compile, with and without -DDEBUG. Anyways, I pushed this script to the pending branch to get kbuild test this patch once again.
Ok, Kalle
Quoted 7 lines
Let me try to be a bit more convincing ;-)
I checked out linux-next/master, taken the provided .config and ran:
$ make prepare $ make M=scripts $ make M=drivers/net/wireless/brcm80211
Thanks, I'm convinced now :) But the kbuild found this warning (I guess you also got an email about that):
drivers/net/wireless/brcm80211/brcmfmac/sdio.c:3562:2: warning: format '%zu' expects argument of type 'size_t', but argument 5 has type 'unsigned int' [-Wformat=]
Can you fix that and respin, please?
Signature · 1 line
Kalle Valo
Re: [01/11] brcmfmac: expose device memory to devcoredump subsystem
In reply to Arend van SprielQuoted 9 lines
Upon PSM watchdog event received from firmware the driver will obtain a memory snapshot of the device and expose it to user-space through the devcoredump framework. This will trigger a uevent.
Reviewed-by Hante Meuleman <[email protected]>Reviewed-by Franky (Zhenhui) Lin <[email protected]>Reviewed-by Pieter-Paul Giesberts <[email protected]>Signed-off-by Arend van Spriel <[email protected]>
Thanks, 11 patches applied to wireless-drivers-next.git:
ff4445a8502c brcmfmac: expose device memory to devcoredump subsystem 185f0eb0b5fa brcmfmac: Fix race condition between USB probe/load and disconnect. 4a3462843f9f brcmfmac: rename firmware_path to alternative_fw_path 43569bfaf6ed brcmfmac: remove conversational comment2b76acdbc043 brcmfmac: Rework p2p attach, use single method for p2p dev creation. 124d517211e4 brcmfmac: Fix station info rate information. cae355dc90db brcmfmac: Add RSSI information to get_station. bf2a7e0499b9 brcmfmac: Add dump_station support to cfg80221 ops. c443e169577c brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct file. 54b499d9ad10 brcmfmac: Remove unused state AP creating.92121e69de8a brcmfmac: Properly set carrier state of netdev.
Kalle Valo
PATCH 2/11 brcmfmac: Fix race condition between USB probe/load and disconnect.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
When a USB device gets disconnected due to for example removal then it is possible that it is still in the loading phase due to the asynchronous load routines. These routines can then possible access memory which has been freed. Fix this by mutex locking the device init phase.
--- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/usb.c +26 -3
@@ -144,6 +144,7 @@ struct brcmf_usbdev_info {struct usb_device *usbdev;struct device *dev; +struct mutex dev_init_lock;int ctl_in_pipe, ctl_out_pipe;struct urb *ctl_urb;/* URB for control endpoint */
@@ -1204,6 +1205,8 @@ static void brcmf_usb_probe_phase2(struct device *dev,int ret;brcmf_dbg (USB ,"Start fw downloading\n" ); + + devinfo = bus->bus_priv.usb->devinfo; ret =check_file (fw->data);if (ret <0 ) {brcmf_err ("invalid firmware\n" );
@@ -1211,7 +1214,6 @@ static void brcmf_usb_probe_phase2(struct device *dev, goto error; } - devinfo = bus->bus_priv.usb->devinfo; devinfo->image = fw->data; devinfo->image_len = fw->size;
@@ -1224,9 +1226,11 @@ static void brcmf_usb_probe_phase2(struct device *dev,if (ret) goto error; +mutex_unlock (&devinfo->dev_init_lock);return ; error:brcmf_dbg (TRACE ,"failed: dev=%s, err=%d\n" ,dev_name (dev), ret); +mutex_unlock (&devinfo->dev_init_lock);device_release_driver (dev); }
@@ -1264,6 +1268,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)if (ret) goto fail;/* we are done */ +mutex_unlock (&devinfo->dev_init_lock);return 0 ; } bus->chip = bus_pub->devid;
@@ -1317,6 +1322,12 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) devinfo->usbdev = usb; devinfo->dev = &usb->dev; +/* Take an init lock, to protect for disconnect while still loading. +* Necessary because of the asynchronous firmware load construction +*/ +mutex_init (&devinfo->dev_init_lock); +mutex_lock (&devinfo->dev_init_lock); +usb_set_intfdata (intf, devinfo);/* Check that the device supports only one configuration */
@@ -1391,6 +1402,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)return 0 ; fail: +mutex_unlock (&devinfo->dev_init_lock);kfree (devinfo);usb_set_intfdata (intf,NULL );return ret;
@@ -1403,8 +1415,19 @@ brcmf_usb_disconnect(struct usb_interface *intf)brcmf_dbg (USB ,"Enter\n" ); devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata (intf); -brcmf_usb_disconnect_cb (devinfo); -kfree (devinfo); + +if (devinfo) { +mutex_lock (&devinfo->dev_init_lock); +/* Make sure that devinfo still exists. Firmware probe routines +* may have released the device and cleared the intfdata. +*/ +if (!usb_get_intfdata (intf)) + goto done; + +brcmf_usb_disconnect_cb (devinfo); +kfree (devinfo); + } +done:brcmf_dbg (USB ,"Exit\n" ); }
Signature · 1 line
1.9.1
PATCH 3/11 brcmfmac: rename firmware_path to alternative_fw_path
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
In brcmfmac the module parameter "firmware_path" is used as an alternative relative path under the search path used by firmware_class or ueventhelper. Rename the parameter to alternative_fw_path to avoid confusion.
--- drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmfmac/firmware.c +1 -1
@@ -29,7 +29,7 @@#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10/* pcie/1/4/ + \0 */ char brcmf_firmware_path[BRCMF_FW_PATH_LEN ]; -module_param_string (firmware_path, brcmf_firmware_path, +module_param_string (alternative_fw_path, brcmf_firmware_path,BRCMF_FW_PATH_LEN ,0440 );enum nvram_parser_state {
Signature · 1 line
1.9.1
PATCH 4/11 brcmfmac: remove conversational comment
In reply to Arend van SprielRemoving a comment that was only useful during the review of the change that introduced it and which should never have been submitted.
--- drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c +0 -3
@@ -873,9 +873,6 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf) commonring = msgbuf->flowrings[flowid];atomic_dec (&commonring->outstanding_tx); -/* Hante: i believe this was a bug as tx_status->msg.ifidx was used -* in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny? -*/ brcmf_txfinalize (brcmf_get_ifp (msgbuf->drvr, tx_status->msg.ifidx), skb, true); }
Signature · 1 line
1.9.1
PATCH 5/11 brcmfmac: Rework p2p attach, use single method for p2p dev creation.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
When module param p2pon is used a p2p device is created at init. This patch reworks how this is done by using the same method as for a dynamically (by user space) created p2p device.
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 18 ++++++ drivers/net/wireless/brcm80211/brcmfmac/core.c | 33 ++++------ drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 3 +- drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 71 +++------------------- 4 files changed, 40 insertions(+), 85 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +18 -0
@@ -6238,6 +6238,17 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,else *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40 ; } +/* p2p might require that "if-events" get processed by fweh. So +* activate the already registered event handlers now and activate +* the rest when initialization has completed. drvr->config needs to +* be assigned before activating events. +*/ + drvr->config = cfg; + err =brcmf_fweh_activate_events (ifp); +if (err) { +brcmf_err ("FWEH activation failed (%d)\n" , err); + goto wiphy_unreg_out; + } err =brcmf_p2p_attach (cfg, p2pdev_forced);if (err) {
@@ -6260,6 +6271,13 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, brcmf_notify_tdls_peer_event); } +/* (re-) activate FWEH event handling */ + err =brcmf_fweh_activate_events (ifp); +if (err) { +brcmf_err ("FWEH activation failed (%d)\n" , err); + goto wiphy_unreg_out; + } +return cfg; wiphy_unreg_out:
drivers/net/wireless/brcm80211/brcmfmac/core.c +11 -22
@@ -828,8 +828,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, }else {brcmf_dbg (INFO ,"allocate netdev interface\n" );/* Allocate netdev, including space for private structure */ - ndev =alloc_netdev (sizeof (*ifp), name,NET_NAME_UNKNOWN , - ether_setup); + ndev =alloc_netdev (sizeof (*ifp), is_p2pdev ?"p2p%d" : name, +NET_NAME_UNKNOWN , ether_setup);if (!ndev)return ERR_PTR (-ENOMEM );
@@ -1021,12 +1021,7 @@ int brcmf_bus_start(struct device *dev)if (IS_ERR (ifp))return PTR_ERR (ifp); -if (brcmf_p2p_enable) - p2p_ifp =brcmf_add_if (drvr,1 ,0 , false,"p2p%d" ,NULL ); -else - p2p_ifp =NULL ; -if (IS_ERR (p2p_ifp)) - p2p_ifp =NULL ; + p2p_ifp =NULL ;/* signal bus ready */ brcmf_bus_change_state (bus_if,BRCMF_BUS_UP );
@@ -1060,11 +1055,13 @@ int brcmf_bus_start(struct device *dev) goto fail; } - ret =brcmf_fweh_activate_events (ifp); -if (ret <0 ) - goto fail; - ret =brcmf_net_attach (ifp, false); + +if ((!ret) && (brcmf_p2p_enable)) { + p2p_ifp = drvr->iflist[1 ]; +if (p2p_ifp) + ret =brcmf_net_p2p_attach (p2p_ifp); + } fail:if (ret <0 ) {brcmf_err ("failed: %d\n" , ret);
@@ -1076,20 +1073,12 @@ fail:brcmf_fws_del_interface (ifp);brcmf_fws_deinit (drvr); } -if (drvr->iflist[0 ]) { +if (ifp)brcmf_net_detach (ifp->ndev); - drvr->iflist[0 ] =NULL ; - } -if (p2p_ifp) { +if (p2p_ifp)brcmf_net_detach (p2p_ifp->ndev); - drvr->iflist[1 ] =NULL ; - }return ret; } -if ((brcmf_p2p_enable) && (p2p_ifp)) -if (brcmf_net_p2p_attach (p2p_ifp) <0 ) - brcmf_p2p_enable =0 ; -return 0 ; }
drivers/net/wireless/brcm80211/brcmfmac/fweh.c +2 -1
@@ -213,7 +213,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, is_p2pdev, emsg->ifname, emsg->addr);if (IS_ERR (ifp))return ; -brcmf_fws_add_interface (ifp); +if (!is_p2pdev) +brcmf_fws_add_interface (ifp);if (!drvr->fweh.evt_handler[BRCMF_E_IF ])if (brcmf_net_attach (ifp, false) <0 )return ;
drivers/net/wireless/brcm80211/brcmfmac/p2p.c +9 -62
92 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 6/11 brcmfmac: Fix station info rate information.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
Txrate and rxrate in get_station got assigned first with value in kbps and then divided by 100 to get it in 100kbps unit. The problem with that is that type of rate is u16 which resulted in incorrect values for high data rate values.
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +4 -4
@@ -2478,13 +2478,13 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, sinfo->rx_packets +=le32_to_cpu (sta_info_le.rx_mcast_pkts);if (sinfo->tx_packets) { sinfo->filled |=BIT (NL80211_STA_INFO_TX_BITRATE ); - sinfo->txrate.legacy =le32_to_cpu (sta_info_le.tx_rate); - sinfo->txrate.legacy /=100 ; + sinfo->txrate.legacy = +le32_to_cpu (sta_info_le.tx_rate) /100 ; }if (sinfo->rx_packets) { sinfo->filled |=BIT (NL80211_STA_INFO_RX_BITRATE ); - sinfo->rxrate.legacy =le32_to_cpu (sta_info_le.rx_rate); - sinfo->rxrate.legacy /=100 ; + sinfo->rxrate.legacy = +le32_to_cpu (sta_info_le.rx_rate) /100 ; }if (le16_to_cpu (sta_info_le.ver) >=4 ) { sinfo->filled |=BIT (NL80211_STA_INFO_TX_BYTES );
Signature · 1 line
1.9.1
PATCH 7/11 brcmfmac: Add RSSI information to get_station.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +23 -0
@@ -2432,6 +2432,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,struct brcmf_sta_info_le sta_info_le;u32 sta_flags;u32 is_tdls_peer; +s32 total_rssi; +s32 count_rssi; +u32 i;brcmf_dbg (TRACE ,"Enter, MAC %pM\n" , mac);if (!check_vif_up (ifp->vif))
@@ -2492,6 +2495,26 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, sinfo->filled |=BIT (NL80211_STA_INFO_RX_BYTES ); sinfo->rx_bytes =le64_to_cpu (sta_info_le.rx_tot_bytes); } + total_rssi =0 ; + count_rssi =0 ; +for (i =0 ; i <BRCMF_ANT_MAX ; i++) { +if (sta_info_le.rssi[i]) { + sinfo->chain_signal_avg[count_rssi] = + sta_info_le.rssi[i]; + sinfo->chain_signal[count_rssi] = + sta_info_le.rssi[i]; + total_rssi += sta_info_le.rssi[i]; + count_rssi++; + } + } +if (count_rssi) { + sinfo->filled |=BIT (NL80211_STA_INFO_CHAIN_SIGNAL ); + sinfo->chains = count_rssi; + + sinfo->filled |=BIT (NL80211_STA_INFO_SIGNAL ); + total_rssi /= count_rssi; + sinfo->signal = total_rssi; + } } done:brcmf_dbg (TRACE ,"Exit\n" );
Signature · 1 line
1.9.1
PATCH 8/11 brcmfmac: Add dump_station support to cfg80221 ops.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
With this feature it becomes possible to request a station assoc list.
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 30 ++++++++++++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h | 1 + drivers/net/wireless/brcm80211/brcmfmac/fwil.h | 1 + .../net/wireless/brcm80211/brcmfmac/fwil_types.h | 13 ++++++++++ 4 files changed, 45 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +30 -0
@@ -2521,6 +2521,35 @@ done:return err; } +static int +brcmf_cfg80211_dump_station (struct wiphy *wiphy,struct net_device *ndev, +int idx,u8 *mac,struct station_info *sinfo) +{ +struct brcmf_cfg80211_info *cfg =wiphy_to_cfg (wiphy); +struct brcmf_if *ifp =netdev_priv (ndev); +s32 err; + +brcmf_dbg (TRACE ,"Enter, idx %d\n" , idx); + +if (idx ==0 ) { + cfg->assoclist.count =cpu_to_le32 (BRCMF_MAX_ASSOCLIST ); + err =brcmf_fil_cmd_data_get (ifp,BRCMF_C_GET_ASSOCLIST , + &cfg->assoclist, +sizeof (cfg->assoclist)); +if (err) { +brcmf_err ("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n" , + err); + cfg->assoclist.count =0 ; +return -EOPNOTSUPP ; + } + } +if (idx <le32_to_cpu (cfg->assoclist.count)) { +memcpy (mac, cfg->assoclist.mac[idx],ETH_ALEN ); +return brcmf_cfg80211_get_station (wiphy, ndev, mac, sinfo); + } +return -ENOENT ; +} +static s32 brcmf_cfg80211_set_power_mgmt (struct wiphy *wiphy,struct net_device *ndev,bool enabled,s32 timeout)
@@ -4620,6 +4649,7 @@ static struct cfg80211_ops wl_cfg80211_ops = { .join_ibss = brcmf_cfg80211_join_ibss, .leave_ibss = brcmf_cfg80211_leave_ibss, .get_station = brcmf_cfg80211_get_station, + .dump_station = brcmf_cfg80211_dump_station, .set_tx_power = brcmf_cfg80211_set_tx_power, .get_tx_power = brcmf_cfg80211_get_tx_power, .add_key = brcmf_cfg80211_add_key,
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h +1 -0
@@ -407,6 +407,7 @@ struct brcmf_cfg80211_info {struct brcmu_d11inf d11inf;bool wowl_enabled;u32 pre_wowl_pmmode; +struct brcmf_assoclist_le assoclist; };/**
drivers/net/wireless/brcm80211/brcmfmac/fwil.h +1 -0
@@ -72,6 +72,7 @@#define BRCMF_C_GET_BSS_INFO 136#define BRCMF_C_GET_BANDLIST 140#define BRCMF_C_SET_SCB_TIMEOUT 158 +#define BRCMF_C_GET_ASSOCLIST 159#define BRCMF_C_GET_PHYLIST 180#define BRCMF_C_SET_SCAN_CHANNEL_TIME 185#define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +13 -0
@@ -119,6 +119,8 @@#define BRCMF_COUNTRY_BUF_SZ 4#define BRCMF_ANT_MAX 4 +#define BRCMF_MAX_ASSOCLIST 128 +/* join preference types for join_pref iovar */ enum brcmf_join_pref_types {BRCMF_JOIN_PREF_RSSI =1 ,
@@ -621,4 +623,15 @@ struct brcmf_rev_info_le { __le32 nvramrev; }; +/** +* struct brcmf_assoclist_le - request assoc list. +* +* @count: indicates number of stations. +* @mac: MAC addresses of stations. +*/ +struct brcmf_assoclist_le { +__le32 count; +u8 mac[BRCMF_MAX_ASSOCLIST ][ETH_ALEN ]; +}; +#endif /* FWIL_TYPES_H_ */
Signature · 1 line
1.9.1
PATCH 9/11 brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct file.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
--- drivers/net/wireless/brcm80211/brcmfmac/common.h | 3 +++ drivers/net/wireless/brcm80211/brcmfmac/core.c | 1 + drivers/net/wireless/brcm80211/brcmfmac/core.h | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/common.h +3 -0
@@ -17,4 +17,7 @@extern const u8 ALLFFMAC [ETH_ALEN ]; +/* Sets dongle media info (drv_version, mac address). */ +int brcmf_c_preinit_dcmds (struct brcmf_if *ifp); +#endif /* BRCMFMAC_COMMON_H */
drivers/net/wireless/brcm80211/brcmfmac/core.c +1 -0
@@ -33,6 +33,7 @@#include "feature.h" #include "proto.h" #include "pcie.h" +#include "common.h" MODULE_AUTHOR ("Broadcom Corporation" );MODULE_DESCRIPTION ("Broadcom 802.11 wireless LAN fullmac driver." );
drivers/net/wireless/brcm80211/brcmfmac/core.h +0 -3
@@ -214,7 +214,4 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp,void brcmf_txfinalize (struct brcmf_if *ifp,struct sk_buff *txp,bool success);void brcmf_netif_rx (struct brcmf_if *ifp,struct sk_buff *skb); -/* Sets dongle media info (drv_version, mac address). */ -int brcmf_c_preinit_dcmds (struct brcmf_if *ifp); -#endif /* BRCMFMAC_CORE_H */
Signature · 1 line
1.9.1
PATCH 10/11 brcmfmac: Remove unused state AP creating.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 3 --- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h | 2 -- 2 files changed, 5 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +0 -3
@@ -840,7 +840,6 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, err =brcmf_p2p_ifchange (cfg,BRCMF_FIL_P2P_IF_GO ); }if (!err) { -set_bit (BRCMF_VIF_STATUS_AP_CREATING , &vif->sme_state);brcmf_dbg (INFO ,"IF Type = AP\n" ); } }else {
@@ -4251,7 +4250,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,brcmf_dbg (TRACE ,"GO mode configuration complete\n" ); } -clear_bit (BRCMF_VIF_STATUS_AP_CREATING , &ifp->vif->sme_state);set_bit (BRCMF_VIF_STATUS_AP_CREATED , &ifp->vif->sme_state); exit:
@@ -4316,7 +4314,6 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) }brcmf_set_mpc (ifp,1 );brcmf_configure_arp_offload (ifp, true); -set_bit (BRCMF_VIF_STATUS_AP_CREATING , &ifp->vif->sme_state);clear_bit (BRCMF_VIF_STATUS_AP_CREATED , &ifp->vif->sme_state);return err;
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h +0 -2
@@ -143,7 +143,6 @@ struct brcmf_cfg80211_profile {* @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully. * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. -* @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation. * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. */ enum brcmf_vif_status {
@@ -151,7 +150,6 @@ enum brcmf_vif_status {BRCMF_VIF_STATUS_CONNECTING ,BRCMF_VIF_STATUS_CONNECTED ,BRCMF_VIF_STATUS_DISCONNECTING , -BRCMF_VIF_STATUS_AP_CREATING , BRCMF_VIF_STATUS_AP_CREATED };
Signature · 1 line
1.9.1
PATCH 11/11 brcmfmac: Properly set carrier state of netdev.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
Use the netif_carrier api to correctly set carrier state on the different modes.
--- drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 4 ++++ drivers/net/wireless/brcm80211/brcmfmac/core.c | 25 ++++++++++++++++++---- drivers/net/wireless/brcm80211/brcmfmac/core.h | 8 +++++-- 3 files changed, 31 insertions(+), 6 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c +4 -0
@@ -4251,6 +4251,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,brcmf_dbg (TRACE ,"GO mode configuration complete\n" ); }set_bit (BRCMF_VIF_STATUS_AP_CREATED , &ifp->vif->sme_state); +brcmf_net_setcarrier (ifp, true); exit:if ((err) && (!mbss)) {
@@ -4315,6 +4316,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)brcmf_set_mpc (ifp,1 );brcmf_configure_arp_offload (ifp, true);clear_bit (BRCMF_VIF_STATUS_AP_CREATED , &ifp->vif->sme_state); +brcmf_net_setcarrier (ifp, false);return err; }
@@ -5024,6 +5026,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, &ifp->vif->sme_state); }else brcmf_bss_connect_done (cfg, ndev, e, true); +brcmf_net_setcarrier (ifp, true); }else if (brcmf_is_linkdown (e)) {brcmf_dbg (CONN ,"Linkdown\n" );if (!brcmf_is_ibssmode (ifp->vif)) {
@@ -5033,6 +5036,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,brcmf_init_prof (ndev_to_prof (ndev));if (ndev !=cfg_to_ndev (cfg))complete (&cfg->vif_disabled); +brcmf_net_setcarrier (ifp, false); }else if (brcmf_is_nonetwork (cfg, e)) {if (brcmf_is_ibssmode (ifp->vif)) clear_bit(BRCMF_VIF_STATUS_CONNECTING,
drivers/net/wireless/brcm80211/brcmfmac/core.c +21 -4
@@ -635,8 +635,7 @@ static int brcmf_netdev_stop(struct net_device *ndev)brcmf_cfg80211_down (ndev); -/* Set state and stop OS transmissions */ -netif_stop_queue (ndev); +brcmf_net_setcarrier (ifp, false);return 0 ; }
@@ -670,8 +669,8 @@ static int brcmf_netdev_open(struct net_device *ndev)return -EIO ; } -/* Allow transmit calls */ -netif_start_queue (ndev); +/* Clear, carrier, set when connected or AP mode. */ +netif_carrier_off (ndev);return 0 ; }
@@ -736,6 +735,24 @@ static void brcmf_net_detach(struct net_device *ndev)brcmf_cfg80211_free_netdev (ndev); } +void brcmf_net_setcarrier (struct brcmf_if *ifp,bool on) +{ +struct net_device *ndev; + +brcmf_dbg (TRACE ,"Enter, idx=%d carrier=%d\n" , ifp->bssidx, on); + + ndev = ifp->ndev; +brcmf_txflowblock_if (ifp,BRCMF_NETIF_STOP_REASON_DISCONNECTED , !on); +if (on) { +if (!netif_carrier_ok (ndev)) +netif_carrier_on (ndev); + + }else { +if (netif_carrier_ok (ndev)) +netif_carrier_off (ndev); + } +} +static int brcmf_net_p2p_open (struct net_device *ndev) {brcmf_dbg (TRACE ,"Enter\n" );
drivers/net/wireless/brcm80211/brcmfmac/core.h +6 -2
@@ -154,10 +154,13 @@ struct brcmf_fws_mac_descriptor;* netif stopped due to firmware signalling flow control. * @BRCMF_NETIF_STOP_REASON_FLOW: * netif stopped due to flowring full. +* @BRCMF_NETIF_STOP_REASON_DISCONNECTED: +* netif stopped due to not being connected (STA mode). */ enum brcmf_netif_stop_reason { -BRCMF_NETIF_STOP_REASON_FWS_FC =1 , -BRCMF_NETIF_STOP_REASON_FLOW =2 +BRCMF_NETIF_STOP_REASON_FWS_FC =BIT (0 ), +BRCMF_NETIF_STOP_REASON_FLOW =BIT (1 ), +BRCMF_NETIF_STOP_REASON_DISCONNECTED =BIT (2 ) };/**
@@ -213,5 +216,6 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp, enum brcmf_netif_stop_reason reason, bool state);void brcmf_txfinalize (struct brcmf_if *ifp,struct sk_buff *txp,bool success);void brcmf_netif_rx (struct brcmf_if *ifp,struct sk_buff *skb); +void brcmf_net_setcarrier (struct brcmf_if *ifp,bool on);#endif /* BRCMFMAC_CORE_H */
Signature · 1 line
1.9.1