All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Enable cw1200 on >=2.6.34
@ 2013-08-17 13:02 Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 1/4] backport: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Solomon Peachy @ 2013-08-17 13:02 UTC (permalink / raw)
  To: backports

This superscedes the earlier patch set I posted when apparently sleep 
deprived.  It enables the cw1200_wlan_sdio driver to build cleanly on 
>=2.6.34 kernels, and the cw1200_wlan_spi driver to build cleanly on 
>=2.6.35 kernels.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] backport: Add an implementation of get_random_int() for <3.10 kernels.
  2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
@ 2013-08-17 13:02 ` Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Solomon Peachy @ 2013-08-17 13:02 UTC (permalink / raw)
  To: backports; +Cc: Solomon Peachy

get_random_int() was present, but simply not exported for use in modules
until 3.10.  Implement it in terms of the more expensive get_random_bytes()

This is needed by the cw1200 driver.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 backport/compat/backport-3.10.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c
index 980ed59..5273758 100644
--- a/backport/compat/backport-3.10.c
+++ b/backport/compat/backport-3.10.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/proc_fs.h>
+#include <linux/random.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
 #include <linux/init.h>
@@ -77,3 +78,15 @@ void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid)
 	de->gid = gid;
 }
 EXPORT_SYMBOL_GPL(proc_set_user);
+
+/* get_random_int() was not exported for module use until 3.10-rc.
+   Implement it here in terms of the more expensive get_random_bytes()
+ */
+unsigned int get_random_int(void)
+{
+	unsigned int r;
+	get_random_bytes(&r, sizeof(r));
+
+	return r;
+}
+EXPORT_SYMBOL_GPL(get_random_int);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] backports:  move the cw1200 sdio quirk into 26-sdio-quirks
  2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 1/4] backport: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
@ 2013-08-17 13:02 ` Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Solomon Peachy @ 2013-08-17 13:02 UTC (permalink / raw)
  To: backports; +Cc: Solomon Peachy

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 .../26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch | 15 +++++++++++++++
 .../network/75-cw1200-sdio-quirk/cw1200.patch             | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
 create mode 100644 patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
 delete mode 100644 patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch

diff --git a/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch b/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
new file mode 100644
index 0000000..2533051
--- /dev/null
+++ b/patches/collateral-evolutions/network/26-sdio-quirks/drivers_net_wireless_cw1200_sdio.patch
@@ -0,0 +1,15 @@
+--- a/drivers/net/wireless/cw1200/cw1200_sdio.c
++++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
+@@ -253,6 +253,12 @@ static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
+ 	else
+ 		size = sdio_align_size(self->func, size);
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
++	/* A quirk to handle this was committed in 3.2-rc */
++	if (size == SDIO_BLOCK_SIZE)
++		size += SDIO_BLOCK_SIZE;  /* HW bug; force use of block mode */
++#endif
++
+ 	return size;
+ }
+ 
diff --git a/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch b/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch
deleted file mode 100644
index 2533051..0000000
--- a/patches/collateral-evolutions/network/75-cw1200-sdio-quirk/cw1200.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/drivers/net/wireless/cw1200/cw1200_sdio.c
-+++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
-@@ -253,6 +253,12 @@ static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
- 	else
- 		size = sdio_align_size(self->func, size);
- 
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0))
-+	/* A quirk to handle this was committed in 3.2-rc */
-+	if (size == SDIO_BLOCK_SIZE)
-+		size += SDIO_BLOCK_SIZE;  /* HW bug; force use of block mode */
-+#endif
-+
- 	return size;
- }
- 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35
  2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 1/4] backport: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
@ 2013-08-17 13:02 ` Solomon Peachy
  2013-08-17 13:02 ` [PATCH v2 4/4] backports: cw1200 needs the multicast API changes to support <=2.6.35 Solomon Peachy
  2013-08-18 22:29 ` [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Hauke Mehrtens
  4 siblings, 0 replies; 7+ messages in thread
From: Solomon Peachy @ 2013-08-17 13:02 UTC (permalink / raw)
  To: backports; +Cc: Solomon Peachy

The new workqueue APIs in 2.6.36 allowed us to scrap the old kthread worker
that had been used; unfortunately the backported API isn't complete so
in order to support older kernels, resurrect this patch.

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 .../75-cw1200-workqueues/cw1200_workqueues.patch   | 133 +++++++++++++++++++++
 1 file changed, 133 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch

diff --git a/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch b/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch
new file mode 100644
index 0000000..3bf3197
--- /dev/null
+++ b/patches/collateral-evolutions/network/75-cw1200-workqueues/cw1200_workqueues.patch
@@ -0,0 +1,133 @@
+diff --git a/drivers/net/wireless/cw1200/bh.c b/drivers/net/wireless/cw1200/bh.c
+index c1ec2a4..5dcbb4e 100644
+--- a/drivers/net/wireless/cw1200/bh.c
++++ b/drivers/net/wireless/cw1200/bh.c
+@@ -48,16 +48,22 @@ enum cw1200_bh_pm_state {
+ typedef int (*cw1200_wsm_handler)(struct cw1200_common *priv,
+ 	u8 *data, size_t size);
+ 
++#ifndef CW1200_USE_COMPAT_KTHREAD
+ static void cw1200_bh_work(struct work_struct *work)
+ {
+ 	struct cw1200_common *priv =
+ 	container_of(work, struct cw1200_common, bh_work);
+ 	cw1200_bh(priv);
+ }
++#endif
+ 
+ int cw1200_register_bh(struct cw1200_common *priv)
+ {
+ 	int err = 0;
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct sched_param param = { .sched_priority = 1 };
++	BUG_ON(priv->bh_thread);
++#else
+ 	/* Realtime workqueue */
+ 	priv->bh_workqueue = alloc_workqueue("cw1200_bh",
+ 				WQ_MEM_RECLAIM | WQ_HIGHPRI
+@@ -67,6 +73,7 @@ int cw1200_register_bh(struct cw1200_common *priv)
+ 		return -ENOMEM;
+ 
+ 	INIT_WORK(&priv->bh_work, cw1200_bh_work);
++#endif
+ 
+ 	pr_debug("[BH] register.\n");
+ 
+@@ -81,20 +88,44 @@ int cw1200_register_bh(struct cw1200_common *priv)
+ 	init_waitqueue_head(&priv->bh_wq);
+ 	init_waitqueue_head(&priv->bh_evt_wq);
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	priv->bh_thread = kthread_create(&cw1200_bh, priv, "cw1200_bh");
++	if (IS_ERR(priv->bh_thread)) {
++		err = PTR_ERR(priv->bh_thread);
++		priv->bh_thread = NULL;
++	} else {
++		WARN_ON(sched_setscheduler(priv->bh_thread,
++					   SCHED_FIFO, &param));
++		wake_up_process(priv->bh_thread);
++	}
++#else
+ 	err = !queue_work(priv->bh_workqueue, &priv->bh_work);
+ 	WARN_ON(err);
++#endif
++
+ 	return err;
+ }
+ 
+ void cw1200_unregister_bh(struct cw1200_common *priv)
+ {
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct task_struct *thread = priv->bh_thread;
++	if (WARN_ON(!thread))
++		return;
++#endif
++
+ 	atomic_add(1, &priv->bh_term);
+ 	wake_up(&priv->bh_wq);
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	kthread_stop(thread);
++	priv->bh_thread = NULL;
++#else
+ 	flush_workqueue(priv->bh_workqueue);
+ 
+ 	destroy_workqueue(priv->bh_workqueue);
+ 	priv->bh_workqueue = NULL;
++#endif
+ 
+ 	pr_debug("[BH] unregistered.\n");
+ }
+@@ -614,6 +645,16 @@ static int cw1200_bh(void *arg)
+ 		pr_err("[BH] Fatal error, exiting.\n");
+ 		priv->bh_error = 1;
+ 		/* TODO: schedule_work(recovery) */
++#ifdef CW1200_USE_COMPAT_KTHREAD
++		for (;;) {
++			int status = wait_event_interruptible(priv->bh_wq, ({
++				term = atomic_xchg(&priv->bh_term, 0);
++				(term);
++			}));
++		if (status || term)
++			break;
++	}
++#endif
+ 	}
+ 	return 0;
+ }
+diff --git a/drivers/net/wireless/cw1200/cw1200.h b/drivers/net/wireless/cw1200/cw1200.h
+index 1ad7d36..300dbbb 100644
+--- a/drivers/net/wireless/cw1200/cw1200.h
++++ b/drivers/net/wireless/cw1200/cw1200.h
+@@ -23,12 +23,18 @@
+ #include <linux/workqueue.h>
+ #include <net/mac80211.h>
+ 
++#include <linux/version.h>
++
+ #include "queue.h"
+ #include "wsm.h"
+ #include "scan.h"
+ #include "txrx.h"
+ #include "pm.h"
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36))
++#define CW1200_USE_COMPAT_KTHREAD
++#endif
++
+ /* Forward declarations */
+ struct hwbus_ops;
+ struct task_struct;
+@@ -190,8 +196,12 @@ struct cw1200_common {
+ 	atomic_t			bh_term;
+ 	atomic_t			bh_suspend;
+ 
++#ifdef CW1200_USE_COMPAT_KTHREAD
++	struct task_struct              *bh_thread;
++#else
+ 	struct workqueue_struct         *bh_workqueue;
+ 	struct work_struct              bh_work;
++#endif
+ 
+ 	int				bh_error;
+ 	wait_queue_head_t		bh_wq;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] backports: cw1200 needs the multicast API changes to support <=2.6.35
  2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
                   ` (2 preceding siblings ...)
  2013-08-17 13:02 ` [PATCH v2 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
@ 2013-08-17 13:02 ` Solomon Peachy
  2013-08-18 22:29 ` [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Hauke Mehrtens
  4 siblings, 0 replies; 7+ messages in thread
From: Solomon Peachy @ 2013-08-17 13:02 UTC (permalink / raw)
  To: backports; +Cc: Solomon Peachy

Also, update the dependencies:

 cw1200_wlan_sdio needs >=2.6.34 due to missing sdio_set_host_pm_flags()
 cw1200_wlan_spi needs >=2.6.35 due to missing request_any_context_irq()

Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
---
 dependencies                                       |  3 +
 .../drivers_net_wireless_cw1200_sta.patch          | 77 ++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/25-multicast-list_head/drivers_net_wireless_cw1200_sta.patch

diff --git a/dependencies b/dependencies
index f1e514b..9bd5763 100644
--- a/dependencies
+++ b/dependencies
@@ -36,6 +36,9 @@ P54_SPI 2.6.25
 WL1251_SDIO 2.6.37
 WLCORE_SDIO 2.6.38
 
+CW1200_WLAN_SDIO 2.6.34
+CW1200_WLAN_SPI 2.6.35
+
 BRCMFMAC 2.6.29
 
 WL_TI 2.6.30
diff --git a/patches/collateral-evolutions/network/25-multicast-list_head/drivers_net_wireless_cw1200_sta.patch b/patches/collateral-evolutions/network/25-multicast-list_head/drivers_net_wireless_cw1200_sta.patch
new file mode 100644
index 0000000..269a696
--- /dev/null
+++ b/patches/collateral-evolutions/network/25-multicast-list_head/drivers_net_wireless_cw1200_sta.patch
@@ -0,0 +1,77 @@
+--- a/drivers/net/wireless/cw1200/sta.c
++++ b/drivers/net/wireless/cw1200/sta.c
+@@ -530,8 +530,13 @@ void cw1200_set_beacon_wakeup_period_work(struct work_struct *work)
+ 				     priv->join_dtim_period, 0);
+ }
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
+ 			     struct netdev_hw_addr_list *mc_list)
++#else
++u64 cw1200_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
++			     struct dev_addr_list *ha)
++#endif
+ {
+ 	static u8 broadcast_ipv6[ETH_ALEN] = {
+ 		0x33, 0x33, 0x00, 0x00, 0x00, 0x01
+@@ -540,13 +545,16 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
+ 		0x01, 0x00, 0x5e, 0x00, 0x00, 0x01
+ 	};
+ 	struct cw1200_common *priv = hw->priv;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ 	struct netdev_hw_addr *ha;
++#endif
+ 	int count = 0;
+ 
+ 	/* Disable multicast filtering */
+ 	priv->has_multicast_subscription = false;
+ 	memset(&priv->multicast_filter, 0x00, sizeof(priv->multicast_filter));
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ 	if (netdev_hw_addr_list_count(mc_list) > WSM_MAX_GRP_ADDRTABLE_ENTRIES)
+ 		return 0;
+ 
+@@ -560,13 +568,26 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
+ 			priv->has_multicast_subscription = true;
+ 		count++;
+ 	}
++#else
++	while (ha &&
++	       count < mc_count &&
++	       count < WSM_MAX_GRP_ADDRTABLE_ENTRIES) {
++		memcpy(&priv->multicast_filter.macaddrs[count],
++		       ha->dmi_addr, ETH_ALEN);
++		if (memcmp(ha->dmi_addr, broadcast_ipv4, ETH_ALEN) &&
++		    memcmp(ha->dmi_addr, broadcast_ipv6, ETH_ALEN))
++			priv->has_multicast_subscription = true;
++		count++;
++		ha = ha->next;
++	}
++#endif
+ 
+ 	if (count) {
+ 		priv->multicast_filter.enable = __cpu_to_le32(1);
+ 		priv->multicast_filter.num_addrs = __cpu_to_le32(count);
+ 	}
+ 
+-	return netdev_hw_addr_list_count(mc_list);
++	return count;
+ }
+ 
+ void cw1200_configure_filter(struct ieee80211_hw *dev,
+--- a/drivers/net/wireless/cw1200/sta.h
++++ b/drivers/net/wireless/cw1200/sta.h
+@@ -42,8 +42,13 @@ int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+ 
+ void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
+ 			     struct netdev_hw_addr_list *mc_list);
++#else
++u64 cw1200_prepare_multicast(struct ieee80211_hw *dev, int mc_count,
++			     struct dev_addr_list *ha);
++#endif
+ 
+ int cw1200_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
+ 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] Enable cw1200 on >=2.6.34
  2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
                   ` (3 preceding siblings ...)
  2013-08-17 13:02 ` [PATCH v2 4/4] backports: cw1200 needs the multicast API changes to support <=2.6.35 Solomon Peachy
@ 2013-08-18 22:29 ` Hauke Mehrtens
  2013-08-27 18:41   ` Luis R. Rodriguez
  4 siblings, 1 reply; 7+ messages in thread
From: Hauke Mehrtens @ 2013-08-18 22:29 UTC (permalink / raw)
  To: Solomon Peachy; +Cc: backports

On 08/17/2013 03:02 PM, Solomon Peachy wrote:
> This superscedes the earlier patch set I posted when apparently sleep 
> deprived.  It enables the cw1200_wlan_sdio driver to build cleanly on 
>> =2.6.34 kernels, and the cw1200_wlan_spi driver to build cleanly on 
>> =2.6.35 kernels.

Hi Solomon,

I compile tested this and haven't found any problems in cw1200 with this
patches applied.

Hauke

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] Enable cw1200 on >=2.6.34
  2013-08-18 22:29 ` [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Hauke Mehrtens
@ 2013-08-27 18:41   ` Luis R. Rodriguez
  0 siblings, 0 replies; 7+ messages in thread
From: Luis R. Rodriguez @ 2013-08-27 18:41 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: Solomon Peachy, backports

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

On Mon, Aug 19, 2013 at 12:29:16AM +0200, Hauke Mehrtens wrote:
> On 08/17/2013 03:02 PM, Solomon Peachy wrote:
> > This superscedes the earlier patch set I posted when apparently sleep 
> > deprived.  It enables the cw1200_wlan_sdio driver to build cleanly on 
> >> =2.6.34 kernels, and the cw1200_wlan_spi driver to build cleanly on 
> >> =2.6.35 kernels.
> 
> Hi Solomon,
> 
> I compile tested this and haven't found any problems in cw1200 with this
> patches applied.

I've applied these and will push out later. Thanks!

  Luis

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-08-27 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-17 13:02 [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Solomon Peachy
2013-08-17 13:02 ` [PATCH v2 1/4] backport: Add an implementation of get_random_int() for <3.10 kernels Solomon Peachy
2013-08-17 13:02 ` [PATCH v2 2/4] backports: move the cw1200 sdio quirk into 26-sdio-quirks Solomon Peachy
2013-08-17 13:02 ` [PATCH v2 3/4] backports: cw1200 utilizes kthreads for <= 2.6.35 Solomon Peachy
2013-08-17 13:02 ` [PATCH v2 4/4] backports: cw1200 needs the multicast API changes to support <=2.6.35 Solomon Peachy
2013-08-18 22:29 ` [PATCH v2 0/4] Enable cw1200 on >=2.6.34 Hauke Mehrtens
2013-08-27 18:41   ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.