Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [PATCH] iw: fix typos in MCS set parsing code
From: Johannes Berg @ 2009-08-11  6:54 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: linux-wireless@vger.kernel.org, Luis R. Rodriguez
In-Reply-To: <1249973250-9235-1-git-send-email-juhosg@openwrt.org>

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

On Tue, 2009-08-11 at 08:47 +0200, Gabor Juhos wrote:
> The current code uses wrong binary operator for masking,
> and the shift values for the 'tx_max_num_spatial_streams' and
> 'tx_unequal_modulation' fields are off-by-one.

> -			tx_max_num_spatial_streams = (mcs[12] | ((1 << 3) | (1 << 4))) + 1;
> -			tx_unequal_modulation = !!(mcs[12] & (1 << 5));
> +			tx_max_num_spatial_streams = (mcs[12] & ((1 << 2) | (1 << 3))) + 1;
> +			tx_unequal_modulation = !!(mcs[12] & (1 << 4));

Are you sure? The "Supported MCS Set" field is defined as a series of
_bits_, and the bits are transmitted the other way around within each
byte.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply

* Re: [PATCH] CRDA and cross-compilation
From: Philip A. Prindeville @ 2009-08-11  0:45 UTC (permalink / raw)
  To: Philip Craig; +Cc: Pavel Roskin, Luis R. Rodriguez, Jon Loeliger, wireless
In-Reply-To: <4A80BE1F.8020708@snapgear.com>

Philip Craig wrote:
> Philip A. Prindeville wrote:
>> * allowing a cross-compilation without contamination by the host's own state via pkg-config bleeding into it.
> 
> Setting PKG_CONFIG_LIBDIR should fix that without any makefile changes.
> I haven't tried with this package, but it works for every other
> cross compilation I've done.

Indeed, and that would work until, as Pavel points out, someone adds something naive and ill-informed like a `uname -r` (or `arch`) into the Makefile.

I'm not just trying to make the current version safe for cross-compilation, but all future versions too so I don't ever have to come back and fix this issue again.

You have no idea how many packages we had to make cross-compilation safe.  Literally dozens.  And some of them continue to have periodic regressions.



^ permalink raw reply

* Re: [PATCH] CRDA and cross-compilation
From: Philip A. Prindeville @ 2009-08-11  0:41 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Luis R. Rodriguez, Jon Loeliger, wireless
In-Reply-To: <1249950344.14653.51.camel@mj>

[-- Attachment #1: Type: text/plain, Size: 2911 bytes --]

Pavel Roskin wrote:
> On Mon, 2009-08-10 at 16:55 -0700, Philip A. Prindeville wrote:
> 
>> You're right: that comment was much more helpful...  does it apply to the first file or the second or both?
>>
>> And what in particular is a mess?
> 
> Cross compilation is not easy.  That's why there are such
> "metadistros" (for the lack of a better word) as buildroot and
> openembedded.  They have special entries for every package that specify
> how to cross-compile it.  There are patches for many sources, although
> it's better to have such files applied to the upstream sources.  But
> it's inevitable that the build is influenced in some way to
> cross-compile, often by specifying variables on the make command line.

Yes, agreed.  We are a downstream user of buildroot.  Unfortunately, not everything we use finds its way upstream to the buildroot repo... so we make certain changes ourselves.

And it's exactly because getting the fixes upstream *is* useful (why fix it in multiple places when you can fix it once???) that I'm being persistent.

I have no problem using variables to make to influence cross-compilation.  Indeed, my patch uses "make ... CROSS_COMPILE=$(TARGET_CROSS)" to work.


> I believe the developers of buildroot and openembedded would be able to
> deal with CRDA as is.  If they find something that could be improved,
> they can send a patch, but I don't think they will bother to change so
> many things as your patch does.
> 
> Besides, it's one thing to follow sane rules that simplify
> cross-compilation, such as providing the fourth argument to
> AC_RUN_IFELSE in configure.ac or not using uname to determine the target
> architecture.  It's another thing to support cross-compilation in a way
> unique to the package.  The gain is miniscule, and the potential for
> breaking is substantial.

There are environments where using pkg-config is every bit as evil using uname.  You just haven't had the unfortunate experience of encountering any yet.

If you're volunteering to add autoconf support to crda, then I accept.  :-)

> Most importantly, you are wasting time of people who could be doing
> something they are better at, such as development of wireless drivers.

By getting wireless drivers to run in yet another environment, I'm augmenting the base of people who will test the code you write.  What I'm doing here isn't without value as well, and some collaboration might be justified.

> There is no point in pushing the same patch over and over again, just
> because you wrote it.  Please try to accept the fact that it's not
> useful for others.  Maybe it was useful for you as an exercise.  But now
> you are not helping.  Please move on and do something else.

You're contradicting yourself.  Above you agree that "specifying variables on the make command line" is a common and acceptable way to indicate cross-compilation.

That's exactly what I'm adding here.



[-- Attachment #2: crda-cross-compile.patch --]
[-- Type: text/plain, Size: 1543 bytes --]

Changes:

1. Move invariant definitions to before any cross-compilation conditional sections for clarity (and to avoid having to duplicate them).

2. Bracket any host (native) compilation sections with conditional based on $(CROSS_COMPILE) being empty.

4. Add 'else' section for cross-compilation using openssl and libnl-1 (or libnl-2 if explicitly selected).


--- crda-1.1.0/Makefile	2009-08-10 13:37:36.000000000 -0700
+++ crda-1.1.0/Makefile.new	2009-08-10 17:29:22.000000000 -0700
@@ -22,12 +22,17 @@
 # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
 PUBKEY_DIR?=pubkeys
 
+MKDIR ?= mkdir -p
+INSTALL ?= install
+
 CFLAGS += -Wall -g
 
 all: all_noverify verify
 
 all_noverify: crda intersect regdbdump
 
+ifeq ($(CROSS_COMPILE),)
+
 ifeq ($(USE_OPENSSL),1)
 CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
 LDLIBS += `pkg-config --libs openssl`
@@ -41,8 +46,6 @@
 reglib.o: keys-gcrypt.c
 
 endif
-MKDIR ?= mkdir -p
-INSTALL ?= install
 
 NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
 NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
@@ -64,6 +67,31 @@
 NLLIBS += `pkg-config --libs $(NLLIBNAME)`
 CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
 
+else
+
+ifeq ($(USE_OPENSSL),1)
+CFLAGS += -DUSE_OPENSSL
+LDLIBS += -lssl
+
+reglib.o: keys-ssl.c
+
+else
+CFLAGS += -DUSE_GCRYPT
+LDLIBS += -lgcrypt
+
+reglib.o: keys-gcrypt.c
+
+endif
+
+ifeq ($(USE_LIBNL20),1)
+CFLAGS += -DCONFIG_LIBNL20
+NLLIBS = -lnl-genl -lnl-2.0
+else
+NLLIBS = -lnl
+endif
+
+endif
+
 ifeq ($(V),1)
 Q=
 NQ=@true

^ permalink raw reply

* [PATCH] mac80211: Fix unresolved mesh frames queued without valid control.vif
From: Javier Cardona @ 2009-08-11  0:29 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel
In-Reply-To: <1249950260-26536-1-git-send-email-javier@cozybit.com>

Mesh frames that could not be immediately resolved were queued with a NULL
info->control.vif.  This patch moves the call to mesh_nexthop_lookup closer to
the point where it is handed over to ieee80211_tx().  This ensures that the
unresolved frames are ready to be sent once the path is resolved.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/tx.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b9f5be6..56dc8df 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1413,14 +1413,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 	info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
 
-	if (ieee80211_vif_is_mesh(&sdata->vif) &&
-	    ieee80211_is_data(hdr->frame_control)) {
-		if (!is_multicast_ether_addr(hdr->addr1))
-			if (mesh_nexthop_lookup(skb, sdata)) {
-				dev_put(sdata->dev);
-				return;
-			}
-	} else if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
+	if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
 		int hdrlen;
 		u16 len_rthdr;
 
@@ -1477,6 +1470,15 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 	info->control.vif = &sdata->vif;
 
+	if (ieee80211_vif_is_mesh(&sdata->vif) &&
+	    ieee80211_is_data(hdr->frame_control) &&
+		!is_multicast_ether_addr(hdr->addr1))
+			if (mesh_nexthop_lookup(skb, sdata)) {
+				/* skb queued: don't free */
+				dev_put(sdata->dev);
+				return;
+			}
+
 	ieee80211_select_queue(local, skb);
 	ieee80211_tx(sdata, skb, false);
 	dev_put(sdata->dev);
-- 
1.5.4.3


^ permalink raw reply related

* Re: [PATCH] CRDA and cross-compilation
From: Philip Craig @ 2009-08-11  0:41 UTC (permalink / raw)
  To: Philip A. Prindeville
  Cc: Pavel Roskin, Luis R. Rodriguez, Jon Loeliger, wireless
In-Reply-To: <4A809B8D.5000309@redfish-solutions.com>

Philip A. Prindeville wrote:
> * allowing a cross-compilation without contamination by the host's own state via pkg-config bleeding into it.

Setting PKG_CONFIG_LIBDIR should fix that without any makefile changes.
I haven't tried with this package, but it works for every other
cross compilation I've done.

^ permalink raw reply

* [PATCH] mac80211: Fix unresolved mesh frames queued without valid control.vif
From: Javier Cardona @ 2009-08-11  0:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel

Mesh frames that could not be immediately resolved were queued with a NULL
info->control.vif.  This patch moves the call to mesh_nexthop_lookup closer to
the point where it is handed over to ieee80211_tx().  This ensures that the
unresolved frames are ready to be sent once the path is resolved.
---
 net/mac80211/tx.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b9f5be6..56dc8df 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1413,14 +1413,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 	info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
 
-	if (ieee80211_vif_is_mesh(&sdata->vif) &&
-	    ieee80211_is_data(hdr->frame_control)) {
-		if (!is_multicast_ether_addr(hdr->addr1))
-			if (mesh_nexthop_lookup(skb, sdata)) {
-				dev_put(sdata->dev);
-				return;
-			}
-	} else if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
+	if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
 		int hdrlen;
 		u16 len_rthdr;
 
@@ -1477,6 +1470,15 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 	info->control.vif = &sdata->vif;
 
+	if (ieee80211_vif_is_mesh(&sdata->vif) &&
+	    ieee80211_is_data(hdr->frame_control) &&
+		!is_multicast_ether_addr(hdr->addr1))
+			if (mesh_nexthop_lookup(skb, sdata)) {
+				/* skb queued: don't free */
+				dev_put(sdata->dev);
+				return;
+			}
+
 	ieee80211_select_queue(local, skb);
 	ieee80211_tx(sdata, skb, false);
 	dev_put(sdata->dev);
-- 
1.5.4.3


^ permalink raw reply related

* Re: [PATCH] CRDA and cross-compilation
From: Pavel Roskin @ 2009-08-11  0:25 UTC (permalink / raw)
  To: Philip A. Prindeville; +Cc: Luis R. Rodriguez, Jon Loeliger, wireless
In-Reply-To: <4A80B363.3090809@redfish-solutions.com>

On Mon, 2009-08-10 at 16:55 -0700, Philip A. Prindeville wrote:

> You're right: that comment was much more helpful...  does it apply to the first file or the second or both?
> 
> And what in particular is a mess?

Cross compilation is not easy.  That's why there are such
"metadistros" (for the lack of a better word) as buildroot and
openembedded.  They have special entries for every package that specify
how to cross-compile it.  There are patches for many sources, although
it's better to have such files applied to the upstream sources.  But
it's inevitable that the build is influenced in some way to
cross-compile, often by specifying variables on the make command line.

I believe the developers of buildroot and openembedded would be able to
deal with CRDA as is.  If they find something that could be improved,
they can send a patch, but I don't think they will bother to change so
many things as your patch does.

Besides, it's one thing to follow sane rules that simplify
cross-compilation, such as providing the fourth argument to
AC_RUN_IFELSE in configure.ac or not using uname to determine the target
architecture.  It's another thing to support cross-compilation in a way
unique to the package.  The gain is miniscule, and the potential for
breaking is substantial.

Most importantly, you are wasting time of people who could be doing
something they are better at, such as development of wireless drivers.

There is no point in pushing the same patch over and over again, just
because you wrote it.  Please try to accept the fact that it's not
useful for others.  Maybe it was useful for you as an exercise.  But now
you are not helping.  Please move on and do something else.

-- 
Regards,
Pavel Roskin

^ permalink raw reply

* Re: [PATCH] CRDA and cross-compilation
From: Philip A. Prindeville @ 2009-08-10 23:55 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Pavel Roskin, Jon Loeliger, wireless
In-Reply-To: <43e72e890908101530h3b024c83t7e73817ed6e28618@mail.gmail.com>

Luis R. Rodriguez wrote:
> On Mon, Aug 10, 2009 at 3:13 PM, Philip A.
> Prindeville<philipp_subx@redfish-solutions.com> wrote:
>> Pavel Roskin wrote:
>>> On Fri, 2009-08-07 at 17:09 -0700, Philip A. Prindeville wrote:
>>>> Luis R. Rodriguez wrote:
>>>>> Please send white space changes first in one patch, ie, that do not
>>>>> change anything other than that. Then send the other stuff.
>>>>>
>>>>>   Luis
>>>> Here it is.
>>> ...
>>>> -else
>>>> + else
>>> ...
>>>> +install-rb: wireless-regdb/regulatory.bin
>>> If you don't understand what you were asked to do, I'll appreciate if
>>> you stop wasting everybody's time.
>>>
>>> Nobody is going to extract useful bits from the patches you send,
>>> especially if you don't provide an adequate description of the changes.
>>>
>>> I was able to cross-compile CDRA for MIPS without any changes other than
>>> those that have already been applied.
>> Since we compile a variety of images that are both Linux and i586 based as are the target and host, detecting instances amongst the 180+ packages contained in our distribution where the build used host parameters instead of target parameters can be painful and tedious.
>>
>> Sometimes it's just best to isolate such code paths with a safe, obvious gating variable.  That's what I've tried to do here.
>>
>> We don't just build images, we also make the entire SVN tree available to others to build in their environments as well (Fedora, Centos, Gentoo, Debian, x86, PPC, x86_64, etc).  We can't possibly test for every scenario our users will encounter, so we make things as safe as we know how.
>>
>> Yes, I'm sure Pavel *was* able to build for his MIPS target in his environment.  That's a bet I can't make for all of our users, however, without these changes.
>>
>> I've split our changes into two functional groups:
>>
>> * allowing a cross-compilation without contamination by the host's own state via pkg-config bleeding into it.
>>
>> * allowing regulatory.bin to be installed via an external Makefile without having to extract internal values from crda/Makefile (i.e. REG_BIN and REG_GIT).
>>
>> These patches assume that Pavel's own "noverify" patch has already been applied.
>>
>> Changes:
>>
>> 1. Remove trailing slashes from directory variables: they're redundant and cause duplicates if they are appended to a path that's already absolute.
>>
>> 2. Move invariant definitions to before any cross-compilation conditional sections for clarity (and to avoid having to duplicate them).
>>
>> 3. Bracket any host (native) compilation sections with conditional based on $(CROSS_COMPILE) being empty.
>>
>> 4. Add 'else' section for cross-compilation using openssl and libnl-1 (or libnl-2 if explicitly selected).
>>
>>
>> --- crda-1.1.0/Makefile 2009-08-10 13:37:36.000000000 -0700
>> +++ crda-1.1.0/Makefile.new     2009-08-10 13:37:11.000000000 -0700
>> @@ -3,10 +3,10 @@
>>  REG_BIN?=/usr/lib/crda/regulatory.bin
>>  REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
>>
>> -PREFIX ?= /usr/
>> -MANDIR ?= $(PREFIX)/share/man/
>> +PREFIX ?= /usr
>> +MANDIR ?= $(PREFIX)/share/man
>>
>> -SBINDIR ?= /sbin/
>> +SBINDIR ?= /sbin
>>
>>  # Use a custom CRDA_UDEV_LEVEL when callling make install to
>>  # change your desired level for the udev regulatory.rules
>> @@ -14,7 +14,7 @@
>>  UDEV_LEVEL=$(CRDA_UDEV_LEVEL)-
>>  # You can customize this if your distributions uses
>>  # a different location.
>> -UDEV_RULE_DIR?=/lib/udev/rules.d/
>> +UDEV_RULE_DIR?=/lib/udev/rules.d
>>
>>  # If your distribution requires a custom pubkeys dir
>>  # you must update this variable to reflect where the
>> @@ -22,48 +22,76 @@
>>  # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
>>  PUBKEY_DIR?=pubkeys
>>
>> +MKDIR ?= mkdir -p
>> +INSTALL ?= install
>> +
>>  CFLAGS += -Wall -g
>>
>>  all: all_noverify verify
>>
>>  all_noverify: crda intersect regdbdump
>>
>> -ifeq ($(USE_OPENSSL),1)
>> +ifeq ($(CROSS_COMPILE),)
>> +
>> + ifeq ($(USE_OPENSSL),1)
>>  CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
>>  LDLIBS += `pkg-config --libs openssl`
>>
>>  reglib.o: keys-ssl.c
>>
>> -else
>> + else
>>  CFLAGS += -DUSE_GCRYPT
>>  LDLIBS += -lgcrypt
>>
>>  reglib.o: keys-gcrypt.c
>>
>> -endif
>> -MKDIR ?= mkdir -p
>> -INSTALL ?= install
>> + endif
>>
>>  NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
>>  NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
>>
>> -ifeq ($(NL1FOUND),Y)
>> + ifeq ($(NL1FOUND),Y)
>>  NLLIBNAME = libnl-1
>> -endif
>> + endif
>>
>> -ifeq ($(NL2FOUND),Y)
>> + ifeq ($(NL2FOUND),Y)
>>  CFLAGS += -DCONFIG_LIBNL20
>>  NLLIBS += -lnl-genl
>>  NLLIBNAME = libnl-2.0
>> -endif
>> + endif
>>
>> -ifeq ($(NLLIBNAME),)
>> + ifeq ($(NLLIBNAME),)
>>  $(error Cannot find development files for any supported version of libnl)
>> -endif
>> + endif
>>
>>  NLLIBS += `pkg-config --libs $(NLLIBNAME)`
>>  CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
>>
>> +else
>> +
>> + ifeq ($(USE_OPENSSL),1)
>> +CFLAGS += -DUSE_OPENSSL
>> +LDLIBS += -lssl
>> +
>> +reglib.o: keys-ssl.c
>> +
>> + else
>> +CFLAGS += -DUSE_GCRYPT
>> +LDLIBS += -lgcrypt
>> +
>> +reglib.o: keys-gcrypt.c
>> +
>> + endif
>> +
>> + ifeq ($(USE_LIBNL20),1)
>> +CFLAGS += -DCONFIG_LIBNL20
>> +NLLIBS = -lnl-genl -lnl-2.0
>> + else
>> +NLLIBS = -lnl
>> + endif
>> +
>> +endif
>> +
>>  ifeq ($(V),1)
>>  Q=
>>  NQ=@true
>>
>>
>> Add a couple of rules to (1) download (via GIT) John's working copy of regulatory.bin and (2) install it in the appropriate target destination.  This avoids us having to parse the Makefile for REG_BIN and REG_GIT from an enclosing (nesting) makefile, as is common in distros and buildroot environments in particular.
>>
>> --- crda-1.1.0/Makefile 2009-08-10 13:37:36.000000000 -0700
>> +++ crda-1.1.0/Makefile.new     2009-08-10 13:37:11.000000000 -0700
>> @@ -136,6 +164,14 @@
>>        $(NQ) '  INSTALL  regdbdump.8.gz'
>>        $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
>>
>> +install-rb: wireless-regdb/regulatory.bin
>> +       $(NQ) '  INSTALL  regulatory.bin'
>> +       $(Q)$(INSTALL) -m 444 -D wireless-regdb/regulatory.bin $(DESTDIR)/$(REG_BIN)
>> +
>> +wireless-regdb/regulatory.bin:
>> +       @rm -rf wireless-regdb
>> +       git clone -q $(REG_GIT) wireless-regdb
>> +
>>  clean:
>>        $(Q)rm -f crda regdbdump intersect *.o *~ *.pyc keys-*.c *.gz \
>>        udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed
> 
> This is a glory mess, please stop trying.
> 
>   Luis

You're right: that comment was much more helpful...  does it apply to the first file or the second or both?

And what in particular is a mess?

-Philip


^ permalink raw reply

* Re: Best (ath9k) miniPCI card for testing overall AP functionality
From: Luis R. Rodriguez @ 2009-08-10 23:25 UTC (permalink / raw)
  To: Adam Di Carlo; +Cc: linux-wireless
In-Reply-To: <87ws5fpic6.fsf@gw.int>

On Fri, Aug 7, 2009 at 11:52 AM, Adam Di Carlo<adam@onshored.com> wrote:
>
>
>
> "Luis R. Rodriguez" <mcgrof-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> writes:
>
>>>> According to:
>>>> http://linuxwireless.org/en/users/Drivers/ath9k
>>>> and:
>>>> http://linuxwireless.org/en/users/Drivers/ath9k/products/external
>>>> none of the above cards are supported...  but that assumes that the Wiki
>>>> is up to date.
>>>
>>> I don't thing the term "up to date" really could apply here.  It would
>>> apply it there was a definite list and it was easy to update the wiki
>>> from it.
>>
>> Hey its easy to update, its a wiki. What else can you ask for?
>
> I'd like to update the status of my (mostly working) ath5k miniPCI
> AR5414 card.
>
> Editing specific wiki pages like
> <http://wireless.kernel.org/en/users/Devices/PCI?action=edit&editor=gui>
> give me <<DeviceList(PCI)>>.
>
> Is there some magic URL to get to the data which composes that table?

Use http://wireless.kernel.org/en/users/Drivers/ath9k/products/

for now, I forget where the generic list is.

  Luis

^ permalink raw reply

* Re: [PATCH] b43: Fix a typo in the sync_stx routine
From: Larry Finger @ 2009-08-10 23:14 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: John Linville, Michael Buesch, Broadcom Wireless, linux-wireless
In-Reply-To: <4A80A522.2020200@gmail.com>

Gábor Stefanik wrote:
> I completely missed the "one's complement" instruction from the specs.
> 
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> drivers/net/wireless/b43/phy_lp.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_lp.c
> b/drivers/net/wireless/b43/phy_lp.c
> index 46fe476..34ad738 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -578,7 +578,7 @@ static void lpphy_sync_stx(struct b43_wldev *dev)
>         tmp >>= e->rf_shift;
>         tmp <<= e->phy_shift;
>         b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e->phy_offset),
> -                e->mask << e->phy_shift, tmp);
> +                ~(e->mask << e->phy_shift), tmp);
>     }
> }
> 

