Skip to contentSkip to conversation

staging: brcm80211: 6th reaction for mainline patch #2

PATCH New Franky Lin 1 participant 20 messages Sep 16, 2011 Staging

lore
Share & tools
lore

Franky Lin

author
#0 lore raw

cover staging: brcm80211: 6th reaction for mainline patch #2

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(-)
author
#1 lore raw

PATCH 1/19 staging: brcm80211: remove SOFTAP code from fullmac

Dead code removal.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h       |   12 ------------
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c |   21 ---------------------
 2 files changed, 0 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -12
index 8898370..c351349 100644
@@ -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)
 {
 }
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -21
index 26a39ee..8286885 100644
@@ -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 */
 	}
 }
 
Signature · 1 line
1.7.1
author
#2 lore raw

PATCH 2/19 staging: brcm80211: remove fullmac module_param sd_f2_blocksize

In reply to Franky Lin

Replaced the global variable with macro.

---
 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(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +0 -4
index 26919f1..d9d1592 100644
@@ -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);
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +5 -5
index 7cb8f3f..65cd5d7 100644
@@ -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;
 	}
 
drivers/staging/brcm80211/brcmfmac/sdio_host.h +0 -2
index c67e1c8..fb5f6b5 100644
@@ -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);
Signature · 1 line
1.7.1
author
#3 lore raw

PATCH 3/19 staging: brcm80211: remove fullmac module_param brcmf_deferred_tx

In reply to Franky Lin

Remove brcmf_deferred_tx as it should be always 1

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |   83 +++++++-----------------
 1 files changed, 24 insertions(+), 59 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +24 -59
index 680b232..dade3ec 100644
@@ -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");
Signature · 1 line
1.7.1
author
#15 lore raw

PATCH 15/19 staging: brcm80211: remove brcmfmac interface name override

In reply to Franky Lin

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.

---
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c |   28 ++++++------------------
 1 files changed, 7 insertions(+), 21 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +7 -21
index 643c9c2..9919fa5 100644
@@ -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;
Signature · 1 line
1.7.1
author
#17 lore raw

PATCH 17/19 staging: brcm80211: remove global variable from bcmsdh_sdmmc.c

In reply to Franky Lin

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.

---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   21 ++++++++++-----------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    5 +++++
 2 files changed, 15 insertions(+), 11 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +10 -11
index 65cd5d7..443e3a8 100644
@@ -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) {
drivers/staging/brcm80211/brcmfmac/sdio_host.h +5 -0
index fb5f6b5..397ad48 100644
@@ -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. */
Signature · 1 line
1.7.1
author
#4 lore raw

PATCH 4/19 staging: brcm80211: remove fullmac module_param for packet filter feature

In reply to Franky Lin

Use constant values for packet filter configuration

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -9
index c351349..329851c 100644
@@ -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;
 
drivers/staging/brcm80211/brcmfmac/dhd_common.c +4 -9
index fd39998..5ae4a40 100644
@@ -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);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -12
index 8286885..8e729d8 100644
@@ -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;
 
Signature · 1 line
1.7.1
author
#5 lore raw

PATCH 5/19 staging: brcm80211: remove global variable brcmf_roam from fullmac

In reply to Franky Lin

Remove unnecessary global variable

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -3
index 329851c..5316df9 100644
@@ -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 */
drivers/staging/brcm80211/brcmfmac/dhd_common.c +2 -1
index 5ae4a40..c02c8cd 100644
@@ -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));
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -3
index 8e729d8..f462a5f 100644
@@ -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;
 
Signature · 1 line
1.7.1
author
#6 lore raw

PATCH 6/19 staging: brcm80211: remove global variable brcmf_radio_up from fullmac

In reply to Franky Lin

Remove unnecessary global variable

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -3
index 5316df9..2967ada 100644
@@ -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;
 
drivers/staging/brcm80211/brcmfmac/dhd_common.c +1 -3
index c02c8cd..2e8db62 100644
@@ -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,
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -3
index f462a5f..16f7216 100644
@@ -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);
Signature · 1 line
1.7.1
author
#7 lore raw

PATCH 7/19 staging: brcm80211: simplified brcmf_proto_ioctl()

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Removed a function parameter since it was redundant.

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +6 -6
index f8731c8..0d8389e 100644
@@ -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);
 	}
 
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +8 -9
index 16f7216..ca42883 100644
@@ -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)
drivers/staging/brcm80211/brcmfmac/dhd_proto.h +1 -1
index 6686f4c..24b0f99 100644
@@ -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);
Signature · 1 line
1.7.1
author
#8 lore raw

