2015-11-25 10:32:51

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 00/11] brcmfmac: beamforming support and cleanup

This series has the following highlights:

* beamforming support.
* unified handling of firmware files.
* 5G join preference.

The series is intended for 4.5 kernel and applies to wireless-drivers-next
on top of previous series with Message-ID:

<[email protected]>

Arend van Spriel (1):
brcmfmac: assure net_ratelimit() is declared before use

Franky Lin (1):
brcmfmac: no retries on rxglom superframe errors

Hante Meuleman (9):
brcmfmac: Cleanup ssid storage.
brcmfmac: Return actual error by fwil.
brcmfmac: Change error print on wlan0 existence.
brcmfmac: Remove redundant parameter action from scan.
brcmfmac: Cleanup roaming configuration.
brcmfmac: Add beamforming support.
brcmfmac: Make 5G join preference configurable.
brcmfmac: Unify methods to define and map firmware files.
brcmfmac: Fix double free on exception at module load.

.../broadcom/brcm80211/brcmfmac/cfg80211.c | 124 +++++++------
.../broadcom/brcm80211/brcmfmac/cfg80211.h | 10 +-
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 53 +++---
.../wireless/broadcom/brcm80211/brcmfmac/core.c | 9 +-
.../wireless/broadcom/brcm80211/brcmfmac/debug.h | 2 +
.../broadcom/brcm80211/brcmfmac/firmware.c | 44 ++++-
.../broadcom/brcm80211/brcmfmac/firmware.h | 46 ++++-
.../wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 +-
.../broadcom/brcm80211/brcmfmac/fwil_types.h | 12 +-
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 33 ++--
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 -
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 149 +++-------------
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 196 +++++----------------
.../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 +-
.../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 86 +++------
15 files changed, 317 insertions(+), 456 deletions(-)

--
1.9.1



2015-11-25 10:32:55

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 10/11] brcmfmac: Unify methods to define and map firmware files.

From: Hante Meuleman <[email protected]>

All bus drivers (sdio, usb and pcie) require firmware files which
needs to be downloaded to the device, The definitions and mapping
of device id and revision to firmware and nvram file is done by
each bus driver. This patch creates common functions and defines
to simplify and unify the definition of these firmware and nvram
files and mapping.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/firmware.c | 44 +++++-
.../broadcom/brcm80211/brcmfmac/firmware.h | 46 +++++-
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 149 ++++--------------
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 166 +++++----------------
.../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 +-
.../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 86 ++++-------
6 files changed, 178 insertions(+), 317 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index 4248f3c..7b57bbd 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -28,9 +28,9 @@
#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */

-char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
+static char brcmf_firmware_path[BRCMF_FW_NAME_LEN];
module_param_string(alternative_fw_path, brcmf_firmware_path,
- BRCMF_FW_PATH_LEN, 0440);
+ BRCMF_FW_NAME_LEN, 0440);

enum nvram_parser_state {
IDLE,
@@ -540,3 +540,43 @@ int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
0);
}

+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
+ struct brcmf_firmware_mapping mapping_table[],
+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
+ char nvram_name[BRCMF_FW_NAME_LEN])
+{
+ u32 i;
+ char end;
+
+ for (i = 0; i < table_size; i++) {
+ if (mapping_table[i].chipid == chip &&
+ mapping_table[i].revmask & BIT(chiprev))
+ break;
+ }
+
+ if (i == table_size) {
+ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev);
+ return -ENODEV;
+ }
+
+ /* check if firmware path is provided by module parameter */
+ if (brcmf_firmware_path[0] != '\0') {
+ strlcpy(fw_name, brcmf_firmware_path, BRCMF_FW_NAME_LEN);
+ if ((nvram_name) && (mapping_table[i].nvram))
+ strlcpy(nvram_name, brcmf_firmware_path,
+ BRCMF_FW_NAME_LEN);
+
+ end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
+ if (end != '/') {
+ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN);
+ if ((nvram_name) && (mapping_table[i].nvram))
+ strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN);
+ }
+ }
+ strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN);
+ if ((nvram_name) && (mapping_table[i].nvram))
+ strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN);
+
+ return 0;
+}
+
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
index 604dd48..ef06f57 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
@@ -21,11 +21,51 @@
#define BRCMF_FW_REQ_FLAGS 0x00F0
#define BRCMF_FW_REQ_NV_OPTIONAL 0x0010

-#define BRCMF_FW_PATH_LEN 256
-#define BRCMF_FW_NAME_LEN 32
+#define BRCMF_FW_NAME_LEN 320

-extern char brcmf_firmware_path[];
+#define BRCMF_FW_DEFAULT_PATH "brcm/"

+/**
+ * struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware
+ * filename and nvram filename. Each bus type implementation should create
+ * a table of firmware mappings (using the macros defined below).
+ *
+ * @chipid: ID of chip.
+ * @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-3
+ * @fw: name of the firmware file.
+ * @nvram: name of nvram file.
+ */
+struct brcmf_firmware_mapping {
+ u32 chipid;
+ u32 revmask;
+ const char *fw;
+ const char *nvram;
+};
+
+#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \
+static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \
+ BRCMF_FW_DEFAULT_PATH fw; \
+static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \
+ BRCMF_FW_DEFAULT_PATH nvram; \
+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); \
+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH nvram)
+
+#define BRCMF_FW_DEF(fw_name, fw) \
+static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \
+ BRCMF_FW_DEFAULT_PATH fw; \
+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \
+
+#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \
+ { chipid, mask, \
+ BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME }
+
+#define BRCMF_FW_ENTRY(chipid, mask, name) \
+ { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL }
+
+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
+ struct brcmf_firmware_mapping mapping_table[],
+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
+ char nvram_name[BRCMF_FW_NAME_LEN]);
void brcmf_fw_nvram_free(void *nvram);
/*
* Request firmware(s) asynchronously. When the asynchronous request
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index e08bc64..1603e65 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -44,25 +44,29 @@ enum brcmf_pcie_state {
BRCMFMAC_PCIE_STATE_UP
};

-
-#define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
-#define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
-#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
-#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
-#define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
-#define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
-#define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
-#define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
-#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
-#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
-#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
-#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
-#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
-#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
-#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
-#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
-#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
-#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
+BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt");
+BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
+BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
+
+static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFFFF, 4350),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
+};

#define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */

@@ -202,26 +206,6 @@ enum brcmf_pcie_state {
#define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3


-MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
-MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
-
-
struct brcmf_pcie_console {
u32 base_addr;
u32 buf_addr;
@@ -258,8 +242,8 @@ struct brcmf_pciedev_info {
enum brcmf_pcie_state state;
bool in_irq;
struct pci_dev *pdev;
- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
+ char fw_name[BRCMF_FW_NAME_LEN];
+ char nvram_name[BRCMF_FW_NAME_LEN];
void __iomem *regs;
void __iomem *tcm;
u32 tcm_size;
@@ -1478,84 +1462,6 @@ brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
}


-static int brcmf_pcie_get_fwnames(struct brcmf_pciedev_info *devinfo)
-{
- char *fw_name;
- char *nvram_name;
- uint fw_len, nv_len;
- char end;
-
- brcmf_dbg(PCIE, "Enter, chip 0x%04x chiprev %d\n", devinfo->ci->chip,
- devinfo->ci->chiprev);
-
- switch (devinfo->ci->chip) {
- case BRCM_CC_43602_CHIP_ID:
- fw_name = BRCMF_PCIE_43602_FW_NAME;
- nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
- break;
- case BRCM_CC_4350_CHIP_ID:
- fw_name = BRCMF_PCIE_4350_FW_NAME;
- nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
- break;
- case BRCM_CC_4356_CHIP_ID:
- fw_name = BRCMF_PCIE_4356_FW_NAME;
- nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
- break;
- case BRCM_CC_43567_CHIP_ID:
- case BRCM_CC_43569_CHIP_ID:
- case BRCM_CC_43570_CHIP_ID:
- fw_name = BRCMF_PCIE_43570_FW_NAME;
- nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
- break;
- case BRCM_CC_4358_CHIP_ID:
- fw_name = BRCMF_PCIE_4358_FW_NAME;
- nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
- break;
- case BRCM_CC_4359_CHIP_ID:
- fw_name = BRCMF_PCIE_4359_FW_NAME;
- nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
- break;
- case BRCM_CC_4365_CHIP_ID:
- fw_name = BRCMF_PCIE_4365_FW_NAME;
- nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
- break;
- case BRCM_CC_4366_CHIP_ID:
- fw_name = BRCMF_PCIE_4366_FW_NAME;
- nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
- break;
- case BRCM_CC_4371_CHIP_ID:
- fw_name = BRCMF_PCIE_4371_FW_NAME;
- nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
- break;
- default:
- brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
- return -ENODEV;
- }
-
- fw_len = sizeof(devinfo->fw_name) - 1;
- nv_len = sizeof(devinfo->nvram_name) - 1;
- /* check if firmware path is provided by module parameter */
- if (brcmf_firmware_path[0] != '\0') {
- strncpy(devinfo->fw_name, brcmf_firmware_path, fw_len);
- strncpy(devinfo->nvram_name, brcmf_firmware_path, nv_len);
- fw_len -= strlen(devinfo->fw_name);
- nv_len -= strlen(devinfo->nvram_name);
-
- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
- if (end != '/') {
- strncat(devinfo->fw_name, "/", fw_len);
- strncat(devinfo->nvram_name, "/", nv_len);
- fw_len--;
- nv_len--;
- }
- }
- strncat(devinfo->fw_name, fw_name, fw_len);
- strncat(devinfo->nvram_name, nvram_name, nv_len);
-
- return 0;
-}
-
-
static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
const struct firmware *fw, void *nvram,
u32 nvram_len)
@@ -1891,7 +1797,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot);
dev_set_drvdata(&pdev->dev, bus);