I should have caught that one.

When debugging gets started, it might be useful to add a statement

      WARN_ON(mask & set);

at the start of b43_radio_maskset() and b43_phy_maskset(). That way
these kind of mistakes will be caught early.

Larry



^ permalink raw reply

* [PATCH] b43: Fix a typo in the sync_stx routine
From: Gábor Stefanik @ 2009-08-10 22:54 UTC (permalink / raw)
  To: John Linville, Michael Buesch
  Cc: Larry Finger, Broadcom Wireless, linux-wireless

I completely missed the "one's complement" instruction from the specs.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
 drivers/net/wireless/b43/phy_lp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 46fe476..34ad738 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -578,7 +578,7 @@ static void lpphy_sync_stx(struct b43_wldev *dev)
 		tmp >>= e->rf_shift;
 		tmp <<= e->phy_shift;
 		b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e->phy_offset),
-				e->mask << e->phy_shift, tmp);
+				~(e->mask << e->phy_shift), tmp);
 	}
 }
 
-- 
1.6.2.4



^ permalink raw reply related

* Re: [PATCH 1/7] [compat-2.6] Rename the rest of CONFIG_MAC80211_MESH to CONFIG_COMPAT_MAC80211_MESH
From: Luis R. Rodriguez @ 2009-08-10 22:50 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1249735096-27071-1-git-send-email-hauke@hauke-m.de>

On Sat, Aug 8, 2009 at 5:38 AM, Hauke Mehrtens<hauke@hauke-m.de> wrote:
> Without this, some symbols can not be resolved because only parts of mesh were disabled.

Thanks a lot! I applied this and the rest of the patches, except for
the few I noted (tuple, usb compat removal).

  Luis

^ permalink raw reply

* Re: [PATCH 7/7] [compat-2.6] Remove unsed code.
From: Luis R. Rodriguez @ 2009-08-10 22:49 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1249735096-27071-7-git-send-email-hauke@hauke-m.de>

On Sat, Aug 8, 2009 at 5:38 AM, Hauke Mehrtens<hauke@hauke-m.de> wrote:
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

So actually I have this here for when we get around to backport the
usb stuff to older kernels, the usb poison stuff, if I remember
correctly. I just never finished that. I'd prefer to drop it if we're
sure we won't need it to make ar9170 compile against older kernels.

  Luis

> ---
>  compat/compat-2.6.28.c |   40 ----------------------------------------
>  compat/compat-2.6.28.h |    3 ---
>  2 files changed, 0 insertions(+), 43 deletions(-)
>
> diff --git a/compat/compat-2.6.28.c b/compat/compat-2.6.28.c
> index 33871a2..965be80 100644
> --- a/compat/compat-2.6.28.c
> +++ b/compat/compat-2.6.28.c
> @@ -167,46 +167,6 @@ struct urb *usb_get_from_anchor(struct usb_anchor *anchor)
>
>  EXPORT_SYMBOL_GPL(usb_get_from_anchor);
>
> -/**
> - * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
> - * @anchor: the anchor whose urbs you want to unanchor
> - *
> - * use this to get rid of all an anchor's urbs
> - */
> -void usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
> -{
> -       struct urb *victim;
> -       unsigned long flags;
> -
> -       spin_lock_irqsave(&anchor->lock, flags);
> -       while (!list_empty(&anchor->urb_list)) {
> -               victim = list_entry(anchor->urb_list.prev, struct urb,
> -                                   anchor_list);
> -               usb_get_urb(victim);
> -               spin_unlock_irqrestore(&anchor->lock, flags);
> -               /* this may free the URB */
> -               usb_unanchor_urb(victim);
> -               usb_put_urb(victim);
> -               spin_lock_irqsave(&anchor->lock, flags);
> -       }
> -       spin_unlock_irqrestore(&anchor->lock, flags);
> -}
> -
> -EXPORT_SYMBOL_GPL(usb_scuttle_anchored_urbs);
> -
> -/**
> - * usb_anchor_empty - is an anchor empty
> - * @anchor: the anchor you want to query
> - *
> - * returns 1 if the anchor has no urbs associated with it
> - */
> -int usb_anchor_empty(struct usb_anchor *anchor)
> -{
> -       return list_empty(&anchor->urb_list);
> -}
> -
> -EXPORT_SYMBOL_GPL(usb_anchor_empty);
> -
>
>  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
>  {
> diff --git a/compat/compat-2.6.28.h b/compat/compat-2.6.28.h
> index e25259f..0a305d2 100644
> --- a/compat/compat-2.6.28.h
> +++ b/compat/compat-2.6.28.h
> @@ -47,9 +47,6 @@ extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
>  #endif
>
>  extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
> -extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
> -extern int usb_anchor_empty(struct usb_anchor *anchor);
> -
>
>  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
>
> --
> 1.6.2.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* [PATCH RFC] b43: LP-PHY: Implement reading band SPROM
From: Gábor Stefanik @ 2009-08-10 22:37 UTC (permalink / raw)
  To: John Linville, Michael Buesch, Larry Finger
  Cc: Broadcom Wireless, linux-wireless

Some of the new variables in b43_phy_lp appear to be dead code in
the vendor driver; they will be removed if they remain unused when
LP-PHY implementation is finished.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
---
I've added a few FIXME comments, please review them.
Also please check that I used the correct types (e.g. u16) for the new variables.

Variable name mappings vs. the specification:
cckpo = tmp3
ofdmpo = tmp2
maxpwr = tmp1

The array txpwr_srom_max[3] has been broken up into 3 variables,
each called max_tx_pwr_{low|med|hi}_band. A struct holding 3 named u16s
may also be a good choice, but I am not fond of using an array for this.
 
 drivers/net/wireless/b43/phy_lp.c |   83 ++++++++++++++++++++++++++++++++++++-
 drivers/net/wireless/b43/phy_lp.h |   16 +++++++
 2 files changed, 98 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 43272a8..46fe476 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -59,6 +59,87 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
 	dev->phy.lp = NULL;
 }
 