PATCH 8/19 staging: brcm80211: removed set_fs/get_fs/get_ds calls from brcmf_dev_ioctl()

In reply to Franky Lin

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.

---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +0 -4
index 1f736ea..c4a8117 100644
@@ -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;
 }
Signature · 1 line
1.7.1
author
#9 lore raw

PATCH 9/19 staging: brcm80211: fixed sparse endianness warnings on fullmac scan pars

In reply to Franky Lin

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.

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +14 -19
index 2967ada..e1d7c57 100644
@@ -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;
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +27 -32

113 lines not on this page · raw message

drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +1 -1
index db71762..7a8c671 100644
@@ -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 */
Signature · 1 line
1.7.1
author
#10 lore raw

PATCH 10/19 staging: brcm80211: fixed sparse endianness warnings on fullmac assoc pars

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Structures that are sent to the dongle have been annotated.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |   10 ++--
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   63 ++++++++++------------
 2 files changed, 34 insertions(+), 39 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +5 -5
index e1d7c57..c34cc7b 100644
@@ -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 */
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +29 -34

120 lines not on this page · raw message

Signature · 1 line
1.7.1
author
#11 lore raw

PATCH 11/19 staging: brcm80211: fixed sparse endianness warnings on fullmac scb pars

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Structure that is sent to the dongle has been annotated.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |    4 ++--
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   13 ++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +2 -2
index c34cc7b..af0ad1f 100644
@@ -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];
 };
 
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +6 -7
index 67955d3..3b0c1a3 100644
@@ -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);
 
Signature · 1 line
1.7.1
author
#12 lore raw

PATCH 12/19 staging: brcm80211: fixed sparse endianness warnings on fullmac ratespec

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Structure that is sent to the dongle has been annotated.

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +7 -0
index af0ad1f..e543640 100644
@@ -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];
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +5 -7
index 3b0c1a3..6ac4cc7 100644
@@ -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;
drivers/staging/brcm80211/brcmsmac/pub.h +7 -0
index c72f7b5..9670309 100644
@@ -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 */
drivers/staging/brcm80211/include/defs.h +0 -7
index 3438c54..1e5f310 100644
@@ -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
Signature · 1 line
1.7.1
author
#13 lore raw

PATCH 13/19 staging: brcm80211: remove _brcmf_sysioc_thread in fullmac

In reply to Franky Lin

_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.

---
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c |  159 ++++++------------------
 1 files changed, 39 insertions(+), 120 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +39 -120
index ca42883..3b2d500 100644
@@ -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);
 
Signature · 1 line
1.7.1
author
#18 lore raw

PATCH 18/19 staging: brcm80211: remove static global variables from dhd_sdio.c

In reply to Franky Lin

From: Arend van Spriel <[email protected]>

Several global variables that were set but never initialized have been removed.

---
 drivers/staging/brcm80211/brcmfmac/dhd_sdio.c |  161 ++++++++++--------------
 1 files changed, 67 insertions(+), 94 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +67 -94
index dade3ec..720f567 100644
@@ -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");
Signature · 1 line
1.7.1
author
#19 lore raw

PATCH 19/19 staging: brcm80211: sparse endianness warnings on fullmac bss info

In reply to Franky Lin

From: Roland Vossen <[email protected]>

Structure that is received from dongle has been annotated.

---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |   27 +++++++++++----------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   10 ++++----
 2 files changed, 19 insertions(+), 18 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +14 -13
index de3f914..da53dd0 100644
@@ -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 */
 };
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +5 -5
index 4f3e8b8..9e07f77 100644
@@ -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)
Signature · 1 line
1.7.1
author
#14 lore raw

PATCH 14/19 staging: brcm80211: remove fullmac module_param for ARP offload feature

In reply to Franky Lin

Use macro to replace global variable for ARP offload configuration

---
 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(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +0 -10
index e543640..de3f914 100644
@@ -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;
 
drivers/staging/brcm80211/brcmfmac/dhd_common.c +3 -3
index 2e8db62..02c022a 100644
@@ -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++) {
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +0 -9
index 3b2d500..643c9c2 100644
@@ -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);
Signature · 1 line
1.7.1
author
#16 lore raw

PATCH 16/19 staging: brcm80211: remove for_each_bss() macro from brcmfmac driver

In reply to Franky Lin

From: Arend van Spriel <[email protected]>

The macro was only used once in the code and has been removed for clarity reading the code.

---
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |    4 ++--
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h |    4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +2 -2
index 6ac4cc7..4f3e8b8 100644
@@ -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;
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +0 -4
index 7a8c671..d27d4e6 100644
@@ -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);
Signature · 1 line
1.7.1