Netdev List
 help / color / mirror / Atom feed
* Re: troubles with r8169
From: Alistair John Strachan @ 2007-08-12 20:38 UTC (permalink / raw)
  To: Vadim Dyadkin; +Cc: Robert Hancock, netdev, linux-kernel
In-Reply-To: <46BF6853.4020800@lns.pnpi.spb.ru>

On Sunday 12 August 2007 21:06:43 Vadim Dyadkin wrote:
> Robert Hancock пишет:
> > This could well be a problem with the nvidia driver as it shares the
> > same IRQ. The first step would be to see if the problem still shows up
> > without the nvidia binary module loaded.
>
> Thank for your answer. This problem never shows up if I use only nvidia
> driver (the work without network), or if I use only r8169 (without
> x.org). If I use both of them I have the hang. Usually the hang appears
> if OpenGL is used or network rate is maximal. I tested this regimes many
> times before.

If you haven't already, I'd drop linux-bugs@nvidia.com an email to see if they 
have any insight. Not that this can't be a kernel bug, just that it's a bit 
difficult for kernel developers to debug when you're using a driver for which 
we don't have the sources.

As for changing the IRQ assignments, I don't have any immediate suggestions. I 
notice that this laptop has a dual core processor, so I'm guessing disabling 
APIC isn't an option. Have you tried that anyway, just to see if the IRQ 
assignment differs?

-- 
Cheers,
Alistair.

137/1 Warrender Park Road, Edinburgh, UK.

^ permalink raw reply

* Re: troubles with r8169
From: Vadim Dyadkin @ 2007-08-12 20:06 UTC (permalink / raw)
  To: Robert Hancock; +Cc: netdev, linux-kernel
In-Reply-To: <46BF61AB.5060400@shaw.ca>

Robert Hancock пишет:
> This could well be a problem with the nvidia driver as it shares the
> same IRQ. The first step would be to see if the problem still shows up
> without the nvidia binary module loaded.

Thank for your answer. This problem never shows up if I use only nvidia
driver (the work without network), or if I use only r8169 (without
x.org). If I use both of them I have the hang. Usually the hang appears
if OpenGL is used or network rate is maximal. I tested this regimes many
times before.

Vadim

^ permalink raw reply

* Re: troubles with r8169
From: Robert Hancock @ 2007-08-12 19:38 UTC (permalink / raw)
  To: Vadim Dyadkin; +Cc: netdev, linux-kernel
In-Reply-To: <fa.BZqd/vLw75Xm+ORj+HLjUzU1hSw@ifi.uio.no>

Vadim Dyadkin wrote:
> Hi!
> 
> I need help from developers, may be, because I have some troubles with
> r8169 card.
> I use laptop ASUS a6tc. The network card in this laptop is r8169. Video
> is GeForce Go 7300. When I load linux (I use linux almost always), the
> network and video cards take the same IRQ every time.
> ************************
> # cat /proc/interrupts
>            CPU0       CPU1
>   0:    3530622     177152    XT-PIC-XT        timer
>   1:       1910          9   IO-APIC-edge      i8042
>   8:          1          1   IO-APIC-edge      rtc
>   9:      41627        115   IO-APIC-fasteoi   acpi
>  12:        122         10   IO-APIC-edge      i8042
>  14:         38         12   IO-APIC-edge      ide0
>  15:      53721          8   IO-APIC-edge      ide1
>  16:          0          0   IO-APIC-fasteoi   yenta
>  17:      34909          1   IO-APIC-fasteoi   ohci_hcd:usb1
>  18:         13          1   IO-APIC-fasteoi   ehci_hcd:usb2
>  19:     332826          1   IO-APIC-fasteoi   nvidia, eth0
>  20:          0          0   IO-APIC-fasteoi   sdhci:slot0
>  21:      26981          1   IO-APIC-fasteoi   HDA Intel
> NMI:          0          0
> LOC:     177152    3530365
> ERR:          1
> MIS:          0
> **************************
> You can see, now it's 19, sometimes it's 17 or 21, but every time it is
> the same.
> Often, the computer hangs, only the reboot can help. In /var/log/messages:
> ************************
> Jul 14 19:15:29 satah NETDEV WATCHDOG: eth0: transmit timed out
> Jul 14 19:15:32 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2c
> Jul 14 19:15:40 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2d
> Jul 14 19:15:48 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2e
> Jul 14 19:15:56 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2f
> Jul 14 19:16:04 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda30
> Jul 14 19:16:12 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda31
> Jul 14 19:16:17 satah NETDEV WATCHDOG: eth0: transmit timed out
> Jul 14 19:16:20 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda32
> Jul 14 19:16:35 satah NETDEV WATCHDOG: eth0: transmit timed out
> Jul 14 19:16:53 satah NETDEV WATCHDOG: eth0: transmit timed out
> ****************************
> There's no such problem in windows. Could you help me with it?

This could well be a problem with the nvidia driver as it shares the 
same IRQ. The first step would be to see if the problem still shows up 
without the nvidia binary module loaded.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/

^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Segher Boessenkool @ 2007-08-12 19:13 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: wjiang, wensong, heiko.carstens, linux-kernel, ak, cfriesen,
	netdev, horms, akpm, schwidefsky, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <alpine.LFD.0.999.0708121107490.30176@woody.linux-foundation.org>

>> Yeah.  Compiler errors are more annoying though I dare say ;-)
>
> Actually, compile-time errors are fine,

Yes, they don't cause data corruption or anything like that,
but I still don't think the 390 people want to ship a kernel
that doesn't build -- and it seems they still need to support
GCC versions before 4.0.  Up until the day they can finally
drop 3.x, they'll have to...

> and easy to work around.

...use the simple workaround, annoying as it may be, at least
it works.  That's all I'm saying.

> *Much*
> more annoying is when gcc actively generates subtly bad code.

Quite so.

> We've had
> use-after-free issues due to incorrect gcc liveness calculations etc, 
> and
> inline asm has beeen one of the more common causes - exactly because 
> the
> kernel is one of the few users (along with glibc) that uses it at all.

The good news is that things are getting better since more and
more of the RTL transformations are ripped out.

> Now *those* are hard to find - the code works most of the time, but the
> compiler has inserted a really subtle race condition into the code
> (deallocated a local stack entry before last use). We had that with our
> semaphore code at some point.

Yeah, magnifying glass + lots of time kind of bug.  Lovely :-/


Segher


^ permalink raw reply

* troubles with r8169
From: Vadim Dyadkin @ 2007-08-12 18:37 UTC (permalink / raw)
  To: netdev, linux-kernel

Hi!

I need help from developers, may be, because I have some troubles with
r8169 card.
I use laptop ASUS a6tc. The network card in this laptop is r8169. Video
is GeForce Go 7300. When I load linux (I use linux almost always), the
network and video cards take the same IRQ every time.
************************
# cat /proc/interrupts
           CPU0       CPU1
  0:    3530622     177152    XT-PIC-XT        timer
  1:       1910          9   IO-APIC-edge      i8042
  8:          1          1   IO-APIC-edge      rtc
  9:      41627        115   IO-APIC-fasteoi   acpi
 12:        122         10   IO-APIC-edge      i8042
 14:         38         12   IO-APIC-edge      ide0
 15:      53721          8   IO-APIC-edge      ide1
 16:          0          0   IO-APIC-fasteoi   yenta
 17:      34909          1   IO-APIC-fasteoi   ohci_hcd:usb1
 18:         13          1   IO-APIC-fasteoi   ehci_hcd:usb2
 19:     332826          1   IO-APIC-fasteoi   nvidia, eth0
 20:          0          0   IO-APIC-fasteoi   sdhci:slot0
 21:      26981          1   IO-APIC-fasteoi   HDA Intel
NMI:          0          0
LOC:     177152    3530365
ERR:          1
MIS:          0
**************************
You can see, now it's 19, sometimes it's 17 or 21, but every time it is
the same.
Often, the computer hangs, only the reboot can help. In /var/log/messages:
************************
Jul 14 19:15:29 satah NETDEV WATCHDOG: eth0: transmit timed out
Jul 14 19:15:32 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2c
Jul 14 19:15:40 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2d
Jul 14 19:15:48 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2e
Jul 14 19:15:56 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda2f
Jul 14 19:16:04 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda30
Jul 14 19:16:12 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda31
Jul 14 19:16:17 satah NETDEV WATCHDOG: eth0: transmit timed out
Jul 14 19:16:20 satah NVRM: Xid (0002:00): 16, Head 00000000 Count 00cfda32
Jul 14 19:16:35 satah NETDEV WATCHDOG: eth0: transmit timed out
Jul 14 19:16:53 satah NETDEV WATCHDOG: eth0: transmit timed out
****************************
There's no such problem in windows. Could you help me with it?

Thank you in advance,
Vadim


^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Linus Torvalds @ 2007-08-12 18:11 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: schwidefsky, wjiang, wensong, heiko.carstens, linux-kernel, ak,
	cfriesen, netdev, horms, akpm, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <74868f39491f8691afc5540f72679129@kernel.crashing.org>



On Sun, 12 Aug 2007, Segher Boessenkool wrote:
> 
> Yeah.  Compiler errors are more annoying though I dare say ;-)

Actually, compile-time errors are fine, and easy to work around. *Much* 
more annoying is when gcc actively generates subtly bad code. We've had 
use-after-free issues due to incorrect gcc liveness calculations etc, and 
inline asm has beeen one of the more common causes - exactly because the 
kernel is one of the few users (along with glibc) that uses it at all.

Now *those* are hard to find - the code works most of the time, but the 
compiler has inserted a really subtle race condition into the code 
(deallocated a local stack entry before last use). We had that with our 
semaphore code at some point.

		Linus

^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Linus Torvalds @ 2007-08-12 17:59 UTC (permalink / raw)
  To: Segher Boessenkool
  Cc: wjiang, wensong, heiko.carstens, linux-kernel, ak, cfriesen,
	netdev, horms, akpm, schwidefsky, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <cbbe196cd30095e13e96762a6ddfd9a0@kernel.crashing.org>



On Sun, 12 Aug 2007, Segher Boessenkool wrote:
> 
> It works _most of the time_.

It used to have problems. Gcc has had problems in various areas.

>			  Ask Martin.  Oh you don't even have to,
> he told you two mails ago.  My last mail simply pointed out that this
> isn't a GCC bug, but merely documented behaviour.

It was *not* documented behaviour, and there were gcc people who actively 
*encouraged* use of "+m", and actually fixed gcc.

The documentation is buggy.

Live with it.

			Linus

^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Iustin Pop @ 2007-08-12 17:45 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: david, Al Boldi, linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <Pine.LNX.4.64.0708121901290.28963@fbirervta.pbzchgretzou.qr>

On Sun, Aug 12, 2007 at 07:03:44PM +0200, Jan Engelhardt wrote:
> 
> On Aug 12 2007 09:39, david@lang.hm wrote:
> >
> > now, I am not an expert on either option, but three are a couple things that I
> > would question about the DRDB+MD option
> >
> > 1. when the remote machine is down, how does MD deal with it for reads and
> > writes?
> 
> I suppose it kicks the drive and you'd have to re-add it by hand unless done by
> a cronjob.

>From my tests, since NBD doesn't have a timeout option, MD hangs in the
write to that mirror indefinitely, somewhat like when dealing with a
broken IDE driver/chipset/disk.

> > 2. MD over local drive will alternate reads between mirrors (or so I've been
> > told), doing so over the network is wrong.
> 
> Certainly. In which case you set "write_mostly" (or even write_only, not sure
> of its name) on the raid component that is nbd.
> 
> > 3. when writing, will MD wait for the network I/O to get the data saved on the
> > backup before returning from the syscall? or can it sync the data out lazily
> 
> Can't answer this one - ask Neil :)

MD has the write-mostly/write-behind options - which help in this case
but only up to a certain amount.


In my experience DRBD wins hands-down over MD+NBD because of MD doesn't
know (or handle) a component that never returns from a write, which is
quite different from returning with an error. Furthermore, DRBD was
designed to handle transient errors in the connection to the peer due to
its network-oriented design, whereas MD is mostly designed with local or
at least high-reliability disks (where disk can be SAN, SCSI, etc.) and
a failure is not normal for MD. Thus the need for manual reconnect in MD
case and the automated handling of reconnects in case of DRBD.

I'm just a happy user of both MD over local disks and DRBD for networked
raid.

regards,
iustin

^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Jan Engelhardt @ 2007-08-12 17:03 UTC (permalink / raw)
  To: david; +Cc: Al Boldi, linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <Pine.LNX.4.64.0708120933210.19502@asgard.lang.hm>


On Aug 12 2007 09:39, david@lang.hm wrote:
>
> now, I am not an expert on either option, but three are a couple things that I
> would question about the DRDB+MD option
>
> 1. when the remote machine is down, how does MD deal with it for reads and
> writes?

I suppose it kicks the drive and you'd have to re-add it by hand unless done by
a cronjob.

> 2. MD over local drive will alternate reads between mirrors (or so I've been
> told), doing so over the network is wrong.

Certainly. In which case you set "write_mostly" (or even write_only, not sure
of its name) on the raid component that is nbd.

> 3. when writing, will MD wait for the network I/O to get the data saved on the
> backup before returning from the syscall? or can it sync the data out lazily

Can't answer this one - ask Neil :)




	Jan
-- 

^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: david @ 2007-08-12 16:39 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Al Boldi, linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <Pine.LNX.4.64.0708121325170.28963@fbirervta.pbzchgretzou.qr>

On Sun, 12 Aug 2007, Jan Engelhardt wrote:

> On Aug 12 2007 13:35, Al Boldi wrote:
>> Lars Ellenberg wrote:
>>> meanwhile, please, anyone interessted,
>>> the drbd paper for LinuxConf Eu 2007 is finalized.
>>> http://www.drbd.org/fileadmin/drbd/publications/
>>> drbd8.linux-conf.eu.2007.pdf
>>>
>>> but it does give a good overview about what DRBD actually is,
>>> what exact problems it tries to solve,
>>> and what developments to expect in the near future.
>>>
>>> so you can make up your mind about
>>>  "Do we need it?", and
>>>  "Why DRBD? Why not NBD + MD-RAID?"
>
> I may have made a mistake when asking for how it compares to NBD+MD.
> Let me retry: what's the functional difference between
> GFS2 on a DRBD .vs. GFS2 on a DAS SAN?

GFS is a distributed filesystem, DRDB is a replicated block device. you 
wouldn't do GFS on top of DRDB, you would do ext2/3, XFS, etc

DRDB is much closer to the NBD+MD option.

now, I am not an expert on either option, but three are a couple things 
that I would question about the DRDB+MD option

1. when the remote machine is down, how does MD deal with it for reads and 
writes?

2. MD over local drive will alternate reads between mirrors (or so I've 
been told), doing so over the network is wrong.

3. when writing, will MD wait for the network I/O to get the data saved on 
the backup before returning from the syscall? or can it sync the data out 
lazily

>> Now, shared remote block access should theoretically be handled, as does
>> DRBD, by a block layer driver, but realistically it may be more appropriate
>> to let it be handled by the combining end user, like OCFS or GFS.

there are times when you want to replicate at the block layer, and there 
are times when you want to have a filesystem do the work. don't force a 
filesystem on use-cases where a block device is the right answer.

David Lang

^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Segher Boessenkool @ 2007-08-12 16:30 UTC (permalink / raw)
  To: schwidefsky
  Cc: wjiang, Linus Torvalds, wensong, heiko.carstens, linux-kernel, ak,
	cfriesen, netdev, horms, akpm, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <1186912098.3852.11.camel@localhost>

>> "+m" works. We use it. It's better than the alternatives. Pointing to
>> stale documentation doesn't change anything.
>
> Well, perhaps on i386. I've seen some older versions of the s390 gcc 
> die
> with an ICE because I have used "+m" in some kernel inline assembly. 
> I'm
> happy to hear that this issue is fixed in recent gcc. Now I'll have to
> find out if this is already true with gcc 3.x.

It was fixed (that is, "+m" is translated into a separate read
and write by GCC itself) in GCC-4.0.0, I just learnt.

> The duplication "=m" and "m" with the same constraint is rather 
> annoying.

Yeah.  Compiler errors are more annoying though I dare say ;-)


Segher


^ permalink raw reply

* Re: [PATCH 2.6.24]S2io: Default to IntA interrupt type when there are less than 4 CPUs in the system.
From: Andi Kleen @ 2007-08-12 17:15 UTC (permalink / raw)
  To: Ramkrishna Vepa
  Cc: Jeff Garzik, Rick Jones, Sivakumar Subramani, netdev, support
In-Reply-To: <78C9135A3D2ECE4B8162EBDCE82CAD7702035B30@nekter>

"Ramkrishna Vepa" <Ramkrishna.Vepa@neterion.com> writes:

> In one of the variations of this driver that is not
> released to netdev, the received packets are steered to a channel based
> on hashing on a preconfigured criteria such as sockets on tcp_ipv4,
> udp_ipv4, tcp_ipv6, udp_ipv6 or addresses in ipv4/6.

Why is it not released for mainline? It sounds interesting.

-Andi


^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Al Boldi @ 2007-08-12 15:28 UTC (permalink / raw)
  To: Evgeniy Polyakov; +Cc: linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <20070812115126.GA14770@2ka.mipt.ru>

Evgeniy Polyakov wrote:
> Al Boldi (a1426z@gawab.com) wrote:
> > Look at ZFS; it illegally violates layering by combining md/dm/lvm with
> > the fs, but it does this based on a realistic understanding of the
> > problems involved, which enables it to improve performance, flexibility,
> > and functionality specific to its use case.
> >
> > This implies that there are two distinct forces at work here:
> >
> >   1. Layer components
> >   2. Use-Case composers
> >
> > Layer components should technically not implement any use case (other
> > than providing a plumbing framework), as that would incur unnecessary
> > dependencies, which could reduce its generality and thus reusability.
> >
> > Use-Case composers can now leverage layer components from across the
> > layering hierarchy, to yield a specific use case implementation.
> >
> > DRBD is such a Use-Case composer, as is mdm / dm / lvm and any fs in
> > general, whereas aoe / nbd / loop and the VFS / FUSE are examples of
> > layer components.
> >
> > It follows that Use-case composers, like DRBD, need common functionality
> > that should be factored out into layer components, and then recompose to
> > implement a specific use case.
>
> Out of curiosity, did you try ndb+dm+raid1 compared to drbd and/or zfs
> on top of distributed storage (which is a urprise to me, that holy zfs
> suppors that)?

Actually, I may not have been very clear in my Use-Case composer description 
to mean internal in-kernel Use-Case composer as opposed to external Userland 
Use-Case composer.

So, nbd+dm+raid1 would be an external Userland Use-Case composition, which 
obviously could have some drastic performance issues.

DRBD and ZFS are examples of internal in-kernel Use-Case composers, which 
obviously could show some drastic performance improvements.  

Although you could allow in-kernel Use-Case composers to be run on top of 
Userland Use-Case composers, that wouldn't be the preferred mode of 
operation.  Instead, you would for example recompose ZFS to incorporate an 
in-kernel distributed storage layer component, like nbd.

All this boils down to refactoring Use-Case composers to produce layer 
components with both in-kernel and userland interfaces.  Once we have that, 
it becomes a matter of plug-and-play to produce something awesome like ZFS.


Thanks!

--
Al


^ permalink raw reply

* Re: [net-2.6.24] forcedeth does not compile without CONFIG_FORCEDETH_NAPI set
From: Samuel Ortiz @ 2007-08-12 13:28 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: Stephen Hemminger, David Miller, netdev
In-Reply-To: <46BCA18B.80603@hartkopp.net>

Hi Oliver,

On Fri, Aug 10, 2007 at 07:34:03PM +0200, Oliver Hartkopp wrote:
> Checking some other source with the current net-2.6.24 GIT, i just
> discovered this:
> 
>   CC      drivers/net/mii.o
>   CC      drivers/net/Space.o
>   CC      drivers/net/loopback.o
>   CC      drivers/net/b44.o
>   CC      drivers/net/forcedeth.o
> drivers/net/forcedeth.c: In function nv_nic_irq:
> drivers/net/forcedeth.c:3017: error: RX_WORK_PER_LOOP undeclared (first
> use in this function)
> drivers/net/forcedeth.c:3017: error: (Each undeclared identifier is
> reported only once
> drivers/net/forcedeth.c:3017: error: for each function it appears in.)
> make[2]: *** [drivers/net/forcedeth.o] Error 1
> make[1]: *** [drivers/net] Error 2
> make: *** [drivers] Error 2
> 
> This only occurs the CONFIG_FORCEDETH_NAPI is _disabled_.
This fixes the build:

--
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>

 drivers/net/forcedeth.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 37732f9..90eef4a 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2973,6 +2973,8 @@ static void nv_link_irq(struct net_device *dev)
 	dprintk(KERN_DEBUG "%s: link change notification done.\n", dev->name);
 }
 
+#define TX_WORK_PER_LOOP  64
+#define RX_WORK_PER_LOOP  64
 static irqreturn_t nv_nic_irq(int foo, void *data)
 {
 	struct net_device *dev = (struct net_device *) data;
@@ -3083,8 +3085,6 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
 	return IRQ_RETVAL(i);
 }
 
-#define TX_WORK_PER_LOOP  64
-#define RX_WORK_PER_LOOP  64
 /**
  * All _optimized functions are used to help increase performance
  * (reduce CPU and increase throughput). They use descripter version 3,




^ permalink raw reply related

* [PATCH 4/4] Net: mac80211, remove bitfields from struct ieee80211_sub_if_data
From: Jiri Slaby @ 2007-08-12 13:09 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jbenc-AlSwsSmVLrQ,
	flamingice-R9e9/4HEdknk1uMJSBkQmQ, jeff-o2qLIJkoznsdnm+yROfE0A
In-Reply-To: <32694265142306417777-2EuRcrBQ8V0@public.gmane.org>

mac80211, remove bitfields from struct ieee80211_sub_if_data

Signed-off-by: Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

---
commit 086d27164f6a040ea24efe6baab3e6b9075942a5
tree 61fb84b9bb528c8321a86a6afbf980eafb28ee3f
parent 3fe2e620fcc758be03b87e3ca5265b10fbd60e1a
author Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sun, 12 Aug 2007 13:41:55 +0200
committer Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sun, 12 Aug 2007 13:41:55 +0200

 net/mac80211/debugfs_netdev.c  |    2 +-
 net/mac80211/ieee80211.c       |   30 ++++++++++++++----------------
 net/mac80211/ieee80211_i.h     |   10 +++++-----
 net/mac80211/ieee80211_ioctl.c |   20 ++++++++++++++------
 net/mac80211/ieee80211_sta.c   |   19 +++++++++++++------
 net/mac80211/rx.c              |    4 ++--
 net/mac80211/tx.c              |   18 ++++++++++--------
 net/mac80211/util.c            |    6 +++---
 8 files changed, 62 insertions(+), 47 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index fa3b153..588f71b 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -379,7 +379,7 @@ static ssize_t ieee80211_if_fmt_flags(
 		 sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
 		 sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
 		 sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
-		 sdata->use_protection ? "CTS prot\n" : "");
+		 sdata->flags & IEEE80211_SDATA_USE_PROTECTION ? "CTS prot\n" : "");
 }
 __IEEE80211_IF_FILE(flags);
 
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 8a6e66f..136410c 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -575,23 +575,21 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
 	unsigned short flags;
 
 	netif_tx_lock_nested(local->mdev, TX_LOCK_MASTER);
-	if (((dev->flags & IFF_ALLMULTI) != 0) ^ (sdata->allmulti != 0)) {
-		if (sdata->allmulti) {
-			sdata->allmulti = 0;
+	if (((dev->flags & IFF_ALLMULTI) != 0) ^
+	    ((sdata->flags & IEEE80211_SDATA_ALLMULTI) != 0)) {
+		if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
 			local->iff_allmultis--;
-		} else {
-			sdata->allmulti = 1;
+		else
 			local->iff_allmultis++;
-		}
+		sdata->flags ^= IEEE80211_SDATA_ALLMULTI;
 	}
-	if (((dev->flags & IFF_PROMISC) != 0) ^ (sdata->promisc != 0)) {
-		if (sdata->promisc) {
-			sdata->promisc = 0;
+	if (((dev->flags & IFF_PROMISC) != 0) ^
+	    ((sdata->flags & IEEE80211_SDATA_PROMISC) != 0)) {
+		if (sdata->flags & IEEE80211_SDATA_PROMISC)
 			local->iff_promiscs--;
-		} else {
-			sdata->promisc = 1;
+		else
 			local->iff_promiscs++;
-		}
+		sdata->flags ^= IEEE80211_SDATA_PROMISC;
 	}
 	if (dev->mc_count != sdata->mc_count) {
 		local->mc_count = local->mc_count - sdata->mc_count +
@@ -761,16 +759,16 @@ void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes)
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	if (local->ops->erp_ie_changed)
 		local->ops->erp_ie_changed(local_to_hw(local), changes,
-					   sdata->use_protection,
-					   !sdata->short_preamble);
+			!!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION),
+			!(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE));
 }
 
 void ieee80211_reset_erp_info(struct net_device *dev)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-	sdata->short_preamble = 0;
-	sdata->use_protection = 0;
+	sdata->flags &= ~(IEEE80211_SDATA_USE_PROTECTION |
+			IEEE80211_SDATA_SHORT_PREAMBLE);
 	ieee80211_erp_info_change_notify(dev,
 					 IEEE80211_ERP_CHANGE_PROTECTION |
 					 IEEE80211_ERP_CHANGE_PREAMBLE);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2c20382..5f65dd5 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -322,14 +322,14 @@ struct ieee80211_sub_if_data {
 	struct ieee80211_local *local;
 
 	int mc_count;
-	unsigned int allmulti:1;
-	unsigned int promisc:1;
-	unsigned int use_protection:1; /* CTS protect ERP frames */
-
+#define IEEE80211_SDATA_ALLMULTI	BIT(0)
+#define IEEE80211_SDATA_PROMISC		BIT(1)
+#define IEEE80211_SDATA_USE_PROTECTION	BIT(2) /* CTS protect ERP frames */
 	/* use short preamble with IEEE 802.11b: this flag is set when the AP
 	 * or beacon generator reports that there are no present stations that
 	 * cannot support short preambles */
-	unsigned int short_preamble:1;
+#define IEEE80211_SDATA_SHORT_PREAMBLE	BIT(3)
+	unsigned int flags;
 
 	struct net_device_stats stats;
 	int drop_unencrypted;
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 6283e83..4af336f 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -2187,8 +2187,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
 
 	case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES:
 		if (sdata->type == IEEE80211_IF_TYPE_AP) {
-			sdata->use_protection = !!value;
-			ieee80211_erp_info_change_notify(dev, IEEE80211_ERP_CHANGE_PROTECTION);
+			if (value)
+				sdata->flags |= IEEE80211_SDATA_USE_PROTECTION;
+			else
+				sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION;
+			ieee80211_erp_info_change_notify(dev,
+					IEEE80211_ERP_CHANGE_PROTECTION);
 		} else {
 			ret = -ENOENT;
 		}