+static void lpphy_read_band_sprom(struct b43_wldev *dev)
+{
+	struct b43_phy_lp *lpphy = dev->phy.lp;
+	struct ssb_bus *bus = dev->dev->bus;
+	u16 cckpo, maxpwr;
+	u32 ofdmpo;
+	int i;
+
+	if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+		lpphy->tx_isolation_med_band = bus->sprom.tri2g;
+		lpphy->bx_arch = bus->sprom.bxa2g;
+		lpphy->rssi_vf = bus->sprom.rssismf2g;
+		lpphy->rssi_vc = bus->sprom.rssismc2g;
+		lpphy->rssi_gs = bus->sprom.rssisav2g;
+		lpphy->txpa[0] = bus->sprom.pa0b0;
+		lpphy->txpa[1] = bus->sprom.pa0b1;
+		lpphy->txpa[2] = bus->sprom.pa0b2;
+		maxpwr = bus->sprom.maxpwr_bg;
+		lpphy->max_tx_pwr_med_band = maxpwr;
+		cckpo = bus->sprom.cck2gpo;
+		ofdmpo = bus->sprom.ofdm2gpo;
+		if (cckpo) {
+			for (i = 0; i < 4; i++) {
+				lpphy->tx_max_rate[i] =
+					maxpwr - (ofdmpo & 0xF) * 2;
+				ofdmpo << 4;
+			}
+			ofdmpo = bus->sprom.ofdm2gpo;
+			for (i = 4; i < 15; i++) {
+				lpphy->tx_max_rate[i] =
+					maxpwr - (ofdmpo & 0xF) * 2;
+				ofdmpo << 4;
+			}
+		} else {
+			ofdmpo &= 0xFF;
+			for (i = 0; i < 4; i++)
+				lpphy->tx_max_rate[i] = maxpwr;
+			for (i = 4; i < 15; i++)
+				lpphy->tx_max_rate[i] = maxpwr - ofdmpo;
+		}
+	} else { /* 5GHz */
+		lpphy->tx_isolation_low_band = bus->sprom.tri5gl;
+		lpphy->tx_isolation_med_band = bus->sprom.tri5g;
+		lpphy->tx_isolation_hi_band = bus->sprom.tri5gh;
+		lpphy->bx_arch = bus->sprom.bxa5g;
+		lpphy->rssi_vf = bus->sprom.rssismf5g;
+		lpphy->rssi_vc = bus->sprom.rssismc5g;
+		lpphy->rssi_gs = bus->sprom.rssisav5g;
+		lpphy->txpa[0] = bus->sprom.pa1b0;
+		lpphy->txpa[1] = bus->sprom.pa1b1;
+		lpphy->txpa[2] = bus->sprom.pa1b2;
+		lpphy->txpal[0] = bus->sprom.pa1lob0;
+		lpphy->txpal[1] = bus->sprom.pa1lob1;
+		lpphy->txpal[2] = bus->sprom.pa1lob2;
+		lpphy->txpah[0] = bus->sprom.pa1hib0;
+		lpphy->txpah[1] = bus->sprom.pa1hib1;
+		lpphy->txpah[2] = bus->sprom.pa1hib2;
+		maxpwr = bus->sprom.maxpwr_al;
+		ofdmpo = bus->sprom.ofdm5glpo;
+		lpphy->max_tx_pwr_low_band = maxpwr;
+		for (i = 4; i < 12; i++) {
+			lpphy->tx_max_ratel[i] = maxpwr - (ofdmpo & 0xF) * 2;
+			ofdmpo << 4;
+		}
+		maxpwr = bus->sprom.maxpwr_a;
+		ofdmpo = bus->sprom.ofdm5gpo;
+		lpphy->max_tx_pwr_med_band = maxpwr;
+		for (i = 4; i < 12; i++) {
+			lpphy->tx_max_rate[i] = maxpwr - (ofdmpo & 0xF) * 2;
+			ofdmpo << 4;
+		}
+		maxpwr = bus->sprom.maxpwr_ah;
+		ofdmpo = bus->sprom.ofdm5ghpo;
+		lpphy->max_tx_pwr_hi_band = maxpwr;
+		for (i = 4; i < 12; i++) {
+			lpphy->tx_max_rateh[i] = maxpwr - (ofdmpo & 0xF) * 2;
+			ofdmpo << 4;
+		}
+	}
+}
+
 static void lpphy_adjust_gain_table(struct b43_wldev *dev)
 {
 	struct b43_phy_lp *lpphy = dev->phy.lp;
@@ -694,7 +775,7 @@ static void lpphy_tx_pctl_init(struct b43_wldev *dev)
 
 static int b43_lpphy_op_init(struct b43_wldev *dev)
 {
-	/* TODO: band SPROM */
+	lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs?
 	lpphy_baseband_init(dev);
 	lpphy_radio_init(dev);
 	//TODO calibrate RC
diff --git a/drivers/net/wireless/b43/phy_lp.h b/drivers/net/wireless/b43/phy_lp.h
index 13d89ea..9d0443c 100644
--- a/drivers/net/wireless/b43/phy_lp.h
+++ b/drivers/net/wireless/b43/phy_lp.h
@@ -831,6 +831,22 @@ struct b43_phy_lp {
 	/* Transmit isolation high band */
 	u8 tx_isolation_hi_band; /* FIXME initial value? */
 
+	/* Max transmit power medium band */
+	u16 max_tx_pwr_med_band;
+	/* Max transmit power low band */
+	u16 max_tx_pwr_low_band;
+	/* Max transmit power high band */
+	u16 max_tx_pwr_hi_band;
+
+	/* FIXME What are these used for? */
+	/* FIXME Is 15 the correct array size? */
+	u16 tx_sprom_max_rate[15];
+	u16 tx_sprom_max_ratel[15];
+	u16 tx_sprom_max_rateh[15];
+
+	/* Transmit power arrays */
+	s16 txpa[3], txpal[3], txpah[3];
+
 	/* Receive power offset */
 	u8 rx_pwr_offset; /* FIXME initial value? */
 
-- 
1.6.2.4



^ permalink raw reply related

* Re: [PATCH] CRDA and cross-compilation
From: Luis R. Rodriguez @ 2009-08-10 22:30 UTC (permalink / raw)
  To: Philip A. Prindeville; +Cc: Pavel Roskin, Jon Loeliger, wireless
In-Reply-To: <4A809B8D.5000309@redfish-solutions.com>

On Mon, Aug 10, 2009 at 3:13 PM, Philip A.
Prindeville<philipp_subx@redfish-solutions.com> wrote:
> Pavel Roskin wrote:
>> On Fri, 2009-08-07 at 17:09 -0700, Philip A. Prindeville wrote:
>>> Luis R. Rodriguez wrote:
>>>> Please send white space changes first in one patch, ie, that do not
>>>> change anything other than that. Then send the other stuff.
>>>>
>>>>   Luis
>>> Here it is.
>> ...
>>> -else
>>> + else
>> ...
>>> +install-rb: wireless-regdb/regulatory.bin
>>
>> If you don't understand what you were asked to do, I'll appreciate if
>> you stop wasting everybody's time.
>>
>> Nobody is going to extract useful bits from the patches you send,
>> especially if you don't provide an adequate description of the changes.
>>
>> I was able to cross-compile CDRA for MIPS without any changes other than
>> those that have already been applied.
>
> Since we compile a variety of images that are both Linux and i586 based as are the target and host, detecting instances amongst the 180+ packages contained in our distribution where the build used host parameters instead of target parameters can be painful and tedious.
>
> Sometimes it's just best to isolate such code paths with a safe, obvious gating variable.  That's what I've tried to do here.
>
> We don't just build images, we also make the entire SVN tree available to others to build in their environments as well (Fedora, Centos, Gentoo, Debian, x86, PPC, x86_64, etc).  We can't possibly test for every scenario our users will encounter, so we make things as safe as we know how.
>
> Yes, I'm sure Pavel *was* able to build for his MIPS target in his environment.  That's a bet I can't make for all of our users, however, without these changes.
>
> I've split our changes into two functional groups:
>
> * allowing a cross-compilation without contamination by the host's own state via pkg-config bleeding into it.
>
> * allowing regulatory.bin to be installed via an external Makefile without having to extract internal values from crda/Makefile (i.e. REG_BIN and REG_GIT).
>
> These patches assume that Pavel's own "noverify" patch has already been applied.
>
> Changes:
>
> 1. Remove trailing slashes from directory variables: they're redundant and cause duplicates if they are appended to a path that's already absolute.
>
> 2. Move invariant definitions to before any cross-compilation conditional sections for clarity (and to avoid having to duplicate them).
>
> 3. Bracket any host (native) compilation sections with conditional based on $(CROSS_COMPILE) being empty.
>
> 4. Add 'else' section for cross-compilation using openssl and libnl-1 (or libnl-2 if explicitly selected).
>
>
> --- crda-1.1.0/Makefile 2009-08-10 13:37:36.000000000 -0700
> +++ crda-1.1.0/Makefile.new     2009-08-10 13:37:11.000000000 -0700
> @@ -3,10 +3,10 @@
>  REG_BIN?=/usr/lib/crda/regulatory.bin
>  REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
>
> -PREFIX ?= /usr/
> -MANDIR ?= $(PREFIX)/share/man/
> +PREFIX ?= /usr
> +MANDIR ?= $(PREFIX)/share/man
>
> -SBINDIR ?= /sbin/
> +SBINDIR ?= /sbin
>
>  # Use a custom CRDA_UDEV_LEVEL when callling make install to
>  # change your desired level for the udev regulatory.rules
> @@ -14,7 +14,7 @@
>  UDEV_LEVEL=$(CRDA_UDEV_LEVEL)-
>  # You can customize this if your distributions uses
>  # a different location.
> -UDEV_RULE_DIR?=/lib/udev/rules.d/
> +UDEV_RULE_DIR?=/lib/udev/rules.d
>
>  # If your distribution requires a custom pubkeys dir
>  # you must update this variable to reflect where the
> @@ -22,48 +22,76 @@
>  # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
>  PUBKEY_DIR?=pubkeys
>
> +MKDIR ?= mkdir -p
> +INSTALL ?= install
> +
>  CFLAGS += -Wall -g
>
>  all: all_noverify verify
>
>  all_noverify: crda intersect regdbdump
>
> -ifeq ($(USE_OPENSSL),1)
> +ifeq ($(CROSS_COMPILE),)
> +
> + ifeq ($(USE_OPENSSL),1)
>  CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
>  LDLIBS += `pkg-config --libs openssl`
>
>  reglib.o: keys-ssl.c
>
> -else
> + else
>  CFLAGS += -DUSE_GCRYPT
>  LDLIBS += -lgcrypt
>
>  reglib.o: keys-gcrypt.c
>
> -endif
> -MKDIR ?= mkdir -p
> -INSTALL ?= install
> + endif
>
>  NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
>  NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
>
> -ifeq ($(NL1FOUND),Y)
> + ifeq ($(NL1FOUND),Y)
>  NLLIBNAME = libnl-1
> -endif
> + endif
>
> -ifeq ($(NL2FOUND),Y)
> + ifeq ($(NL2FOUND),Y)
>  CFLAGS += -DCONFIG_LIBNL20
>  NLLIBS += -lnl-genl
>  NLLIBNAME = libnl-2.0
> -endif
> + endif
>
> -ifeq ($(NLLIBNAME),)
> + ifeq ($(NLLIBNAME),)
>  $(error Cannot find development files for any supported version of libnl)
> -endif
> + endif
>
>  NLLIBS += `pkg-config --libs $(NLLIBNAME)`
>  CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
>
> +else
> +
> + ifeq ($(USE_OPENSSL),1)
> +CFLAGS += -DUSE_OPENSSL
> +LDLIBS += -lssl
> +
> +reglib.o: keys-ssl.c
> +
> + else
> +CFLAGS += -DUSE_GCRYPT
> +LDLIBS += -lgcrypt
> +
> +reglib.o: keys-gcrypt.c
> +
> + endif
> +
> + ifeq ($(USE_LIBNL20),1)
> +CFLAGS += -DCONFIG_LIBNL20
> +NLLIBS = -lnl-genl -lnl-2.0
> + else
> +NLLIBS = -lnl
> + endif
> +
> +endif
> +
>  ifeq ($(V),1)
>  Q=
>  NQ=@true
>
>
> Add a couple of rules to (1) download (via GIT) John's working copy of regulatory.bin and (2) install it in the appropriate target destination.  This avoids us having to parse the Makefile for REG_BIN and REG_GIT from an enclosing (nesting) makefile, as is common in distros and buildroot environments in particular.
>
> --- crda-1.1.0/Makefile 2009-08-10 13:37:36.000000000 -0700
> +++ crda-1.1.0/Makefile.new     2009-08-10 13:37:11.000000000 -0700
> @@ -136,6 +164,14 @@
>        $(NQ) '  INSTALL  regdbdump.8.gz'
>        $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
>
> +install-rb: wireless-regdb/regulatory.bin
> +       $(NQ) '  INSTALL  regulatory.bin'
> +       $(Q)$(INSTALL) -m 444 -D wireless-regdb/regulatory.bin $(DESTDIR)/$(REG_BIN)
> +
> +wireless-regdb/regulatory.bin:
> +       @rm -rf wireless-regdb
> +       git clone -q $(REG_GIT) wireless-regdb
> +
>  clean:
>        $(Q)rm -f crda regdbdump intersect *.o *~ *.pyc keys-*.c *.gz \
>        udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed

This is a glory mess, please stop trying.

  Luis

^ permalink raw reply

* Re: [PATCH 3/7] [compat-2.6] pcmcia_parse_tuple was redefined in pcmcia/cistpl.h
From: Luis R. Rodriguez @ 2009-08-10 22:20 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless
In-Reply-To: <1249735096-27071-3-git-send-email-hauke@hauke-m.de>

On Sat, Aug 8, 2009 at 5:38 AM, Hauke Mehrtens<hauke@hauke-m.de> wrote:
> fix build:
> undef pcmcia_parse_tuple before redefine it again.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  compat/compat-2.6.28.h |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/compat/compat-2.6.28.h b/compat/compat-2.6.28.h
> index fdc021a..e25259f 100644
> --- a/compat/compat-2.6.28.h
> +++ b/compat/compat-2.6.28.h
> @@ -29,7 +29,13 @@
>  })
>  #endif /* From include/asm-generic/bug.h */
>
> -#define pcmcia_parse_tuple(tuple, parse) pcmcia_parse_tuple(NULL, tuple, parse)
> +#include <pcmcia/cs_types.h>
> +#include <pcmcia/cs.h>
> +#include <pcmcia/cistpl.h>
> +#ifdef pcmcia_parse_tuple
> +#undef pcmcia_parse_tuple
> +#define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
> +#endif

Where did pccard_parse_tuple() come from?

Did you see the commit 0df8084caf53774113c8f118e9dd43e660cf9e15 by any
chance? That fixed compilation for me against older kernels.

  Luis

^ permalink raw reply

* [PATCH] CRDA and cross-compilation
From: Philip A. Prindeville @ 2009-08-10 22:13 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Luis R. Rodriguez, Jon Loeliger, wireless
In-Reply-To: <1249698462.25983.7.camel@mj>

[-- Attachment #1: Type: text/plain, Size: 1983 bytes --]

Pavel Roskin wrote:
> On Fri, 2009-08-07 at 17:09 -0700, Philip A. Prindeville wrote:
>> Luis R. Rodriguez wrote:
>>> Please send white space changes first in one patch, ie, that do not
>>> change anything other than that. Then send the other stuff.
>>>
>>>   Luis
>> Here it is.
> ...
>> -else
>> + else
> ...
>> +install-rb: wireless-regdb/regulatory.bin
> 
> If you don't understand what you were asked to do, I'll appreciate if
> you stop wasting everybody's time.
> 
> Nobody is going to extract useful bits from the patches you send,
> especially if you don't provide an adequate description of the changes.
> 
> I was able to cross-compile CDRA for MIPS without any changes other than
> those that have already been applied.

Since we compile a variety of images that are both Linux and i586 based as are the target and host, detecting instances amongst the 180+ packages contained in our distribution where the build used host parameters instead of target parameters can be painful and tedious.

Sometimes it's just best to isolate such code paths with a safe, obvious gating variable.  That's what I've tried to do here.

We don't just build images, we also make the entire SVN tree available to others to build in their environments as well (Fedora, Centos, Gentoo, Debian, x86, PPC, x86_64, etc).  We can't possibly test for every scenario our users will encounter, so we make things as safe as we know how.

Yes, I'm sure Pavel *was* able to build for his MIPS target in his environment.  That's a bet I can't make for all of our users, however, without these changes.

I've split our changes into two functional groups:

* allowing a cross-compilation without contamination by the host's own state via pkg-config bleeding into it.

* allowing regulatory.bin to be installed via an external Makefile without having to extract internal values from crda/Makefile (i.e. REG_BIN and REG_GIT).

These patches assume that Pavel's own "noverify" patch has already been applied.

[-- Attachment #2: crda-cross-compile.patch --]
[-- Type: text/plain, Size: 2845 bytes --]

Changes:

1. Remove trailing slashes from directory variables: they're redundant and cause duplicates if they are appended to a path that's already absolute.

2. Move invariant definitions to before any cross-compilation conditional sections for clarity (and to avoid having to duplicate them).

3. Bracket any host (native) compilation sections with conditional based on $(CROSS_COMPILE) being empty.

4. Add 'else' section for cross-compilation using openssl and libnl-1 (or libnl-2 if explicitly selected).


--- crda-1.1.0/Makefile	2009-08-10 13:37:36.000000000 -0700
+++ crda-1.1.0/Makefile.new	2009-08-10 13:37:11.000000000 -0700
@@ -3,10 +3,10 @@
 REG_BIN?=/usr/lib/crda/regulatory.bin
 REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
 
-PREFIX ?= /usr/
-MANDIR ?= $(PREFIX)/share/man/
+PREFIX ?= /usr
+MANDIR ?= $(PREFIX)/share/man
 
-SBINDIR ?= /sbin/
+SBINDIR ?= /sbin
 
 # Use a custom CRDA_UDEV_LEVEL when callling make install to
 # change your desired level for the udev regulatory.rules
@@ -14,7 +14,7 @@
 UDEV_LEVEL=$(CRDA_UDEV_LEVEL)-
 # You can customize this if your distributions uses
 # a different location.
-UDEV_RULE_DIR?=/lib/udev/rules.d/
+UDEV_RULE_DIR?=/lib/udev/rules.d
 
 # If your distribution requires a custom pubkeys dir
 # you must update this variable to reflect where the
@@ -22,48 +22,76 @@
 # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
 PUBKEY_DIR?=pubkeys
 
+MKDIR ?= mkdir -p
+INSTALL ?= install
+
 CFLAGS += -Wall -g
 
 all: all_noverify verify
 
 all_noverify: crda intersect regdbdump
 
-ifeq ($(USE_OPENSSL),1)
+ifeq ($(CROSS_COMPILE),)
+
+ ifeq ($(USE_OPENSSL),1)
 CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
 LDLIBS += `pkg-config --libs openssl`
 
 reglib.o: keys-ssl.c
 
-else
+ else
 CFLAGS += -DUSE_GCRYPT
 LDLIBS += -lgcrypt
 
 reglib.o: keys-gcrypt.c
 
-endif
-MKDIR ?= mkdir -p
-INSTALL ?= install
+ endif
 
 NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
 NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
 
-ifeq ($(NL1FOUND),Y)
+ ifeq ($(NL1FOUND),Y)
 NLLIBNAME = libnl-1
-endif
+ endif
 
-ifeq ($(NL2FOUND),Y)
+ ifeq ($(NL2FOUND),Y)
 CFLAGS += -DCONFIG_LIBNL20
 NLLIBS += -lnl-genl
 NLLIBNAME = libnl-2.0
-endif
+ endif
 
-ifeq ($(NLLIBNAME),)
+ ifeq ($(NLLIBNAME),)
 $(error Cannot find development files for any supported version of libnl)
-endif
+ endif
 
 NLLIBS += `pkg-config --libs $(NLLIBNAME)`
 CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
 
+else
+
+ ifeq ($(USE_OPENSSL),1)
+CFLAGS += -DUSE_OPENSSL
+LDLIBS += -lssl
+
+reglib.o: keys-ssl.c
+
+ else
+CFLAGS += -DUSE_GCRYPT
+LDLIBS += -lgcrypt
+
+reglib.o: keys-gcrypt.c
+
+ endif
+
+ ifeq ($(USE_LIBNL20),1)
+CFLAGS += -DCONFIG_LIBNL20
+NLLIBS = -lnl-genl -lnl-2.0
+ else
+NLLIBS = -lnl
+ endif
+
+endif
+
 ifeq ($(V),1)
 Q=
 NQ=@true


[-- Attachment #3: crda-regbin-install.patch --]
[-- Type: text/plain, Size: 971 bytes --]

Add a couple of rules to (1) download (via GIT) John's working copy of regulatory.bin and (2) install it in the appropriate target destination.  This avoids us having to parse the Makefile for REG_BIN and REG_GIT from an enclosing (nesting) makefile, as is common in distros and buildroot environments in particular.

--- crda-1.1.0/Makefile	2009-08-10 13:37:36.000000000 -0700
+++ crda-1.1.0/Makefile.new	2009-08-10 13:37:11.000000000 -0700
@@ -136,6 +164,14 @@
 	$(NQ) '  INSTALL  regdbdump.8.gz'
 	$(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
 
+install-rb: wireless-regdb/regulatory.bin
+	$(NQ) '  INSTALL  regulatory.bin'
+	$(Q)$(INSTALL) -m 444 -D wireless-regdb/regulatory.bin $(DESTDIR)/$(REG_BIN)
+
+wireless-regdb/regulatory.bin:
+	@rm -rf wireless-regdb
+	git clone -q $(REG_GIT) wireless-regdb
+
 clean:
 	$(Q)rm -f crda regdbdump intersect *.o *~ *.pyc keys-*.c *.gz \
 	udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed


^ permalink raw reply

* Re: [PATCH] ath9k: Fix read buffer overflow
From: John W. Linville @ 2009-08-10 20:26 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Jouni Malinen, linux-wireless, ath9k-devel, Andrew Morton
In-Reply-To: <4A7CA188.1070706@gmail.com>

On Fri, Aug 07, 2009 at 11:50:00PM +0200, Roel Kluin wrote:
> Prevent a read of powInfo[-1] in the first iteration.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> The last hunk I already sent in a previous patch.

The last two hunks, apparently -- neither of them apply.

Why on earth would you randomly include those hunks here?  Especially
if you already sent them?

Listen, I'm glad you are there to do these various clean-ups.
But honestly your patches seem to always have some problem that
requires manual intervention to apply them.  You make my life hard,
and you slow me down.  That makes John a grumpy boy.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [PATCH] b43: Implement LP-PHY baseband table initialization
From: Gábor Stefanik @ 2009-08-10 20:16 UTC (permalink / raw)
  To: John W. Linville
  Cc: Larry Finger, Michael Buesch, Johannes Berg, Broadcom Wireless,
	linux-wireless
In-Reply-To: <20090810201431.GA6060@tuxdriver.com>

2009/8/10 John W. Linville <linville@tuxdriver.com>:
> On Mon, Aug 10, 2009 at 08:58:44PM +0200, Gábor Stefanik wrote:
>> 2009/8/10 Larry Finger <Larry.Finger@lwfinger.net>:
>> > Gábor Stefanik wrote:
>> >> Implement LP-PHY baseband table init for all revisions.
>> >>
>> >> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
>> >> ---
>> >> Changes from RFC:
>> >> -Improved table formatting in the code.
>> >> -The 2GHz check in adjust_gain_table now uses b43_current_band.
>> >> -Added a comment to rev2plus_table_init about a possible future
>> >> improvement.
>> >
>> > I like the new table formatting.
>> >
>> > The comment in rev2plus_table_init has a typo - "ben" should be
>> > "been". Otherwise it looks good. Thanks for all your work.
>> >
>> > Larry
>> >
>>
>> John, can you fix that when checking in, or should I resubmit with the
>> typo fixed?
>
> Sure, fine...
>
> --
> John W. Linville                Someday the world will need a hero, and you
> linville@tuxdriver.com                  might be all we have.  Be ready.
>
Thanks!


-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

^ permalink raw reply

* Re: [PATCH] b43: Implement LP-PHY baseband table initialization
From: John W. Linville @ 2009-08-10 20:14 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: Larry Finger, Michael Buesch, Johannes Berg, Broadcom Wireless,
	linux-wireless
In-Reply-To: <69e28c910908101158nbc9477re66a203657b702f6@mail.gmail.com>

On Mon, Aug 10, 2009 at 08:58:44PM +0200, Gábor Stefanik wrote:
> 2009/8/10 Larry Finger <Larry.Finger@lwfinger.net>:
> > Gábor Stefanik wrote:
> >> Implement LP-PHY baseband table init for all revisions.
> >>
> >> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> >> ---
> >> Changes from RFC:
> >> -Improved table formatting in the code.
> >> -The 2GHz check in adjust_gain_table now uses b43_current_band.
> >> -Added a comment to rev2plus_table_init about a possible future
> >> improvement.
> >
> > I like the new table formatting.
> >
> > The comment in rev2plus_table_init has a typo - "ben" should be
> > "been". Otherwise it looks good. Thanks for all your work.
> >
> > Larry
> >
> 
> John, can you fix that when checking in, or should I resubmit with the
> typo fixed?

Sure, fine...

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* [PATCH 7/7] mac80211: Move mpath and mpp growth to mesh workqueue.
From: Javier Cardona @ 2009-08-10 19:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel
In-Reply-To: <1249931752-18127-7-git-send-email-javier@cozybit.com>

This prevents calling rcu_synchronize from within the tx path by moving the
table growth code to the mesh workqueue.

Move mesh_table_free and mesh_table_grow from mesh.c to mesh_pathtbl.c and
declare them static.

Also, re-enable mesh in Kconfig and update the configuration description.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Tested-by: Andrey Yurovsky <andrey@cozybit.com>
---
 net/mac80211/Kconfig        |    8 +-
 net/mac80211/ieee80211_i.h  |    2 +-
 net/mac80211/mesh.c         |   77 +++--------------------
 net/mac80211/mesh.h         |   20 ++++++-
 net/mac80211/mesh_pathtbl.c |  146 ++++++++++++++++++++++++++++++++-----------
 5 files changed, 144 insertions(+), 109 deletions(-)

diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 7dd77b6..9db4ff8 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -66,12 +66,12 @@ endmenu
 config MAC80211_MESH
 	bool "Enable mac80211 mesh networking (pre-802.11s) support"
 	depends on MAC80211 && EXPERIMENTAL
-	depends on BROKEN
 	---help---
 	 This options enables support of Draft 802.11s mesh networking.
-	 The implementation is based on Draft 1.08 of the Mesh Networking
-	 amendment. For more information visit http://o11s.org/.
-
+	 The implementation is based on Draft 2.08 of the Mesh Networking
+	 amendment.  However, no compliance with that draft is claimed or even
+	 possible, as drafts leave a number of identifiers to be defined after
+	 ratification.  For more information visit http://o11s.org/.
 
 config MAC80211_LEDS
 	bool "Enable LED triggers"
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d6bd7dd..a6abc7d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -355,7 +355,7 @@ struct ieee80211_if_mesh {
 
 	unsigned long timers_running;
 
-	bool housekeeping;
+	unsigned long wrkq_flags;
 
 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
 	size_t mesh_id_len;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 25d0065..3185e18 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -47,7 +47,7 @@ static void ieee80211_mesh_housekeeping_timer(unsigned long data)
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
 
-	ifmsh->housekeeping = true;
+	ifmsh->wrkq_flags |= MESH_WORK_HOUSEKEEPING;
 
 	if (local->quiescing) {
 		set_bit(TMR_RUNNING_HK, &ifmsh->timers_running);
@@ -320,30 +320,6 @@ struct mesh_table *mesh_table_alloc(int size_order)
 	return newtbl;
 }
 
-static void __mesh_table_free(struct mesh_table *tbl)
-{
-	kfree(tbl->hash_buckets);
-	kfree(tbl->hashwlock);
-	kfree(tbl);
-}
-
-void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
-{
-	struct hlist_head *mesh_hash;
-	struct hlist_node *p, *q;
-	int i;
-
-	mesh_hash = tbl->hash_buckets;
-	for (i = 0; i <= tbl->hash_mask; i++) {
-		spin_lock(&tbl->hashwlock[i]);
-		hlist_for_each_safe(p, q, &mesh_hash[i]) {
-			tbl->free_node(p, free_leafs);
-			atomic_dec(&tbl->entries);
-		}
-		spin_unlock(&tbl->hashwlock[i]);
-	}
-	__mesh_table_free(tbl);
-}
 
 static void ieee80211_mesh_path_timer(unsigned long data)
 {
@@ -360,44 +336,6 @@ static void ieee80211_mesh_path_timer(unsigned long data)
 	ieee80211_queue_work(&local->hw, &ifmsh->work);
 }
 
-struct mesh_table *mesh_table_grow(struct mesh_table *tbl)
-{
-	struct mesh_table *newtbl;
-	struct hlist_head *oldhash;
-	struct hlist_node *p, *q;
-	int i;
-
-	if (atomic_read(&tbl->entries)
-			< tbl->mean_chain_len * (tbl->hash_mask + 1))
-		goto endgrow;
-
-	newtbl = mesh_table_alloc(tbl->size_order + 1);
-	if (!newtbl)
-		goto endgrow;
-
-	newtbl->free_node = tbl->free_node;
-	newtbl->mean_chain_len = tbl->mean_chain_len;
-	newtbl->copy_node = tbl->copy_node;
-	atomic_set(&newtbl->entries, atomic_read(&tbl->entries));
-
-	oldhash = tbl->hash_buckets;
-	for (i = 0; i <= tbl->hash_mask; i++)
-		hlist_for_each(p, &oldhash[i])
-			if (tbl->copy_node(p, newtbl) < 0)
-				goto errcopy;
-
-	return newtbl;
-
-errcopy:
-	for (i = 0; i <= newtbl->hash_mask; i++) {
-		hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
-			tbl->free_node(p, 0);
-	}
-	__mesh_table_free(newtbl);
-endgrow:
-	return NULL;
-}
-
 /**
  * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
  * @hdr:    	802.11 frame header
@@ -487,7 +425,6 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
 	if (free_plinks != sdata->u.mesh.accepting_plinks)
 		ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
 
-	ifmsh->housekeeping = false;
 	mod_timer(&ifmsh->housekeeping_timer,
 		  round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL));
 }
@@ -524,8 +461,8 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
 	struct ieee80211_local *local = sdata->local;
 
-	ifmsh->housekeeping = true;
-	queue_work(local->hw, &ifmsh->work);
+	ifmsh->wrkq_flags |= MESH_WORK_HOUSEKEEPING;
+	ieee80211_queue_work(&local->hw, &ifmsh->work);
 	sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
 	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
 						BSS_CHANGED_BEACON_ENABLED |
@@ -664,7 +601,13 @@ static void ieee80211_mesh_work(struct work_struct *work)
 		       ifmsh->last_preq + msecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval)))
 		mesh_path_start_discovery(sdata);
 
-	if (ifmsh->housekeeping)
+	if (test_and_clear_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags))
+		mesh_mpath_table_grow();
+
+	if (test_and_clear_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags))
+		mesh_mpp_table_grow();
+
+	if (test_and_clear_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags))
 		ieee80211_mesh_housekeeping(sdata, ifmsh);
 }
 
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 4241925..eb23fc6 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -44,6 +44,23 @@ enum mesh_path_flags {
 };
 
 /**
+ * enum mesh_deferred_task_flags - mac80211 mesh deferred tasks
+ *
+ *
+ *
+ * @MESH_WORK_HOUSEKEEPING: run the periodic mesh housekeeping tasks
+ * @MESH_WORK_GROW_MPATH_TABLE: the mesh path table is full and needs
+ * to grow.
+ * @MESH_WORK_GROW_MPP_TABLE: the mesh portals table is full and needs to
+ * grow
+ */
+enum mesh_deferred_task_flags {
+	MESH_WORK_HOUSEKEEPING,
+	MESH_WORK_GROW_MPATH_TABLE,
+	MESH_WORK_GROW_MPP_TABLE,
+};
+
+/**
  * struct mesh_path - mac80211 mesh path structure
  *
  * @dst: mesh path destination mac address
@@ -250,7 +267,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
 /* Mesh tables */
 struct mesh_table *mesh_table_alloc(int size_order);
 void mesh_table_free(struct mesh_table *tbl, bool free_leafs);
-struct mesh_table *mesh_table_grow(struct mesh_table *tbl);
+void mesh_mpath_table_grow(void);
+void mesh_mpp_table_grow(void);
 u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata,
 		struct mesh_table *tbl);
 /* Mesh paths */
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 431865a..751c4d0 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -39,6 +39,69 @@ static struct mesh_table *mesh_paths;
 static struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */
 
 int mesh_paths_generation;
+static void __mesh_table_free(struct mesh_table *tbl)
+{
+	kfree(tbl->hash_buckets);
+	kfree(tbl->hashwlock);
+	kfree(tbl);
+}
+
+void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
+{
+	struct hlist_head *mesh_hash;
+	struct hlist_node *p, *q;
+	int i;
+
+	mesh_hash = tbl->hash_buckets;
+	for (i = 0; i <= tbl->hash_mask; i++) {
+		spin_lock(&tbl->hashwlock[i]);
+		hlist_for_each_safe(p, q, &mesh_hash[i]) {
+			tbl->free_node(p, free_leafs);
+			atomic_dec(&tbl->entries);
+		}
+		spin_unlock(&tbl->hashwlock[i]);
+	}
+	__mesh_table_free(tbl);
+}
+
+static struct mesh_table *mesh_table_grow(struct mesh_table *tbl)
+{
+	struct mesh_table *newtbl;
+	struct hlist_head *oldhash;
+	struct hlist_node *p, *q;
+	int i;
+
+	if (atomic_read(&tbl->entries)
+			< tbl->mean_chain_len * (tbl->hash_mask + 1))
+		goto endgrow;
+
+	newtbl = mesh_table_alloc(tbl->size_order + 1);
+	if (!newtbl)
+		goto endgrow;
+
+	newtbl->free_node = tbl->free_node;
+	newtbl->mean_chain_len = tbl->mean_chain_len;
+	newtbl->copy_node = tbl->copy_node;
+	atomic_set(&newtbl->entries, atomic_read(&tbl->entries));
+
+	oldhash = tbl->hash_buckets;
+	for (i = 0; i <= tbl->hash_mask; i++)
+		hlist_for_each(p, &oldhash[i])
+			if (tbl->copy_node(p, newtbl) < 0)
+				goto errcopy;
+
+	return newtbl;
+
+errcopy:
+	for (i = 0; i <= newtbl->hash_mask; i++) {
+		hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
+			tbl->free_node(p, 0);
+	}
+	__mesh_table_free(newtbl);
+endgrow:
+	return NULL;
+}
+
 
 /* This lock will have the grow table function as writer and add / delete nodes
  * as readers. When reading the table (i.e. doing lookups) we are well protected
@@ -187,6 +250,8 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data
  */
 int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
 {
+	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
+	struct ieee80211_local *local = sdata->local;
 	struct mesh_path *mpath, *new_mpath;
 	struct mpath_node *node, *new_node;
 	struct hlist_head *bucket;
@@ -195,8 +260,6 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
 	int err = 0;
 	u32 hash_idx;
 
-	might_sleep();
-
 	if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0)
 		/* never add ourselves as neighbours */
 		return -ENOTSUPP;
@@ -208,11 +271,11 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
 		return -ENOSPC;
 
 	err = -ENOMEM;
-	new_mpath = kzalloc(sizeof(struct mesh_path), GFP_KERNEL);
+	new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC);
 	if (!new_mpath)
 		goto err_path_alloc;
 
-	new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
+	new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
 	if (!new_node)
 		goto err_node_alloc;
 
@@ -250,20 +313,8 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
 	spin_unlock(&mesh_paths->hashwlock[hash_idx]);
 	read_unlock(&pathtbl_resize_lock);
 	if (grow) {
-		struct mesh_table *oldtbl, *newtbl;
-
-		write_lock(&pathtbl_resize_lock);
-		oldtbl = mesh_paths;
-		newtbl = mesh_table_grow(mesh_paths);
-		if (!newtbl) {
-			write_unlock(&pathtbl_resize_lock);
-			return 0;
-		}
-		rcu_assign_pointer(mesh_paths, newtbl);
-		write_unlock(&pathtbl_resize_lock);
-
-		synchronize_rcu();
-		mesh_table_free(oldtbl, false);
+		set_bit(MESH_WORK_GROW_MPATH_TABLE,  &ifmsh->wrkq_flags);
+		ieee80211_queue_work(&local->hw, &ifmsh->work);
 	}
 	return 0;
 
@@ -278,9 +329,46 @@ err_path_alloc:
 	return err;
 }
 
+void mesh_mpath_table_grow(void)
+{
+	struct mesh_table *oldtbl, *newtbl;
+
+	write_lock(&pathtbl_resize_lock);
+	oldtbl = mesh_paths;
+	newtbl = mesh_table_grow(mesh_paths);
+	if (!newtbl) {
+		write_unlock(&pathtbl_resize_lock);
+		return;
+	}
+	rcu_assign_pointer(mesh_paths, newtbl);
+	write_unlock(&pathtbl_resize_lock);
+
+	synchronize_rcu();
+	mesh_table_free(oldtbl, false);
+}
+
+void mesh_mpp_table_grow(void)
+{
+	struct mesh_table *oldtbl, *newtbl;
+
+	write_lock(&pathtbl_resize_lock);
+	oldtbl = mpp_paths;
+	newtbl = mesh_table_grow(mpp_paths);
+	if (!newtbl) {
+		write_unlock(&pathtbl_resize_lock);
+		return;
+	}
+	rcu_assign_pointer(mpp_paths, newtbl);
+	write_unlock(&pathtbl_resize_lock);
+
+	synchronize_rcu();
+	mesh_table_free(oldtbl, false);
+}
 
 int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
 {
+	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
+	struct ieee80211_local *local = sdata->local;
 	struct mesh_path *mpath, *new_mpath;
 	struct mpath_node *node, *new_node;
 	struct hlist_head *bucket;
@@ -289,8 +377,6 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
 	int err = 0;
 	u32 hash_idx;
 
-	might_sleep();
-
 	if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0)
 		/* never add ourselves as neighbours */
 		return -ENOTSUPP;
@@ -299,11 +385,11 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
 		return -ENOTSUPP;
 
 	err = -ENOMEM;
-	new_mpath = kzalloc(sizeof(struct mesh_path), GFP_KERNEL);
+	new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC);
 	if (!new_mpath)
 		goto err_path_alloc;
 
-	new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
+	new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
 	if (!new_node)
 		goto err_node_alloc;
 
@@ -337,20 +423,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
 	spin_unlock(&mpp_paths->hashwlock[hash_idx]);
 	read_unlock(&pathtbl_resize_lock);
 	if (grow) {
-		struct mesh_table *oldtbl, *newtbl;
-
-		write_lock(&pathtbl_resize_lock);
-		oldtbl = mpp_paths;
-		newtbl = mesh_table_grow(mpp_paths);
-		if (!newtbl) {
-			write_unlock(&pathtbl_resize_lock);
-			return 0;
-		}
-		rcu_assign_pointer(mpp_paths, newtbl);
-		write_unlock(&pathtbl_resize_lock);
-
-		synchronize_rcu();
-		mesh_table_free(oldtbl, false);
+		set_bit(MESH_WORK_GROW_MPP_TABLE,  &ifmsh->wrkq_flags);
+		ieee80211_queue_work(&local->hw, &ifmsh->work);
 	}
 	return 0;
 
-- 
1.5.4.3


^ permalink raw reply related

* [PATCH 6/7] mac80211: Assign a default mesh beaconing interval.
From: Javier Cardona @ 2009-08-10 19:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel
In-Reply-To: <1249931752-18127-6-git-send-email-javier@cozybit.com>

The mesh stack was enabling beaconing without specifying an interval.  This
patch defines a default beaconing interval of 1s.

Incidentally, this fixes mesh beaconing in mac80211_hwsim devices.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/mesh.c |    6 ++++--
 net/mac80211/mesh.h |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 10d9338..25d0065 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -525,9 +525,11 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
 	struct ieee80211_local *local = sdata->local;
 
 	ifmsh->housekeeping = true;
-	ieee80211_queue_work(&local->hw, &ifmsh->work);
+	queue_work(local->hw, &ifmsh->work);
+	sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
 	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
-						BSS_CHANGED_BEACON_ENABLED);
+						BSS_CHANGED_BEACON_ENABLED |
+						BSS_CHANGED_BEACON_INT);
 }
 
 void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 2ebd74c..4241925 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -174,6 +174,7 @@ struct mesh_rmc {
  */
 #define MESH_PATH_REFRESH_TIME			1000
 #define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME)
+#define MESH_DEFAULT_BEACON_INTERVAL		1000 	/* in 1024 us units */
 
 #define MESH_MAX_PREQ_RETRIES 4
 #define MESH_PATH_EXPIRE (600 * HZ)
-- 
1.5.4.3


^ permalink raw reply related

* [PATCH 5/7] mac80211: Early detection of broken mesh paths when using minstrel.
From: Javier Cardona @ 2009-08-10 19:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel
In-Reply-To: <1249931752-18127-5-git-send-email-javier@cozybit.com>

This change triggers a path discovery as soon as the link quality degrades
below a certain threshold.  This results in a faster path recovery time than
by simply relying on the periodic path refresh mechanism to detect broken
links.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/rc80211_minstrel.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 3ea9740..0071649 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -51,6 +51,7 @@
 #include <linux/random.h>
 #include <linux/ieee80211.h>
 #include <net/mac80211.h>
+#include "mesh.h"
 #include "rate.h"
 #include "rc80211_minstrel.h"
 
@@ -178,9 +179,14 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
 
 		if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) {
 			mi->r[ndx].success += success;
-			if (si)
+			if (si) {
 				si->fail_avg = (18050 - mi->r[ndx].probability)
 					/ 180;
+				WARN_ON(si->fail_avg > 100);
+				if (si->fail_avg == 100 &&
+					ieee80211_vif_is_mesh(&si->sdata->vif))
+					mesh_plink_broken(si);
+			}
 		}
 	}
 
