Fullmac code clean up.
Arend van Spriel (4):
staging: brcm80211: remove brcmfmac interface name override
staging: brcm80211: remove for_each_bss() macro from brcmfmac driver
staging: brcm80211: remove global variable from bcmsdh_sdmmc.c
staging: brcm80211: remove static global variables from dhd_sdio.c
Franky Lin (8):
staging: brcm80211: remove SOFTAP code from fullmac
staging: brcm80211: remove fullmac module_param sd_f2_blocksize
staging: brcm80211: remove fullmac module_param brcmf_deferred_tx
staging: brcm80211: remove fullmac module_param for packet filter
feature
staging: brcm80211: remove global variable brcmf_roam from fullmac
staging: brcm80211: remove global variable brcmf_radio_up from
fullmac
staging: brcm80211: remove _brcmf_sysioc_thread in fullmac
staging: brcm80211: remove fullmac module_param for ARP offload
feature
Roland Vossen (7):
staging: brcm80211: simplified brcmf_proto_ioctl()
staging: brcm80211: removed set_fs/get_fs/get_ds calls from
brcmf_dev_ioctl()
staging: brcm80211: fixed sparse endianness warnings on fullmac scan
pars
staging: brcm80211: fixed sparse endianness warnings on fullmac assoc
pars
staging: brcm80211: fixed sparse endianness warnings on fullmac scb
pars
staging: brcm80211: fixed sparse endianness warnings on fullmac
ratespec
staging: brcm80211: sparse endianness warnings on fullmac bss info
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 4 -
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 31 ++--
drivers/staging/brcm80211/brcmfmac/dhd.h | 118 ++++-------
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 12 +-
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 26 +--
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 244 +++++----------------
drivers/staging/brcm80211/brcmfmac/dhd_proto.h | 2 +-
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 244 ++++++++-------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 7 +-
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 165 +++++++--------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 6 +-
drivers/staging/brcm80211/brcmsmac/pub.h | 7 +
drivers/staging/brcm80211/include/defs.h | 7 -
13 files changed, 302 insertions(+), 571 deletions(-)
From: Roland Vossen <[email protected]>
Structure that is sent to the dongle has been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 7 +++++++
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 12 +++++-------
drivers/staging/brcm80211/brcmsmac/pub.h | 7 +++++++
drivers/staging/brcm80211/include/defs.h | 7 -------
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index af0ad1f..e543640 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -400,6 +400,13 @@ struct brcmf_bss_info {
/* variable length Information Elements */
};
+struct brcm_rateset_le {
+ /* # rates in this set */
+ __le32 count;
+ /* rates in 500kbps units w/hi bit set if basic */
+ u8 rates[WL_NUMRATES];
+};
+
struct brcmf_ssid {
u32 SSID_len;
unsigned char SSID[32];
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 3b0c1a3..6ac4cc7 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1864,7 +1864,7 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr,
const struct cfg80211_bitrate_mask *mask)
{
- struct brcm_rateset rateset;
+ struct brcm_rateset_le rateset_le;
s32 rate;
s32 val;
s32 err_bg;
@@ -1878,15 +1878,13 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
/* addr param is always NULL. ignore it */
/* Get current rateset */
- err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset,
- sizeof(rateset));
+ err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset_le,
+ sizeof(rateset_le));
if (unlikely(err)) {
WL_ERR("could not get current rateset (%d)\n", err);
goto done;
}
- rateset.count = le32_to_cpu(rateset.count);
-
legacy = ffs(mask->control[IEEE80211_BAND_2GHZ].legacy & 0xFFFF);
if (!legacy)
legacy = ffs(mask->control[IEEE80211_BAND_5GHZ].legacy &
@@ -1894,9 +1892,9 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
val = wl_g_rates[legacy - 1].bitrate * 100000;
- if (val < rateset.count)
+ if (val < le32_to_cpu(rateset_le.count))
/* Select rate by rateset index */
- rate = rateset.rates[val] & 0x7f;
+ rate = rateset_le.rates[val] & 0x7f;
else
/* Specified rate in bps */
rate = val / 500000;
diff --git a/drivers/staging/brcm80211/brcmsmac/pub.h b/drivers/staging/brcm80211/brcmsmac/pub.h
index c72f7b5..9670309 100644
--- a/drivers/staging/brcm80211/brcmsmac/pub.h
+++ b/drivers/staging/brcm80211/brcmsmac/pub.h
@@ -101,6 +101,13 @@
#define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */
+struct brcm_rateset {
+ /* # rates in this set */
+ u32 count;
+ /* rates in 500kbps units w/hi bit set if basic */
+ u8 rates[WL_NUMRATES];
+};
+
struct brcms_c_rateset {
uint count; /* number of rates in rates[] */
/* rates in 500kbps units w/hi bit set if basic */
diff --git a/drivers/staging/brcm80211/include/defs.h b/drivers/staging/brcm80211/include/defs.h
index 3438c54..1e5f310 100644
--- a/drivers/staging/brcm80211/include/defs.h
+++ b/drivers/staging/brcm80211/include/defs.h
@@ -48,13 +48,6 @@
#define WL_NUMRATES 16 /* max # of rates in a rateset */
-struct brcm_rateset {
- /* # rates in this set */
- u32 count;
- /* rates in 500kbps units w/hi bit set if basic */
- u8 rates[WL_NUMRATES];
-};
-
#define BRCM_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */
#define BRCM_SET_CHANNEL 30
--
1.7.1
From: Arend van Spriel <[email protected]>
The source file contained some static global variables that were
needed per device handled by the driver. They have moved to the
struct brcmf_sdio_dev for that reason.
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 21 ++++++++++-----------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 5 +++++
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 65cd5d7..443e3a8 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -50,11 +50,6 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = {
};
MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
-static DECLARE_WAIT_QUEUE_HEAD(sdioh_request_byte_wait);
-static DECLARE_WAIT_QUEUE_HEAD(sdioh_request_word_wait);
-static DECLARE_WAIT_QUEUE_HEAD(sdioh_request_packet_wait);
-static DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait);
-
static bool
brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
{
@@ -66,12 +61,12 @@ brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
}
static void
-brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t wq)
+brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq)
{
#ifdef CONFIG_PM_SLEEP
int retry = 0;
while (atomic_read(&sdiodev->suspend) && retry++ != 30)
- wait_event_timeout(wq, false, HZ/100);
+ wait_event_timeout(*wq, false, HZ/100);
#endif
}
@@ -82,7 +77,7 @@ int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr);
- brcmf_pm_resume_wait(sdiodev, sdioh_request_byte_wait);
+ brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait);
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
if (rw) { /* CMD52 Write */
@@ -185,7 +180,7 @@ int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev,
brcmf_dbg(INFO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
rw, func, addr, nbytes);
- brcmf_pm_resume_wait(sdiodev, sdioh_request_word_wait);
+ brcmf_pm_resume_wait(sdiodev, &sdiodev->request_word_wait);
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
/* Claim host controller */
@@ -235,7 +230,7 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
brcmf_dbg(TRACE, "Enter\n");
- brcmf_pm_resume_wait(sdiodev, sdioh_request_packet_wait);
+ brcmf_pm_resume_wait(sdiodev, &sdiodev->request_packet_wait);
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
@@ -312,7 +307,7 @@ int brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
brcmf_dbg(TRACE, "Enter\n");
- brcmf_pm_resume_wait(sdiodev, sdioh_request_buffer_wait);
+ brcmf_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait);
if (brcmf_pm_resume_error(sdiodev))
return -EIO;
/* Case 1: we don't have a packet. */
@@ -529,6 +524,10 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
dev_set_drvdata(&func->card->dev, sdiodev);
atomic_set(&sdiodev->suspend, false);
+ init_waitqueue_head(&sdiodev->request_byte_wait);
+ init_waitqueue_head(&sdiodev->request_word_wait);
+ init_waitqueue_head(&sdiodev->request_packet_wait);
+ init_waitqueue_head(&sdiodev->request_buffer_wait);
}
if (func->num == 2) {
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index fb5f6b5..397ad48 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -130,6 +130,11 @@ struct brcmf_sdio_dev {
bool regfail; /* status of last reg_r/w call */
void *bus;
atomic_t suspend; /* suspend flag */
+ wait_queue_head_t request_byte_wait;
+ wait_queue_head_t request_word_wait;
+ wait_queue_head_t request_packet_wait;
+ wait_queue_head_t request_buffer_wait;
+
};
/* Register/deregister device interrupt handler. */
--
1.7.1
Use macro to replace global variable for ARP offload configuration
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 10 ----------
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 6 +++---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 9 ---------
3 files changed, 3 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index e543640..de3f914 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -665,16 +665,6 @@ struct bcmevent_name {
const char *name;
};
-/*
- * Insmod parameters for debug/test
- */
-
-/* ARP offload agent mode */
-extern uint brcmf_arp_mode;
-
-/* ARP offload enable */
-extern uint brcmf_arp_enable;
-
/* Override to force tx queueing all the time */
extern uint brcmf_force_tx_queueing;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 2e8db62..02c022a 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -30,6 +30,7 @@
#define DOT11_OUI_LEN 3
#define BCMILCP_BCM_SUBTYPE_EVENT 1
#define PKTFILTER_BUF_SIZE 2048
+#define BRCMF_ARPOL_MODE 0xb /* agent|snoop|peer_autoreply */
int brcmf_msg_level;
@@ -859,9 +860,8 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
(char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
/* Set and enable ARP offload feature */
- if (brcmf_arp_enable)
- brcmf_c_arp_offload_set(drvr, brcmf_arp_mode);
- brcmf_c_arp_offload_enable(drvr, brcmf_arp_enable);
+ brcmf_c_arp_offload_set(drvr, BRCMF_ARPOL_MODE);
+ brcmf_c_arp_offload_enable(drvr, true);
/* Set up pkt filter */
for (i = 0; i < drvr->pktfilter_count; i++) {
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 3b2d500..643c9c2 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -82,15 +82,6 @@ struct brcmf_info {
/* Error bits */
module_param(brcmf_msg_level, int, 0);
-/* ARP offload agent mode : Enable ARP Host Auto-Reply
-and ARP Peer Auto-Reply */
-uint brcmf_arp_mode = 0xb;
-module_param(brcmf_arp_mode, uint, 0);
-
-/* ARP offload enable */
-uint brcmf_arp_enable = true;
-module_param(brcmf_arp_enable, uint, 0);
-
/* Network inteface name */
char iface_name[IFNAMSIZ] = "wlan";
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
--
1.7.1
From: Roland Vossen <[email protected]>
Structure that is sent to the dongle has been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 4 ++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 13 ++++++-------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index c34cc7b..af0ad1f 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -535,8 +535,8 @@ struct brcmf_wsec_key_le {
};
/* Used to get specific STA parameters */
-struct brcmf_scb_val {
- u32 val;
+struct brcmf_scb_val_le {
+ __le32 val;
u8 ea[ETH_ALEN];
};
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 67955d3..3b0c1a3 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1327,7 +1327,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
u16 reason_code)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
- struct brcmf_scb_val scbval;
+ struct brcmf_scb_val_le scbval;
s32 err = 0;
WL_TRACE("Enter. Reason code = %d\n", reason_code);
@@ -1336,11 +1336,10 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status);
- scbval.val = reason_code;
memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN);
- scbval.val = cpu_to_le32(scbval.val);
+ scbval.val = cpu_to_le32(reason_code);
err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval,
- sizeof(struct brcmf_scb_val));
+ sizeof(struct brcmf_scb_val_le));
if (unlikely(err))
WL_ERR("error (%d)\n", err);
@@ -1771,7 +1770,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
u8 *mac, struct station_info *sinfo)
{
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
- struct brcmf_scb_val scb_val;
+ struct brcmf_scb_val_le scb_val;
int rssi;
s32 rate;
s32 err = 0;
@@ -1803,9 +1802,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
}
if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) {
- scb_val.val = 0;
+ scb_val.val = cpu_to_le32(0);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val,
- sizeof(struct brcmf_scb_val));
+ sizeof(struct brcmf_scb_val_le));
if (unlikely(err))
WL_ERR("Could not get rssi (%d)\n", err);
--
1.7.1
Dead code removal.
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 12 ------------
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 21 ---------------------
2 files changed, 0 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 8898370..c351349 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -707,18 +707,6 @@ static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr)
{
}
-static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr)
-{
-}
-
-static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr)
-{
-}
-
-static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr)
-{
-}
-
static inline void MUTEX_LOCK_WL_SCAN_SET_INIT(void)
{
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 26a39ee..8286885 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -314,10 +314,6 @@ _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
return ret;
}
-#ifdef SOFTAP
-static struct net_device *ap_net_dev;
-#endif
-
/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */
static void brcmf_op_if(struct brcmf_if *ifp)
{
@@ -357,18 +353,6 @@ static void brcmf_op_if(struct brcmf_if *ifp)
err);
ret = -EOPNOTSUPP;
} else {
-#ifdef SOFTAP
- /* semaphore that the soft AP CODE
- waits on */
- struct semaphore ap_eth_sema;
-
- /* save ptr to wl0.1 netdev for use
- in wl_iw.c */
- ap_net_dev = ifp->net;
- /* signal to the SOFTAP 'sleeper' thread,
- wl0.1 is ready */
- up(&ap_eth_sema);
-#endif
brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n",
current->pid, ifp->net->name);
ifp->state = 0;
@@ -395,11 +379,6 @@ static void brcmf_op_if(struct brcmf_if *ifp)
drvr_priv->iflist[ifp->idx] = NULL;
kfree(ifp);
-#ifdef SOFTAP
- if (ifp->net == ap_net_dev)
- ap_net_dev = NULL; /* NULL SOFTAP global
- wl0.1 as well */
-#endif /* SOFTAP */
}
}
--
1.7.1
From: Roland Vossen <[email protected]>
brcmf_dev_ioctl() does not provide a user space buffer to
brcmf_netdev_ioctl_priv. Hence these calls are not necessary.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 1f736ea..c4a8117 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -251,7 +251,6 @@ static s32
brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
{
struct brcmf_ioctl ioc;
- mm_segment_t fs;
s32 err = 0;
memset(&ioc, 0, sizeof(ioc));
@@ -259,10 +258,7 @@ brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
ioc.buf = arg;
ioc.len = len;
- fs = get_fs();
- set_fs(get_ds());
err = brcmf_netdev_ioctl_priv(dev, &ioc);
- set_fs(fs);
return err;
}
--
1.7.1
From: Roland Vossen <[email protected]>
Structures that are sent to the dongle have been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 10 ++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 63 ++++++++++------------
2 files changed, 34 insertions(+), 39 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index e1d7c57..c34cc7b 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -462,20 +462,20 @@ struct brcmf_scan_results {
};
/* used for association with a specific BSSID and chanspec list */
-struct brcmf_assoc_params {
+struct brcmf_assoc_params_le {
/* 00:00:00:00:00:00: broadcast scan */
u8 bssid[ETH_ALEN];
/* 0: all available channels, otherwise count of chanspecs in
* chanspec_list */
- s32 chanspec_num;
+ __le32 chanspec_num;
/* list of chanspecs */
- u16 chanspec_list[1];
+ __le16 chanspec_list[1];
};
/* used for join with or without a specific bssid and channel list */
struct brcmf_join_params {
- struct brcmf_ssid ssid;
- struct brcmf_assoc_params params;
+ struct brcmf_ssid_le ssid_le;
+ struct brcmf_assoc_params_le params_le;
};
/* size of brcmf_scan_results not including variable length array */
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 2dced70..67955d3 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -34,7 +34,7 @@
#include "wl_cfg80211.h"
#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
- (sizeof(struct brcmf_assoc_params) - sizeof(u16))
+ (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
@@ -777,10 +777,7 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
u16 chanspec = 0;
if (ch != 0) {
- join_params->params.chanspec_num = 1;
- join_params->params.chanspec_list[0] = ch;
-
- if (join_params->params.chanspec_list[0] <= CH_MAX_2G_CHANNEL)
+ if (ch <= CH_MAX_2G_CHANNEL)
chanspec |= WL_CHANSPEC_BAND_2G;
else
chanspec |= WL_CHANSPEC_BAND_5G;
@@ -789,19 +786,15 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
chanspec |= WL_CHANSPEC_CTL_SB_NONE;
*join_params_size += BRCMF_ASSOC_PARAMS_FIXED_SIZE +
- join_params->params.chanspec_num * sizeof(u16);
-
- join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK;
- join_params->params.chanspec_list[0] |= chanspec;
- join_params->params.chanspec_list[0] =
- cpu_to_le16(join_params->params.chanspec_list[0]);
+ sizeof(u16);
- join_params->params.chanspec_num =
- cpu_to_le32(join_params->params.chanspec_num);
+ chanspec |= (ch & WL_CHANSPEC_CHAN_MASK);
+ join_params->params_le.chanspec_list[0] = cpu_to_le16(chanspec);
+ join_params->params_le.chanspec_num = cpu_to_le32(1);
WL_CONN("join_params->params.chanspec_list[0]= %#X,"
"channel %d, chanspec %#X\n",
- join_params->params.chanspec_list[0], ch, chanspec);
+ chanspec, ch, chanspec);
}
}
@@ -833,6 +826,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
s32 err = 0;
s32 wsec = 0;
s32 bcnprd;
+ struct brcmf_ssid ssid;
WL_TRACE("Enter\n");
if (!check_sys_up(wiphy))
@@ -910,24 +904,24 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
memset(&join_params, 0, sizeof(struct brcmf_join_params));
/* SSID */
- join_params.ssid.SSID_len =
- (params->ssid_len > 32) ? 32 : params->ssid_len;
- memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len);
- join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
- join_params_size = sizeof(join_params.ssid);
- brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID);
+ ssid.SSID_len = min_t(u32, params->ssid_len, 32);
+ memcpy(ssid.SSID, params->ssid, ssid.SSID_len);
+ memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len);
+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
+ join_params_size = sizeof(join_params.ssid_le);
+ brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID);
/* BSSID */
if (params->bssid) {
- memcpy(join_params.params.bssid, params->bssid, ETH_ALEN);
- join_params_size = sizeof(join_params.ssid) +
- BRCMF_ASSOC_PARAMS_FIXED_SIZE;
+ memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
+ join_params_size = sizeof(join_params.ssid_le) +
+ BRCMF_ASSOC_PARAMS_FIXED_SIZE;
} else {
- memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
+ memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
}
brcmf_update_prof(cfg_priv, NULL,
- &join_params.params.bssid, WL_PROF_BSSID);
+ &join_params.params_le.bssid, WL_PROF_BSSID);
/* Channel */
if (params->channel) {
@@ -1244,6 +1238,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan = sme->channel;
struct brcmf_join_params join_params;
size_t join_params_size;
+ struct brcmf_ssid ssid;
s32 err = 0;
@@ -1299,19 +1294,19 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
}
memset(&join_params, 0, sizeof(join_params));
- join_params_size = sizeof(join_params.ssid);
+ join_params_size = sizeof(join_params.ssid_le);
- join_params.ssid.SSID_len =
- min(sizeof(join_params.ssid.SSID), sme->ssid_len);
- memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
- join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len);
- brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID);
+ ssid.SSID_len = min_t(u32, sizeof(ssid.SSID), sme->ssid_len);
+ memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len);
+ memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len);
+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
+ brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID);
- memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN);
+ memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
- if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN)
+ if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN)
WL_CONN("ssid \"%s\", len (%d)\n",
- join_params.ssid.SSID, join_params.ssid.SSID_len);
+ ssid.SSID, ssid.SSID_len);
brcmf_ch_to_chanspec(cfg_priv->channel,
&join_params, &join_params_size);
--
1.7.1
_brcmf_sysioc_thread is handling deferred jobs from 4 callers. Use
work queue to handle set_mac_address/set_multicast_list requests.
brcmf_add_if/brcmf_del_if never run in atomic context and can call
brcmf_op_if directly.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 159 ++++++------------------
1 files changed, 39 insertions(+), 120 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index ca42883..3b2d500 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -73,11 +73,8 @@ struct brcmf_info {
struct mutex proto_block;
- /* Thread to issue ioctl for multicast */
- struct task_struct *sysioc_tsk;
- wait_queue_head_t sysioc_waitq;
- bool set_multicast;
- bool set_macaddress;
+ struct work_struct setmacaddr_work;
+ struct work_struct multicast_work;
u8 macvalue[ETH_ALEN];
atomic_t pend_8021x_cnt;
};
@@ -85,10 +82,6 @@ struct brcmf_info {
/* Error bits */
module_param(brcmf_msg_level, int, 0);
-/* Spawn a thread for system ioctls (set mac, set mcast) */
-uint brcmf_sysioc = true;
-module_param(brcmf_sysioc, uint, 0);
-
/* ARP offload agent mode : Enable ARP Host Auto-Reply
and ARP Peer Auto-Reply */
uint brcmf_arp_mode = 0xb;
@@ -152,7 +145,7 @@ char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
return "<if_none>";
}
-static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
+static void _brcmf_set_multicast_list(struct work_struct *work)
{
struct net_device *dev;
struct netdev_hw_addr *ha;
@@ -163,7 +156,10 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
uint buflen;
int ret;
- dev = drvr_priv->iflist[ifidx]->net;
+ struct brcmf_info *drvr_priv = container_of(work, struct brcmf_info,
+ multicast_work);
+
+ dev = drvr_priv->iflist[0]->net;
cnt = netdev_mc_count(dev);
/* Determine initial value of allmulti flag */
@@ -175,7 +171,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
bufp = buf = kmalloc(buflen, GFP_ATOMIC);
if (!bufp) {
brcmf_dbg(ERROR, "%s: out of memory for mcast_list, cnt %d\n",
- brcmf_ifname(&drvr_priv->pub, ifidx), cnt);
+ brcmf_ifname(&drvr_priv->pub, 0), cnt);
return;
}
@@ -200,10 +196,10 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = buflen;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set mcast_list failed, cnt %d\n",
- brcmf_ifname(&drvr_priv->pub, ifidx), cnt);
+ brcmf_ifname(&drvr_priv->pub, 0), cnt);
allmulti = cnt ? true : allmulti;
}
@@ -218,7 +214,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
buf = kmalloc(buflen, GFP_ATOMIC);
if (!buf) {
brcmf_dbg(ERROR, "%s: out of memory for allmulti\n",
- brcmf_ifname(&drvr_priv->pub, ifidx));
+ brcmf_ifname(&drvr_priv->pub, 0));
return;
}
allmulti = cpu_to_le32(allmulti);
@@ -226,7 +222,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
if (!brcmu_mkiovar
("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
brcmf_dbg(ERROR, "%s: mkiovar failed for allmulti, datalen %d buflen %u\n",
- brcmf_ifname(&drvr_priv->pub, ifidx),
+ brcmf_ifname(&drvr_priv->pub, 0),
(int)sizeof(allmulti), buflen);
kfree(buf);
return;
@@ -238,10 +234,10 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = buflen;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set allmulti %d failed\n",
- brcmf_ifname(&drvr_priv->pub, ifidx),
+ brcmf_ifname(&drvr_priv->pub, 0),
le32_to_cpu(allmulti));
}
@@ -259,26 +255,30 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = sizeof(allmulti);
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set promisc %d failed\n",
- brcmf_ifname(&drvr_priv->pub, ifidx),
+ brcmf_ifname(&drvr_priv->pub, 0),
le32_to_cpu(allmulti));
}
}
-static int
-_brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
+static void
+_brcmf_set_mac_address(struct work_struct *work)
{
char buf[32];
struct brcmf_ioctl ioc;
int ret;
+ struct brcmf_info *drvr_priv = container_of(work, struct brcmf_info,
+ setmacaddr_work);
+
brcmf_dbg(TRACE, "enter\n");
- if (!brcmu_mkiovar("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) {
+ if (!brcmu_mkiovar("cur_etheraddr", (char *)drvr_priv->macvalue,
+ ETH_ALEN, buf, 32)) {
brcmf_dbg(ERROR, "%s: mkiovar failed for cur_etheraddr\n",
- brcmf_ifname(&drvr_priv->pub, ifidx));
- return -1;
+ brcmf_ifname(&drvr_priv->pub, 0));
+ return;
}
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = BRCMF_C_SET_VAR;
@@ -286,14 +286,15 @@ _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
ioc.len = 32;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0)
brcmf_dbg(ERROR, "%s: set cur_etheraddr failed\n",
- brcmf_ifname(&drvr_priv->pub, ifidx));
+ brcmf_ifname(&drvr_priv->pub, 0));
else
- memcpy(drvr_priv->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
+ memcpy(drvr_priv->iflist[0]->net->dev_addr,
+ drvr_priv->macvalue, ETH_ALEN);
- return ret;
+ return;
}
/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */
@@ -364,76 +365,8 @@ static void brcmf_op_if(struct brcmf_if *ifp)
}
}
-static int _brcmf_sysioc_thread(void *data)
-{
- struct brcmf_info *drvr_priv = (struct brcmf_info *) data;
- int i;
-#ifdef SOFTAP
- bool in_ap = false;
-#endif
- DECLARE_WAITQUEUE(wait, current);
- allow_signal(SIGTERM);
-
- add_wait_queue(&drvr_priv->sysioc_waitq, &wait);
- while (1) {
- prepare_to_wait(&drvr_priv->sysioc_waitq, &wait,
- TASK_INTERRUPTIBLE);
-
- /* wait for event */
- schedule();
-
- if (kthread_should_stop())
- break;
-
- for (i = 0; i < BRCMF_MAX_IFS; i++) {
- struct brcmf_if *ifentry = drvr_priv->iflist[i];
- if (ifentry) {
-#ifdef SOFTAP
- in_ap = (ap_net_dev != NULL);
-#endif /* SOFTAP */
- if (ifentry->state)
- brcmf_op_if(ifentry);
-#ifdef SOFTAP
- if (drvr_priv->iflist[i] == NULL) {
- brcmf_dbg(TRACE, "interface %d removed!\n",
- i);
- continue;
- }
-
- if (in_ap && drvr_priv->set_macaddress) {
- brcmf_dbg(TRACE, "attempt to set MAC for %s in AP Mode, blocked.\n",
- ifentry->net->name);
- drvr_priv->set_macaddress = false;
- continue;
- }
-
- if (in_ap && drvr_priv->set_multicast) {
- brcmf_dbg(TRACE, "attempt to set MULTICAST list for %s in AP Mode, blocked.\n",
- ifentry->net->name);
- drvr_priv->set_multicast = false;
- continue;
- }
-#endif /* SOFTAP */
- if (drvr_priv->set_multicast) {
- drvr_priv->set_multicast = false;
- _brcmf_set_multicast_list(drvr_priv, i);
- }
- if (drvr_priv->set_macaddress) {
- drvr_priv->set_macaddress = false;
- _brcmf_set_mac_address(drvr_priv, i,
- drvr_priv->macvalue);
- }
- }
- }
- }
- finish_wait(&drvr_priv->sysioc_waitq, &wait);
- return 0;
-}
-
static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
{
- int ret = 0;
-
struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev);
struct sockaddr *sa = (struct sockaddr *)addr;
int ifidx;
@@ -443,9 +376,8 @@ static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr)
return -1;
memcpy(&drvr_priv->macvalue, sa->sa_data, ETH_ALEN);
- drvr_priv->set_macaddress = true;
- wake_up(&drvr_priv->sysioc_waitq);
- return ret;
+ schedule_work(&drvr_priv->setmacaddr_work);
+ return 0;
}
static void brcmf_netdev_set_multicast_list(struct net_device *dev)
@@ -457,8 +389,7 @@ static void brcmf_netdev_set_multicast_list(struct net_device *dev)
if (ifidx == BRCMF_BAD_IF)
return;
- drvr_priv->set_multicast = true;
- wake_up(&drvr_priv->sysioc_waitq);
+ schedule_work(&drvr_priv->multicast_work);
}
int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf)
@@ -1056,7 +987,7 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net,
if (net == NULL) {
ifp->state = BRCMF_E_IF_ADD;
ifp->idx = ifidx;
- wake_up(&drvr_priv->sysioc_waitq);
+ brcmf_op_if(ifp);
} else
ifp->net = net;
@@ -1077,7 +1008,7 @@ void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx)
ifp->state = BRCMF_E_IF_DEL;
ifp->idx = ifidx;
- wake_up(&drvr_priv->sysioc_waitq);
+ brcmf_op_if(ifp);
}
struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
@@ -1148,17 +1079,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
goto fail;
}
- if (brcmf_sysioc) {
- init_waitqueue_head(&drvr_priv->sysioc_waitq);
- drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread,
- drvr_priv, "_brcmf_sysioc");
- if (IS_ERR(drvr_priv->sysioc_tsk)) {
- printk(KERN_WARNING
- "_brcmf_sysioc thread failed to start\n");
- drvr_priv->sysioc_tsk = NULL;
- }
- } else
- drvr_priv->sysioc_tsk = NULL;
+ INIT_WORK(&drvr_priv->setmacaddr_work, _brcmf_set_mac_address);
+ INIT_WORK(&drvr_priv->multicast_work, _brcmf_set_multicast_list);
/*
* Save the brcmf_info into the priv
@@ -1337,11 +1259,8 @@ void brcmf_detach(struct brcmf_pub *drvr)
unregister_netdev(ifp->net);
}
- if (drvr_priv->sysioc_tsk) {
- send_sig(SIGTERM, drvr_priv->sysioc_tsk, 1);
- kthread_stop(drvr_priv->sysioc_tsk);
- drvr_priv->sysioc_tsk = NULL;
- }
+ cancel_work_sync(&drvr_priv->setmacaddr_work);
+ cancel_work_sync(&drvr_priv->multicast_work);
brcmf_bus_detach(drvr);
--
1.7.1
Remove unnecessary global variable
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 3 ---
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 4 +---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 3 ---
3 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 5316df9..2967ada 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -673,9 +673,6 @@ extern uint brcmf_arp_mode;
/* ARP offload enable */
extern uint brcmf_arp_enable;
-/* Roaming mode control */
-extern uint brcmf_radio_up;
-
/* Override to force tx queueing all the time */
extern uint brcmf_force_tx_queueing;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index c02c8cd..2e8db62 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -845,9 +845,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
sizeof(iovbuf));
/* Force STA UP */
- if (brcmf_radio_up)
- brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up,
- sizeof(up));
+ brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up));
/* Setup event_msgs */
brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index f462a5f..16f7216 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -98,9 +98,6 @@ module_param(brcmf_arp_mode, uint, 0);
uint brcmf_arp_enable = true;
module_param(brcmf_arp_enable, uint, 0);
-/* Control radio state */
-uint brcmf_radio_up = 1;
-
/* Network inteface name */
char iface_name[IFNAMSIZ] = "wlan";
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
--
1.7.1
From: Arend van Spriel <[email protected]>
Several global variables that were set but never initialized have
been removed.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 161 ++++++++++--------------
1 files changed, 67 insertions(+), 94 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index dade3ec..720f567 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -761,26 +761,18 @@ module_param(brcmf_poll, uint, 0);
uint brcmf_intr = true;
module_param(brcmf_intr, uint, 0);
-/* IOCTL response timeout */
-static int brcmf_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT;
-
/* override the RAM size if possible */
#define DONGLE_MIN_MEMSIZE (128 * 1024)
int brcmf_dongle_memsize;
module_param(brcmf_dongle_memsize, int, 0);
-static bool brcmf_alignctl;
-
-static bool retrydata;
-#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)
-
-static const uint firstread = BRCMF_FIRSTREAD;
+#define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL)
/* Retry count for register access failures */
static const uint retry_limit = 2;
-/* Force even SD lengths (some host controllers mess up on odd bytes) */
-static bool forcealign;
+/* Limit on rounding up frames */
+static const uint max_roundup = 512;
#define ALIGNMENT 4
@@ -794,12 +786,6 @@ static void pkt_align(struct sk_buff *p, int len, int align)
__skb_trim(p, len);
}
-/* Limit on rounding up frames */
-static const uint max_roundup = 512;
-
-/* Try doing readahead */
-static bool brcmf_readahead;
-
/* To check if there's window offered */
static bool data_ok(struct brcmf_bus *bus)
{
@@ -1697,7 +1683,7 @@ static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition,
bool *pending)
{
DECLARE_WAITQUEUE(wait, current);
- int timeout = msecs_to_jiffies(brcmf_ioctl_timeout_msec);
+ int timeout = msecs_to_jiffies(IOCTL_RESP_TIMEOUT);
/* Wait until control frame is available */
add_wait_queue(&bus->ioctl_resp_wait, &wait);
@@ -1733,21 +1719,19 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
/* Set rxctl for frame (w/optional alignment) */
bus->rxctl = bus->rxbuf;
- if (brcmf_alignctl) {
- bus->rxctl += firstread;
- pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN);
- if (pad)
- bus->rxctl += (BRCMF_SDALIGN - pad);
- bus->rxctl -= firstread;
- }
+ bus->rxctl += BRCMF_FIRSTREAD;
+ pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN);
+ if (pad)
+ bus->rxctl += (BRCMF_SDALIGN - pad);
+ bus->rxctl -= BRCMF_FIRSTREAD;
/* Copy the already-read portion over */
- memcpy(bus->rxctl, hdr, firstread);
- if (len <= firstread)
+ memcpy(bus->rxctl, hdr, BRCMF_FIRSTREAD);
+ if (len <= BRCMF_FIRSTREAD)
goto gotpkt;
/* Raise rdlen to next SDIO block to avoid tail command */
- rdlen = len - firstread;
+ rdlen = len - BRCMF_FIRSTREAD;
if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {
pad = bus->blocksize - (rdlen % bus->blocksize);
if ((pad <= bus->roundup) && (pad < bus->blocksize) &&
@@ -1758,11 +1742,11 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
}
/* Satisfy length-alignment requirements */
- if (forcealign && (rdlen & (ALIGNMENT - 1)))
+ if (rdlen & (ALIGNMENT - 1))
rdlen = roundup(rdlen, ALIGNMENT);
/* Drop if the read is too big or it exceeds our maximum */
- if ((rdlen + firstread) > bus->drvr->maxctl) {
+ if ((rdlen + BRCMF_FIRSTREAD) > bus->drvr->maxctl) {
brcmf_dbg(ERROR, "%d-byte control read exceeds %d-byte buffer\n",
rdlen, bus->drvr->maxctl);
bus->drvr->rx_errors++;
@@ -1783,7 +1767,7 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
bus->sdiodev->sbwad,
SDIO_FUNC_2,
- F2SYNC, (bus->rxctl + firstread), rdlen,
+ F2SYNC, (bus->rxctl + BRCMF_FIRSTREAD), rdlen,
NULL);
bus->f2rxdata++;
@@ -1857,7 +1841,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
}
/* Try doing single read if we can */
- if (brcmf_readahead && bus->nextlen) {
+ if (bus->nextlen) {
u16 nextlen = bus->nextlen;
bus->nextlen = 0;
@@ -1871,7 +1855,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
(rdlen % bus->blocksize);
if ((pad <= bus->roundup)
&& (pad < bus->blocksize)
- && ((rdlen + pad + firstread) <
+ && ((rdlen + pad + BRCMF_FIRSTREAD) <
MAX_RX_DATASZ))
rdlen += pad;
} else if (rdlen % BRCMF_SDALIGN) {
@@ -2055,8 +2039,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
/* Read frame header (hardware and software) */
sdret = brcmf_sdcard_recv_buf(bus->sdiodev, bus->sdiodev->sbwad,
- SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
- NULL);
+ SDIO_FUNC_2, F2SYNC, bus->rxhdr,
+ BRCMF_FIRSTREAD, NULL);
bus->f2rxhdrs++;
if (sdret < 0) {
@@ -2162,24 +2146,24 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
SDPCM_GLOM_CHANNEL */
/* Length to read */
- rdlen = (len > firstread) ? (len - firstread) : 0;
+ rdlen = (len > BRCMF_FIRSTREAD) ? (len - BRCMF_FIRSTREAD) : 0;
/* May pad read to blocksize for efficiency */
if (bus->roundup && bus->blocksize &&
(rdlen > bus->blocksize)) {
pad = bus->blocksize - (rdlen % bus->blocksize);
if ((pad <= bus->roundup) && (pad < bus->blocksize) &&
- ((rdlen + pad + firstread) < MAX_RX_DATASZ))
+ ((rdlen + pad + BRCMF_FIRSTREAD) < MAX_RX_DATASZ))
rdlen += pad;
} else if (rdlen % BRCMF_SDALIGN) {
rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
}
/* Satisfy length-alignment requirements */
- if (forcealign && (rdlen & (ALIGNMENT - 1)))
+ if (rdlen & (ALIGNMENT - 1))
rdlen = roundup(rdlen, ALIGNMENT);
- if ((rdlen + firstread) > MAX_RX_DATASZ) {
+ if ((rdlen + BRCMF_FIRSTREAD) > MAX_RX_DATASZ) {
/* Too long -- skip this frame */
brcmf_dbg(ERROR, "too long: len %d rdlen %d\n",
len, rdlen);
@@ -2189,7 +2173,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
continue;
}
- pkt = brcmu_pkt_buf_get_skb(rdlen + firstread + BRCMF_SDALIGN);
+ pkt = brcmu_pkt_buf_get_skb(rdlen +
+ BRCMF_FIRSTREAD + BRCMF_SDALIGN);
if (!pkt) {
/* Give up on data, request rtx of events */
brcmf_dbg(ERROR, "brcmu_pkt_buf_get_skb failed: rdlen %d chan %d\n",
@@ -2200,7 +2185,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
}
/* Leave room for what we already read, and align remainder */
- skb_pull(pkt, firstread);
+ skb_pull(pkt, BRCMF_FIRSTREAD);
pkt_align(pkt, rdlen, BRCMF_SDALIGN);
/* Read the remaining frame data */
@@ -2221,8 +2206,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
}
/* Copy the already-read portion */
- skb_push(pkt, firstread);
- memcpy(pkt->data, bus->rxhdr, firstread);
+ skb_push(pkt, BRCMF_FIRSTREAD);
+ memcpy(pkt->data, bus->rxhdr, BRCMF_FIRSTREAD);
#ifdef BCMDBG
if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
@@ -2328,7 +2313,6 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
u8 *frame;
u16 len, pad = 0;
u32 swheader;
- uint retries = 0;
struct sk_buff *new;
int i;
@@ -2413,48 +2397,44 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
}
/* Some controllers have trouble with odd bytes -- round to even */
- if (forcealign && (len & (ALIGNMENT - 1)))
+ if (len & (ALIGNMENT - 1))
len = roundup(len, ALIGNMENT);
- do {
- ret = brcmf_sdbrcm_send_buf(bus, bus->sdiodev->sbwad,
- SDIO_FUNC_2, F2SYNC, frame,
- len, pkt);
- bus->f2txdata++;
+ ret = brcmf_sdbrcm_send_buf(bus, bus->sdiodev->sbwad,
+ SDIO_FUNC_2, F2SYNC, frame,
+ len, pkt);
+ bus->f2txdata++;
- if (ret < 0) {
- /* On failure, abort the command
- and terminate the frame */
- brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n",
- ret);
- bus->tx_sderrs++;
+ if (ret < 0) {
+ /* On failure, abort the command and terminate the frame */
+ brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n",
+ ret);
+ bus->tx_sderrs++;
- brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
- brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
- SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
- NULL);
- bus->f1regdata++;
-
- for (i = 0; i < 3; i++) {
- u8 hi, lo;
- hi = brcmf_sdcard_cfg_read(bus->sdiodev,
- SDIO_FUNC_1,
- SBSDIO_FUNC1_WFRAMEBCHI,
- NULL);
- lo = brcmf_sdcard_cfg_read(bus->sdiodev,
- SDIO_FUNC_1,
- SBSDIO_FUNC1_WFRAMEBCLO,
- NULL);
- bus->f1regdata += 2;
- if ((hi == 0) && (lo == 0))
- break;
- }
+ brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2);
+ brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
+ SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM,
+ NULL);
+ bus->f1regdata++;
+ for (i = 0; i < 3; i++) {
+ u8 hi, lo;
+ hi = brcmf_sdcard_cfg_read(bus->sdiodev,
+ SDIO_FUNC_1,
+ SBSDIO_FUNC1_WFRAMEBCHI,
+ NULL);
+ lo = brcmf_sdcard_cfg_read(bus->sdiodev,
+ SDIO_FUNC_1,
+ SBSDIO_FUNC1_WFRAMEBCLO,
+ NULL);
+ bus->f1regdata += 2;
+ if ((hi == 0) && (lo == 0))
+ break;
}
- if (ret == 0)
- bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
- } while ((ret < 0) && retrydata && retries++ < TXRETRIES);
+ }
+ if (ret == 0)
+ bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP;
done:
/* restore pkt buffer pointer before calling tx complete routine */
@@ -3259,16 +3239,14 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
len = (msglen += SDPCM_HDRLEN);
/* Add alignment padding (optional for ctl frames) */
- if (brcmf_alignctl) {
- doff = ((unsigned long)frame % BRCMF_SDALIGN);
- if (doff) {
- frame -= doff;
- len += doff;
- msglen += doff;
- memset(frame, 0, doff + SDPCM_HDRLEN);
- }
- /* precondition: doff < BRCMF_SDALIGN */
+ doff = ((unsigned long)frame % BRCMF_SDALIGN);
+ if (doff) {
+ frame -= doff;
+ len += doff;
+ msglen += doff;
+ memset(frame, 0, doff + SDPCM_HDRLEN);
}
+ /* precondition: doff < BRCMF_SDALIGN */
doff += SDPCM_HDRLEN;
/* Round send length to next SDIO block */
@@ -3281,7 +3259,7 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
}
/* Satisfy length-alignment requirements */
- if (forcealign && (len & (ALIGNMENT - 1)))
+ if (len & (ALIGNMENT - 1))
len = roundup(len, ALIGNMENT);
/* precondition: IS_ALIGNED((unsigned long)frame, 2) */
@@ -4825,14 +4803,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
*/
brcmf_txbound = BRCMF_TXBOUND;
brcmf_rxbound = BRCMF_RXBOUND;
- brcmf_alignctl = true;
- brcmf_readahead = true;
- retrydata = false;
brcmf_dongle_memsize = 0;
brcmf_txminmax = BRCMF_TXMINMAX;
- forcealign = true;
-
brcmf_c_init();
brcmf_dbg(TRACE, "Enter\n");
--
1.7.1
Remove unnecessary global variable
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 3 ---
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 3 ++-
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 3 ---
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 329851c..5316df9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -674,9 +674,6 @@ extern uint brcmf_arp_mode;
extern uint brcmf_arp_enable;
/* Roaming mode control */
-extern uint brcmf_roam;
-
-/* Roaming mode control */
extern uint brcmf_radio_up;
/* Override to force tx queueing all the time */
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 5ae4a40..c02c8cd 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -794,6 +794,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
char buf[128], *ptr;
u32 dongle_align = BRCMF_SDALIGN;
u32 glom = 0;
+ u32 roaming = 1;
uint bcn_timeout = 3;
int scan_assoc_time = 40;
int scan_unassoc_time = 40;
@@ -838,7 +839,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
/* Enable/Disable build-in roaming to allowed ext supplicant to take
of romaing */
- brcmu_mkiovar("roam_off", (char *)&brcmf_roam, 4,
+ brcmu_mkiovar("roam_off", (char *)&roaming, 4,
iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf));
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 8e729d8..f462a5f 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -98,9 +98,6 @@ module_param(brcmf_arp_mode, uint, 0);
uint brcmf_arp_enable = true;
module_param(brcmf_arp_enable, uint, 0);
-/* Contorl fw roaming */
-uint brcmf_roam = 1;
-
/* Control radio state */
uint brcmf_radio_up = 1;
--
1.7.1
Remove brcmf_deferred_tx as it should be always 1
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 83 +++++++-----------------
1 files changed, 24 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 680b232..dade3ec 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -721,10 +721,6 @@ static int qcount[NUMPRIO];
static int tx_packets[NUMPRIO];
#endif /* BCMDBG */
-/* Deferred transmit */
-uint brcmf_deferred_tx = 1;
-module_param(brcmf_deferred_tx, uint, 0);
-
/* Watchdog thread priority, -1 to use kernel timer */
int brcmf_watchdog_prio = 97;
module_param(brcmf_watchdog_prio, int, 0);
@@ -2845,63 +2841,33 @@ int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt)
/* Check for existing queue, current flow-control,
pending event, or pending clock */
- if (brcmf_deferred_tx || bus->fcstate || pktq_len(&bus->txq)
- || bus->dpc_sched || (!data_ok(bus))
- || (bus->flowcontrol & NBITVAL(prec))
- || (bus->clkstate != CLK_AVAIL)) {
- brcmf_dbg(TRACE, "deferring pktq len %d\n",
- pktq_len(&bus->txq));
- bus->fcqueued++;
-
- /* Priority based enq */
- spin_lock_bh(&bus->txqlock);
- if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) ==
- false) {
- skb_pull(pkt, SDPCM_HDRLEN);
- brcmf_txcomplete(bus->drvr, pkt, false);
- brcmu_pkt_buf_free_skb(pkt);
- brcmf_dbg(ERROR, "out of bus->txq !!!\n");
- ret = -ENOSR;
- } else {
- ret = 0;
- }
- spin_unlock_bh(&bus->txqlock);
+ brcmf_dbg(TRACE, "deferring pktq len %d\n", pktq_len(&bus->txq));
+ bus->fcqueued++;
+
+ /* Priority based enq */
+ spin_lock_bh(&bus->txqlock);
+ if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) == false) {
+ skb_pull(pkt, SDPCM_HDRLEN);
+ brcmf_txcomplete(bus->drvr, pkt, false);
+ brcmu_pkt_buf_free_skb(pkt);
+ brcmf_dbg(ERROR, "out of bus->txq !!!\n");
+ ret = -ENOSR;
+ } else {
+ ret = 0;
+ }
+ spin_unlock_bh(&bus->txqlock);
- if (pktq_len(&bus->txq) >= TXHI)
- brcmf_txflowcontrol(bus->drvr, 0, ON);
+ if (pktq_len(&bus->txq) >= TXHI)
+ brcmf_txflowcontrol(bus->drvr, 0, ON);
#ifdef BCMDBG
- if (pktq_plen(&bus->txq, prec) > qcount[prec])
- qcount[prec] = pktq_plen(&bus->txq, prec);
+ if (pktq_plen(&bus->txq, prec) > qcount[prec])
+ qcount[prec] = pktq_plen(&bus->txq, prec);
#endif
- /* Schedule DPC if needed to send queued packet(s) */
- if (brcmf_deferred_tx && !bus->dpc_sched) {
- bus->dpc_sched = true;
- brcmf_sdbrcm_sched_dpc(bus);
- }
- } else {
- /* Lock: we're about to use shared data/code (and SDIO) */
- brcmf_sdbrcm_sdlock(bus);
-
- /* Otherwise, send it now */
- bus_wake(bus);
- /* Make sure back plane ht clk is on, no pending allowed */
- brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, true);
-
- brcmf_dbg(TRACE, "calling txpkt\n");
- ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
- if (ret)
- bus->drvr->tx_errors++;
- else
- bus->drvr->dstats.tx_bytes += datalen;
-
- if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
- !bus->dpc_sched) {
- bus->activity = false;
- brcmf_sdbrcm_clkctl(bus, CLK_NONE, true);
- }
-
- brcmf_sdbrcm_sdunlock(bus);
+ /* Schedule DPC if needed to send queued packet(s) */
+ if (!bus->dpc_sched) {
+ bus->dpc_sched = true;
+ brcmf_sdbrcm_sched_dpc(bus);
}
return ret;
@@ -5013,8 +4979,7 @@ int brcmf_bus_register(void)
break;
/* If both watchdog and DPC are threads, TX must be deferred */
- if ((brcmf_watchdog_prio >= 0) && (brcmf_dpc_prio >= 0)
- && brcmf_deferred_tx)
+ if (brcmf_watchdog_prio >= 0 && brcmf_dpc_prio >= 0)
break;
brcmf_dbg(ERROR, "Invalid module parameters.\n");
--
1.7.1
From: Roland Vossen <[email protected]>
Removed a function parameter since it was redundant.
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 12 ++++++------
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 17 ++++++++---------
drivers/staging/brcm80211/brcmfmac/dhd_proto.h | 2 +-
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index f8731c8..0d8389e 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -271,7 +271,7 @@ done:
int
brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
- void *buf, int len)
+ int len)
{
struct brcmf_proto *prot = drvr->prot;
int ret = -1;
@@ -293,7 +293,7 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
(unsigned long)prot->lastcmd);
if ((ioc->cmd == BRCMF_C_SET_VAR) ||
(ioc->cmd == BRCMF_C_GET_VAR))
- brcmf_dbg(TRACE, "iovar cmd=%s\n", (char *)buf);
+ brcmf_dbg(TRACE, "iovar cmd=%s\n", (char *)ioc->buf);
goto done;
}
@@ -302,10 +302,10 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
prot->lastcmd = ioc->cmd;
if (ioc->set)
ret = brcmf_proto_cdc_set_ioctl(drvr, ifidx, ioc->cmd,
- buf, len);
+ ioc->buf, len);
else {
ret = brcmf_proto_cdc_query_ioctl(drvr, ifidx, ioc->cmd,
- buf, len);
+ ioc->buf, len);
if (ret > 0)
ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl);
}
@@ -321,12 +321,12 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
/* Intercept the wme_dp ioctl here */
if (!ret && ioc->cmd == BRCMF_C_SET_VAR &&
- !strcmp(buf, "wme_dp")) {
+ !strcmp(ioc->buf, "wme_dp")) {
int slen, val = 0;
slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int)))
- memcpy(&val, (char *)buf + slen, sizeof(int));
+ memcpy(&val, (char *)ioc->buf + slen, sizeof(int));
drvr->wme_dp = (u8) le32_to_cpu(val);
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 16f7216..ca42883 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -200,7 +200,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = buflen;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set mcast_list failed, cnt %d\n",
brcmf_ifname(&drvr_priv->pub, ifidx), cnt);
@@ -238,7 +238,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = buflen;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set allmulti %d failed\n",
brcmf_ifname(&drvr_priv->pub, ifidx),
@@ -259,7 +259,7 @@ static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx)
ioc.len = sizeof(allmulti);
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: set promisc %d failed\n",
brcmf_ifname(&drvr_priv->pub, ifidx),
@@ -286,7 +286,7 @@ _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr)
ioc.len = 32;
ioc.set = true;
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0)
brcmf_dbg(ERROR, "%s: set cur_etheraddr failed\n",
brcmf_ifname(&drvr_priv->pub, ifidx));
@@ -718,7 +718,7 @@ static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol)
ioc.set = false;
strcpy(buf, "toe_ol");
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
/* Check for older dongle image that doesn't support toe_ol */
if (ret == -EIO) {
@@ -756,7 +756,7 @@ static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
strcpy(buf, "toe_ol");
memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: could not set toe_ol: ret=%d\n",
brcmf_ifname(&drvr_priv->pub, ifidx), ret);
@@ -770,7 +770,7 @@ static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
strcpy(buf, "toe");
memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));
- ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len);
+ ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len);
if (ret < 0) {
brcmf_dbg(ERROR, "%s: could not set toe: ret=%d\n",
brcmf_ifname(&drvr_priv->pub, ifidx), ret);
@@ -963,8 +963,7 @@ int brcmf_netdev_ioctl_priv(struct net_device *net, struct brcmf_ioctl *ioc)
if (is_set_key_cmd)
brcmf_netdev_wait_pend8021x(net);
- bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx,
- ioc, ioc->buf, buflen);
+ bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, ioc, buflen);
done:
if (bcmerror > 0)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
index 6686f4c..24b0f99 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_proto.h
@@ -50,7 +50,7 @@ extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
/* Use protocol to issue ioctl to dongle */
extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx,
- struct brcmf_ioctl *ioc, void *buf, int len);
+ struct brcmf_ioctl *ioc, int len);
/* Update local copy of dongle statistics */
extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
--
1.7.1
From: Arend van Spriel <[email protected]>
The macro was only used once in the code and has been removed for
clarity reading the code.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 4 ++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 4 ----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 6ac4cc7..4f3e8b8 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1993,8 +1993,8 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
return -EOPNOTSUPP;
}
WL_SCAN("scanned AP count (%d)\n", bss_list->count);
- bi = next_bss(bss_list, bi);
- for_each_bss(bss_list, bi, i) {
+ for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) {
+ bi = next_bss(bss_list, bi);
err = brcmf_inform_single_bss(cfg_priv, bi);
if (unlikely(err))
break;
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 7a8c671..d27d4e6 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -362,10 +362,6 @@ static inline struct brcmf_bss_info *next_bss(struct brcmf_scan_results *list,
list->bss_info;
}
-#define for_each_bss(list, bss, __i) \
- for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, \
- bss = next_bss(list, bss))
-
extern struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev,
struct device *busdev,
void *data);
--
1.7.1
Use constant values for packet filter configuration
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 9 ---------
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 13 ++++---------
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 12 ------------
3 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index c351349..329851c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -673,15 +673,6 @@ extern uint brcmf_arp_mode;
/* ARP offload enable */
extern uint brcmf_arp_enable;
-/* Pkt filte enable control */
-extern uint brcmf_pkt_filter_enable;
-
-/* Pkt filter init setup */
-extern uint brcmf_pkt_filter_init;
-
-/* Pkt filter mode control */
-extern uint brcmf_master_mode;
-
/* Roaming mode control */
extern uint brcmf_roam;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index fd39998..5ae4a40 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -865,15 +865,10 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
brcmf_c_arp_offload_enable(drvr, brcmf_arp_enable);
/* Set up pkt filter */
- if (brcmf_pkt_filter_enable) {
- for (i = 0; i < drvr->pktfilter_count; i++) {
- brcmf_c_pktfilter_offload_set(drvr,
- drvr->pktfilter[i]);
- brcmf_c_pktfilter_offload_enable(drvr,
- drvr->pktfilter[i],
- brcmf_pkt_filter_init,
- brcmf_master_mode);
- }
+ for (i = 0; i < drvr->pktfilter_count; i++) {
+ brcmf_c_pktfilter_offload_set(drvr, drvr->pktfilter[i]);
+ brcmf_c_pktfilter_offload_enable(drvr, drvr->pktfilter[i],
+ 0, true);
}
brcmf_os_proto_unblock(drvr);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 8286885..8e729d8 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -98,18 +98,6 @@ module_param(brcmf_arp_mode, uint, 0);
uint brcmf_arp_enable = true;
module_param(brcmf_arp_enable, uint, 0);
-/* Global Pkt filter enable control */
-uint brcmf_pkt_filter_enable = true;
-module_param(brcmf_pkt_filter_enable, uint, 0);
-
-/* Pkt filter init setup */
-uint brcmf_pkt_filter_init;
-module_param(brcmf_pkt_filter_init, uint, 0);
-
-/* Pkt filter mode control */
-uint brcmf_master_mode = true;
-module_param(brcmf_master_mode, uint, 0);
-
/* Contorl fw roaming */
uint brcmf_roam = 1;
--
1.7.1
From: Arend van Spriel <[email protected]>
The brcmfmac had a module parameter which could be used to override
the name of the wireless net device name and it defaults to 'wlan'.
This is considered rather useless, because what is in a name.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Franky (Zhenhui) Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 28 ++++++------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 643c9c2..9919fa5 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -82,9 +82,6 @@ struct brcmf_info {
/* Error bits */
module_param(brcmf_msg_level, int, 0);
-/* Network inteface name */
-char iface_name[IFNAMSIZ] = "wlan";
-module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net)
{
@@ -311,10 +308,11 @@ static void brcmf_op_if(struct brcmf_if *ifp)
unregister_netdev(ifp->net);
free_netdev(ifp->net);
}
- /* Allocate etherdev, including space for private structure */
- ifp->net = alloc_etherdev(sizeof(drvr_priv));
+ /* Allocate netdev, including space for private structure */
+ ifp->net = alloc_netdev(sizeof(drvr_priv), "wlan%d",
+ ether_setup);
if (!ifp->net) {
- brcmf_dbg(ERROR, "OOM - alloc_etherdev\n");
+ brcmf_dbg(ERROR, "OOM - alloc_netdev\n");
ret = -ENOMEM;
}
if (ret == 0) {
@@ -1009,10 +1007,10 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
brcmf_dbg(TRACE, "Enter\n");
- /* Allocate etherdev, including space for private structure */
- net = alloc_etherdev(sizeof(drvr_priv));
+ /* Allocate netdev, including space for private structure */
+ net = alloc_netdev(sizeof(drvr_priv), "wlan%d", ether_setup);
if (!net) {
- brcmf_dbg(ERROR, "OOM - alloc_etherdev\n");
+ brcmf_dbg(ERROR, "OOM - alloc_netdev\n");
goto fail;
}
@@ -1028,18 +1026,6 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)
*/
memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv));
- /* Set network interface name if it was provided as module parameter */
- if (iface_name[0]) {
- int len;
- char ch;
- strncpy(net->name, iface_name, IFNAMSIZ);
- net->name[IFNAMSIZ - 1] = 0;
- len = strlen(net->name);
- ch = net->name[len - 1];
- if ((ch > '9' || ch < '0') && (len < IFNAMSIZ - 2))
- strcat(net->name, "%d");
- }
-
if (brcmf_add_if(drvr_priv, 0, net, net->name, NULL, 0, 0) ==
BRCMF_BAD_IF)
goto fail;
--
1.7.1
Replaced the global variable with macro.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 4 ----
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 10 +++++-----
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 2 --
3 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 26919f1..d9d1592 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -37,10 +37,6 @@
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
-/* Module parameters specific to each host-controller driver */
-
-module_param(sd_f2_blocksize, int, 0);
-
static void brcmf_sdioh_irqhandler(struct sdio_func *func)
{
struct brcmf_sdio_dev *sdiodev = dev_get_drvdata(&func->card->dev);
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 7cb8f3f..65cd5d7 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -40,7 +40,8 @@
#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
-uint sd_f2_blocksize = 512; /* Default blocksize */
+#define SDIO_FUNC1_BLOCKSIZE 64
+#define SDIO_FUNC2_BLOCKSIZE 512
/* devices we support, null terminated */
static const struct sdio_device_id brcmf_sdmmc_ids[] = {
@@ -466,7 +467,7 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
sdiodev->num_funcs = 2;
sdio_claim_host(sdiodev->func[1]);
- err_ret = sdio_set_block_size(sdiodev->func[1], 64);
+ err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE);
sdio_release_host(sdiodev->func[1]);
if (err_ret) {
brcmf_dbg(ERROR, "Failed to set F1 blocksize\n");
@@ -474,11 +475,10 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
}
sdio_claim_host(sdiodev->func[2]);
- err_ret = sdio_set_block_size(sdiodev->func[2], sd_f2_blocksize);
+ err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE);
sdio_release_host(sdiodev->func[2]);
if (err_ret) {
- brcmf_dbg(ERROR, "Failed to set F2 blocksize to %d\n",
- sd_f2_blocksize);
+ brcmf_dbg(ERROR, "Failed to set F2 blocksize\n");
goto out;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index c67e1c8..fb5f6b5 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -244,8 +244,6 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
bool enable);
-extern uint sd_f2_blocksize;
-
extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
u32 regsva, struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdbrcm_disconnect(void *ptr);
--
1.7.1
From: Roland Vossen <[email protected]>
Structure that is received from dongle has been annotated.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 27 +++++++++++----------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 10 ++++----
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index de3f914..da53dd0 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -366,36 +366,37 @@ struct brcmf_pkt_filter_enable {
* next bss_info structure in a vector (in struct brcmf_scan_results)
*/
struct brcmf_bss_info {
- u32 version; /* version field */
- u32 length; /* byte length of data in this record,
+ __le32 version; /* version field */
+ __le32 length; /* byte length of data in this record,
* starting at version and including IEs
*/
u8 BSSID[ETH_ALEN];
- u16 beacon_period; /* units are Kusec */
- u16 capability; /* Capability information */
+ __le16 beacon_period; /* units are Kusec */
+ __le16 capability; /* Capability information */
u8 SSID_len;
u8 SSID[32];
struct {
- uint count; /* # rates in this set */
+ __le32 count; /* # rates in this set */
u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
} rateset; /* supported rates */
- u16 chanspec; /* chanspec for bss */
- u16 atim_window; /* units are Kusec */
+ __le16 chanspec; /* chanspec for bss */
+ __le16 atim_window; /* units are Kusec */
u8 dtim_period; /* DTIM period */
- s16 RSSI; /* receive signal strength (in dBm) */
+ __le16 RSSI; /* receive signal strength (in dBm) */
s8 phy_noise; /* noise (in dBm) */
u8 n_cap; /* BSS is 802.11N Capable */
- u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
+ /* 802.11N BSS Capabilities (based on HT_CAP_*): */
+ __le32 nbss_cap;
u8 ctl_ch; /* 802.11N BSS control channel number */
- u32 reserved32[1]; /* Reserved for expansion of BSS properties */
+ __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
u8 flags; /* flags */
u8 reserved[3]; /* Reserved for expansion of BSS properties */
u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
- u16 ie_offset; /* offset at which IEs start, from beginning */
- u32 ie_length; /* byte length of Information Elements */
- s16 SNR; /* average SNR of during frame reception */
+ __le16 ie_offset; /* offset at which IEs start, from beginning */
+ __le32 ie_length; /* byte length of Information Elements */
+ __le16 SNR; /* average SNR of during frame reception */
/* Add new fields here */
/* variable length Information Elements */
};
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 4f3e8b8..9e07f77 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1955,7 +1955,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv,
notify_capability = le16_to_cpu(bi->capability);
notify_interval = le16_to_cpu(bi->beacon_period);
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
- notify_ielen = le16_to_cpu(bi->ie_length);
+ notify_ielen = le32_to_cpu(bi->ie_length);
notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
WL_CONN("bssid: %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
@@ -2054,7 +2054,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
notify_capability = le16_to_cpu(bi->capability);
notify_interval = le16_to_cpu(bi->beacon_period);
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
- notify_ielen = le16_to_cpu(bi->ie_length);
+ notify_ielen = le32_to_cpu(bi->ie_length);
notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
WL_CONN("channel: %d(%d)\n", channel, freq);
@@ -2111,9 +2111,9 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
if (unlikely(err))
goto update_bss_info_out;
- ie = ((u8 *)bi) + bi->ie_offset;
- ie_len = bi->ie_length;
- beacon_interval = cpu_to_le16(bi->beacon_period);
+ ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset);
+ ie_len = le32_to_cpu(bi->ie_length);
+ beacon_interval = le16_to_cpu(bi->beacon_period);
tim = brcmu_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
if (tim)
--
1.7.1
From: Roland Vossen <[email protected]>
Three structures that are sent to the dongle have been annotated for correct
endianness: struct brcmf_iscan_params, brcmf_scan_params,
brcmf_cfg80211_scan_req.
Reported-by: Johannes Berg <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Franky Lin <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 33 +++++-------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 59 ++++++++++------------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 2 +-
3 files changed, 42 insertions(+), 52 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 2967ada..e1d7c57 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -410,24 +410,24 @@ struct brcmf_ssid_le {
unsigned char SSID[32];
};
-struct brcmf_scan_params {
- struct brcmf_ssid ssid; /* default: {0, ""} */
+struct brcmf_scan_params_le {
+ struct brcmf_ssid_le ssid_le; /* default: {0, ""} */
u8 bssid[ETH_ALEN]; /* default: bcast */
s8 bss_type; /* default: any,
* DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
*/
u8 scan_type; /* flags, 0 use default */
- s32 nprobes; /* -1 use default, number of probes per channel */
- s32 active_time; /* -1 use default, dwell time per channel for
+ __le32 nprobes; /* -1 use default, number of probes per channel */
+ __le32 active_time; /* -1 use default, dwell time per channel for
* active scanning
*/
- s32 passive_time; /* -1 use default, dwell time per channel
+ __le32 passive_time; /* -1 use default, dwell time per channel
* for passive scanning
*/
- s32 home_time; /* -1 use default, dwell time for the home channel
- * between channel scans
+ __le32 home_time; /* -1 use default, dwell time for the
+ * home channel between channel scans
*/
- s32 channel_num; /* count of channels and ssids that follow
+ __le32 channel_num; /* count of channels and ssids that follow
*
* low half is count of channels in
* channel_list, 0 means default (use all
@@ -443,22 +443,17 @@ struct brcmf_scan_params {
* fixed parameter portion is assumed, otherwise
* ssid in the fixed portion is ignored
*/
- u16 channel_list[1]; /* list of chanspecs */
+ __le16 channel_list[1]; /* list of chanspecs */
};
/* incremental scan struct */
-struct brcmf_iscan_params {
- u32 version;
- u16 action;
- u16 scan_duration;
- struct brcmf_scan_params params;
+struct brcmf_iscan_params_le {
+ __le32 version;
+ __le16 action;
+ __le16 scan_duration;
+ struct brcmf_scan_params_le params_le;
};
-/* 3 fields + size of brcmf_scan_params, not including variable length array */
-#define BRCMF_ISCAN_PARAMS_FIXED_SIZE \
- (offsetof(struct brcmf_iscan_params, params) + \
- sizeof(struct brcmf_ssid))
-
struct brcmf_scan_results {
u32 buflen;
u32 version;
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index c4a8117..2dced70 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -359,9 +359,10 @@ static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val)
s8 buf[BRCMF_C_IOCTL_SMLEN];
u32 len;
s32 err = 0;
+ __le32 val_le;
- val = cpu_to_le32(val);
- len = brcmu_mkiovar(name, (char *)(&val), sizeof(val), buf,
+ val_le = cpu_to_le32(val);
+ len = brcmu_mkiovar(name, (char *)(&val_le), sizeof(val_le), buf,
sizeof(buf));
BUG_ON(!len);
@@ -411,25 +412,19 @@ static void brcmf_set_mpc(struct net_device *ndev, int mpc)
}
}
-static void wl_iscan_prep(struct brcmf_scan_params *params,
+static void wl_iscan_prep(struct brcmf_scan_params_le *params_le,
struct brcmf_ssid *ssid)
{
- memcpy(params->bssid, ether_bcast, ETH_ALEN);
- params->bss_type = DOT11_BSSTYPE_ANY;
- params->scan_type = 0;
- params->nprobes = -1;
- params->active_time = -1;
- params->passive_time = -1;
- params->home_time = -1;
- params->channel_num = 0;
-
- params->nprobes = cpu_to_le32(params->nprobes);
- params->active_time = cpu_to_le32(params->active_time);
- params->passive_time = cpu_to_le32(params->passive_time);
- params->home_time = cpu_to_le32(params->home_time);
+ memcpy(params_le->bssid, ether_bcast, ETH_ALEN);
+ params_le->bss_type = DOT11_BSSTYPE_ANY;
+ params_le->scan_type = 0;
+ params_le->channel_num = 0;
+ params_le->nprobes = cpu_to_le32(-1);
+ params_le->active_time = cpu_to_le32(-1);
+ params_le->passive_time = cpu_to_le32(-1);
+ params_le->home_time = cpu_to_le32(-1);
if (ssid && ssid->SSID_len)
- memcpy(¶ms->ssid, ssid, sizeof(struct brcmf_ssid));
-
+ memcpy(¶ms_le->ssid_le, ssid, sizeof(struct brcmf_ssid));
}
static s32
@@ -460,9 +455,9 @@ static s32
brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
struct brcmf_ssid *ssid, u16 action)
{
- s32 params_size = (BRCMF_SCAN_PARAMS_FIXED_SIZE +
- offsetof(struct brcmf_iscan_params, params));
- struct brcmf_iscan_params *params;
+ s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
+ offsetof(struct brcmf_iscan_params_le, params_le);
+ struct brcmf_iscan_params_le *params;
s32 err = 0;
if (ssid && ssid->SSID_len)
@@ -472,13 +467,12 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
return -ENOMEM;
BUG_ON(params_size >= BRCMF_C_IOCTL_SMLEN);
- wl_iscan_prep(¶ms->params, ssid);
+ wl_iscan_prep(¶ms->params_le, ssid);
params->version = cpu_to_le32(BRCMF_ISCAN_REQ_VERSION);
params->action = cpu_to_le16(action);
params->scan_duration = cpu_to_le16(0);
- /* params_size += offsetof(struct brcmf_iscan_params, params); */
err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size,
iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN);
if (unlikely(err)) {
@@ -537,6 +531,7 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
bool iscan_req;
bool spec_scan;
s32 err = 0;
+ u32 SSID_len;
if (unlikely(test_bit(WL_STATUS_SCANNING, &cfg_priv->status))) {
WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status);
@@ -577,12 +572,12 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
} else {
WL_SCAN("ssid \"%s\", ssid_len (%d)\n",
ssids->ssid, ssids->ssid_len);
- memset(&sr->ssid, 0, sizeof(sr->ssid));
- sr->ssid.SSID_len =
- min_t(u8, sizeof(sr->ssid.SSID), ssids->ssid_len);
- if (sr->ssid.SSID_len) {
- memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len);
- sr->ssid.SSID_len = cpu_to_le32(sr->ssid.SSID_len);
+ memset(&sr->ssid_le, 0, sizeof(sr->ssid_le));
+ SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len);
+ sr->ssid_le.SSID_len = cpu_to_le32(0);
+ if (SSID_len) {
+ memcpy(sr->ssid_le.SSID, ssids->ssid, SSID_len);
+ sr->ssid_le.SSID_len = cpu_to_le32(SSID_len);
spec_scan = true;
} else {
WL_SCAN("Broadcast scan\n");
@@ -596,12 +591,12 @@ __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
goto scan_out;
}
brcmf_set_mpc(ndev, 0);
- err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid,
- sizeof(sr->ssid));
+ err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid_le,
+ sizeof(sr->ssid_le));
if (err) {
if (err == -EBUSY)
WL_INFO("system busy : scan for \"%s\" "
- "canceled\n", sr->ssid.SSID);
+ "canceled\n", sr->ssid_le.SSID);
else
WL_ERR("WLC_SCAN error (%d)\n", err);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index db71762..7a8c671 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -188,7 +188,7 @@ struct brcmf_cfg80211_dev {
/* basic structure of scan request */
struct brcmf_cfg80211_scan_req {
- struct brcmf_ssid ssid;
+ struct brcmf_ssid_le ssid_le;
};
/* basic structure of information element */
--
1.7.1