@@ -2196,8 +2200,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
 
 	case PRISM2_PARAM_PREAMBLE:
 		if (sdata->type != IEEE80211_IF_TYPE_AP) {
-			sdata->short_preamble = !!value;
-			ieee80211_erp_info_change_notify(dev, IEEE80211_ERP_CHANGE_PREAMBLE);
+			if (value)
+				sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE;
+			else
+				sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE;
+			ieee80211_erp_info_change_notify(dev,
+					IEEE80211_ERP_CHANGE_PREAMBLE);
 		} else {
 			ret = -ENOENT;
 		}
@@ -2398,11 +2406,11 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
 		break;
 
 	case PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES:
-		*param = sdata->use_protection;
+		*param = !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION);
 		break;
 
 	case PRISM2_PARAM_PREAMBLE:
-		*param = sdata->short_preamble;
+		*param = !!(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
 		break;
 
 	case PRISM2_PARAM_STAT_TIME:
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index e6a1e8d..1cdbbd3 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -362,7 +362,7 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
 	int preamble_mode = (erp_value & WLAN_ERP_BARKER_PREAMBLE) != 0;
 	u8 changes = 0;
 
-	if (use_protection != sdata->use_protection) {
+	if (use_protection != !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION)) {
 		if (net_ratelimit()) {
 			printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
 			       MAC_FMT ")\n",
@@ -370,11 +370,14 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
 			       use_protection ? "enabled" : "disabled",
 			       MAC_ARG(ifsta->bssid));
 		}
-		sdata->use_protection = use_protection;
+		if (use_protection)
+			sdata->flags |= IEEE80211_SDATA_USE_PROTECTION;
+		else
+			sdata->flags &= ~IEEE80211_SDATA_USE_PROTECTION;
 		changes |= IEEE80211_ERP_CHANGE_PROTECTION;
 	}
 
-	if (!preamble_mode != sdata->short_preamble) {
+	if (preamble_mode != !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)) {
 		if (net_ratelimit()) {
 			printk(KERN_DEBUG "%s: switched to %s barker preamble"
 			       " (BSSID=" MAC_FMT ")\n",
@@ -383,7 +386,10 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
 					"short" : "long",
 			       MAC_ARG(ifsta->bssid));
 		}
-		sdata->short_preamble = !preamble_mode;
+		if (preamble_mode)
+			sdata->flags &= ~IEEE80211_SDATA_SHORT_PREAMBLE;
+		else
+			sdata->flags |= IEEE80211_SDATA_SHORT_PREAMBLE;
 		changes |= IEEE80211_ERP_CHANGE_PREAMBLE;
 	}
 
@@ -3251,8 +3257,9 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 			       "for IBSS beacon\n", dev->name);
 			break;
 		}
-		control.tx_rate = (sdata->short_preamble &&
-				   (rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
+		control.tx_rate =
+			((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
+			(rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
 			rate->val2 : rate->val;
 		control.antenna_sel_tx = local->hw.conf.antenna_sel_tx;
 		control.power_level = local->hw.conf.power_level;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8dd7488..029e3c6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1405,7 +1405,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
 		} else if (!multicast &&
 			   compare_ether_addr(sdata->dev->dev_addr,
 					      hdr->addr1) != 0) {
-			if (!sdata->promisc)
+			if (!(sdata->flags & IEEE80211_SDATA_PROMISC))
 				return 0;
 			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		}
@@ -1420,7 +1420,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
 		} else if (!multicast &&
 			   compare_ether_addr(sdata->dev->dev_addr,
 					      hdr->addr1) != 0) {
-			if (!sdata->promisc)
+			if (!(sdata->flags & IEEE80211_SDATA_PROMISC))
 				return 0;
 			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		} else if (!rx->sta)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index bc4a3c7..b9ab284 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -173,7 +173,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
 	 * to closest integer */
 
 	dur = ieee80211_frame_duration(local, 10, rate, erp,
-				       tx->sdata->short_preamble);
+		       tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
 
 	if (next_frag_len) {
 		/* Frame is fragmented: duration increases with time needed to
@@ -181,8 +181,9 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr,
 		dur *= 2; /* ACK + SIFS */
 		/* next fragment */
 		dur += ieee80211_frame_duration(local, next_frag_len,
-						txrate->rate, erp,
-						tx->sdata->short_preamble);
+				txrate->rate, erp,
+				tx->sdata->flags &
+					IEEE80211_SDATA_SHORT_PREAMBLE);
 	}
 
 	return dur;
@@ -614,7 +615,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
 	if (!tx->u.tx.rate)
 		return TXRX_DROP;
 	if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
-	    tx->sdata->use_protection &&
+	    (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
 	    (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
 		tx->u.tx.last_frag_rate = tx->u.tx.rate;
 		if (extra.probe)
@@ -671,7 +672,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
 	if (mode->mode == MODE_IEEE80211G &&
 	    (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
 	    (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
-	    tx->sdata->use_protection &&
+	    (tx->sdata->flags & IEEE80211_SDATA_USE_PROTECTION) &&
 	    !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
 
@@ -680,7 +681,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
 	 * available on the network at the current point in time. */
 	if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
 	    (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) &&
-	    tx->sdata->short_preamble &&
+	    (tx->sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
 	    (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) {
 		tx->u.tx.control->tx_rate = tx->u.tx.rate->val2;
 	}
@@ -1782,8 +1783,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id,
 			return NULL;
 		}
 
-		control->tx_rate = (sdata->short_preamble &&
-				    (rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
+		control->tx_rate =
+			((sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE) &&
+			(rate->flags & IEEE80211_RATE_PREAMBLE2)) ?
 			rate->val2 : rate->val;
 		control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
 		control->power_level = local->hw.conf.power_level;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 091ac0d..07686bd 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -329,7 +329,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id,
 	sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
 	erp = ieee80211_is_erp_rate(hw->conf.phymode, rate);
 	dur = ieee80211_frame_duration(local, frame_len, rate,
-				       erp, sdata->short_preamble);
+		       erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE);
 
 	dev_put(bdev);
 	return cpu_to_le16(dur);
@@ -352,7 +352,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id,
 		return 0;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
-	short_preamble = sdata->short_preamble;
+	short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
 
 	rate = frame_txctl->rts_rate;
 	erp = !!(rate->flags & IEEE80211_RATE_ERP);
@@ -388,7 +388,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id,
 		return 0;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(bdev);
-	short_preamble = sdata->short_preamble;
+	short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE;
 
 	rate = frame_txctl->rts_rate;
 	erp = !!(rate->flags & IEEE80211_RATE_ERP);

^ permalink raw reply related

* [PATCH 1/4] Net: mac80211, remove bitfields from struct ieee80211_tx_packet_data
From: Jiri Slaby @ 2007-08-12 13:08 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, jbenc-AlSwsSmVLrQ,
	flamingice-R9e9/4HEdknk1uMJSBkQmQ, jeff-o2qLIJkoznsdnm+yROfE0A

All against mac80211 tree

--

mac80211, remove bitfields from struct ieee80211_tx_packet_data

Signed-off-by: Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

---
commit 10e9252a35d42fb92e65dfaaef136d81dbb71c4f
tree f8579cff30dc8053b770b78582a30961b7320046
parent a050b807aede7f33339c6bee0bef1c07cd9c5fc4
author Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sun, 12 Aug 2007 11:14:36 +0200
committer Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sun, 12 Aug 2007 11:14:36 +0200

 net/mac80211/ieee80211.c     |   15 +++++++++++----
 net/mac80211/ieee80211_i.h   |   11 ++++++-----
 net/mac80211/ieee80211_sta.c |    6 ++++--
 net/mac80211/rx.c            |    4 ++--
 net/mac80211/tx.c            |   23 ++++++++++++-----------
 net/mac80211/wme.c           |    4 ++--
 6 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 9ff86ee..0952237 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -933,10 +933,17 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
 
 	pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
 	pkt_data->ifindex = control->ifindex;
-	pkt_data->mgmt_iface = (control->type == IEEE80211_IF_TYPE_MGMT);
-	pkt_data->req_tx_status = !!(control->flags & IEEE80211_TXCTL_REQ_TX_STATUS);
-	pkt_data->do_not_encrypt = !!(control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT);
-	pkt_data->requeue = !!(control->flags & IEEE80211_TXCTL_REQUEUE);
+	pkt_data->flags &= ~(IEEE80211_TXPD_REQ_TX_STATUS |
+		IEEE80211_TXPD_DO_NOT_ENCRYPT | IEEE80211_TXPD_REQUEUE |
+		IEEE80211_TXPD_MGMT_IFACE);
+	if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)
+		pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
+	if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)
+		pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
+	if (control->flags & IEEE80211_TXCTL_REQUEUE)
+		pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
+	if (control->type == IEEE80211_IF_TYPE_MGMT)
+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
 	pkt_data->queue = control->queue;
 
 	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 4599d55..265893a 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -170,11 +170,12 @@ struct ieee80211_txrx_data {
 struct ieee80211_tx_packet_data {
 	int ifindex;
 	unsigned long jiffies;
-	unsigned int req_tx_status:1;
-	unsigned int do_not_encrypt:1;
-	unsigned int requeue:1;
-	unsigned int mgmt_iface:1;
-	unsigned int queue:4;
+#define IEEE80211_TXPD_REQ_TX_STATUS	BIT(0)
+#define IEEE80211_TXPD_DO_NOT_ENCRYPT	BIT(1)
+#define IEEE80211_TXPD_REQUEUE		BIT(2)
+#define IEEE80211_TXPD_MGMT_IFACE	BIT(3)
+	unsigned int flags;
+	u8 queue;
 };
 
 struct ieee80211_tx_stored_packet {
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index b996332..75521ae 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -506,8 +506,10 @@ static void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = sdata->dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
-	pkt_data->do_not_encrypt = !encrypt;
+	if (sdata->type == IEEE80211_IF_TYPE_MGMT)
+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
+	if (!encrypt)
+		pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
 
 	dev_queue_xmit(skb);
 }
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 0a10720..948eb2f 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -415,7 +415,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
 	while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
 		pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 		sent++;
-		pkt_data->requeue = 1;
+		pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
 		dev_queue_xmit(skb);
 	}
 	while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
@@ -427,7 +427,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
 		       "since STA not sleeping anymore\n", dev->name,
 		       MAC_ARG(sta->addr), sta->aid);
 #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
-		pkt_data->requeue = 1;
+		pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
 		dev_queue_xmit(skb);
 	}
 
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b57a592..3d05f8f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1248,11 +1248,11 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
 
 	control.ifindex = odev->ifindex;
 	control.type = osdata->type;
-	if (pkt_data->req_tx_status)
+	if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS)
 		control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
-	if (pkt_data->do_not_encrypt)
+	if (pkt_data->flags & IEEE80211_TXPD_DO_NOT_ENCRYPT)
 		control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
-	if (pkt_data->requeue)
+	if (pkt_data->flags & IEEE80211_TXPD_REQUEUE)
 		control.flags |= IEEE80211_TXCTL_REQUEUE;
 	control.queue = pkt_data->queue;
 
@@ -1294,8 +1294,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
 	/* needed because we set skb device to master */
 	pkt_data->ifindex = dev->ifindex;
 
-	pkt_data->mgmt_iface = 0;
-	pkt_data->do_not_encrypt = 1;
+	pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
 
 	/*
 	 * fix up the pointers accounting for the radiotap
@@ -1346,7 +1345,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
 	struct ieee80211_hdr hdr;
 	const u8 *encaps_data;
 	int encaps_len, skip_header_bytes;
-	int nh_pos, h_pos, no_encrypt = 0;
+	int nh_pos, h_pos;
 	struct sta_info *sta;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1492,8 +1491,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
 	pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
-	pkt_data->do_not_encrypt = no_encrypt;
+	if (sdata->type == IEEE80211_IF_TYPE_MGMT)
+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
 
 	skb->dev = local->mdev;
 	sdata->stats.tx_packets++;
@@ -1551,7 +1550,8 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
 	pkt_data->ifindex = sdata->dev->ifindex;
-	pkt_data->mgmt_iface = (sdata->type == IEEE80211_IF_TYPE_MGMT);
+	if (sdata->type == IEEE80211_IF_TYPE_MGMT)
+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
 
 	skb->priority = 20; /* use hardcoded priority for mgmt TX queue */
 	skb->dev = sdata->local->mdev;
@@ -1561,12 +1561,13 @@ int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * to request TX callback for hostapd. BIT(1) is checked.
 	 */
 	if ((fc & BIT(1)) == BIT(1)) {
-		pkt_data->req_tx_status = 1;
+		pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
 		fc &= ~BIT(1);
 		hdr->frame_control = cpu_to_le16(fc);
 	}
 
-	pkt_data->do_not_encrypt = !(fc & IEEE80211_FCTL_PROTECTED);
+	if (!(fc & IEEE80211_FCTL_PROTECTED))
+		pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
 
 	sdata->stats.tx_packets++;
 	sdata->stats.tx_bytes += skb->len;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 99a792c..d3c81fe 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -110,7 +110,7 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
 		return IEEE80211_TX_QUEUE_DATA0;
 	}
 
-	if (unlikely(pkt_data->mgmt_iface)) {
+	if (unlikely(pkt_data->flags & IEEE80211_TXPD_MGMT_IFACE)) {
 		/* Data frames from hostapd (mainly, EAPOL) use AC_VO
 		* and they will include QoS control fields if
 		* the target STA is using WME. */
@@ -179,7 +179,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
 	struct Qdisc *qdisc;
 	int err, queue;
 
-	if (pkt_data->requeue) {
+	if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
 		skb_queue_tail(&q->requeued[pkt_data->queue], skb);
 		qd->q.qlen++;
 		return 0;

^ permalink raw reply related

* [PATCH 3/4] Net: mac80211, remove bitfields from struct ieee80211_if_sta
From: Jiri Slaby @ 2007-08-12 13:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, jbenc, flamingice, jeff
In-Reply-To: <32694265142306417777@wsc.cz>

mac80211, remove bitfields from struct ieee80211_if_sta

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 3fe2e620fcc758be03b87e3ca5265b10fbd60e1a
tree 2f3e78c8f801af86ac42b8de1ab4495cdcd24bc3
parent 37d65bd9e26732c7ec33a58eab6bda750b3be113
author Jiri Slaby <jirislaby@gmail.com> Sun, 12 Aug 2007 13:10:40 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 12 Aug 2007 13:10:40 +0200

 net/mac80211/debugfs_netdev.c  |   14 +++--
 net/mac80211/ieee80211.c       |    2 -
 net/mac80211/ieee80211_i.h     |   27 +++++-----
 net/mac80211/ieee80211_iface.c |    9 ++-
 net/mac80211/ieee80211_ioctl.c |   57 +++++++++++++++-------
 net/mac80211/ieee80211_sta.c   |  104 ++++++++++++++++++++++------------------
 6 files changed, 122 insertions(+), 91 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 806c5bd..fa3b153 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -373,13 +373,13 @@ static ssize_t ieee80211_if_fmt_flags(
 	const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
 {
 	return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n",
-			 sdata->u.sta.ssid_set ? "SSID\n" : "",
-			 sdata->u.sta.bssid_set ? "BSSID\n" : "",
-			 sdata->u.sta.prev_bssid_set ? "prev BSSID\n" : "",
-			 sdata->u.sta.authenticated ? "AUTH\n" : "",
-			 sdata->u.sta.associated ? "ASSOC\n" : "",
-			 sdata->u.sta.probereq_poll ? "PROBEREQ POLL\n" : "",
-			 sdata->use_protection ? "CTS prot\n" : "");
+		 sdata->u.sta.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "",
+		 sdata->u.sta.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "",
+		 sdata->u.sta.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "",
+		 sdata->u.sta.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
+		 sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
+		 sdata->u.sta.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
+		 sdata->use_protection ? "CTS prot\n" : "");
 }
 __IEEE80211_IF_FILE(flags);
 
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 0952237..8a6e66f 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -382,7 +382,7 @@ static void ieee80211_if_open(struct net_device *dev)
 	switch (sdata->type) {
 	case IEEE80211_IF_TYPE_STA:
 	case IEEE80211_IF_TYPE_IBSS:
-		sdata->u.sta.prev_bssid_set = 0;
+		sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
 		break;
 	}
 }
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c48c896..2c20382 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -263,19 +263,20 @@ struct ieee80211_if_sta {
 
 	int auth_tries, assoc_tries;
 
-	unsigned int ssid_set:1;
-	unsigned int bssid_set:1;
-	unsigned int prev_bssid_set:1;
-	unsigned int authenticated:1;
-	unsigned int associated:1;
-	unsigned int probereq_poll:1;
-	unsigned int create_ibss:1;
-	unsigned int mixed_cell:1;
-	unsigned int wmm_enabled:1;
-	unsigned int ht_enabled:1;
-	unsigned int auto_ssid_sel:1;
-	unsigned int auto_bssid_sel:1;
-	unsigned int auto_channel_sel:1;
+#define IEEE80211_STA_SSID_SET		BIT(0)
+#define IEEE80211_STA_BSSID_SET		BIT(1)
+#define IEEE80211_STA_PREV_BSSID_SET	BIT(2)
+#define IEEE80211_STA_AUTHENTICATED	BIT(3)
+#define IEEE80211_STA_ASSOCIATED	BIT(4)
+#define IEEE80211_STA_PROBEREQ_POLL	BIT(5)
+#define IEEE80211_STA_CREATE_IBSS	BIT(6)
+#define IEEE80211_STA_MIXED_CELL	BIT(7)
+#define IEEE80211_STA_WMM_ENABLED	BIT(8)
+#define IEEE80211_STA_HT_ENABLED	BIT(9)
+#define IEEE80211_STA_AUTO_SSID_SEL	BIT(10)
+#define IEEE80211_STA_AUTO_BSSID_SEL	BIT(11)
+#define IEEE80211_STA_AUTO_CHANNEL_SEL	BIT(12)
+	unsigned int flags;
 #define IEEE80211_STA_REQ_SCAN 0
 #define IEEE80211_STA_REQ_AUTH 1
 #define IEEE80211_STA_REQ_RUN  2
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index edd1535..c5e0288 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -191,11 +191,10 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
 		ifsta->capab = WLAN_CAPABILITY_ESS;
 		ifsta->auth_algs = IEEE80211_AUTH_ALG_OPEN |
 			IEEE80211_AUTH_ALG_SHARED_KEY;
-		ifsta->create_ibss = 1;
-		ifsta->wmm_enabled = 1;
-		ifsta->ht_enabled = 1;
-		ifsta->auto_channel_sel = 1;
-		ifsta->auto_bssid_sel = 1;
+		ifsta->flags |= IEEE80211_STA_CREATE_IBSS |
+			IEEE80211_STA_WMM_ENABLED | IEEE80211_STA_HT_ENABLED |
+			IEEE80211_STA_AUTO_BSSID_SEL |
+			IEEE80211_STA_AUTO_CHANNEL_SEL;
 
 		/* Initialize non-AP QSTA QoS Params */
 		ifsta->dot11EDCAAveragingPeriod = 5;
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 009ed1c..6283e83 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -1113,7 +1113,7 @@ static int ieee80211_set_gen_ie(struct net_device *dev, u8 *ie, size_t len)
 		int ret = ieee80211_sta_set_extra_ie(dev, ie, len);
 		if (ret)
 			return ret;
-		sdata->u.sta.auto_bssid_sel = 0;
+		sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
 		ieee80211_sta_req_auth(dev, &sdata->u.sta);
 		return 0;
 	}
@@ -1615,13 +1615,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	if (sdata->type == IEEE80211_IF_TYPE_STA)
-		sdata->u.sta.auto_channel_sel = 0;
+		sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
 
 	/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
 	if (freq->e == 0) {
 		if (freq->m < 0) {
 			if (sdata->type == IEEE80211_IF_TYPE_STA)
-				sdata->u.sta.auto_channel_sel = 1;
+				sdata->u.sta.flags |=
+					IEEE80211_STA_AUTO_CHANNEL_SEL;
 			return 0;
 		} else
 			return ieee80211_set_channel(local, freq->m, -1);
@@ -1676,7 +1677,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
 			sdata->u.sta.ssid_len = len;
 			return 0;
 		}
-		sdata->u.sta.auto_ssid_sel = !data->flags;
+		if (data->flags)
+			sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
+		else
+			sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
 		ret = ieee80211_sta_set_ssid(dev, ssid, len);
 		if (ret)
 			return ret;
@@ -1743,13 +1747,13 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
 			       ETH_ALEN);
 			return 0;
 		}
-		if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) {
-			sdata->u.sta.auto_bssid_sel = 1;
-			sdata->u.sta.auto_channel_sel = 1;
-		} else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
-			sdata->u.sta.auto_bssid_sel = 1;
+		if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
+			sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
+				IEEE80211_STA_AUTO_CHANNEL_SEL;
+		else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
+			sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
 		else
-			sdata->u.sta.auto_bssid_sel = 0;
+			sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
 		ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
 		if (ret)
 			return ret;
@@ -2294,8 +2298,12 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
 		if (sdata->type != IEEE80211_IF_TYPE_STA &&
 		    sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
-		else
-			sdata->u.sta.mixed_cell = !!value;
+		else {
+			if (value)
+				sdata->u.sta.flags |= IEEE80211_STA_MIXED_CELL;
+			else
+				sdata->u.sta.flags &= ~IEEE80211_STA_MIXED_CELL;
+		}
 		break;
 
 	case PRISM2_PARAM_KEY_MGMT:
@@ -2312,15 +2320,23 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
 	case PRISM2_PARAM_CREATE_IBSS:
 		if (sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
-		else
-			sdata->u.sta.create_ibss = !!value;
+		else {
+			if (value)
+				sdata->u.sta.flags |= IEEE80211_STA_CREATE_IBSS;
+			else
+				sdata->u.sta.flags &= ~IEEE80211_STA_CREATE_IBSS;
+		}
 		break;
 	case PRISM2_PARAM_WMM_ENABLED:
 		if (sdata->type != IEEE80211_IF_TYPE_STA &&
 		    sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
-		else
-			sdata->u.sta.wmm_enabled = !!value;
+		else {
+			if (value)
+				sdata->u.sta.flags |= IEEE80211_STA_WMM_ENABLED;
+			else
+				sdata->u.sta.flags &= ~IEEE80211_STA_WMM_ENABLED;
+		}
 		break;
 	case PRISM2_PARAM_RADAR_DETECT:
 		local->hw.conf.radar_detect = value;
@@ -2463,7 +2479,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
 		if (sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
 		else
-			*param = !!sdata->u.sta.create_ibss;
+			*param = !!(sdata->u.sta.flags &
+					IEEE80211_STA_CREATE_IBSS);
 		break;
 
 	case PRISM2_PARAM_MIXED_CELL:
@@ -2471,7 +2488,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
 		    sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
 		else
-			*param = !!sdata->u.sta.mixed_cell;
+			*param = !!(sdata->u.sta.flags &
+					IEEE80211_STA_MIXED_CELL);
 		break;
 
 	case PRISM2_PARAM_KEY_MGMT:
@@ -2485,7 +2503,8 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
 		    sdata->type != IEEE80211_IF_TYPE_IBSS)
 			ret = -EINVAL;
 		else
-			*param = !!sdata->u.sta.wmm_enabled;
+			*param = !!(sdata->u.sta.flags &
+					IEEE80211_STA_WMM_ENABLED);
 		break;
 	case PRISM2_PARAM_MGMT_IF:
 		if (local->apdev)
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 75521ae..e6a1e8d 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -444,18 +444,20 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev,
 
 
 static void ieee80211_set_associated(struct net_device *dev,
-				     struct ieee80211_if_sta *ifsta, int assoc)
+				     struct ieee80211_if_sta *ifsta,
+				     unsigned int assoc)
 {
 	union iwreq_data wrqu;
 
-	if (ifsta->associated == assoc)
+	if (!!(ifsta->flags & IEEE80211_STA_ASSOCIATED) == assoc)
 		return;
 
-	ifsta->associated = assoc;
-
 	if (assoc) {
 		struct ieee80211_sub_if_data *sdata;
 		struct ieee80211_sta_bss *bss;
+
+		ifsta->flags |= IEEE80211_STA_ASSOCIATED;
+
 		sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 		if (sdata->type != IEEE80211_IF_TYPE_STA)
 			return;
@@ -468,11 +470,13 @@ static void ieee80211_set_associated(struct net_device *dev,
 		}
 
 		netif_carrier_on(dev);
-		ifsta->prev_bssid_set = 1;
+		ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
 		memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
 		memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
 		ieee80211_sta_send_associnfo(dev, ifsta);
 	} else {
+		ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
+
 		netif_carrier_off(dev);
 		ieee80211_reset_erp_info(dev);
 		memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
@@ -623,7 +627,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
 	memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN);
 	memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
 
-	if (ifsta->prev_bssid_set) {
+	if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) {
 		skb_put(skb, 10);
 		mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT,
 						   IEEE80211_STYPE_REASSOC_REQ);
@@ -675,7 +679,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
 		memcpy(pos, ifsta->extra_ie, ifsta->extra_ie_len);
 	}
 
-	if (wmm && ifsta->wmm_enabled) {
+	if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
 		pos = skb_put(skb, 9);
 		*pos++ = WLAN_EID_VENDOR_SPECIFIC;
 		*pos++ = 7; /* len */
@@ -690,7 +694,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
 
 #ifdef CONFIG_MAC80211_HT
 	/* if low level driver supports 11n, fill in 11n IE */
-	if (ht_enabled && ifsta->ht_enabled && local->ops->get_ht_capab) {
+	if (ht_enabled && (ifsta->flags & IEEE80211_STA_HT_ENABLED) &&
+	    local->ops->get_ht_capab) {
 		pos = skb_put(skb, sizeof(struct ieee80211_ht_capability)+2);
 		*pos++ = WLAN_EID_HT_CAPABILITY;
 		*pos++ = sizeof(struct ieee80211_ht_capability);
@@ -1170,7 +1175,7 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
 	struct ieee80211_sta_bss *bss;
 	int res = 0;
 
-	if (!ifsta || ifsta->mixed_cell ||
+	if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) ||
 	    ifsta->key_mgmt != IEEE80211_KEY_MGMT_NONE)
 		return 0;
 
@@ -1239,22 +1244,20 @@ static void ieee80211_associated(struct net_device *dev,
 		disassoc = 0;
 		if (time_after(jiffies,
 			       sta->last_rx + IEEE80211_MONITORING_INTERVAL)) {
-			if (ifsta->probereq_poll) {
+			if (ifsta->flags & IEEE80211_STA_PROBEREQ_POLL) {
 				printk(KERN_DEBUG "%s: No ProbeResp from "
 				       "current AP " MAC_FMT " - assume out of "
 				       "range\n",
 				       dev->name, MAC_ARG(ifsta->bssid));
 				disassoc = 1;
 				sta_info_free(sta);
-				ifsta->probereq_poll = 0;
-			} else {
+			} else
 				ieee80211_send_probe_req(dev, ifsta->bssid,
 							 local->scan_ssid,
 							 local->scan_ssid_len);
-				ifsta->probereq_poll = 1;
-			}
+			ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL;
 		} else {
-			ifsta->probereq_poll = 0;
+			ifsta->flags &= ~IEEE80211_STA_PROBEREQ_POLL;
 			if (time_after(jiffies, ifsta->last_probe +
 				       IEEE80211_PROBE_INTERVAL)) {
 				ifsta->last_probe = jiffies;
@@ -1358,7 +1361,7 @@ static void ieee80211_auth_completed(struct net_device *dev,
 				     struct ieee80211_if_sta *ifsta)
 {
 	printk(KERN_DEBUG "%s: authenticated\n", dev->name);
-	ifsta->authenticated = 1;
+	ifsta->flags |= IEEE80211_STA_AUTHENTICATED;
 	ieee80211_associate(dev, ifsta);
 }
 
@@ -1545,7 +1548,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
 	       " (reason=%d)\n",
 	       dev->name, MAC_ARG(mgmt->sa), reason_code);
 
-	if (ifsta->authenticated) {
+	if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) {
 		printk(KERN_DEBUG "%s: deauthenticated\n", dev->name);
 	}
 
@@ -1558,7 +1561,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev,
 	}
 
 	ieee80211_set_disassoc(dev, ifsta, 1);
-	ifsta->authenticated = 0;
+	ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED;
 }
 
 
@@ -1590,7 +1593,7 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev,
 	       " (reason=%d)\n",
 	       dev->name, MAC_ARG(mgmt->sa), reason_code);
 
-	if (ifsta->associated)
+	if (ifsta->flags & IEEE80211_STA_ASSOCIATED)
 		printk(KERN_DEBUG "%s: disassociated\n", dev->name);
 
 	if (ifsta->state == IEEE80211_ASSOCIATED) {
@@ -1662,7 +1665,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
 		/* if this was a reassociation, ensure we try a "full"
 		 * association next time. This works around some broken APs
 		 * which do not correctly reject reassociation requests. */
-		ifsta->prev_bssid_set = 0;
+		ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
 		return;
 	}
 
@@ -1748,7 +1751,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
 	sta->supp_rates = rates;
 #ifdef CONFIG_MAC80211_HT
 	if (elems.ht_extra_param && elems.ht_cap_param && elems.wmm_param &&
-	    ifsta->ht_enabled && local->ops->conf_ht){
+	    (ifsta->flags & IEEE80211_STA_HT_ENABLED) && local->ops->conf_ht) {
 		int rc;
 
 		rc = local->ops->conf_ht(local_to_hw(local),
@@ -1764,7 +1767,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
 
 	rate_control_rate_init(sta, local);
 
-	if (elems.wmm_param && ifsta->wmm_enabled) {
+	if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
 		sta->flags |= WLAN_STA_WME;
 		ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
 					 elems.wmm_param_len);
@@ -2431,7 +2434,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
 		return;
 	ifsta = &sdata->u.sta;
 
-	if (!ifsta->associated ||
+	if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED) ||
 	    memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
 		return;
 
@@ -2447,7 +2450,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
 	if (elems.erp_info && elems.erp_info_len >= 1)
 		ieee80211_handle_erp_ie(dev, elems.erp_info[0]);
 
-	if (elems.wmm_param && ifsta->wmm_enabled) {
+	if (elems.wmm_param && (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
 		ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param,
 					 elems.wmm_param_len);
 	}
@@ -3024,7 +3027,8 @@ static void ieee80211_sta_reset_auth(struct net_device *dev,
 	printk(KERN_DEBUG "%s: Initial auth_alg=%d\n", dev->name,
 	       ifsta->auth_alg);
 	ifsta->auth_transaction = -1;
-	ifsta->associated = ifsta->auth_tries = ifsta->assoc_tries = 0;
+	ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
+	ifsta->auth_tries = ifsta->assoc_tries = 0;
 	netif_carrier_off(dev);
 }
 
@@ -3038,8 +3042,10 @@ void ieee80211_sta_req_auth(struct net_device *dev,
 	if (sdata->type != IEEE80211_IF_TYPE_STA)
 		return;
 
-	if ((ifsta->bssid_set || ifsta->auto_bssid_sel) &&
-	    (ifsta->ssid_set || ifsta->auto_ssid_sel)) {
+	if ((ifsta->flags & (IEEE80211_STA_BSSID_SET |
+				IEEE80211_STA_AUTO_BSSID_SEL)) &&
+	    (ifsta->flags & (IEEE80211_STA_SSID_SET |
+				IEEE80211_STA_AUTO_SSID_SEL))) {
 		set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
 		queue_work(local->hw.workqueue, &ifsta->work);
 	}
@@ -3053,7 +3059,7 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta,
 	if (!memcmp(ifsta->ssid, ssid, ssid_len))
 		return 1;
 
-	if (ifsta->auto_bssid_sel)
+	if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL)
 		return 0;
 
 	hidden_ssid = 1;
@@ -3082,8 +3088,8 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 	struct ieee80211_sta_bss *bss, *selected = NULL;
 	int top_rssi = 0, freq;
 
-	if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel &&
-	    !ifsta->auto_ssid_sel) {
+	if (!(ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
+	    IEEE80211_STA_AUTO_BSSID_SEL | IEEE80211_STA_AUTO_CHANNEL_SEL))) {
 		ifsta->state = IEEE80211_AUTHENTICATE;
 		ieee80211_sta_reset_auth(dev, ifsta);
 		return 0;
@@ -3099,14 +3105,15 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 		    !!sdata->default_key)
 			continue;
 
-		if (!ifsta->auto_channel_sel && bss->freq != freq)
+		if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) &&
+		    bss->freq != freq)
 			continue;
 
-		if (!ifsta->auto_bssid_sel &&
+		if (!(ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) &&
 		    memcmp(bss->bssid, ifsta->bssid, ETH_ALEN))
 			continue;
 
-		if (!ifsta->auto_ssid_sel &&
+		if (!(ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) &&
 		    !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len))
 			continue;
 
@@ -3121,7 +3128,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 
 	if (selected) {
 		ieee80211_set_channel(local, -1, selected->freq);
-		if (!ifsta->ssid_set)
+		if (!(ifsta->flags & IEEE80211_STA_SSID_SET))
 			ieee80211_sta_set_ssid(dev, selected->ssid,
 					       selected->ssid_len);
 		ieee80211_sta_set_bssid(dev, selected->bssid);
@@ -3424,10 +3431,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
 
 		if (time_after(jiffies, ifsta->ibss_join_req +
 			       IEEE80211_IBSS_JOIN_TIMEOUT)) {
-			if (ifsta->create_ibss &&
+			if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) &&
 			    local->oper_channel->flag & IEEE80211_CHAN_W_IBSS)
 				return ieee80211_sta_create_ibss(dev, ifsta);
-			if (ifsta->create_ibss) {
+			if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) {
 				printk(KERN_DEBUG "%s: IBSS not allowed on the"
 				       " configured channel %d (%d MHz)\n",
 				       dev->name, local->hw.conf.channel,
@@ -3488,13 +3495,17 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
 	ifsta = &sdata->u.sta;
 
 	if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)
-		ifsta->prev_bssid_set = 0;
+		ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
 	memcpy(ifsta->ssid, ssid, len);
 	memset(ifsta->ssid + len, 0, IEEE80211_MAX_SSID_LEN - len);
 	ifsta->ssid_len = len;
 
-	ifsta->ssid_set = len ? 1 : 0;
-	if (sdata->type == IEEE80211_IF_TYPE_IBSS && !ifsta->bssid_set) {
+	if (len)
+		ifsta->flags |= IEEE80211_STA_SSID_SET;
+	else
+		ifsta->flags &= ~IEEE80211_STA_SSID_SET;
+	if (sdata->type == IEEE80211_IF_TYPE_IBSS &&
+	    !(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
 		ifsta->ibss_join_req = jiffies;
 		ifsta->state = IEEE80211_IBSS_SEARCH;
 		return ieee80211_sta_find_ibss(dev, ifsta);
@@ -3532,10 +3543,11 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid)
 		}
 	}
 
-	if (!is_valid_ether_addr(bssid))
-		ifsta->bssid_set = 0;
+	if (is_valid_ether_addr(bssid))
+		ifsta->flags |= IEEE80211_STA_BSSID_SET;
 	else
-		ifsta->bssid_set = 1;
+		ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
+
 	return 0;
 }
 
@@ -3602,7 +3614,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 			continue;
 
 		if (sdata->type == IEEE80211_IF_TYPE_STA) {
-			if (sdata->u.sta.associated)
+			if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)
 				ieee80211_send_nullfunc(local, sdata, 0);
 			ieee80211_sta_timer((unsigned long)sdata);
 		}
@@ -3614,7 +3626,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	if (sdata->type == IEEE80211_IF_TYPE_IBSS) {
 		struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-		if (!ifsta->bssid_set ||
+		if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
 		    (!ifsta->state == IEEE80211_IBSS_JOINED &&
 		    !ieee80211_sta_active_ibss(dev)))
 			ieee80211_sta_find_ibss(dev, ifsta);
@@ -3756,7 +3768,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev,
 
 		netif_stop_queue(sdata->dev);
 		if (sdata->type == IEEE80211_IF_TYPE_STA &&
-		    sdata->u.sta.associated)
+		    (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED))
 			ieee80211_send_nullfunc(local, sdata, 1);
 	}
 	read_unlock(&local->sub_if_lock);
@@ -4069,7 +4081,7 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason)
 	if (sdata->type != IEEE80211_IF_TYPE_STA)
 		return -EINVAL;
 
-	if (!ifsta->associated)
+	if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED))
 		return -1;
 
 	ieee80211_send_disassoc(dev, ifsta, reason);

^ permalink raw reply related

* [PATCH 2/4] Net: mac80211, remove bitfields from struct ieee80211_txrx_data
From: Jiri Slaby @ 2007-08-12 13:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, jbenc, flamingice, jeff
In-Reply-To: <32694265142306417777@wsc.cz>

mac80211, remove bitfields from struct ieee80211_txrx_data

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 37d65bd9e26732c7ec33a58eab6bda750b3be113
tree ac8e2b83c426b03007ea0bd7c5092e351598053c
parent 10e9252a35d42fb92e65dfaaef136d81dbb71c4f
author Jiri Slaby <jirislaby@gmail.com> Sun, 12 Aug 2007 11:50:05 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 12 Aug 2007 11:50:05 +0200

 net/mac80211/ieee80211_i.h |   22 ++++++++-------
 net/mac80211/rx.c          |   64 +++++++++++++++++++++++++-------------------
 net/mac80211/tx.c          |   61 +++++++++++++++++++++++++-----------------
 net/mac80211/wpa.c         |   14 +++++-----
 4 files changed, 91 insertions(+), 70 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 265893a..c48c896 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -127,13 +127,20 @@ struct ieee80211_txrx_data {
 	struct sta_info *sta;
 	u16 fc, ethertype;
 	struct ieee80211_key *key;
-	unsigned int fragmented:1; /* whether the MSDU was fragmented */
+	/* whether the MSDU was fragmented */
+#define IEEE80211_TXRXD_FRAGMENTED		BIT(0)
+#define IEEE80211_TXRXD_TXUNICAST		BIT(1)
+#define IEEE80211_TXRXD_TXPS_BUFFERED		BIT(2)
+#define IEEE80211_TXRXD_TXPROBE_LAST_FRAG	BIT(3)
+#define IEEE80211_TXRXD_RXIN_SCAN		BIT(4)
+	/* frame is destined to interface currently processed
+	 * (including multicast frames) */
+#define IEEE80211_TXRXD_RXRA_MATCH		BIT(5)
+#define IEEE80211_TXRXD_RXIS_AGG_FRAME		BIT(6)
+	unsigned int flags;
 	union {
 		struct {
 			struct ieee80211_tx_control *control;
-			unsigned int unicast:1;
-			unsigned int ps_buffered:1;
-			unsigned int probe_last_frag:1;
 			struct ieee80211_hw_mode *mode;
 			struct ieee80211_rate *rate;
 			/* use this rate (if set) for last fragment; rate can
@@ -154,11 +161,6 @@ struct ieee80211_txrx_data {
 			int queue;
 			int load;
 			u16 qos_control;
-			unsigned int in_scan:1;
-			/* frame is destined to interface currently processed
-			 * (including multicast frames) */
-			unsigned int ra_match:1;
-			unsigned int is_agg_frame:1;
 		} rx;
 	} u;
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
@@ -186,7 +188,7 @@ struct ieee80211_tx_stored_packet {
 	int last_frag_rateidx;
 	int last_frag_hwrate;
 	struct ieee80211_rate *last_frag_rate;
-	unsigned int last_frag_rate_ctrl_probe:1;
+	unsigned int last_frag_rate_ctrl_probe;
 };
 
 struct sta_ts_data {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 948eb2f..8dd7488 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -65,7 +65,10 @@ ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
 		I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
 
 	rx->u.rx.queue = tid;
-	rx->u.rx.is_agg_frame = is_agg_frame;
+	if (is_agg_frame)
+		rx->flags |= IEEE80211_TXRXD_RXIS_AGG_FRAME;
+	else
+		rx->flags &= ~IEEE80211_TXRXD_RXIS_AGG_FRAME;
 	/* Set skb->priority to 1d tag if highest order bit of TID is not set.
 	 * For now, set skb->priority to 0 for other cases. */
 	rx->skb->priority = (tid > 7) ? 0 : tid;
@@ -229,7 +232,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx)
 		return TXRX_QUEUED;
 	}
 
-	if (unlikely(rx->u.rx.in_scan)) {
+	if (unlikely(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) {
 		/* scanning finished during invoking of handlers */
 		I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
 		return TXRX_DROP;
@@ -249,7 +252,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
 		if (unlikely(rx->fc & IEEE80211_FCTL_RETRY &&
 			     rx->sta->last_seq_ctrl[rx->u.rx.queue] ==
 			     hdr->seq_ctrl)) {
-			if (rx->u.rx.ra_match) {
+			if (rx->flags & IEEE80211_TXRXD_RXRA_MATCH) {
 				rx->local->dot11FrameDuplicateCount++;
 				rx->sta->num_duplicates++;
 			}
@@ -267,7 +270,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
 		return TXRX_DROP;
 	}
 
-	if (!rx->u.rx.ra_match)
+	if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 		rx->skb->pkt_type = PACKET_OTHERHOST;
 	else if (compare_ether_addr(rx->dev->dev_addr, hdr->addr1) == 0)
 		rx->skb->pkt_type = PACKET_HOST;
@@ -295,7 +298,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
 		if ((!(rx->fc & IEEE80211_FCTL_FROMDS) &&
 		     !(rx->fc & IEEE80211_FCTL_TODS) &&
 		     (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)
-		    || !rx->u.rx.ra_match) {
+		    || !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
 			/* Drop IBSS frames and frames for other hosts
 			 * silently. */
 			return TXRX_DROP;
@@ -341,7 +344,7 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
 				rx->key = rx->sdata->keys[keyidx];
 
 			if (!rx->key) {
-				if (!rx->u.rx.ra_match)
+				if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 					return TXRX_DROP;
 				printk(KERN_DEBUG "%s: RX WEP frame with "
 				       "unknown keyidx %d (A1=" MAC_FMT " A2="
@@ -360,7 +363,8 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
 		}
 	}
 
-	if (rx->fc & IEEE80211_FCTL_PROTECTED && rx->key && rx->u.rx.ra_match) {
+	if (rx->fc & IEEE80211_FCTL_PROTECTED && rx->key &&
+	    (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
 		rx->key->tx_rx_count++;
 		if (unlikely(rx->local->key_tx_rx_threshold &&
 			     rx->key->tx_rx_count >
@@ -461,7 +465,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
 		sta->last_rx = jiffies;
 	}
 
-	if (!rx->u.rx.ra_match)
+	if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 		return TXRX_CONTINUE;
 
 	sta->rx_fragments++;
@@ -500,7 +504,8 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx)
 {
 	if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
 	    (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
-	    !rx->key || rx->key->alg != ALG_WEP || !rx->u.rx.ra_match)
+	    !rx->key || rx->key->alg != ALG_WEP ||
+	    !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 		return TXRX_CONTINUE;
 
 	/* Check for weak IVs, if hwaccel did not remove IV from the frame */
@@ -732,7 +737,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
 	}
 
 	/* Complete frame has been reassembled - process it now */
-	rx->fragmented = 1;
+	rx->flags |= IEEE80211_TXRXD_FRAGMENTED;
 
  out:
 	if (rx->sta)
@@ -753,7 +758,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
 	if (likely(!rx->sta ||
 		   (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL ||
 		   (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL ||
-		   !rx->u.rx.ra_match))
+		   !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)))
 		return TXRX_CONTINUE;
 
 	skb = skb_dequeue(&rx->sta->tx_filtered);
@@ -837,7 +842,8 @@ static ieee80211_txrx_result
 ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx)
 {
 	if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
-	    rx->sdata->type != IEEE80211_IF_TYPE_STA && rx->u.rx.ra_match) {
+	    rx->sdata->type != IEEE80211_IF_TYPE_STA &&
+	    (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
 		/* Pass both encrypted and unencrypted EAPOL frames to user
 		 * space for processing. */
 		if (!rx->local->apdev)
@@ -910,7 +916,7 @@ ieee80211_rx_h_data_agg(struct ieee80211_txrx_data *rx)
 	if (unlikely(!WLAN_FC_DATA_PRESENT(fc)))
 		return TXRX_DROP;
 
-	if (!rx->u.rx.is_agg_frame)
+	if (!(rx->flags & IEEE80211_TXRXD_RXIS_AGG_FRAME))
 		return TXRX_CONTINUE;
 
 	hdrlen = ieee80211_get_hdrlen(fc);
@@ -965,7 +971,7 @@ ieee80211_rx_h_data_agg(struct ieee80211_txrx_data *rx)
 		if (local->bridge_packets &&
 		    (sdata->type == IEEE80211_IF_TYPE_AP ||
 		     sdata->type == IEEE80211_IF_TYPE_VLAN) &&
-		     rx->u.rx.ra_match) {
+		     (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
 			if (is_multicast_ether_addr(frame->data)) {
 				/* send multicast frames both to higher layers
 				* in local net stack and back to the wireless
@@ -1149,7 +1155,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
 	sdata->stats.rx_bytes += skb->len;
 
 	if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP
-	    || sdata->type == IEEE80211_IF_TYPE_VLAN) && rx->u.rx.ra_match) {
+	    || sdata->type == IEEE80211_IF_TYPE_VLAN) &&
+	    (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
 		if (is_multicast_ether_addr(skb->data)) {
 			/* send multicast frames both to higher layers in
 			 * local net stack and back to the wireless media */
@@ -1199,7 +1206,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
 {
 	struct ieee80211_sub_if_data *sdata;
 
-	if (!rx->u.rx.ra_match)
+	if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 		return TXRX_DROP;
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
@@ -1392,30 +1399,30 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
 		if (!bssid)
 			return 0;
 		if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
-			if (!rx->u.rx.in_scan)
+			if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
 				return 0;
-			rx->u.rx.ra_match = 0;
+			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		} else if (!multicast &&
 			   compare_ether_addr(sdata->dev->dev_addr,
 					      hdr->addr1) != 0) {
 			if (!sdata->promisc)
 				return 0;
-			rx->u.rx.ra_match = 0;
+			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		}
 		break;
 	case IEEE80211_IF_TYPE_IBSS:
 		if (!bssid)
 			return 0;
 		if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
-			if (!rx->u.rx.in_scan)
+			if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
 				return 0;
-			rx->u.rx.ra_match = 0;
+			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		} else if (!multicast &&
 			   compare_ether_addr(sdata->dev->dev_addr,
 					      hdr->addr1) != 0) {
 			if (!sdata->promisc)
 				return 0;
-			rx->u.rx.ra_match = 0;
+			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		} else if (!rx->sta)
 			rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
 							 bssid, hdr->addr2);
@@ -1427,11 +1434,12 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
 				return 0;
 		} else if (!ieee80211_bssid_match(bssid,
 					sdata->dev->dev_addr)) {
-			if (!rx->u.rx.in_scan)
+			if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
 				return 0;
-			rx->u.rx.ra_match = 0;
+			rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
 		}
-		if (sdata->dev == sdata->local->mdev && !rx->u.rx.in_scan)
+		if (sdata->dev == sdata->local->mdev &&
+		    !(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
 			/* do not receive anything via
 			 * master device when not scanning */
 			return 0;
@@ -1497,7 +1505,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
 	}
 
 	if (unlikely(local->sta_scanning))
-		rx.u.rx.in_scan = 1;
+		rx.flags |= IEEE80211_TXRXD_RXIN_SCAN;
 
 	if (__ieee80211_invoke_rx_handlers(local, local->rx_pre_handlers, &rx,
 					   sta) != TXRX_CONTINUE)
@@ -1507,7 +1515,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
 	skb_push(skb, radiotap_len);
 	if (sta && !sta->assoc_ap && !(sta->flags & WLAN_STA_WDS) &&
 	    !local->iff_promiscs && !is_multicast_ether_addr(hdr->addr1)) {
-		rx.u.rx.ra_match = 1;
+		rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
 		ieee80211_invoke_rx_handlers(local, local->rx_handlers, &rx,
 					     rx.sta);
 		sta_info_put(sta);
@@ -1518,7 +1526,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
 
 	read_lock(&local->sub_if_lock);
 	list_for_each_entry(sdata, &local->sub_if_list, list) {
-		rx.u.rx.ra_match = 1;
+		rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
 
 		prepres = prepare_for_handlers(sdata, bssid, &rx, hdr);
 		/* prepare_for_handlers can change sta */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3d05f8f..bc4a3c7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -223,12 +223,12 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
 	     (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ))
 		return TXRX_DROP;
 
-	if (tx->u.tx.ps_buffered)
+	if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)
 		return TXRX_CONTINUE;
 
 	sta_flags = tx->sta ? tx->sta->flags : 0;
 
-	if (likely(tx->u.tx.unicast)) {
+	if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) {
 		if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
 			     tx->sdata->type != IEEE80211_IF_TYPE_IBSS &&
 			     (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
@@ -411,10 +411,10 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
 static ieee80211_txrx_result
 ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx)
 {
-	if (unlikely(tx->u.tx.ps_buffered))
+	if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED))
 		return TXRX_CONTINUE;
 
-	if (tx->u.tx.unicast)
+	if (tx->flags & IEEE80211_TXRXD_TXUNICAST)
 		return ieee80211_tx_h_unicast_ps_buf(tx);
 	else
 		return ieee80211_tx_h_multicast_ps_buf(tx);
@@ -468,7 +468,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
 	u8 *pos;
 	int frag_threshold = tx->local->fragmentation_threshold;
 
-	if (!tx->fragmented)
+	if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED))
 		return TXRX_CONTINUE;
 
 	first = tx->skb;
@@ -605,7 +605,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
 					      &extra);
 	if (unlikely(extra.probe != NULL)) {
 		tx->u.tx.control->flags |= IEEE80211_TXCTL_RATE_CTRL_PROBE;
-		tx->u.tx.probe_last_frag = 1;
+		tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
 		tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val;
 		tx->u.tx.rate = extra.probe;
 	} else {
@@ -614,11 +614,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
 	if (!tx->u.tx.rate)
 		return TXRX_DROP;
 	if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
-	    tx->sdata->use_protection && tx->fragmented &&
-	    extra.nonerp) {
+	    tx->sdata->use_protection &&
+	    (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
 		tx->u.tx.last_frag_rate = tx->u.tx.rate;
-		tx->u.tx.probe_last_frag = extra.probe ? 1 : 0;
-
+		if (extra.probe)
+			tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
+		else
+			tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
 		tx->u.tx.rate = extra.nonerp;
 		tx->u.tx.control->rate = extra.nonerp;
 		tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
@@ -655,7 +657,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
 		control->retry_limit = 1;
 	}
 
-	if (tx->fragmented) {
+	if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) {
 		/* Do not use multiple retry rates when sending fragmented
 		 * frames.
 		 * TODO: The last fragment could still use multiple retry
@@ -668,7 +670,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
 	 * for the frame. */
 	if (mode->mode == MODE_IEEE80211G &&
 	    (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
-	    tx->u.tx.unicast && tx->sdata->use_protection &&
+	    (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
+	    tx->sdata->use_protection &&
 	    !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
 		control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
 
@@ -686,8 +689,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
 	 * for remaining fragments will be updated when they are being sent
 	 * to low-level driver in ieee80211_tx(). */
 	dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
-				 tx->fragmented ? tx->u.tx.extra_frag[0]->len :
-				 0);
+				 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ?
+				 tx->u.tx.extra_frag[0]->len : 0);
 	hdr->duration_id = cpu_to_le16(dur);
 
 	if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
@@ -979,15 +982,20 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
 	}
 
 	tx->u.tx.control = control;
-	tx->u.tx.unicast = !is_multicast_ether_addr(hdr->addr1);
-	if (is_multicast_ether_addr(hdr->addr1))
+	if (is_multicast_ether_addr(hdr->addr1)) {
+		tx->flags &= ~IEEE80211_TXRXD_TXUNICAST;
 		control->flags |= IEEE80211_TXCTL_NO_ACK;
-	else
+	} else {
+		tx->flags |= IEEE80211_TXRXD_TXUNICAST;
 		control->flags &= ~IEEE80211_TXCTL_NO_ACK;
-	tx->fragmented = local->fragmentation_threshold <
-		IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast &&
-		skb->len + FCS_LEN > local->fragmentation_threshold &&
-		(!local->ops->set_frag_threshold);
+	}
+	if (local->fragmentation_threshold < IEEE80211_MAX_FRAG_THRESHOLD &&
+	    (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
+	    skb->len + FCS_LEN > local->fragmentation_threshold &&
+	    !local->ops->set_frag_threshold)
+		tx->flags |= IEEE80211_TXRXD_FRAGMENTED;
+	else
+		tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED;
 	if (!tx->sta)
 		control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK;
 	else if (tx->sta->clear_dst_mask) {
@@ -1058,7 +1066,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
 			if (i == tx->u.tx.num_extra_frag) {
 				control->tx_rate = tx->u.tx.last_frag_hwrate;
 				control->rate = tx->u.tx.last_frag_rate;
-				if (tx->u.tx.probe_last_frag)
+				if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG)
 					control->flags |=
 						IEEE80211_TXCTL_RATE_CTRL_PROBE;
 				else
@@ -1189,7 +1197,8 @@ retry:
 		store->num_extra_frag = tx.u.tx.num_extra_frag;
 		store->last_frag_hwrate = tx.u.tx.last_frag_hwrate;
 		store->last_frag_rate = tx.u.tx.last_frag_rate;
-		store->last_frag_rate_ctrl_probe = tx.u.tx.probe_last_frag;
+		store->last_frag_rate_ctrl_probe =
+			!!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG);
 	}
 	return 0;
 
@@ -1618,7 +1627,9 @@ void ieee80211_tx_pending(unsigned long data)
 		tx.u.tx.num_extra_frag = store->num_extra_frag;
 		tx.u.tx.last_frag_hwrate = store->last_frag_hwrate;
 		tx.u.tx.last_frag_rate = store->last_frag_rate;
-		tx.u.tx.probe_last_frag = store->last_frag_rate_ctrl_probe;
+		tx.flags = 0;
+		if (store->last_frag_rate_ctrl_probe)
+			tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
 		ret = __ieee80211_tx(local, store->skb, &tx);
 		if (ret) {
 			if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1864,7 +1875,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
 		dev_kfree_skb_any(skb);
 	}
 	sta = tx.sta;
-	tx.u.tx.ps_buffered = 1;
+	tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED;
 
 	for (handler = local->tx_handlers; *handler != NULL; handler++) {
 		res = (*handler)(&tx);
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 2806886..e0d735a 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -97,14 +97,14 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
 
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	if ((tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC) ||
-	    (!tx->u.tx.unicast &&
+	    (!(tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
 	     tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC)) {
 		wpa_test = 1;
 	}
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
 	if (!tx->key->force_sw_encrypt &&
-	    !tx->fragmented &&
+	    !(tx->flags & IEEE80211_TXRXD_FRAGMENTED) &&
 	    !(tx->local->hw.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) &&
 	    !wpa_test) {
 		/* hwaccel - with no need for preallocated room for Michael MIC
@@ -142,7 +142,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
 		tx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_MIC;
 		tx->wpa_test = 1;
 		mic[0]++;
-	} else if (!tx->u.tx.unicast &&
+	} else if (!(tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
 		   tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_MIC) {
 		printk(KERN_INFO "%s: WPA testing - corrupting TX Michael MIC "
 		       "for Group Key\n", tx->dev->name);
@@ -193,7 +193,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
 		/* Need to verify Michael MIC sometimes in software even when
 		 * hwaccel is used. Atheros ar5212: fragmented frames and QoS
 		 * frames. */
-		if (!rx->fragmented && !wpa_test)
+		if (!(rx->flags & IEEE80211_TXRXD_FRAGMENTED) && !wpa_test)
 			goto remove_mic;
 	}
 
@@ -225,7 +225,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
 		int i;
 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
 
-		if (!rx->u.rx.ra_match)
+		if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
 			return TXRX_DROP;
 
 		printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "
@@ -392,7 +392,7 @@ ieee80211_tx_h_tkip_encrypt(struct ieee80211_txrx_data *tx)
 
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
 	if ((tx->sta && tx->sta->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV) ||
-	    (!tx->u.tx.unicast &&
+	    (!(tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
 	     tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV)) {
 		wpa_test = 1;
 	}
@@ -453,7 +453,7 @@ ieee80211_tx_h_tkip_encrypt(struct ieee80211_txrx_data *tx)
 		tx->u.tx.control->key_idx = HW_KEY_IDX_INVALID;
 		tx->sta->wpa_trigger &= ~WPA_TRIGGER_FAIL_TX_ICV;
 		skb->data[skb->len - 1]++;
-	} else if (!tx->u.tx.unicast &&
+	} else if (!(tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
 		   tx->local->wpa_trigger & WPA_TRIGGER_FAIL_TX_ICV) {
 		printk(KERN_INFO "%s: WPA testing - corrupting TX TKIP ICV "
 		       "for Group Key\n",

^ permalink raw reply related

* Re: [RFC: -mm patch] improve the SSB dependencies
From: Michael Buesch @ 2007-08-12 12:00 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Adrian Bunk, Johannes Berg, John Linville, Andrew Morton,
	Linux Netdev List
In-Reply-To: <20070811230855.GA8907@stusta.de>

Ok, I'll give it a try, with small modifications.

On Sunday 12 August 2007, Adrian Bunk wrote:
> Additional changes in this patch:
> - small help text changes
> - B44_PCI is no longer usr visible (automatically enabled when possible)

I think we want that to be selectable, as it's not needed
on some embedded devices. And we need to save memory there.

> - let SSB_SILENT depend on EMBEDDED (unless you are in a very
>   space restricted environment you don't need to enable it)

Good idea.

> - make the following options no longer user visible
>   (they are select'ed when required):
>   - SSB_PCIHOST

>   - SSB_DRIVER_PCICORE

No, we need that to be selectable.

>   - SSB_PCMCIAHOST
> 
> 
> Signed-off-by: Adrian Bunk <bunk@kernel.org>
> 
> ---
> 
>  drivers/net/Kconfig                           |   12 ---
>  drivers/net/wireless/bcm43xx-mac80211/Kconfig |   10 +-
>  drivers/ssb/Kconfig                           |   72 ++++++++++--------
>  drivers/usb/host/Kconfig                      |    4 -
>  4 files changed, 51 insertions(+), 47 deletions(-)
> 
> 6ed573214282b96e7714b33b89a7221c01efbb86 
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index cea1979..a4f0c2f 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -1435,6 +1435,7 @@ config APRICOT
>  config B44
>  	tristate "Broadcom 440x/47xx ethernet support"
>  	depends on HAS_IOMEM
> +	depends on SSB_POSSIBLE
>  	select SSB
>  	select MII
>  	help
> @@ -1452,17 +1453,10 @@ config B44
>  	  called b44.
>  
>  config B44_PCI
> -	bool "Broadcom 440x PCI device support"
> -	depends on B44 && NET_PCI
> -	select SSB_PCIHOST
> +	bool
> +	depends on B44 && SSB_DRIVER_PCICORE_POSSIBLE
>  	select SSB_DRIVER_PCICORE
>  	default y
> -	help
> -	  Support for Broadcom 440x PCI devices.
> -
> -	  Say Y, unless you know what you are doing.
> -	  If you say N here I will _not_ listen to your
> -	  bugreports!
>  
>  config FORCEDETH
>  	tristate "nForce Ethernet support"
> diff --git a/drivers/net/wireless/bcm43xx-mac80211/Kconfig b/drivers/net/wireless/bcm43xx-mac80211/Kconfig
> index 8f9df0e..8af8535 100644
> --- a/drivers/net/wireless/bcm43xx-mac80211/Kconfig
> +++ b/drivers/net/wireless/bcm43xx-mac80211/Kconfig
> @@ -1,6 +1,6 @@
>  config BCM43XX_MAC80211
>  	tristate "Broadcom BCM43xx wireless support (mac80211 stack)"
> -	depends on MAC80211 && WLAN_80211 && EXPERIMENTAL
> +	depends on MAC80211 && WLAN_80211 && SSB_POSSIBLE && EXPERIMENTAL
>  	select FW_LOADER
>  	select SSB
>  	select HW_RANDOM
> @@ -10,8 +10,8 @@ config BCM43XX_MAC80211
>  
>  config BCM43XX_MAC80211_PCI
>  	bool "BCM43xx PCI device support"
> -	depends on BCM43XX_MAC80211 && PCI
> -	select SSB_PCIHOST
> +	depends on BCM43XX_MAC80211
> +	depends on SSB_DRIVER_PCICORE_POSSIBLE
>  	select SSB_DRIVER_PCICORE
>  	default y
>  	---help---
> @@ -24,7 +24,7 @@ config BCM43XX_MAC80211_PCI
>  
>  config BCM43XX_MAC80211_PCMCIA
>  	bool "BCM43xx PCMCIA device support"
> -	depends on BCM43XX_MAC80211 && PCMCIA
> +	depends on BCM43XX_MAC80211 && SSB_PCMCIAHOST_POSSIBLE
>  	select SSB_PCMCIAHOST
>  	---help---
>  	  Broadcom 43xx PCMCIA device support.
> @@ -45,7 +45,7 @@ config BCM43XX_MAC80211_PCMCIA
>  config BCM43XX_MAC80211_DEBUG
>  	bool "Broadcom BCM43xx debugging (RECOMMENDED)"
>  	depends on BCM43XX_MAC80211
> -	select SSB_DEBUG if !SSB_SILENT
> +	select SSB_DEBUG if SSB_DEBUG_POSSIBLE
>  	default y
>  	---help---
>  	  Broadcom 43xx debugging messages.
> diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
> index 094703c..366c888 100644
> --- a/drivers/ssb/Kconfig
> +++ b/drivers/ssb/Kconfig
> @@ -1,37 +1,42 @@
>  menu "Sonics Silicon Backplane"
>  
> +config SSB_POSSIBLE
> +	bool
> +	depends on EXPERIMENTAL && HAS_IOMEM
> +	default y
> +
>  config SSB
>  	tristate "Sonics Silicon Backplane support"
> -	depends on EXPERIMENTAL && HAS_IOMEM
> +	depends on SSB_POSSIBLE
>  	help
> -	  Support for the Sonics Silicon Backplane bus
> +	  Support for the Sonics Silicon Backplane bus.
> +	  You only need to enable this option if you are
> +	  configuring a kernel for an embedded system with
> +	  this bus.
>  
> -	  The module will be called ssb
> +	  The module will be called ssb.
>  
> -	  If unsure, say M
> +	  If unsure, say N.
>  
> -config SSB_PCIHOST
> -	bool "Support for SSB on PCI-bus host"
> -	depends on SSB && PCI
> +config SSB_PCIHOST_POSSIBLE
> +	bool
> +	depends on SSB_POSSIBLE && PCI
>  	default y
> -	help
> -	  Support for a Sonics Silicon Backplane on top
> -	  of a PCI device.
>  
> -	  If unsure, say Y
> +config SSB_PCIHOST
> +	bool
>  
> -config SSB_PCMCIAHOST
> -	bool "Support for SSB on PCMCIA-bus host"
> -	depends on SSB && PCMCIA
> -	help
> -	  Support for a Sonics Silicon Backplane on top
> -	  of a PCMCIA device.
> +config SSB_PCMCIAHOST_POSSIBLE
> +	bool
> +	depends on SSB_POSSIBLE && PCMCIA
> +	default y
>  
> -	  If unsure, say N
> +config SSB_PCMCIAHOST
> +	bool
>  
>  config SSB_SILENT
>  	bool "No SSB kernel messages"
> -	depends on SSB
> +	depends on SSB && EMBEDDED
>  	help
>  	  This option turns off all Sonics Silicon Backplane printks.
>  	  Note that you won't be able to identify problems, once
> @@ -39,30 +44,35 @@ config SSB_SILENT
>  	  This might only be desired for production kernels on
>  	  embedded devices to reduce the kernel size.
>  
> -	  Say N
> +	  If unsure, say N.
> +
> +config SSB_DEBUG_POSSIBLE
> +	bool
> +	depends on SSB && !SSB_SILENT
> +	default y
>  
>  config SSB_DEBUG
>  	bool "SSB debugging"
> -	depends on SSB && !SSB_SILENT
> +	depends on SSB_DEBUG_POSSIBLE
>  	help
>  	  This turns on additional runtime checks and debugging
>  	  messages. Turn this on for SSB troubleshooting.
>  
> -	  If unsure, say N
> +	  If unsure, say N.
>  
>  config SSB_SERIAL
>  	bool
>  	depends on SSB
>  	# ChipCommon and ExtIf serial support routines.
>  
> -config SSB_DRIVER_PCICORE
> -	bool "SSB PCI core driver"
> -	depends on SSB && SSB_PCIHOST
> -	help
> -	  Driver for the Sonics Silicon Backplane attached
> -	  Broadcom PCI core.
> +config SSB_DRIVER_PCICORE_POSSIBLE
> +	bool
> +	depends on SSB_PCIHOST_POSSIBLE
> +	default y
>  
> -	  If unsure, say Y
> +config SSB_DRIVER_PCICORE
> +	bool
> +	select SSB_PCIHOST
>  
>  config SSB_PCICORE_HOSTMODE
>  	bool "Hostmode support for SSB PCI core"
> @@ -78,7 +88,7 @@ config SSB_DRIVER_MIPS
>  	  Driver for the Sonics Silicon Backplane attached
>  	  Broadcom MIPS core.
>  
> -	  If unsure, say N
> +	  If unsure, say N.
>  
>  config SSB_DRIVER_EXTIF
>  	bool "SSB Broadcom EXTIF core driver"
> @@ -87,6 +97,6 @@ config SSB_DRIVER_EXTIF
>  	  Driver for the Sonics Silicon Backplane attached
>  	  Broadcom EXTIF core.
>  
> -	  If unsure, say N
> +	  If unsure, say N.
>  
>  endmenu
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index dc3b7fe..d7f5328 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -101,6 +101,7 @@ config USB_OHCI_HCD
>  	depends on USB && USB_ARCH_HAS_OHCI
>  	select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
>  	select I2C if ARCH_PNX4008
> +	select SSB if USB_OHCI_HCD_SSB
>  	---help---
>  	  The Open Host Controller Interface (OHCI) is a standard for accessing
>  	  USB 1.1 host controller hardware.  It does more in hardware than Intel's
> @@ -156,8 +157,7 @@ config USB_OHCI_HCD_PCI
>  
>  config USB_OHCI_HCD_SSB
>  	bool "OHCI support for the Broadcom SSB OHCI core (embedded systems only)"
> -	depends on USB_OHCI_HCD && ((USB_OHCI_HCD=m && SSB) || (USB_OHCI_HCD=y && SSB=y)) && EXPERIMENTAL
> -	default n
> +	depends on USB_OHCI_HCD && SSB_POSSIBLE && EXPERIMENTAL
>  	---help---
>  	  Support for the Sonics Silicon Backplane (SSB) attached
>  	  Broadcom USB OHCI core.
> 
> 
> 



^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Evgeniy Polyakov @ 2007-08-12 11:51 UTC (permalink / raw)
  To: Al Boldi; +Cc: linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <200708121335.17267.a1426z@gawab.com>

On Sun, Aug 12, 2007 at 01:35:17PM +0300, Al Boldi (a1426z@gawab.com) wrote:
> Lars Ellenberg wrote:
> > meanwhile, please, anyone interessted,
> > the drbd paper for LinuxConf Eu 2007 is finalized.
> > http://www.drbd.org/fileadmin/drbd/publications/
> > drbd8.linux-conf.eu.2007.pdf
> >
> > it does not give too much implementation detail (would be inapropriate
> > for conference proceedings, imo; some paper commenting on the source
> > code should follow).
> >
> > but it does give a good overview about what DRBD actually is,
> > what exact problems it tries to solve,
> > and what developments to expect in the near future.
> >
> > so you can make up your mind about
> >  "Do we need it?", and
> >  "Why DRBD? Why not NBD + MD-RAID?"
> 
> Ok, conceptually your driver sounds really interresting, but when I read the 
> pdf I got completely turned off.  The problem is that the concepts are not 
> clearly implemented, when in fact the concepts are really simple:
> 
>   Allow shared access to remote block storage with fault tolerance.
> 
> The first thing to tackle here would be write serialization.  Then start 
> thinking about fault tolerance.
> 
> Now, shared remote block access should theoretically be handled, as does 
> DRBD, by a block layer driver, but realistically it may be more appropriate 
> to let it be handled by the combining end user, like OCFS or GFS.
> 
> The idea here is to simplify lower layer implementations while removing any 
> preconceived dependencies, and let upper layers reign free without incurring 
> redundant overhead.
> 
> Look at ZFS; it illegally violates layering by combining md/dm/lvm with the 
> fs, but it does this based on a realistic understanding of the problems 
> involved, which enables it to improve performance, flexibility, and 
> functionality specific to its use case.
> 
> This implies that there are two distinct forces at work here:
> 
>   1. Layer components
>   2. Use-Case composers
> 
> Layer components should technically not implement any use case (other than 
> providing a plumbing framework), as that would incur unnecessary 
> dependencies, which could reduce its generality and thus reusability.
> 
> Use-Case composers can now leverage layer components from across the layering 
> hierarchy, to yield a specific use case implementation.
> 
> DRBD is such a Use-Case composer, as is mdm / dm / lvm and any fs in general, 
> whereas aoe / nbd / loop and the VFS / FUSE are examples of layer 
> components.
> 
> It follows that Use-case composers, like DRBD, need common functionality that 
> should be factored out into layer components, and then recompose to 
> implement a specific use case.

Out of curiosity, did you try ndb+dm+raid1 compared to drbd and/or zfs
on top of distributed storage (which is a urprise to me, that holy zfs
suppors that)?
 
> Thanks!
> 
> --
> Al
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
	Evgeniy Polyakov

^ permalink raw reply

* Re: [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Jan Engelhardt @ 2007-08-12 11:28 UTC (permalink / raw)
  To: Al Boldi; +Cc: linux-kernel, linux-fsdevel, netdev, linux-raid
In-Reply-To: <200708121335.17267.a1426z@gawab.com>


On Aug 12 2007 13:35, Al Boldi wrote:
>Lars Ellenberg wrote:
>> meanwhile, please, anyone interessted,
>> the drbd paper for LinuxConf Eu 2007 is finalized.
>> http://www.drbd.org/fileadmin/drbd/publications/
>> drbd8.linux-conf.eu.2007.pdf
>>
>> but it does give a good overview about what DRBD actually is,
>> what exact problems it tries to solve,
>> and what developments to expect in the near future.
>>
>> so you can make up your mind about
>>  "Do we need it?", and
>>  "Why DRBD? Why not NBD + MD-RAID?"

I may have made a mistake when asking for how it compares to NBD+MD.
Let me retry: what's the functional difference between
GFS2 on a DRBD .vs. GFS2 on a DAS SAN?

>Now, shared remote block access should theoretically be handled, as does 
>DRBD, by a block layer driver, but realistically it may be more appropriate 
>to let it be handled by the combining end user, like OCFS or GFS.


	Jan
-- 

^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Segher Boessenkool @ 2007-08-12 10:35 UTC (permalink / raw)
  To: schwidefsky
  Cc: wjiang, Linus Torvalds, wensong, heiko.carstens, linux-kernel, ak,
	cfriesen, netdev, horms, akpm, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <1186912053.3852.9.camel@localhost>

>>> Yes, though I would use "=m" on the output list and "m" on the input
>>> list. The reason is that I've seen gcc fall on its face with an ICE 
>>> on
>>> s390 due to "+m". The explanation I've got from our compiler people 
>>> was
>>> quite esoteric, as far as I remember gcc splits "+m" to an input
>>> operand
>>> and an output operand. Now it can happen that the compiler chooses 
>>> two
>>> different registers to access the same memory location. "+m" requires
>>> that the two memory references are identical which causes the ICE if
>>> they are not.
>>
>> The problem is very nicely described here, last paragraph:
>> <http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01816.html>
>>
>> It's not a problem anymore in (very) recent GCC, although
>> that of course won't help you in the kernel (yet).
>
> So you are saying that gcc 3.x still has this problem ?

Yes.  A warning ("read-write constraint does not allow a register")
was added for GCC-3.4, but the fix/workaround is more recent
(4.2 I believe, perhaps it was backported to the 4.1 branch).

>>> I do not know if the current compilers still do this. Has
>>> anyone else seen this happen ?
>>
>> In recent GCC, it's actually documented:
>>
>> 	 The ordinary output operands must be write-only; GCC will assume 
>> that
>> 	the values in these operands before the instruction are dead and need
>> 	not be generated.  Extended asm supports input-output or read-write
>> 	operands.  Use the constraint character `+' to indicate such an 
>> operand
>> 	and list it with the output operands.  You should only use read-write
>> 	operands when the constraints for the operand (or the operand in 
>> which
>> 	only some of the bits are to be changed) allow a register.
>>
>> Note that last line.
>
> I see, thanks for the info.

My pleasure.


Segher

^ permalink raw reply

* [RFD] Layering: Use-Case Composers (was: DRBD - what is it, anyways? [compare with e.g. NBD + MD raid])
From: Al Boldi @ 2007-08-12 10:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, netdev, linux-raid

Lars Ellenberg wrote:
> meanwhile, please, anyone interessted,
> the drbd paper for LinuxConf Eu 2007 is finalized.
> http://www.drbd.org/fileadmin/drbd/publications/
> drbd8.linux-conf.eu.2007.pdf
>
> it does not give too much implementation detail (would be inapropriate
> for conference proceedings, imo; some paper commenting on the source
> code should follow).
>
> but it does give a good overview about what DRBD actually is,
> what exact problems it tries to solve,
> and what developments to expect in the near future.
>
> so you can make up your mind about
>  "Do we need it?", and
>  "Why DRBD? Why not NBD + MD-RAID?"

Ok, conceptually your driver sounds really interresting, but when I read the 
pdf I got completely turned off.  The problem is that the concepts are not 
clearly implemented, when in fact the concepts are really simple:

  Allow shared access to remote block storage with fault tolerance.

The first thing to tackle here would be write serialization.  Then start 
thinking about fault tolerance.

Now, shared remote block access should theoretically be handled, as does 
DRBD, by a block layer driver, but realistically it may be more appropriate 
to let it be handled by the combining end user, like OCFS or GFS.

The idea here is to simplify lower layer implementations while removing any 
preconceived dependencies, and let upper layers reign free without incurring 
redundant overhead.

Look at ZFS; it illegally violates layering by combining md/dm/lvm with the 
fs, but it does this based on a realistic understanding of the problems 
involved, which enables it to improve performance, flexibility, and 
functionality specific to its use case.

This implies that there are two distinct forces at work here:

  1. Layer components
  2. Use-Case composers

Layer components should technically not implement any use case (other than 
providing a plumbing framework), as that would incur unnecessary 
dependencies, which could reduce its generality and thus reusability.

Use-Case composers can now leverage layer components from across the layering 
hierarchy, to yield a specific use case implementation.

DRBD is such a Use-Case composer, as is mdm / dm / lvm and any fs in general, 
whereas aoe / nbd / loop and the VFS / FUSE are examples of layer 
components.

It follows that Use-case composers, like DRBD, need common functionality that 
should be factored out into layer components, and then recompose to 
implement a specific use case.


Thanks!

--
Al


^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Segher Boessenkool @ 2007-08-12 10:27 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: wjiang, wensong, heiko.carstens, linux-kernel, ak, cfriesen,
	netdev, horms, akpm, schwidefsky, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <alpine.LFD.0.999.0708112305170.30176@woody.linux-foundation.org>

>> Note that last line.
>
> Segher, how about you just accept that Linux uses gcc as per reality, 
> and
> that sometimes the reality is different from your expectations?
>
> "+m" works.

It works _most of the time_.  Ask Martin.  Oh you don't even have to,
he told you two mails ago.  My last mail simply pointed out that this
isn't a GCC bug, but merely documented behaviour.  Well okay, it was
documented only after people found problems with it; it is an edge
case and pretty hard to trigger (impossible to trigger on RISC
architectures, and not very likely on x86 either, for different
reasons).

Since "realistic" people keep using "+m" anyhow, current GCC has added
a workaround that splits "+m" into an "=m" and an "m" constraint.  It
likely will be accepted as a permanent feature.  However, that 
workaround
doesn't yet exist on some of the compilers Linux still allows building
with (but the problem does).

> We use it. It's better than the alternatives.

How is this better than simply writing the slightly more verbose
asm("..." : "=m"(XX) : "m"(XX)) ?  It's a few more characters.
asm() is hard to write (correctly) anyway.  I don't see the problem.

> Pointing to stale documentation doesn't change anything.

It's not "stale" documentation, it's freshly built from GCC mainline.
It's also not "stale" in the sense that it isn't updated; in fact,
the email I pointed to is from a thread where a change in this exact
paragraph in the documentation was suggested (a couple of weeks ago).

> The same is true of accesses through a volatile pointer. The kernel has
> done that for a *loong* time (all MMIO IO is done that way),

(All MMIO on certain architectures).  This however is a completely
different case; there _is_ no underlying C object declared anywhere,
so no way can GCC prove that that object isn't volatile, so it _has_
to assume it is.

Also, in case of e.g. readb(), if the compiler can prove the resulting
value isn't used it doesn't have to perform the access at all -- the
documentation (again, not "stale" documentation) points this out quite
literally.

> and it's
> totally pointless to say that "volatile" isn't guaranteed to do what it
> does.

I actually asked a couple of other GCC developers last night, and
they all agreed with me.  If you look at historic GCC problem reports
(I pointed at a few earlier in these threads) you would see that the
situation is far from clear.

> It works, and quite frankly, if it didn't work, it would be a gcc
> BUG.

How can it be a bug, if the semantics you think are guaranteed are
guaranteed in your (and others') minds only?

Of course, GCC likes to cater to its users, and tries to make things
work the way the programmer probably intended.  However it a) cannot
*actually* read your mind, it just looks that way; b) it _also_ has
to implement the _correct_ semantics of volatile; c) since this isn't
part of any C version (no, not GNU99 or similar either), sometimes
GCC developers do not think about what some people expect the compiler
should do with such code, but just implement the requirements they
*know* exist.  And that's when "BUGs" happen.

If you want GCC to do what you want it to do instead of what it does,
why not file an enhancement request?  <http://gcc.gnu.org/bugzilla>.

To save you the trouble, I just did: <gcc.gnu.org/PR33053>.  Let's
see what comes from it.

> And again, this is not a "C standard" issue. It's a "sane 
> implementation"
> issue.

Maybe what you consider sane isn't as clear-cut as you think?  I'm
not alone with this opinion, as the mailing lists archives readily
show.

> Linux expects the compiler to be sane.

And the compiler expects the code it is asked to translate to
be reasonably sane.  Nothing new here.  The compiler is more
forgiving than the Linux code, IMHO; that's why I suggested
using the obviously correct asm implementation of the atomic
get/set, rather than using the not-so-obviously-correct and
error-prone volatile thing.  The semantics of the asm() are
exactly the semantics you expect from an atomic get/set, while
that of the volatile implementation are *not*; and on top of
that it is very well-tested well-understood technology.

> If it isn't, that's not our problem.

What, if the compiler doesn't work as you expect, like a silent
miscompilation, or even only the compiler ICEs, that is not a
problem for users and/or developers of Linux?  Interesting
opinion.  I'd rather stay clear of known pitfalls.

> gcc *is* sane,

Yes, it is.

> and I don't see why you constantly act as if it wasn't.

I guess I didn't express myself clearly enough then.  Hopefully
some other people _did_ understand what I meant.  In very harsh
words: "not all (proposed) kernel code is sane".


Segher


^ permalink raw reply

* Re: [PATCH] make atomic_t volatile on all architectures
From: Linus Torvalds @ 2007-08-12  9:54 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: Segher Boessenkool, wjiang, wensong, heiko.carstens, linux-kernel,
	ak, cfriesen, netdev, horms, akpm, Chuck Ebbert, davem, zlynx,
	Chris Snook
In-Reply-To: <1186912098.3852.11.camel@localhost>



On Sun, 12 Aug 2007, Martin Schwidefsky wrote:
> 
> The duplication "=m" and "m" with the same constraint is rather 
> annoying.

It's not only annoying, it causes gcc to generate bad code too. At least 
certain versions of gcc will generate the address *twice*, even if there 
is obviously only one address used.

If you have problems with "+m", you are often actually better off using 
just "m" and then adding a memory clobber. But that has other code 
generation downsides.

			Linus

^ permalink raw reply


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