-- 
1.5.4.3


^ permalink raw reply related

* [PATCH 4/7] mac80211: Update the station failed frames average when minstrel is used.
From: Javier Cardona @ 2009-08-10 19:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, andrey, johannes, linville, devel
In-Reply-To: <1249931752-18127-4-git-send-email-javier@cozybit.com>

The fail_avg value is used to compute the mesh metric, and was only being set
by the pid rate control module. This fixes the mesh path selection mechanism
for cards that use mistrel for rate control.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/rc80211_minstrel.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 7c51429..3ea9740 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -155,12 +155,16 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
 		   struct sk_buff *skb)
 {
 	struct minstrel_sta_info *mi = priv_sta;
+	struct minstrel_priv *mp = (struct minstrel_priv *)priv;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_tx_rate *ar = info->status.rates;
+	struct ieee80211_local *local = hw_to_local(mp->hw);
+	struct sta_info *si;
 	int i, ndx;
 	int success;
 
 	success = !!(info->flags & IEEE80211_TX_STAT_ACK);
+	si = sta_info_get(local, sta->addr);
 
 	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
 		if (ar[i].idx < 0)
@@ -172,8 +176,12 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
 
 		mi->r[ndx].attempts += ar[i].count;
 
-		if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0))
+		if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) {
 			mi->r[ndx].success += success;
+			if (si)
+				si->fail_avg = (18050 - mi->r[ndx].probability)
+					/ 180;
+		}
 	}
 
 	if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0))
