[PATCH] kernel 2.5.4x supported for hostap-2002-10-12

Huagang Xie xie
Sat Nov 9 01:00:41 PST 2002


Hi,

Here is my little hack for the hostap working under 2.5.46. From a kernel
version around 2.5.40, the task queue is not longer support, instead, it 
use workqueue to replace it. the workqueue has better support for SMP,
scheduling etc. 

Here is the changelog,

	- use workqueue to replace the taskqueue
	- add extra CFLAGS in Makefile to make compilation OK
	- use KERNEL_VERSION checking to make it compatible 
	  with old kernel version.

That's it, now the drivering working very well on my laptop. 

Have fun,
Huagang

-- 
LIDS secure linux kernel
http://www.lids.org/
1024D/B6EFB028 		4731 2BF7 7735 4DBD 3771  4E24 B53B B60A B6EF B028
-------------- next part --------------
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_ap.c hostap-2002-10-12/driver/modules/hostap_ap.c
--- hostap-2002-10-12.vanilla/driver/modules/hostap_ap.c	2002-09-14 08:54:12.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_ap.c	2002-11-09 00:20:31.000000000 -0800
@@ -638,6 +638,7 @@
 #endif /* PRISM2_NO_PROCFS_DEBUG */
 
 	/* Initialize task queue structure for AP management */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	HOSTAP_TQ_INIT(&local->ap->ap_queue);
 	local->ap->ap_queue.sync = 0;
 	local->ap->ap_queue.routine = handle_ap_queue;
@@ -647,6 +648,10 @@
 	local->ap->set_tim_queue.sync = 0;
 	local->ap->set_tim_queue.routine = handle_set_tim_queue;
 	local->ap->set_tim_queue.data = local;
+#else 
+	INIT_WORK(&local->ap->ap_queue,handle_ap_queue,local);
+	INIT_WORK(&local->ap->set_tim_queue,handle_set_tim_queue,local);
+#endif
 	INIT_LIST_HEAD(&ap->set_tim_list);
 	spin_lock_init(&ap->set_tim_lock);
 
@@ -672,7 +677,6 @@
 		       "initialized - skip resource freeing\n");
 		return;
 	}
-
 #ifndef PRISM2_HOSTAPD
 	if (ap->crypt)
 		ap->crypt->deinit(ap->crypt_priv);
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_ap.h hostap-2002-10-12/driver/modules/hostap_ap.h
--- hostap-2002-10-12.vanilla/driver/modules/hostap_ap.h	2002-09-12 05:49:47.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_ap.h	2002-11-08 21:43:12.000000000 -0800
@@ -152,7 +152,11 @@
 	int initialized; /* whether ap_data has been initialized */
 	local_info_t *local;
 	struct sk_buff_head ap_queued_skb;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	struct tq_struct ap_queue;
+#else
+	struct work_struct ap_queue;
+#endif
 	int bridge_packets; /* send packet to associated STAs directly to the
 			     * wireless media instead of higher layers in the
 			     * kernel */
@@ -182,7 +186,11 @@
 	struct mac_restrictions mac_restrictions; /* MAC-based auth */
 	int last_tx_rate;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	struct tq_struct set_tim_queue;
+#else
+	struct work_struct set_tim_queue;
+#endif
 	struct list_head set_tim_list;
 	spinlock_t set_tim_lock;
 
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_compat.h hostap-2002-10-12/driver/modules/hostap_compat.h
--- hostap-2002-10-12.vanilla/driver/modules/hostap_compat.h	2002-10-12 06:15:15.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_compat.h	2002-11-08 21:46:28.000000000 -0800
@@ -49,6 +49,7 @@
 #define PRISM2_NETDEV_EXTRA 0
 #define prism2_set_dev_name(dev, pos) do { } while (0)
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 #define PRISM2_SCHEDULE_TASK(q) \
 MOD_INC_USE_COUNT; \
 if (schedule_task((q)) == 0) \
@@ -60,6 +61,15 @@
 {
 	INIT_LIST_HEAD(&tq->list);
 }
+#else
+#define PRISM2_SCHEDULE_TASK(q) \
+MOD_INC_USE_COUNT; \
+if (schedule_work((q)) == 0) \
+	MOD_DEC_USE_COUNT;
+
+#define PRISM2_FLUSH_SCHEDULED_TASKS() flush_scheduled_work()
+
+#endif
 
 #endif /* kernel < 2.4.0 */
 
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_cs.c hostap-2002-10-12/driver/modules/hostap_cs.c
--- hostap-2002-10-12.vanilla/driver/modules/hostap_cs.c	2002-10-12 07:28:23.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_cs.c	2002-11-08 22:41:09.000000000 -0800
@@ -13,7 +13,7 @@
 #include <linux/timer.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
