* Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
From: Mark Brown @ 2013-10-28 19:23 UTC (permalink / raw)
To: Grazvydas Ignotas
Cc: Alexander Shiyan, Luciano Coelho, Mark Rutland, devicetree,
Russell King, Pawel Moll, Ian Campbell, Tony Lindgren,
Greg Kroah-Hartman, Stephen Warren, linux-doc, John W. Linville,
Rob Herring, linux-kernel@vger.kernel.org, Sachin Kamat,
Bill Pemberton, Felipe Balbi, Rob Landley, netdev,
linux-wireless@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <CANOLnONKcC1i19ypb4rh2Rff3WsVhhuUhNvZvYwDV2-ZNtjVxQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]
On Mon, Oct 28, 2013 at 07:29:52PM +0200, Grazvydas Ignotas wrote:
> When wl12xx family of chips is connected through SDIO, we already have
> that pin set up as a regulator controlled with the help of mmc
> subsystem. When time comes to communicate with the chip, mmc subsystem
> sees this as yet another SD card and looks for associated regulator
> for it, and the board file has that set up as a fixed regulator
> controlling that pin (see pandora_vmmc3 in
> arch/arm/mach-omap2/board-omap3pandora.c). To prevent poweroff after
> first SDIO communications are over, pm_runtime calls are used in
> drivers/net/wireless/ti/wl1251/sdio.c .
Is this actually controlling VMMC though, or is it some other control?
If it's not controlling VMMC then it shouldn't say that it is.
> I don't know if something similar can be done done in SPI case, but
> I'm sure this is not the first your-so-called regulator misuse.
It's not the first but that doesn't make controlling something other
than a regulator through the regulator API any less broken.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] cfg80211/nl80211: Add support to report unsafe frequency ranges(s)
From: Dan Williams @ 2013-10-28 19:01 UTC (permalink / raw)
To: Chauhan, Rajesh
Cc: Rodriguez, Luis, Johannes Berg, linux-wireless@vger.kernel.org,
Malinen, Jouni, Bahini, Henri, Chang, Leo, Luo, Xun
In-Reply-To: <D19FD2B13A40CD4B8DA64DB9B8F112E9218E461D@nasanexd01a.na.qualcomm.com>
On Mon, 2013-10-28 at 18:08 +0000, Chauhan, Rajesh wrote:
> Hi Luis,
>
> For "enough information for proper usage" - how about if I add an attribute for the source of interference (say, for example, "cellular") for each of those frequency range?
When you say "cellular" here, do mean a WWAN card in the same machine,
sharing the antenna (or using a very very nearby antenna) with the WiFi
card? Or do you mean a close-by phone, or a tower itself? How is this
different from BT coexistence or WiMAX coexistence?
Dan
> Regards,
> Rajesh Chauhan
>
> -----Original Message-----
> From: mcgrof@gmail.com [mailto:mcgrof@gmail.com] On Behalf Of Luis R. Rodriguez
> Sent: Sunday, October 20, 2013 3:39 AM
> To: Chauhan, Rajesh
> Cc: Dan Williams; Johannes Berg; linux-wireless@vger.kernel.org; Malinen, Jouni; Bahini, Henri; Chang, Leo; Luo, Xun
> Subject: Re: [PATCH] cfg80211/nl80211: Add support to report unsafe frequency ranges(s)
>
> On Thu, Oct 17, 2013 at 9:51 PM, Chauhan, Rajesh <rajeshc@qca.qualcomm.com> wrote:
> > Hi Dan,
> >
> > Thanks for your comments.
> >
> > Current patch is to report event asynchronously and that would be needed even if we have your suggested interface of client collecting that information upfront, which seems like you also kind of agree, because RF environment may change later and generating an event at that time with frequency details would help. So your suggested approach of "mechanism for the client to get this information" in itself seems like a candidate for a separate patch.
>
> The infrastructure for this sort of thing that me, Inaky and Marcel had proposed in 2007 is the Frequency Broker:
>
> http://wireless.kernel.org/en/developers/FrequencyBroker
>
> > On the race condition which you described - thanks!, but it is something which implementation of driver would need to take care. Similarly, user space can have implementation to cache information on receipt of the event to use it later.
>
> This patch is vague. Once we set something as API we have to live with it, I am not comfortable with this patch having enough information for proper usage by different drivers for the same purpose or intent. The only real positive argument that could be used here is where something like Android might have already embraced some similar API but are we going to always just enable API on Linux just because Android did it without thinking about proper long term architecture? I don't think so.
>
> Luis
^ permalink raw reply
* Re: I always need a miracle to connect with iwlwifi
From: Felipe Contreras @ 2013-10-28 18:43 UTC (permalink / raw)
To: Krishna Chaitanya
Cc: Oleksij Rempel, ilw, hostap@lists.shmoo.com,
linux-wireless Mailing List
In-Reply-To: <CABPxzY+xJ7kst-sYwP8RJwMO_zkNYWKaYy=_LS7WQfuxquK24w@mail.gmail.com>
On Mon, Oct 28, 2013 at 12:28 PM, Krishna Chaitanya
<chaitanya.mgit@gmail.com> wrote:
> On Mon, Oct 28, 2013 at 11:30 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>
>> The authentication response does come back in both cases though, it's
>> just the acknowledgement that is missing. Unfortunately I cannot
>> figure out for which message it's the ack.
>>
>> Also, I notice the sequence number received from the router doesn't
>> seem to change. All the authentication requests received have the same
>> number (256). Another peculiar thing is that in the failed case the SN
>> we send starts with 0.
>>
>> I suppose since the authentication ack never arrives, the next steps
>> are never completed.
>>
>> Does that help?
> From the supplicant logs we have successfully received the
> authentication response
> and sent out the association request. So are you referring to not receiving ACK
> for association request??
No, from the capture there's no association request in the bad case,
only in the good one.
> It would be nice to get the capture without any filters?
http://people.freedesktop.org/~felipec/wpa/wpa-bad.pcapng
http://people.freedesktop.org/~felipec/wpa/wpa-good.pcapng
--
Felipe Contreras
^ permalink raw reply
* Re: I always need a miracle to connect with iwlwifi
From: Krishna Chaitanya @ 2013-10-28 18:28 UTC (permalink / raw)
To: Felipe Contreras
Cc: Oleksij Rempel, ilw, hostap@lists.shmoo.com,
linux-wireless Mailing List
In-Reply-To: <CAMP44s2Cvw9HF3c3Asuq+bTSD36Gw6PXOUVjAcCD+hf6KB_awg@mail.gmail.com>
On Mon, Oct 28, 2013 at 11:30 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> The authentication response does come back in both cases though, it's
> just the acknowledgement that is missing. Unfortunately I cannot
> figure out for which message it's the ack.
>
> Also, I notice the sequence number received from the router doesn't
> seem to change. All the authentication requests received have the same
> number (256). Another peculiar thing is that in the failed case the SN
> we send starts with 0.
>
> I suppose since the authentication ack never arrives, the next steps
> are never completed.
>
> Does that help?
>From the supplicant logs we have successfully received the
authentication response
and sent out the association request. So are you referring to not receiving ACK
for association request??
It would be nice to get the capture without any filters?
--
Thanks,
Regards,
Chaitanya T K.
Mobile:+91-9963910010.
^ permalink raw reply
* [PATCH 5/5] cfg80211: fix dfs channel state after stopping AP
From: Janusz Dziedzic @ 2013-10-28 18:27 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Marek Puzyniak
In-Reply-To: <1382984824-3729-1-git-send-email-janusz.dziedzic@tieto.com>
From: Marek Puzyniak <marek.puzyniak@tieto.com>
This can be called when a mode of operation that can supports
initiating radiation on a DFS channel leaves that channel to
ensure that if the mode of operation is started again on it
that it will require a new channel availability check.
Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
include/net/cfg80211.h | 10 ++++++++++
net/mac80211/cfg.c | 6 ++++++
net/wireless/mlme.c | 7 +++++++
3 files changed, 23 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8b52fcb..cc1ba48 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4135,6 +4135,16 @@ void cfg80211_cac_event(struct net_device *netdev,
struct cfg80211_chan_def *chandef,
enum nl80211_radar_event event, gfp_t gfp);
+/**
+ * cfg80211_leave_dfs_channel - Leaving dfs channel
+ * @wiphy: the wiphy
+ * @chandef: chandef for the current channel
+ *
+ * This function is called when dfs channel is being not used for diffrent
+ * reasons. Make channel DFS USABLE again.
+ */
+void cfg80211_leave_dfs_channel(struct wiphy *wiphy,
+ struct cfg80211_chan_def *chandef);
/**
* cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5690d21..10778ae 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1096,6 +1096,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL);
+ } else if (sdata->radar_required) {
+ /*
+ * AP stopped on DFS channel so change that channel state
+ * to NL80211_DFS_USABLE again.
+ */
+ cfg80211_leave_dfs_channel(wiphy, &sdata->vif.bss_conf.chandef);
}
drv_stop_ap(sdata->local, sdata);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index a50c27b..c75b1d3 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -797,3 +797,10 @@ void cfg80211_cac_event(struct net_device *netdev,
nl80211_radar_notify(rdev, chandef, event, netdev, gfp);
}
EXPORT_SYMBOL(cfg80211_cac_event);
+
+void cfg80211_leave_dfs_channel(struct wiphy *wiphy,
+ struct cfg80211_chan_def *chandef)
+{
+ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_USABLE);
+}
+EXPORT_SYMBOL(cfg80211_leave_dfs_channel);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/5] cfg80211: add helper functions for start/end freq
From: Janusz Dziedzic @ 2013-10-28 18:27 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Janusz Dziedzic
In-Reply-To: <1382984824-3729-1-git-send-email-janusz.dziedzic@tieto.com>
Add helper fuctions for start/end freq.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
net/wireless/chan.c | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 16f3c3a..f74dae3 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -277,6 +277,32 @@ void cfg80211_set_dfs_state(struct wiphy *wiphy,
width, dfs_state);
}
+static u32 cfg80211_get_start_freq(u32 center_freq,
+ u32 bandwidth)
+{
+ u32 start_freq;
+
+ if (bandwidth <= 20)
+ start_freq = center_freq;
+ else
+ start_freq = center_freq - bandwidth/2 + 10;
+
+ return start_freq;
+}
+
+static u32 cfg80211_get_end_freq(u32 center_freq,
+ u32 bandwidth)
+{
+ u32 end_freq;
+
+ if (bandwidth <= 20)
+ end_freq = center_freq;
+ else
+ end_freq = center_freq + bandwidth/2 - 10;
+
+ return end_freq;
+}
+
static int cfg80211_get_chans_dfs_required(struct wiphy *wiphy,
u32 center_freq,
u32 bandwidth)
@@ -284,13 +310,8 @@ static int cfg80211_get_chans_dfs_required(struct wiphy *wiphy,
struct ieee80211_channel *c;
u32 freq, start_freq, end_freq;
- if (bandwidth <= 20) {
- start_freq = center_freq;
- end_freq = center_freq;
- } else {
- start_freq = center_freq - bandwidth/2 + 10;
- end_freq = center_freq + bandwidth/2 - 10;
- }
+ start_freq = cfg80211_get_start_freq(center_freq, bandwidth);
+ end_freq = cfg80211_get_end_freq(center_freq, bandwidth);
for (freq = start_freq; freq <= end_freq; freq += 20) {
c = ieee80211_get_channel(wiphy, freq);
@@ -337,13 +358,8 @@ static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
struct ieee80211_channel *c;
u32 freq, start_freq, end_freq;
- if (bandwidth <= 20) {
- start_freq = center_freq;
- end_freq = center_freq;
- } else {
- start_freq = center_freq - bandwidth/2 + 10;
- end_freq = center_freq + bandwidth/2 - 10;
- }
+ start_freq = cfg80211_get_start_freq(center_freq, bandwidth);
+ end_freq = cfg80211_get_end_freq(center_freq, bandwidth);
for (freq = start_freq; freq <= end_freq; freq += 20) {
c = ieee80211_get_channel(wiphy, freq);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 4/5] cfg80211: DFS check chandef usable before CAC
From: Janusz Dziedzic @ 2013-10-28 18:27 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Janusz Dziedzic
In-Reply-To: <1382984824-3729-1-git-send-email-janusz.dziedzic@tieto.com>
Check chandef we get in CAC request is usable for CAC.
All channels have to be DFS channels. Allow DFS_USABLE
and DFS_AVAILABLE channels mix. At least one channel
has to be DFS_USABLE (require CAC).
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
net/wireless/chan.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
net/wireless/core.h | 11 +++++++
net/wireless/nl80211.c | 2 +-
3 files changed, 87 insertions(+), 1 deletion(-)
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index f74dae3..a6f5c4c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -351,6 +351,81 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
}
EXPORT_SYMBOL(cfg80211_chandef_dfs_required);
+static int cfg80211_get_chans_dfs_usable(struct wiphy *wiphy,
+ u32 center_freq,
+ u32 bandwidth)
+{
+ struct ieee80211_channel *c;
+ u32 freq, start_freq, end_freq;
+ int count = 0;
+
+ start_freq = cfg80211_get_start_freq(center_freq, bandwidth);
+ end_freq = cfg80211_get_end_freq(center_freq, bandwidth);
+
+ /*
+ * Check entire range of channels for the bandwidth.
+ * Check all channels are DFS channels (DFS_USABLE or
+ * DFS_AVAILABLE). Return number of usable channels
+ * (require CAC).
+ */
+ for (freq = start_freq; freq <= end_freq; freq += 20) {
+ c = ieee80211_get_channel(wiphy, freq);
+ if (!c)
+ return -EINVAL;
+
+ if (c->flags & IEEE80211_CHAN_DISABLED)
+ return -EINVAL;
+
+ if (!(c->flags & IEEE80211_CHAN_RADAR))
+ return -EINVAL;
+
+ if (c->dfs_state == NL80211_DFS_UNAVAILABLE)
+ return -EINVAL;
+
+ if (c->dfs_state == NL80211_DFS_USABLE)
+ count++;
+ }
+
+ return count;
+}
+
+bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
+ const struct cfg80211_chan_def *chandef)
+{
+ int width;
+ int r1, r2 = 0;
+
+ if (WARN_ON(!cfg80211_chandef_valid(chandef)))
+ return false;
+
+ width = cfg80211_chandef_get_width(chandef);
+ if (width < 0)
+ return false;
+
+ r1 = cfg80211_get_chans_dfs_usable(wiphy, chandef->center_freq1,
+ width);
+
+ if (r1 < 0)
+ return false;
+
+ switch (chandef->width) {
+ case NL80211_CHAN_WIDTH_80P80:
+ WARN_ON(!chandef->center_freq2);
+ r2 = cfg80211_get_chans_dfs_usable(wiphy,
+ chandef->center_freq2,
+ width);
+ if (r2 < 0)
+ return false;
+ break;
+ default:
+ WARN_ON(chandef->center_freq2);
+ break;
+ }
+
+ return (r1 + r2 > 0);
+}
+
+
static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
u32 center_freq, u32 bandwidth,
u32 prohibited_flags)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index eb0f7a3..eb24a53 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -382,6 +382,17 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
enum cfg80211_chan_mode chanmode,
u8 radar_detect);
+/**
+ * cfg80211_chandef_dfs_usable - checks if chandef is usable and we can
+ * start CAC on such chandef.
+ * @wiphy: the wiphy to validate against
+ * @chandef: the channel definition to check
+ * Return: Return true if all channels available and at least
+ * one channel required CAC (NL80211_DFS_USABLE)
+ */
+bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
+ const struct cfg80211_chan_def *chandef);
+
void cfg80211_set_dfs_state(struct wiphy *wiphy,
const struct cfg80211_chan_def *chandef,
enum nl80211_dfs_state dfs_state);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cbbef88..1cb1cd9 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5604,7 +5604,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
if (err == 0)
return -EINVAL;
- if (chandef.chan->dfs_state != NL80211_DFS_USABLE)
+ if (!cfg80211_chandef_dfs_usable(wdev->wiphy, &chandef))
return -EINVAL;
if (!rdev->ops->start_radar_detection)
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/5] cfg80211/mac80211: DFS setup chandef for cac event
From: Janusz Dziedzic @ 2013-10-28 18:27 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Janusz Dziedzic
To report channel width correctly we have
to send correct channel parameters from
mac80211 when calling cfg80211_cac_event().
This is required in case of using channel width
higher than 20MHz and we have to set correct
dfs channel state after CAC (NL80211_DFS_AVAILABLE).
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
include/net/cfg80211.h | 2 ++
net/mac80211/cfg.c | 5 ++++-
net/mac80211/iface.c | 5 ++++-
net/mac80211/mlme.c | 6 ++++--
net/mac80211/util.c | 3 +++
net/wireless/mlme.c | 8 +++-----
6 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 45f6bf5..8b52fcb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4123,6 +4123,7 @@ void cfg80211_radar_event(struct wiphy *wiphy,
/**
* cfg80211_cac_event - Channel availability check (CAC) event
* @netdev: network device
+ * @chandef: chandef for the current channel
* @event: type of event
* @gfp: context flags
*
@@ -4131,6 +4132,7 @@ void cfg80211_radar_event(struct wiphy *wiphy,
* also by full-MAC drivers.
*/
void cfg80211_cac_event(struct net_device *netdev,
+ struct cfg80211_chan_def *chandef,
enum nl80211_radar_event event, gfp_t gfp);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7501497..5690d21 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1050,6 +1050,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
struct ieee80211_local *local = sdata->local;
struct beacon_data *old_beacon;
struct probe_resp *old_probe_resp;
+ struct cfg80211_chan_def chandef;
old_beacon = rtnl_dereference(sdata->u.ap.beacon);
if (!old_beacon)
@@ -1090,8 +1091,10 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
if (sdata->wdev.cac_started) {
+ chandef = sdata->vif.bss_conf.chandef;
cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
- cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_ABORTED,
+ cfg80211_cac_event(sdata->dev, &chandef,
+ NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL);
}
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index e48f103..cb5e339 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -749,6 +749,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
u32 hw_reconf_flags = 0;
int i, flushed;
struct ps_data *ps;
+ struct cfg80211_chan_def chandef;
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
@@ -823,11 +824,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
if (sdata->wdev.cac_started) {
+ chandef = sdata->vif.bss_conf.chandef;
WARN_ON(local->suspended);
mutex_lock(&local->iflist_mtx);
ieee80211_vif_release_channel(sdata);
mutex_unlock(&local->iflist_mtx);
- cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_ABORTED,
+ cfg80211_cac_event(sdata->dev, &chandef,
+ NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL);
}
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 91cc828..a2487da 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1400,10 +1400,12 @@ void ieee80211_dfs_cac_timer_work(struct work_struct *work)
struct ieee80211_sub_if_data *sdata =
container_of(delayed_work, struct ieee80211_sub_if_data,
dfs_cac_timer_work);
+ struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chandef;
ieee80211_vif_release_channel(sdata);
-
- cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_FINISHED, GFP_KERNEL);
+ cfg80211_cac_event(sdata->dev, &chandef,
+ NL80211_RADAR_CAC_FINISHED,
+ GFP_KERNEL);
}
/* MLME */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index aefb9d5..f704415 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2253,14 +2253,17 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
{
struct ieee80211_sub_if_data *sdata;
+ struct cfg80211_chan_def chandef;
mutex_lock(&local->iflist_mtx);
list_for_each_entry(sdata, &local->interfaces, list) {
cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
if (sdata->wdev.cac_started) {
+ chandef = sdata->vif.bss_conf.chandef;
ieee80211_vif_release_channel(sdata);
cfg80211_cac_event(sdata->dev,
+ &chandef,
NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL);
}
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 6a6b1c8..a50c27b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -763,12 +763,12 @@ void cfg80211_radar_event(struct wiphy *wiphy,
EXPORT_SYMBOL(cfg80211_radar_event);
void cfg80211_cac_event(struct net_device *netdev,
+ struct cfg80211_chan_def *chandef,
enum nl80211_radar_event event, gfp_t gfp)
{
struct wireless_dev *wdev = netdev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
- struct cfg80211_chan_def chandef;
unsigned long timeout;
trace_cfg80211_cac_event(netdev, event);
@@ -779,14 +779,12 @@ void cfg80211_cac_event(struct net_device *netdev,
if (WARN_ON(!wdev->channel))
return;
- cfg80211_chandef_create(&chandef, wdev->channel, NL80211_CHAN_NO_HT);
-
switch (event) {
case NL80211_RADAR_CAC_FINISHED:
timeout = wdev->cac_start_time +
msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS);
WARN_ON(!time_after_eq(jiffies, timeout));
- cfg80211_set_dfs_state(wiphy, &chandef, NL80211_DFS_AVAILABLE);
+ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);
break;
case NL80211_RADAR_CAC_ABORTED:
break;
@@ -796,6 +794,6 @@ void cfg80211_cac_event(struct net_device *netdev,
}
wdev->cac_started = false;
- nl80211_radar_notify(rdev, &chandef, event, netdev, gfp);
+ nl80211_radar_notify(rdev, chandef, event, netdev, gfp);
}
EXPORT_SYMBOL(cfg80211_cac_event);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/5] mac80211: DFS setup chandef for radar_event correctly
From: Janusz Dziedzic @ 2013-10-28 18:27 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Janusz Dziedzic
In-Reply-To: <1382984824-3729-1-git-send-email-janusz.dziedzic@tieto.com>
Setup chandef for radar event correctly, before we
will clear this in ieee80211_dfs_cac_cancel() function.
Without this patch mac80211 will report wrong channel
width in case we will get radar event during active CAC.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
net/mac80211/util.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index f704415..c286d9b 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2275,17 +2275,15 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
{
struct ieee80211_local *local =
container_of(work, struct ieee80211_local, radar_detected_work);
- struct cfg80211_chan_def chandef;
+ struct cfg80211_chan_def chandef = local->hw.conf.chandef;
ieee80211_dfs_cac_cancel(local);
if (local->use_chanctx)
/* currently not handled */
WARN_ON(1);
- else {
- chandef = local->hw.conf.chandef;
+ else
cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL);
- }
}
void ieee80211_radar_detected(struct ieee80211_hw *hw)
--
1.7.9.5
^ permalink raw reply related
* RE: [PATCH] cfg80211/nl80211: Add support to report unsafe frequency ranges(s)
From: Chauhan, Rajesh @ 2013-10-28 18:14 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-wireless@vger.kernel.org, Rodriguez, Luis, Malinen, Jouni,
Bahini, Henri, Chang, Leo, Luo, Xun, Chauhan, Rajesh
In-Reply-To: <1382971479.17956.29.camel@jlt4.sipsolutions.net>
SGkgSm9oYW5uZXMsDQoNCkluIGFub3RoZXIgZW1haWwsIEkgYW0gcHJvcG9zaW5nIHRvIGFkZCBh
biBhdHRyaWJ1dGUgZm9yIHRoZSBzb3VyY2Ugb2YgaW50ZXJmZXJlbmNlIChmb3IgZXhhbXBsZSwg
ImNlbGx1bGFyIikgZm9yIGVhY2ggZnJlcXVlbmN5IHJhbmdlLiBTbyB0aGF0IHdheSBkcml2ZXIg
d2lsbCBoYXZlIHRvIHNwZWNpZnkgZXhhY3Qgc291cmNlIG9mIGludGVyZmVyZW5jZSBhbmQgdGhh
dCB3b3VsZCBhbHNvIGF2b2lkIHJhbmRvbSBjaGFubmVsIHN0ZWVyaW5nLiBJIHdvdWxkIHNlbmQg
b3V0IHVwZGF0ZWQgcGF0Y2ggc2V0IHdpdGggdGhhdCBjaGFuZ2UuDQoNClJlZ2FyZHMsDQpSYWpl
c2ggQ2hhdWhhbg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogSm9oYW5uZXMg
QmVyZyBbbWFpbHRvOmpvaGFubmVzQHNpcHNvbHV0aW9ucy5uZXRdIA0KU2VudDogTW9uZGF5LCBP
Y3RvYmVyIDI4LCAyMDEzIDc6NDUgQU0NClRvOiBDaGF1aGFuLCBSYWplc2gNCkNjOiBsaW51eC13
aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmc7IFJvZHJpZ3VleiwgTHVpczsgTWFsaW5lbiwgSm91bmk7
IEJhaGluaSwgSGVucmk7IENoYW5nLCBMZW87IEx1bywgWHVuDQpTdWJqZWN0OiBSZTogW1BBVENI
XSBjZmc4MDIxMS9ubDgwMjExOiBBZGQgc3VwcG9ydCB0byByZXBvcnQgdW5zYWZlIGZyZXF1ZW5j
eSByYW5nZXMocykNCg0KT24gVGh1LCAyMDEzLTEwLTE3IGF0IDE3OjE5ICswMDAwLCBDaGF1aGFu
LCBSYWplc2ggd3JvdGU6DQo+IEhpIEpvaGFubmVzLA0KPiANCj4gVGhhbmtzIGZvciB5b3VyIGNv
bW1lbnQuIFB1cnBvc2Ugb2YgdGhpcyBwYXRjaCBpcyB0byBhZGQgYW4gQVBJIGZvciANCj4gV0xB
TiBkcml2ZXIgdG8gcmVwb3J0IGZyZXF1ZW5jeSByYW5nZXMgd2hpY2ggc2hvdWxkIGJlIGF2b2lk
ZWQgZm9yIA0KPiBTQVAvUDJQLUdPIGJlY2F1c2Ugb2YgaW50ZXJmZXJlbmNlLg0KPiANCj4gSG93
IGFib3V0IGlmIEkgcmV3b3JkIGNvbW1pdCB0ZXN0IGFzIGJlbG93Pw0KPiANCj4gY2ZnODAyMTEv
bmw4MDIxMTogQWRkIEFQSSB0byByZXBvcnQgZnJlcXVlbmN5IHJhbmdlKHMpIHRvIGJlIGF2b2lk
ZWQNCj4gDQo+IEFkZCBzdXBwb3J0IGZvciBXTEFOIGRyaXZlciB0byByZXBvcnQgZnJlcXVlbmN5
IHJhbmdlKHMpIHRvIGJlIGF2b2lkZWQgDQo+IGJlY2F1c2Ugb2YgaW50ZXJmZXJlbmNlLg0KDQpX
b3VsZG4ndCBpdCBtYWtlIG1vcmUgc2Vuc2UgdG8gcmFpc2UgYSAiZGV0ZWN0ZWQgaW50ZXJmZXJl
bmNlIiBldmVudD8NClRoZXJlJ3Mgbm8gd2F5IHRvIGtub3cgd2hhdCBjaGFubmVsIHJhbmdlIGlz
IGFmZmVjdGVkIGFueXdheS4gSSBmZWFyIHRoYXQgdGhpcyBpcyB2YWd1ZSBlbm91Z2ggZm9yIHlv
dSB0byAoYWIpdXNlIGl0IGZvciBhbGwga2luZHMgb2YgcmFuZG9tICJjaGFubmVsIHN0ZWVyaW5n
IiBmcm9tIHRoZSBkcml2ZXIuDQoNCmpvaGFubmVzDQoNCg==
^ permalink raw reply
* RE: [PATCH] cfg80211/nl80211: Add support to report unsafe frequency ranges(s)
From: Chauhan, Rajesh @ 2013-10-28 18:08 UTC (permalink / raw)
To: Rodriguez, Luis
Cc: Dan Williams, Johannes Berg, linux-wireless@vger.kernel.org,
Malinen, Jouni, Bahini, Henri, Chang, Leo, Luo, Xun,
Chauhan, Rajesh
In-Reply-To: <CAB=NE6UkKuSzH4x2SjkE0pRTVCVa3k7g=_ZeU_JE+t2OovRoEg@mail.gmail.com>
SGkgTHVpcywNCg0KRm9yICJlbm91Z2ggaW5mb3JtYXRpb24gZm9yIHByb3BlciB1c2FnZSIgLSBo
b3cgYWJvdXQgaWYgSSBhZGQgYW4gYXR0cmlidXRlIGZvciB0aGUgc291cmNlIG9mIGludGVyZmVy
ZW5jZSAoc2F5LCBmb3IgZXhhbXBsZSwgImNlbGx1bGFyIikgZm9yIGVhY2ggb2YgdGhvc2UgZnJl
cXVlbmN5IHJhbmdlPw0KDQpSZWdhcmRzLA0KUmFqZXNoIENoYXVoYW4NCg0KLS0tLS1PcmlnaW5h
bCBNZXNzYWdlLS0tLS0NCkZyb206IG1jZ3JvZkBnbWFpbC5jb20gW21haWx0bzptY2dyb2ZAZ21h
aWwuY29tXSBPbiBCZWhhbGYgT2YgTHVpcyBSLiBSb2RyaWd1ZXoNClNlbnQ6IFN1bmRheSwgT2N0
b2JlciAyMCwgMjAxMyAzOjM5IEFNDQpUbzogQ2hhdWhhbiwgUmFqZXNoDQpDYzogRGFuIFdpbGxp
YW1zOyBKb2hhbm5lcyBCZXJnOyBsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmc7IE1hbGlu
ZW4sIEpvdW5pOyBCYWhpbmksIEhlbnJpOyBDaGFuZywgTGVvOyBMdW8sIFh1bg0KU3ViamVjdDog
UmU6IFtQQVRDSF0gY2ZnODAyMTEvbmw4MDIxMTogQWRkIHN1cHBvcnQgdG8gcmVwb3J0IHVuc2Fm
ZSBmcmVxdWVuY3kgcmFuZ2VzKHMpDQoNCk9uIFRodSwgT2N0IDE3LCAyMDEzIGF0IDk6NTEgUE0s
IENoYXVoYW4sIFJhamVzaCA8cmFqZXNoY0BxY2EucXVhbGNvbW0uY29tPiB3cm90ZToNCj4gSGkg
RGFuLA0KPg0KPiBUaGFua3MgZm9yIHlvdXIgY29tbWVudHMuDQo+DQo+IEN1cnJlbnQgcGF0Y2gg
aXMgdG8gcmVwb3J0IGV2ZW50IGFzeW5jaHJvbm91c2x5IGFuZCB0aGF0IHdvdWxkIGJlIG5lZWRl
ZCBldmVuIGlmIHdlIGhhdmUgeW91ciBzdWdnZXN0ZWQgaW50ZXJmYWNlIG9mIGNsaWVudCBjb2xs
ZWN0aW5nIHRoYXQgaW5mb3JtYXRpb24gdXBmcm9udCwgd2hpY2ggc2VlbXMgbGlrZSB5b3UgYWxz
byBraW5kIG9mIGFncmVlLCBiZWNhdXNlIFJGIGVudmlyb25tZW50IG1heSBjaGFuZ2UgbGF0ZXIg
YW5kIGdlbmVyYXRpbmcgYW4gZXZlbnQgYXQgdGhhdCB0aW1lIHdpdGggZnJlcXVlbmN5IGRldGFp
bHMgd291bGQgaGVscC4gU28geW91ciBzdWdnZXN0ZWQgYXBwcm9hY2ggb2YgIm1lY2hhbmlzbSBm
b3IgdGhlIGNsaWVudCB0byBnZXQgdGhpcyBpbmZvcm1hdGlvbiIgaW4gaXRzZWxmIHNlZW1zIGxp
a2UgYSBjYW5kaWRhdGUgZm9yIGEgc2VwYXJhdGUgcGF0Y2guDQoNClRoZSBpbmZyYXN0cnVjdHVy
ZSBmb3IgdGhpcyBzb3J0IG9mIHRoaW5nIHRoYXQgbWUsIEluYWt5IGFuZCBNYXJjZWwgaGFkIHBy
b3Bvc2VkIGluIDIwMDcgaXMgdGhlIEZyZXF1ZW5jeSBCcm9rZXI6DQoNCmh0dHA6Ly93aXJlbGVz
cy5rZXJuZWwub3JnL2VuL2RldmVsb3BlcnMvRnJlcXVlbmN5QnJva2VyDQoNCj4gT24gdGhlIHJh
Y2UgY29uZGl0aW9uIHdoaWNoIHlvdSBkZXNjcmliZWQgLSB0aGFua3MhLCBidXQgaXQgaXMgc29t
ZXRoaW5nIHdoaWNoIGltcGxlbWVudGF0aW9uIG9mIGRyaXZlciB3b3VsZCBuZWVkIHRvIHRha2Ug
Y2FyZS4gU2ltaWxhcmx5LCB1c2VyIHNwYWNlIGNhbiBoYXZlIGltcGxlbWVudGF0aW9uIHRvIGNh
Y2hlIGluZm9ybWF0aW9uIG9uIHJlY2VpcHQgb2YgdGhlIGV2ZW50IHRvIHVzZSBpdCBsYXRlci4N
Cg0KVGhpcyBwYXRjaCBpcyB2YWd1ZS4gT25jZSB3ZSBzZXQgc29tZXRoaW5nIGFzIEFQSSB3ZSBo
YXZlIHRvIGxpdmUgd2l0aCBpdCwgSSBhbSBub3QgY29tZm9ydGFibGUgd2l0aCB0aGlzIHBhdGNo
IGhhdmluZyBlbm91Z2ggaW5mb3JtYXRpb24gZm9yIHByb3BlciB1c2FnZSBieSBkaWZmZXJlbnQg
ZHJpdmVycyBmb3IgdGhlIHNhbWUgcHVycG9zZSBvciBpbnRlbnQuIFRoZSBvbmx5IHJlYWwgcG9z
aXRpdmUgYXJndW1lbnQgdGhhdCBjb3VsZCBiZSB1c2VkIGhlcmUgaXMgd2hlcmUgc29tZXRoaW5n
IGxpa2UgQW5kcm9pZCBtaWdodCBoYXZlIGFscmVhZHkgZW1icmFjZWQgc29tZSBzaW1pbGFyIEFQ
SSBidXQgYXJlIHdlIGdvaW5nIHRvIGFsd2F5cyBqdXN0IGVuYWJsZSBBUEkgb24gTGludXgganVz
dCBiZWNhdXNlIEFuZHJvaWQgZGlkIGl0IHdpdGhvdXQgdGhpbmtpbmcgYWJvdXQgcHJvcGVyIGxv
bmcgdGVybSBhcmNoaXRlY3R1cmU/IEkgZG9uJ3QgdGhpbmsgc28uDQoNCiBMdWlzDQo=
^ permalink raw reply
* Re: I always need a miracle to connect with iwlwifi
From: Felipe Contreras @ 2013-10-28 18:00 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: linux-wireless Mailing List, ilw, hostap@lists.shmoo.com
In-Reply-To: <526E20EA.9090203@rempel-privat.de>
On Mon, Oct 28, 2013 at 2:31 AM, Oleksij Rempel <linux@rempel-privat.de> wrote:
> Take wireshark and capture working and not working associational request.
All right, so what I did is take a working and non-working on the same
Linux machine. I have never done that, and didn't find much
information about how to do that so I used kismet.
I don't know exactly how I should export these logs for you to browse
them but I gave a shot at interpreting them.
What I can see is that in both cases the authentication request is
exactly the same, except for the sequence number. Yet in good case
there's an acknowledgement, and in the bad case there isn't.
The authentication response does come back in both cases though, it's
just the acknowledgement that is missing. Unfortunately I cannot
figure out for which message it's the ack.
Also, I notice the sequence number received from the router doesn't
seem to change. All the authentication requests received have the same
number (256). Another peculiar thing is that in the failed case the SN
we send starts with 0.
I suppose since the authentication ack never arrives, the next steps
are never completed.
Does that help?
--
Felipe Contreras
^ permalink raw reply
* Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
From: Grazvydas Ignotas @ 2013-10-28 17:29 UTC (permalink / raw)
To: Alexander Shiyan, Luciano Coelho, Mark Rutland, devicetree,
Russell King, Pawel Moll, Ian Campbell, Tony Lindgren,
Greg Kroah-Hartman, Stephen Warren, linux-doc, John W. Linville,
Rob Herring, linux-kernel@vger.kernel.org, Sachin Kamat,
Bill Pemberton, Felipe Balbi, Rob Landley, netdev,
linux-wireless@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Mark Brown
In-Reply-To: <20131027201218.GA4414@earth.universe>
On Sun, Oct 27, 2013 at 10:12 PM, Sebastian Reichel <sre@debian.org> wrote:
> On Sun, Oct 27, 2013 at 08:24:16PM +0400, Alexander Shiyan wrote:
>> > Move the power GPIO handling from the board code into
>> > the driver. This is a dependency for device tree support.
>> >
>> > Signed-off-by: Sebastian Reichel <sre@debian.org>
>> > ---
>> > arch/arm/mach-omap2/board-omap3pandora.c | 2 ++
>> > arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++--------
>> > drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++-----
>> > drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++----------
>> > drivers/net/wireless/ti/wl1251/wl1251.h | 2 +-
>> > include/linux/wl12xx.h | 2 +-
>> > 6 files changed, 43 insertions(+), 28 deletions(-)
>> ...
>> > diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
>> > index b516b4f..a9c723b 100644
>> > --- a/include/linux/wl12xx.h
>> > +++ b/include/linux/wl12xx.h
>> > @@ -49,7 +49,7 @@ enum {
>> > };
>> >
>> > struct wl1251_platform_data {
>> > - void (*set_power)(bool enable);
>> > + int power_gpio;
>> > /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
>> > int irq;
>> > bool use_eeprom;
>> > --
>>
>> What a reason for not using regulator API here with GPIO-based
>> regulator?
>
> I think this pin is not used as power supply, but like an enable pin
> for low power states. Of course the regulator API could still be
> (mis?)used for this, but I think it would be the first linux device
> driver doing this.
>
> Note: I don't have wl1251 documentation.
When wl12xx family of chips is connected through SDIO, we already have
that pin set up as a regulator controlled with the help of mmc
subsystem. When time comes to communicate with the chip, mmc subsystem
sees this as yet another SD card and looks for associated regulator
for it, and the board file has that set up as a fixed regulator
controlling that pin (see pandora_vmmc3 in
arch/arm/mach-omap2/board-omap3pandora.c). To prevent poweroff after
first SDIO communications are over, pm_runtime calls are used in
drivers/net/wireless/ti/wl1251/sdio.c .
I don't know if something similar can be done done in SPI case, but
I'm sure this is not the first your-so-called regulator misuse.
Gražvydas
^ permalink raw reply
* Re: [PATCH 4/4] wl1251: spi: add device tree support
From: Grazvydas Ignotas @ 2013-10-28 17:15 UTC (permalink / raw)
To: Kumar Gala
Cc: Sebastian Reichel, Mark Rutland, linux-doc, Tony Lindgren,
Russell King, Sachin Kamat, Ian Campbell, Sebastian Reichel,
Luciano Coelho, devicetree, Pawel Moll, Stephen Warren,
John W. Linville, Rob Herring, Bill Pemberton,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Greg Kroah-Hartman, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org, Felipe Balbi, Rob Landley, netdev
In-Reply-To: <FF34C626-4A49-43B1-B0AD-DC6146ABBB11@codeaurora.org>
On Mon, Oct 28, 2013 at 8:37 AM, Kumar Gala <galak@codeaurora.org> wrote:
> On Oct 27, 2013, at 11:14 AM, Sebastian Reichel wrote:
> > +++ b/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
> > @@ -0,0 +1,36 @@
> > +* Texas Instruments wl1251 controller
> > +
> > +The wl1251 chip can be connected via SPI or via SDIO. The linux
> > +kernel currently only supports device tree for the SPI variant.
> > +
>
> From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
>
> However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
When connected to SDIO, it doesn't act as standard SDIO device and
can't be probed (standard SDIO registers missing), so information has
to come some other way. That used to partially come through
platform_data and partially through a callback from mmc subsystem (see
pandora_wl1251_init_card() in
arch/arm/mach-omap2/board-omap3pandora.c). I don't know much about DT,
but maybe the information that comes from SDIO registers on "normal"
SDIO devices should come through DT in this case too? I don't really
know how that should be integrated with mmc subsystem though..
> > +Required properties:
> > +- compatible : Should be "ti,wl1251"
>
> reg is not listed as a required prop.
>
> > +- interrupts : Should contain interrupt line
> > +- interrupt-parent : Should be the phandle for the interrupt
> > + controller that services interrupts for this device
> > +- vio-supply : phandle to regulator providing VIO
> > +- power-gpio : GPIO connected to chip's PMEN pin
>
> should be vendor prefixed: ti,power-gpio
>
> > +- For additional required properties on SPI, please consult
> > + Documentation/devicetree/bindings/spi/spi-bus.txt
> > +
> > +Optional properties:
> > +- ti,use-eeprom : If found, configuration will be loaded from eeprom.
>
> can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
wl1251 is a wifi chip that can have an optional eeprom connected to it
to store things like calibration stuff and MAC address, and that
eeprom is usually inside a single module with some additional radio
related chips. If the eeprom is connected (like the module on pandora
board has), the driver can issue command to the firmware running on
chip to load that data on it's startup, alternatively the driver can
load calibration from other storage (like it happens on N900).
Gražvydas
^ permalink raw reply
* Re: [PATCH 3.12] cfg80211: fix ibss wext chandef creation
From: Dirk Gouders @ 2013-10-28 17:14 UTC (permalink / raw)
To: Johannes Berg
Cc: Simon Wunderlich, linux-wireless, Mathias Kretschmer,
Linux Kernel
In-Reply-To: <1382970069.17956.23.camel@jlt4.sipsolutions.net>
Johannes Berg <johannes@sipsolutions.net> writes:
> On Tue, 2013-10-22 at 22:02 +0200, Simon Wunderlich wrote:
>> The wext internal chandefs for ibss should be created using the
>> cfg80211_chandef_create() functions. Otherwise the center_freq1 field
>> will not be set and cfg80211_chandef_valid() will spit a warning and
>> report the chandef as invalid when it should be used.
>
> I think
>
> commit f478f33a93f9353dcd1fe55445343d76b1c3f84a
> Author: Bruno Randolf <br1@einfach.org>
> Date: Thu Sep 26 16:55:28 2013 +0100
>
> cfg80211: fix warning when using WEXT for IBSS
>
>
> already fixed this. Your patch doesn't apply, but feel free to send me a
> new one (for -next) converting to the creation helpers.
I tested the above commit and it also fixes the problems I noticed here.
Best regards,
Dirk
^ permalink raw reply
* Re: I always need a miracle to connect with iwlwifi
From: Felipe Contreras @ 2013-10-28 17:12 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: linux-wireless Mailing List, ilw, hostap@lists.shmoo.com
In-Reply-To: <526E9093.6020409@rempel-privat.de>
On Mon, Oct 28, 2013 at 10:28 AM, Oleksij Rempel <linux@rempel-privat.de> wrote:
> Am 28.10.2013 16:44, schrieb Felipe Contreras:
>> And BTW, the devices we are talking about are very varied: Wii U,
>> Windows 7, Windows 8.1, Nokia N9, Android phone, iPhone, iMac, Amazon
>> Kindle. Yet the only device that seems to have a problem is my Linux
>> machine, I think it's pretty clear where the problem is.
>
> Do any of listed devices use mac80211?
Yes, my Nokia N900, which works flawlessly. I didn't list that, but I
just tried it.
> If not, you still have fallowing
> options: wpa_supplicant, mac80211, iwlwifi driver, iwlwifi firmware. In
> you arguments you even didn't tried to eliminate any of them. So, no. It
> is not clear where problem is.
All of these things run in the Linux laptop, so to me it is clearly
not in the router. Sure, the router might be buggy, but it's very
conspicuous that only this machine reproduces that bug.
>> And sure, it does not necessarily means that other people have the
>> same problem, but it is very unlikely that I'm the only one.
>
> what is your hardware?
Intel Corporation Centrino Advanced-N 6235
> Did you tired to disable power save mode?
modinfo shows this:
parm: power_save:enable WiFi power management (default:
disable) (bool)
So I guessed power saving was disabled by default.
But yeah, to be sure I did try it:
sudo modprobe iwlwifi power_save=0 power_level=1
> I have "Intel Centrino Advanced-N 6235", it use same driver and works
> with three of my APs. I say just to show, that list of working hardware
> is not helpful.
Of course it is helpful, it tells us that the problem is very likely
on this machine, not on the AP.
> what is you AP?
ZNID-GPON-2516
> Mode it is running?
I don't know, it's a wireless router.
> Do changing settings of this AP makes some difference?
I don't have access to the settings. I'm going to ask for access, but
I'm not too hopeful.
--
Felipe Contreras
^ permalink raw reply
* Re: [PATCH 3.12] cfg80211: fix ibss wext chandef creation
From: Dirk Gouders @ 2013-10-28 17:05 UTC (permalink / raw)
To: Johannes Berg
Cc: Simon Wunderlich, linux-wireless, Mathias Kretschmer,
Linux Kernel
In-Reply-To: <1382970069.17956.23.camel@jlt4.sipsolutions.net>
Johannes Berg <johannes@sipsolutions.net> writes:
> On Tue, 2013-10-22 at 22:02 +0200, Simon Wunderlich wrote:
>> The wext internal chandefs for ibss should be created using the
>> cfg80211_chandef_create() functions. Otherwise the center_freq1 field
>> will not be set and cfg80211_chandef_valid() will spit a warning and
>> report the chandef as invalid when it should be used.
>
> I think
>
> commit f478f33a93f9353dcd1fe55445343d76b1c3f84a
> Author: Bruno Randolf <br1@einfach.org>
> Date: Thu Sep 26 16:55:28 2013 +0100
>
> cfg80211: fix warning when using WEXT for IBSS
>
>
> already fixed this. Your patch doesn't apply, but feel free to send me a
> new one (for -next) converting to the creation helpers.
I tested the above commit and it also fixes the problems I noticed here.
Dirk
^ permalink raw reply
* [PATCH v2 6/6] crda: make reglib a shared library
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
Now that we have quite a few helpers this puts the more
valuable helpers into a library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
Makefile | 48 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 9e37ccd..4a351c6 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@ REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.g
PREFIX ?= /usr/
MANDIR ?= $(PREFIX)/share/man/
+INCLUDE_DIR ?= $(PREFIX)/include/reglib/
+LIBDIR ?= $(PREFIX)/lib
SBINDIR ?= /sbin/
@@ -23,24 +25,29 @@ UDEV_RULE_DIR?=/lib/udev/rules.d/
PUBKEY_DIR?=pubkeys
RUNTIME_PUBKEY_DIR?=/etc/wireless-regdb/pubkeys
+CFLAGS += -O2 -fpic
+CFLAGS += -std=gnu99 -Wall -Werror -pedantic
CFLAGS += -Wall -g
LDLIBS += -lm
+LDLIBREG += -lreg
+LIBREG += libreg.so
+LDFLAGS += -L ./ $(LDLIBREG)
all: all_noverify verify
-all_noverify: crda intersect regdbdump db2rd optimize
+all_noverify: $(LIBREG) crda intersect regdbdump db2rd optimize
ifeq ($(USE_OPENSSL),1)
CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl`
LDLIBS += `pkg-config --libs openssl`
-reglib.o: keys-ssl.c
+$(LIBREG): keys-ssl.c
else
CFLAGS += -DUSE_GCRYPT
LDLIBS += -lgcrypt
-reglib.o: keys-gcrypt.c
+$(LIBREG): keys-gcrypt.c
endif
MKDIR ?= mkdir -p
@@ -106,39 +113,56 @@ keys-%.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem)
$(NQ) ' Trusted pubkeys:' $(wildcard $(PUBKEY_DIR)/*.pem)
$(Q)./utils/key2pub.py --$* $(wildcard $(PUBKEY_DIR)/*.pem) $@
-%.o: %.c regdb.h reglib.h
+$(LIBREG): regdb.h reglib.h reglib.c
+ $(NQ) ' CC ' $@
+ $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -shared -Wl,-soname,$(LIBREG) $^
+
+install-libreg-headers:
+ $(NQ) ' INSTALL libreg-headers'
+ $(Q)mkdir -p $(INCLUDE_DIR)
+ $(Q)cp *.h $(INCLUDE_DIR)/
+
+install-libreg:
+ $(NQ) ' INSTALL libreg'
+ $(Q)mkdir -p $(LIBDIR)
+ $(Q)cp $(LIBREG) $(LIBDIR)/
+ $(Q)ldconfig
+
+%.o: %.c regdb.h $(LIBREG)
$(NQ) ' CC ' $@
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
-crda: reglib.o crda.o
+crda: crda.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(NLLIBS)
-regdbdump: reglib.o regdbdump.o
+regdbdump: regdbdump.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-intersect: reglib.o intersect.o
+intersect: intersect.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-db2rd: reglib.o db2rd.o
+db2rd: db2rd.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-optimize: reglib.o optimize.o
+optimize: optimize.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
verify: $(REG_BIN) regdbdump
$(NQ) ' CHK $(REG_BIN)'
- $(Q)./regdbdump $(REG_BIN) >/dev/null
+ $(Q)\
+ LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) \
+ ./regdbdump $(REG_BIN) >/dev/null
%.gz: %
@$(NQ) ' GZIP' $<
$(Q)gzip < $< > $@
-install: crda crda.8.gz regdbdump.8.gz
+install: install-libreg install-libreg-headers crda crda.8.gz regdbdump.8.gz
$(NQ) ' INSTALL crda'
$(Q)$(MKDIR) $(DESTDIR)/$(SBINDIR)
$(Q)$(INSTALL) -m 755 -t $(DESTDIR)/$(SBINDIR) crda
@@ -161,6 +185,6 @@ install: crda crda.8.gz regdbdump.8.gz
$(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
clean:
- $(Q)rm -f crda regdbdump intersect db2rd optimize \
+ $(Q)rm -f $(LIBREG) crda regdbdump intersect db2rd optimize \
*.o *~ *.pyc keys-*.c *.gz \
udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 5/6] crda: make ssl keys include stdint.h
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
This is required to fix compilation if we
move reglig to its own library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
utils/key2pub.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/utils/key2pub.py b/utils/key2pub.py
index 4d85369..3e84cd2 100755
--- a/utils/key2pub.py
+++ b/utils/key2pub.py
@@ -59,6 +59,7 @@ def print_ssl_32(output, name, val):
def print_ssl(output, name, val):
import struct
+ output.write('#include <stdint.h>\n')
if len(struct.pack('@L', 0)) == 8:
return print_ssl_64(output, name, val)
else:
@@ -85,6 +86,7 @@ static struct pubkey keys[] = {
pass
def print_gcrypt(output, name, val):
+ output.write('#include <stdint.h>\n')
while val[0] == '\0':
val = val[1:]
output.write('static const uint8_t %s[%d] = {\n' % (name, len(val)))
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 4/6] crda: add regulatory domain optimizer
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
This adds a regulatory domain optimizer which can be
used with information of a regulatory domain in db.txt
format in stdin. It makes use of the new shiny regulatory
domain stream parser.
The way this works is it iterates over the regulatory domain
computing unions between each frequency, starting from each
frequency as a pivot. If a union leads to a valid regulatory
rule we verify that the pivot and othre frequency rules that
provided that valid union can fit into that union regulatory
rule by computing an intersection. If an intersection is
possible it means two rules can be optimized out. We do
this repetitively.
Note: cfg80211's nl80211.h API has:
#define NL80211_MAX_SUPP_REG_RULES 32
Our tools, both the stream parser and the optimizer are not
limited to these artificial limits ! We can work on extending
the kernel's limit but so far we have had no needs. A few
notes below though on the existing reasoning for the limit
and possible future enhancements.
This is used nl80211_set_reg() upon intercept of a regulatory
domain being sent from userspace to it. We picked a limitation
to at least have a stopping gap to avoid userpace flooding the
kernel with a denial of service requests on memory from userspace.
This means that userspace can only request at most a kmalloc
of up to 32 regulatory rules for processing for the regulatory
data that we are copying from userspace. There's a Linux kernel
enhancement that will be made soon so that we invalidate bogus
requests, by checking to see if the incomming regulatory domain
alpha2 was not expected upon a regulatory hint initiator (even
if userspace first tells the kernel it is waiting for a response
from kernel space), and if its invalid then we drop the userspace
supplied request, therefore avoiding some form of flooding on
memory to the kernel.
Note that we can still get flooding if the userspace API is used
to *request* to the kernel for a regulatory domain to be sent
from userspace, in that case the kernel will properly expect the
regulatory data for the alpha2. To prevent flooding there perhaps
its a good idea for us to check whether a userspace pending request
is pendingg and if so deny new updates until the last one triggers
a timeout.
Screenshot for a US file with 40 rules:
mcgrof@frijol ~/devel/xlreg (git::master)$ cat us | grep --"(" | wc -l
40
mcgrof@frijol ~/devel/crda (git::master)$ cat us
country US: DFS-FCC
(2402.000 - 2422.000 @ 20.000), (30.00)
(2407.000 - 2427.000 @ 20.000), (30.00)
(2412.000 - 2432.000 @ 20.000), (30.00)
(2417.000 - 2437.000 @ 20.000), (30.00)
(2422.000 - 2442.000 @ 20.000), (30.00)
(2427.000 - 2447.000 @ 20.000), (30.00)
(2432.000 - 2452.000 @ 20.000), (30.00)
(2437.000 - 2457.000 @ 20.000), (30.00)
(2442.000 - 2462.000 @ 20.000), (30.00)
(2447.000 - 2467.000 @ 20.000), (30.00)
(2452.000 - 2472.000 @ 20.000), (30.00)
(2402.000 - 2442.000 @ 40.000), (30.00)
(2407.000 - 2447.000 @ 40.000), (30.00)
(2412.000 - 2452.000 @ 40.000), (30.00)
(2417.000 - 2457.000 @ 40.000), (30.00)
(2422.000 - 2462.000 @ 40.000), (30.00)
(2427.000 - 2467.000 @ 40.000), (30.00)
(2432.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5190.000 @ 20.000), (17.00)
(5190.000 - 5210.000 @ 20.000), (17.00)
(5210.000 - 5230.000 @ 20.000), (17.00)
(5230.000 - 5250.000 @ 20.000), (17.00)
(5250.000 - 5270.000 @ 20.000), (23.00), DFS
(5270.000 - 5290.000 @ 20.000), (23.00), DFS
(5290.000 - 5310.000 @ 20.000), (23.00), DFS
(5310.000 - 5330.000 @ 20.000), (23.00), DFS
(5735.000 - 5755.000 @ 20.000), (30.00)
(5755.000 - 5775.000 @ 20.000), (30.00)
(5775.000 - 5795.000 @ 20.000), (30.00)
(5795.000 - 5815.000 @ 20.000), (30.00)
(5815.000 - 5835.000 @ 20.000), (30.00)
(5170.000 - 5210.000 @ 40.000), (17.00)
(5210.000 - 5250.000 @ 40.000), (17.00)
(5250.000 - 5290.000 @ 40.000), (23.00), DFS
(5290.000 - 5330.000 @ 40.000), (23.00), DFS
(5735.000 - 5775.000 @ 40.000), (30.00)
(5775.000 - 5815.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5815.000 @ 80.000), (30.00)
mcgrof@frijol ~/devel/crda (git::master)$ cat us | ./optimize
country US: DFS-FCC
(2402.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5835.000 @ 80.000), (30.00)
I've also tested this with the current db.txt from wireless-regdb
and get real optimiziations which I will post later.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
Makefile | 8 +-
optimize.c | 40 +++++++++
reglib.c | 300 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
reglib.h | 16 ++++
4 files changed, 360 insertions(+), 4 deletions(-)
create mode 100644 optimize.c
diff --git a/Makefile b/Makefile
index bd9c220..9e37ccd 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ LDLIBS += -lm
all: all_noverify verify
-all_noverify: crda intersect regdbdump db2rd
+all_noverify: crda intersect regdbdump db2rd optimize
ifeq ($(USE_OPENSSL),1)
CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl`
@@ -126,6 +126,10 @@ db2rd: reglib.o db2rd.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+optimize: reglib.o optimize.o
+ $(NQ) ' LD ' $@
+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
verify: $(REG_BIN) regdbdump
$(NQ) ' CHK $(REG_BIN)'
$(Q)./regdbdump $(REG_BIN) >/dev/null
@@ -157,6 +161,6 @@ install: crda crda.8.gz regdbdump.8.gz
$(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
clean:
- $(Q)rm -f crda regdbdump intersect db2rd \
+ $(Q)rm -f crda regdbdump intersect db2rd optimize \
*.o *~ *.pyc keys-*.c *.gz \
udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed
diff --git a/optimize.c b/optimize.c
new file mode 100644
index 0000000..89d714b
--- /dev/null
+++ b/optimize.c
@@ -0,0 +1,40 @@
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <arpa/inet.h> /* ntohl */
+#include <string.h>
+
+#include "nl80211.h"
+#include "reglib.h"
+
+int main(int argc, char **argv)
+{
+ struct ieee80211_regdomain *rd = NULL, *rd_opt = NULL;
+ FILE *fp;
+
+ if (argc != 1) {
+ fprintf(stderr, "Usage: cat db.txt | %s\n", argv[0]);
+ return -EINVAL;
+ }
+
+ fp = reglib_create_parse_stream(stdin);
+ if (!fp)
+ return -EINVAL;
+
+ reglib_for_each_country_stream(fp, rd) {
+ rd_opt = reglib_optimize_regdom(rd);
+ if (!rd_opt){
+ fprintf(stderr, "Unable to optimize %c%c\n",
+ rd->alpha2[0],
+ rd->alpha2[1]);
+ free(rd);
+ continue;
+ }
+ reglib_print_regdom(rd_opt);
+ free(rd);
+ free(rd_opt);
+ }
+
+ fclose(fp);
+ return 0;
+}
diff --git a/reglib.c b/reglib.c
index 6191acd..9577ada 100644
--- a/reglib.c
+++ b/reglib.c
@@ -459,6 +459,49 @@ int reglib_is_valid_rd(const struct ieee80211_regdomain *rd)
return 1;
}
+static int reg_rules_union(const struct ieee80211_reg_rule *rule1,
+ const struct ieee80211_reg_rule *rule2,
+ struct ieee80211_reg_rule *union_rule)
+{
+ const struct ieee80211_freq_range *freq_range1, *freq_range2;
+ struct ieee80211_freq_range *freq_range;
+ const struct ieee80211_power_rule *power_rule1, *power_rule2;
+ struct ieee80211_power_rule *power_rule;
+
+ freq_range1 = &rule1->freq_range;
+ freq_range2 = &rule2->freq_range;
+ freq_range = &union_rule->freq_range;
+
+ power_rule1 = &rule1->power_rule;
+ power_rule2 = &rule2->power_rule;
+ power_rule = &union_rule->power_rule;
+
+
+ if (freq_range1->end_freq_khz < freq_range2->start_freq_khz)
+ return -EINVAL;
+ if (freq_range2->end_freq_khz < freq_range1->start_freq_khz)
+ return -EINVAL;
+
+ freq_range->start_freq_khz = reglib_min(freq_range1->start_freq_khz,
+ freq_range2->start_freq_khz);
+ freq_range->end_freq_khz = reglib_max(freq_range1->end_freq_khz,
+ freq_range2->end_freq_khz);
+ freq_range->max_bandwidth_khz = reglib_max(freq_range1->max_bandwidth_khz,
+ freq_range2->max_bandwidth_khz);
+
+ power_rule->max_eirp = reglib_max(power_rule1->max_eirp,
+ power_rule2->max_eirp);
+ power_rule->max_antenna_gain = reglib_max(power_rule1->max_antenna_gain,
+ power_rule2->max_antenna_gain);
+
+ union_rule->flags = rule1->flags | rule2->flags;
+
+ if (!is_valid_reg_rule(union_rule))
+ return -EINVAL;
+
+ return 0;
+}
+
/*
* Helper for reglib_intersect_rds(), this does the real
* mathematical intersection fun
@@ -971,8 +1014,10 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
memset(line, 0, sizeof(line));
line_p = fgets(line, sizeof(line), fp);
- if (line_p != line)
+ if (line_p != line) {
+ free(reglib_rule_parsers);
return -EINVAL;
+ }
for (i = 0; i < reglib_rule_parsers->n_parsers; i++) {
r = reglib_rule_parsers->rule_parsers[i](line, reg_rule);
@@ -980,6 +1025,8 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
break;
}
+ free(reglib_rule_parsers);
+
return r;
}
@@ -1151,8 +1198,10 @@ struct ieee80211_regdomain *__reglib_parse_country(FILE *fp)
line_p = fgets(line, sizeof(line), fp);
- if (line_p != line)
+ if (line_p != line) {
+ free(reglib_country_parsers);
return NULL;
+ }
for (i = 0; i < reglib_country_parsers->n_parsers; i++) {
r = reglib_country_parsers->country_parsers[i](line, &tmp_rd);
@@ -1162,11 +1211,14 @@ struct ieee80211_regdomain *__reglib_parse_country(FILE *fp)
if (r != 0) {
fprintf(stderr, "Invalid country line: %s", line);
+ free(reglib_country_parsers);
return NULL;
}
rd = reglib_parse_rules(fp, &tmp_rd);
+ free(reglib_country_parsers);
+
return rd;
}
@@ -1250,3 +1302,247 @@ FILE *reglib_create_parse_stream(FILE *f)
return fp;
}
+
+/*
+ * Just whatever for now, nothing formal, but note that as bands
+ * grow we'll want to make this a bit more formal somehow.
+ */
+static uint32_t reglib_deduce_band(uint32_t start_freq_khz)
+{
+ uint32_t freq_mhz = REGLIB_KHZ_TO_MHZ(start_freq_khz);
+
+ if (freq_mhz >= 4000)
+ return 5;
+ if (freq_mhz > 2000 && freq_mhz < 4000)
+ return 2;
+ if (freq_mhz > 50000)
+ return 60;
+ return 1234;
+}
+
+/*
+ * The idea behind a rule key is that if two rule keys share the
+ * same key they can be merged together if their frequencies overlap.
+ */
+static uint64_t reglib_rule_key(struct ieee80211_reg_rule *reg_rule)
+{
+ struct ieee80211_power_rule *power_rule;
+ struct ieee80211_freq_range *freq_range;
+ uint32_t band;
+ uint32_t key;
+
+ freq_range = ®_rule->freq_range;
+ band = reglib_deduce_band(freq_range->start_freq_khz);
+
+ power_rule = ®_rule->power_rule;
+
+ key = ((power_rule->max_eirp ^ 0) << 0) ^
+ ((reg_rule->flags ^ 8) << 8) ^
+ ((band ^ 16) << 16);
+
+ return key;
+}
+
+struct reglib_optimize_map {
+ bool optimized;
+ uint32_t key;
+};
+
+/* Does the provided rule suffice both of the other two */
+static int reglib_opt_rule_fit(struct ieee80211_reg_rule *rule1,
+ struct ieee80211_reg_rule *rule2,
+ struct ieee80211_reg_rule *opt_rule)
+{
+ struct ieee80211_reg_rule interesected_rule;
+ struct ieee80211_reg_rule *int_rule;
+ int r;
+
+ memset(&interesected_rule, 0, sizeof(struct ieee80211_reg_rule));
+ int_rule = &interesected_rule;
+
+ r = reg_rules_intersect(rule1, opt_rule, int_rule);
+ if (r != 0)
+ return r;
+ r = reg_rules_intersect(rule2, opt_rule, int_rule);
+ if (r != 0)
+ return r;
+
+ return 0;
+}
+
+static int reg_rule_optimize(struct ieee80211_reg_rule *rule1,
+ struct ieee80211_reg_rule *rule2,
+ struct ieee80211_reg_rule *opt_rule)
+{
+ int r;
+
+ r = reg_rules_union(rule1, rule2, opt_rule);
+ if (r != 0)
+ return r;
+ r = reglib_opt_rule_fit(rule1, rule2, opt_rule);
+ if (r != 0)
+ return r;
+
+ return 0;
+}
+
+/*
+ * Here's the math explanation:
+ *
+ * This takes each pivot frequency on the regulatory domain, computes
+ * the union between it each regulatory rule on the regulatory domain
+ * sequentially, and after that it tries to verify that the pivot frequency
+ * fits on it by computing an intersection between it and the union, if
+ * a rule exist as a possible intersection then we know the rule can be
+ * subset of the combination of the two frequency ranges (union) computed.
+ */
+static unsigned int reg_rule_optimize_rd(struct ieee80211_regdomain *rd,
+ unsigned int rule_idx,
+ struct ieee80211_reg_rule *opt_rule,
+ struct reglib_optimize_map *opt_map)
+{
+ unsigned int i;
+ struct ieee80211_reg_rule *rule1;
+ struct ieee80211_reg_rule *rule2;
+
+ struct ieee80211_reg_rule tmp_optimized_rule;
+ struct ieee80211_reg_rule *tmp_opt_rule;
+
+ struct ieee80211_reg_rule *target_rule;
+
+ unsigned int optimized = 0;
+ int r;
+
+ if (rule_idx > rd->n_reg_rules)
+ return 0;
+
+ rule1 = &rd->reg_rules[rule_idx];
+
+ memset(&tmp_optimized_rule, 0, sizeof(struct ieee80211_reg_rule));
+ tmp_opt_rule = &tmp_optimized_rule;
+
+ memset(opt_rule, 0, sizeof(*opt_rule));
+
+ for (i = 0; i < rd->n_reg_rules; i++) {
+ if (rule_idx == i)
+ continue;
+ rule2 = &rd->reg_rules[i];
+ if (opt_map[rule_idx].key != opt_map[i].key)
+ continue;
+
+ target_rule = optimized ? opt_rule : rule1;
+ r = reg_rule_optimize(target_rule, rule2, tmp_opt_rule);
+ if (r != 0)
+ continue;
+ memcpy(opt_rule, tmp_opt_rule, sizeof(*tmp_opt_rule));
+
+ if (!opt_map[i].optimized) {
+ opt_map[i].optimized = true;
+ optimized++;
+ }
+ if (!opt_map[rule_idx].optimized) {
+ opt_map[rule_idx].optimized = true;
+ optimized++;
+ }
+ }
+ return optimized;
+}
+
+struct ieee80211_regdomain *
+reglib_optimize_regdom(struct ieee80211_regdomain *rd)
+{
+ struct ieee80211_regdomain *opt_rd = NULL;
+ struct ieee80211_reg_rule *reg_rule;
+ struct ieee80211_reg_rule *reg_rule_dst;
+ struct ieee80211_reg_rule optimized_reg_rule;
+ struct ieee80211_reg_rule *opt_reg_rule;
+ struct reglib_optimize_map *opt_map;
+ unsigned int i, idx = 0, non_opt = 0, opt = 0;
+ size_t num_rules, size_of_regd, size_of_opt_map;
+ unsigned int num_opts = 0;
+
+ size_of_opt_map = (rd->n_reg_rules + 2) *
+ sizeof(struct reglib_optimize_map);
+ opt_map = malloc(size_of_opt_map);
+ if (!opt_map)
+ return NULL;
+
+ memset(opt_map, 0, size_of_opt_map);
+ memset(&optimized_reg_rule, 0, sizeof(struct ieee80211_reg_rule));
+
+ opt_reg_rule = &optimized_reg_rule;
+
+ for (i = 0; i < rd->n_reg_rules; i++) {
+ reg_rule = &rd->reg_rules[i];
+ opt_map[i].key = reglib_rule_key(reg_rule);
+ }
+ for (i = 0; i < rd->n_reg_rules; i++) {
+ reg_rule = &rd->reg_rules[i];
+ if (opt_map[i].optimized)
+ continue;
+ num_opts = reg_rule_optimize_rd(rd, i, opt_reg_rule, opt_map);
+ if (!num_opts)
+ non_opt++;
+ else
+ opt += (num_opts ? 1 : 0);
+ }
+
+ num_rules = non_opt + opt;
+
+ if (num_rules > rd->n_reg_rules)
+ goto fail_opt_map;
+
+ size_of_regd = reglib_array_len(sizeof(struct ieee80211_regdomain),
+ num_rules + 1,
+ sizeof(struct ieee80211_reg_rule));
+
+ opt_rd = malloc(size_of_regd);
+ if (!opt_rd)
+ goto fail_opt_map;
+ memset(opt_rd, 0, size_of_regd);
+
+ opt_rd->n_reg_rules = num_rules;
+ opt_rd->alpha2[0] = rd->alpha2[0];
+ opt_rd->alpha2[1] = rd->alpha2[1];
+ opt_rd->dfs_region = rd->dfs_region;
+
+ memset(opt_map, 0, size_of_opt_map);
+ memset(&optimized_reg_rule, 0, sizeof(struct ieee80211_reg_rule));
+
+ opt_reg_rule = &optimized_reg_rule;
+
+ for (i = 0; i < rd->n_reg_rules; i++) {
+ reg_rule = &rd->reg_rules[i];
+ opt_map[i].key = reglib_rule_key(reg_rule);
+ }
+
+ for (i = 0; i < rd->n_reg_rules; i++) {
+ reg_rule = &rd->reg_rules[i];
+ reg_rule_dst = &opt_rd->reg_rules[idx];
+ if (opt_map[i].optimized)
+ continue;
+ num_opts = reg_rule_optimize_rd(rd, i, opt_reg_rule, opt_map);
+ if (!num_opts)
+ memcpy(reg_rule_dst, reg_rule, sizeof(struct ieee80211_reg_rule));
+ else
+ memcpy(reg_rule_dst, opt_reg_rule, sizeof(struct ieee80211_reg_rule));
+ idx++;
+ }
+
+ if (idx != num_rules)
+ goto fail;
+
+ for (i = 0; i < opt_rd->n_reg_rules; i++) {
+ reg_rule = &opt_rd->reg_rules[i];
+ if (!is_valid_reg_rule(reg_rule))
+ goto fail;
+ }
+
+ free(opt_map);
+ return opt_rd;
+fail:
+ free(opt_rd);
+fail_opt_map:
+ free(opt_map);
+ return NULL;
+}
diff --git a/reglib.h b/reglib.h
index 885792e..d570c36 100644
--- a/reglib.h
+++ b/reglib.h
@@ -219,6 +219,22 @@ FILE *reglib_create_parse_stream(FILE *fp);
*/
struct ieee80211_regdomain *reglib_parse_country(FILE *fp);
+/**
+ * @reglib_optimize_regdom - optimize a regulatory domain
+ *
+ * @rd: a regulatory domain to be optimized
+ *
+ * A regulatory domain may exist without optimal expressions
+ * over its rules. This will look for regulatory rules that can
+ * be combined together to reduce the size of the regulatory
+ * domain and its expression.
+ *
+ * Regulatory rules will be combined if their max allowed
+ * bandwidth, max EIRP, and flags all match.
+ */
+struct ieee80211_regdomain *
+reglib_optimize_regdom(struct ieee80211_regdomain *rd);
+
#define reglib_for_each_country_stream(__fp, __rd) \
for (__rd = reglib_parse_country(__fp); \
__rd != NULL; \
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 3/6] crda: add regulatory domain stream parser
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
This adds a stream parser for regulatory domains. This
allows developers to build regulatory domains now using
the db.txt from a stream, either stdin, or a from an
opened file.
This also adds a simple db2rd which for now only uses the
library but with a bit of effort can also be used as a
suitable replacement for the kernel's genregdb.awk.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
Makefile | 10 +-
db2rd.c | 32 ++++
reglib.c | 543 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
reglib.h | 44 ++++++
4 files changed, 627 insertions(+), 2 deletions(-)
create mode 100644 db2rd.c
diff --git a/Makefile b/Makefile
index 7d2e33f..bd9c220 100644
--- a/Makefile
+++ b/Makefile
@@ -24,10 +24,11 @@ PUBKEY_DIR?=pubkeys
RUNTIME_PUBKEY_DIR?=/etc/wireless-regdb/pubkeys
CFLAGS += -Wall -g
+LDLIBS += -lm
all: all_noverify verify
-all_noverify: crda intersect regdbdump
+all_noverify: crda intersect regdbdump db2rd
ifeq ($(USE_OPENSSL),1)
CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl`
@@ -121,6 +122,10 @@ intersect: reglib.o intersect.o
$(NQ) ' LD ' $@
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+db2rd: reglib.o db2rd.o
+ $(NQ) ' LD ' $@
+ $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
verify: $(REG_BIN) regdbdump
$(NQ) ' CHK $(REG_BIN)'
$(Q)./regdbdump $(REG_BIN) >/dev/null
@@ -152,5 +157,6 @@ install: crda crda.8.gz regdbdump.8.gz
$(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
clean:
- $(Q)rm -f crda regdbdump intersect *.o *~ *.pyc keys-*.c *.gz \
+ $(Q)rm -f crda regdbdump intersect db2rd \
+ *.o *~ *.pyc keys-*.c *.gz \
udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed
diff --git a/db2rd.c b/db2rd.c
new file mode 100644
index 0000000..51ec051
--- /dev/null
+++ b/db2rd.c
@@ -0,0 +1,32 @@
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <arpa/inet.h> /* ntohl */
+#include <string.h>
+
+#include "nl80211.h"
+#include "reglib.h"
+
+int main(int argc, char **argv)
+{
+ struct ieee80211_regdomain *rd = NULL;
+ FILE *fp;
+
+ if (argc != 1) {
+ fprintf(stderr, "Usage: cat db.txt | %s\n", argv[0]);
+ return -EINVAL;
+ }
+
+ fp = reglib_create_parse_stream(stdin);
+ if (!fp)
+ return -EINVAL;
+
+ reglib_for_each_country_stream(fp, rd) {
+ reglib_print_regdom(rd);
+ free(rd);
+ }
+
+ fclose(fp);
+
+ return 0;
+}
diff --git a/reglib.c b/reglib.c
index b0c61e5..6191acd 100644
--- a/reglib.c
+++ b/reglib.c
@@ -38,6 +38,19 @@
#include "keys-gcrypt.c"
#endif
+int debug = 0;
+
+struct reglib_rule_parse_list {
+ int n_parsers;
+ int (*rule_parsers[])(char *line, struct ieee80211_reg_rule *reg_rule);
+};
+
+struct reglib_country_parse_list {
+ int n_parsers;
+ int (*country_parsers[])(char *line, struct ieee80211_regdomain *rd);
+};
+
+
void *
reglib_get_file_ptr(uint8_t *db, size_t dblen, size_t structlen, uint32_t ptr)
{
@@ -707,3 +720,533 @@ void reglib_print_regdom(const struct ieee80211_regdomain *rd)
print_reg_rule(&rd->reg_rules[i]);
printf("\n");
}
+
+static unsigned int reglib_parse_dfs_region(char *dfs_region)
+{
+ if (strncmp(dfs_region, "DFS-FCC", 7) == 0)
+ return REGDB_DFS_FCC;
+ if (strncmp(dfs_region, "DFS-ETSI", 8) == 0)
+ return REGDB_DFS_ETSI;
+ if (strncmp(dfs_region, "DFS-JP", 6) == 0)
+ return REGDB_DFS_JP;
+ return REGDB_DFS_UNSET;
+}
+
+static uint32_t reglib_parse_rule_flag(char *flag_s)
+{
+ if (strncmp(flag_s, "NO-OFDM", 7) == 0)
+ return RRF_NO_OFDM;
+ if (strncmp(flag_s, "NO-CCK", 6) == 0)
+ return RRF_NO_CCK;
+ if (strncmp(flag_s, "NO-INDOOR", 9) == 0)
+ return RRF_NO_INDOOR;
+ if (strncmp(flag_s, "NO-OUTDOOR", 10) == 0)
+ return RRF_NO_OUTDOOR;
+ if (strncmp(flag_s, "DFS", 3) == 0)
+ return RRF_DFS;
+ if (strncmp(flag_s, "PTP-ONLY", 8) == 0)
+ return RRF_PTP_ONLY;
+ if (strncmp(flag_s, "PTMP-ONLY", 9) == 0)
+ return RRF_PTMP_ONLY;
+ if (strncmp(flag_s, "NO-IR", 5) == 0)
+ return RRF_NO_IR;
+
+ return 0;
+}
+
+static int
+reglib_parse_rule_simple(char *line, struct ieee80211_reg_rule *reg_rule)
+{
+ int hits;
+ float start_freq_khz, end_freq_khz, max_bandwidth_khz, max_eirp;
+
+ hits = sscanf(line, "\t(%f - %f @ %f), (%f)\n",
+ &start_freq_khz,
+ &end_freq_khz,
+ &max_bandwidth_khz,
+ &max_eirp);
+
+ if (hits != 4)
+ return -EINVAL;
+
+ reg_rule->freq_range.start_freq_khz =
+ REGLIB_MHZ_TO_KHZ(start_freq_khz);
+ reg_rule->freq_range.end_freq_khz =
+ REGLIB_MHZ_TO_KHZ(end_freq_khz);
+ reg_rule->freq_range.max_bandwidth_khz =
+ REGLIB_MHZ_TO_KHZ(max_bandwidth_khz);
+ reg_rule->power_rule.max_eirp =
+ REGLIB_DBM_TO_MBM(max_eirp);
+
+ reg_rule->flags = 0;
+
+ if (debug)
+ printf("reglib_parse_rule_simple(): %d line: %s", hits, line);
+
+
+ return 0;
+}
+
+static int
+reglib_parse_rule_simple_mw(char *line, struct ieee80211_reg_rule *reg_rule)
+{
+ int hits;
+ float start_freq_khz, end_freq_khz, max_bandwidth_khz, max_eirp;
+ char mw[3];
+
+ hits = sscanf(line, "\t(%f - %f @ %f), (%f %2[mW])\n",
+ &start_freq_khz,
+ &end_freq_khz,
+ &max_bandwidth_khz,
+ &max_eirp, mw);
+
+ if (hits != 4)
+ return -EINVAL;
+
+
+ reg_rule->freq_range.start_freq_khz =
+ REGLIB_MHZ_TO_KHZ(start_freq_khz);
+ reg_rule->freq_range.end_freq_khz =
+ REGLIB_MHZ_TO_KHZ(end_freq_khz);
+ reg_rule->freq_range.max_bandwidth_khz =
+ REGLIB_MHZ_TO_KHZ(max_bandwidth_khz);
+ reg_rule->power_rule.max_eirp =
+ REGLIB_MW_TO_MBM(max_eirp);
+
+ reg_rule->flags = 0;
+
+ if (debug)
+ printf("reglib_parse_rule_simple_mw(): %d line: %s",
+ hits, line);
+
+ return 0;
+}
+
+static int
+reglib_parse_rule_args(char *line, struct ieee80211_reg_rule *reg_rule)
+{
+#define IGNORE_COMMA_OR_SPACE "%*[ ,]"
+ int hits;
+ char flag_list[9][100];
+ unsigned int i = 0;
+ float start_freq_khz, end_freq_khz, max_bandwidth_khz, max_eirp;
+
+ for (i = 0; i < 9; i++)
+ memset(flag_list[i], 0, sizeof(flag_list[i]));
+
+ hits = sscanf(line, "\t(%f - %f @ %f), (%f)"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s",
+ &start_freq_khz,
+ &end_freq_khz,
+ &max_bandwidth_khz,
+ &max_eirp,
+ flag_list[0],
+ flag_list[1],
+ flag_list[2],
+ flag_list[3],
+ flag_list[4],
+ flag_list[5],
+ flag_list[6],
+ flag_list[7],
+ flag_list[8]);
+
+ if (hits < 5)
+ return -EINVAL;
+
+ reg_rule->freq_range.start_freq_khz =
+ REGLIB_MHZ_TO_KHZ(start_freq_khz);
+ reg_rule->freq_range.end_freq_khz =
+ REGLIB_MHZ_TO_KHZ(end_freq_khz);
+ reg_rule->freq_range.max_bandwidth_khz =
+ REGLIB_MHZ_TO_KHZ(max_bandwidth_khz);
+ reg_rule->power_rule.max_eirp =
+ REGLIB_DBM_TO_MBM(max_eirp);
+
+ for (i = 0; i < 8; i++)
+ reg_rule->flags |= reglib_parse_rule_flag(flag_list[i]);
+
+ if (debug)
+ printf("reglib_parse_rule_args(): %d flags: %d, line: %s",
+ hits, reg_rule->flags, line);
+
+ return 0;
+#undef IGNORE_COMMA_OR_SPACE
+}
+
+
+static int
+reglib_parse_rule_args_mw(char *line, struct ieee80211_reg_rule *reg_rule)
+{
+#define IGNORE_COMMA_OR_SPACE "%*[ ,]"
+ int hits;
+ char flag_list[9][100];
+ unsigned int i = 0;
+ char mw[3];
+ float start_freq_khz, end_freq_khz, max_bandwidth_khz, max_eirp;
+
+ for (i = 0; i < 9; i++)
+ memset(flag_list[i], 0, sizeof(flag_list[i]));
+
+ hits = sscanf(line, "\t(%f - %f @ %f), (%f %2[mW])"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s"
+ IGNORE_COMMA_OR_SPACE "%s",
+ &start_freq_khz,
+ &end_freq_khz,
+ &max_bandwidth_khz,
+ &max_eirp,
+ mw,
+ flag_list[0],
+ flag_list[1],
+ flag_list[2],
+ flag_list[3],
+ flag_list[4],
+ flag_list[5],
+ flag_list[6],
+ flag_list[7],
+ flag_list[8]);
+
+ if (hits < 5)
+ return -EINVAL;
+
+ reg_rule->freq_range.start_freq_khz =
+ REGLIB_MHZ_TO_KHZ(start_freq_khz);
+ reg_rule->freq_range.end_freq_khz =
+ REGLIB_MHZ_TO_KHZ(end_freq_khz);
+ reg_rule->freq_range.max_bandwidth_khz =
+ REGLIB_MHZ_TO_KHZ(max_bandwidth_khz);
+ reg_rule->power_rule.max_eirp =
+ REGLIB_MW_TO_MBM(max_eirp);
+
+ for (i = 0; i < 8; i++)
+ reg_rule->flags |= reglib_parse_rule_flag(flag_list[i]);
+
+ if (debug)
+ printf("reglib_parse_rule_args_mw(): %d flags: %d, line: %s",
+ hits, reg_rule->flags, line);
+ return 0;
+#undef IGNORE_COMMA_OR_SPACE
+}
+
+static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
+{
+ char line[1024];
+ char *line_p;
+ unsigned int i;
+ int r = 0;
+ struct reglib_rule_parse_list *reglib_rule_parsers;
+ size_t size_parsers = sizeof(struct reglib_rule_parse_list) +
+ 4 * sizeof(int (*)(char *, struct ieee80211_reg_rule *));
+
+ reglib_rule_parsers = malloc(size_parsers);
+ if (!reglib_rule_parsers)
+ return -EINVAL;
+ memset(reglib_rule_parsers, 0, size_parsers);
+
+ reglib_rule_parsers->n_parsers = 4;
+
+ /*
+ * XXX: sscanf() is a bit odd with picking up mW
+ * case over the simple one, this order however works,
+ * gotta figure out how to be more precise.
+ */
+ reglib_rule_parsers->rule_parsers[0] = reglib_parse_rule_args_mw;
+ reglib_rule_parsers->rule_parsers[1] = reglib_parse_rule_args;
+ reglib_rule_parsers->rule_parsers[2] = reglib_parse_rule_simple;
+ reglib_rule_parsers->rule_parsers[3] = reglib_parse_rule_simple_mw;
+
+ memset(line, 0, sizeof(line));
+ line_p = fgets(line, sizeof(line), fp);
+ if (line_p != line)
+ return -EINVAL;
+
+ for (i = 0; i < reglib_rule_parsers->n_parsers; i++) {
+ r = reglib_rule_parsers->rule_parsers[i](line, reg_rule);
+ if (r == 0)
+ break;
+ }
+
+ return r;
+}
+
+static uint32_t
+reglib_get_n_rules(FILE *fp, struct ieee80211_reg_rule *reg_rule)
+{
+ uint32_t n_rules = 0;
+ int r;
+ bool save_debug = false;
+
+ save_debug = debug;
+ debug = false;
+
+ while (1) {
+ r = reglib_parse_rule(fp, reg_rule);
+ if (r != 0)
+ break;
+ n_rules++;
+ }
+
+ debug = save_debug;
+
+ return n_rules;
+}
+
+static int reglib_parse_reg_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule)
+{
+ int r;
+
+ while (1) {
+ r = reglib_parse_rule(fp, reg_rule);
+ if (r != 0)
+ continue;
+ return 0;
+ }
+}
+
+static struct ieee80211_regdomain *
+reglib_parse_rules(FILE *fp, struct ieee80211_regdomain *trd)
+{
+ struct ieee80211_regdomain *rd;
+ struct ieee80211_reg_rule rule;
+ struct ieee80211_reg_rule *reg_rule;
+ fpos_t pos;
+ unsigned int i;
+ uint32_t size_of_regd = 0, num_rules = 0;
+ int r;
+
+ memset(&rule, 0, sizeof(rule));
+ reg_rule = &rule;
+
+ r = fgetpos(fp, &pos);
+ if (r != 0) {
+ fprintf(stderr, "fgetpos() failed: %s\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ num_rules = reglib_get_n_rules(fp, reg_rule);
+ if (!num_rules)
+ return NULL;
+
+ size_of_regd = reglib_array_len(sizeof(struct ieee80211_regdomain),
+ num_rules + 1,
+ sizeof(struct ieee80211_reg_rule));
+ rd = malloc(size_of_regd);
+ if (!rd)
+ return NULL;
+
+ memset(rd, 0, size_of_regd);
+ memcpy(rd, trd, sizeof(*trd));
+
+ rd->n_reg_rules = num_rules;
+
+ r = fsetpos(fp, &pos);
+ if (r != 0) {
+ fprintf(stderr, "fsetpos() failed: %s\n",
+ strerror(errno));
+ free(rd);
+ return NULL;
+ }
+ for (i = 0; i < num_rules; i++) {
+ struct ieee80211_reg_rule *rrule = &rd->reg_rules[i];
+
+ if (reglib_parse_reg_rule(fp, rrule) != 0) {
+ fprintf(stderr, "rule parse failed\n");
+ free(rd);
+ return NULL;
+ }
+ }
+ return rd;
+}
+
+static int
+reglib_parse_country_simple(char *line, struct ieee80211_regdomain *rd)
+{
+ char dfs_region_alpha[9];
+ char alpha2[2];
+ int hits;
+
+ memset(rd, 0, sizeof(rd));
+ memset(alpha2, 0, sizeof(alpha2));
+ memset(dfs_region_alpha, 0, sizeof(dfs_region_alpha));
+
+ hits = sscanf(line, "country %2[a-zA-Z0-9]:",
+ alpha2);
+
+ if (hits != 1)
+ return -EINVAL;
+
+ rd->alpha2[0] = alpha2[0];
+ rd->alpha2[1] = alpha2[1];
+
+ return 0;
+}
+
+static int reglib_parse_country_dfs(char *line, struct ieee80211_regdomain *rd)
+{
+ char dfs_region_alpha[9];
+ char alpha2[2];
+ int hits;
+
+ memset(rd, 0, sizeof(rd));
+ memset(alpha2, 0, sizeof(alpha2));
+ memset(dfs_region_alpha, 0, sizeof(dfs_region_alpha));
+
+ hits = sscanf(line, "country %2[a-zA-Z0-9]:%*[ ]%s\n",
+ alpha2,
+ dfs_region_alpha);
+ if (hits <= 0)
+ return -EINVAL;
+
+ if (hits != 2)
+ return -EINVAL;
+
+
+ rd->alpha2[0] = alpha2[0];
+ rd->alpha2[1] = alpha2[1];
+ rd->dfs_region = reglib_parse_dfs_region(dfs_region_alpha);
+
+ return 0;
+}
+
+struct ieee80211_regdomain *__reglib_parse_country(FILE *fp)
+{
+ struct ieee80211_regdomain *rd;
+ struct ieee80211_regdomain tmp_rd;
+ char line[1024];
+ char *line_p;
+ unsigned int i;
+ int r = 0;
+ struct reglib_country_parse_list *reglib_country_parsers;
+ size_t size_of_parsers = sizeof(struct reglib_country_parse_list) +
+ 2 * sizeof(int (*)(char *, struct ieee80211_regdomain *));
+
+ reglib_country_parsers = malloc(size_of_parsers);
+ if (!reglib_country_parsers)
+ return NULL;
+ memset(reglib_country_parsers, 0, size_of_parsers);
+
+ reglib_country_parsers->n_parsers = 2;
+ reglib_country_parsers->country_parsers[0] =
+ reglib_parse_country_dfs;
+ reglib_country_parsers->country_parsers[1] =
+ reglib_parse_country_simple;
+
+ memset(&tmp_rd, 0, sizeof(tmp_rd));
+ memset(line, 0, sizeof(line));
+
+ line_p = fgets(line, sizeof(line), fp);
+
+ if (line_p != line)
+ return NULL;
+
+ for (i = 0; i < reglib_country_parsers->n_parsers; i++) {
+ r = reglib_country_parsers->country_parsers[i](line, &tmp_rd);
+ if (r == 0)
+ break;
+ }
+
+ if (r != 0) {
+ fprintf(stderr, "Invalid country line: %s", line);
+ return NULL;
+ }
+
+ rd = reglib_parse_rules(fp, &tmp_rd);
+
+ return rd;
+}
+
+static int reglib_find_next_country_stream(FILE *fp)
+{
+ fpos_t prev_pos;
+ int r;
+ unsigned int i = 0;
+
+ while(1) {
+ char line[1024];
+ char *line_p;
+
+ r = fgetpos(fp, &prev_pos);
+ if (r != 0) {
+ fprintf(stderr, "fgetpos() failed: %s\n",
+ strerror(errno));
+ return r;
+ }
+
+ memset(line, 0, sizeof(line));
+
+ line_p = fgets(line, sizeof(line), fp);
+ if (line_p == line) {
+ if (strspn(line, "\n") == strlen(line)) {
+ i++;
+ continue;
+ }
+ if (strncmp(line, "country", 7) != 0)
+ continue;
+ r = fsetpos(fp, &prev_pos);
+ if (r != 0) {
+ fprintf(stderr, "fsetpos() failed: %s\n",
+ strerror(errno));
+ return r;
+ }
+ return 0;
+ } else
+ return EOF;
+ }
+}
+
+struct ieee80211_regdomain *reglib_parse_country(FILE *fp)
+{
+ int r;
+
+ r = reglib_find_next_country_stream(fp);
+ if (r != 0)
+ return NULL;
+ return __reglib_parse_country(fp);
+}
+
+FILE *reglib_create_parse_stream(FILE *f)
+{
+ unsigned int lines = 0;
+ FILE *fp;
+
+ fp = tmpfile();
+ if (errno) {
+ fprintf(stderr, "%s\n", strerror(errno));
+ return NULL;
+ }
+
+ while(1) {
+ char line[1024];
+ char *line_p;
+
+ line_p = fgets(line, sizeof(line), f);
+ if (line_p == line) {
+ if (strchr(line, '#') == NULL) {
+ fputs(line, fp);
+ lines++;
+ }
+ continue;
+ } else
+ break;
+ }
+
+ rewind(fp);
+ fflush(fp);
+
+ return fp;
+}
diff --git a/reglib.h b/reglib.h
index 7a586a3..885792e 100644
--- a/reglib.h
+++ b/reglib.h
@@ -1,10 +1,12 @@
#ifndef REG_LIB_H
#define REG_LIB_H
+#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/stat.h>
+#include <math.h>
#include "regdb.h"
@@ -35,6 +37,19 @@ struct ieee80211_regdomain {
struct ieee80211_reg_rule reg_rules[];
};
+/* Remove this once upstream nl80211.h gets this */
+#define NL80211_RRF_NO_IR (1<<7)
+
+#define REGLIB_MHZ_TO_KHZ(freq) ((freq) * 1000)
+#define REGLIB_KHZ_TO_MHZ(freq) ((freq) / 1000)
+#define REGLIB_DBI_TO_MBI(gain) ((gain) * 100)
+#define REGLIB_MBI_TO_DBI(gain) ((gain) / 100)
+#define REGLIB_DBM_TO_MBM(gain) ((gain) * 100)
+#define REGLIB_MBM_TO_DBM(gain) ((gain) / 100)
+
+#define REGLIB_MW_TO_DBM(gain) (10 * log10(gain))
+#define REGLIB_MW_TO_MBM(gain) (REGLIB_DBM_TO_MBM(REGLIB_MW_TO_DBM(gain)))
+
/**
* struct reglib_regdb_ctx - reglib regdb context
*
@@ -180,4 +195,33 @@ reglib_intersect_rds(const struct ieee80211_regdomain *rd1,
const struct ieee80211_regdomain *
reglib_intersect_regdb(const struct reglib_regdb_ctx *ctx);
+/**
+ * @reglib_create_parse_stream - provide a clean new stream for processing
+ *
+ * @fp: FILE stream, could be stdin, or a stream from an open file.
+ *
+ * In order to parse a stream we recommend to create a new stream
+ * using this helper. A new stream is preferred in order to work
+ * with stdin, as otherwise we cannot rewind() and move around
+ * the stream. This helper will create new stream using tmpfile()
+ * and also remove all comments. It will be closed and the file
+ * deleted when the process terminates.
+ */
+FILE *reglib_create_parse_stream(FILE *fp);
+
+/**
+ * @reglib_parse_country - parse stream to build a regulatory domain
+ *
+ * @fp: FILE stream, could be stdin, or a stream from an open file.
+ *
+ * Parse stream and return back a built regulatory domain. Returns
+ * NULL if one could not be built.
+ */
+struct ieee80211_regdomain *reglib_parse_country(FILE *fp);
+
+#define reglib_for_each_country_stream(__fp, __rd) \
+ for (__rd = reglib_parse_country(__fp); \
+ __rd != NULL; \
+ __rd = reglib_parse_country(__fp)) \
+
#endif
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 2/6] crda: fix -pedantic gcc compilation
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
gcc likes to complain about this, fix that as we're
going to get a bit more anal with code here soon as
we're moving towards making a library out of reglib.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
crda.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/crda.c b/crda.c
index 2a601eb..4751a39 100644
--- a/crda.c
+++ b/crda.c
@@ -141,13 +141,15 @@ int main(int argc, char **argv)
{
int fd = -1;
int i = 0, j, r;
- char alpha2[3] = {}; /* NUL-terminate */
+ char alpha2[3];
char *env_country;
struct nl80211_state nlstate;
struct nl_cb *cb = NULL;
struct nl_msg *msg;
int finished = 0;
+ memset(alpha2, 0, 3);
+
struct nlattr *nl_reg_rules;
const struct ieee80211_regdomain *rd = NULL;
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 1/6] crda: relicense under copyleft-next-0.3.0
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
In-Reply-To: <1382978526-23929-1-git-send-email-mcgrof@do-not-panic.com>
I'm relicensing CRDA to copyleft-next-0.3.0. The original
motivation was to help with the BSD family but they are not
using any of this software and as this software grows I'd
like to ensure we use the best free software license
possible.
Fontana's work on copyleft-next is great and has good
community traction. At this point development for
copyleft-next has slowed down as copyleft-next-0.3.0
is already a good, usable alternative to GPLv2 and GPLv3.
A few notes:
* With copyleft we don't have to specify 'at your option
any later version' since the license allows that by
default.
* Some folks might wonder if copyleft-next-0.3.0 is
OSI OSD-conformant or FSF-free since neither of
those bodies have examined the license officially,
but note, although IANAL, that copyleft-next is
outbound-compatible with GPLv2 and GPLv3
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
LICENSE | 14 +++-
copyleft-next-0.3.0 | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 232 insertions(+), 1 deletion(-)
create mode 100644 copyleft-next-0.3.0
diff --git a/LICENSE b/LICENSE
index 652a6dd..cc26ff2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,16 @@
-Copyright (c) 2008, Luis R. Rodriguez <mcgrof@gmail.com>
+Copyright (c) 2013, Luis R. Rodriguez <mcgrof@do-not-panic.com>
+
+CRDA is licensed under copyleft-next 0.3.0
+
+Refer to copyleft-next-0.3.0 for license details, you can
+also always get the latest updates of copyleft-next from:
+
+https://gitorious.org/copyleft-next/
+
+This file incorporates work covered by the following copyright and
+permission notice:
+
+Copyright (c) 2008, Luis R. Rodriguez <mcgrof@do-not-panic.com>
Copyright (c) 2008, Johannes Berg <johannes@sipsolutions.net>
Copyright (c) 2008, Michael Green <Michael.Green@Atheros.com>
diff --git a/copyleft-next-0.3.0 b/copyleft-next-0.3.0
new file mode 100644
index 0000000..a66d5bf
--- /dev/null
+++ b/copyleft-next-0.3.0
@@ -0,0 +1,219 @@
+ copyleft-next 0.3.0 ("this License")
+ Release date: 2013-05-16
+
+1. License Grants; No Trademark License
+
+ Subject to the terms of this License, I grant You:
+
+ a) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable
+ copyright license, to reproduce, Distribute, prepare derivative works
+ of, publicly perform and publicly display My Work.
+
+ b) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable
+ patent license under Licensed Patents to make, have made, use, sell,
+ offer for sale, and import Covered Works.
+
+ This License does not grant any rights in My name, trademarks, service
+ marks, or logos.
+
+2. Distribution: General Conditions
+
+ You may Distribute Covered Works, provided that You (i) inform
+ recipients how they can obtain a copy of this License; (ii) satisfy the
+ applicable conditions of sections 3 through 6; and (iii) preserve all
+ Legal Notices contained in My Work (to the extent they remain
+ pertinent). "Legal Notices" means copyright notices, license notices,
+ license texts, and author attributions, but does not include logos,
+ other graphical images, trademarks or trademark legends.
+
+3. Conditions for Distributing Derived Works; Outbound GPL Compatibility
+
+ If You Distribute a Derived Work, You must license the entire Derived
+ Work as a whole under this License, with prominent notice of such
+ licensing. This condition may not be avoided through such means as
+ separate Distribution of portions of the Derived Work. You may
+ additionally license the Derived Work under the GPL, so that the
+ recipient may further Distribute the Derived Work under either this
+ License or the GPL.
+
+4. Condition Against Further Restrictions; Inbound License Compatibility
+
+ When Distributing a Covered Work, You may not impose further
+ restrictions on the exercise of rights in the Covered Work granted under
+ this License. This condition is not excused merely because such
+ restrictions result from Your compliance with conditions or obligations
+ extrinsic to this License (such as a court order or an agreement with a
+ third party).
+
+ However, You may Distribute a Covered Work incorporating material
+ governed by a license that is both OSI-Approved and FSF-Free as of the
+ release date of this License, provided that Your Distribution complies
+ with such other license.
+
+5. Conditions for Distributing Object Code
+
+ You may Distribute an Object Code form of a Covered Work, provided that
+ you accompany the Object Code with a URL through which the Corresponding
+ Source is made available, at no charge, by some standard or customary
+ means of providing network access to source code.
+
+ If you Distribute the Object Code in a physical product or tangible
+ storage medium ("Product"), the Corresponding Source must be available
+ through such URL for two years from the date of Your most recent
+ Distribution of the Object Code in the Product. However, if the Product
+ itself contains or is accompanied by the Corresponding Source (made
+ available in a customarily accessible manner), You need not also comply
+ with the first paragraph of this section.
+
+ Each recipient of the Covered Work from You is an intended third-party
+ beneficiary of this License solely as to this section 5, with the right
+ to enforce its terms.
+
+6. Symmetrical Licensing Condition for Upstream Contributions
+
+ If You Distribute a work to Me specifically for inclusion in or
+ modification of a Covered Work (a "Patch"), and no explicit licensing
+ terms apply to the Patch, You license the Patch under this License, to
+ the extent of Your copyright in the Patch. This condition does not
+ negate the other conditions of this License, if applicable to the Patch.
+
+7. Nullification of Copyleft/Proprietary Dual Licensing
+
+ If I offer to license, for a fee, a Covered Work under terms other than
+ a license that is OSI-Approved or FSF-Free as of the release date of this
+ License or a numbered version of copyleft-next released by the
+ Copyleft-Next Project, then the license I grant You under section 1 is no
+ longer subject to the conditions in sections 2 through 5.
+
+8. Copyleft Sunset
+
+ The conditions in sections 2 through 5 no longer apply once fifteen
+ years have elapsed from the date of My first Distribution of My Work
+ under this License.
+
+9. Pass-Through
+
+ When You Distribute a Covered Work, the recipient automatically receives
+ a license to My Work from Me, subject to the terms of this License.
+
+10. Termination
+
+ Your license grants under section 1 are automatically terminated if You
+
+ a) fail to comply with the conditions of this License, unless You cure
+ such noncompliance within thirty days after becoming aware of it, or
+
+ b) initiate a patent infringement litigation claim (excluding
+ declaratory judgment actions, counterclaims, and cross-claims)
+ alleging that any part of My Work directly or indirectly infringes
+ any patent.
+
+ Termination of Your license grants extends to all copies of Covered
+ Works You subsequently obtain. Termination does not terminate the
+ rights of those who have received copies or rights from You subject to
+ this License.
+
+ To the extent permission to make copies of a Covered Work is necessary
+ merely for running it, such permission is not terminable.
+
+11. Later License Versions
+
+ The Copyleft-Next Project may release new versions of copyleft-next,
+ designated by a distinguishing version number ("Later Versions").
+ Unless I explicitly remove the option of Distributing Covered Works
+ under Later Versions, You may Distribute Covered Works under any Later
+ Version.
+
+** 12. No Warranty **
+** **
+** My Work is provided "as-is", without warranty. You bear the risk **
+** of using it. To the extent permitted by applicable law, each **
+** Distributor of My Work excludes the implied warranties of title, **
+** merchantability, fitness for a particular purpose and **
+** non-infringement. **
+
+** 13. Limitation of Liability **
+** **
+** To the extent permitted by applicable law, in no event will any **
+** Distributor of My Work be liable to You for any damages **
+** whatsoever, whether direct, indirect, special, incidental, or **
+** consequential damages, whether arising under contract, tort **
+** (including negligence), or otherwise, even where the Distributor **
+** knew or should have known about the possibility of such damages. **
+
+14. Severability
+
+ The invalidity or unenforceability of any provision of this License
+ does not affect the validity or enforceability of the remainder of
+ this License. Such provision is to be reformed to the minimum extent
+ necessary to make it valid and enforceable.
+
+15. Definitions
+
+ "Copyleft-Next Project" means the project that maintains the source
+ code repository at <https://gitorious.org/copyleft-next/> as of the
+ release date of this License.
+
+ "Corresponding Source" of a Covered Work in Object Code form means (i)
+ the Source Code form of the Covered Work; (ii) all scripts,
+ instructions and similar information that are reasonably necessary for
+ a skilled developer to generate such Object Code from the Source Code
+ provided under (i); and (iii) a list clearly identifying all Separate
+ Works (other than those provided in compliance with (ii)) that were
+ specifically used in building and (if applicable) installing the
+ Covered Work (for example, a specified proprietary compiler including
+ its version number). Corresponding Source must be machine-readable.
+
+ "Covered Work" means My Work or a Derived Work.
+
+ "Derived Work" means a work of authorship that copies from, modifies,
+ adapts, is based on, is a derivative work of, transforms, translates or
+ contains all or part of My Work, such that copyright permission is
+ required. The following are not Derived Works: (i) Mere Aggregation;
+ (ii) a mere reproduction of My Work; and (iii) if My Work fails to
+ explicitly state an expectation otherwise, a work that merely makes
+ reference to My Work.
+
+ "Distribute" means to distribute, transfer or make a copy available to
+ someone else, such that copyright permission is required.
+
+ "Distributor" means Me and anyone else who Distributes a Covered Work.
+
+ "FSF-Free" means classified as 'free' by the Free Software Foundation.
+
+ "GPL" means a version of the GNU General Public License or the GNU
+ Affero General Public License.
+
+ "I"/"Me"/"My" refers to the individual or legal entity that places My
+ Work under this License. "You"/"Your" refers to the individual or legal
+ entity exercising rights in My Work under this License. A legal entity
+ includes each entity that controls, is controlled by, or is under
+ common control with such legal entity. "Control" means (a) the power to
+ direct the actions of such legal entity, whether by contract or
+ otherwise, or (b) ownership of more than fifty percent of the
+ outstanding shares or beneficial ownership of such legal entity.
+
+ "Licensed Patents" means all patent claims licensable royalty-free by
+ Me, now or in the future, that are necessarily infringed by making,
+ using, or selling My Work, and excludes claims that would be infringed
+ only as a consequence of further modification of My Work.
+
+ "Mere Aggregation" means an aggregation of a Covered Work with a
+ Separate Work.
+
+ "My Work" means the particular work of authorship I license to You
+ under this License.
+
+ "Object Code" means any form of a work that is not Source Code.
+
+ "OSI-Approved" means approved as 'Open Source' by the Open Source
+ Initiative.
+
+ "Separate Work" means a work that is separate from and independent of a
+ particular Covered Work and is not by its nature an extension or
+ enhancement of the Covered Work, and/or a runtime library, standard
+ library or similar component that is used to generate an Object Code
+ form of a Covered Work.
+
+ "Source Code" means the preferred form of a work for making
+ modifications to it.
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH v2 0/6] crda: few more updates
From: Luis R. Rodriguez @ 2013-10-28 16:42 UTC (permalink / raw)
To: linux-wireless; +Cc: wireless-regdb, Luis R. Rodriguez
Here's a second spin, after quite a bit more testing I ran
into a few small issues with the parser and library. This
has these additional fixes / enhancements:
* Lifts the restriction on 32 rules, although the kernel
is limited by this we don't adhere to this limit on our
stream parser or optimizer
* The union code got updated to address two cases that are
invalid for unions
* A few fixes on db2rd and optimizer on using the stream
parser, if its NULL, bail, we weren't checking for it
* The optimizer was not considering band differences as
part of its key broker (when it decides it can use
two rules for optimization), to address this we deduce
the band and add that to the key mixing. Note that this
will need to be updated upon new frequency band additions.
This limits the scope of optimizations between their own
respective bands.
I've also gone ahead and tested this with a huge fluffy
non optimized regulatory domain of 40 rules, and also with
the wireless-regdb db.txt. I'll send some optimizations
based on this for wireless-regdb.
The only patches that go modified are the stream parser
and the optimizer.
Luis R. Rodriguez (6):
crda: relicense under copyleft-next-0.3.0
crda: fix -pedantic gcc compilation
crda: add regulatory domain stream parser
crda: add regulatory domain optimizer
crda: make ssl keys include stdint.h
crda: make reglib a shared library
LICENSE | 14 +-
Makefile | 54 +++-
copyleft-next-0.3.0 | 219 ++++++++++++++
crda.c | 4 +-
db2rd.c | 32 ++
optimize.c | 40 +++
reglib.c | 839 ++++++++++++++++++++++++++++++++++++++++++++++++++++
reglib.h | 60 ++++
utils/key2pub.py | 2 +
9 files changed, 1252 insertions(+), 12 deletions(-)
create mode 100644 copyleft-next-0.3.0
create mode 100644 db2rd.c
create mode 100644 optimize.c
--
1.8.4.rc3
^ permalink raw reply
* Re: I always need a miracle to connect with iwlwifi
From: Oleksij Rempel @ 2013-10-28 16:28 UTC (permalink / raw)
To: Felipe Contreras; +Cc: linux-wireless Mailing List, ilw, hostap@lists.shmoo.com
In-Reply-To: <CAMP44s05-NRskvWHNqzVxTRiB_2DeRsPwQGAZZ3saM-VC=ZyQA@mail.gmail.com>
Am 28.10.2013 16:44, schrieb Felipe Contreras:
> On Mon, Oct 28, 2013 at 3:52 AM, Oleksij Rempel <linux@rempel-privat.de> wrote:
>> Am 28.10.2013 10:38, schrieb Felipe Contreras:
>>> On Mon, Oct 28, 2013 at 2:31 AM, Oleksij Rempel <linux@rempel-privat.de> wrote:
>
>>>> Heh... this logs look like miracle :)
>>>> My first assumption would be buggy router. There is no answer in
>>>> wpa_supplicant log.
>>>
>>> Yeah, I bet the router is buggy, which router isn't? But why Windows 7
>>> connects fine?
>>
>> May be it includes some workaround?
>
>> You do not need to fight with devs, i think they are agree that some
>> thing is wrong. But believe me, there are so many access points, which
>> make problems or wear things. If you have a bug, does not mean other
>> user have it.
>
> I understand the problems of making wireless drivers work on different
> kinds of access points, and I'm not fighting with devs, I'm just
> saying that if it works in all other devices the problem is most
> likely on this one.
>
> And BTW, the devices we are talking about are very varied: Wii U,
> Windows 7, Windows 8.1, Nokia N9, Android phone, iPhone, iMac, Amazon
> Kindle. Yet the only device that seems to have a problem is my Linux
> machine, I think it's pretty clear where the problem is.
Do any of listed devices use mac80211? If not, you still have fallowing
options: wpa_supplicant, mac80211, iwlwifi driver, iwlwifi firmware. In
you arguments you even didn't tried to eliminate any of them. So, no. It
is not clear where problem is.
> And sure, it does not necessarily means that other people have the
> same problem, but it is very unlikely that I'm the only one.
what is your hardware? Did you tired to disable power save mode?
I have "Intel Centrino Advanced-N 6235", it use same driver and works
with three of my APs. I say just to show, that list of working hardware
is not helpful.
what is you AP? Mode it is running? Do changing settings of this AP
makes some difference? -- No, changing settings of you AP is not the way
to get you off.
>> Beside, how many clients use this AP?
>
> Probably around a dozen.
>
>> How big is the distance?
>
> Probably around 10m.
>
>> What do you configure in AdHock mode?
>
> Nothing, I don't think it even works, but it associates. I just add mode=1.
>
> network={
> ssid="AXTEL-XXX"
> proto=WPA2
> scan_ssid=1
> key_mgmt=WPA-PSK
> psk="XXX"
> mode=1
> }
>
>>>> Take wireshark and capture working and not working associational request.
>>>
>>> I'll try that. If only it was that easy to get a working association.
>>
>> Compare it with windows.
>
> Right, I forgot I can use wireshark in Windows.
>
>> and please read this, it will help to provide more information.
>> http://wireless.kernel.org/en/users/Documentation/Reporting_bugs
>
> I don't understand what exactly do you need from that list. I'm using
> 3.11.6, but as I said in the original report, the kernel version makes
> no difference, even as far back as 3.6.0. I've put the dmesg log in
> the original mail and there's nothing of value there. I could try
> running with CONFIG_MAC80211_*_DEBUG stuff enabled, but do you really
> think that will help?
>
> If you really must know, this is exactly what I'm running:
>
> config=$(mktemp)
> pid="/run/wpa_supplicant_wlan0.pid"
>
> cat > $config <<-EOF
> country=MX
> ap_scan=1
> eapol_version=2
> device_name=Nysa
> device_type=1-0050F204-1
>
> network={
> ssid="AXTEL-7111"
> proto=WPA2
> scan_ssid=1
> key_mgmt=WPA-PSK
> psk="C3657111"
> mode=0
> }
> EOF
>
> wpa_supplicant -B -t -d -P $pid -i wlan0 -D nl80211,wext -c $config -f
> /tmp/wpa.log
>
> rm -f "$config"
>
> I tried with wext, but that doesn't work at all. A curious fact is
> that I need to enable CONFIG_CFG80211_WEXT=y for AP scanning to work,
> even though I'm not using the wext driver.
>
> I will try to get the wireshark logs.
>
--
Regards,
Oleksij
^ 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