- ret = brcmf_pcie_get_fwnames(devinfo);
+ ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev,
+ brcmf_pcie_fwnames,
+ ARRAY_SIZE(brcmf_pcie_fwnames),
+ devinfo->fw_name, devinfo->nvram_name);
if (ret)
goto fail_bus;

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index bf3c281..5bdb5da 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -596,136 +596,41 @@ static const struct sdiod_drive_str sdiod_drvstr_tab2_3v3[] = {
{4, 0x1}
};

-#define BCM43143_FIRMWARE_NAME "brcm/brcmfmac43143-sdio.bin"
-#define BCM43143_NVRAM_NAME "brcm/brcmfmac43143-sdio.txt"
-#define BCM43241B0_FIRMWARE_NAME "brcm/brcmfmac43241b0-sdio.bin"
-#define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
-#define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
-#define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
-#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
-#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
-#define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
-#define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
-#define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
-#define BCM4330_NVRAM_NAME "brcm/brcmfmac4330-sdio.txt"
-#define BCM4334_FIRMWARE_NAME "brcm/brcmfmac4334-sdio.bin"
-#define BCM4334_NVRAM_NAME "brcm/brcmfmac4334-sdio.txt"
-#define BCM43340_FIRMWARE_NAME "brcm/brcmfmac43340-sdio.bin"
-#define BCM43340_NVRAM_NAME "brcm/brcmfmac43340-sdio.txt"
-#define BCM4335_FIRMWARE_NAME "brcm/brcmfmac4335-sdio.bin"
-#define BCM4335_NVRAM_NAME "brcm/brcmfmac4335-sdio.txt"
-#define BCM43362_FIRMWARE_NAME "brcm/brcmfmac43362-sdio.bin"
-#define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
-#define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
-#define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
-#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
-#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
-#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
-#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
-#define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
-#define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
-
-MODULE_FIRMWARE(BCM43143_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43143_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4330_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4334_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4334_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43340_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43340_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4335_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4335_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
-MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
-MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
-MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
-
-struct brcmf_firmware_names {
- u32 chipid;
- u32 revmsk;
- const char *bin;
- const char *nv;
+BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin",
+ "brcmfmac43241b0-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin",
+ "brcmfmac43241b4-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin",
+ "brcmfmac43241b5-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
+BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
+BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
+
+static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354)
};

-enum brcmf_firmware_type {
- BRCMF_FIRMWARE_BIN,
- BRCMF_FIRMWARE_NVRAM
-};
-
-#define BRCMF_FIRMWARE_NVRAM(name) \
- name ## _FIRMWARE_NAME, name ## _NVRAM_NAME
-
-static const struct brcmf_firmware_names brcmf_fwname_data[] = {
- { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
- { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
- { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
- { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
- { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
- { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
- { BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43340) },
- { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
- { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
- { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
- { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
- { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
-};
-
-static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci,
- struct brcmf_sdio_dev *sdiodev)
-{
- int i;
- char end;
-
- for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) {
- if (brcmf_fwname_data[i].chipid == ci->chip &&
- brcmf_fwname_data[i].revmsk & BIT(ci->chiprev))
- break;
- }
-
- if (i == ARRAY_SIZE(brcmf_fwname_data)) {
- brcmf_err("Unknown chipid %d [%d]\n", ci->chip, ci->chiprev);
- return -ENODEV;
- }
-
- /* check if firmware path is provided by module parameter */
- if (brcmf_firmware_path[0] != '\0') {
- strlcpy(sdiodev->fw_name, brcmf_firmware_path,
- sizeof(sdiodev->fw_name));
- strlcpy(sdiodev->nvram_name, brcmf_firmware_path,
- sizeof(sdiodev->nvram_name));
-
- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
- if (end != '/') {
- strlcat(sdiodev->fw_name, "/",
- sizeof(sdiodev->fw_name));
- strlcat(sdiodev->nvram_name, "/",
- sizeof(sdiodev->nvram_name));
- }
- }
- strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin,
- sizeof(sdiodev->fw_name));
- strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv,
- sizeof(sdiodev->nvram_name));
-
- return 0;
-}
-
static void pkt_align(struct sk_buff *p, int len, int align)
{
uint datalign;
@@ -4252,7 +4157,10 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
brcmf_sdio_debugfs_create(bus);
brcmf_dbg(INFO, "completed!!\n");

- ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev);
+ ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,
+ brcmf_sdio_fwnames,
+ ARRAY_SIZE(brcmf_sdio_fwnames),
+ sdiodev->fw_name, sdiodev->nvram_name);
if (ret)
goto fail;

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
index 7328478..d86ecf2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
@@ -195,8 +195,8 @@ struct brcmf_sdio_dev {
uint max_segment_size;
uint txglomsz;
struct sg_table sgtable;
- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
+ char fw_name[BRCMF_FW_NAME_LEN];
+ char nvram_name[BRCMF_FW_NAME_LEN];
bool wowl_enabled;
enum brcmf_sdiod_state state;
struct brcmf_sdiod_freezer *freezer;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index fe8b2bc..3072773 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -43,10 +43,20 @@
#define BRCMF_USB_CBCTL_READ 1
#define BRCMF_USB_MAX_PKT_SIZE 1600

-#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin"
-#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin"
-#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin"
-#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"
+BRCMF_FW_DEF(43143, "brcmfmac43143.bin");
+BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
+BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
+BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
+
+static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
+ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
+ BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B),
+ BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B),
+ BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
+ BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
+ BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
+ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569)
+};

#define TRX_MAGIC 0x30524448 /* "HDR0" */
#define TRX_MAX_OFFSET 3 /* Max number of file offsets */
@@ -139,6 +149,7 @@ struct brcmf_usbdev_info {
struct brcmf_usbreq *tx_reqs;
struct brcmf_usbreq *rx_reqs;

+ char fw_name[BRCMF_FW_NAME_LEN];
const u8 *image; /* buffer for combine fw and nvram */
int image_len;

@@ -983,45 +994,15 @@ static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo)
return 0;
}

-static bool brcmf_usb_chip_support(int chipid, int chiprev)
-{
- switch(chipid) {
- case BRCM_CC_43143_CHIP_ID:
- return true;
- case BRCM_CC_43235_CHIP_ID:
- case BRCM_CC_43236_CHIP_ID:
- case BRCM_CC_43238_CHIP_ID:
- return (chiprev == 3);
- case BRCM_CC_43242_CHIP_ID:
- return true;
- case BRCM_CC_43566_CHIP_ID:
- case BRCM_CC_43569_CHIP_ID:
- return true;
- default:
- break;
- }
- return false;
-}
-
static int
brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
{
- int devid, chiprev;
int err;

brcmf_dbg(USB, "Enter\n");
if (devinfo == NULL)
return -ENODEV;

- devid = devinfo->bus_pub.devid;
- chiprev = devinfo->bus_pub.chiprev;
-
- if (!brcmf_usb_chip_support(devid, chiprev)) {
- brcmf_err("unsupported chip %d rev %d\n",
- devid, chiprev);
- return -EINVAL;
- }
-
if (!devinfo->image) {
brcmf_err("No firmware!\n");
return -ENOENT;
@@ -1071,25 +1052,6 @@ static int check_file(const u8 *headers)
return -1;
}

-static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)
-{
- switch (devinfo->bus_pub.devid) {
- case BRCM_CC_43143_CHIP_ID:
- return BRCMF_USB_43143_FW_NAME;
- case BRCM_CC_43235_CHIP_ID:
- case BRCM_CC_43236_CHIP_ID:
- case BRCM_CC_43238_CHIP_ID:
- return BRCMF_USB_43236_FW_NAME;
- case BRCM_CC_43242_CHIP_ID:
- return BRCMF_USB_43242_FW_NAME;
- case BRCM_CC_43566_CHIP_ID:
- case BRCM_CC_43569_CHIP_ID:
- return BRCMF_USB_43569_FW_NAME;
- default:
- return NULL;
- }
-}
-

static
struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
@@ -1274,9 +1236,16 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo)
bus->chip = bus_pub->devid;
bus->chiprev = bus_pub->chiprev;

+ ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev,
+ brcmf_usb_fwnames,
+ ARRAY_SIZE(brcmf_usb_fwnames),
+ devinfo->fw_name, NULL);
+ if (ret)
+ goto fail;
+
/* request firmware here */
- ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
- NULL, brcmf_usb_probe_phase2);
+ ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL,
+ brcmf_usb_probe_phase2);
if (ret) {
brcmf_err("firmware request failed: %d\n", ret);
goto fail;
@@ -1472,8 +1441,7 @@ static int brcmf_usb_reset_resume(struct usb_interface *intf)

brcmf_dbg(USB, "Enter\n");

- return brcmf_fw_get_firmwares(&usb->dev, 0,
- brcmf_usb_get_fwname(devinfo), NULL,
+ return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL,
brcmf_usb_probe_phase2);
}

@@ -1491,10 +1459,6 @@ static struct usb_device_id brcmf_usb_devid_table[] = {
};

MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table);
-MODULE_FIRMWARE(BRCMF_USB_43143_FW_NAME);
-MODULE_FIRMWARE(BRCMF_USB_43236_FW_NAME);
-MODULE_FIRMWARE(BRCMF_USB_43242_FW_NAME);
-MODULE_FIRMWARE(BRCMF_USB_43569_FW_NAME);

static struct usb_driver brcmf_usbdrvr = {
.name = KBUILD_MODNAME,
--
1.9.1


2015-11-25 10:32:51

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 04/11] brcmfmac: no retries on rxglom superframe errors

From: Franky Lin <[email protected]>

Aborting the current read attempt on the superframe also removes the
packet from the pipeline. Retries should not be attempted on the next
packet since it would not be a superframe(either a superframe descriptor
or other data packet) and should not be handled by brcmf_sdio_rxglom

Reviewed-by: Hante Meuleman <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Arend Van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 30 ++++++----------------
1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 7e74ac3..bf3c281 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -460,7 +460,6 @@ struct brcmf_sdio {

struct sk_buff *glomd; /* Packet containing glomming descriptor */
struct sk_buff_head glom; /* Packet list for glommed superframe */
- uint glomerr; /* Glom packet read errors */

u8 *rxbuf; /* Buffer for receiving control packets */
uint rxblen; /* Allocated length of rxbuf */
@@ -1654,20 +1653,15 @@ static u8 brcmf_sdio_rxglom(struct brcmf_sdio *bus, u8 rxseq)
sdio_release_host(bus->sdiodev->func[1]);
bus->sdcnt.f2rxdata++;

- /* On failure, kill the superframe, allow a couple retries */
+ /* On failure, kill the superframe */
if (errcode < 0) {
brcmf_err("glom read of %d bytes failed: %d\n",
dlen, errcode);

sdio_claim_host(bus->sdiodev->func[1]);
- if (bus->glomerr++ < 3) {
- brcmf_sdio_rxfail(bus, true, true);
- } else {
- bus->glomerr = 0;
- brcmf_sdio_rxfail(bus, true, false);
- bus->sdcnt.rxglomfail++;
- brcmf_sdio_free_glom(bus);
- }
+ brcmf_sdio_rxfail(bus, true, false);
+ bus->sdcnt.rxglomfail++;
+ brcmf_sdio_free_glom(bus);
sdio_release_host(bus->sdiodev->func[1]);
return 0;
}
@@ -1708,19 +1702,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf_sdio *bus, u8 rxseq)
}

if (errcode) {
- /* Terminate frame on error, request
- a couple retries */
+ /* Terminate frame on error */
sdio_claim_host(bus->sdiodev->func[1]);
- if (bus->glomerr++ < 3) {
- /* Restore superframe header space */
- skb_push(pfirst, sfdoff);
- brcmf_sdio_rxfail(bus, true, true);
- } else {
- bus->glomerr = 0;
- brcmf_sdio_rxfail(bus, true, false);
- bus->sdcnt.rxglomfail++;
- brcmf_sdio_free_glom(bus);
- }
+ brcmf_sdio_rxfail(bus, true, false);
+ bus->sdcnt.rxglomfail++;
+ brcmf_sdio_free_glom(bus);
sdio_release_host(bus->sdiodev->func[1]);
bus->cur_read.len = 0;
return 0;
--
1.9.1


2015-11-25 10:32:55

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 05/11] brcmfmac: Remove redundant parameter action from scan.

From: Hante Meuleman <[email protected]>

ESCAN is always performed using action start scan. No need to
pass this parameter on to different functions.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +++---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 +-
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 13 +++++--------
3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 49dfc00..53831f5 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -946,7 +946,7 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,

static s32
brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
- struct cfg80211_scan_request *request, u16 action)
+ struct cfg80211_scan_request *request)
{
s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
offsetof(struct brcmf_escan_params_le, params_le);
@@ -971,7 +971,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
brcmf_escan_prep(cfg, &params->params_le, request);
params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
- params->action = cpu_to_le16(action);
+ params->action = cpu_to_le16(WL_ESCAN_ACTION_START);
params->sync_id = cpu_to_le16(0x1234);

err = brcmf_fil_iovar_data_set(ifp, "escan", params, params_size);
@@ -1013,7 +1013,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
results->count = 0;
results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;

- err = escan->run(cfg, ifp, request, WL_ESCAN_ACTION_START);
+ err = escan->run(cfg, ifp, request);
if (err)
brcmf_scan_config_mpc(ifp, 1);
return err;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 98c8920..3b3096b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -231,7 +231,7 @@ struct escan_info {
struct wiphy *wiphy;
struct brcmf_if *ifp;
s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
- struct cfg80211_scan_request *request, u16 action);
+ struct cfg80211_scan_request *request);
};

/**
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index a5902c3..b23dcbc 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -625,11 +625,10 @@ exit:
* @num_chans: number of channels to scan.
* @chanspecs: channel parameters for @num_chans channels.
* @search_state: P2P discover state to use.
- * @action: scan action to pass to firmware.
* @bss_type: type of P2P bss.
*/
static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
- u16 chanspecs[], s32 search_state, u16 action,
+ u16 chanspecs[], s32 search_state,
enum p2p_bss_type bss_type)
{
s32 ret = 0;
@@ -738,7 +737,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,

/* set the escan specific parameters */
p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
- p2p_params->eparams.action = cpu_to_le16(action);
+ p2p_params->eparams.action = cpu_to_le16(WL_ESCAN_ACTION_START);
p2p_params->eparams.sync_id = cpu_to_le16(0x1234);
/* perform p2p scan on primary device */
ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize);
@@ -762,8 +761,7 @@ exit:
*/
static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
struct brcmf_if *ifp,
- struct cfg80211_scan_request *request,
- u16 action)
+ struct cfg80211_scan_request *request)
{
struct brcmf_p2p_info *p2p = &cfg->p2p;
s32 err = 0;
@@ -823,7 +821,7 @@ static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
num_nodfs++;
}
err = brcmf_p2p_escan(p2p, num_nodfs, chanspecs, search_state,
- action, P2PAPI_BSSCFG_DEVICE);
+ P2PAPI_BSSCFG_DEVICE);
kfree(chanspecs);
}
exit:
@@ -1092,8 +1090,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
default_chan_list[2] = ch.chspec;
}
err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list,
- WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START,
- P2PAPI_BSSCFG_DEVICE);
+ WL_P2P_DISC_ST_SEARCH, P2PAPI_BSSCFG_DEVICE);
kfree(default_chan_list);
exit:
return err;
--
1.9.1


2015-11-30 12:49:49

by Kalle Valo

[permalink] [raw]
Subject: Re: [01/11] brcmfmac: Cleanup ssid storage.

Kalle Valo <[email protected]> writes:

>> From: Hante Meuleman <[email protected]>
>>
>> SSIDs used for connect and p2p got stored, but never used.
>>
>> Reviewed-by: Arend Van Spriel <[email protected]>
>> Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
>> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
>> Signed-off-by: Hante Meuleman <[email protected]>
>> Signed-off-by: Arend van Spriel <[email protected]>
>
> Thanks, 10 patches applied to wireless-drivers-next.git:
>
> e9a6ca825eb7 brcmfmac: Cleanup ssid storage.
> 21000b3f3da4 brcmfmac: Return actual error by fwil.
> 6a23863eaa51 brcmfmac: Change error print on wlan0 existence.
> 64d66c30c37e brcmfmac: no retries on rxglom superframe errors
> c495810624ef brcmfmac: Remove redundant parameter action from scan.
> 1119e23edf25 brcmfmac: Cleanup roaming configuration.
> 7bf65aa9ad3f brcmfmac: Add beamforming support.
> b4fd63c608a2 brcmfmac: assure net_ratelimit() is declared before use
> 46d703a77539 brcmfmac: Unify methods to define and map firmware files.
> 5536f20a1c43 brcmfmac: Fix double free on exception at module load.

Forgot to mention that I skipped patch 8 for now as it needs more
discussion.

https://patchwork.kernel.org/patch/7697091/

--
Kalle Valo

2015-11-25 10:32:52

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 02/11] brcmfmac: Return actual error by fwil.

From: Hante Meuleman <[email protected]>

FWIL is always mapping back errors to EBADE. This is not very
conventient when trying to understand problems by reading logs.
Some callers print the error code, but that is quite useless
when the exact error code is not returned. It also makes it
impossible to differentiate based on error code. This patch
changes the return of EBADE into the actual error code.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
index bbf7abb..f6a2df9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
@@ -126,7 +126,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)

brcmf_dbg(FIL, "Failed: %s (%d)\n",
brcmf_fil_get_errstr((u32)(-err)), err);
- return -EBADE;
+
+ return err;
}

s32
--
1.9.1


2015-11-30 12:48:17

by Kalle Valo

[permalink] [raw]
Subject: Re: [01/11] brcmfmac: Cleanup ssid storage.


> From: Hante Meuleman <[email protected]>
>
> SSIDs used for connect and p2p got stored, but never used.
>
> Reviewed-by: Arend Van Spriel <[email protected]>
> Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
> Signed-off-by: Hante Meuleman <[email protected]>
> Signed-off-by: Arend van Spriel <[email protected]>

Thanks, 10 patches applied to wireless-drivers-next.git:

e9a6ca825eb7 brcmfmac: Cleanup ssid storage.
21000b3f3da4 brcmfmac: Return actual error by fwil.
6a23863eaa51 brcmfmac: Change error print on wlan0 existence.
64d66c30c37e brcmfmac: no retries on rxglom superframe errors
c495810624ef brcmfmac: Remove redundant parameter action from scan.
1119e23edf25 brcmfmac: Cleanup roaming configuration.
7bf65aa9ad3f brcmfmac: Add beamforming support.
b4fd63c608a2 brcmfmac: assure net_ratelimit() is declared before use
46d703a77539 brcmfmac: Unify methods to define and map firmware files.
5536f20a1c43 brcmfmac: Fix double free on exception at module load.