-#include <linux/tqueue.h>
+#include <linux/workqueue.h>
 
 #include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_hw.c hostap-2002-10-12/driver/modules/hostap_hw.c
--- hostap-2002-10-12.vanilla/driver/modules/hostap_hw.c	2002-10-12 08:01:16.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_hw.c	2002-11-09 00:31:33.000000000 -0800
@@ -3075,6 +3075,7 @@
 	       "alloc event\n", dev->name, HFA384X_INW(HFA384X_ALLOCFID_OFF));
 
  out:
+	return;
 }
 
 
@@ -4094,6 +4095,7 @@
 	skb_queue_head_init(&local->bridge_list);
 
 	/* Initialize task queue structures */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	HOSTAP_TQ_INIT(&local->bridge_queue);
 	local->bridge_queue.sync = 0;
 	local->bridge_queue.routine = handle_bridged_queue;
@@ -4110,6 +4112,13 @@
 	local->info_queue.routine = handle_info_queue;
 	local->info_queue.data = local;
 #endif /* PRISM2_NO_STATION_MODES */
+#else
+	INIT_WORK(&local->bridge_queue, handle_bridged_queue, local);
+	INIT_WORK(&local->reset_queue, handle_reset_queue, local);
+#ifndef PRISM2_NO_STATION_MODES
+	INIT_WORK(&local->info_queue, handle_info_queue, local);
+#endif /* PRISM2_NO_STATION_MODES */
+#endif
 
 	INIT_LIST_HEAD(&local->cmd_queue);
 
diff -N -r -u hostap-2002-10-12.vanilla/driver/modules/hostap_wlan.h hostap-2002-10-12/driver/modules/hostap_wlan.h
--- hostap-2002-10-12.vanilla/driver/modules/hostap_wlan.h	2002-09-21 05:43:43.000000000 -0700
+++ hostap-2002-10-12/driver/modules/hostap_wlan.h	2002-11-08 21:51:31.000000000 -0800
@@ -1070,7 +1070,11 @@
 	/* skb queue for packets to be send using dev_queue_xmit() after
 	 * exiting hard IRQ handler (prism2_rx) */
 	struct sk_buff_head bridge_list;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	struct tq_struct bridge_queue;
+#else
+	struct work_struct bridge_queue;
+#endif
 
 	/* command queue for hfa384x_cmd(); protected with cmdlock */
 	struct list_head cmd_queue;
@@ -1082,7 +1086,11 @@
 
 	/* if card timeout is detected in interrupt context, reset_queue is
 	 * used to schedule card reseting to be done in user context */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	struct tq_struct reset_queue;
+#else
+	struct work_struct reset_queue;
+#endif
 
 	prism2_wds_info_t *wds; /* list of established wds connections */
 	int wds_max_connections;
@@ -1149,7 +1157,11 @@
 	unsigned long last_join_time; /* time of last JoinRequest */
 	struct hfa384x_scan_result *last_scan_results;
 	int last_scan_results_count;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44))
 	struct tq_struct info_queue;
+#else
+	struct work_struct info_queue;
+#endif
 	long pending_info; /* bit field of pending info_queue items */
 #define PRISM2_INFO_PENDING_LINKSTATUS 0
 #define PRISM2_INFO_PENDING_SCANRESULTS 1
diff -N -r -u hostap-2002-10-12.vanilla/Makefile hostap-2002-10-12/Makefile
--- hostap-2002-10-12.vanilla/Makefile	2002-09-12 01:11:00.000000000 -0700
+++ hostap-2002-10-12/Makefile	2002-11-08 22:39:58.000000000 -0800
@@ -42,6 +42,15 @@
 
 include $(KERNEL_PATH)/.config
 
+ifdef CONFIG_VISWS
+MACHINE	:= mach-visws
+else
+MACHINE	:= mach-generic
+endif
+
+CFLAGS += -I$(KERNEL_PATH)/arch/i386/$(MACHINE)
+
+
 ifdef CONFIG_ALPHA
 CFLAGS += -mno-fp-regs -ffixed-8
 endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20021109/b64ec3e8/attachment.pgp 



More information about the Hostap mailing list