-- 
1.5.4.3


^ permalink raw reply related

* [PATCH 3/7] mac80211: Use 3-address format for mesh broadcast frames.
From: Javier Cardona @ 2009-08-10 19:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Javier Cardona, Andrey Yurovsky, johannes, linville, devel
In-Reply-To: <1249931752-18127-3-git-send-email-javier@cozybit.com>

The 11s task group recently changed the frame mesh multicast/broadcast frame
format to use 3-address.  This was done to avoid interactions with widely
deployed lazy-WDS access points.

This patch changes the format of group addressed frames, both mesh-originated
and proxied, to use the data format defined in draft D2.08 and forward.  The
address fields used for group addressed frames is:

In 802.11 header
 ToDS:0  FromDS:1
 addr1: DA  (broadcast/multicast address)
 addr2: TA
 addr3: Mesh SA

In address extension header:
 addr4: SA  (only present if frame was proxied)

Note that this change breaks backward compatibility with earlier mesh stack
versions.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/mesh.c |   62 ++++++++++++++++++++++++++++++++++++++++++++++---
 net/mac80211/mesh.h |    5 +++-
 net/mac80211/rx.c   |   45 ++++++++++++++++++++++-------------
 net/mac80211/tx.c   |   64 +++++++++++++++++++++++++++------------------------
 net/wireless/util.c |   16 +++++++++---
 5 files changed, 136 insertions(+), 56 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 8c068e2..10d9338 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -399,21 +399,75 @@ endgrow:
 }
 
 /**
+ * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
+ * @hdr:    	802.11 frame header
+ * @fc:		frame control field
+ * @meshda:	destination address in the mesh
+ * @meshsa:	source address address in the mesh.  Same as TA, as frame is
+ *              locally originated.
+ *
+ * Return the length of the 802.11 (does not include a mesh control header)
+ */
+int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, char
+		*meshda, char *meshsa) {
+	if (is_multicast_ether_addr(meshda)) {
+		*fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
+		/* DA TA SA */
+		memcpy(hdr->addr1, meshda, ETH_ALEN);
+		memcpy(hdr->addr2, meshsa, ETH_ALEN);
+		memcpy(hdr->addr3, meshsa, ETH_ALEN);
+		return 24;
+	} else {
+		*fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
+				IEEE80211_FCTL_TODS);
+		/* RA TA DA SA */
+		memset(hdr->addr1, 0, ETH_ALEN);   /* RA is resolved later */
+		memcpy(hdr->addr2, meshsa, ETH_ALEN);
+		memcpy(hdr->addr3, meshda, ETH_ALEN);
+		memcpy(hdr->addr4, meshsa, ETH_ALEN);
+		return 30;
+	}
+}
+
+/**
  * ieee80211_new_mesh_header - create a new mesh header
  * @meshhdr:    uninitialized mesh header
  * @sdata:	mesh interface to be used
+ * @addr4:	addr4 of the mesh frame (1st in ae header)
+ *              may be NULL
+ * @addr5:	addr5 of the mesh frame (1st or 2nd in ae header)
+ *              may be NULL unless addr6 is present
+ * @addr6:	addr6 of the mesh frame (2nd or 3rd in ae header)
+ * 		may be NULL unless addr5 is present
  *
  * Return the header length.
  */
 int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