Kalle Valo

2015-11-25 10:32:56

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 06/11] brcmfmac: Cleanup roaming configuration.

From: Hante Meuleman <[email protected]>

Put all roaming configuration related code in one place and
configure timeout based upon roaming setting.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ++++++++++------------
.../broadcom/brcm80211/brcmfmac/cfg80211.h | 6 ++--
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 21 -----------
3 files changed, 22 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 53831f5..ef0f882 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -4756,7 +4756,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
vif->wdev.iftype = type;

vif->pm_block = pm_block;
- vif->roam_off = -1;

brcmf_init_prof(&vif->profile);

@@ -5306,35 +5305,33 @@ static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
mutex_init(&event->vif_event_lock);
}

-static s32
-brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
+static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
{
- s32 err = 0;
+ s32 err;
+ u32 bcn_timeout;
__le32 roamtrigger[2];
__le32 roam_delta[2];

- /*
- * Setup timeout if Beacons are lost and roam is
- * off to report link down
- */
- if (brcmf_roamoff) {
- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
- if (err) {
- brcmf_err("bcn_timeout error (%d)\n", err);
- goto dongle_rom_out;
- }
+ /* Configure beacon timeout value based upon roaming setting */
+ if (brcmf_roamoff)
+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF;
+ else
+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
+ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
+ if (err) {
+ brcmf_err("bcn_timeout error (%d)\n", err);
+ goto roam_setup_done;
}

- /*
- * Enable/Disable built-in roaming to allow supplicant
- * to take care of roaming
+ /* Enable/Disable built-in roaming to allow supplicant to take care of
+ * roaming.
*/
brcmf_dbg(INFO, "Internal Roaming = %s\n",
brcmf_roamoff ? "Off" : "On");
err = brcmf_fil_iovar_int_set(ifp, "roam_off", !!(brcmf_roamoff));
if (err) {
brcmf_err("roam_off error (%d)\n", err);
- goto dongle_rom_out;
+ goto roam_setup_done;
}

roamtrigger[0] = cpu_to_le32(WL_ROAM_TRIGGER_LEVEL);
@@ -5343,7 +5340,7 @@ brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
(void *)roamtrigger, sizeof(roamtrigger));
if (err) {
brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
- goto dongle_rom_out;
+ goto roam_setup_done;
}

roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA);
@@ -5352,10 +5349,10 @@ brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
(void *)roam_delta, sizeof(roam_delta));
if (err) {
brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
- goto dongle_rom_out;
+ goto roam_setup_done;
}

-dongle_rom_out:
+roam_setup_done:
return err;
}

@@ -6070,7 +6067,7 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
brcmf_dbg(INFO, "power save set to %s\n",
(power_mode ? "enabled" : "disabled"));

- err = brcmf_dongle_roam(ifp, WL_BEACON_TIMEOUT);
+ err = brcmf_dongle_roam(ifp);
if (err)
goto default_conf_out;
err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 3b3096b..d492163 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -28,7 +28,6 @@
#define WL_EXTRA_BUF_MAX 2048
#define WL_ROAM_TRIGGER_LEVEL -75
#define WL_ROAM_DELTA 20
-#define WL_BEACON_TIMEOUT 3

#define WL_SCAN_CHANNEL_TIME 40
#define WL_SCAN_UNASSOC_TIME 40
@@ -77,6 +76,9 @@

#define BRCMF_MAX_DEFAULT_KEYS 4

+/* beacon loss timeout defaults */
+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4

/**
* enum brcmf_scan_status - scan engine status
@@ -178,7 +180,6 @@ struct vif_saved_ie {
* @ifp: lower layer interface pointer
* @wdev: wireless device.
* @profile: profile information.
- * @roam_off: roaming state.
* @sme_state: SME state using enum brcmf_vif_status bits.
* @pm_block: power-management blocked.
* @list: linked list.
@@ -189,7 +190,6 @@ struct brcmf_cfg80211_vif {
struct brcmf_if *ifp;
struct wireless_dev wdev;
struct brcmf_cfg80211_profile profile;
- s32 roam_off;
unsigned long sme_state;
bool pm_block;
struct vif_saved_ie saved_ie;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index fe54844..59beed2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -29,7 +29,6 @@

const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

-#define BRCMF_DEFAULT_BCN_TIMEOUT 3
#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40

@@ -107,26 +106,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
goto done;
}

- /*
- * Setup timeout if Beacons are lost and roam is off to report
- * link down
- */
- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout",
- BRCMF_DEFAULT_BCN_TIMEOUT);
- if (err) {
- brcmf_err("bcn_timeout error (%d)\n", err);
- goto done;
- }
-
- /* Enable/Disable build-in roaming to allowed ext supplicant to take
- * of romaing
- */
- err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
- if (err) {
- brcmf_err("roam_off error (%d)\n", err);
- goto done;
- }
-
/* Setup join_pref to select target by RSSI(with boost on 5GHz) */
join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
join_pref_params[0].len = 2;
--
1.9.1


2015-11-25 10:32:53

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

From: Hante Meuleman <[email protected]>

By default the 5G band has an advantage of 8 dBm on the RSSI when
it comes to selection during join and roam. This patch adds a
module param to make this value configurable. Using the value 99
results in configuration that 5G has always preference over 2.4G.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 31 +++++++++++++++++-----
1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 474de11..6bc0ae9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -15,6 +15,7 @@
*/

#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/string.h>
#include <linux/netdevice.h>
#include <brcmu_wifi.h>
@@ -32,8 +33,18 @@ const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40

-/* boost value for RSSI_DELTA in preferred join selection */
+/* default boost value for RSSI_DELTA in preferred join selection */
#define BRCMF_JOIN_PREF_RSSI_BOOST 8
+#define BRCMF_RSSI_BOOST_IS_5G 99
+
+/* Module param joinboost_5g used for preferred join selection.
+ * Use value 99 to configure preferred join to choose 5G always over 2.4G, any
+ * other value configures the advantage of 5G signal strength over 2.4G signal
+ * strength.
+ */
+static int brcmf_joinboost_5g_rssi = BRCMF_JOIN_PREF_RSSI_BOOST;
+module_param_named(joinboost_5g, brcmf_joinboost_5g_rssi, int, 0);
+MODULE_PARM_DESC(joinboost_5g, "Join preference 5G RSSI boost");

int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
{
@@ -106,11 +117,19 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
goto done;
}

- /* Setup join_pref to select target by RSSI(with boost on 5GHz) */
- join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
- join_pref_params[0].len = 2;
- join_pref_params[0].rssi_gain = BRCMF_JOIN_PREF_RSSI_BOOST;
- join_pref_params[0].band = WLC_BAND_5G;
+ if (brcmf_joinboost_5g_rssi == BRCMF_RSSI_BOOST_IS_5G) {
+ /* Setup join_pref to select 5GHz over 2.4Ghz */
+ join_pref_params[0].type = BRCMF_JOIN_PREF_BAND;
+ join_pref_params[0].len = 2;
+ join_pref_params[0].rssi_gain = 0;
+ join_pref_params[0].band = WLC_BAND_5G;
+ } else {
+ /* Setup join_pref to select target by RSSI (boost on 5GHz) */
+ join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
+ join_pref_params[0].len = 2;
+ join_pref_params[0].rssi_gain = brcmf_joinboost_5g_rssi;
+ join_pref_params[0].band = WLC_BAND_5G;
+ }
join_pref_params[1].type = BRCMF_JOIN_PREF_RSSI;
join_pref_params[1].len = 2;
join_pref_params[1].rssi_gain = 0;
--
1.9.1


2015-11-25 10:32:51

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 03/11] brcmfmac: Change error print on wlan0 existence.

From: Hante Meuleman <[email protected]>

During initialization of the device, but also on some other
moments the driver prints an error that the netdev already exists.
This is a result of the way the driver is initializing the
firmware and not really an error. The code is not treating it as
an error either. This error print has resulted in many questions
by users and is confusing and incorrect. This patch changes the
error log into a debug info log.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 8d16f50..9038932 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -811,14 +811,15 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
* in case we missed the BRCMF_E_IF_DEL event.
*/
if (ifp) {
- brcmf_err("ERROR: netdev:%s already exists\n",
- ifp->ndev->name);
if (ifidx) {
+ brcmf_err("ERROR: netdev:%s already exists\n",
+ ifp->ndev->name);
netif_stop_queue(ifp->ndev);
brcmf_net_detach(ifp->ndev);
drvr->iflist[bsscfgidx] = NULL;
} else {
- brcmf_err("ignore IF event\n");
+ brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
+ ifp->ndev->name);
return ERR_PTR(-EINVAL);
}
}
--
1.9.1


2015-11-25 10:32:53

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 11/11] brcmfmac: Fix double free on exception at module load.

From: Hante Meuleman <[email protected]>

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 9038932..3a39192 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1083,6 +1083,8 @@ fail:
brcmf_net_detach(ifp->ndev);
if (p2p_ifp)
brcmf_net_detach(p2p_ifp->ndev);
+ drvr->iflist[0] = NULL;
+ drvr->iflist[1] = NULL;
return ret;
}
return 0;
--
1.9.1


2015-11-25 10:32:53

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 09/11] brcmfmac: assure net_ratelimit() is declared before use

Under some kernel configuration we get build issue with implicit
declaration of net_ratelimit() function. Fix this by explicitly
including the file providing the prototype.

Reviewed-by: Hante Meuleman <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
index d0d9676..6687812 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -17,6 +17,8 @@
#ifndef BRCMFMAC_DEBUG_H
#define BRCMFMAC_DEBUG_H

+#include <linux/net.h> /* net_ratelimit() */
+
/* message levels */
#define BRCMF_TRACE_VAL 0x00000002
#define BRCMF_INFO_VAL 0x00000004
--
1.9.1


2015-11-25 10:32:53

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 07/11] brcmfmac: Add beamforming support.

From: Hante Meuleman <[email protected]>

Some devices support beamforming. This patch enables tx beamforming
if supported and reports beamforming capabilities per channel if
supported.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 36 ++++++++++++++++++++--
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 3 ++
.../broadcom/brcm80211/brcmfmac/fwil_types.h | 5 +++
3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index ef0f882..771c581 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5672,7 +5672,8 @@ static __le16 brcmf_get_mcs_map(u32 nchain, enum ieee80211_vht_mcs_support supp)
}

static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
- u32 bw_cap[2], u32 nchain)
+ u32 bw_cap[2], u32 nchain, u32 txstreams,
+ u32 txbf_bfe_cap, u32 txbf_bfr_cap)
{
__le16 mcs_map;

@@ -5691,6 +5692,25 @@ static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9);
band->vht_cap.vht_mcs.rx_mcs_map = mcs_map;
band->vht_cap.vht_mcs.tx_mcs_map = mcs_map;
+
+ /* Beamforming support information */
+ if (txbf_bfe_cap & BRCMF_TXBF_SU_BFE_CAP)
+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
+ if (txbf_bfe_cap & BRCMF_TXBF_MU_BFE_CAP)
+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
+ if (txbf_bfr_cap & BRCMF_TXBF_SU_BFR_CAP)
+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
+ if (txbf_bfr_cap & BRCMF_TXBF_MU_BFR_CAP)
+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
+
+ if ((txbf_bfe_cap || txbf_bfr_cap) && (txstreams > 1)) {
+ band->vht_cap.cap |=
+ (2 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
+ band->vht_cap.cap |= ((txstreams - 1) <<
+ IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT);
+ band->vht_cap.cap |=
+ IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB;
+ }
}

static int brcmf_setup_wiphybands(struct wiphy *wiphy)
@@ -5705,6 +5725,9 @@ static int brcmf_setup_wiphybands(struct wiphy *wiphy)
int err;
s32 i;
struct ieee80211_supported_band *band;
+ u32 txstreams = 0;
+ u32 txbf_bfe_cap = 0;
+ u32 txbf_bfr_cap = 0;

(void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
@@ -5733,6 +5756,14 @@ static int brcmf_setup_wiphybands(struct wiphy *wiphy)
return err;
}

+ if (vhtmode) {
+ (void)brcmf_fil_iovar_int_get(ifp, "txstreams", &txstreams);
+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfe_cap",
+ &txbf_bfe_cap);
+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfr_cap",
+ &txbf_bfr_cap);
+ }
+
wiphy = cfg_to_wiphy(cfg);
for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
band = wiphy->bands[i];
@@ -5742,7 +5773,8 @@ static int brcmf_setup_wiphybands(struct wiphy *wiphy)
if (nmode)
brcmf_update_ht_cap(band, bw_cap, nchain);
if (vhtmode)
- brcmf_update_vht_cap(band, bw_cap, nchain);
+ brcmf_update_vht_cap(band, bw_cap, nchain, txstreams,
+ txbf_bfe_cap, txbf_bfr_cap);
}

return 0;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 59beed2..474de11 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -153,6 +153,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
goto done;
}

+ /* Enable tx beamforming, errors can be ignored (not supported) */
+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);
+
/* do bus specific preinit here */
err = brcmf_bus_preinit(ifp->drvr->bus_if);
done:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index 2bcd187..18483e7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -121,6 +121,11 @@

#define BRCMF_MAX_ASSOCLIST 128

+#define BRCMF_TXBF_SU_BFE_CAP BIT(0)
+#define BRCMF_TXBF_MU_BFE_CAP BIT(1)
+#define BRCMF_TXBF_SU_BFR_CAP BIT(0)
+#define BRCMF_TXBF_MU_BFR_CAP BIT(1)
+
/* join preference types for join_pref iovar */
enum brcmf_join_pref_types {
BRCMF_JOIN_PREF_RSSI = 1,
--
1.9.1


2015-11-30 10:59:05

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

Arend van Spriel <[email protected]> writes:

> From: Hante Meuleman <[email protected]>
>
> By default the 5G band has an advantage of 8 dBm on the RSSI when
> it comes to selection during join and roam. This patch adds a
> module param to make this value configurable. Using the value 99
> results in configuration that 5G has always preference over 2.4G.
>
> Reviewed-by: Arend Van Spriel <[email protected]>
> Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
> Signed-off-by: Hante Meuleman <[email protected]>
> Signed-off-by: Arend van Spriel <[email protected]>

[...]

> +/* Module param joinboost_5g used for preferred join selection.
> + * Use value 99 to configure preferred join to choose 5G always over 2.4G, any
> + * other value configures the advantage of 5G signal strength over 2.4G signal
> + * strength.
> + */
> +static int brcmf_joinboost_5g_rssi = BRCMF_JOIN_PREF_RSSI_BOOST;
> +module_param_named(joinboost_5g, brcmf_joinboost_5g_rssi, int, 0);
> +MODULE_PARM_DESC(joinboost_5g, "Join preference 5G RSSI boost");

I'm not sure here, is a module parameter really the right way to
configure something like this?

--
Kalle Valo

2015-11-30 11:00:53

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 11/11] brcmfmac: Fix double free on exception at module load.

Arend van Spriel <[email protected]> writes:

> From: Hante Meuleman <[email protected]>
>
> Reviewed-by: Arend Van Spriel <[email protected]>
> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
> Signed-off-by: Hante Meuleman <[email protected]>
> Signed-off-by: Arend van Spriel <[email protected]>

In the future no empty commit logs, please.

--
Kalle Valo

2015-11-25 10:32:52

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 01/11] brcmfmac: Cleanup ssid storage.

From: Hante Meuleman <[email protected]>

SSIDs used for connect and p2p got stored, but never used.

Reviewed-by: Arend Van Spriel <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Hante Meuleman <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ++++++++--------------
.../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 --
.../broadcom/brcm80211/brcmfmac/fwil_types.h | 7 +---
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 20 +++++------
.../net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 --
5 files changed, 24 insertions(+), 48 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 998c521..49dfc00 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -960,7 +960,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
params_size += sizeof(u32) * ((request->n_channels + 1) / 2);

/* Allocate space for populating ssids in struct */
- params_size += sizeof(struct brcmf_ssid) * request->n_ssids;
+ params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids;
}

params = kzalloc(params_size, GFP_KERNEL);
@@ -1292,6 +1292,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
s32 wsec = 0;
s32 bcnprd;
u16 chanspec;
+ u32 ssid_len;

brcmf_dbg(TRACE, "Enter\n");
if (!check_vif_up(ifp->vif))
@@ -1369,17 +1370,15 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
memset(&join_params, 0, sizeof(struct brcmf_join_params));

/* SSID */
- profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32);
- memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len);
- memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len);
- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
+ ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN);
+ memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len);
+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
join_params_size = sizeof(join_params.ssid_le);

/* BSSID */
if (params->bssid) {
memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
- join_params_size = sizeof(join_params.ssid_le) +
- BRCMF_ASSOC_PARAMS_FIXED_SIZE;
+ join_params_size += BRCMF_ASSOC_PARAMS_FIXED_SIZE;
memcpy(profile->bssid, params->bssid, ETH_ALEN);
} else {
eth_broadcast_addr(join_params.params_le.bssid);
@@ -1729,7 +1728,6 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
{
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_if *ifp = netdev_priv(ndev);
- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
struct ieee80211_channel *chan = sme->channel;
struct brcmf_join_params join_params;
size_t join_params_size;
@@ -1740,6 +1738,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
struct brcmf_ext_join_params_le *ext_join_params;
u16 chanspec;
s32 err = 0;
+ u32 ssid_len;

brcmf_dbg(TRACE, "Enter\n");
if (!check_vif_up(ifp->vif))
@@ -1825,15 +1824,6 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
goto done;
}

- profile->ssid.SSID_len = min_t(u32, (u32)sizeof(profile->ssid.SSID),
- (u32)sme->ssid_len);
- memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len);
- if (profile->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
- profile->ssid.SSID[profile->ssid.SSID_len] = 0;
- brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n", profile->ssid.SSID,
- profile->ssid.SSID_len);
- }
-
/* Join with specific BSSID and cached SSID
* If SSID is zero join based on BSSID only
*/
@@ -1846,9 +1836,12 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
err = -ENOMEM;
goto done;
}
- ext_join_params->ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
- memcpy(&ext_join_params->ssid_le.SSID, sme->ssid,
- profile->ssid.SSID_len);
+ ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
+ ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len);
+ memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len);
+ if (ssid_len < IEEE80211_MAX_SSID_LEN)
+ brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n",
+ ext_join_params->ssid_le.SSID, ssid_len);

/* Set up join scan parameters */
ext_join_params->scan_le.scan_type = -1;
@@ -1896,8 +1889,8 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
memset(&join_params, 0, sizeof(join_params));
join_params_size = sizeof(join_params.ssid_le);

- memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len);
- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
+ memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len);
+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);

if (sme->bssid)
memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN);
@@ -2776,9 +2769,7 @@ CleanUp:
static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
struct brcmf_if *ifp)
{
- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ifp->ndev);
struct brcmf_bss_info_le *bi;
- struct brcmf_ssid *ssid;
const struct brcmf_tlv *tim;
u16 beacon_interval;
u8 dtim_period;
@@ -2790,8 +2781,6 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
if (brcmf_is_ibssmode(ifp->vif))
return err;

- ssid = &profile->ssid;
-
*(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
cfg->extra_buf, WL_EXTRA_BUF_MAX);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 6a878c8..98c8920 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -124,13 +124,11 @@ struct brcmf_cfg80211_security {
/**
* struct brcmf_cfg80211_profile - profile information.
*
- * @ssid: ssid of associated/associating ap.
* @bssid: bssid of joined/joining ibss.
* @sec: security information.
* @key: key information
*/
struct brcmf_cfg80211_profile {
- struct brcmf_ssid ssid;
u8 bssid[ETH_ALEN];
struct brcmf_cfg80211_security sec;
struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
index 92ee1ad..2bcd187 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h
@@ -282,14 +282,9 @@ struct brcm_rateset_le {
u8 rates[BRCMF_MAXRATES_IN_SET];
};

-struct brcmf_ssid {
- u32 SSID_len;
- unsigned char SSID[32];
-};
-
struct brcmf_ssid_le {
__le32 SSID_len;
- unsigned char SSID[32];
+ unsigned char SSID[IEEE80211_MAX_SSID_LEN];
};

struct brcmf_scan_params_le {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 98cf1d0..a5902c3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -642,7 +642,6 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
struct brcmf_cfg80211_vif *vif;
struct brcmf_p2p_scan_le *p2p_params;
struct brcmf_scan_params_le *sparams;
- struct brcmf_ssid ssid;

memsize += num_chans * sizeof(__le16);
memblk = kzalloc(memsize, GFP_KERNEL);
@@ -655,16 +654,16 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
ret = -EINVAL;
goto exit;
}
+ p2p_params = (struct brcmf_p2p_scan_le *)memblk;
+ sparams = &p2p_params->eparams.params_le;

switch (search_state) {
case WL_P2P_DISC_ST_SEARCH:
/*
* If we in SEARCH STATE, we don't need to set SSID explictly
- * because dongle use P2P WILDCARD internally by default
+ * because dongle use P2P WILDCARD internally by default, use
+ * null ssid, which it is already due to kzalloc.
*/
- /* use null ssid */
- ssid.SSID_len = 0;
- memset(ssid.SSID, 0, sizeof(ssid.SSID));
break;
case WL_P2P_DISC_ST_SCAN:
/*
@@ -673,8 +672,10 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
* P2P WILDCARD because we just do broadcast scan unless
* setting SSID.
*/
- ssid.SSID_len = BRCMF_P2P_WILDCARD_SSID_LEN;
- memcpy(ssid.SSID, BRCMF_P2P_WILDCARD_SSID, ssid.SSID_len);
+ sparams->ssid_le.SSID_len =
+ cpu_to_le32(BRCMF_P2P_WILDCARD_SSID_LEN);
+ memcpy(sparams->ssid_le.SSID, BRCMF_P2P_WILDCARD_SSID,
+ BRCMF_P2P_WILDCARD_SSID_LEN);
break;
default:
brcmf_err(" invalid search state %d\n", search_state);
@@ -687,11 +688,9 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
/*
* set p2p scan parameters.
*/
- p2p_params = (struct brcmf_p2p_scan_le *)memblk;
p2p_params->type = 'E';

/* determine the scan engine parameters */
- sparams = &p2p_params->eparams.params_le;
sparams->bss_type = DOT11_BSSTYPE_ANY;
if (p2p->cfg->active_scan)
sparams->scan_type = 0;
@@ -699,9 +698,6 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
sparams->scan_type = 1;

eth_broadcast_addr(sparams->bssid);
- if (ssid.SSID_len)
- memcpy(sparams->ssid_le.SSID, ssid.SSID, ssid.SSID_len);
- sparams->ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS);

/*
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
index 5d49059..a3bd18c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
@@ -112,7 +112,6 @@ struct afx_hdl {
* @int_addr: P2P interface address.
* @bss_idx: informate for P2P bss types.
* @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
- * @ssid: ssid for P2P GO.
* @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
* @remain_on_channel: contains copy of struct used by cfg80211.
* @remain_on_channel_cookie: cookie counter for remain on channel cmd
@@ -133,7 +132,6 @@ struct brcmf_p2p_info {
u8 int_addr[ETH_ALEN];
struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
struct timer_list listen_timer;
- struct brcmf_ssid ssid;
u8 listen_channel;
struct ieee80211_channel remain_on_channel;
u32 remain_on_channel_cookie;
--
1.9.1


2015-12-02 16:38:53

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On Wed, 2015-12-02 at 14:32 +0100, Arend van Spriel wrote:
> On 12/01/2015 12:08 PM, Jouni Malinen wrote:
> > On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
> > > Arend van Spriel <[email protected]> writes:
> > > > It solves a problem for us, but admittedly it is not something
> > > > that is
> > > > very usable by user-space apps. So I guess what you are
> > > > suggesting
> > > > here is to come up with a nl80211 api for this. On the mailing
> > > > list
> > > > (or hostap list) the topic pops up from time to time so there
> > > > are
> > > > people who would like to have such a knob to play with. Still
> > > > would
> > > > like to keep the module parameter although its use may change
> > > > when
> > > > nl80211 api is added.
> > >
> > > I don't know what is the best approach, that's why I would like
> > > to hear
> > > opinions from others. Personally I don't like the idea of adding
> > > 802.11
> > > level configuration options to module parameters, but on the
> > > other hand
> > > I don't have any strong opinions about this.
> >
> > I would like to see this as a new attribute to NL80211_CMD_CONNECT
> > to
> > provide parameters for offloaded (driver and/or firmware) BSS
> > selection
> > and roaming. If there is a driver that uses roaming offload with
> > NL80211_CMD_ASSOCIATE, the same attribute could be used there (but
> > I'm
> > not sure how exact such offloading would work in practice since I'd
> > expect both authentication and (re)association to be offloaded).
>
> Sounds reasonable. Just would like to explore the use-case a bit
> more.
> Looking at tools like NetworkManager and android network list, the
> user
> is always presented with just SSID listed once. For NetworkManager
>
While NM has band locking properties, there is currently no "prefer
5ghz" since as Jouni said, the supplicant should probably just prefer
5ghz right now. In any case, the best path from an NM perspective
would be a supplicant per-network property that would then be sent for
CONNECT-capable drivers, or which the supplicant would manually handle
for softmac drivers through its existing AP selection code.

Dan

> details can be configured for a connection and the bss selection
> parameters could be one of those. What level of detail would be
> needed
> there. Not saying we can not have more detail in the nl80211 API.
>
> > > I guess we have two different designs, one where the roaming
> > > logic is in
> > > firmware and other where wpasupplicant is responsible for this.
> > > (And I
> > > assume that brcfmac belongs to the former group.) Ideally it
> > > would be
> > > nice that we would have a same configuration knob for both but I
> > > don't
> > > know if that's really feasible.
> >
> > Both of these would work as long as wpa_supplicant has means for
> > providing such configuration to the driver in a generic manner.
> > That
> > NL80211_CMD_CONNECT extension with a new optional attribute would
> > be
> > such a generic design.
>
> So does the driver need to advertise support for bss selection
> parameters or can it simply ignore the parameters. Assuming the
> latter
> for now.
>
> Regards,
> Arend
> --
> To unsubscribe from this list: send the line "unsubscribe linux
> -wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-12-02 13:32:59

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On 12/01/2015 12:08 PM, Jouni Malinen wrote:
> On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
>> Arend van Spriel <[email protected]> writes:
>>> It solves a problem for us, but admittedly it is not something that is
>>> very usable by user-space apps. So I guess what you are suggesting
>>> here is to come up with a nl80211 api for this. On the mailing list
>>> (or hostap list) the topic pops up from time to time so there are
>>> people who would like to have such a knob to play with. Still would
>>> like to keep the module parameter although its use may change when
>>> nl80211 api is added.
>>
>> I don't know what is the best approach, that's why I would like to hear
>> opinions from others. Personally I don't like the idea of adding 802.11
>> level configuration options to module parameters, but on the other hand
>> I don't have any strong opinions about this.
>
> I would like to see this as a new attribute to NL80211_CMD_CONNECT to
> provide parameters for offloaded (driver and/or firmware) BSS selection
> and roaming. If there is a driver that uses roaming offload with
> NL80211_CMD_ASSOCIATE, the same attribute could be used there (but I'm
> not sure how exact such offloading would work in practice since I'd
> expect both authentication and (re)association to be offloaded).

Sounds reasonable. Just would like to explore the use-case a bit more.
Looking at tools like NetworkManager and android network list, the user
is always presented with just SSID listed once. For NetworkManager
details can be configured for a connection and the bss selection
parameters could be one of those. What level of detail would be needed
there. Not saying we can not have more detail in the nl80211 API.

>> I guess we have two different designs, one where the roaming logic is in
>> firmware and other where wpasupplicant is responsible for this. (And I
>> assume that brcfmac belongs to the former group.) Ideally it would be
>> nice that we would have a same configuration knob for both but I don't
>> know if that's really feasible.
>
> Both of these would work as long as wpa_supplicant has means for
> providing such configuration to the driver in a generic manner. That
> NL80211_CMD_CONNECT extension with a new optional attribute would be
> such a generic design.

So does the driver need to advertise support for bss selection
parameters or can it simply ignore the parameters. Assuming the latter
for now.

Regards,
Arend

2015-12-02 21:07:04

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On Wed, 2015-12-02 at 10:00 -0800, Paul Stewart wrote:
> From my perspective it is useful to have the driver express whether
> or not it supports this parameter. It may not change how the system
> operates, but it will be useful in testing to determine whether it
> is expected that a (given version of a) driver is expected to act
> with respect to this property so we can flag issues with the
> implementation.

Agreed.

Dan

> On Wed, Dec 2, 2015 at 8:38 AM, Dan Williams <[email protected]> wrote:
> > On Wed, 2015-12-02 at 14:32 +0100, Arend van Spriel wrote:
> > > On 12/01/2015 12:08 PM, Jouni Malinen wrote:
> > > > On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
> > > > > Arend van Spriel <[email protected]> writes:
> > > > > > It solves a problem for us, but admittedly it is not
> > > > > > something
> > > > > > that is
> > > > > > very usable by user-space apps. So I guess what you are
> > > > > > suggesting
> > > > > > here is to come up with a nl80211 api for this. On the
> > > > > > mailing
> > > > > > list
> > > > > > (or hostap list) the topic pops up from time to time so
> > > > > > there
> > > > > > are
> > > > > > people who would like to have such a knob to play with.
> > > > > > Still
> > > > > > would
> > > > > > like to keep the module parameter although its use may
> > > > > > change
> > > > > > when
> > > > > > nl80211 api is added.
> > > > >
> > > > > I don't know what is the best approach, that's why I would
> > > > > like
> > > > > to hear
> > > > > opinions from others. Personally I don't like the idea of
> > > > > adding
> > > > > 802.11
> > > > > level configuration options to module parameters, but on the
> > > > > other hand
> > > > > I don't have any strong opinions about this.
> > > >
> > > > I would like to see this as a new attribute to
> > > > NL80211_CMD_CONNECT
> > > > to
> > > > provide parameters for offloaded (driver and/or firmware) BSS
> > > > selection
> > > > and roaming. If there is a driver that uses roaming offload
> > > > with
> > > > NL80211_CMD_ASSOCIATE, the same attribute could be used there
> > > > (but
> > > > I'm
> > > > not sure how exact such offloading would work in practice since
> > > > I'd
> > > > expect both authentication and (re)association to be
> > > > offloaded).
> > >
> > > Sounds reasonable. Just would like to explore the use-case a bit
> > > more.
> > > Looking at tools like NetworkManager and android network list,
> > > the
> > > user
> > > is always presented with just SSID listed once. For
> > > NetworkManager
> > >
> > While NM has band locking properties, there is currently no "prefer
> > 5ghz" since as Jouni said, the supplicant should probably just
> > prefer
> > 5ghz right now. In any case, the best path from an NM perspective
> > would be a supplicant per-network property that would then be sent
> > for
> > CONNECT-capable drivers, or which the supplicant would manually
> > handle
> > for softmac drivers through its existing AP selection code.
> >
> > Dan
> >
> > > details can be configured for a connection and the bss selection
> > > parameters could be one of those. What level of detail would be
> > > needed
> > > there. Not saying we can not have more detail in the nl80211 API.
> > >
> > > > > I guess we have two different designs, one where the roaming
> > > > > logic is in
> > > > > firmware and other where wpasupplicant is responsible for
> > > > > this.
> > > > > (And I
> > > > > assume that brcfmac belongs to the former group.) Ideally it
> > > > > would be
> > > > > nice that we would have a same configuration knob for both
> > > > > but I
> > > > > don't
> > > > > know if that's really feasible.
> > > >
> > > > Both of these would work as long as wpa_supplicant has means
> > > > for
> > > > providing such configuration to the driver in a generic manner.
> > > > That
> > > > NL80211_CMD_CONNECT extension with a new optional attribute
> > > > would
> > > > be
> > > > such a generic design.
> > >
> > > So does the driver need to advertise support for bss selection
> > > parameters or can it simply ignore the parameters. Assuming the
> > > latter
> > > for now.
> > >
> > > Regards,
> > > Arend
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux
> > > -wireless" in
> > > the body of a message to [email protected]
> > > More majordomo info at
> > > http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux
> > -wireless" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-12-03 21:28:15

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On 12/02/2015 07:00 PM, Paul Stewart wrote:
> From my perspective it is useful to have the driver express whether
> or not it supports this parameter. It may not change how the system
> operates, but it will be useful in testing to determine whether it
> is expected that a (given version of a) driver is expected to act
> with respect to this property so we can flag issues with the
> implementation.

Thanks, Paul

and others. Will come up with a RFC for this incorporating all feedback
received.

Regards,
Arend

> On Wed, Dec 2, 2015 at 8:38 AM, Dan Williams <[email protected]> wrote:
>> On Wed, 2015-12-02 at 14:32 +0100, Arend van Spriel wrote:
>>> On 12/01/2015 12:08 PM, Jouni Malinen wrote:
>>>> On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
>>>>> Arend van Spriel <[email protected]> writes:
>>>>>> It solves a problem for us, but admittedly it is not something
>>>>>> that is
>>>>>> very usable by user-space apps. So I guess what you are
>>>>>> suggesting
>>>>>> here is to come up with a nl80211 api for this. On the mailing
>>>>>> list
>>>>>> (or hostap list) the topic pops up from time to time so there
>>>>>> are
>>>>>> people who would like to have such a knob to play with. Still
>>>>>> would
>>>>>> like to keep the module parameter although its use may change
>>>>>> when
>>>>>> nl80211 api is added.
>>>>>
>>>>> I don't know what is the best approach, that's why I would like
>>>>> to hear
>>>>> opinions from others. Personally I don't like the idea of adding
>>>>> 802.11
>>>>> level configuration options to module parameters, but on the
>>>>> other hand
>>>>> I don't have any strong opinions about this.
>>>>
>>>> I would like to see this as a new attribute to NL80211_CMD_CONNECT
>>>> to
>>>> provide parameters for offloaded (driver and/or firmware) BSS
>>>> selection
>>>> and roaming. If there is a driver that uses roaming offload with
>>>> NL80211_CMD_ASSOCIATE, the same attribute could be used there (but
>>>> I'm
>>>> not sure how exact such offloading would work in practice since I'd
>>>> expect both authentication and (re)association to be offloaded).
>>>
>>> Sounds reasonable. Just would like to explore the use-case a bit
>>> more.
>>> Looking at tools like NetworkManager and android network list, the
>>> user
>>> is always presented with just SSID listed once. For NetworkManager
>>>
>> While NM has band locking properties, there is currently no "prefer
>> 5ghz" since as Jouni said, the supplicant should probably just prefer
>> 5ghz right now. In any case, the best path from an NM perspective
>> would be a supplicant per-network property that would then be sent for
>> CONNECT-capable drivers, or which the supplicant would manually handle
>> for softmac drivers through its existing AP selection code.
>>
>> Dan
>>
>>> details can be configured for a connection and the bss selection
>>> parameters could be one of those. What level of detail would be
>>> needed
>>> there. Not saying we can not have more detail in the nl80211 API.
>>>
>>>>> I guess we have two different designs, one where the roaming
>>>>> logic is in
>>>>> firmware and other where wpasupplicant is responsible for this.
>>>>> (And I
>>>>> assume that brcfmac belongs to the former group.) Ideally it
>>>>> would be
>>>>> nice that we would have a same configuration knob for both but I
>>>>> don't
>>>>> know if that's really feasible.
>>>>
>>>> Both of these would work as long as wpa_supplicant has means for
>>>> providing such configuration to the driver in a generic manner.
>>>> That
>>>> NL80211_CMD_CONNECT extension with a new optional attribute would
>>>> be
>>>> such a generic design.
>>>
>>> So does the driver need to advertise support for bss selection
>>> parameters or can it simply ignore the parameters. Assuming the
>>> latter
>>> for now.
>>>
>>> Regards,
>>> Arend
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux
>>> -wireless" in
>>> the body of a message to [email protected]
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html


2015-12-01 09:48:39

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

Arend van Spriel <[email protected]> writes:

> On 11/30/2015 11:58 AM, Kalle Valo wrote:
>> Arend van Spriel <[email protected]> writes:
>>
>>> From: Hante Meuleman <[email protected]>
>>>
>>> By default the 5G band has an advantage of 8 dBm on the RSSI when
>>> it comes to selection during join and roam. This patch adds a
>>> module param to make this value configurable. Using the value 99
>>> results in configuration that 5G has always preference over 2.4G.
>>>
>>> Reviewed-by: Arend Van Spriel <[email protected]>
>>> Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
>>> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
>>> Signed-off-by: Hante Meuleman <[email protected]>
>>> Signed-off-by: Arend van Spriel <[email protected]>
>>
>> [...]
>>
>>> +/* Module param joinboost_5g used for preferred join selection.
>>> + * Use value 99 to configure preferred join to choose 5G always over 2.4G, any
>>> + * other value configures the advantage of 5G signal strength over 2.4G signal
>>> + * strength.
>>> + */
>>> +static int brcmf_joinboost_5g_rssi = BRCMF_JOIN_PREF_RSSI_BOOST;
>>> +module_param_named(joinboost_5g, brcmf_joinboost_5g_rssi, int, 0);
>>> +MODULE_PARM_DESC(joinboost_5g, "Join preference 5G RSSI boost");
>>
>> I'm not sure here, is a module parameter really the right way to
>> configure something like this?
>
> Define "right way".

Something which can be generic for all drivers/hw with similar design.
It's not good if a user is forced to configure this differently for each
driver. I have understood that this is a common problem anyway.

> It solves a problem for us, but admittedly it is not something that is
> very usable by user-space apps. So I guess what you are suggesting
> here is to come up with a nl80211 api for this. On the mailing list
> (or hostap list) the topic pops up from time to time so there are
> people who would like to have such a knob to play with. Still would
> like to keep the module parameter although its use may change when
> nl80211 api is added.

I don't know what is the best approach, that's why I would like to hear
opinions from others. Personally I don't like the idea of adding 802.11
level configuration options to module parameters, but on the other hand
I don't have any strong opinions about this.

I guess we have two different designs, one where the roaming logic is in
firmware and other where wpasupplicant is responsible for this. (And I
assume that brcfmac belongs to the former group.) Ideally it would be
nice that we would have a same configuration knob for both but I don't
know if that's really feasible.

--
Kalle Valo

2015-12-02 15:12:49

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On Wed, Dec 02, 2015 at 02:32:55PM +0100, Arend van Spriel wrote:
> On 12/01/2015 12:08 PM, Jouni Malinen wrote:
> >I would like to see this as a new attribute to NL80211_CMD_CONNECT to
> >provide parameters for offloaded (driver and/or firmware) BSS selection
> >and roaming. If there is a driver that uses roaming offload with
> >NL80211_CMD_ASSOCIATE, the same attribute could be used there (but I'm
> >not sure how exact such offloading would work in practice since I'd
> >expect both authentication and (re)association to be offloaded).
>
> Sounds reasonable. Just would like to explore the use-case a bit
> more. Looking at tools like NetworkManager and android network list,
> the user is always presented with just SSID listed once. For
> NetworkManager details can be configured for a connection and the
> bss selection parameters could be one of those. What level of detail
> would be needed there. Not saying we can not have more detail in the
> nl80211 API.

As far as wpa_supplicant is concerned, I'm thinking of having a "global
parameter" as the default and option to have per-network override. For
most end user GUI things, I'm not sure there would be much to expose
(i.e., seems reasonable to prefer 5 GHz nowadays by default). For an
advanced UI, there could be an option to toggle this type of information
on/off or even give more details like how many dB to prefer.

> So does the driver need to advertise support for bss selection
> parameters or can it simply ignore the parameters. Assuming the
> latter for now.

I thought about this a bit and did not ask for such advertisement since
I didn't see how wpa_supplicant would behave any differently based on
the knowledge.. That said, if someone does think of exposing this in an
UI to a real end user, it would be convenient to have means for
determining whether the parameter is really supported. However, I'm not
sure vendors would provide the exact same set of configuration
parameters for this type of preferences for offloaded roaming, so coming
up with a generic and detailed advertisement can be a bit difficult.
Yes/no advertisement of something along the lines of preference for 5
GHz might be easier to handle.

--
Jouni Malinen PGP id EFC895FA

2015-12-01 11:08:31

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
> Arend van Spriel <[email protected]> writes:
> > It solves a problem for us, but admittedly it is not something that is
> > very usable by user-space apps. So I guess what you are suggesting
> > here is to come up with a nl80211 api for this. On the mailing list
> > (or hostap list) the topic pops up from time to time so there are
> > people who would like to have such a knob to play with. Still would
> > like to keep the module parameter although its use may change when
> > nl80211 api is added.
>
> I don't know what is the best approach, that's why I would like to hear
> opinions from others. Personally I don't like the idea of adding 802.11
> level configuration options to module parameters, but on the other hand
> I don't have any strong opinions about this.

I would like to see this as a new attribute to NL80211_CMD_CONNECT to
provide parameters for offloaded (driver and/or firmware) BSS selection
and roaming. If there is a driver that uses roaming offload with
NL80211_CMD_ASSOCIATE, the same attribute could be used there (but I'm
not sure how exact such offloading would work in practice since I'd
expect both authentication and (re)association to be offloaded).

> I guess we have two different designs, one where the roaming logic is in
> firmware and other where wpasupplicant is responsible for this. (And I
> assume that brcfmac belongs to the former group.) Ideally it would be
> nice that we would have a same configuration knob for both but I don't
> know if that's really feasible.

Both of these would work as long as wpa_supplicant has means for
providing such configuration to the driver in a generic manner. That
NL80211_CMD_CONNECT extension with a new optional attribute would be
such a generic design.

--
Jouni Malinen PGP id EFC895FA

2015-12-01 08:34:01

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

On 11/30/2015 11:58 AM, Kalle Valo wrote:
> Arend van Spriel <[email protected]> writes:
>
>> From: Hante Meuleman <[email protected]>
>>
>> By default the 5G band has an advantage of 8 dBm on the RSSI when
>> it comes to selection during join and roam. This patch adds a
>> module param to make this value configurable. Using the value 99
>> results in configuration that 5G has always preference over 2.4G.
>>
>> Reviewed-by: Arend Van Spriel <[email protected]>
>> Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
>> Reviewed-by: Pieter-Paul Giesberts <[email protected]>
>> Signed-off-by: Hante Meuleman <[email protected]>
>> Signed-off-by: Arend van Spriel <[email protected]>
>
> [...]
>
>> +/* Module param joinboost_5g used for preferred join selection.
>> + * Use value 99 to configure preferred join to choose 5G always over 2.4G, any
>> + * other value configures the advantage of 5G signal strength over 2.4G signal
>> + * strength.
>> + */
>> +static int brcmf_joinboost_5g_rssi = BRCMF_JOIN_PREF_RSSI_BOOST;
>> +module_param_named(joinboost_5g, brcmf_joinboost_5g_rssi, int, 0);
>> +MODULE_PARM_DESC(joinboost_5g, "Join preference 5G RSSI boost");
>
> I'm not sure here, is a module parameter really the right way to
> configure something like this?

Define "right way". It solves a problem for us, but admittedly it is not
something that is very usable by user-space apps. So I guess what you
are suggesting here is to come up with a nl80211 api for this. On the
mailing list (or hostap list) the topic pops up from time to time so
there are people who would like to have such a knob to play with. Still
would like to keep the module parameter although its use may change when
nl80211 api is added.

Regards,
Arend

2015-12-02 18:00:29

by Paul Stewart

[permalink] [raw]
Subject: Re: [PATCH 08/11] brcmfmac: Make 5G join preference configurable.

>From my perspective it is useful to have the driver express whether
or not it supports this parameter. It may not change how the system
operates, but it will be useful in testing to determine whether it
is expected that a (given version of a) driver is expected to act
with respect to this property so we can flag issues with the
implementation.

On Wed, Dec 2, 2015 at 8:38 AM, Dan Williams <[email protected]> wrote:
> On Wed, 2015-12-02 at 14:32 +0100, Arend van Spriel wrote:
>> On 12/01/2015 12:08 PM, Jouni Malinen wrote:
>> > On Tue, Dec 01, 2015 at 11:48:32AM +0200, Kalle Valo wrote:
>> > > Arend van Spriel <[email protected]> writes:
>> > > > It solves a problem for us, but admittedly it is not something
>> > > > that is
>> > > > very usable by user-space apps. So I guess what you are
>> > > > suggesting
>> > > > here is to come up with a nl80211 api for this. On the mailing
>> > > > list
>> > > > (or hostap list) the topic pops up from time to time so there
>> > > > are
>> > > > people who would like to have such a knob to play with. Still
>> > > > would
>> > > > like to keep the module parameter although its use may change
>> > > > when
>> > > > nl80211 api is added.
>> > >
>> > > I don't know what is the best approach, that's why I would like
>> > > to hear
>> > > opinions from others. Personally I don't like the idea of adding
>> > > 802.11
>> > > level configuration options to module parameters, but on the
>> > > other hand
>> > > I don't have any strong opinions about this.
>> >
>> > I would like to see this as a new attribute to NL80211_CMD_CONNECT
>> > to
>> > provide parameters for offloaded (driver and/or firmware) BSS
>> > selection
>> > and roaming. If there is a driver that uses roaming offload with
>> > NL80211_CMD_ASSOCIATE, the same attribute could be used there (but
>> > I'm
>> > not sure how exact such offloading would work in practice since I'd
>> > expect both authentication and (re)association to be offloaded).
>>
>> Sounds reasonable. Just would like to explore the use-case a bit
>> more.
>> Looking at tools like NetworkManager and android network list, the
>> user
>> is always presented with just SSID listed once. For NetworkManager
>>
> While NM has band locking properties, there is currently no "prefer
> 5ghz" since as Jouni said, the supplicant should probably just prefer
> 5ghz right now. In any case, the best path from an NM perspective
> would be a supplicant per-network property that would then be sent for
> CONNECT-capable drivers, or which the supplicant would manually handle
> for softmac drivers through its existing AP selection code.
>
> Dan
>
>> details can be configured for a connection and the bss selection
>> parameters could be one of those. What level of detail would be
>> needed
>> there. Not saying we can not have more detail in the nl80211 API.
>>
>> > > I guess we have two different designs, one where the roaming
>> > > logic is in
>> > > firmware and other where wpasupplicant is responsible for this.
>> > > (And I
>> > > assume that brcfmac belongs to the former group.) Ideally it
>> > > would be
>> > > nice that we would have a same configuration knob for both but I
>> > > don't
>> > > know if that's really feasible.
>> >
>> > Both of these would work as long as wpa_supplicant has means for
>> > providing such configuration to the driver in a generic manner.
>> > That
>> > NL80211_CMD_CONNECT extension with a new optional attribute would
>> > be
>> > such a generic design.
>>
>> So does the driver need to advertise support for bss selection
>> parameters or can it simply ignore the parameters. Assuming the
>> latter
>> for now.
>>
>> Regards,
>> Arend
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux
>> -wireless" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html