add some locks to wlcompat (just in case...) and reduce the polling frequency
authorFelix Fietkau <nbd@openwrt.org>
Tue, 15 May 2007 18:52:46 +0000 (18:52 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 15 May 2007 18:52:46 +0000 (18:52 +0000)
SVN-Revision: 7255

openwrt/target/linux/package/wlcompat/Makefile
openwrt/target/linux/package/wlcompat/wlcompat.c

index 023e8a94e66bf3fb02b979efe8635bbdea4c4973..b6bb37be07edf9c31c9359e40cdc8ab0ef5f25ce 100644 (file)
@@ -3,7 +3,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME := kmod-wlcompat
-PKG_RELEASE := 4
+PKG_RELEASE := 5
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
index 6946a7a3b9edd2fa06877aef9821a1a3e88d94a7..f2abc006f0d4429e1275e328d3cd45399598c265 100644 (file)
@@ -52,7 +52,7 @@ const long channel_frequency[] = {
 #define NUM_CHANNELS ( sizeof(channel_frequency) / sizeof(channel_frequency[0]) )
 
 #define SCAN_RETRY_MAX 5
-#define RNG_POLL_FREQ  2
+#define RNG_POLL_FREQ  1
 
 typedef struct internal_wsec_key {
        uint8 index;            // 0x00
@@ -1032,17 +1032,22 @@ static int new_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) {
 
 #ifndef DEBUG
 static struct timer_list rng_timer;
+static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED;
 
 static void rng_timer_tick(unsigned long n)
 {
        struct net_device *dev = (struct net_device *) n;
+       unsigned long flags;
        u16 data[4];
        int i, ret;
        
        ret = 0;
+       spin_lock_irqsave(&rng_lock, flags);
        for (i = 0; i < 3; i++) {
                ret |= wl_get_val(dev, "rand", &data[i], sizeof(u16));
        }
+       spin_unlock_irqrestore(&rng_lock, flags);
+
        if (!ret)
                batch_entropy_store(*((u32 *) &data[0]), *((u32 *) &data[2]), (jiffies % 255));