-		struct ieee80211_sub_if_data *sdata)
+		struct ieee80211_sub_if_data *sdata, char *addr4,
+		char *addr5, char *addr6)
 {
-	meshhdr->flags = 0;
+	int aelen = 0;
+	memset(meshhdr, 0, sizeof(meshhdr));
 	meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
 	put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum);
 	sdata->u.mesh.mesh_seqnum++;
-
-	return 6;
+	if (addr4) {
+		meshhdr->flags |= MESH_FLAGS_AE_A4;
+		aelen += ETH_ALEN;
+		memcpy(meshhdr->eaddr1, addr4, ETH_ALEN);
+	}
+	if (addr5 && addr6) {
+		meshhdr->flags |= MESH_FLAGS_AE_A5_A6;
+		aelen += 2 * ETH_ALEN;
+		if (!addr4) {
+			memcpy(meshhdr->eaddr1, addr5, ETH_ALEN);
+			memcpy(meshhdr->eaddr2, addr6, ETH_ALEN);
+		} else {
+			memcpy(meshhdr->eaddr2, addr5, ETH_ALEN);
+			memcpy(meshhdr->eaddr3, addr6, ETH_ALEN);
+		}
+	}
+	return 6 + aelen;
 }
 
 static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 6aaf1ec..2ebd74c 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -193,8 +193,11 @@ struct mesh_rmc {
 
 /* Public interfaces */
 /* Various */
+int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
+		char *da, char *sa);
 int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
