* [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h
@ 2006-07-24 3:40 Michael Wu
2006-07-24 4:01 ` Jeff Garzik
2006-07-24 4:03 ` Christoph Hellwig
0 siblings, 2 replies; 4+ messages in thread
From: Michael Wu @ 2006-07-24 3:40 UTC (permalink / raw)
To: linville; +Cc: Jiri Benc, netdev, proski
[-- Attachment #1: Type: text/plain, Size: 5171 bytes --]
orinoco: Switch to d80211.h
This patch "converts" the orinoco driver to use d80211.h instead of
ieee80211.h. It also copies the IEEE80211_DATA_LEN definition to
d80211.h for use by the stack and drivers.
Signed-off-by: Michael Wu <flamingice@sourmilk.net>
---
drivers/net/wireless/orinoco.c | 37 +++++++++++++++++++------------------
include/net/d80211.h | 9 +++++++++
net/d80211/ieee80211.c | 4 ++--
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index d6ed578..bdc8d37 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -83,8 +83,9 @@ #include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/wireless.h>
+#include <linux/if_arp.h>
#include <net/iw_handler.h>
-#include <net/ieee80211.h>
+#include <net/d80211.h>
#include "hermes_rid.h"
#include "orinoco.h"
@@ -400,7 +401,7 @@ static int orinoco_change_mtu(struct net
if ( (new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU) )
return -EINVAL;
- if ( (new_mtu + ENCAPS_OVERHEAD + IEEE80211_HLEN) >
+ if ( (new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
(priv->nicbuf_size - ETH_HLEN) )
return -EINVAL;
@@ -720,29 +721,29 @@ static void orinoco_rx_monitor(struct ne
/* Determine the size of the header and the data */
fc = le16_to_cpu(desc->frame_ctl);
- switch (fc & IEEE80211_FCTL_FTYPE) {
- case IEEE80211_FTYPE_DATA:
- if ((fc & IEEE80211_FCTL_TODS)
- && (fc & IEEE80211_FCTL_FROMDS))
+ switch (WLAN_FC_GET_TYPE(fc)) {
+ case WLAN_FC_TYPE_DATA:
+ if ((fc & WLAN_FC_TODS)
+ && (fc & WLAN_FC_FROMDS))
hdrlen = 30;
else
hdrlen = 24;
datalen = len;
break;
- case IEEE80211_FTYPE_MGMT:
+ case WLAN_FC_TYPE_MGMT:
hdrlen = 24;
datalen = len;
break;
- case IEEE80211_FTYPE_CTL:
- switch (fc & IEEE80211_FCTL_STYPE) {
- case IEEE80211_STYPE_PSPOLL:
- case IEEE80211_STYPE_RTS:
- case IEEE80211_STYPE_CFEND:
- case IEEE80211_STYPE_CFENDACK:
+ case WLAN_FC_TYPE_CTRL:
+ switch (WLAN_FC_GET_STYPE(fc)) {
+ case WLAN_FC_STYPE_PSPOLL:
+ case WLAN_FC_STYPE_RTS:
+ case WLAN_FC_STYPE_CFEND:
+ case WLAN_FC_STYPE_CFENDACK:
hdrlen = 16;
break;
- case IEEE80211_STYPE_CTS:
- case IEEE80211_STYPE_ACK:
+ case WLAN_FC_STYPE_CTS:
+ case WLAN_FC_STYPE_ACK:
hdrlen = 10;
break;
}
@@ -908,7 +909,7 @@ static void __orinoco_ev_rx(struct net_d
hdr->h_proto = htons(length);
}
memcpy(hdr->h_dest, desc.addr1, ETH_ALEN);
- if (fc & IEEE80211_FCTL_FROMDS)
+ if (fc & WLAN_FC_FROMDS)
memcpy(hdr->h_source, desc.addr3, ETH_ALEN);
else
memcpy(hdr->h_source, desc.addr2, ETH_ALEN);
@@ -917,7 +918,7 @@ static void __orinoco_ev_rx(struct net_d
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);
skb->ip_summed = CHECKSUM_NONE;
- if (fc & IEEE80211_FCTL_TODS)
+ if (fc & WLAN_FC_TODS)
skb->pkt_type = PACKET_OTHERHOST;
/* Process the wireless stats if needed */
@@ -2229,7 +2230,7 @@ static int orinoco_init(struct net_devic
/* No need to lock, the hw_unavailable flag is already set in
* alloc_orinocodev() */
- priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN;
+ priv->nicbuf_size = IEEE80211_DATA_LEN + sizeof(struct ieee80211_hdr) + ETH_HLEN;
/* Initialize the firmware */
err = hermes_init(hw);
diff --git a/include/net/d80211.h b/include/net/d80211.h
index b9d4b24..6bf1b08 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -958,6 +958,15 @@ #define WLAN_FC_STYPE_QOS_CFACKPOLL 15
#define IEEE80211_MAX_FRAG_THRESHOLD 2346
#define IEEE80211_MAX_RTS_THRESHOLD 2347
+#define IEEE80211_DATA_LEN 2304
+/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
+ 6.2.1.1.2.
+
+ The figure in section 7.1.2 suggests a body size of up to 2312
+ bytes is allowed, which is a bit confusing, I suspect this
+ represents the 2304 bytes of real data, plus a possible 8 bytes of
+ WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
+
struct ieee80211_hdr {
__le16 frame_control;
__le16 duration_id;
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 71f9005..9c38905 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1969,7 +1969,7 @@ static int ieee80211_change_mtu(struct n
{
/* FIX: what would be proper limits for MTU?
* This interface uses 802.3 frames. */
- if (new_mtu < 256 || new_mtu > 2304 - 24 - 6) {
+ if (new_mtu < 256 || new_mtu > IEEE80211_DATA_LEN - 24 - 6) {
printk(KERN_WARNING "%s: invalid MTU %d\n",
dev->name, new_mtu);
return -EINVAL;
@@ -1987,7 +1987,7 @@ static int ieee80211_change_mtu_apdev(st
{
/* FIX: what would be proper limits for MTU?
* This interface uses 802.11 frames. */
- if (new_mtu < 256 || new_mtu > 2304) {
+ if (new_mtu < 256 || new_mtu > IEEE80211_DATA_LEN) {
printk(KERN_WARNING "%s: invalid MTU %d\n",
dev->name, new_mtu);
return -EINVAL;
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h
2006-07-24 3:40 [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h Michael Wu
@ 2006-07-24 4:01 ` Jeff Garzik
2006-07-24 4:03 ` Christoph Hellwig
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2006-07-24 4:01 UTC (permalink / raw)
To: Michael Wu; +Cc: linville, Jiri Benc, netdev, proski
Michael Wu wrote:
> orinoco: Switch to d80211.h
>
> This patch "converts" the orinoco driver to use d80211.h instead of
> ieee80211.h. It also copies the IEEE80211_DATA_LEN definition to
> d80211.h for use by the stack and drivers.
>
> Signed-off-by: Michael Wu <flamingice@sourmilk.net>
> ---
>
> drivers/net/wireless/orinoco.c | 37 +++++++++++++++++++------------------
> include/net/d80211.h | 9 +++++++++
> net/d80211/ieee80211.c | 4 ++--
> 3 files changed, 30 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
> index d6ed578..bdc8d37 100644
> --- a/drivers/net/wireless/orinoco.c
> +++ b/drivers/net/wireless/orinoco.c
> @@ -83,8 +83,9 @@ #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> #include <linux/ethtool.h>
> #include <linux/wireless.h>
> +#include <linux/if_arp.h>
> #include <net/iw_handler.h>
> -#include <net/ieee80211.h>
> +#include <net/d80211.h>
>
> #include "hermes_rid.h"
> #include "orinoco.h"
> @@ -400,7 +401,7 @@ static int orinoco_change_mtu(struct net
> if ( (new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU) )
> return -EINVAL;
>
> - if ( (new_mtu + ENCAPS_OVERHEAD + IEEE80211_HLEN) >
> + if ( (new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
> (priv->nicbuf_size - ETH_HLEN) )
> return -EINVAL;
>
> @@ -720,29 +721,29 @@ static void orinoco_rx_monitor(struct ne
>
> /* Determine the size of the header and the data */
> fc = le16_to_cpu(desc->frame_ctl);
> - switch (fc & IEEE80211_FCTL_FTYPE) {
> - case IEEE80211_FTYPE_DATA:
> - if ((fc & IEEE80211_FCTL_TODS)
> - && (fc & IEEE80211_FCTL_FROMDS))
> + switch (WLAN_FC_GET_TYPE(fc)) {
> + case WLAN_FC_TYPE_DATA:
> + if ((fc & WLAN_FC_TODS)
> + && (fc & WLAN_FC_FROMDS))
> hdrlen = 30;
> else
> hdrlen = 24;
> datalen = len;
> break;
> - case IEEE80211_FTYPE_MGMT:
> + case WLAN_FC_TYPE_MGMT:
> hdrlen = 24;
> datalen = len;
> break;
> - case IEEE80211_FTYPE_CTL:
> - switch (fc & IEEE80211_FCTL_STYPE) {
> - case IEEE80211_STYPE_PSPOLL:
> - case IEEE80211_STYPE_RTS:
> - case IEEE80211_STYPE_CFEND:
> - case IEEE80211_STYPE_CFENDACK:
> + case WLAN_FC_TYPE_CTRL:
> + switch (WLAN_FC_GET_STYPE(fc)) {
> + case WLAN_FC_STYPE_PSPOLL:
> + case WLAN_FC_STYPE_RTS:
> + case WLAN_FC_STYPE_CFEND:
> + case WLAN_FC_STYPE_CFENDACK:
> hdrlen = 16;
> break;
> - case IEEE80211_STYPE_CTS:
> - case IEEE80211_STYPE_ACK:
> + case WLAN_FC_STYPE_CTS:
> + case WLAN_FC_STYPE_ACK:
> hdrlen = 10;
> break;
> }
> @@ -908,7 +909,7 @@ static void __orinoco_ev_rx(struct net_d
> hdr->h_proto = htons(length);
> }
> memcpy(hdr->h_dest, desc.addr1, ETH_ALEN);
> - if (fc & IEEE80211_FCTL_FROMDS)
> + if (fc & WLAN_FC_FROMDS)
> memcpy(hdr->h_source, desc.addr3, ETH_ALEN);
> else
> memcpy(hdr->h_source, desc.addr2, ETH_ALEN);
> @@ -917,7 +918,7 @@ static void __orinoco_ev_rx(struct net_d
> skb->dev = dev;
> skb->protocol = eth_type_trans(skb, dev);
> skb->ip_summed = CHECKSUM_NONE;
> - if (fc & IEEE80211_FCTL_TODS)
> + if (fc & WLAN_FC_TODS)
Rather than have a great symbol renaming, it seems better to change the
out-of-tree stuff to match the in-tree stuff.
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h
2006-07-24 3:40 [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h Michael Wu
2006-07-24 4:01 ` Jeff Garzik
@ 2006-07-24 4:03 ` Christoph Hellwig
2006-07-24 4:06 ` Jeff Garzik
1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2006-07-24 4:03 UTC (permalink / raw)
To: Michael Wu; +Cc: linville, Jiri Benc, netdev, proski
On Sun, Jul 23, 2006 at 08:40:20PM -0700, Michael Wu wrote:
> orinoco: Switch to d80211.h
>
> This patch "converts" the orinoco driver to use d80211.h instead of
> ieee80211.h. It also copies the IEEE80211_DATA_LEN definition to
> d80211.h for use by the stack and drivers.
NACK for all of these patches. The names in ieee80211.h
a) make a whole lot more sense
b) are used all over the kernel already
please convert the devicescape stack to reuse existing infrastrucure instead,
and that starts with things as simple as names for constants and data
structures in headers.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h
2006-07-24 4:03 ` Christoph Hellwig
@ 2006-07-24 4:06 ` Jeff Garzik
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2006-07-24 4:06 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Michael Wu, linville, Jiri Benc, netdev, proski
Christoph Hellwig wrote:
> On Sun, Jul 23, 2006 at 08:40:20PM -0700, Michael Wu wrote:
>> orinoco: Switch to d80211.h
>>
>> This patch "converts" the orinoco driver to use d80211.h instead of
>> ieee80211.h. It also copies the IEEE80211_DATA_LEN definition to
>> d80211.h for use by the stack and drivers.
>
> NACK for all of these patches. The names in ieee80211.h
>
> a) make a whole lot more sense
> b) are used all over the kernel already
>
> please convert the devicescape stack to reuse existing infrastrucure instead,
> and that starts with things as simple as names for constants and data
> structures in headers.
Agreed...
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-24 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-24 3:40 [PATCH wireless-dev 2/5] orinoco: Switch to d80211.h Michael Wu
2006-07-24 4:01 ` Jeff Garzik
2006-07-24 4:03 ` Christoph Hellwig
2006-07-24 4:06 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).