Skip to contentSkip to conversation

Add 32bit emulation for wireless

PATCH In review Andi Kleen 5 participants 15 messages Jan 19, 2004

Subsystems (3)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Add 32bit emulation for wireless

[First version of this mail seems to have gotten lost. Apologies if you see it twice]

Some distributions call iwconfig at every bootup and I was sick of seeing all the unimplemented ioctl messages on AMD64 with a 32bit userland.

This patch implements ioctl emulation for the wireless subsytem. The only structure that was incompatible from visual inspection was "iw_point". The rest is just passed through.

It reuses the existing ioctl description table, but renames it to export it (standard_ioctls wasn't a good name for a global variable)

I don't actually have have a working wireless card (only some non supported Samsung one), so I wasn't able to test it, but at least the messages are gone.

-Andi

net/core/wireless.c renamed from net/core/wireless.c-WIRELESS +7 -7
diff -u linux-2.6.1-amd64/net/core/wireless.c-WIRELESS linux-2.6.1-amd64/net/core/wireless.c
@@ -27,7 +27,7 @@
  *	o Initial dumb commit strategy based on orinoco.c
  *
  * v3 - 19.12.01 - Jean II
- *	o Make sure we don't go out of standard_ioctl[] in ioctl_standard_call
+ *	o Make sure we don't go out of wireless_ioctl[] in ioctl_standard_call
  *	o Add event dispatcher function
  *	o Add event description
  *	o Propagate events as rtnetlink IFLA_WIRELESS option
@@ -91,7 +91,7 @@
  * Meta-data about all the standard Wireless Extension request we
  * know about.
  */
-static const struct iw_ioctl_description standard_ioctl[] = {
+const struct iw_ioctl_description wireless_ioctl[] = {
 	[SIOCSIWCOMMIT	- SIOCIWFIRST] = {
 		.header_type	= IW_HEADER_TYPE_NULL,
 	},
@@ -266,7 +266,7 @@
 		.header_type	= IW_HEADER_TYPE_PARAM,
 	},
 };
-static const int standard_ioctl_num = (sizeof(standard_ioctl) /
+const int wireless_ioctl_num = (sizeof(wireless_ioctl) /
 				       sizeof(struct iw_ioctl_description));
 
 /*
@@ -593,9 +593,9 @@
 	int					user_size = 0;
 
 	/* Get the description of the IOCTL */
-	if((cmd - SIOCIWFIRST) >= standard_ioctl_num)
+	if((cmd - SIOCIWFIRST) >= wireless_ioctl_num)
 		return -EOPNOTSUPP;
-	descr = &(standard_ioctl[cmd - SIOCIWFIRST]);
+	descr = &(wireless_ioctl[cmd - SIOCIWFIRST]);
 
 #ifdef WE_IOCTL_DEBUG
 	printk(KERN_DEBUG "%s (WE) : Found standard handler for 0x%04X\n",
@@ -1041,8 +1041,8 @@
 	/* Get the description of the IOCTL */
 	if(cmd <= SIOCIWLAST) {
 		cmd_index = cmd - SIOCIWFIRST;
-		if(cmd_index < standard_ioctl_num)
-			descr = &(standard_ioctl[cmd_index]);
+		if(cmd_index < wireless_ioctl_num)
+			descr = &(wireless_ioctl[cmd_index]);
 	} else {
 		cmd_index = cmd - IWEVFIRST;
 		if(cmd_index < standard_event_num)
fs/compat_ioctl.c renamed from fs/compat_ioctl.c-WIRELESS +98 -0

116 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Andi Kleen

It reuses the existing ioctl description table, but renames it to export it (standard_ioctls wasn't a good name for a global variable)

What about register_ioctl32_conversion() from the wireless code to avoid exposing it?

#2 lore raw
Quoted 6 lines · On Mon, 19 Jan 2004 12:39:45 +0000 Christoph Hellwig <[email protected]> wrote:
Quoted 2 lines · Andi Kleen

It reuses the existing ioctl description table, but renames it to export it (standard_ioctls wasn't a good name for a global variable)

What about register_ioctl32_conversion() from the wireless code to avoid exposing it?

At least for net/* stuff it seems to be standard to do it in the central file. All other networking ioctls are implemented this way too.

-Andi

#3 lore raw

Andi please see the current 2.6.x BK tree, I already put in preliminary work in this area.

#4 lore raw
Quoted 3 lines · On Mon, 19 Jan 2004 05:56:15 -0800 "David S. Miller" <[email protected]> wrote:

Andi please see the current 2.6.x BK tree, I already put in preliminary work in this area.

Went it in after 2.6.1? 2.6.1 definitely spews out warnings for it at every boot, that is why I did this. If it's already fixed that's fine for me of course.

-Andi

#5 lore raw
Quoted 1 line · On Mon, 19 Jan 2004 15:39:19 +0100 Andi Kleen <[email protected]> wrote:

Went it in after 2.6.1?

Yes, Linus sucked it in like 10 hours ago, about 4 hours right before you made your initial posting on this thread.

#6 lore raw
Quoted 7 lines · On Mon, 19 Jan 2004 06:39:21 -0800 "David S. Miller" <[email protected]> wrote:
Quoted 1 line · On Mon, 19 Jan 2004 15:39:19 +0100 Andi Kleen <[email protected]> wrote:

Went it in after 2.6.1?

Yes, Linus sucked it in like 10 hours ago, about 4 hours right before you made your initial posting on this thread.

Oh, I actually posted it yesterday but due a broken MTA it didn't go out @) But I didn't check BK anyways so it would not have made much difference.

-Andi

#7 lore raw
Quoted 10 lines · Andi Kleen

Some distributions call iwconfig at every bootup and I was sick of seeing all the unimplemented ioctl messages on AMD64 with a 32bit userland.

This patch implements ioctl emulation for the wireless subsytem. The only structure that was incompatible from visual inspection was "iw_point". The rest is just passed through.

It reuses the existing ioctl description table, but renames it to export it (standard_ioctls wasn't a good name for a global variable)

I'm glad that you found the ioctl description table useful,
the code look neat and simple. When I did redesign the driver API in WE-13, ioctl emulation for 64 bits was definitely on my mind (thanks to Dave warning me about it). Also, from the very start, the API was defined with explicitely sized types, which help.

However, this is my prefered way to do things. I would much
prefer to see you using native version of the Wireless Tools, especially that the tools and the kernel need to be in sync as far as version is concerned. It should be a simple matter of recompiling the tools package.
One of the main strength of OpenSource is that you can
recompile for your platform, and I think we should fully exploit this advantage, especially for the base system. Otherwise, why not enable 16bit compatibility on i386 for ELKS packages ?

Quoted 3 lines

I don't actually have have a working wireless card (only some non supported Samsung one), so I wasn't able to test it, but at least the messages are gone.

Actually, the devil is always in the details.

Quoted 8 lines · Andi Kleen
Quoted 5 lines · On Mon, 19 Jan 2004 06:39:21 -0800 "David S. Miller" <[email protected]> wrote:
Quoted 1 line · On Mon, 19 Jan 2004 15:39:19 +0100 Andi Kleen <[email protected]> wrote:

Went it in after 2.6.1?

Quoted 7 lines
Quoted 2 lines

Yes, Linus sucked it in like 10 hours ago, about 4 hours right before you made your initial posting on this thread.

Oh, I actually posted it yesterday but due a broken MTA it didn't go out @) But I didn't check BK anyways so it would not have made much difference.

-Andi

	It seems that the BK->Web stuff has not yet picked your

updates, because I don't see them (and of course the snapshot on kernel.org is too old).
Let's just be happy that some code is in ;-)

Regards,

Jean

#8 lore raw
Quoted 5 lines · On Mon, 19 Jan 2004 11:49:43 -0800 Jean Tourrilhes <[email protected]>…

However, this is my prefered way to do things. I would much
prefer to see you using native version of the Wireless Tools, especially that the tools and the kernel need to be in sync as far as version is concerned. It should be a simple matter of recompiling the tools package.

I don't use wireless at all[1] - I was just annoyed at the storm of unimplemented ioctl messages when booting up 32bit userland. SuSE 9.0 boot up calls iwconfig by default.

[1] I actually have a Samsung wireless card, but it's not working due to missing support for the Cirrus 6729 PCMCIA bridge on there.

Quoted 4 lines

One of the main strength of OpenSource is that you can
recompile for your platform, and I think we should fully exploit this advantage, especially for the base system. Otherwise, why not enable 16bit compatibility on i386 for ELKS packages ?

I maintain the 32bit emulation on x86-64 and booting an unmodified 32bit distribution is an important test case for me. Your suggestion is like someone suggesting to you to just use ethernet with cables instead of this unreliable wireless stuff...

Quoted 4 lines
	It seems that the BK->Web stuff has not yet picked your

updates, because I don't see them (and of course the snapshot on kernel.org is too old).

It's actually there, just hidden in a large batch of network updates.

-Andi

#9 lore raw
Quoted 3 lines · Andi Kleen

[1] I actually have a Samsung wireless card, but it's not working due to missing support for the Cirrus 6729 PCMCIA bridge on there.

I was wondering, because Samsungs cards should be supported by
the HostAP driver (which remind me, HostAP needs to go in the kernel).

Quoted 8 lines
Quoted 4 lines

One of the main strength of OpenSource is that you can
recompile for your platform, and I think we should fully exploit this advantage, especially for the base system. Otherwise, why not enable 16bit compatibility on i386 for ELKS packages ?

I maintain the 32bit emulation on x86-64 and booting an unmodified 32bit distribution is an important test case for me. Your suggestion is like someone suggesting to you to just use ethernet with cables instead of this unreliable wireless stuff...

This analogy doesn't work. If your network is wireless, you
won't connect to it with an Ethernet card (and vice versa). A fully 64 bits userspace has only very minor downside, and most users won't see any difference. If we follow your line of thought, we should all be using a 16bit userspace on i386 (more compact, more compatible).

Quoted 5 lines
Quoted 3 lines
	It seems that the BK->Web stuff has not yet picked your

updates, because I don't see them (and of course the snapshot on kernel.org is too old).

It's actually there, just hidden in a large batch of network updates.

It was backlogged, it seems to be catching up (but I need to
see if I find it).
http://linux.bkbits.net:8080/linux-2.5/ChangeSet@-4d?nav=index.html

Quoted 1 line

-Andi

Jean

#10 lore raw
Quoted 5 lines · On Mon, 19 Jan 2004 12:19:12 -0800 Jean Tourrilhes <[email protected]>…

This analogy doesn't work. If your network is wireless, you
won't connect to it with an Ethernet card (and vice versa). A fully 64 bits userspace has only very minor downside, and most users won't see any difference. If we follow your line of thought, we should all be using a 16bit userspace on i386 (more compact, more compatible).

I think the situation is different. On several 64-bit platforms we encourage using 32-bit compilation and binaries by default because:

1) they're a lot faster than their 64-bit counterparts

2) they're a lot smaller than their 64-bit counterparts

3) 64-bits buys them absolutely nothing

Therefore the 32-bit compatability layer must be as fully supportive as humanly possible. Most 64-bit platforms still have %99 32-bit distributions.

This has been discussed to death a million times, please accept the situation and work towards getting the 32-bit compat stuff working for these wireless ioctls. We wouldn't be working on this if "just compile as 64-bit" we an acceptable solution now would we :)

#13 lore raw
In reply to Jean Tourrilhes
Quoted 7 lines · On Mon, 19 Jan 2004 12:19:12 -0800 Jean Tourrilhes <[email protected]>…
Quoted 3 lines · Andi Kleen

[1] I actually have a Samsung wireless card, but it's not working due to missing support for the Cirrus 6729 PCMCIA bridge on there.

I was wondering, because Samsungs cards should be supported by
the HostAP driver (which remind me, HostAP needs to go in the kernel).

It apparently works with David Hinds' PCMCIA kit, but that is far too messy to patch into a changing development kernel all the time. The main problem seems to be the missing bridge support in the kernel PCMCIA, so the wireless driver cannot even see the chip.

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

One of the main strength of OpenSource is that you can
recompile for your platform, and I think we should fully exploit this advantage, especially for the base system. Otherwise, why not enable 16bit compatibility on i386 for ELKS packages ?

I maintain the 32bit emulation on x86-64 and booting an unmodified 32bit distribution is an important test case for me. Your suggestion is like someone suggesting to you to just use ethernet with cables instead of this unreliable wireless stuff...

Quoted 5 lines

This analogy doesn't work. If your network is wireless, you
won't connect to it with an Ethernet card (and vice versa). A fully 64 bits userspace has only very minor downside, and most users won't see any difference. If we follow your line of thought, we should all be using a 16bit userspace on i386 (more compact, more compatible).

My point was not that I think it's so great to run 32bit user space. In fact on AMD64 the 64bit compiler generates in general better and often more compact code than the 32bit compiler. Most of my 64bit machines are running with full 64bit userland. But it's very useful to have working 32bit emulation for many reasons, and going from good application emulation to supporting a full distribution boot is only a small step and a great test.

-Andi

#11 lore raw
In reply to David S. Miller
Quoted 3 lines · David S. Miller

and work towards getting the 32-bit compat stuff working for these wireless ioctls.

I think I've done my part, the wireless ioctls were clearly
not the most difficult to convert ;-)

Jean

author
#12 lore raw
In reply to David S. Miller
Quoted 5 lines

1) they're a lot faster than their 64-bit counterparts

2) they're a lot smaller than their 64-bit counterparts

3) 64-bits buys them absolutely nothing

Just for the record: this doesn't apply to AMD64. While data structures take a bit more memory at runtime the 64bit code is a lot better due to more registers and better ABI. And it is also not signifcantly bigger, in fact some programs get smaller when you recompile them for 64bit.

Still good 32bit emulation is important because people expect 32bit applications to run seamlessly on 64bit kernels.

Quoted 2 lines

Therefore the 32-bit compatability layer must be as fully supportive as humanly possible. Most 64-bit platforms still have %99 32-bit distributions.

AMD64 should usually run with 64bit userland, except for user who transistion slowly from a 32bit user land.

-Andi

#14 lore raw
In reply to Andi Kleen
Quoted 8 lines · Andi Kleen
Quoted 5 lines · On Mon, 19 Jan 2004 12:19:12 -0800 Jean Tourrilhes <[email protected]>…
Quoted 3 lines · Andi Kleen

[1] I actually have a Samsung wireless card, but it's not working due to missing support for the Cirrus 6729 PCMCIA bridge on there.

Quoted 7 lines
Quoted 2 lines

I was wondering, because Samsungs cards should be supported by
the HostAP driver (which remind me, HostAP needs to go in the kernel).

It apparently works with David Hinds' PCMCIA kit, but that is far too messy to patch into a changing development kernel all the time. The main problem seems to be the missing bridge support in the kernel PCMCIA, so the wireless driver cannot even see the chip.

I see you have it covered :
http://www.ussg.iu.edu/hypermail/linux/kernel/0312.1/0469.html
You may want to get in touch with Dominik Brodowski and
Russell King, because the i82365 driver in 2.6.X is fairly stable (as opposed to the CardBus stuff).

Quoted 1 line

-Andi

Jean