-		struct ieee80211_sub_if_data *sdata);
+		struct ieee80211_sub_if_data *sdata, char *addr4,
+		char *addr5, char *addr6);
 int mesh_rmc_check(u8 *addr, struct ieee80211s_hdr *mesh_hdr,
 		struct ieee80211_sub_if_data *sdata);
 bool mesh_matches_local(struct ieee802_11_elems *ie,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 25a669c..e7d8895 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -489,12 +489,21 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
 	unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control);
+	char *dev_addr = rx->dev->dev_addr;
 
 	if (ieee80211_is_data(hdr->frame_control)) {
-		if (!ieee80211_has_a4(hdr->frame_control))
-			return RX_DROP_MONITOR;
-		if (memcmp(hdr->addr4, rx->dev->dev_addr, ETH_ALEN) == 0)
-			return RX_DROP_MONITOR;
+		if (is_multicast_ether_addr(hdr->addr1)) {
+			if (ieee80211_has_tods(hdr->frame_control) ||
+				!ieee80211_has_fromds(hdr->frame_control))
+				return RX_DROP_MONITOR;
+			if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0)
+				return RX_DROP_MONITOR;
+		} else {
+			if (!ieee80211_has_a4(hdr->frame_control))
+				return RX_DROP_MONITOR;
+			if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0)
+				return RX_DROP_MONITOR;
+		}
 	}
 
 	/* If there is not an established peer link and this is not a peer link
@@ -527,7 +536,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 
 	if (ieee80211_is_data(hdr->frame_control) &&
 	    is_multicast_ether_addr(hdr->addr1) &&
-	    mesh_rmc_check(hdr->addr4, msh_h_get(hdr, hdrlen), rx->sdata))
+	    mesh_rmc_check(hdr->addr3, msh_h_get(hdr, hdrlen), rx->sdata))
 		return RX_DROP_MONITOR;
 #undef msh_h_get
 
@@ -1495,7 +1504,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		/* illegal frame */
 		return RX_DROP_MONITOR;
 
-	if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6){
+	if (!is_multicast_ether_addr(hdr->addr1) &&
+			(mesh_hdr->flags & MESH_FLAGS_AE_A5_A6)) {
 		struct mesh_path *mppath;
 
 		rcu_read_lock();
@@ -1512,7 +1522,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		rcu_read_unlock();
 	}
 
-	if (compare_ether_addr(rx->dev->dev_addr, hdr->addr3) == 0)
+	/* Frame has reached destination.  Don't forward */
+	if (!is_multicast_ether_addr(hdr->addr1) &&
+			compare_ether_addr(rx->dev->dev_addr, hdr->addr3) == 0)
 		return RX_CONTINUE;
 
 	mesh_hdr->ttl--;
@@ -1532,22 +1544,21 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 						   rx->dev->name);
 
 			fwd_hdr =  (struct ieee80211_hdr *) fwd_skb->data;
-			/*
-			 * Save TA to addr1 to send TA a path error if a
-			 * suitable next hop is not found
-			 */
-			memcpy(fwd_hdr->addr1, fwd_hdr->addr2, ETH_ALEN);
 			memcpy(fwd_hdr->addr2, rx->dev->dev_addr, ETH_ALEN);
 			info = IEEE80211_SKB_CB(fwd_skb);
 			memset(info, 0, sizeof(*info));
 			info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
 			info->control.vif = &rx->sdata->vif;
 			ieee80211_select_queue(local, fwd_skb);
-			if (is_multicast_ether_addr(fwd_hdr->addr3))
-				memcpy(fwd_hdr->addr1, fwd_hdr->addr3,
+			if (!is_multicast_ether_addr(fwd_hdr->addr1)) {
+				int err;
+				/*
+				 * Save TA to addr1 to send TA a path error if a
+				 * suitable next hop is not found
+				 */
+				memcpy(fwd_hdr->addr1, fwd_hdr->addr2,
 						ETH_ALEN);
-			else {
-				int err = mesh_nexthop_lookup(fwd_skb, sdata);
+				err = mesh_nexthop_lookup(fwd_skb, sdata);
 				/* Failed to immediately resolve next hop:
 				 * fwded frame was dropped or will be added
 				 * later to the pending skb queue.  */
@@ -1560,7 +1571,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 		}
 	}
 
-	if (is_multicast_ether_addr(hdr->addr3) ||
+	if (is_multicast_ether_addr(hdr->addr1) ||
 	    rx->dev->flags & IFF_PROMISC)
 		return RX_CONTINUE;
 	else
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c9be9dc..b9f5be6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1415,9 +1415,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
 
 	if (ieee80211_vif_is_mesh(&sdata->vif) &&
 	    ieee80211_is_data(hdr->frame_control)) {
-		if (is_multicast_ether_addr(hdr->addr3))
-			memcpy(hdr->addr1, hdr->addr3, ETH_ALEN);
-		else
+		if (!is_multicast_ether_addr(hdr->addr1))
 			if (mesh_nexthop_lookup(skb, sdata)) {
 				dev_put(sdata->dev);
 				return;
@@ -1620,52 +1618,58 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
 		break;
 #ifdef CONFIG_MAC80211_MESH
 	case NL80211_IFTYPE_MESH_POINT:
-		fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS);
 		if (!sdata->u.mesh.mshcfg.dot11MeshTTL) {
 			/* Do not send frames with mesh_ttl == 0 */
 			sdata->u.mesh.mshstats.dropped_frames_ttl++;
 			ret = 0;
 			goto fail;
 		}
-		memset(&mesh_hdr, 0, sizeof(mesh_hdr));
 
 		if (compare_ether_addr(dev->dev_addr,
 					  skb->data + ETH_ALEN) == 0) {
-			/* RA TA DA SA */
-			memset(hdr.addr1, 0, ETH_ALEN);
-			memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN);
-			memcpy(hdr.addr3, skb->data, ETH_ALEN);
-			memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
-			meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, sdata);
+			hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
+					skb->data, skb->data + ETH_ALEN);
+			meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr,
+					sdata, NULL, NULL, NULL);
 		} else {
 			/* packet from other interface */
 			struct mesh_path *mppath;
+			int is_mesh_mcast = 1;
+			char *mesh_da;
 
-			memset(hdr.addr1, 0, ETH_ALEN);
-			memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN);
-			memcpy(hdr.addr4, dev->dev_addr, ETH_ALEN);
-
+			rcu_read_lock();
 			if (is_multicast_ether_addr(skb->data))
-				memcpy(hdr.addr3, skb->data, ETH_ALEN);
+				/* DA TA mSA AE:SA */
+				mesh_da = skb->data;
 			else {
-				rcu_read_lock();
 				mppath = mpp_path_lookup(skb->data, sdata);
-				if (mppath)
-					memcpy(hdr.addr3, mppath->mpp, ETH_ALEN);
-				else
-					memset(hdr.addr3, 0xff, ETH_ALEN);
-				rcu_read_unlock();
+				if (mppath) {
+					/* RA TA mDA mSA AE:DA SA */
+					mesh_da = mppath->mpp;
+					is_mesh_mcast = 0;
+				} else
+					/* DA TA mSA AE:SA */
+					mesh_da = dev->broadcast;
 			}
+			hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
+					mesh_da, dev->dev_addr);
+			rcu_read_unlock();
+			if (is_mesh_mcast)
+				meshhdrlen =
+					ieee80211_new_mesh_header(&mesh_hdr,
+							sdata,
+							skb->data + ETH_ALEN,
+							NULL,
+							NULL);
+			else
+				meshhdrlen =
+					ieee80211_new_mesh_header(&mesh_hdr,
+							sdata,
+							NULL,
+							skb->data,
+							skb->data + ETH_ALEN);
 
-			mesh_hdr.flags |= MESH_FLAGS_AE_A5_A6;
-			mesh_hdr.ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
-			put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &mesh_hdr.seqnum);
-			memcpy(mesh_hdr.eaddr1, skb->data, ETH_ALEN);
-			memcpy(mesh_hdr.eaddr2, skb->data + ETH_ALEN, ETH_ALEN);
-			sdata->u.mesh.mesh_seqnum++;
-			meshhdrlen = 18;
 		}
-		hdrlen = 30;
 		break;
 #endif
 	case NL80211_IFTYPE_STATION:
diff --git a/net/wireless/util.c b/net/wireless/util.c
index ba387d8..693275a 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -274,11 +274,11 @@ static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
 	switch (ae) {
 	case 0:
 		return 6;
-	case 1:
+	case MESH_FLAGS_AE_A4:
 		return 12;
-	case 2:
+	case MESH_FLAGS_AE_A5_A6:
 		return 18;
-	case 3:
+	case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
 		return 24;
 	default:
 		return 6;
@@ -333,10 +333,18 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
 		}
 		break;
 	case cpu_to_le16(IEEE80211_FCTL_FROMDS):
-		if (iftype != NL80211_IFTYPE_STATION ||
+		if ((iftype != NL80211_IFTYPE_STATION &&
+		    iftype != NL80211_IFTYPE_MESH_POINT) ||
 		    (is_multicast_ether_addr(dst) &&
 		     !compare_ether_addr(src, addr)))
 			return -1;
+		if (iftype == NL80211_IFTYPE_MESH_POINT) {
+			struct ieee80211s_hdr *meshdr =
+				(struct ieee80211s_hdr *) (skb->data + hdrlen);
+			hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
+			if (meshdr->flags & MESH_FLAGS_AE_A4)
+				memcpy(src, meshdr->eaddr1, ETH_ALEN);
+		}
 		break;
 	case cpu_to_le16(0):
 		if (iftype != NL80211_IFTYPE_ADHOC)
-- 
1.5.4.3


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox