From: Felix Fietkau Date: Tue, 15 May 2007 18:52:46 +0000 (+0000) Subject: add some locks to wlcompat (just in case...) and reduce the polling frequency X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1ea393e3077618143bb802b193234cc645622698;p=openwrt%2Fsvn-archive%2Fopenwrt.git add some locks to wlcompat (just in case...) and reduce the polling frequency SVN-Revision: 7255 --- diff --git a/openwrt/target/linux/package/wlcompat/Makefile b/openwrt/target/linux/package/wlcompat/Makefile index 023e8a94e6..b6bb37be07 100644 --- a/openwrt/target/linux/package/wlcompat/Makefile +++ b/openwrt/target/linux/package/wlcompat/Makefile @@ -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 diff --git a/openwrt/target/linux/package/wlcompat/wlcompat.c b/openwrt/target/linux/package/wlcompat/wlcompat.c index 6946a7a3b9..f2abc006f0 100644 --- a/openwrt/target/linux/package/wlcompat/wlcompat.c +++ b/openwrt/target/linux/package/wlcompat/wlcompat.c @@ -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));