* Re: ath9k: BUG kmalloc-8192: Poison overwritten
From: Bruno Randolf @ 2010-05-14 6:38 UTC (permalink / raw)
To: Justin P. Mattock
Cc: Luis R. Rodriguez, Luis Rodriguez, linux-wireless@vger.kernel.org,
Linux Kernel Mailing List
In-Reply-To: <4BECEE3E.6090303@gmail.com>
On Friday 14 May 2010 15:31:26 Justin P. Mattock wrote:
> On 05/13/10 23:20, Bruno Randolf wrote:
> > On Friday 14 May 2010 15:16:22 Luis R. Rodriguez wrote:
> >> On Thu, May 13, 2010 at 9:44 PM, Justin P. Mattock
> >>
> >> <justinmattock@gmail.com> wrote:
> >>> On 05/13/10 21:01, Luis R. Rodriguez wrote:
> >>>> On Thu, May 13, 2010 at 7:14 PM, Justin P. Mattock
> >>>>
> >>>> <justinmattock@gmail.com> wrote:
> >>>>> what I can try, is(not at the convention, on eth0
> >>>>> at the moment), but when I get back to the convention
> >>>>> center place I can try your patch as well as the
> >>>>> modprobe option, to see if I can get any signs of
> >>>>> a recreation(if so I'll bisect there).
> >>>>
> >>>> The debug info I just need upon load of the module, I don't need you
> >>>> to run the debug stuff to try to reproduce. The debug print upon load
> >>>> will tell us the rxbuf size and cache line size.
> >>>>
> >>>> Luis
> >>>
> >>> o.k. it's not pretty due
> >>> to loads of avc's for SELinux:
> >>> (I run a rootless system).
> >>>
> >>> [ 84.172649] ath9k: Driver unloaded
> >>> [ 100.675300] audit_printk_skb: 6 callbacks suppressed
> >>> [ 100.675306] type=1400 audit(1273811633.675:20): avc: denied {
> >>> search } for pid=2168 comm="modprobe" name="modules" dev=sda3
> >>> ino=2500 scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=system_u:object_r:modules_object_t:s0 tclass=dir
> >>> [ 100.675408] type=1400 audit(1273811633.675:20): avc: denied {
> >>> search } for pid=2168 comm="modprobe"
> >>> name="2.6.34-rc7-00057-gcdfda35" dev=sda3 ino=524392
> >>> scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=name:object_r:modules_object_t:s0 tclass=dir
> >>> [ 100.675552] type=1400 audit(1273811633.675:20): avc: denied { read
> >>> } for pid=2168 comm="modprobe" name="modules.dep.bin" dev=sda3
> >>> ino=525251 scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=name:object_r:modules_object_t:s0 tclass=file
> >>> [ 100.675598] type=1400 audit(1273811633.675:20): avc: denied { open
> >>> } for pid=2168 comm="modprobe" name="modules.dep.bin" dev=sda3
> >>> ino=525251 scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=name:object_r:modules_object_t:s0 tclass=file
> >>> [ 100.675748] type=1300 audit(1273811633.675:20): arch=c000003e
> >>> syscall=2 success=yes exit=3 a0=60d140 a1=0 a2=1b6 a3=0 items=0
> >>> ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0
> >>> sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe" exe="/sbin/modprobe"
> >>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
> >>> [ 100.675902] type=1400 audit(1273811633.675:21): avc: denied {
> >>> getattr } for pid=2168 comm="modprobe"
> >>> path="/lib/modules/2.6.34-rc7-00057-gcdfda35/modules.dep.bin" dev=sda3
> >>> ino=525251 scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=name:object_r:modules_object_t:s0 tclass=file
> >>> [ 100.676052] type=1300 audit(1273811633.675:21): arch=c000003e
> >>> syscall=5 success=yes exit=0 a0=3 a1=7fffd2d1dd70 a2=7fffd2d1dd70 a3=0
> >>> items=0 ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0
> >>> egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe"
> >>> exe="/sbin/modprobe"
> >>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
> >>> [ 100.698392] ath9k 0000:03:00.0: PCI INT A -> GSI 17 (level, low) ->
> >>> IRQ 17
> >>> [ 100.698409] ath9k 0000:03:00.0: setting latency timer to 64
> >>> [ 100.828787] ath: EEPROM regdomain: 0x64
> >>> [ 100.828790] ath: EEPROM indicates we should expect a direct regpair
> >>> map [ 100.828793] ath: Country alpha2 being used: 00
> >>> [ 100.828795] ath: Regpair used: 0x64
> >>> [ 100.848609] type=1400 audit(1273811633.678:22): avc: denied {
> >>> search } for pid=2168 comm="modprobe" name="ieee80211" dev=debugfs
> >>> ino=18 scontext=name:staff_r:staff_sudo_t:s0
> >>> tcontext=system_u:object_r:debugfs_t:s0 tclass=dir
> >>> [ 100.848788] phy1: Selected rate control algorithm
> >>> 'ath9k_rate_control' [ 100.850035] Registered led device:
> >>> ath9k-phy1::radio
> >>> [ 100.850488] Registered led device: ath9k-phy1::assoc
> >>> [ 100.851227] Registered led device: ath9k-phy1::tx
> >>> [ 100.851633] Registered led device: ath9k-phy1::rx
> >>> [ 100.851640] phy1: Atheros AR5418 MAC/BB Rev:2 AR5133 RF Rev:81
> >>> mem=0xffffc900005a0000, irq=17
> >>> [ 100.852240] type=1300 audit(1273811633.678:22): arch=c000003e
> >>> syscall=175 success=yes exit=0 a0=7f1e9d6ab010 a1=19580 a2=60d920 a3=0
> >>> items=0 ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0
> >>> egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe"
> >>> exe="/sbin/modprobe"
> >>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
> >>>
> >>> but there you go dmesg of the debug info for you
> >>
> >> Justin, did you forget to use the debug parameter on modprobe ath9k?
> >>
> >> modprobe ath9k debug=0x0000020
> >>
> >> I do not see the output I expected.
> >
> > i think you have to do at least "ifconfig wlan0 up" to see it - (at least
> > for ath5k).
> >
> > bruno
>
> didn't think todo so, I'll redu
> again and see. BTW: the connection
> over here is dodgy(hotel) should I at-least
> find a stable access point? i.g. convetion
> center seemed semi somewhat there
no that does not matter. just ifconfig up is enough. it's just initialization,
you don't need a connection for that.
bruno
> Justin P. Mattock
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: Architecture for wireless driver development in the Linux environment
From: Luis R. Rodriguez @ 2010-05-14 6:39 UTC (permalink / raw)
To: Madhavi Manchala; +Cc: linux-wireless
In-Reply-To: <AANLkTimgcy5UV-snifCoduVOyhooS_1X7tn_HxKTXQ6w@mail.gmail.com>
On Thu, May 13, 2010 at 11:23 PM, Madhavi Manchala
<madhavi.linux@gmail.com> wrote:
> Dear Experts,
>
> I am new to the wireless driver development in the Linux environment.
> I have gone through the http://wireless.kernel.org/ link about the
> wireless driver development in the Linux environment. However, I did
> not find any architecture or skeleton driver like usb-skeleton.c file
> either in the drivers/Documentation or in the mentioned link. I want
> to develop a driver for USB WIFI device for x86 architecture. Please
> let me where can find the USB WIFI driver development architecture in
> the Linux environment.
You can look at:
drivers/net/wireless/mac80211_hwsim.c
> http://wireless.kernel.org/en/developers/Documentation/cfg80211
> What is cfg80211? Are we need to follow this configuration method for
> developing the drivers in the Linux environment?
Its what defines the generic data structure for all 802.11 devices,
both FullMAC and SoftMAC, it also defines the new API for 802.11 for
Linux, you register your struct wiphy device to cfg80211, your driver
has cfg80211_ops and you use nl80211 to communicate to cfg80211 from
userspace for a wiphy device or just generally to cfg80211 (for iw reg
get/set).
Luis
^ permalink raw reply
* Re: ath9k: BUG kmalloc-8192: Poison overwritten
From: Justin P. Mattock @ 2010-05-14 6:42 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Bruno Randolf, Luis Rodriguez, linux-wireless@vger.kernel.org,
Linux Kernel Mailing List
In-Reply-To: <AANLkTikKqFTS9MyvJKtyP9pNsrYyFPk5ijidjS9IA_30@mail.gmail.com>
On 05/13/10 23:36, Luis R. Rodriguez wrote:
> On Thu, May 13, 2010 at 11:31 PM, Justin P. Mattock
> <justinmattock@gmail.com> wrote:
>> On 05/13/10 23:20, Bruno Randolf wrote:
>>>
>>> On Friday 14 May 2010 15:16:22 Luis R. Rodriguez wrote:
>>>>
>>>> On Thu, May 13, 2010 at 9:44 PM, Justin P. Mattock
>>>>
>>>> <justinmattock@gmail.com> wrote:
>>>>>
>>>>> On 05/13/10 21:01, Luis R. Rodriguez wrote:
>>>>>>
>>>>>> On Thu, May 13, 2010 at 7:14 PM, Justin P. Mattock
>>>>>>
>>>>>> <justinmattock@gmail.com> wrote:
>>>>>>>
>>>>>>> what I can try, is(not at the convention, on eth0
>>>>>>> at the moment), but when I get back to the convention
>>>>>>> center place I can try your patch as well as the
>>>>>>> modprobe option, to see if I can get any signs of
>>>>>>> a recreation(if so I'll bisect there).
>>>>>>
>>>>>> The debug info I just need upon load of the module, I don't need you
>>>>>> to run the debug stuff to try to reproduce. The debug print upon load
>>>>>> will tell us the rxbuf size and cache line size.
>>>>>>
>>>>>> Luis
>>>>>
>>>>> o.k. it's not pretty due
>>>>> to loads of avc's for SELinux:
>>>>> (I run a rootless system).
>>>>>
>>>>> [ 84.172649] ath9k: Driver unloaded
>>>>> [ 100.675300] audit_printk_skb: 6 callbacks suppressed
>>>>> [ 100.675306] type=1400 audit(1273811633.675:20): avc: denied {
>>>>> search
>>>>> } for pid=2168 comm="modprobe" name="modules" dev=sda3 ino=2500
>>>>> scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=system_u:object_r:modules_object_t:s0 tclass=dir
>>>>> [ 100.675408] type=1400 audit(1273811633.675:20): avc: denied {
>>>>> search
>>>>> } for pid=2168 comm="modprobe" name="2.6.34-rc7-00057-gcdfda35"
>>>>> dev=sda3 ino=524392 scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=name:object_r:modules_object_t:s0 tclass=dir
>>>>> [ 100.675552] type=1400 audit(1273811633.675:20): avc: denied { read
>>>>> }
>>>>> for pid=2168 comm="modprobe" name="modules.dep.bin" dev=sda3 ino=525251
>>>>> scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=name:object_r:modules_object_t:s0 tclass=file
>>>>> [ 100.675598] type=1400 audit(1273811633.675:20): avc: denied { open
>>>>> }
>>>>> for pid=2168 comm="modprobe" name="modules.dep.bin" dev=sda3 ino=525251
>>>>> scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=name:object_r:modules_object_t:s0 tclass=file
>>>>> [ 100.675748] type=1300 audit(1273811633.675:20): arch=c000003e
>>>>> syscall=2 success=yes exit=3 a0=60d140 a1=0 a2=1b6 a3=0 items=0
>>>>> ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0
>>>>> sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe" exe="/sbin/modprobe"
>>>>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
>>>>> [ 100.675902] type=1400 audit(1273811633.675:21): avc: denied {
>>>>> getattr } for pid=2168 comm="modprobe"
>>>>> path="/lib/modules/2.6.34-rc7-00057-gcdfda35/modules.dep.bin" dev=sda3
>>>>> ino=525251 scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=name:object_r:modules_object_t:s0 tclass=file
>>>>> [ 100.676052] type=1300 audit(1273811633.675:21): arch=c000003e
>>>>> syscall=5 success=yes exit=0 a0=3 a1=7fffd2d1dd70 a2=7fffd2d1dd70 a3=0
>>>>> items=0 ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0
>>>>> egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe"
>>>>> exe="/sbin/modprobe"
>>>>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
>>>>> [ 100.698392] ath9k 0000:03:00.0: PCI INT A -> GSI 17 (level, low) ->
>>>>> IRQ 17
>>>>> [ 100.698409] ath9k 0000:03:00.0: setting latency timer to 64
>>>>> [ 100.828787] ath: EEPROM regdomain: 0x64
>>>>> [ 100.828790] ath: EEPROM indicates we should expect a direct regpair
>>>>> map [ 100.828793] ath: Country alpha2 being used: 00
>>>>> [ 100.828795] ath: Regpair used: 0x64
>>>>> [ 100.848609] type=1400 audit(1273811633.678:22): avc: denied {
>>>>> search
>>>>> } for pid=2168 comm="modprobe" name="ieee80211" dev=debugfs ino=18
>>>>> scontext=name:staff_r:staff_sudo_t:s0
>>>>> tcontext=system_u:object_r:debugfs_t:s0 tclass=dir
>>>>> [ 100.848788] phy1: Selected rate control algorithm
>>>>> 'ath9k_rate_control'
>>>>> [ 100.850035] Registered led device: ath9k-phy1::radio
>>>>> [ 100.850488] Registered led device: ath9k-phy1::assoc
>>>>> [ 100.851227] Registered led device: ath9k-phy1::tx
>>>>> [ 100.851633] Registered led device: ath9k-phy1::rx
>>>>> [ 100.851640] phy1: Atheros AR5418 MAC/BB Rev:2 AR5133 RF Rev:81
>>>>> mem=0xffffc900005a0000, irq=17
>>>>> [ 100.852240] type=1300 audit(1273811633.678:22): arch=c000003e
>>>>> syscall=175 success=yes exit=0 a0=7f1e9d6ab010 a1=19580 a2=60d920 a3=0
>>>>> items=0 ppid=2080 pid=2168 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0
>>>>> egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="modprobe"
>>>>> exe="/sbin/modprobe"
>>>>> subj=name:staff_r:staff_sudo_t:s0 key=(null)
>>>>>
>>>>> but there you go dmesg of the debug info for you
>>>>
>>>> Justin, did you forget to use the debug parameter on modprobe ath9k?
>>>>
>>>> modprobe ath9k debug=0x0000020
>>>>
>>>> I do not see the output I expected.
>>>
>>> i think you have to do at least "ifconfig wlan0 up" to see it - (at least
>>> for
>>> ath5k).
>>>
>>> bruno
>>>
>>
>> didn't think todo so, I'll redu
>> again and see. BTW: the connection
>> over here is dodgy(hotel) should I at-least
>> find a stable access point?
>
> Up to you, just need that print line.
>
> ath_print(common, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n",
> common->cachelsz, common->rx_bufsize);
>
> Luis
>
alright.. (in a few) I'll go ahead and enable
as much as possible, as well as the prink
ans see if I can grab the right info for you.
Justin P. Mattock
^ permalink raw reply
* [PATCH 2/3] wl1271: Add support for NVS files with 5GHz band parameters
From: Luciano Coelho @ 2010-05-14 7:34 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273822457-9194-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
This patch adds support for NVS files with 5GHz band parameters. The change
is done in a backward compatible manner - if 11a is not enabled in the driver,
the driver will allow also old NVS files to be loaded.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271_cmd.c | 9 ++++++++-
drivers/net/wireless/wl12xx/wl1271_ini.h | 11 ++++++++---
drivers/net/wireless/wl12xx/wl1271_main.c | 13 ++++++++++---
drivers/net/wireless/wl12xx/wl1271_testmode.c | 11 +++++++++--
4 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 241b477..d7bcce8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -238,13 +238,20 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
+ /* 2.4GHz parameters */
memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2,
sizeof(struct wl1271_ini_band_params_2));
memcpy(&radio_parms->dyn_params_2,
&wl->nvs->dyn_radio_params_2[rparam->fem].params,
sizeof(struct wl1271_ini_fem_params_2));
- /* FIXME: current NVS is missing 5GHz parameters */
+ /* 5GHz parameters */
+ memcpy(&radio_parms->static_params_5,
+ &wl->nvs->stat_radio_params_5,
+ sizeof(struct wl1271_ini_band_params_5));
+ memcpy(&radio_parms->dyn_params_5,
+ &wl->nvs->dyn_radio_params_5[rparam->fem].params,
+ sizeof(struct wl1271_ini_fem_params_5));
wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ",
radio_parms, sizeof(*radio_parms));
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h
index d1590bc..0fb156a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_ini.h
+++ b/drivers/net/wireless/wl12xx/wl1271_ini.h
@@ -95,9 +95,10 @@ struct wl1271_ini_fem_params_5 {
/* NVS data structure */
#define WL1271_INI_NVS_SECTION_SIZE 468
-#define WL1271_INI_SPARE_SIZE 124
#define WL1271_INI_FEM_MODULE_COUNT 2
+#define WL1271_INI_LEGACY_NVS_FILE_SIZE 800
+
struct wl1271_nvs_file {
/* NVS section */
u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
@@ -111,8 +112,12 @@ struct wl1271_nvs_file {
struct wl1271_ini_fem_params_2 params;
u8 padding;
} dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
-
- u8 ini_spare[WL1271_INI_SPARE_SIZE];
+ struct wl1271_ini_band_params_5 stat_radio_params_5;
+ u8 padding3;
+ struct {
+ struct wl1271_ini_fem_params_5 params;
+ u8 padding;
+ } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
} __attribute__ ((packed));
#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 933e432..371c394 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -566,14 +566,21 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
return ret;
}
- if (fw->size != sizeof(struct wl1271_nvs_file)) {
+ /*
+ * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
+ * configurations) can be removed when those NVS files stop floating
+ * around.
+ */
+ if (fw->size != sizeof(struct wl1271_nvs_file) &&
+ (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
+ wl1271_11a_enabled())) {
wl1271_error("nvs size is not as expected: %zu != %zu",
fw->size, sizeof(struct wl1271_nvs_file));
ret = -EILSEQ;
goto out;
}
- wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
+ wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
if (!wl->nvs) {
wl1271_error("could not allocate memory for the nvs file");
@@ -581,7 +588,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
goto out;
}
- memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file));
+ memcpy(wl->nvs, fw->data, fw->size);
out:
release_firmware(fw);
diff --git a/drivers/net/wireless/wl12xx/wl1271_testmode.c b/drivers/net/wireless/wl12xx/wl1271_testmode.c
index 554deb4..6e0952f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_testmode.c
+++ b/drivers/net/wireless/wl12xx/wl1271_testmode.c
@@ -199,7 +199,14 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
buf = nla_data(tb[WL1271_TM_ATTR_DATA]);
len = nla_len(tb[WL1271_TM_ATTR_DATA]);
- if (len != sizeof(struct wl1271_nvs_file)) {
+ /*
+ * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
+ * configurations) can be removed when those NVS files stop floating
+ * around.
+ */
+ if (len != sizeof(struct wl1271_nvs_file) &&
+ (len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
+ wl1271_11a_enabled())) {
wl1271_error("nvs size is not as expected: %zu != %zu",
len, sizeof(struct wl1271_nvs_file));
return -EMSGSIZE;
@@ -209,7 +216,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
kfree(wl->nvs);
- wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
+ wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
if (!wl->nvs) {
wl1271_error("could not allocate memory for the nvs file");
ret = -ENOMEM;
--
1.6.3.3
^ permalink raw reply related
* [PATCH 3/3] wl1271: Fix RX data path frame lengths
From: Luciano Coelho @ 2010-05-14 7:34 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273822457-9194-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
The current frame length used by the driver for RX frames is the SPI bus
transfer length. This length has padding bytes, which do not belong to the
WLAN frame.
As there is no other length information in the WLAN frame except the skb
length this problem caused for instance extra ESSID's to be listed at the
end of scan results (IE id 0) with zero length.
Fix the frame length by removing padding.
Fixes: NB#168117 - Extra padding in scan result information elements
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271_rx.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index 57f4bfd..b98fb64 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -113,6 +113,8 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length)
wl1271_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len,
beacon ? "beacon" : "");
+ skb_trim(skb, skb->len - desc->pad_len);
+
memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
ieee80211_rx_ni(wl->hw, skb);
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH 0/3] wl1271: patches for wk19
From: Luciano Coelho @ 2010-05-14 7:34 UTC (permalink / raw)
To: linville; +Cc: linux-wireless
Hi John,
Here's our weekly patchset for the wl1271 driver.
Cheers,
Luca.
Juuso Oikarinen (3):
wl1271: Update handling of the NVS file / INI parameters
wl1271: Add support for NVS files with 5GHz band parameters
wl1271: Fix RX data path frame lengths
drivers/net/wireless/wl12xx/wl1271.h | 28 +------
drivers/net/wireless/wl12xx/wl1271_cmd.c | 25 +++--
drivers/net/wireless/wl12xx/wl1271_cmd.h | 26 +++--
drivers/net/wireless/wl12xx/wl1271_ini.h | 123 +++++++++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_main.c | 13 ++-
drivers/net/wireless/wl12xx/wl1271_rx.c | 2 +
drivers/net/wireless/wl12xx/wl1271_testmode.c | 11 ++-
7 files changed, 177 insertions(+), 51 deletions(-)
create mode 100644 drivers/net/wireless/wl12xx/wl1271_ini.h
^ permalink raw reply
* [PATCH 1/3] wl1271: Update handling of the NVS file / INI parameters
From: Luciano Coelho @ 2010-05-14 7:34 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273822457-9194-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
This patch updates the handling of the NVS file INI-section, trying to make
it slightly more generic, and exposing the parameters being set. This is done
in preparation for 5GHz parameters.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271.h | 28 +-------
drivers/net/wireless/wl12xx/wl1271_cmd.c | 14 ++--
drivers/net/wireless/wl12xx/wl1271_cmd.h | 26 ++++---
drivers/net/wireless/wl12xx/wl1271_ini.h | 118 ++++++++++++++++++++++++++++++
4 files changed, 142 insertions(+), 44 deletions(-)
create mode 100644 drivers/net/wireless/wl12xx/wl1271_ini.h
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 6f1b6b5..1e48e75 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -33,6 +33,7 @@
#include <net/mac80211.h>
#include "wl1271_conf.h"
+#include "wl1271_ini.h"
#define DRIVER_NAME "wl1271"
#define DRIVER_PREFIX DRIVER_NAME ": "
@@ -116,33 +117,6 @@ enum {
#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
-/* NVS data structure */
-#define WL1271_NVS_SECTION_SIZE 468
-
-#define WL1271_NVS_GENERAL_PARAMS_SIZE 57
-#define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \
- (WL1271_NVS_GENERAL_PARAMS_SIZE + 1)
-#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17
-#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \
- (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1)
-#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65
-#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \
- (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1)
-#define WL1271_NVS_FEM_COUNT 2
-#define WL1271_NVS_INI_SPARE_SIZE 124
-
-struct wl1271_nvs_file {
- /* NVS section */
- u8 nvs[WL1271_NVS_SECTION_SIZE];
-
- /* INI section */
- u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED];
- u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED];
- u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
- [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
- u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
-} __attribute__ ((packed));
-
/*
* Enable/disable 802.11a support for WL1273
*/
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 19393e2..241b477 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -212,8 +212,8 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
- memcpy(gen_parms->params, wl->nvs->general_params,
- WL1271_NVS_GENERAL_PARAMS_SIZE);
+ memcpy(&gen_parms->general_params, &wl->nvs->general_params,
+ sizeof(struct wl1271_ini_general_params));
ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
if (ret < 0)
@@ -238,11 +238,11 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
- memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params,
- WL1271_NVS_STAT_RADIO_PARAMS_SIZE);
- memcpy(radio_parms->dyn_radio_params,
- wl->nvs->dyn_radio_params[rparam->fem],
- WL1271_NVS_DYN_RADIO_PARAMS_SIZE);
+ memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2,
+ sizeof(struct wl1271_ini_band_params_2));
+ memcpy(&radio_parms->dyn_params_2,
+ &wl->nvs->dyn_radio_params_2[rparam->fem].params,
+ sizeof(struct wl1271_ini_fem_params_2));
/* FIXME: current NVS is missing 5GHz parameters */
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index f2820b4..4ff966f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -439,24 +439,30 @@ struct wl1271_general_parms_cmd {
struct wl1271_cmd_test_header test;
- u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE];
- s8 reserved[23];
-} __attribute__ ((packed));
+ struct wl1271_ini_general_params general_params;
-#define WL1271_STAT_RADIO_PARAMS_5_SIZE 29
-#define WL1271_DYN_RADIO_PARAMS_5_SIZE 104
+ u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 sr_sen_n_p;
+ u8 sr_sen_n_p_gain;
+ u8 sr_sen_nrn;
+ u8 sr_sen_prn;
+ u8 padding[3];
+} __attribute__ ((packed));
struct wl1271_radio_parms_cmd {
struct wl1271_cmd_header header;
struct wl1271_cmd_test_header test;
- u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE];
- u8 stat_radio_params_5[WL1271_STAT_RADIO_PARAMS_5_SIZE];
+ /* Static radio parameters */
+ struct wl1271_ini_band_params_2 static_params_2;
+ struct wl1271_ini_band_params_5 static_params_5;
- u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE];
- u8 reserved;
- u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE];
+ /* Dynamic radio parameters */
+ struct wl1271_ini_fem_params_2 dyn_params_2;
+ u8 padding2;
+ struct wl1271_ini_fem_params_5 dyn_params_5;
+ u8 padding3[2];
} __attribute__ ((packed));
struct wl1271_cmd_cal_channel_tune {
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h
new file mode 100644
index 0000000..d1590bc
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1271_ini.h
@@ -0,0 +1,118 @@
+/*
+ * This file is part of wl1271
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Contact: Luciano Coelho <luciano.coelho@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __WL1271_INI_H__
+#define __WL1271_INI_H__
+
+#define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
+
+struct wl1271_ini_general_params {
+ u8 ref_clock;
+ u8 settling_time;
+ u8 clk_valid_on_wakeup;
+ u8 dc2dc_mode;
+ u8 dual_mode_select;
+ u8 tx_bip_fem_auto_detect;
+ u8 tx_bip_fem_manufacturer;
+ u8 general_settings;
+ u8 sr_state;
+ u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+} __attribute__ ((packed));
+
+#define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
+
+struct wl1271_ini_band_params_2 {
+ u8 rx_trace_insertion_loss;
+ u8 tx_trace_loss;
+ u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
+} __attribute__ ((packed));
+
+#define WL1271_INI_RATE_GROUP_COUNT 6
+#define WL1271_INI_CHANNEL_COUNT_2 14
+
+struct wl1271_ini_fem_params_2 {
+ __le16 tx_bip_ref_pd_voltage;
+ u8 tx_bip_ref_power;
+ u8 tx_bip_ref_offset;
+ u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
+ u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
+ u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
+ u8 rx_fem_insertion_loss;
+ u8 degraded_low_to_normal_thr;
+ u8 normal_to_degraded_high_thr;
+} __attribute__ ((packed));
+
+#define WL1271_INI_CHANNEL_COUNT_5 35
+#define WL1271_INI_SUB_BAND_COUNT_5 7
+
+struct wl1271_ini_band_params_5 {
+ u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
+} __attribute__ ((packed));
+
+struct wl1271_ini_fem_params_5 {
+ __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
+ u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
+ u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 degraded_low_to_normal_thr;
+ u8 normal_to_degraded_high_thr;
+} __attribute__ ((packed));
+
+
+/* NVS data structure */
+#define WL1271_INI_NVS_SECTION_SIZE 468
+#define WL1271_INI_SPARE_SIZE 124
+#define WL1271_INI_FEM_MODULE_COUNT 2
+
+struct wl1271_nvs_file {
+ /* NVS section */
+ u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
+
+ /* INI section */
+ struct wl1271_ini_general_params general_params;
+ u8 padding1;
+ struct wl1271_ini_band_params_2 stat_radio_params_2;
+ u8 padding2;
+ struct {
+ struct wl1271_ini_fem_params_2 params;
+ u8 padding;
+ } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
+
+ u8 ini_spare[WL1271_INI_SPARE_SIZE];
+} __attribute__ ((packed));
+
+#endif
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCH 0/3] wl1271: patches for wk19
From: Luciano Coelho @ 2010-05-14 7:42 UTC (permalink / raw)
To: linville@tuxdriver.com; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1273822457-9194-1-git-send-email-luciano.coelho@nokia.com>
On Fri, 2010-05-14 at 09:34 +0200, Coelho Luciano (Nokia-D/Helsinki)
wrote:
> Hi John,
>
> Here's our weekly patchset for the wl1271 driver.
Oops! Please ignore this patchset as one internal bugzilla tag slipped
out. I'll send v2 with the tag removed.
--
Cheers,
Luca.
^ permalink raw reply
* [PATCH v2 1/3] wl1271: Update handling of the NVS file / INI parameters
From: Luciano Coelho @ 2010-05-14 7:46 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273823184-9381-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
This patch updates the handling of the NVS file INI-section, trying to make
it slightly more generic, and exposing the parameters being set. This is done
in preparation for 5GHz parameters.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271.h | 28 +-------
drivers/net/wireless/wl12xx/wl1271_cmd.c | 14 ++--
drivers/net/wireless/wl12xx/wl1271_cmd.h | 26 ++++---
drivers/net/wireless/wl12xx/wl1271_ini.h | 118 ++++++++++++++++++++++++++++++
4 files changed, 142 insertions(+), 44 deletions(-)
create mode 100644 drivers/net/wireless/wl12xx/wl1271_ini.h
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 6f1b6b5..1e48e75 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -33,6 +33,7 @@
#include <net/mac80211.h>
#include "wl1271_conf.h"
+#include "wl1271_ini.h"
#define DRIVER_NAME "wl1271"
#define DRIVER_PREFIX DRIVER_NAME ": "
@@ -116,33 +117,6 @@ enum {
#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
-/* NVS data structure */
-#define WL1271_NVS_SECTION_SIZE 468
-
-#define WL1271_NVS_GENERAL_PARAMS_SIZE 57
-#define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \
- (WL1271_NVS_GENERAL_PARAMS_SIZE + 1)
-#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17
-#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \
- (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1)
-#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65
-#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \
- (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1)
-#define WL1271_NVS_FEM_COUNT 2
-#define WL1271_NVS_INI_SPARE_SIZE 124
-
-struct wl1271_nvs_file {
- /* NVS section */
- u8 nvs[WL1271_NVS_SECTION_SIZE];
-
- /* INI section */
- u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED];
- u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED];
- u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
- [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
- u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
-} __attribute__ ((packed));
-
/*
* Enable/disable 802.11a support for WL1273
*/
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 19393e2..241b477 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -212,8 +212,8 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
- memcpy(gen_parms->params, wl->nvs->general_params,
- WL1271_NVS_GENERAL_PARAMS_SIZE);
+ memcpy(&gen_parms->general_params, &wl->nvs->general_params,
+ sizeof(struct wl1271_ini_general_params));
ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
if (ret < 0)
@@ -238,11 +238,11 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
- memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params,
- WL1271_NVS_STAT_RADIO_PARAMS_SIZE);
- memcpy(radio_parms->dyn_radio_params,
- wl->nvs->dyn_radio_params[rparam->fem],
- WL1271_NVS_DYN_RADIO_PARAMS_SIZE);
+ memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2,
+ sizeof(struct wl1271_ini_band_params_2));
+ memcpy(&radio_parms->dyn_params_2,
+ &wl->nvs->dyn_radio_params_2[rparam->fem].params,
+ sizeof(struct wl1271_ini_fem_params_2));
/* FIXME: current NVS is missing 5GHz parameters */
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index f2820b4..4ff966f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -439,24 +439,30 @@ struct wl1271_general_parms_cmd {
struct wl1271_cmd_test_header test;
- u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE];
- s8 reserved[23];
-} __attribute__ ((packed));
+ struct wl1271_ini_general_params general_params;
-#define WL1271_STAT_RADIO_PARAMS_5_SIZE 29
-#define WL1271_DYN_RADIO_PARAMS_5_SIZE 104
+ u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 sr_sen_n_p;
+ u8 sr_sen_n_p_gain;
+ u8 sr_sen_nrn;
+ u8 sr_sen_prn;
+ u8 padding[3];
+} __attribute__ ((packed));
struct wl1271_radio_parms_cmd {
struct wl1271_cmd_header header;
struct wl1271_cmd_test_header test;
- u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE];
- u8 stat_radio_params_5[WL1271_STAT_RADIO_PARAMS_5_SIZE];
+ /* Static radio parameters */
+ struct wl1271_ini_band_params_2 static_params_2;
+ struct wl1271_ini_band_params_5 static_params_5;
- u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE];
- u8 reserved;
- u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE];
+ /* Dynamic radio parameters */
+ struct wl1271_ini_fem_params_2 dyn_params_2;
+ u8 padding2;
+ struct wl1271_ini_fem_params_5 dyn_params_5;
+ u8 padding3[2];
} __attribute__ ((packed));
struct wl1271_cmd_cal_channel_tune {
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h
new file mode 100644
index 0000000..d1590bc
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1271_ini.h
@@ -0,0 +1,118 @@
+/*
+ * This file is part of wl1271
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Contact: Luciano Coelho <luciano.coelho@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __WL1271_INI_H__
+#define __WL1271_INI_H__
+
+#define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
+
+struct wl1271_ini_general_params {
+ u8 ref_clock;
+ u8 settling_time;
+ u8 clk_valid_on_wakeup;
+ u8 dc2dc_mode;
+ u8 dual_mode_select;
+ u8 tx_bip_fem_auto_detect;
+ u8 tx_bip_fem_manufacturer;
+ u8 general_settings;
+ u8 sr_state;
+ u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+ u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
+} __attribute__ ((packed));
+
+#define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
+
+struct wl1271_ini_band_params_2 {
+ u8 rx_trace_insertion_loss;
+ u8 tx_trace_loss;
+ u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
+} __attribute__ ((packed));
+
+#define WL1271_INI_RATE_GROUP_COUNT 6
+#define WL1271_INI_CHANNEL_COUNT_2 14
+
+struct wl1271_ini_fem_params_2 {
+ __le16 tx_bip_ref_pd_voltage;
+ u8 tx_bip_ref_power;
+ u8 tx_bip_ref_offset;
+ u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
+ u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
+ u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
+ u8 rx_fem_insertion_loss;
+ u8 degraded_low_to_normal_thr;
+ u8 normal_to_degraded_high_thr;
+} __attribute__ ((packed));
+
+#define WL1271_INI_CHANNEL_COUNT_5 35
+#define WL1271_INI_SUB_BAND_COUNT_5 7
+
+struct wl1271_ini_band_params_5 {
+ u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
+} __attribute__ ((packed));
+
+struct wl1271_ini_fem_params_5 {
+ __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
+ u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
+ u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
+ u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
+ u8 degraded_low_to_normal_thr;
+ u8 normal_to_degraded_high_thr;
+} __attribute__ ((packed));
+
+
+/* NVS data structure */
+#define WL1271_INI_NVS_SECTION_SIZE 468
+#define WL1271_INI_SPARE_SIZE 124
+#define WL1271_INI_FEM_MODULE_COUNT 2
+
+struct wl1271_nvs_file {
+ /* NVS section */
+ u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
+
+ /* INI section */
+ struct wl1271_ini_general_params general_params;
+ u8 padding1;
+ struct wl1271_ini_band_params_2 stat_radio_params_2;
+ u8 padding2;
+ struct {
+ struct wl1271_ini_fem_params_2 params;
+ u8 padding;
+ } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
+
+ u8 ini_spare[WL1271_INI_SPARE_SIZE];
+} __attribute__ ((packed));
+
+#endif
--
1.6.3.3
^ permalink raw reply related
* [PATCH v2 2/3] wl1271: Add support for NVS files with 5GHz band parameters
From: Luciano Coelho @ 2010-05-14 7:46 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273823184-9381-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
This patch adds support for NVS files with 5GHz band parameters. The change
is done in a backward compatible manner - if 11a is not enabled in the driver,
the driver will allow also old NVS files to be loaded.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271_cmd.c | 9 ++++++++-
drivers/net/wireless/wl12xx/wl1271_ini.h | 11 ++++++++---
drivers/net/wireless/wl12xx/wl1271_main.c | 13 ++++++++++---
drivers/net/wireless/wl12xx/wl1271_testmode.c | 11 +++++++++--
4 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 241b477..d7bcce8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -238,13 +238,20 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM;
+ /* 2.4GHz parameters */
memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2,
sizeof(struct wl1271_ini_band_params_2));
memcpy(&radio_parms->dyn_params_2,
&wl->nvs->dyn_radio_params_2[rparam->fem].params,
sizeof(struct wl1271_ini_fem_params_2));
- /* FIXME: current NVS is missing 5GHz parameters */
+ /* 5GHz parameters */
+ memcpy(&radio_parms->static_params_5,
+ &wl->nvs->stat_radio_params_5,
+ sizeof(struct wl1271_ini_band_params_5));
+ memcpy(&radio_parms->dyn_params_5,
+ &wl->nvs->dyn_radio_params_5[rparam->fem].params,
+ sizeof(struct wl1271_ini_fem_params_5));
wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ",
radio_parms, sizeof(*radio_parms));
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h
index d1590bc..0fb156a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_ini.h
+++ b/drivers/net/wireless/wl12xx/wl1271_ini.h
@@ -95,9 +95,10 @@ struct wl1271_ini_fem_params_5 {
/* NVS data structure */
#define WL1271_INI_NVS_SECTION_SIZE 468
-#define WL1271_INI_SPARE_SIZE 124
#define WL1271_INI_FEM_MODULE_COUNT 2
+#define WL1271_INI_LEGACY_NVS_FILE_SIZE 800
+
struct wl1271_nvs_file {
/* NVS section */
u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
@@ -111,8 +112,12 @@ struct wl1271_nvs_file {
struct wl1271_ini_fem_params_2 params;
u8 padding;
} dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
-
- u8 ini_spare[WL1271_INI_SPARE_SIZE];
+ struct wl1271_ini_band_params_5 stat_radio_params_5;
+ u8 padding3;
+ struct {
+ struct wl1271_ini_fem_params_5 params;
+ u8 padding;
+ } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT];
} __attribute__ ((packed));
#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 933e432..371c394 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -566,14 +566,21 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
return ret;
}
- if (fw->size != sizeof(struct wl1271_nvs_file)) {
+ /*
+ * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
+ * configurations) can be removed when those NVS files stop floating
+ * around.
+ */
+ if (fw->size != sizeof(struct wl1271_nvs_file) &&
+ (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
+ wl1271_11a_enabled())) {
wl1271_error("nvs size is not as expected: %zu != %zu",
fw->size, sizeof(struct wl1271_nvs_file));
ret = -EILSEQ;
goto out;
}
- wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
+ wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
if (!wl->nvs) {
wl1271_error("could not allocate memory for the nvs file");
@@ -581,7 +588,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
goto out;
}
- memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file));
+ memcpy(wl->nvs, fw->data, fw->size);
out:
release_firmware(fw);
diff --git a/drivers/net/wireless/wl12xx/wl1271_testmode.c b/drivers/net/wireless/wl12xx/wl1271_testmode.c
index 554deb4..6e0952f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_testmode.c
+++ b/drivers/net/wireless/wl12xx/wl1271_testmode.c
@@ -199,7 +199,14 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
buf = nla_data(tb[WL1271_TM_ATTR_DATA]);
len = nla_len(tb[WL1271_TM_ATTR_DATA]);
- if (len != sizeof(struct wl1271_nvs_file)) {
+ /*
+ * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
+ * configurations) can be removed when those NVS files stop floating
+ * around.
+ */
+ if (len != sizeof(struct wl1271_nvs_file) &&
+ (len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
+ wl1271_11a_enabled())) {
wl1271_error("nvs size is not as expected: %zu != %zu",
len, sizeof(struct wl1271_nvs_file));
return -EMSGSIZE;
@@ -209,7 +216,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
kfree(wl->nvs);
- wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
+ wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL);
if (!wl->nvs) {
wl1271_error("could not allocate memory for the nvs file");
ret = -ENOMEM;
--
1.6.3.3
^ permalink raw reply related
* [PATCH v2 3/3] wl1271: Fix RX data path frame lengths
From: Luciano Coelho @ 2010-05-14 7:46 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Juuso Oikarinen
In-Reply-To: <1273823184-9381-1-git-send-email-luciano.coelho@nokia.com>
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
The current frame length used by the driver for RX frames is the SPI bus
transfer length. This length has padding bytes, which do not belong to the
WLAN frame.
As there is no other length information in the WLAN frame except the skb
length this problem caused for instance extra ESSID's to be listed at the
end of scan results (IE id 0) with zero length.
Fix the frame length by removing padding.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
drivers/net/wireless/wl12xx/wl1271_rx.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index 57f4bfd..b98fb64 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -113,6 +113,8 @@ static void wl1271_rx_handle_data(struct wl1271 *wl, u32 length)
wl1271_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len,
beacon ? "beacon" : "");
+ skb_trim(skb, skb->len - desc->pad_len);
+
memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
ieee80211_rx_ni(wl->hw, skb);
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH v2 0/3] wl1271: patches for wk19
From: Luciano Coelho @ 2010-05-14 7:46 UTC (permalink / raw)
To: linville; +Cc: linux-wireless
Hi John,
Here's v2 of our weekly patchset for the wl1271 driver, with no useless
internal tags.
Cheers,
Luca.
Juuso Oikarinen (3):
wl1271: Update handling of the NVS file / INI parameters
wl1271: Add support for NVS files with 5GHz band parameters
wl1271: Fix RX data path frame lengths
drivers/net/wireless/wl12xx/wl1271.h | 28 +------
drivers/net/wireless/wl12xx/wl1271_cmd.c | 25 +++--
drivers/net/wireless/wl12xx/wl1271_cmd.h | 26 +++--
drivers/net/wireless/wl12xx/wl1271_ini.h | 123 +++++++++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_main.c | 13 ++-
drivers/net/wireless/wl12xx/wl1271_rx.c | 2 +
drivers/net/wireless/wl12xx/wl1271_testmode.c | 11 ++-
7 files changed, 177 insertions(+), 51 deletions(-)
create mode 100644 drivers/net/wireless/wl12xx/wl1271_ini.h
^ permalink raw reply
* [PATCH] ath5k: consistently use rx_bufsize for RX DMA
From: Bruno Randolf @ 2010-05-14 7:50 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, bob, ath5k-devel, lrodriguez
We should use the same buffer size we set up for DMA also in the hardware
descriptor. Previously we used common->rx_bufsize for setting up the DMA
mapping, but skb_tailroom(skb) for the size we tell to the hardware in the
descriptor itself. The problem is that skb_tailroom(skb) can give us a larger
value than the size we set up for DMA before: In my case rx_bufsize is 2528,
and we allocated an skb of 2559 bytes length, including padding for cache
alignment, but sbk_tailroom() was 2592. Just consistently use rx_bufsize for
all RX DMA memory sizes.
Also check the return value of setup function.
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
PS: I'm not sure if this is enough to fix bug 15861, but it's definetly one
possibility where the hardware could write out of bounds. But the bug report
looks too similar to the ath9k one, so i suspect a common bug between ath5k and
ath9k. (?)
---
drivers/net/wireless/ath/ath5k/base.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9f42af7..5f24e4a 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1217,6 +1217,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
struct ath5k_hw *ah = sc->ah;
struct sk_buff *skb = bf->skb;
struct ath5k_desc *ds;
+ int ret;
if (!skb) {
skb = ath5k_rx_skb_alloc(sc, &bf->skbaddr);
@@ -1243,9 +1244,9 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
ds = bf->desc;
ds->ds_link = bf->daddr; /* link to self */
ds->ds_data = bf->skbaddr;
- ah->ah_setup_rx_desc(ah, ds,
- skb_tailroom(skb), /* buffer size */
- 0);
+ ret = ah->ah_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0);
+ if (ret)
+ return ret;
if (sc->rxlink != NULL)
*sc->rxlink = bf->daddr;
^ permalink raw reply related
* Re: Possible issue with mac80211 and certain access points
From: Johannes Berg @ 2010-05-14 7:59 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Chad Koehler, linux-wireless
In-Reply-To: <1273788460.375.76.camel@localhost.localdomain>
On Fri, 2010-05-14 at 00:07 +0200, Marcel Holtmann wrote:
> > Using the Palm Pre hotspot, I can get connected, but the connection
> > will drop after a very short period of time. There are messages in
> > the system log whenever the connection drops:
> actually I ran into the same issue two days ago and was going to post
> it. So what I am seeing with the Palm Pre is that when we actually scan
> while connected to the Palm Pre, a second later we end up disconnected.
So the Palm is acting as an AP? A beer for each of you says their AP
implementation is buggy.
johannes
^ permalink raw reply
* Re: [PATCH 1/3] cfg80211: Add nl80211 antenna configuration
From: Bruno Randolf @ 2010-05-14 8:10 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless, holgerschurig
In-Reply-To: <1273652994.3979.0.camel@jlt3.sipsolutions.net>
On Wednesday 12 May 2010 17:29:54 Johannes Berg wrote:
> On Wed, 2010-05-12 at 17:23 +0900, Bruno Randolf wrote:
> > + CMD(get_antenna, GET_ANTENNA);
>
> I'm wondering ... does get_antenna really make sense as a separate
> command? Seems like we could just as well report it as part of the wiphy
> information dump?
i don't insist on a separate command, but i don't know where else to put it.
you mean "iw phy0 info"? that shows more a list of possible configuration
options than the actual current configuration: like the list of channels,
modes, bitrates, supported commands, etc... with the exception of coverage
class... i feel like it doesn't really fit in there. maybe iw needs some
command to show the device configuration (channel, antenna, essid, bssid, etc
...)???
bruno
^ permalink raw reply
* Re: [PATCH] wl1271: remove sdio ARM dependency
From: Luciano Coelho @ 2010-05-14 8:23 UTC (permalink / raw)
To: ext Ohad Ben-Cohen; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1273743804-11587-1-git-send-email-ohad@wizery.com>
On Thu, 2010-05-13 at 11:43 +0200, ext Ohad Ben-Cohen wrote:
> Make it possible to use wl1271's SDIO interface on non-ARM platforms.
>
> Fully tested on a x86 platform, compile-tested on ARM.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> ---
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
One question, what wl1271 card are you using on an x86 platform?
--
Cheers,
Luca.
^ permalink raw reply
* RE: [PATCH v2] Libertas: Added callback functions to support SDIO suspend/resume.
From: Amitkumar Karwar @ 2010-05-14 8:43 UTC (permalink / raw)
To: 'Sascha Silbe', Kiran Divekar
Cc: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org
In-Reply-To: <20100513092013.GA22652@twin.sascha.silbe.org>
Hi Sascha,
> -----Original Message-----
> From: libertas-dev-bounces@lists.infradead.org [mailto:libertas-dev-
> bounces@lists.infradead.org] On Behalf Of Sascha Silbe
>
> On Wed, May 12, 2010 at 10:07:55PM -0700, Kiran Divekar wrote:
> [if_usb_suspend()]
> > + if (priv->wol_criteria == 0xffffffff) {
> Again, s/0xffffffff/EHS_REMOVE_WAKEUP/.
>
> > + lbs_pr_info("Suspend attempt without "
> > + "configuring wake params!\n");
> > + return -ENOSYS;
> > + }
> AFAICT this would cause a USB-connected libertas chip with WOL
> disabled ("ethtool eth0 d") to prevent suspend, instead of just
> powering down like an SDIO-connected chip. So instead of failing
> during
> lbs_host_sleep_cfg() because the 8388 doesn't support
> EHS_REMOVE_WAKEUP, you just bail out earlier, still breaking suspend.
>
Earlier also this check was there in lbs_suspend() (in main.c). I just moved it to if_usb_suspend (in if_usb.c). In both the cases It's going to bail out earlier. So I don't see any side affects on USB suspend due to this patch.
Your other comments looks fine to me. I will modify the patch accordingly.
>
> > diff --git a/drivers/net/wireless/libertas/main.c
> > b/drivers/net/wireless/libertas/main.c
Thanks,
Amit
^ permalink raw reply
* Re: [PATCH] wl1271: remove sdio ARM dependency
From: Ohad Ben-Cohen @ 2010-05-14 9:30 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1273825421.6318.98.camel@powerslave>
Hi Luciano,
On Fri, May 14, 2010 at 11:23 AM, Luciano Coelho
<luciano.coelho@nokia.com> wrote:
> On Thu, 2010-05-13 at 11:43 +0200, ext Ohad Ben-Cohen wrote:
>> Make it possible to use wl1271's SDIO interface on non-ARM platforms.
>>
>> Fully tested on a x86 platform, compile-tested on ARM.
>>
>> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
>> ---
>
> Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
>
> One question, what wl1271 card are you using on an x86 platform?
It's an embedded x86 platform with a specially made wl1271 card.
Not something that is widely available..
Thanks,
Ohad.
>
> --
> Cheers,
> Luca.
>
>
^ permalink raw reply
* [PATCH v3] libertas: Added callback functions to support SDIO suspend/resume.
From: Amitkumar Karwar @ 2010-05-14 9:32 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org
Cc: Kiran Divekar, Amitkumar Karwar
In suspend() host sleep is activated using already configured
host sleep parameters through wol command, and in resume() host
sleep is cancelled. Earlier priv->fw_ready flag used to reset and
set in suspend and resume handler respectively. Since after suspend
only host goes into sleep state and firmware is always ready, those
changes in flag state are removed.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
---
drivers/net/wireless/libertas/cmd.c | 37 ++++++++++++--
drivers/net/wireless/libertas/cmdresp.c | 30 ++---------
drivers/net/wireless/libertas/decl.h | 2 +-
drivers/net/wireless/libertas/dev.h | 6 ++
drivers/net/wireless/libertas/ethtool.c | 15 +++---
drivers/net/wireless/libertas/if_sdio.c | 58 ++++++++++++++++++++++
drivers/net/wireless/libertas/if_usb.c | 6 ++
drivers/net/wireless/libertas/main.c | 79 +++++++++++++++++++++---------
8 files changed, 171 insertions(+), 62 deletions(-)
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index cdb9b96..0fa6b0e 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -70,6 +70,8 @@ static u8 is_command_allowed_in_ps(u16 cmd)
switch (cmd) {
case CMD_802_11_RSSI:
return 1;
+ case CMD_802_11_HOST_SLEEP_CFG:
+ return 1;
default:
break;
}
@@ -185,6 +187,23 @@ out:
return ret;
}
+static int lbs_ret_host_sleep_cfg(struct lbs_private *priv, unsigned long dummy,
+ struct cmd_header *resp)
+{
+ lbs_deb_enter(LBS_DEB_CMD);
+ if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
+ priv->is_host_sleep_configured = 0;
+ if (priv->psstate == PS_STATE_FULL_POWER) {
+ priv->is_host_sleep_activated = 0;
+ wake_up_interruptible(&priv->host_sleep_q);
+ }
+ } else {
+ priv->is_host_sleep_configured = 1;
+ }
+ lbs_deb_leave(LBS_DEB_CMD);
+ return 0;
+}
+
int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
struct wol_config *p_wol_config)
{
@@ -202,12 +221,11 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
else
cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE;
- ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config);
+ ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config.hdr,
+ le16_to_cpu(cmd_config.hdr.size),
+ lbs_ret_host_sleep_cfg, 0);
if (!ret) {
- if (criteria) {
- lbs_deb_cmd("Set WOL criteria to %x\n", criteria);
- priv->wol_criteria = criteria;
- } else
+ if (p_wol_config)
memcpy((uint8_t *) p_wol_config,
(uint8_t *)&cmd_config.wol_conf,
sizeof(struct wol_config));
@@ -712,6 +730,10 @@ static void lbs_queue_cmd(struct lbs_private *priv,
}
}
+ if (le16_to_cpu(cmdnode->cmdbuf->command) ==
+ CMD_802_11_WAKEUP_CONFIRM)
+ addtail = 0;
+
spin_lock_irqsave(&priv->driver_lock, flags);
if (addtail)
@@ -1353,6 +1375,11 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
/* We don't get a response on the sleep-confirmation */
priv->dnld_sent = DNLD_RES_RECEIVED;
+ if (priv->is_host_sleep_configured) {
+ priv->is_host_sleep_activated = 1;
+ wake_up_interruptible(&priv->host_sleep_q);
+ }
+
/* If nothing to do, go back to sleep (?) */
if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx])
priv->psstate = PS_STATE_SLEEP;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 88f7131..d6c3063 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -17,6 +17,7 @@
#include "dev.h"
#include "assoc.h"
#include "wext.h"
+#include "cmd.h"
/**
* @brief This function handles disconnect event. it
@@ -341,32 +342,10 @@ done:
return ret;
}
-static int lbs_send_confirmwake(struct lbs_private *priv)
-{
- struct cmd_header cmd;
- int ret = 0;
-
- lbs_deb_enter(LBS_DEB_HOST);
-
- cmd.command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM);
- cmd.size = cpu_to_le16(sizeof(cmd));
- cmd.seqnum = cpu_to_le16(++priv->seqnum);
- cmd.result = 0;
-
- lbs_deb_hex(LBS_DEB_HOST, "wake confirm", (u8 *) &cmd,
- sizeof(cmd));
-
- ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &cmd, sizeof(cmd));
- if (ret)
- lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n");
-
- lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
- return ret;
-}
-
int lbs_process_event(struct lbs_private *priv, u32 event)
{
int ret = 0;
+ struct cmd_header cmd;
lbs_deb_enter(LBS_DEB_CMD);
@@ -410,7 +389,10 @@ int lbs_process_event(struct lbs_private *priv, u32 event)
if (priv->reset_deep_sleep_wakeup)
priv->reset_deep_sleep_wakeup(priv);
priv->is_deep_sleep = 0;
- lbs_send_confirmwake(priv);
+ lbs_cmd_async(priv, CMD_802_11_WAKEUP_CONFIRM, &cmd,
+ sizeof(cmd));
+ priv->is_host_sleep_activated = 0;
+ wake_up_interruptible(&priv->host_sleep_q);
break;
case MACREG_INT_CODE_DEEP_SLEEP_AWAKE:
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 709ffca..61db8bc 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -38,7 +38,7 @@ int lbs_set_mac_address(struct net_device *dev, void *addr);
void lbs_set_multicast_list(struct net_device *dev);
int lbs_suspend(struct lbs_private *priv);
-void lbs_resume(struct lbs_private *priv);
+int lbs_resume(struct lbs_private *priv);
void lbs_queue_event(struct lbs_private *priv, u32 event);
void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx);
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index a54880e..71c5ad4 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -75,6 +75,7 @@ struct lbs_private {
/* Deep sleep */
int is_deep_sleep;
+ int deep_sleep_required;
int is_auto_deep_sleep_enabled;
int wakeup_dev_required;
int is_activity_detected;
@@ -82,6 +83,11 @@ struct lbs_private {
wait_queue_head_t ds_awake_q;
struct timer_list auto_deepsleep_timer;
+ /* Host sleep*/
+ int is_host_sleep_configured;
+ int is_host_sleep_activated;
+ wait_queue_head_t host_sleep_q;
+
/* Hardware access */
void *card;
u8 fw_ready;
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 3804a58..6a36c99 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -91,23 +91,22 @@ static int lbs_ethtool_set_wol(struct net_device *dev,
struct ethtool_wolinfo *wol)
{
struct lbs_private *priv = dev->ml_priv;
- uint32_t criteria = 0;
if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY))
return -EOPNOTSUPP;
+ priv->wol_criteria = 0;
if (wol->wolopts & WAKE_UCAST)
- criteria |= EHS_WAKE_ON_UNICAST_DATA;
+ priv->wol_criteria |= EHS_WAKE_ON_UNICAST_DATA;
if (wol->wolopts & WAKE_MCAST)
- criteria |= EHS_WAKE_ON_MULTICAST_DATA;
+ priv->wol_criteria |= EHS_WAKE_ON_MULTICAST_DATA;
if (wol->wolopts & WAKE_BCAST)
- criteria |= EHS_WAKE_ON_BROADCAST_DATA;
+ priv->wol_criteria |= EHS_WAKE_ON_BROADCAST_DATA;
if (wol->wolopts & WAKE_PHY)
- criteria |= EHS_WAKE_ON_MAC_EVENT;
+ priv->wol_criteria |= EHS_WAKE_ON_MAC_EVENT;
if (wol->wolopts == 0)
- criteria |= EHS_REMOVE_WAKEUP;
-
- return lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL);
+ priv->wol_criteria |= EHS_REMOVE_WAKEUP;
+ return 0;
}
const struct ethtool_ops lbs_ethtool_ops = {
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 64dd345..575d433 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1182,11 +1182,69 @@ static void if_sdio_remove(struct sdio_func *func)
lbs_deb_leave(LBS_DEB_SDIO);
}
+static int if_sdio_suspend(struct device *dev)
+{
+ struct sdio_func *func = dev_to_sdio_func(dev);
+ int ret;
+ struct if_sdio_card *card = sdio_get_drvdata(func);
+
+ mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);
+
+ lbs_pr_info("%s: suspend: PM flags = 0x%x\n",
+ sdio_func_id(func), flags);
+
+ /* If we aren't being asked to wake on anything, we should bail out
+ * and let the SD stack power down the card.
+ */
+ if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) {
+ lbs_pr_info("Suspend without wake params -- "
+ "powering down card.");
+ return -ENOSYS;
+ }
+
+ if (!(flags & MMC_PM_KEEP_POWER)) {
+ lbs_pr_err("%s: cannot remain alive while host is suspended\n",
+ sdio_func_id(func));
+ return -ENOSYS;
+ }
+
+ ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
+ if (ret)
+ return ret;
+
+ ret = lbs_suspend(card->priv);
+ if (ret)
+ return ret;
+
+ return sdio_set_host_pm_flags(func, MMC_PM_WAKE_SDIO_IRQ);
+}
+
+static int if_sdio_resume(struct device *dev)
+{
+ struct sdio_func *func = dev_to_sdio_func(dev);
+ struct if_sdio_card *card = sdio_get_drvdata(func);
+ int ret;
+
+ lbs_pr_info("%s: resume: we're back\n", sdio_func_id(func));
+
+ ret = lbs_resume(card->priv);
+
+ return ret;
+}
+
+static struct const dev_pm_ops if_sdio_pm_ops = {
+ .suspend = if_sdio_suspend,
+ .resume = if_sdio_resume,
+};
+
static struct sdio_driver if_sdio_driver = {
.name = "libertas_sdio",
.id_table = if_sdio_ids,
.probe = if_sdio_probe,
.remove = if_sdio_remove,
+ .drv = {
+ .pm = &if_sdio_pm_ops,
+ },
};
/*******************************************************************/
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index fcea574..e5e6801 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -1047,6 +1047,12 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
if (priv->psstate != PS_STATE_FULL_POWER)
return -1;
+ if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
+ lbs_pr_info("Suspend attempt without "
+ "configuring wake params!\n");
+ return -ENOSYS;
+ }
+
ret = lbs_suspend(priv);
if (ret)
goto out;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index d35ebca..25c5734 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -625,16 +625,13 @@ static int lbs_thread(void *data)
return 0;
}
-static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy,
- struct cmd_header *cmd)
+static int lbs_ret_host_sleep_activate(struct lbs_private *priv,
+ unsigned long dummy,
+ struct cmd_header *cmd)
{
lbs_deb_enter(LBS_DEB_FW);
-
- netif_device_detach(priv->dev);
- if (priv->mesh_dev)
- netif_device_detach(priv->mesh_dev);
-
- priv->fw_ready = 0;
+ priv->is_host_sleep_activated = 1;
+ wake_up_interruptible(&priv->host_sleep_q);
lbs_deb_leave(LBS_DEB_FW);
return 0;
}
@@ -646,39 +643,65 @@ int lbs_suspend(struct lbs_private *priv)
lbs_deb_enter(LBS_DEB_FW);
- if (priv->wol_criteria == 0xffffffff) {
- lbs_pr_info("Suspend attempt without configuring wake params!\n");
- return -EINVAL;
+ if (priv->is_deep_sleep) {
+ ret = lbs_set_deep_sleep(priv, 0);
+ if (ret) {
+ lbs_pr_err("deep sleep cancellation failed: %d\n", ret);
+ return ret;
+ }
+ priv->deep_sleep_required = 1;
}
memset(&cmd, 0, sizeof(cmd));
+ ret = lbs_host_sleep_cfg(priv, priv->wol_criteria,
+ (struct wol_config *)NULL);
+ if (ret) {
+ lbs_pr_info("Host sleep configuration failed: %d\n", ret);
+ return ret;
+ }
+ if (priv->psstate == PS_STATE_FULL_POWER) {
+ ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd,
+ sizeof(cmd), lbs_ret_host_sleep_activate, 0);
+ if (ret)
+ lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret);
+ }
- ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd,
- sizeof(cmd), lbs_suspend_callback, 0);
- if (ret)
- lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret);
+ if (!wait_event_interruptible_timeout(priv->host_sleep_q,
+ priv->is_host_sleep_activated, (10 * HZ))) {
+ lbs_pr_err("host_sleep_q: timer expired\n");
+ ret = -1;
+ }
+ netif_device_detach(priv->dev);
+ if (priv->mesh_dev)
+ netif_device_detach(priv->mesh_dev);
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret;
}
EXPORT_SYMBOL_GPL(lbs_suspend);
-void lbs_resume(struct lbs_private *priv)
+int lbs_resume(struct lbs_private *priv)
{
- lbs_deb_enter(LBS_DEB_FW);
+ int ret;
+ uint32_t criteria = EHS_REMOVE_WAKEUP;
- priv->fw_ready = 1;
+ lbs_deb_enter(LBS_DEB_FW);
- /* Firmware doesn't seem to give us RX packets any more
- until we send it some command. Might as well update */
- lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
- 0, 0, NULL);
+ ret = lbs_host_sleep_cfg(priv, criteria, (struct wol_config *)NULL);
netif_device_attach(priv->dev);
if (priv->mesh_dev)
netif_device_attach(priv->mesh_dev);
- lbs_deb_leave(LBS_DEB_FW);
+ if (priv->deep_sleep_required) {
+ priv->deep_sleep_required = 0;
+ ret = lbs_set_deep_sleep(priv, 1);
+ if (ret)
+ lbs_pr_err("deep sleep activation failed: %d\n", ret);
+ }
+
+ lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
+ return ret;
}
EXPORT_SYMBOL_GPL(lbs_resume);
@@ -834,10 +857,13 @@ static int lbs_init_adapter(struct lbs_private *priv)
priv->psstate = PS_STATE_FULL_POWER;
priv->is_deep_sleep = 0;
priv->is_auto_deep_sleep_enabled = 0;
+ priv->deep_sleep_required = 0;
priv->wakeup_dev_required = 0;
init_waitqueue_head(&priv->ds_awake_q);
priv->authtype_auto = 1;
-
+ priv->is_host_sleep_configured = 0;
+ priv->is_host_sleep_activated = 0;
+ init_waitqueue_head(&priv->host_sleep_q);
mutex_init(&priv->lock);
setup_timer(&priv->command_timer, lbs_cmd_timeout_handler,
@@ -976,6 +1002,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
priv->wol_criteria = 0xffffffff;
priv->wol_gpio = 0xff;
+ priv->wol_gap = 20;
goto done;
@@ -1031,6 +1058,10 @@ void lbs_remove_card(struct lbs_private *priv)
wake_up_interruptible(&priv->ds_awake_q);
}
+ priv->is_host_sleep_configured = 0;
+ priv->is_host_sleep_activated = 0;
+ wake_up_interruptible(&priv->host_sleep_q);
+
/* Stop the thread servicing the interrupts */
priv->surpriseremoved = 1;
kthread_stop(priv->main_thread);
--
1.5.3.4
^ permalink raw reply related
* [PATCH 1/2] ath9k: fix dma direction for map/unmap in ath_rx_tasklet
From: tom.leiming @ 2010-05-14 13:15 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, linville, Ming Lei
From: Ming Lei <tom.leiming@gmail.com>
For edma, we should use DMA_BIDIRECTIONAL, or else use
DMA_FROM_DEVICE.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
drivers/net/wireless/ath/ath9k/recv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ba13913..a3fe6e1 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -838,9 +838,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
int dma_type;
if (edma)
- dma_type = DMA_FROM_DEVICE;
- else
dma_type = DMA_BIDIRECTIONAL;
+ else
+ dma_type = DMA_FROM_DEVICE;
qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP;
spin_lock_bh(&sc->rx.rxbuflock);
--
1.6.2.5
^ permalink raw reply related
* [PATCH 2/2] ath9k: fix dma sync in rx path
From: tom.leiming @ 2010-05-14 13:16 UTC (permalink / raw)
To: lrodriguez; +Cc: linux-wireless, linville, Ming Lei
In-Reply-To: <1273842938-3401-1-git-send-email-tom.leiming@gmail.com>
From: Ming Lei <tom.leiming@gmail.com>
If buffer is to be accessed by cpu after dma transfer is over, but
between dma mapping and dma unmapping, we should use
dma_sync_single_for_cpu to sync the buffer between cpu with
device. And dma_sync_single_for_device is used to let
device gain the buffer again.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
drivers/net/wireless/ath/ath9k/recv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index a3fe6e1..96f5d83 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -694,7 +694,7 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
bf = SKB_CB_ATHBUF(skb);
BUG_ON(!bf);
- dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
+ dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
common->rx_bufsize, DMA_FROM_DEVICE);
ret = ath9k_hw_process_rxdesc_edma(ah, NULL, skb->data);
@@ -808,7 +808,7 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
* 1. accessing the frame
* 2. requeueing the same buffer to h/w
*/
- dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
+ dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
common->rx_bufsize,
DMA_FROM_DEVICE);
--
1.6.2.5
^ permalink raw reply related
* [patch -next 2/2] ath9k/debug: fixup the return codes
From: Dan Carpenter @ 2010-05-14 13:25 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Jouni Malinen, Sujith Manoharan, Vasanthakumar Thiagarajan,
Senthil Balasubramanian, John W. Linville, Felix Fietkau,
Jeff Hansen, linux-wireless, ath9k-devel
Changed -EINVAL to -EFAULT if copy_to_user() failed.
Changed 0 to -ENOMEM if allocations failed.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index f344128..3123d16 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -56,7 +56,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
- return -EINVAL;
+ return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, &mask))
@@ -100,7 +100,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
- return -EINVAL;
+ return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, &mask))
@@ -142,7 +142,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
- return -EINVAL;
+ return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, &mask))
@@ -175,7 +175,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL);
if (!buf)
- return 0;
+ return -ENOMEM;
ath9k_ps_wakeup(sc);
@@ -405,7 +405,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
max = 80 + sc->cur_rate_table->rate_cnt * 1024 + 1;
buf = kmalloc(max, GFP_KERNEL);
if (buf == NULL)
- return 0;
+ return -ENOMEM;
len += sprintf(buf, "%6s %6s %6s "
"%10s %10s %10s %10s\n",
@@ -640,7 +640,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)
- return 0;
+ return -ENOMEM;
len += sprintf(buf, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO");
@@ -713,7 +713,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)
- return 0;
+ return -ENOMEM;
len += snprintf(buf + len, size - len,
"%18s : %10u\n", "CRC ERR",
@@ -832,7 +832,7 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
- return -EINVAL;
+ return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, ®idx))
@@ -874,7 +874,7 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
- return -EINVAL;
+ return -EFAULT;
buf[len] = '\0';
if (strict_strtoul(buf, 0, ®val))
^ permalink raw reply related
* [patch -next 1/2] ath9k/debug: improve the snprintf() handling
From: Dan Carpenter @ 2010-05-14 13:24 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Jouni Malinen, Sujith Manoharan, Vasanthakumar Thiagarajan,
Senthil Balasubramanian, John W. Linville, Felix Fietkau,
Jeff Hansen, linux-wireless, ath9k-devel
The snprintf() function returns the number of bytes that *would* have
been written (not counting the NULL terminator) and that can potentally
be more than the size of the buffer.
In this patch if there were one liners where string clearly fits into
the buffer, then I changed snprintf to sprintf(). It's confusing to use
the return value of snprintf() as a limitter without verifying that it's
smaller than size. This is what initially caught my attention here.
If we use the return value of sprintf() instead future code auditors will
assume we've verified that it fits already.
Also I did find some places where it made sense to use the return value
after we've verified that it is smaller than the buffer size.
Finally the read_file_rcstat() function added an explicit NULL terminator
before calling snprintf(). That's unnecessary because snprintf() will
add the null terminator automatically.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 2ca9bba..f344128 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -41,7 +41,7 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf,
char buf[32];
unsigned int len;
- len = snprintf(buf, sizeof(buf), "0x%08x\n", common->debug_mask);
+ len = sprintf(buf, "0x%08x\n", common->debug_mask);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -85,7 +85,7 @@ static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
char buf[32];
unsigned int len;
- len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask);
+ len = sprintf(buf, "0x%08x\n", common->tx_chainmask);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -127,7 +127,7 @@ static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
char buf[32];
unsigned int len;
- len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask);
+ len = sprintf(buf, "0x%08x\n", common->rx_chainmask);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -247,6 +247,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
ath9k_ps_restore(sc);
+ if (len > DMA_BUF_LEN)
+ len = DMA_BUF_LEN;
+
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
@@ -357,6 +360,9 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
len += snprintf(buf + len, sizeof(buf) - len,
"%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total);
+ if (len > sizeof(buf))
+ len = sizeof(buf);
+
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -396,11 +402,10 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
if (sc->cur_rate_table == NULL)
return 0;
- max = 80 + sc->cur_rate_table->rate_cnt * 1024;
- buf = kmalloc(max + 1, GFP_KERNEL);
+ max = 80 + sc->cur_rate_table->rate_cnt * 1024 + 1;
+ buf = kmalloc(max, GFP_KERNEL);
if (buf == NULL)
return 0;
- buf[max] = 0;
len += sprintf(buf, "%6s %6s %6s "
"%10s %10s %10s %10s\n",
@@ -442,6 +447,9 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
stats->per);
}
+ if (len > max)
+ len = max;
+
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
@@ -504,6 +512,9 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
len += snprintf(buf + len, sizeof(buf) - len,
"addrmask: %pM\n", addr);
+ if (len > sizeof(buf))
+ len = sizeof(buf);
+
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -647,6 +658,9 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
PR("DATA Underrun: ", data_underrun);
PR("DELIM Underrun: ", delim_underrun);
+ if (len > size)
+ len = size;
+
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
@@ -750,6 +764,9 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL);
PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL);
+ if (len > size)
+ len = size;
+
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
@@ -801,7 +818,7 @@ static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
char buf[32];
unsigned int len;
- len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx);
+ len = sprintf(buf, "0x%08x\n", sc->debug.regidx);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
@@ -842,7 +859,7 @@ static ssize_t read_file_regval(struct file *file, char __user *user_buf,
u32 regval;
regval = REG_READ_D(ah, sc->debug.regidx);
- len = snprintf(buf, sizeof(buf), "0x%08x\n", regval);
+ len = sprintf(buf, "0x%08x\n", regval);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
^ permalink raw reply related
* RTL8185 mlme.c:341 warning and failure still in 2.6.34rc7
From: Andi Kleen @ 2010-05-14 13:37 UTC (permalink / raw)
To: linux-wireless, linux-kernel, rjw
[ccing Rafael because this seems to be a regression. Please add it to your list.]
When I boot my system with a RTL8185 the wireless doesn't come up at boot,
only when I manually restart it. Instead i get
I reported this a few rc*s back, but haven't heard anything back and the
problem is still there.
For me it's a serious problem when the wireless does not come up.
This didn't happen in .33.
-Andi
wlan0: authenticate with 00:1f:3f:1d:54:46 (try 1)
wlan0: authenticated
wlan0: associate with 00:1f:3f:1d:54:46 (try 1)
wlan0: associate with 00:1f:3f:1d:54:46 (try 2)
wlan0: associate with 00:1f:3f:1d:54:46 (try 3)
wlan0: association with 00:1f:3f:1d:54:46 timed out
------------[ cut here ]------------
WARNING: at /home/lsrc/linux-2.6.34-rc7/net/wireless/mlme.c:341 cfg80211_send_assoc_timeout+0xff/0x117 [cfg80211]()
Hardware name: ...
Modules linked in: ...
Pid: 3344, comm: phy0 Not tainted 2.6.34-rc7 #7
Call Trace:
[<ffffffffa0072124>] ? cfg80211_send_assoc_timeout+0xff/0x117 [cfg80211]
[<ffffffff8103a4f0>] warn_slowpath_common+0x7c/0xa9
[<ffffffff8103a531>] warn_slowpath_null+0x14/0x16
[<ffffffffa0072124>] cfg80211_send_assoc_timeout+0xff/0x117 [cfg80211]
[<ffffffffa00e6393>] ieee80211_assoc_done+0x74/0xa9 [mac80211]
[<ffffffffa00e85f0>] ieee80211_work_work+0xe4c/0xe8d [mac80211]
[<ffffffff81033cbe>] ? finish_task_switch+0x42/0xab
[<ffffffff810535d7>] ? prepare_to_wait+0x6e/0x7a
[<ffffffff8104f832>] worker_thread+0x192/0x227
[<ffffffffa00e77a4>] ? ieee80211_work_work+0x0/0xe8d [mac80211]
[<ffffffff81053342>] ? autoremove_wake_function+0x0/0x3d
[<ffffffff8104f6a0>] ? worker_thread+0x0/0x227
[<ffffffff81052efc>] kthread+0x82/0x8a
[<ffffffff81003954>] kernel_thread_helper+0x4/0x10
[<ffffffff81052e7a>] ? kthread+0x0/0x8a
[<ffffffff81003950>] ? kernel_thread_helper+0x0/0x10
---[ end trace 4e3067114aa2fd06 ]---
wlan0: deauthenticating from 00:1f:3f:1d:54:46 by local choice (reason=3)
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* Re: [PATCH] mac80211: Add HT IE to IBSS beacons and probe responses
From: Johannes Berg @ 2010-05-14 13:56 UTC (permalink / raw)
To: Benoit Papillault; +Cc: linux-wireless
In-Reply-To: <1273698460-18061-4-git-send-email-benoit.papillault@free.fr>
> @@ -103,7 +104,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
> sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
>
> local->oper_channel = chan;
> - WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT));
> + WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type));
> ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
This is incorrect .. you need to fall back to HT20 when HT40 fails, like
mlme.c does.
> /* fix ourselves to that channel now already */
> if (params->channel_fixed) {
> sdata->local->oper_channel = params->channel;
> WARN_ON(!ieee80211_set_channel_type(sdata->local, sdata,
> - NL80211_CHAN_NO_HT));
> + params->channel_type));
> }
Same here.
> u16 transaction, u16 auth_alg,
> u8 *extra, size_t extra_len, const u8 *bssid,
> const u8 *key, u8 key_len, u8 key_idx);
> +
> +u8 *ieee80211_add_ht_cap(u8 *pos,
> + struct ieee80211_supported_band *sband);
> +
> +u8 *ieee80211_add_ht_info(u8 *pos,
> + struct ieee80211_supported_band *sband,
> + struct ieee80211_channel *channel,
> + enum nl80211_channel_type channel_type);
> +
> +enum nl80211_channel_type ieee80211_channel_type_from_ht_info(
> + struct ieee80211_local *local,
> + struct ieee80211_ht_info *hti, u16 ap_ht_cap_flags);
> +
> int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
> const u8 *ie, size_t ie_len,
> enum ieee80211_band band);
Didn't you just do this in the first patch??
johannes
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox