You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(46) |
Sep
(117) |
Oct
(24) |
Nov
(10) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(11) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
(5) |
Jul
(7) |
Aug
(1) |
Sep
(8) |
Oct
(2) |
Nov
(27) |
Dec
(33) |
2009 |
Jan
(11) |
Feb
(10) |
Mar
(10) |
Apr
(16) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jeff G. <jg...@po...> - 2005-08-15 03:17:43
|
Jouni Malinen wrote: > This set of patches merges a bug fix for the Host AP driver (patch 1), > does some cleanup for different hardware models (patches 2-3), continues > conversion to generic ieee80211 code (patches 4-6), and tests how we can > handle changes that have a dependency to modify ieee80211 and hostap > at the same time (patches 7-9). Please apply to suitable branch(es) in > netdev-2.6. * Applied patches 1-6 to ieee80211-wifi branch. * Applied patch 7 to ieee80211 branch, then merged that branch into ieee80211-wifi. * Did not apply patch 8, because it modified both hostap and ieee80211 core stuff. Since hostap is in a separate branch, you'll need to split this change up into two separate patches, the hostap portion and the non-hostap portion. Indicate dependencies using English, in the patch description and/or patch ordering. * Did not apply patch 9 because I stopped at patch 8. The content of patches 8 and 9 looked OK to me. Please start a new patch series, containing split-up patch 8, patch 9, and anything new you have come up with. Thanks! Jeff |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:52
|
Replace hardware model specific #ifdef's in struct local_info with void *hw_priv that is pointing to cs/pci/plx specific data structure. This removes unneeded #ifdef's and as such, is a step towards making it possible to share objects for hostap_hw.c and hostap_download.c with cs/pci/plx drivers without having to compile and link the same code separately for each one. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_cs.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_cs.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_cs.c @@ -40,6 +40,14 @@ module_param(ignore_cis_vcc, int, 0444); MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry"); +/* struct local_info::hw_priv */ +struct hostap_cs_priv { + dev_node_t node; + dev_link_t *link; + int sandisk_connectplus; +}; + + #ifdef PRISM2_IO_DEBUG static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) @@ -203,8 +211,9 @@ static int prism2_event(event_t event, i static int prism2_pccard_card_present(local_info_t *local) { - if (local->link != NULL && - ((local->link->state & (DEV_PRESENT | DEV_CONFIG)) == + struct hostap_cs_priv *hw_priv = local->hw_priv; + if (hw_priv->link != NULL && + ((hw_priv->link->state & (DEV_PRESENT | DEV_CONFIG)) == (DEV_PRESENT | DEV_CONFIG))) return 1; return 0; @@ -224,12 +233,14 @@ static void sandisk_set_iobase(local_inf { int res; conf_reg_t reg; + struct hostap_cs_priv *hw_priv = local->hw_priv; reg.Function = 0; reg.Action = CS_WRITE; reg.Offset = 0x10; /* 0x3f0 IO base 1 */ - reg.Value = local->link->io.BasePort1 & 0x00ff; - res = pcmcia_access_configuration_register(local->link->handle, ®); + reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" " res=%d\n", res); @@ -239,8 +250,9 @@ static void sandisk_set_iobase(local_inf reg.Function = 0; reg.Action = CS_WRITE; reg.Offset = 0x12; /* 0x3f2 IO base 2 */ - reg.Value = (local->link->io.BasePort1 & 0xff00) >> 8; - res = pcmcia_access_configuration_register(local->link->handle, ®); + reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" " res=%d\n", res); @@ -272,8 +284,9 @@ static int sandisk_enable_wireless(struc tuple_t tuple; cisparse_t *parse = NULL; u_char buf[64]; + struct hostap_cs_priv *hw_priv = local->hw_priv; - if (local->link->io.NumPorts1 < 0x42) { + if (hw_priv->link->io.NumPorts1 < 0x42) { /* Not enough ports to be SanDisk multi-function card */ ret = -ENODEV; goto done; @@ -290,9 +303,9 @@ static int sandisk_enable_wireless(struc tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); tuple.TupleOffset = 0; - if (pcmcia_get_first_tuple(local->link->handle, &tuple) || - pcmcia_get_tuple_data(local->link->handle, &tuple) || - pcmcia_parse_tuple(local->link->handle, &tuple, parse) || + if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || + pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || + pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) { /* No SanDisk manfid found */ ret = -ENODEV; @@ -300,9 +313,9 @@ static int sandisk_enable_wireless(struc } tuple.DesiredTuple = CISTPL_LONGLINK_MFC; - if (pcmcia_get_first_tuple(local->link->handle, &tuple) || - pcmcia_get_tuple_data(local->link->handle, &tuple) || - pcmcia_parse_tuple(local->link->handle, &tuple, parse) || + if (pcmcia_get_first_tuple(hw_priv->link->handle, &tuple) || + pcmcia_get_tuple_data(hw_priv->link->handle, &tuple) || + pcmcia_parse_tuple(hw_priv->link->handle, &tuple, parse) || parse->longlink_mfc.nfn < 2) { /* No multi-function links found */ ret = -ENODEV; @@ -311,13 +324,14 @@ static int sandisk_enable_wireless(struc printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected" " - using vendor-specific initialization\n", dev->name); - local->sandisk_connectplus = 1; + hw_priv->sandisk_connectplus = 1; reg.Function = 0; reg.Action = CS_WRITE; reg.Offset = CISREG_COR; reg.Value = COR_SOFT_RESET; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); @@ -333,7 +347,8 @@ static int sandisk_enable_wireless(struc * will be enabled during the first cor_sreset call. */ reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); @@ -358,6 +373,7 @@ static void prism2_pccard_cor_sreset(loc { int res; conf_reg_t reg; + struct hostap_cs_priv *hw_priv = local->hw_priv; if (!prism2_pccard_card_present(local)) return; @@ -366,7 +382,8 @@ static void prism2_pccard_cor_sreset(loc reg.Action = CS_READ; reg.Offset = CISREG_COR; reg.Value = 0; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", res); @@ -377,28 +394,30 @@ static void prism2_pccard_cor_sreset(loc reg.Action = CS_WRITE; reg.Value |= COR_SOFT_RESET; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", res); return; } - mdelay(local->sandisk_connectplus ? 5 : 2); + mdelay(hw_priv->sandisk_connectplus ? 5 : 2); reg.Value &= ~COR_SOFT_RESET; - if (local->sandisk_connectplus) + if (hw_priv->sandisk_connectplus) reg.Value |= COR_IREQ_ENA; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", res); return; } - mdelay(local->sandisk_connectplus ? 5 : 2); + mdelay(hw_priv->sandisk_connectplus ? 5 : 2); - if (local->sandisk_connectplus) + if (hw_priv->sandisk_connectplus) sandisk_set_iobase(local); } @@ -408,11 +427,12 @@ static void prism2_pccard_genesis_reset( int res; conf_reg_t reg; int old_cor; + struct hostap_cs_priv *hw_priv = local->hw_priv; if (!prism2_pccard_card_present(local)) return; - if (local->sandisk_connectplus) { + if (hw_priv->sandisk_connectplus) { sandisk_write_hcr(local, hcr); return; } @@ -421,7 +441,8 @@ static void prism2_pccard_genesis_reset( reg.Action = CS_READ; reg.Offset = CISREG_COR; reg.Value = 0; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " "(%d)\n", res); @@ -433,7 +454,8 @@ static void prism2_pccard_genesis_reset( reg.Action = CS_WRITE; reg.Value |= COR_SOFT_RESET; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " "(%d)\n", res); @@ -446,7 +468,8 @@ static void prism2_pccard_genesis_reset( reg.Action = CS_WRITE; reg.Value = hcr; reg.Offset = CISREG_CCSR; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " "(%d)\n", res); @@ -457,7 +480,8 @@ static void prism2_pccard_genesis_reset( reg.Action = CS_WRITE; reg.Offset = CISREG_COR; reg.Value = old_cor & ~COR_SOFT_RESET; - res = pcmcia_access_configuration_register(local->link->handle, ®); + res = pcmcia_access_configuration_register(hw_priv->link->handle, + ®); if (res != CS_SUCCESS) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " "(%d)\n", res); @@ -470,23 +494,29 @@ static void prism2_pccard_genesis_reset( static int prism2_pccard_dev_open(local_info_t *local) { - local->link->open++; + struct hostap_cs_priv *hw_priv = local->hw_priv; + hw_priv->link->open++; return 0; } static int prism2_pccard_dev_close(local_info_t *local) { - if (local == NULL || local->link == NULL) + struct hostap_cs_priv *hw_priv; + + if (local == NULL || local->hw_priv == NULL) + return 1; + hw_priv = local->hw_priv; + if (hw_priv->link == NULL) return 1; - if (!local->link->open) { + if (!hw_priv->link->open) { printk(KERN_WARNING "%s: prism2_pccard_dev_close(): " "link not open?!\n", local->dev->name); return 1; } - local->link->open--; + hw_priv->link->open--; return 0; } @@ -567,8 +597,13 @@ static void prism2_detach(dev_link_t *li *linkp = link->next; /* release net devices */ if (link->priv) { - prism2_free_local_data((struct net_device *) link->priv); - + struct net_device *dev; + struct hostap_interface *iface; + dev = link->priv; + iface = netdev_priv(dev); + kfree(iface->local->hw_priv); + iface->local->hw_priv = NULL; + prism2_free_local_data(dev); } kfree(link); } @@ -601,14 +636,19 @@ static int prism2_config(dev_link_t *lin u_char buf[64]; config_info_t conf; cistpl_cftable_entry_t dflt = { 0 }; + struct hostap_cs_priv *hw_priv; PDEBUG(DEBUG_FLOW, "prism2_config()\n"); parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); - if (parse == NULL) { + hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); + if (parse == NULL || hw_priv == NULL) { + kfree(parse); + kfree(hw_priv); ret = -ENOMEM; goto failed; } + memset(hw_priv, 0, sizeof(*hw_priv)); tuple.DesiredTuple = CISTPL_CONFIG; tuple.Attributes = 0; @@ -779,9 +819,10 @@ static int prism2_config(dev_link_t *lin iface = netdev_priv(dev); local = iface->local; - local->link = link; - strcpy(local->node.dev_name, dev->name); - link->dev = &local->node; + local->hw_priv = hw_priv; + hw_priv->link = link; + strcpy(hw_priv->node.dev_name, dev->name); + link->dev = &hw_priv->node; local->shutdown = 0; @@ -791,7 +832,7 @@ static int prism2_config(dev_link_t *lin if (!ret) { ret = hostap_hw_ready(dev); if (ret == 0 && local->ddev) - strcpy(local->node.dev_name, local->ddev->name); + strcpy(hw_priv->node.dev_name, local->ddev->name); } kfree(parse); return ret; @@ -801,6 +842,7 @@ static int prism2_config(dev_link_t *lin failed: kfree(parse); + kfree(hw_priv); prism2_release((u_long)link); return ret; } Index: netdev-2.6/drivers/net/wireless/hostap/hostap_pci.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_pci.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_pci.c @@ -34,6 +34,12 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(PRISM2_VERSION); +/* struct local_info::hw_priv */ +struct hostap_pci_priv { + void __iomem *mem_start; +}; + + /* FIX: do we need mb/wmb/rmb with memory operations? */ @@ -61,7 +67,7 @@ static inline void hfa384x_outb_debug(st spin_lock_irqsave(&local->lock, flags); prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); - writeb(v, local->mem_start + a); + writeb(v, hw_priv->mem_start + a); spin_unlock_irqrestore(&local->lock, flags); } @@ -76,7 +82,7 @@ static inline u8 hfa384x_inb_debug(struc local = iface->local; spin_lock_irqsave(&local->lock, flags); - v = readb(local->mem_start + a); + v = readb(hw_priv->mem_start + a); prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v); spin_unlock_irqrestore(&local->lock, flags); return v; @@ -93,7 +99,7 @@ static inline void hfa384x_outw_debug(st spin_lock_irqsave(&local->lock, flags); prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); - writew(v, local->mem_start + a); + writew(v, hw_priv->mem_start + a); spin_unlock_irqrestore(&local->lock, flags); } @@ -108,7 +114,7 @@ static inline u16 hfa384x_inw_debug(stru local = iface->local; spin_lock_irqsave(&local->lock, flags); - v = readw(local->mem_start + a); + v = readw(hw_priv->mem_start + a); prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v); spin_unlock_irqrestore(&local->lock, flags); return v; @@ -126,37 +132,37 @@ static inline u16 hfa384x_inw_debug(stru static inline void hfa384x_outb(struct net_device *dev, int a, u8 v) { struct hostap_interface *iface; - local_info_t *local; + struct hostap_pci_priv *hw_priv; iface = netdev_priv(dev); - local = iface->local; - writeb(v, local->mem_start + a); + hw_priv = iface->local->hw_priv; + writeb(v, hw_priv->mem_start + a); } static inline u8 hfa384x_inb(struct net_device *dev, int a) { struct hostap_interface *iface; - local_info_t *local; + struct hostap_pci_priv *hw_priv; iface = netdev_priv(dev); - local = iface->local; - return readb(local->mem_start + a); + hw_priv = iface->local->hw_priv; + return readb(hw_priv->mem_start + a); } static inline void hfa384x_outw(struct net_device *dev, int a, u16 v) { struct hostap_interface *iface; - local_info_t *local; + struct hostap_pci_priv *hw_priv; iface = netdev_priv(dev); - local = iface->local; - writew(v, local->mem_start + a); + hw_priv = iface->local->hw_priv; + writew(v, hw_priv->mem_start + a); } static inline u16 hfa384x_inw(struct net_device *dev, int a) { struct hostap_interface *iface; - local_info_t *local; + struct hostap_pci_priv *hw_priv; iface = netdev_priv(dev); - local = iface->local; - return readw(local->mem_start + a); + hw_priv = iface->local->hw_priv; + return readw(hw_priv->mem_start + a); } #define HFA384X_OUTB(v,a) hfa384x_outb(dev, (a), (v)) @@ -288,6 +294,12 @@ static int prism2_pci_probe(struct pci_d static int cards_found /* = 0 */; int irq_registered = 0; struct hostap_interface *iface; + struct hostap_pci_priv *hw_priv; + + hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); + if (hw_priv == NULL) + return -ENOMEM; + memset(hw_priv, 0, sizeof(*hw_priv)); if (pci_enable_device(pdev)) return -EIO; @@ -311,10 +323,11 @@ static int prism2_pci_probe(struct pci_d goto fail; iface = netdev_priv(dev); local = iface->local; + local->hw_priv = hw_priv; cards_found++; dev->irq = pdev->irq; - local->mem_start = mem; + hw_priv->mem_start = mem; prism2_pci_cor_sreset(local); @@ -339,6 +352,8 @@ static int prism2_pci_probe(struct pci_d return hostap_hw_ready(dev); fail: + kfree(hw_priv); + if (irq_registered && dev) free_irq(dev->irq, dev); @@ -349,6 +364,9 @@ static int prism2_pci_probe(struct pci_d err_out_disable: pci_disable_device(pdev); + kfree(hw_priv); + if (local) + local->hw_priv = NULL; prism2_free_local_data(dev); return -ENODEV; @@ -360,9 +378,11 @@ static void prism2_pci_remove(struct pci struct net_device *dev; struct hostap_interface *iface; void __iomem *mem_start; + struct hostap_pci_priv *hw_priv; dev = pci_get_drvdata(pdev); iface = netdev_priv(dev); + hw_priv = iface->local->hw_priv; /* Reset the hardware, and ensure interrupts are disabled. */ prism2_pci_cor_sreset(iface->local); @@ -371,7 +391,9 @@ static void prism2_pci_remove(struct pci if (dev->irq) free_irq(dev->irq, dev); - mem_start = iface->local->mem_start; + mem_start = hw_priv->mem_start; + kfree(hw_priv); + iface->local->hw_priv = NULL; prism2_free_local_data(dev); iounmap(mem_start); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_plx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_plx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_plx.c @@ -42,6 +42,13 @@ module_param(ignore_cis, int, 0444); MODULE_PARM_DESC(ignore_cis, "Do not verify manfid information in CIS"); +/* struct local_info::hw_priv */ +struct hostap_plx_priv { + void __iomem *attr_mem; + unsigned int cor_offset; +}; + + #define PLX_MIN_ATTR_LEN 512 /* at least 2 x 256 is needed for CIS */ #define COR_SRESET 0x80 #define COR_LEVLREQ 0x40 @@ -261,27 +268,28 @@ static int hfa384x_to_bap(struct net_dev static void prism2_plx_cor_sreset(local_info_t *local) { unsigned char corsave; + struct hostap_plx_priv *hw_priv = local->hw_priv; printk(KERN_DEBUG "%s: Doing reset via direct COR access.\n", dev_info); /* Set sreset bit of COR and clear it after hold time */ - if (local->attr_mem == NULL) { + if (hw_priv->attr_mem == NULL) { /* TMD7160 - COR at card's first I/O addr */ - corsave = inb(local->cor_offset); - outb(corsave | COR_SRESET, local->cor_offset); + corsave = inb(hw_priv->cor_offset); + outb(corsave | COR_SRESET, hw_priv->cor_offset); mdelay(2); - outb(corsave & ~COR_SRESET, local->cor_offset); + outb(corsave & ~COR_SRESET, hw_priv->cor_offset); mdelay(2); } else { /* PLX9052 */ - corsave = readb(local->attr_mem + local->cor_offset); + corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset); writeb(corsave | COR_SRESET, - local->attr_mem + local->cor_offset); + hw_priv->attr_mem + hw_priv->cor_offset); mdelay(2); writeb(corsave & ~COR_SRESET, - local->attr_mem + local->cor_offset); + hw_priv->attr_mem + hw_priv->cor_offset); mdelay(2); } } @@ -290,26 +298,27 @@ static void prism2_plx_cor_sreset(local_ static void prism2_plx_genesis_reset(local_info_t *local, int hcr) { unsigned char corsave; + struct hostap_plx_priv *hw_priv = local->hw_priv; - if (local->attr_mem == NULL) { + if (hw_priv->attr_mem == NULL) { /* TMD7160 - COR at card's first I/O addr */ - corsave = inb(local->cor_offset); - outb(corsave | COR_SRESET, local->cor_offset); + corsave = inb(hw_priv->cor_offset); + outb(corsave | COR_SRESET, hw_priv->cor_offset); mdelay(10); - outb(hcr, local->cor_offset + 2); + outb(hcr, hw_priv->cor_offset + 2); mdelay(10); - outb(corsave & ~COR_SRESET, local->cor_offset); + outb(corsave & ~COR_SRESET, hw_priv->cor_offset); mdelay(10); } else { /* PLX9052 */ - corsave = readb(local->attr_mem + local->cor_offset); + corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset); writeb(corsave | COR_SRESET, - local->attr_mem + local->cor_offset); + hw_priv->attr_mem + hw_priv->cor_offset); mdelay(10); - writeb(hcr, local->attr_mem + local->cor_offset + 2); + writeb(hcr, hw_priv->attr_mem + hw_priv->cor_offset + 2); mdelay(10); writeb(corsave & ~COR_SRESET, - local->attr_mem + local->cor_offset); + hw_priv->attr_mem + hw_priv->cor_offset); mdelay(10); } } @@ -438,6 +447,12 @@ static int prism2_plx_probe(struct pci_d static int cards_found /* = 0 */; int irq_registered = 0; int tmd7160; + struct hostap_plx_priv *hw_priv; + + hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); + if (hw_priv == NULL) + return -ENOMEM; + memset(hw_priv, 0, sizeof(*hw_priv)); if (pci_enable_device(pdev)) return -EIO; @@ -529,12 +544,13 @@ static int prism2_plx_probe(struct pci_d goto fail; iface = netdev_priv(dev); local = iface->local; + local->hw_priv = hw_priv; cards_found++; dev->irq = pdev->irq; dev->base_addr = pccard_ioaddr; - local->attr_mem = attr_mem; - local->cor_offset = cor_offset; + hw_priv->attr_mem = attr_mem; + hw_priv->cor_offset = cor_offset; pci_set_drvdata(pdev, dev); @@ -554,6 +570,9 @@ static int prism2_plx_probe(struct pci_d return hostap_hw_ready(dev); fail: + kfree(hw_priv); + if (local) + local->hw_priv = NULL; prism2_free_local_data(dev); if (irq_registered && dev) @@ -572,19 +591,23 @@ static void prism2_plx_remove(struct pci { struct net_device *dev; struct hostap_interface *iface; + struct hostap_plx_priv *hw_priv; dev = pci_get_drvdata(pdev); iface = netdev_priv(dev); + hw_priv = iface->local->hw_priv; /* Reset the hardware, and ensure interrupts are disabled. */ prism2_plx_cor_sreset(iface->local); hfa384x_disable_interrupts(dev); - if (iface->local->attr_mem) - iounmap(iface->local->attr_mem); + if (hw_priv->attr_mem) + iounmap(hw_priv->attr_mem); if (dev->irq) free_irq(dev->irq, dev); + kfree(iface->local->hw_priv); + iface->local->hw_priv = NULL; prism2_free_local_data(dev); pci_disable_device(pdev); } Index: netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h @@ -876,27 +876,8 @@ struct local_info { int io_debug_enabled; #endif /* PRISM2_IO_DEBUG */ - /* struct local_info is used also in hostap.o that does not define - * any PRISM2_{PCCARD,PLX,PCI}. Make sure that the hardware version - * specific fields are in the end of the struct (these could also be - * moved to void *priv or something like that). */ -#ifdef PRISM2_PCCARD - dev_node_t node; - dev_link_t *link; - int sandisk_connectplus; -#endif /* PRISM2_PCCARD */ - -#ifdef PRISM2_PLX - void __iomem *attr_mem; - unsigned int cor_offset; -#endif /* PRISM2_PLX */ - -#ifdef PRISM2_PCI - void __iomem *mem_start; -#endif /* PRISM2_PCI */ - - /* NOTE! Do not add common entries here after hardware version - * specific blocks. */ + /* Pointer to hardware model specific (cs,pci,plx) private data. */ + void *hw_priv; }; -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:52
|
Replace temporary HOSTAP_FC_GET_{TYPE,STYPE} macros with the ieee80211 version of WLAN_FC_GET_{TYPE,STYPE}. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap.c @@ -594,7 +594,7 @@ void hostap_dump_rx_header(const char *n fc = __le16_to_cpu(rx->frame_control); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " "data_len=%d%s%s\n", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), __le16_to_cpu(rx->data_len), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -623,7 +623,7 @@ void hostap_dump_tx_header(const char *n fc = __le16_to_cpu(tx->frame_control); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " "data_len=%d%s%s\n", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), __le16_to_cpu(tx->data_len), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -666,15 +666,15 @@ int hostap_80211_get_hdrlen(u16 fc) { int hdrlen = 24; - switch (HOSTAP_FC_GET_TYPE(fc)) { - case WLAN_FC_TYPE_DATA: + switch (WLAN_FC_GET_TYPE(fc)) { + case IEEE80211_FTYPE_DATA: if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) hdrlen = 30; /* Addr4 */ break; - case WLAN_FC_TYPE_CTRL: - switch (HOSTAP_FC_GET_STYPE(fc)) { - case WLAN_FC_STYPE_CTS: - case WLAN_FC_STYPE_ACK: + case IEEE80211_FTYPE_CTL: + switch (WLAN_FC_GET_STYPE(fc)) { + case IEEE80211_STYPE_CTS: + case IEEE80211_STYPE_ACK: hdrlen = 10; break; default: @@ -1093,7 +1093,7 @@ int prism2_update_comms_qual(struct net_ } -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, +int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, u8 *body, size_t bodylen) { struct sk_buff *skb; @@ -1108,8 +1108,7 @@ int prism2_sta_send_mgmt(local_info_t *l mgmt = (struct hostap_ieee80211_mgmt *) skb_put(skb, IEEE80211_MGMT_HDR_LEN); memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN); - mgmt->frame_control = - cpu_to_le16((WLAN_FC_TYPE_MGMT << 2) | (stype << 4)); + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); memcpy(mgmt->da, dst, ETH_ALEN); memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); memcpy(mgmt->bssid, dst, ETH_ALEN); @@ -1140,7 +1139,7 @@ int prism2_sta_deauth(local_info_t *loca return 0; reason = cpu_to_le16(reason); - ret = prism2_sta_send_mgmt(local, local->bssid, WLAN_FC_STYPE_DEAUTH, + ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_rx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c @@ -21,7 +21,7 @@ void hostap_dump_rx_80211(const char *na fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); @@ -445,8 +445,8 @@ hostap_rx_frame_mgmt(local_info_t *local skb->data); } - if (local->hostapd && type == WLAN_FC_TYPE_MGMT) { - if (stype == WLAN_FC_STYPE_BEACON && + if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { + if (stype == IEEE80211_STYPE_BEACON && local->iw_mode == IW_MODE_MASTER) { struct sk_buff *skb2; /* Process beacon frames also in kernel driver to @@ -467,23 +467,24 @@ hostap_rx_frame_mgmt(local_info_t *local } if (local->iw_mode == IW_MODE_MASTER) { - if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { + if (type != IEEE80211_FTYPE_MGMT && + type != IEEE80211_FTYPE_CTL) { printk(KERN_DEBUG "%s: unknown management frame " "(type=0x%02x, stype=0x%02x) dropped\n", - skb->dev->name, type, stype); + skb->dev->name, type >> 2, stype >> 4); return -1; } hostap_rx(skb->dev, skb, rx_stats); return 0; - } else if (type == WLAN_FC_TYPE_MGMT && - (stype == WLAN_FC_STYPE_BEACON || - stype == WLAN_FC_STYPE_PROBE_RESP)) { + } else if (type == IEEE80211_FTYPE_MGMT && + (stype == IEEE80211_STYPE_BEACON || + stype == IEEE80211_STYPE_PROBE_RESP)) { hostap_rx_sta_beacon(local, skb, stype); return -1; - } else if (type == WLAN_FC_TYPE_MGMT && - (stype == WLAN_FC_STYPE_ASSOC_RESP || - stype == WLAN_FC_STYPE_REASSOC_RESP)) { + } else if (type == IEEE80211_FTYPE_MGMT && + (stype == IEEE80211_STYPE_ASSOC_RESP || + stype == IEEE80211_STYPE_REASSOC_RESP)) { /* Ignore (Re)AssocResp silently since these are not currently * needed but are still received when WPA/RSN mode is enabled. */ @@ -491,7 +492,7 @@ hostap_rx_frame_mgmt(local_info_t *local } else { printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled" " management frame in non-Host AP mode (type=%d:%d)\n", - skb->dev->name, type, stype); + skb->dev->name, type >> 2, stype >> 4); return -1; } } @@ -719,8 +720,8 @@ void hostap_80211_rx(struct net_device * goto rx_dropped; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); hdrlen = hostap_80211_get_hdrlen(fc); @@ -784,8 +785,9 @@ void hostap_80211_rx(struct net_device * } } - if (type != WLAN_FC_TYPE_DATA) { - if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && + if (type != IEEE80211_FTYPE_DATA) { + if (type == IEEE80211_FTYPE_MGMT && + stype == IEEE80211_STYPE_AUTH && fc & WLAN_FC_ISWEP && local->host_decrypt && (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) { @@ -867,14 +869,14 @@ void hostap_80211_rx(struct net_device * /* Nullfunc frames may have PS-bit set, so they must be passed to * hostap_handle_sta_rx() before being dropped here. */ - if (stype != WLAN_FC_STYPE_DATA && - stype != WLAN_FC_STYPE_DATA_CFACK && - stype != WLAN_FC_STYPE_DATA_CFPOLL && - stype != WLAN_FC_STYPE_DATA_CFACKPOLL) { - if (stype != WLAN_FC_STYPE_NULLFUNC) + if (stype != IEEE80211_STYPE_DATA && + stype != IEEE80211_STYPE_DATA_CFACK && + stype != IEEE80211_STYPE_DATA_CFPOLL && + stype != IEEE80211_STYPE_DATA_CFACKPOLL) { + if (stype != IEEE80211_STYPE_NULLFUNC) printk(KERN_DEBUG "%s: RX: dropped data frame " "with no data (type=0x%02x, subtype=0x%02x)\n", - dev->name, type, stype); + dev->name, type >> 2, stype >> 4); goto rx_dropped; } Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_tx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c @@ -13,7 +13,7 @@ void hostap_dump_tx_80211(const char *na fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), + fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " [ToDS]" : "", fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); @@ -115,7 +115,7 @@ int hostap_data_start_xmit(struct sk_buf skip_header_bytes -= 2; } - fc = (WLAN_FC_TYPE_DATA << 2) | (WLAN_FC_STYPE_DATA << 4); + fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; hdr_len = IEEE80211_DATA_HDR3_LEN; if (use_wds != WDS_NO) { @@ -268,8 +268,8 @@ int hostap_mgmt_start_xmit(struct sk_buf if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && - HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && + WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header)]; meta->ethertype = (pos[0] << 8) | pos[1]; @@ -410,7 +410,7 @@ int hostap_master_start_xmit(struct sk_b break; case AP_TX_CONTINUE_NOT_AUTHORIZED: if (local->ieee_802_1x && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && meta->ethertype != ETH_P_PAE && !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { printk(KERN_DEBUG "%s: dropped frame to unauthorized " @@ -448,7 +448,7 @@ int hostap_master_start_xmit(struct sk_b hdr->frame_ctl = cpu_to_le16(fc); } - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) { no_encrypt = 1; tx.crypt = NULL; } @@ -469,7 +469,7 @@ int hostap_master_start_xmit(struct sk_b fc |= WLAN_FC_ISWEP; hdr->frame_ctl = cpu_to_le16(fc); } else if (local->drop_unencrypted && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && meta->ethertype != ETH_P_PAE) { if (net_ratelimit()) { printk(KERN_DEBUG "%s: dropped unencrypted TX data " Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c @@ -46,7 +46,7 @@ static void handle_add_proc_queue(void * #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT static void handle_wds_oper_queue(void *data); static void prism2_send_mgmt(struct net_device *dev, - int type, int subtype, char *body, + u16 type_subtype, char *body, int body_len, u8 *addr, u16 tx_cb_idx); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ @@ -237,12 +237,12 @@ static void ap_handle_timer(unsigned lon } else if (sta->timeout_next == STA_NULLFUNC) { /* send data frame to poll STA and check whether this frame * is ACKed */ - /* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but + /* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but * it is apparently not retried so TX Exc events are not * received for it */ sta->flags |= WLAN_STA_PENDING_POLL; - prism2_send_mgmt(local->dev, WLAN_FC_TYPE_DATA, - WLAN_FC_STYPE_DATA, NULL, 0, + prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA | + IEEE80211_STYPE_DATA, NULL, 0, sta->addr, ap->tx_callback_poll); } else { int deauth = sta->timeout_next == STA_DEAUTH; @@ -255,9 +255,9 @@ static void ap_handle_timer(unsigned lon resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - prism2_send_mgmt(local->dev, WLAN_FC_TYPE_MGMT, - (deauth ? WLAN_FC_STYPE_DEAUTH : - WLAN_FC_STYPE_DISASSOC), + prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT | + (deauth ? IEEE80211_STYPE_DEAUTH : + IEEE80211_STYPE_DISASSOC), (char *) &resp, 2, sta->addr, 0); } @@ -300,7 +300,8 @@ void hostap_deauth_all_stas(struct net_d * else we can do at this point since the driver is going to be shut * down */ for (i = 0; i < 5; i++) { - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | + IEEE80211_STYPE_DEAUTH, (char *) &resp, 2, addr, 0); if (!resend || ap->num_sta <= 0) @@ -471,7 +472,7 @@ static int ap_control_kick_mac(struct ap return -EINVAL; resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_DEAUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH, (char *) &resp, 2, sta->addr, 0); if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) @@ -634,8 +635,8 @@ static void hostap_ap_tx_cb_auth(struct hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || - HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH || + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || + WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || skb->len < IEEE80211_MGMT_HDR_LEN + 6) { printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " "frame\n", dev->name); @@ -703,9 +704,9 @@ static void hostap_ap_tx_cb_assoc(struct hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || - (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP && - HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) || + if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || + (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && + WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) || skb->len < IEEE80211_MGMT_HDR_LEN + 4) { printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " "frame\n", dev->name); @@ -912,7 +913,7 @@ static struct sta_info* ap_get_sta(struc /* Called from timer handler and from scheduled AP queue handlers */ static void prism2_send_mgmt(struct net_device *dev, - int type, int subtype, char *body, + u16 type_subtype, char *body, int body_len, u8 *addr, u16 tx_cb_idx) { struct hostap_interface *iface; @@ -941,7 +942,7 @@ static void prism2_send_mgmt(struct net_ return; } - fc = (type << 2) | (subtype << 4); + fc = type_subtype; hdrlen = hostap_80211_get_hdrlen(fc); hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); if (body) @@ -954,11 +955,11 @@ static void prism2_send_mgmt(struct net_ memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ - if (type == WLAN_FC_TYPE_DATA) { + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { fc |= WLAN_FC_FROMDS; memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ - } else if (type == WLAN_FC_TYPE_CTRL) { + } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { /* control:ACK does not have addr2 or addr3 */ memset(hdr->addr2, 0, ETH_ALEN); memset(hdr->addr3, 0, ETH_ALEN); @@ -1475,7 +1476,7 @@ static void handle_authen(local_info_t * olen += 2 + WLAN_AUTH_CHALLENGE_LEN; } - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, WLAN_FC_STYPE_AUTH, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH, body, olen, hdr->addr2, ap->tx_callback_auth); if (sta) { @@ -1673,10 +1674,10 @@ static void handle_assoc(local_info_t *l pos = (u16 *) p; } - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, - (send_deauth ? WLAN_FC_STYPE_DEAUTH : - (reassoc ? WLAN_FC_STYPE_REASSOC_RESP : - WLAN_FC_STYPE_ASSOC_RESP)), + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | + (send_deauth ? IEEE80211_STYPE_DEAUTH : + (reassoc ? IEEE80211_STYPE_REASSOC_RESP : + IEEE80211_STYPE_ASSOC_RESP)), body, (u8 *) pos - (u8 *) body, hdr->addr2, send_deauth ? 0 : local->ap->tx_callback_assoc); @@ -1793,7 +1794,7 @@ static void ap_handle_data_nullfunc(loca * send control::ACK for the data::nullfunc */ printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n"); - prism2_send_mgmt(dev, WLAN_FC_TYPE_CTRL, WLAN_FC_STYPE_ACK, + prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK, NULL, 0, hdr->addr2, 0); } @@ -1820,9 +1821,9 @@ static void ap_handle_dropped_data(local reason = __constant_cpu_to_le16( WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); - prism2_send_mgmt(dev, WLAN_FC_TYPE_MGMT, + prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? - WLAN_FC_STYPE_DEAUTH : WLAN_FC_STYPE_DISASSOC), + IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), (char *) &reason, sizeof(reason), hdr->addr2, 0); if (sta) @@ -2142,15 +2143,15 @@ static void handle_ap_item(local_info_t * buffer is long enough */ hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (!local->hostapd && type == WLAN_FC_TYPE_DATA) { + if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { - if (stype == WLAN_FC_STYPE_NULLFUNC) { + if (stype == IEEE80211_STYPE_NULLFUNC) { /* no ToDS nullfunc seems to be used to check * AP association; so send reject message to * speed up re-association */ @@ -2169,20 +2170,21 @@ static void handle_ap_item(local_info_t goto done; } - if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC) + if (local->ap->nullfunc_ack && + stype == IEEE80211_STYPE_NULLFUNC) ap_handle_data_nullfunc(local, hdr); else ap_handle_dropped_data(local, hdr); goto done; } - if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) { + if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) { handle_beacon(local, skb, rx_stats); goto done; } #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - if (type == WLAN_FC_TYPE_CTRL && stype == WLAN_FC_STYPE_PSPOLL) { + if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) { handle_pspoll(local, hdr, rx_stats); goto done; } @@ -2194,7 +2196,7 @@ static void handle_ap_item(local_info_t } #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (type != WLAN_FC_TYPE_MGMT) { + if (type != IEEE80211_FTYPE_MGMT) { PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n"); goto done; } @@ -2212,32 +2214,33 @@ static void handle_ap_item(local_info_t } switch (stype) { - case WLAN_FC_STYPE_ASSOC_REQ: + case IEEE80211_STYPE_ASSOC_REQ: handle_assoc(local, skb, rx_stats, 0); break; - case WLAN_FC_STYPE_ASSOC_RESP: + case IEEE80211_STYPE_ASSOC_RESP: PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n"); break; - case WLAN_FC_STYPE_REASSOC_REQ: + case IEEE80211_STYPE_REASSOC_REQ: handle_assoc(local, skb, rx_stats, 1); break; - case WLAN_FC_STYPE_REASSOC_RESP: + case IEEE80211_STYPE_REASSOC_RESP: PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n"); break; - case WLAN_FC_STYPE_ATIM: + case IEEE80211_STYPE_ATIM: PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n"); break; - case WLAN_FC_STYPE_DISASSOC: + case IEEE80211_STYPE_DISASSOC: handle_disassoc(local, skb, rx_stats); break; - case WLAN_FC_STYPE_AUTH: + case IEEE80211_STYPE_AUTH: handle_authen(local, skb, rx_stats); break; - case WLAN_FC_STYPE_DEAUTH: + case IEEE80211_STYPE_DEAUTH: handle_deauth(local, skb, rx_stats); break; default: - PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", stype); + PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", + stype >> 4); break; } #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ @@ -2268,8 +2271,8 @@ void hostap_rx(struct net_device *dev, s fc = le16_to_cpu(hdr->frame_ctl); if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && - HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON) + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT && + WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON) goto drop; skb->protocol = __constant_htons(ETH_P_HOSTAP); @@ -2302,7 +2305,7 @@ static void schedule_packet_send(local_i /* Generate a fake pspoll frame to start packet delivery */ hdr->frame_ctl = __constant_cpu_to_le16( - (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4)); + IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); memcpy(hdr->addr2, sta->addr, ETH_ALEN); hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); @@ -2872,13 +2875,14 @@ static void hostap_update_sta_ps2(local_ sta->flags |= WLAN_STA_PS; PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS " "mode (type=0x%02X, stype=0x%02X)\n", - MAC2STR(sta->addr), type, stype); + MAC2STR(sta->addr), type >> 2, stype >> 4); } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { sta->flags &= ~WLAN_STA_PS; PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use " "PS mode (type=0x%02X, stype=0x%02X)\n", - MAC2STR(sta->addr), type, stype); - if (type != WLAN_FC_TYPE_CTRL || stype != WLAN_FC_STYPE_PSPOLL) + MAC2STR(sta->addr), type >> 2, stype >> 4); + if (type != IEEE80211_FTYPE_CTL || + stype != IEEE80211_STYPE_PSPOLL) schedule_packet_send(local, sta); } } @@ -2902,7 +2906,7 @@ int hostap_update_sta_ps(local_info_t *l fc = le16_to_cpu(hdr->frame_ctl); hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, - HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc)); + WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); atomic_dec(&sta->users); return 0; @@ -2927,8 +2931,8 @@ ap_rx_ret hostap_handle_sta_rx(local_inf hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - type = HOSTAP_FC_GET_TYPE(fc); - stype = HOSTAP_FC_GET_STYPE(fc); + type = WLAN_FC_GET_TYPE(fc); + stype = WLAN_FC_GET_STYPE(fc); spin_lock(&local->ap->sta_table_lock); sta = ap_get_sta(local->ap, hdr->addr2); @@ -2952,8 +2956,8 @@ ap_rx_ret hostap_handle_sta_rx(local_inf printk(KERN_DEBUG "%s: dropped received packet" " from non-associated STA " MACSTR " (type=0x%02x, subtype=0x%02x)\n", - dev->name, MAC2STR(hdr->addr2), type, - stype); + dev->name, MAC2STR(hdr->addr2), + type >> 2, stype >> 4); hostap_rx(dev, skb, rx_stats); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ } @@ -2972,7 +2976,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf ret = AP_RX_DROP; goto out; } - } else if (stype == WLAN_FC_STYPE_NULLFUNC && sta == NULL && + } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL && memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { if (local->hostapd) { @@ -2994,7 +2998,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf } ret = AP_RX_EXIT; goto out; - } else if (stype == WLAN_FC_STYPE_NULLFUNC) { + } else if (stype == IEEE80211_STYPE_NULLFUNC) { /* At least Lucent cards seem to send periodic nullfunc * frames with ToDS. Let these through to update SQ * stats and PS state. Nullfunc frames do not contain @@ -3007,7 +3011,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf printk(KERN_DEBUG "%s: dropped received packet from " MACSTR " with no ToDS flag (type=0x%02x, " "subtype=0x%02x)\n", dev->name, - MAC2STR(hdr->addr2), type, stype); + MAC2STR(hdr->addr2), type >> 2, stype >> 4); hostap_dump_rx_80211(dev->name, skb, rx_stats); } ret = AP_RX_DROP; @@ -3023,7 +3027,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf sta->last_rx = jiffies; } - if (local->ap->nullfunc_ack && stype == WLAN_FC_STYPE_NULLFUNC && + if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && fc & WLAN_FC_TODS) { if (local->hostapd) { prism2_rx_80211(local->apdev, skb, rx_stats, Index: netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c @@ -1843,7 +1843,7 @@ static int prism2_tx_80211(struct sk_buf hdr_len = 24; memcpy(&txdesc.frame_control, skb->data, hdr_len); fc = le16_to_cpu(txdesc.frame_control); - if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && + if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && (fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) { /* Addr4 */ memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); @@ -2395,10 +2395,10 @@ static void prism2_txexc(local_info_t *l PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " "(%s%s%s::%d%s%s)\n", txdesc.retry_count, txdesc.tx_rate, fc, - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT ? "Mgmt" : "", - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_CTRL ? "Ctrl" : "", - HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ? "Data" : "", - HOSTAP_FC_GET_STYPE(fc), + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT ? "Mgmt" : "", + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", + WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", + WLAN_FC_GET_STYPE(fc) >> 4, fc & WLAN_FC_TODS ? " ToDS" : "", fc & WLAN_FC_FROMDS ? " FromDS" : ""); PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3=" Index: netdev-2.6/drivers/net/wireless/hostap/hostap.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap.h @@ -37,7 +37,7 @@ struct net_device * hostap_add_interface void hostap_remove_interface(struct net_device *dev, int rtnl_locked, int remove_from_list); int prism2_update_comms_qual(struct net_device *dev); -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u8 stype, +int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, u8 *body, size_t bodylen); int prism2_sta_deauth(local_info_t *local, u16 reason); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_common.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_common.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_common.h @@ -19,49 +19,6 @@ #define WLAN_FC_ISWEP BIT(14) #define WLAN_FC_ORDER BIT(15) -/* - * To be replaced with ieee80211.h WLAN_FC_GET_* once HostAP code is updated to - * use the versions without right shift. - */ -#define HOSTAP_FC_GET_TYPE(fc) (((fc) & (BIT(3) | BIT(2))) >> 2) -#define HOSTAP_FC_GET_STYPE(fc) \ - (((fc) & (BIT(7) | BIT(6) | BIT(5) | BIT(4))) >> 4) - -#define WLAN_FC_TYPE_MGMT 0 -#define WLAN_FC_TYPE_CTRL 1 -#define WLAN_FC_TYPE_DATA 2 - -/* management */ -#define WLAN_FC_STYPE_ASSOC_REQ 0 -#define WLAN_FC_STYPE_ASSOC_RESP 1 -#define WLAN_FC_STYPE_REASSOC_REQ 2 -#define WLAN_FC_STYPE_REASSOC_RESP 3 -#define WLAN_FC_STYPE_PROBE_REQ 4 -#define WLAN_FC_STYPE_PROBE_RESP 5 -#define WLAN_FC_STYPE_BEACON 8 -#define WLAN_FC_STYPE_ATIM 9 -#define WLAN_FC_STYPE_DISASSOC 10 -#define WLAN_FC_STYPE_AUTH 11 -#define WLAN_FC_STYPE_DEAUTH 12 - -/* control */ -#define WLAN_FC_STYPE_PSPOLL 10 -#define WLAN_FC_STYPE_RTS 11 -#define WLAN_FC_STYPE_CTS 12 -#define WLAN_FC_STYPE_ACK 13 -#define WLAN_FC_STYPE_CFEND 14 -#define WLAN_FC_STYPE_CFENDACK 15 - -/* data */ -#define WLAN_FC_STYPE_DATA 0 -#define WLAN_FC_STYPE_DATA_CFACK 1 -#define WLAN_FC_STYPE_DATA_CFPOLL 2 -#define WLAN_FC_STYPE_DATA_CFACKPOLL 3 -#define WLAN_FC_STYPE_NULLFUNC 4 -#define WLAN_FC_STYPE_CFACK 5 -#define WLAN_FC_STYPE_CFPOLL 6 -#define WLAN_FC_STYPE_CFACKPOLL 7 - #define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ioctl.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ioctl.c @@ -3784,11 +3784,11 @@ static int prism2_ioctl_siwmlme(struct n switch (mlme->cmd) { case IW_MLME_DEAUTH: return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - WLAN_FC_STYPE_DEAUTH, + IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); case IW_MLME_DISASSOC: return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - WLAN_FC_STYPE_DISASSOC, + IEEE80211_STYPE_DISASSOC, (u8 *) &reason, 2); default: return -EOPNOTSUPP; @@ -3805,11 +3805,11 @@ static int prism2_ioctl_mlme(local_info_ switch (param->u.mlme.cmd) { case MLME_STA_DEAUTH: return prism2_sta_send_mgmt(local, param->sta_addr, - WLAN_FC_STYPE_DEAUTH, + IEEE80211_STYPE_DEAUTH, (u8 *) &reason, 2); case MLME_STA_DISASSOC: return prism2_sta_send_mgmt(local, param->sta_addr, - WLAN_FC_STYPE_DISASSOC, + IEEE80211_STYPE_DISASSOC, (u8 *) &reason, 2); default: return -EOPNOTSUPP; -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:51
|
PCI version of Prism2.5/3 has undocumented DMA support for TX/RX data, but this seems to have some hardware bugs that prevent it from being used properly for TX. RX side could possibly be made to work reliably. Even though DMA support would be very useful for saving host CPU (from about 40% to 5-10% when operating at maximum throughput), it seems to be best to just remove this code finally. The implementation has always been commented out by default and has received very limited testing. The code may have already been broken number of times and I don't have much interested in trying to verify whether it works or not. Getting this out makes it easier to maintain the driver and allows some cleanups that have been partly postponed because of this experimental bus master/DMA code. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h @@ -787,10 +787,6 @@ struct local_info { struct prism2_helper_functions *func; - int bus_master_threshold_tx; - int bus_master_threshold_rx; - u8 *bus_m1_buf; - u8 *pda; int fw_ap; #define PRISM2_FW_VER(major, minor, variant) \ @@ -897,14 +893,6 @@ struct local_info { #ifdef PRISM2_PCI void __iomem *mem_start; -#ifdef PRISM2_BUS_MASTER - /* bus master for BAP0 (TX) */ - int bus_m0_tx_idx; - u8 *bus_m0_buf; - - /* bus master for BAP1 (RX) */ - struct sk_buff *rx_skb; -#endif /* PRISM2_BUS_MASTER */ #endif /* PRISM2_PCI */ /* NOTE! Do not add common entries here after hardware version Index: netdev-2.6/drivers/net/wireless/hostap/hostap_common.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_common.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_common.h @@ -343,8 +343,8 @@ enum { PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16, PRISM2_PARAM_HOST_ENCRYPT = 17, PRISM2_PARAM_HOST_DECRYPT = 18, - PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19, - PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20, + /* PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19, REMOVED 2005-08-14 */ + /* PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20, REMOVED 2005-08-14 */ PRISM2_PARAM_HOST_ROAMING = 21, PRISM2_PARAM_BCRX_STA_KEY = 22, PRISM2_PARAM_IEEE_802_1X = 23, Index: netdev-2.6/drivers/net/wireless/hostap/hostap_config.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_config.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_config.h @@ -13,37 +13,6 @@ /* Maximum number of events handler per one interrupt */ #define PRISM2_MAX_INTERRUPT_EVENTS 20 -/* Use PCI bus master to copy data to/from BAP (only available for - * hostap_pci.o). - * - * Note! This is extremely experimental. PCI bus master is not supported by - * Intersil and it seems to have some problems at least on TX path (see below). - * The driver code for implementing bus master support is based on guessing - * and experimenting suitable control bits and these might not be correct. - * This code is included because using bus master makes a huge difference in - * host CPU load (something like 40% host CPU usage to 5-10% when sending or - * receiving at maximum throughput). - * - * Note2! Station firmware version 1.3.5 and primary firmware version 1.0.7 - * have some fixes for PCI corruption and these (or newer) versions are - * recommended especially when using bus mastering. - * - * NOTE: PCI bus mastering code has not been updated for long time and it is - * not likely to compile and it will _not_ work as is. Only enable this if you - * are prepared to first fix the implementation.. - */ -/* #define PRISM2_BUS_MASTER */ - -#ifdef PRISM2_BUS_MASTER - -/* PCI bus master implementation seems to be broken in current - * hardware/firmware versions. Enable this to use enable command to fix - * something before starting bus master operation on TX path. This will add - * some latency and an extra interrupt to each TX packet. */ -#define PRISM2_ENABLE_BEFORE_TX_BUS_MASTER - -#endif /* PRISM2_BUS_MASTER */ - /* Include code for downloading firmware images into volatile RAM. */ #define PRISM2_DOWNLOAD_SUPPORT Index: netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c @@ -83,18 +83,6 @@ static int dtim_period[MAX_PARM_DEVICES] module_param_array(dtim_period, int, NULL, 0444); MODULE_PARM_DESC(dtim_period, "DTIM period"); -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) -static int bus_master_threshold_rx[MAX_PARM_DEVICES] = { 100, DEF_INTS }; -module_param_array(bus_master_threshold_rx, int, NULL, 0444); -MODULE_PARM_DESC(bus_master_threshold_rx, "Packet length threshold for using " - "PCI bus master on RX"); - -static int bus_master_threshold_tx[MAX_PARM_DEVICES] = { 100, DEF_INTS }; -module_param_array(bus_master_threshold_tx, int, NULL, 0444); -MODULE_PARM_DESC(bus_master_threshold_tx, "Packet length threshold for using " - "PCI bus master on TX"); -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - static char dev_template[16] = "wlan%d"; module_param_string(dev_template, dev_template, sizeof(dev_template), 0444); MODULE_PARM_DESC(dev_template, "Prefix for network device name (default: " @@ -107,12 +95,6 @@ MODULE_PARM_DESC(dev_template, "Prefix f #define EXTRA_EVENTS_WTERR HFA384X_EV_WTERR #endif -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) -#define EXTRA_EVENTS_BUS_MASTER (HFA384X_EV_PCI_M0 | HFA384X_EV_PCI_M1) -#else -#define EXTRA_EVENTS_BUS_MASTER 0 -#endif - /* Events that will be using BAP0 */ #define HFA384X_BAP0_EVENTS \ (HFA384X_EV_TXEXC | HFA384X_EV_RX | HFA384X_EV_INFO | HFA384X_EV_TX) @@ -121,7 +103,7 @@ MODULE_PARM_DESC(dev_template, "Prefix f #define HFA384X_EVENT_MASK \ (HFA384X_BAP0_EVENTS | HFA384X_EV_ALLOC | HFA384X_EV_INFDROP | \ HFA384X_EV_CMD | HFA384X_EV_TICK | \ - EXTRA_EVENTS_WTERR | EXTRA_EVENTS_BUS_MASTER) + EXTRA_EVENTS_WTERR) /* Default TX control flags: use 802.11 headers and request interrupt for * failed transmits. Frames that request ACK callback, will add @@ -1827,34 +1809,6 @@ static int prism2_transmit(struct net_de } -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) -/* Called only from hardware IRQ */ -static void prism2_tx_cb(struct net_device *dev, void *context, - u16 resp0, u16 res) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long addr; - int buf_len = (int) context; - - iface = netdev_priv(dev); - local = iface->local; - - if (res) { - printk(KERN_DEBUG "%s: prism2_tx_cb - res=0x%02x\n", - dev->name, res); - return; - } - - addr = virt_to_phys(local->bus_m0_buf); - HFA384X_OUTW((addr & 0xffff0000) >> 16, HFA384X_PCI_M0_ADDRH_OFF); - HFA384X_OUTW(addr & 0x0000ffff, HFA384X_PCI_M0_ADDRL_OFF); - HFA384X_OUTW(buf_len / 2, HFA384X_PCI_M0_LEN_OFF); - HFA384X_OUTW(HFA384X_PCI_CTL_TO_BAP, HFA384X_PCI_M0_CTL_OFF); -} -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - - /* Send IEEE 802.11 frame (convert the header into Prism2 TX descriptor and * send the payload with this descriptor) */ /* Called only from software IRQ */ @@ -1920,53 +1874,6 @@ static int prism2_tx_80211(struct sk_buf spin_lock(&local->baplock); res = hfa384x_setup_bap(dev, BAP0, local->txfid[idx], 0); -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - if (!res && skb->len >= local->bus_master_threshold_tx) { - u8 *pos; - int buf_len; - - local->bus_m0_tx_idx = idx; - - /* FIX: BAP0 should be locked during bus master transfer, but - * baplock with BH's disabled is not OK for this; netif queue - * stopping is not enough since BAP0 is used also for RID - * read/write */ - - /* stop the queue for the time that bus mastering on BAP0 is - * in use */ - netif_stop_queue(dev); - - spin_unlock(&local->baplock); - - /* Copy frame data to bus_m0_buf */ - pos = local->bus_m0_buf; - memcpy(pos, &txdesc, sizeof(txdesc)); - pos += sizeof(txdesc); - memcpy(pos, skb->data + hdr_len, skb->len - hdr_len); - pos += skb->len - hdr_len; - buf_len = pos - local->bus_m0_buf; - if (buf_len & 1) - buf_len++; - -#ifdef PRISM2_ENABLE_BEFORE_TX_BUS_MASTER - /* Any RX packet seems to break something with TX bus - * mastering; enable command is enough to fix this.. */ - if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_ENABLE, 0, - prism2_tx_cb, (long) buf_len)) { - printk(KERN_DEBUG "%s: TX: enable port0 failed\n", - dev->name); - } -#else /* PRISM2_ENABLE_BEFORE_TX_BUS_MASTER */ - prism2_tx_cb(dev, (void *) buf_len, 0, 0); -#endif /* PRISM2_ENABLE_BEFORE_TX_BUS_MASTER */ - - /* Bus master transfer will be started from command completion - * event handler and TX handling will be finished by calling - * prism2_transmit() from bus master event handler */ - goto tx_stats; - } -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - if (!res) res = hfa384x_to_bap(dev, BAP0, &txdesc, sizeof(txdesc)); if (!res) @@ -2107,50 +2014,18 @@ static void prism2_rx(local_info_t *loca skb->dev = dev; memcpy(skb_put(skb, hdr_len), &rxdesc, hdr_len); -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - if (len >= local->bus_master_threshold_rx) { - unsigned long addr; - - hfa384x_events_no_bap1(dev); - - local->rx_skb = skb; - /* Internal BAP0 offset points to the byte following rxdesc; - * copy rest of the data using bus master */ - addr = virt_to_phys(skb_put(skb, len)); - HFA384X_OUTW((addr & 0xffff0000) >> 16, - HFA384X_PCI_M0_ADDRH_OFF); - HFA384X_OUTW(addr & 0x0000ffff, HFA384X_PCI_M0_ADDRL_OFF); - if (len & 1) - len++; - HFA384X_OUTW(len / 2, HFA384X_PCI_M0_LEN_OFF); - HFA384X_OUTW(HFA384X_PCI_CTL_FROM_BAP, HFA384X_PCI_M0_CTL_OFF); - - /* pci_bus_m1 event will be generated when data transfer is - * complete and the frame will then be added to rx_list and - * rx_tasklet is scheduled */ - rx_pending = 1; - - /* Have to release baplock before returning, although BAP0 - * should really not be used before DMA transfer has been - * completed. */ - spin_unlock(&local->baplock); - } else -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - { - if (len > 0) - res = hfa384x_from_bap(dev, BAP0, skb_put(skb, len), - len); - spin_unlock(&local->baplock); - if (res) { - printk(KERN_DEBUG "%s: RX failed to read " - "frame data\n", dev->name); - goto rx_dropped; - } - - skb_queue_tail(&local->rx_list, skb); - tasklet_schedule(&local->rx_tasklet); + if (len > 0) + res = hfa384x_from_bap(dev, BAP0, skb_put(skb, len), len); + spin_unlock(&local->baplock); + if (res) { + printk(KERN_DEBUG "%s: RX failed to read " + "frame data\n", dev->name); + goto rx_dropped; } + skb_queue_tail(&local->rx_list, skb); + tasklet_schedule(&local->rx_tasklet); + rx_exit: prism2_callback(local, PRISM2_CALLBACK_RX_END); if (!rx_pending) { @@ -2654,36 +2529,6 @@ static void hostap_bap_tasklet(unsigned } -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) -/* Called only from hardware IRQ */ -static void prism2_bus_master_ev(struct net_device *dev, int bap) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (bap == BAP1) { - /* FIX: frame payload was DMA'd to skb->data; might need to - * invalidate data cache for that memory area */ - skb_queue_tail(&local->rx_list, local->rx_skb); - tasklet_schedule(&local->rx_tasklet); - HFA384X_OUTW(HFA384X_EV_RX, HFA384X_EVACK_OFF); - } else { - if (prism2_transmit(dev, local->bus_m0_tx_idx)) { - printk(KERN_DEBUG "%s: prism2_transmit() failed " - "when called from bus master event\n", - dev->name); - local->intransmitfid[local->bus_m0_tx_idx] = - PRISM2_TXFID_EMPTY; - schedule_work(&local->reset_queue); - } - } -} -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - - /* Called only from hardware IRQ */ static void prism2_infdrop(struct net_device *dev) { @@ -2852,21 +2697,6 @@ static irqreturn_t prism2_interrupt(int HFA384X_OUTW(HFA384X_EV_TICK, HFA384X_EVACK_OFF); } -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - if (ev & HFA384X_EV_PCI_M0) { - prism2_bus_master_ev(dev, BAP0); - HFA384X_OUTW(HFA384X_EV_PCI_M0, HFA384X_EVACK_OFF); - } - - if (ev & HFA384X_EV_PCI_M1) { - /* previous RX has been copied can be ACKed now */ - HFA384X_OUTW(HFA384X_EV_RX, HFA384X_EVACK_OFF); - - prism2_bus_master_ev(dev, BAP1); - HFA384X_OUTW(HFA384X_EV_PCI_M1, HFA384X_EVACK_OFF); - } -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - if (ev & HFA384X_EV_ALLOC) { prism2_alloc_ev(dev); HFA384X_OUTW(HFA384X_EV_ALLOC, HFA384X_EVACK_OFF); @@ -3309,13 +3139,6 @@ prism2_init_local_data(struct prism2_hel local->io_debug_enabled = 1; #endif /* PRISM2_IO_DEBUG */ -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - local->bus_m0_buf = (u8 *) kmalloc(sizeof(struct hfa384x_tx_frame) + - PRISM2_DATA_MAXLEN, GFP_DMA); - if (local->bus_m0_buf == NULL) - goto fail; -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ - local->func = funcs; local->func->cmd = hfa384x_cmd; local->func->read_regs = hfa384x_read_regs; @@ -3376,12 +3199,6 @@ prism2_init_local_data(struct prism2_hel local->auth_algs = PRISM2_AUTH_OPEN | PRISM2_AUTH_SHARED_KEY; local->sram_type = -1; local->scan_channel_mask = 0xffff; -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - local->bus_master_threshold_rx = GET_INT_PARM(bus_master_threshold_rx, - card_idx); - local->bus_master_threshold_tx = GET_INT_PARM(bus_master_threshold_tx, - card_idx); -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ /* Initialize task queue structures */ INIT_WORK(&local->reset_queue, handle_reset_queue, local); @@ -3462,9 +3279,6 @@ while (0) return dev; fail: -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - kfree(local->bus_m0_buf); -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ free_netdev(dev); return NULL; } @@ -3586,9 +3400,6 @@ static void prism2_free_local_data(struc kfree(bss); } -#if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER) - kfree(local->bus_m0_buf); -#endif /* PRISM2_PCI and PRISM2_BUS_MASTER */ kfree(local->pda); kfree(local->last_scan_results); kfree(local->generic_elem); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ioctl.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ioctl.c @@ -2239,14 +2239,6 @@ static const struct iw_priv_args prism2_ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "host_decrypt" }, { PRISM2_PARAM_HOST_DECRYPT, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethost_decrypt" }, - { PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "busmaster_rx" }, - { PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbusmaster_rx" }, - { PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "busmaster_tx" }, - { PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbusmaster_tx" }, #ifndef PRISM2_NO_STATION_MODES { PRISM2_PARAM_HOST_ROAMING, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "host_roaming" }, @@ -2495,14 +2487,6 @@ static int prism2_ioctl_priv_prism2_para ret = -EINVAL; break; - case PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX: - local->bus_master_threshold_rx = value; - break; - - case PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX: - local->bus_master_threshold_tx = value; - break; - #ifndef PRISM2_NO_STATION_MODES case PRISM2_PARAM_HOST_ROAMING: if (value < 0 || value > 2) { @@ -2799,14 +2783,6 @@ static int prism2_ioctl_priv_get_prism2_ *param = local->host_decrypt; break; - case PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX: - *param = local->bus_master_threshold_rx; - break; - - case PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX: - *param = local->bus_master_threshold_tx; - break; - case PRISM2_PARAM_HOST_ROAMING: *param = local->host_roaming; break; Index: netdev-2.6/drivers/net/wireless/hostap/hostap_pci.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_pci.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_pci.c @@ -305,10 +305,6 @@ static int prism2_pci_probe(struct pci_d goto fail; } -#ifdef PRISM2_BUS_MASTER - pci_set_master(pdev); -#endif /* PRISM2_BUS_MASTER */ - dev = prism2_init_local_data(&prism2_pci_funcs, cards_found, &pdev->dev); if (dev == NULL) -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:51
|
Remove unused defines that are already available from generic kernel header files. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h @@ -18,13 +18,6 @@ * prism2_send_mgmt() sends these with dev_queue_xmit() to prism2_tx(). */ #define ETH_P_HOSTAP ETH_P_CONTROL -#ifndef ARPHRD_IEEE80211 -#define ARPHRD_IEEE80211 801 -#endif -#ifndef ARPHRD_IEEE80211_PRISM -#define ARPHRD_IEEE80211_PRISM 802 -#endif - /* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header * (from linux-wlan-ng) */ struct linux_wlan_ng_val { Index: netdev-2.6/drivers/net/wireless/hostap/hostap_common.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_common.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_common.h @@ -7,14 +7,6 @@ #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" -#ifndef ETH_P_PAE -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ -#endif /* ETH_P_PAE */ - -#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ - - - /* IEEE 802.11 defines */ #define WLAN_FC_PVER (BIT(1) | BIT(0)) -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:50
|
Replace remaining WLAN_FC_* defines with the ones used in ieee80211 header file. This completes the move from hostap version of frame control field processing to ieee80211 version. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_common.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_common.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_common.h @@ -9,16 +9,6 @@ /* IEEE 802.11 defines */ -#define WLAN_FC_PVER (BIT(1) | BIT(0)) -#define WLAN_FC_TODS BIT(8) -#define WLAN_FC_FROMDS BIT(9) -#define WLAN_FC_MOREFRAG BIT(10) -#define WLAN_FC_RETRY BIT(11) -#define WLAN_FC_PWRMGT BIT(12) -#define WLAN_FC_MOREDATA BIT(13) -#define WLAN_FC_ISWEP BIT(14) -#define WLAN_FC_ORDER BIT(15) - /* Information Element IDs */ #define WLAN_EID_SSID 0 #define WLAN_EID_SUPP_RATES 1 Index: netdev-2.6/drivers/net/wireless/hostap/hostap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap.c @@ -597,8 +597,8 @@ void hostap_dump_rx_header(const char *n fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), __le16_to_cpu(rx->data_len), - fc & WLAN_FC_TODS ? " [ToDS]" : "", - fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); + fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", + fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" MACSTR "\n", @@ -626,8 +626,8 @@ void hostap_dump_tx_header(const char *n fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), __le16_to_cpu(tx->data_len), - fc & WLAN_FC_TODS ? " [ToDS]" : "", - fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); + fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", + fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" MACSTR "\n", @@ -668,7 +668,7 @@ int hostap_80211_get_hdrlen(u16 fc) switch (WLAN_FC_GET_TYPE(fc)) { case IEEE80211_FTYPE_DATA: - if ((fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS)) + if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) hdrlen = 30; /* Addr4 */ break; case IEEE80211_FTYPE_CTL: Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_rx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c @@ -22,8 +22,8 @@ void hostap_dump_rx_80211(const char *na fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, - fc & WLAN_FC_TODS ? " [ToDS]" : "", - fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); + fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", + fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); if (skb->len < IEEE80211_DATA_HDR3_LEN) { printk("\n"); @@ -73,9 +73,9 @@ int prism2_rx_80211(struct net_device *d hdr = (struct ieee80211_hdr *) skb->data; fc = le16_to_cpu(hdr->frame_ctl); - if (type == PRISM2_RX_MGMT && (fc & WLAN_FC_PVER)) { + if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { printk(KERN_DEBUG "%s: dropped management frame with header " - "version %d\n", dev->name, fc & WLAN_FC_PVER); + "version %d\n", dev->name, fc & IEEE80211_FCTL_VERS); dev_kfree_skb_any(skb); return 0; } @@ -525,9 +525,9 @@ hostap_rx_frame_wds(local_info_t *local, { /* FIX: is this really supposed to accept WDS frames only in Master * mode? What about Repeater or Managed with WDS frames? */ - if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) != - (WLAN_FC_TODS | WLAN_FC_FROMDS) && - (local->iw_mode != IW_MODE_MASTER || !(fc & WLAN_FC_TODS))) + if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) != + (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS) && + (local->iw_mode != IW_MODE_MASTER || !(fc & IEEE80211_FCTL_TODS))) return 0; /* not a WDS frame */ /* Possible WDS frame: either IEEE 802.11 compliant (if FromDS) @@ -539,14 +539,15 @@ hostap_rx_frame_wds(local_info_t *local, /* RA (or BSSID) is not ours - drop */ PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with " "not own or broadcast %s=" MACSTR "\n", - local->dev->name, fc & WLAN_FC_FROMDS ? "RA" : "BSSID", + local->dev->name, + fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID", MAC2STR(hdr->addr1)); return -1; } /* check if the frame came from a registered WDS connection */ *wds = prism2_rx_get_wds(local, hdr->addr2); - if (*wds == NULL && fc & WLAN_FC_FROMDS && + if (*wds == NULL && fc & IEEE80211_FCTL_FROMDS && (local->iw_mode != IW_MODE_INFRA || !(local->wds_type & HOSTAP_WDS_AP_CLIENT) || memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) { @@ -560,7 +561,7 @@ hostap_rx_frame_wds(local_info_t *local, return -1; } - if (*wds && !(fc & WLAN_FC_FROMDS) && local->ap && + if (*wds && !(fc & IEEE80211_FCTL_FROMDS) && local->ap && hostap_is_sta_assoc(local->ap, hdr->addr2)) { /* STA is actually associated with us even though it has a * registered WDS link. Assume it is in 'AP client' mode. @@ -588,11 +589,13 @@ static int hostap_is_eapol_frame(local_i fc = le16_to_cpu(hdr->frame_ctl); /* check that the frame is unicast frame to us */ - if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS && + if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_TODS && memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { /* ToDS frame with own addr BSSID and DA */ - } else if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS && + } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_FROMDS && memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { /* FromDS frame with own addr as DA */ } else @@ -770,7 +773,7 @@ void hostap_80211_rx(struct net_device * crypt->ops->decrypt_mpdu == NULL)) crypt = NULL; - if (!crypt && (fc & WLAN_FC_ISWEP)) { + if (!crypt && (fc & IEEE80211_FCTL_WEP)) { #if 0 /* This seems to be triggered by some (multicast?) * frames from other than current BSS, so just drop the @@ -788,7 +791,7 @@ void hostap_80211_rx(struct net_device * if (type != IEEE80211_FTYPE_DATA) { if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_AUTH && - fc & WLAN_FC_ISWEP && local->host_decrypt && + fc & IEEE80211_FCTL_WEP && local->host_decrypt && (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) { printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " @@ -809,16 +812,16 @@ void hostap_80211_rx(struct net_device * if (skb->len < IEEE80211_DATA_HDR3_LEN) goto rx_dropped; - switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) { - case WLAN_FC_FROMDS: + switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { + case IEEE80211_FCTL_FROMDS: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr3, ETH_ALEN); break; - case WLAN_FC_TODS: + case IEEE80211_FCTL_TODS: memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); break; - case WLAN_FC_FROMDS | WLAN_FC_TODS: + case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: if (skb->len < IEEE80211_DATA_HDR4_LEN) goto rx_dropped; memcpy(dst, hdr->addr3, ETH_ALEN); @@ -838,7 +841,8 @@ void hostap_80211_rx(struct net_device * } if (local->iw_mode == IW_MODE_MASTER && !wds && - (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_FROMDS && + (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_FROMDS && local->stadev && memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) { /* Frame from BSSID of the AP for which we are a client */ @@ -882,22 +886,22 @@ void hostap_80211_rx(struct net_device * /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ - if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && + if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) && (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) goto rx_dropped; hdr = (struct ieee80211_hdr *) skb->data; /* skb: hdr + (possibly fragmented) plaintext payload */ - if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && - (frag != 0 || (fc & WLAN_FC_MOREFRAG))) { + if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) && + (frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { int flen; struct sk_buff *frag_skb = prism2_frag_cache_get(local, hdr); if (!frag_skb) { printk(KERN_DEBUG "%s: Rx cannot get skb from " "fragment cache (morefrag=%d seq=%u frag=%u)\n", - dev->name, (fc & WLAN_FC_MOREFRAG) != 0, + dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0, WLAN_GET_SEQ_SEQ(sc) >> 4, frag); goto rx_dropped; } @@ -927,7 +931,7 @@ void hostap_80211_rx(struct net_device * dev_kfree_skb(skb); skb = NULL; - if (fc & WLAN_FC_MOREFRAG) { + if (fc & IEEE80211_FCTL_MOREFRAGS) { /* more fragments expected - leave the skb in fragment * cache for now; it will be delivered to upper layers * after all fragments have been received */ @@ -944,12 +948,12 @@ void hostap_80211_rx(struct net_device * /* skb: hdr + (possible reassembled) full MSDU payload; possibly still * encrypted/authenticated */ - if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && + if (local->host_decrypt && (fc & IEEE80211_FCTL_WEP) && hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) goto rx_dropped; hdr = (struct ieee80211_hdr *) skb->data; - if (crypt && !(fc & WLAN_FC_ISWEP) && !local->open_wep) { + if (crypt && !(fc & IEEE80211_FCTL_WEP) && !local->open_wep) { if (local->ieee_802_1x && hostap_is_eapol_frame(local, skb)) { /* pass unencrypted EAPOL frames even if encryption is @@ -964,7 +968,7 @@ void hostap_80211_rx(struct net_device * } } - if (local->drop_unencrypted && !(fc & WLAN_FC_ISWEP) && + if (local->drop_unencrypted && !(fc & IEEE80211_FCTL_WEP) && !hostap_is_eapol_frame(local, skb)) { if (net_ratelimit()) { printk(KERN_DEBUG "%s: dropped unencrypted RX data " @@ -1023,7 +1027,8 @@ void hostap_80211_rx(struct net_device * memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); } - if (wds && ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS) && + if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == + IEEE80211_FCTL_TODS) && skb->len >= ETH_HLEN + ETH_ALEN) { /* Non-standard frame: get addr4 from its bogus location after * the payload */ Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_tx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c @@ -14,8 +14,8 @@ void hostap_dump_tx_80211(const char *na fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4, - fc & WLAN_FC_TODS ? " [ToDS]" : "", - fc & WLAN_FC_FROMDS ? " [FromDS]" : ""); + fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", + fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); if (skb->len < IEEE80211_DATA_HDR3_LEN) { printk("\n"); @@ -128,7 +128,7 @@ int hostap_data_start_xmit(struct sk_buf * frame format */ if (use_wds == WDS_COMPLIANT_FRAME) { - fc |= WLAN_FC_FROMDS | WLAN_FC_TODS; + fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, * Addr4 = SA */ memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); @@ -136,7 +136,7 @@ int hostap_data_start_xmit(struct sk_buf } else { /* bogus 4-addr format to workaround Prism2 station * f/w bug */ - fc |= WLAN_FC_TODS; + fc |= IEEE80211_FCTL_TODS; /* From DS: Addr1 = DA (used as RA), * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA), */ @@ -161,13 +161,13 @@ int hostap_data_start_xmit(struct sk_buf memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); memcpy(&hdr.addr3, skb->data, ETH_ALEN); } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { - fc |= WLAN_FC_FROMDS; + fc |= IEEE80211_FCTL_FROMDS; /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ memcpy(&hdr.addr1, skb->data, ETH_ALEN); memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { - fc |= WLAN_FC_TODS; + fc |= IEEE80211_FCTL_TODS; /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ memcpy(&hdr.addr1, to_assoc_ap ? local->assoc_ap_addr : local->bssid, ETH_ALEN); @@ -439,12 +439,12 @@ int hostap_master_start_xmit(struct sk_b /* Request TX callback if protocol version is 2 in 802.11 header; * this version 2 is a special case used between hostapd and kernel * driver */ - if (((fc & WLAN_FC_PVER) == BIT(1)) && + if (((fc & IEEE80211_FCTL_VERS) == BIT(1)) && local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) { meta->tx_cb_idx = local->ap->tx_callback_idx; /* remove special version from the frame header */ - fc &= ~WLAN_FC_PVER; + fc &= ~IEEE80211_FCTL_VERS; hdr->frame_ctl = cpu_to_le16(fc); } @@ -454,7 +454,7 @@ int hostap_master_start_xmit(struct sk_b } if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt && - !(fc & WLAN_FC_ISWEP)) { + !(fc & IEEE80211_FCTL_VERS)) { no_encrypt = 1; PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing " "unencrypted EAPOL frame\n", dev->name); @@ -466,7 +466,7 @@ int hostap_master_start_xmit(struct sk_b else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) { /* Add ISWEP flag both for firmware and host based encryption */ - fc |= WLAN_FC_ISWEP; + fc |= IEEE80211_FCTL_WEP; hdr->frame_ctl = cpu_to_le16(fc); } else if (local->drop_unencrypted && WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c @@ -604,7 +604,7 @@ static void hostap_ap_tx_cb(struct sk_bu /* Pass the TX callback frame to the hostapd; use 802.11 header version * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ - fc &= ~WLAN_FC_PVER; + fc &= ~IEEE80211_FCTL_VERS; fc |= ok ? BIT(1) : BIT(0); hdr->frame_ctl = cpu_to_le16(fc); @@ -956,7 +956,7 @@ static void prism2_send_mgmt(struct net_ memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) { - fc |= WLAN_FC_FROMDS; + fc |= IEEE80211_FCTL_FROMDS; memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) { @@ -1436,7 +1436,7 @@ static void handle_authen(local_info_t * challenge == NULL || memcmp(sta->u.sta.challenge, challenge, WLAN_AUTH_CHALLENGE_LEN) != 0 || - !(fc & WLAN_FC_ISWEP)) { + !(fc & IEEE80211_FCTL_WEP)) { txt = "challenge response incorrect"; resp = WLAN_STATUS_CHALLENGE_FAIL; goto fail; @@ -1871,7 +1871,7 @@ static void handle_pspoll(local_info_t * PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR " PWRMGT=%d\n", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), - !!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT)); + !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR @@ -2150,7 +2150,8 @@ static void handle_ap_item(local_info_t if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); - if (!(fc & WLAN_FC_TODS) || (fc & WLAN_FC_FROMDS)) { + if (!(fc & IEEE80211_FCTL_TODS) || + (fc & IEEE80211_FCTL_FROMDS)) { if (stype == IEEE80211_STYPE_NULLFUNC) { /* no ToDS nullfunc seems to be used to check * AP association; so send reject message to @@ -2746,7 +2747,8 @@ ap_tx_ret hostap_handle_sta_tx(local_inf if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { /* indicate to STA that more frames follow */ - hdr->frame_ctl |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); + hdr->frame_ctl |= + __constant_cpu_to_le16(IEEE80211_FCTL_MOREDATA); } if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { @@ -2905,7 +2907,7 @@ int hostap_update_sta_ps(local_info_t *l return -1; fc = le16_to_cpu(hdr->frame_ctl); - hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, + hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc)); atomic_dec(&sta->users); @@ -2946,7 +2948,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf ret = AP_RX_CONTINUE; - if (fc & WLAN_FC_TODS) { + if (fc & IEEE80211_FCTL_TODS) { if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) { if (local->hostapd) { prism2_rx_80211(local->apdev, skb, rx_stats, @@ -2964,7 +2966,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf ret = AP_RX_EXIT; goto out; } - } else if (fc & WLAN_FC_FROMDS) { + } else if (fc & IEEE80211_FCTL_FROMDS) { if (!wds) { /* FromDS frame - not for us; probably * broadcast/multicast in another BSS - drop */ @@ -3019,7 +3021,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf } if (sta) { - hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, + hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, type, stype); sta->rx_packets++; @@ -3028,7 +3030,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf } if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && - fc & WLAN_FC_TODS) { + fc & IEEE80211_FCTL_TODS) { if (local->hostapd) { prism2_rx_80211(local->apdev, skb, rx_stats, PRISM2_RX_NULLFUNC_ACK); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c @@ -1844,7 +1844,8 @@ static int prism2_tx_80211(struct sk_buf memcpy(&txdesc.frame_control, skb->data, hdr_len); fc = le16_to_cpu(txdesc.frame_control); if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && - (fc & WLAN_FC_FROMDS) && (fc & WLAN_FC_TODS) && skb->len >= 30) { + (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS) && + skb->len >= 30) { /* Addr4 */ memcpy(txdesc.addr4, skb->data + hdr_len, ETH_ALEN); hdr_len += ETH_ALEN; @@ -2399,8 +2400,8 @@ static void prism2_txexc(local_info_t *l WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL ? "Ctrl" : "", WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA ? "Data" : "", WLAN_FC_GET_STYPE(fc) >> 4, - fc & WLAN_FC_TODS ? " ToDS" : "", - fc & WLAN_FC_FROMDS ? " FromDS" : ""); + fc & IEEE80211_FCTL_TODS ? " ToDS" : "", + fc & IEEE80211_FCTL_FROMDS ? " FromDS" : ""); PDEBUG(DEBUG_EXTRA, " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR " A4=" MACSTR "\n", MAC2STR(txdesc.addr1), MAC2STR(txdesc.addr2), -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:50
|
IEEE 802.11 has a capability field flag called ESS, but ieee80211 had renamed this to BSS for some reason. hostap has been using WLAN_CAPABILITY_ESS and since that matches with the standard, lets use it as the name for this define. Add WLAN_CAPABILITY_BSS as a backwards compatibility name for the same bit since ieee80211 and ipw2200 are using this and there are versions outside kernel tree that expect to find this define name. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/include/net/ieee80211.h =================================================================== --- netdev-2.6.orig/include/net/ieee80211.h +++ netdev-2.6/include/net/ieee80211.h @@ -263,7 +263,8 @@ struct ieee80211_snap_hdr { #define WLAN_AUTH_CHALLENGE_LEN 128 -#define WLAN_CAPABILITY_BSS (1<<0) +#define WLAN_CAPABILITY_ESS (1<<0) +#define WLAN_CAPABILITY_BSS WLAN_CAPABILITY_ESS #define WLAN_CAPABILITY_IBSS (1<<1) #define WLAN_CAPABILITY_CF_POLLABLE (1<<2) #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) Index: netdev-2.6/drivers/net/wireless/ipw2200.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/ipw2200.c +++ netdev-2.6/drivers/net/wireless/ipw2200.c @@ -4190,7 +4190,7 @@ static int ipw_best_network( /* Verify that this network's capability is compatible with the * current mode (AdHoc or Infrastructure) */ if ((priv->ieee->iw_mode == IW_MODE_INFRA && - !(network->capability & WLAN_CAPABILITY_BSS)) || + !(network->capability & WLAN_CAPABILITY_ESS)) || (priv->ieee->iw_mode == IW_MODE_ADHOC && !(network->capability & WLAN_CAPABILITY_IBSS))) { IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded due to " Index: netdev-2.6/net/ieee80211/ieee80211_wx.c =================================================================== --- netdev-2.6.orig/net/ieee80211/ieee80211_wx.c +++ netdev-2.6/net/ieee80211/ieee80211_wx.c @@ -77,8 +77,8 @@ static inline char *ipw2100_translate_sc /* Add mode */ iwe.cmd = SIOCGIWMODE; if (network->capability & - (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { - if (network->capability & WLAN_CAPABILITY_BSS) + (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { + if (network->capability & WLAN_CAPABILITY_ESS) iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_ADHOC; Index: netdev-2.6/drivers/net/wireless/hostap/hostap_common.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_common.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_common.h @@ -19,9 +19,6 @@ #define WLAN_FC_ISWEP BIT(14) #define WLAN_FC_ORDER BIT(15) -#define WLAN_CAPABILITY_ESS WLAN_CAPABILITY_BSS - - /* Information Element IDs */ #define WLAN_EID_SSID 0 #define WLAN_EID_SUPP_RATES 1 -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:50
|
Replace hostap-specific struct hostap_ieee80211_hdr with struct ieee80211_hdr from net/ieee80211.h. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211.h @@ -1,17 +1,6 @@ #ifndef HOSTAP_80211_H #define HOSTAP_80211_H -struct hostap_ieee80211_hdr { - u16 frame_control; - u16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - u16 seq_ctrl; - u8 addr4[6]; -} __attribute__ ((packed)); - - struct hostap_ieee80211_mgmt { u16 frame_control; u16 duration; Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_rx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_rx.c @@ -6,10 +6,10 @@ void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, struct hostap_80211_rx_status *rx_stats) { - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " "jiffies=%ld\n", @@ -19,7 +19,7 @@ void hostap_dump_rx_80211(const char *na if (skb->len < 2) return; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -31,7 +31,7 @@ void hostap_dump_rx_80211(const char *na } printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), - le16_to_cpu(hdr->seq_ctrl)); + le16_to_cpu(hdr->seq_ctl)); printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR, MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3)); @@ -51,7 +51,7 @@ int prism2_rx_80211(struct net_device *d int hdrlen, phdrlen, head_need, tail_need; u16 fc; int prism_header, ret; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; iface = netdev_priv(dev); local = iface->local; @@ -70,8 +70,8 @@ int prism2_rx_80211(struct net_device *d phdrlen = 0; } - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); if (type == PRISM2_RX_MGMT && (fc & WLAN_FC_PVER)) { printk(KERN_DEBUG "%s: dropped management frame with header " @@ -215,21 +215,21 @@ prism2_frag_cache_find(local_info_t *loc /* Called only as a tasklet (software IRQ) */ static struct sk_buff * -prism2_frag_cache_get(local_info_t *local, struct hostap_ieee80211_hdr *hdr) +prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) { struct sk_buff *skb = NULL; u16 sc; unsigned int frag, seq; struct prism2_frag_entry *entry; - sc = le16_to_cpu(hdr->seq_ctrl); + sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); seq = WLAN_GET_SEQ_SEQ(sc) >> 4; if (frag == 0) { /* Reserve enough space to fit maximum frame length */ skb = dev_alloc_skb(local->dev->mtu + - sizeof(struct hostap_ieee80211_hdr) + + sizeof(struct ieee80211_hdr) + 8 /* LLC */ + 2 /* alignment */ + 8 /* WEP */ + ETH_ALEN /* WDS */); @@ -267,13 +267,13 @@ prism2_frag_cache_get(local_info_t *loca /* Called only as a tasklet (software IRQ) */ static int prism2_frag_cache_invalidate(local_info_t *local, - struct hostap_ieee80211_hdr *hdr) + struct ieee80211_hdr *hdr) { u16 sc; unsigned int seq; struct prism2_frag_entry *entry; - sc = le16_to_cpu(hdr->seq_ctrl); + sc = le16_to_cpu(hdr->seq_ctl); seq = WLAN_GET_SEQ_SEQ(sc) >> 4; entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1); @@ -441,7 +441,7 @@ hostap_rx_frame_mgmt(local_info_t *local u16 stype) { if (local->iw_mode == IW_MODE_MASTER) { - hostap_update_sta_ps(local, (struct hostap_ieee80211_hdr *) + hostap_update_sta_ps(local, (struct ieee80211_hdr *) skb->data); } @@ -519,7 +519,7 @@ static inline struct net_device *prism2_ static inline int -hostap_rx_frame_wds(local_info_t *local, struct hostap_ieee80211_hdr *hdr, +hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, u16 fc, struct net_device **wds) { /* FIX: is this really supposed to accept WDS frames only in Master @@ -577,14 +577,14 @@ static int hostap_is_eapol_frame(local_i { struct net_device *dev = local->dev; u16 fc, ethertype; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u8 *pos; if (skb->len < 24) return 0; - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); /* check that the frame is unicast frame to us */ if ((fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) == WLAN_FC_TODS && @@ -615,14 +615,14 @@ static inline int hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, struct ieee80211_crypt_data *crypt) { - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) return 0; - hdr = (struct hostap_ieee80211_hdr *) skb->data; - hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); + hdr = (struct ieee80211_hdr *) skb->data; + hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); if (local->tkip_countermeasures && strcmp(crypt->ops->name, "TKIP") == 0) { @@ -654,14 +654,14 @@ static inline int hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, int keyidx, struct ieee80211_crypt_data *crypt) { - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; int res, hdrlen; if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) return 0; - hdr = (struct hostap_ieee80211_hdr *) skb->data; - hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); + hdr = (struct ieee80211_hdr *) skb->data; + hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); atomic_inc(&crypt->refcnt); res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); @@ -685,7 +685,7 @@ void hostap_80211_rx(struct net_device * { struct hostap_interface *iface; local_info_t *local; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; size_t hdrlen; u16 fc, type, stype, sc; struct net_device *wds = NULL; @@ -712,16 +712,16 @@ void hostap_80211_rx(struct net_device * dev = local->ddev; iface = netdev_priv(dev); - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; stats = hostap_get_stats(dev); if (skb->len < 10) goto rx_dropped; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); type = HOSTAP_FC_GET_TYPE(fc); stype = HOSTAP_FC_GET_STYPE(fc); - sc = le16_to_cpu(hdr->seq_ctrl); + sc = le16_to_cpu(hdr->seq_ctl); frag = WLAN_GET_SEQ_FRAG(sc); hdrlen = hostap_80211_get_hdrlen(fc); @@ -883,7 +883,7 @@ void hostap_80211_rx(struct net_device * if (local->host_decrypt && (fc & WLAN_FC_ISWEP) && (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) goto rx_dropped; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; /* skb: hdr + (possibly fragmented) plaintext payload */ @@ -935,7 +935,7 @@ void hostap_80211_rx(struct net_device * /* this was the last fragment and the frame will be * delivered, so remove skb from fragment cache */ skb = frag_skb; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; prism2_frag_cache_invalidate(local, hdr); } @@ -946,7 +946,7 @@ void hostap_80211_rx(struct net_device * hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) goto rx_dropped; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; if (crypt && !(fc & WLAN_FC_ISWEP) && !local->open_wep) { if (local->ieee_802_1x && hostap_is_eapol_frame(local, skb)) { Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_tx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c @@ -1,9 +1,9 @@ void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) { - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", name, skb->len, jiffies); @@ -11,7 +11,7 @@ void hostap_dump_tx_80211(const char *na if (skb->len < 2) return; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", fc, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc), fc & WLAN_FC_TODS ? " [ToDS]" : "", @@ -23,7 +23,7 @@ void hostap_dump_tx_80211(const char *na } printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), - le16_to_cpu(hdr->seq_ctrl)); + le16_to_cpu(hdr->seq_ctl)); printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR, MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3)); @@ -41,7 +41,7 @@ int hostap_data_start_xmit(struct sk_buf struct hostap_interface *iface; local_info_t *local; int need_headroom, need_tailroom = 0; - struct hostap_ieee80211_hdr hdr; + struct ieee80211_hdr hdr; u16 fc, ethertype = 0; enum { WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME @@ -180,7 +180,7 @@ int hostap_data_start_xmit(struct sk_buf memcpy(&hdr.addr3, local->bssid, ETH_ALEN); } - hdr.frame_control = cpu_to_le16(fc); + hdr.frame_ctl = cpu_to_le16(fc); skb_pull(skb, skip_header_bytes); need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; @@ -244,7 +244,7 @@ int hostap_mgmt_start_xmit(struct sk_buf struct hostap_interface *iface; local_info_t *local; struct hostap_skb_tx_data *meta; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc; iface = netdev_priv(dev); @@ -266,8 +266,8 @@ int hostap_mgmt_start_xmit(struct sk_buf meta->iface = iface; if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); if (HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && HOSTAP_FC_GET_STYPE(fc) == WLAN_FC_STYPE_DATA) { u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + @@ -289,7 +289,7 @@ struct sk_buff * hostap_tx_encrypt(struc { struct hostap_interface *iface; local_info_t *local; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc; int hdr_len, res; @@ -303,7 +303,7 @@ struct sk_buff * hostap_tx_encrypt(struc if (local->tkip_countermeasures && crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; if (net_ratelimit()) { printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " "TX packet to " MACSTR "\n", @@ -325,8 +325,8 @@ struct sk_buff * hostap_tx_encrypt(struc return NULL; } - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); hdr_len = hostap_80211_get_hdrlen(fc); /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so @@ -360,7 +360,7 @@ int hostap_master_start_xmit(struct sk_b ap_tx_ret tx_ret; struct hostap_skb_tx_data *meta; int no_encrypt = 0; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; iface = netdev_priv(dev); local = iface->local; @@ -403,8 +403,8 @@ int hostap_master_start_xmit(struct sk_b tx_ret = hostap_handle_sta_tx(local, &tx); skb = tx.skb; meta = (struct hostap_skb_tx_data *) skb->cb; - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); switch (tx_ret) { case AP_TX_CONTINUE: break; @@ -445,7 +445,7 @@ int hostap_master_start_xmit(struct sk_b /* remove special version from the frame header */ fc &= ~WLAN_FC_PVER; - hdr->frame_control = cpu_to_le16(fc); + hdr->frame_ctl = cpu_to_le16(fc); } if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_DATA) { @@ -467,7 +467,7 @@ int hostap_master_start_xmit(struct sk_b /* Add ISWEP flag both for firmware and host based encryption */ fc |= WLAN_FC_ISWEP; - hdr->frame_control = cpu_to_le16(fc); + hdr->frame_ctl = cpu_to_le16(fc); } else if (local->drop_unencrypted && HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && meta->ethertype != ETH_P_PAE) { Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c @@ -590,22 +590,22 @@ static void hostap_ap_tx_cb(struct sk_bu { struct ap_data *ap = data; u16 fc; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; if (!ap->local->hostapd || !ap->local->apdev) { dev_kfree_skb(skb); return; } - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); /* Pass the TX callback frame to the hostapd; use 802.11 header version * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ fc &= ~WLAN_FC_PVER; fc |= ok ? BIT(1) : BIT(0); - hdr->frame_control = cpu_to_le16(fc); + hdr->frame_ctl = cpu_to_le16(fc); skb->dev = ap->local->apdev; skb_pull(skb, hostap_80211_get_hdrlen(fc)); @@ -622,7 +622,7 @@ static void hostap_ap_tx_cb_auth(struct { struct ap_data *ap = data; struct net_device *dev = ap->local->dev; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc, *pos, auth_alg, auth_transaction, status; struct sta_info *sta = NULL; char *txt = NULL; @@ -632,8 +632,8 @@ static void hostap_ap_tx_cb_auth(struct return; } - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_AUTH || skb->len < IEEE80211_MGMT_HDR_LEN + 6) { @@ -691,7 +691,7 @@ static void hostap_ap_tx_cb_assoc(struct { struct ap_data *ap = data; struct net_device *dev = ap->local->dev; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc, *pos, status; struct sta_info *sta = NULL; char *txt = NULL; @@ -701,8 +701,8 @@ static void hostap_ap_tx_cb_assoc(struct return; } - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); if (HOSTAP_FC_GET_TYPE(fc) != WLAN_FC_TYPE_MGMT || (HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_ASSOC_RESP && HOSTAP_FC_GET_STYPE(fc) != WLAN_FC_STYPE_REASSOC_RESP) || @@ -756,12 +756,12 @@ static void hostap_ap_tx_cb_assoc(struct static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) { struct ap_data *ap = data; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; struct sta_info *sta; if (skb->len < 24) goto fail; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; if (ok) { spin_lock(&ap->sta_table_lock); sta = ap_get_sta(ap, hdr->addr1); @@ -917,7 +917,7 @@ static void prism2_send_mgmt(struct net_ { struct hostap_interface *iface; local_info_t *local; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; u16 fc; struct sk_buff *skb; struct hostap_skb_tx_data *meta; @@ -943,7 +943,7 @@ static void prism2_send_mgmt(struct net_ fc = (type << 2) | (subtype << 4); hdrlen = hostap_80211_get_hdrlen(fc); - hdr = (struct hostap_ieee80211_hdr *) skb_put(skb, hdrlen); + hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); if (body) memcpy(skb_put(skb, body_len), body, body_len); @@ -967,7 +967,7 @@ static void prism2_send_mgmt(struct net_ memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */ } - hdr->frame_control = cpu_to_le16(fc); + hdr->frame_ctl = cpu_to_le16(fc); meta = (struct hostap_skb_tx_data *) skb->cb; memset(meta, 0, sizeof(*meta)); @@ -1284,8 +1284,7 @@ static void handle_authen(local_info_t * struct hostap_80211_rx_status *rx_stats) { struct net_device *dev = local->dev; - struct hostap_ieee80211_hdr *hdr = - (struct hostap_ieee80211_hdr *) skb->data; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; size_t hdrlen; struct ap_data *ap = local->ap; char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; @@ -1298,7 +1297,7 @@ static void handle_authen(local_info_t * len = skb->len - IEEE80211_MGMT_HDR_LEN; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); hdrlen = hostap_80211_get_hdrlen(fc); if (len < 6) { @@ -1498,8 +1497,7 @@ static void handle_assoc(local_info_t *l struct hostap_80211_rx_status *rx_stats, int reassoc) { struct net_device *dev = local->dev; - struct hostap_ieee80211_hdr *hdr = - (struct hostap_ieee80211_hdr *) skb->data; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; char body[12], *p, *lpos; int len, left; u16 *pos; @@ -1706,8 +1704,7 @@ static void handle_deauth(local_info_t * struct hostap_80211_rx_status *rx_stats) { struct net_device *dev = local->dev; - struct hostap_ieee80211_hdr *hdr = - (struct hostap_ieee80211_hdr *) skb->data; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); int len; u16 reason_code, *pos; @@ -1748,8 +1745,7 @@ static void handle_disassoc(local_info_t struct hostap_80211_rx_status *rx_stats) { struct net_device *dev = local->dev; - struct hostap_ieee80211_hdr *hdr = - (struct hostap_ieee80211_hdr *) skb->data; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; char *body = skb->data + IEEE80211_MGMT_HDR_LEN; int len; u16 reason_code, *pos; @@ -1787,7 +1783,7 @@ static void handle_disassoc(local_info_t /* Called only as a scheduled task for pending AP frames. */ static void ap_handle_data_nullfunc(local_info_t *local, - struct hostap_ieee80211_hdr *hdr) + struct ieee80211_hdr *hdr) { struct net_device *dev = local->dev; @@ -1804,7 +1800,7 @@ static void ap_handle_data_nullfunc(loca /* Called only as a scheduled task for pending AP frames. */ static void ap_handle_dropped_data(local_info_t *local, - struct hostap_ieee80211_hdr *hdr) + struct ieee80211_hdr *hdr) { struct net_device *dev = local->dev; struct sta_info *sta; @@ -1863,7 +1859,7 @@ static void pspoll_send_buffered(local_i /* Called only as a scheduled task for pending AP frames. */ static void handle_pspoll(local_info_t *local, - struct hostap_ieee80211_hdr *hdr, + struct ieee80211_hdr *hdr, struct hostap_80211_rx_status *rx_stats) { struct net_device *dev = local->dev; @@ -1874,7 +1870,7 @@ static void handle_pspoll(local_info_t * PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR " PWRMGT=%d\n", MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), - !!(le16_to_cpu(hdr->frame_control) & WLAN_FC_PWRMGT)); + !!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT)); if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR @@ -1982,8 +1978,7 @@ static void handle_wds_oper_queue(void * static void handle_beacon(local_info_t *local, struct sk_buff *skb, struct hostap_80211_rx_status *rx_stats) { - struct hostap_ieee80211_hdr *hdr = - (struct hostap_ieee80211_hdr *) skb->data; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; char *body = skb->data + IEEE80211_MGMT_HDR_LEN; int len, left; u16 *pos, beacon_int, capability; @@ -2141,12 +2136,12 @@ static void handle_ap_item(local_info_t struct net_device *dev = local->dev; #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ u16 fc, type, stype; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; /* FIX: should give skb->len to handler functions and check that the * buffer is long enough */ - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); type = HOSTAP_FC_GET_TYPE(fc); stype = HOSTAP_FC_GET_STYPE(fc); @@ -2259,7 +2254,7 @@ void hostap_rx(struct net_device *dev, s struct hostap_interface *iface; local_info_t *local; u16 fc; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; iface = netdev_priv(dev); local = iface->local; @@ -2269,8 +2264,8 @@ void hostap_rx(struct net_device *dev, s local->stats.rx_packets++; - hdr = (struct hostap_ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + hdr = (struct ieee80211_hdr *) skb->data; + fc = le16_to_cpu(hdr->frame_ctl); if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && @@ -2290,7 +2285,7 @@ void hostap_rx(struct net_device *dev, s static void schedule_packet_send(local_info_t *local, struct sta_info *sta) { struct sk_buff *skb; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; struct hostap_80211_rx_status rx_stats; if (skb_queue_empty(&sta->tx_buf)) @@ -2303,10 +2298,10 @@ static void schedule_packet_send(local_i return; } - hdr = (struct hostap_ieee80211_hdr *) skb_put(skb, 16); + hdr = (struct ieee80211_hdr *) skb_put(skb, 16); /* Generate a fake pspoll frame to start packet delivery */ - hdr->frame_control = __constant_cpu_to_le16( + hdr->frame_ctl = __constant_cpu_to_le16( (WLAN_FC_TYPE_CTRL << 2) | (WLAN_FC_STYPE_PSPOLL << 4)); memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); memcpy(hdr->addr2, sta->addr, ETH_ALEN); @@ -2686,7 +2681,7 @@ ap_tx_ret hostap_handle_sta_tx(local_inf struct sta_info *sta = NULL; struct sk_buff *skb = tx->skb; int set_tim, ret; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; struct hostap_skb_tx_data *meta; meta = (struct hostap_skb_tx_data *) skb->cb; @@ -2695,7 +2690,7 @@ ap_tx_ret hostap_handle_sta_tx(local_inf meta->iface->type == HOSTAP_INTERFACE_STA) goto out; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; if (hdr->addr1[0] & 0x01) { /* broadcast/multicast frame - no AP related processing */ @@ -2748,7 +2743,7 @@ ap_tx_ret hostap_handle_sta_tx(local_inf if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { /* indicate to STA that more frames follow */ - hdr->frame_control |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); + hdr->frame_ctl |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); } if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { @@ -2821,10 +2816,10 @@ void hostap_handle_sta_release(void *ptr void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) { struct sta_info *sta; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; struct hostap_skb_tx_data *meta; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; meta = (struct hostap_skb_tx_data *) skb->cb; spin_lock(&local->ap->sta_table_lock); @@ -2890,8 +2885,8 @@ static void hostap_update_sta_ps2(local_ /* Called only as a tasklet (software IRQ). Called for each RX frame to update - * STA power saving state. pwrmgt is a flag from 802.11 frame_control field. */ -int hostap_update_sta_ps(local_info_t *local, struct hostap_ieee80211_hdr *hdr) + * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */ +int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) { struct sta_info *sta; u16 fc; @@ -2905,7 +2900,7 @@ int hostap_update_sta_ps(local_info_t *l if (!sta) return -1; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); hostap_update_sta_ps2(local, sta, fc & WLAN_FC_PWRMGT, HOSTAP_FC_GET_TYPE(fc), HOSTAP_FC_GET_STYPE(fc)); @@ -2924,14 +2919,14 @@ ap_rx_ret hostap_handle_sta_rx(local_inf int ret; struct sta_info *sta; u16 fc, type, stype; - struct hostap_ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr; if (local->ap == NULL) return AP_RX_CONTINUE; - hdr = (struct hostap_ieee80211_hdr *) skb->data; + hdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); + fc = le16_to_cpu(hdr->frame_ctl); type = HOSTAP_FC_GET_TYPE(fc); stype = HOSTAP_FC_GET_STYPE(fc); @@ -3057,7 +3052,7 @@ ap_rx_ret hostap_handle_sta_rx(local_inf /* Called only as a tasklet (software IRQ) */ int hostap_handle_sta_crypto(local_info_t *local, - struct hostap_ieee80211_hdr *hdr, + struct ieee80211_hdr *hdr, struct ieee80211_crypt_data **crypt, void **sta_ptr) { @@ -3159,7 +3154,7 @@ int hostap_add_sta(struct ap_data *ap, u /* Called only as a tasklet (software IRQ) */ int hostap_update_rx_stats(struct ap_data *ap, - struct hostap_ieee80211_hdr *hdr, + struct ieee80211_hdr *hdr, struct hostap_80211_rx_status *rx_stats) { struct sta_info *sta; Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.h @@ -233,8 +233,7 @@ struct hostap_tx_data { ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); void hostap_handle_sta_release(void *ptr); void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); -int hostap_update_sta_ps(local_info_t *local, - struct hostap_ieee80211_hdr *hdr); +int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); typedef enum { AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED } ap_rx_ret; @@ -242,15 +241,13 @@ ap_rx_ret hostap_handle_sta_rx(local_inf struct sk_buff *skb, struct hostap_80211_rx_status *rx_stats, int wds); -int hostap_handle_sta_crypto(local_info_t *local, - struct hostap_ieee80211_hdr *hdr, +int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, struct ieee80211_crypt_data **crypt, void **sta_ptr); int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); -int hostap_update_rx_stats(struct ap_data *ap, - struct hostap_ieee80211_hdr *hdr, +int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, struct hostap_80211_rx_status *rx_stats); void hostap_update_rates(local_info_t *local); void hostap_add_wds_links(local_info_t *local); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_hw.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_hw.c @@ -1817,7 +1817,6 @@ static int prism2_tx_80211(struct sk_buf struct hostap_interface *iface; local_info_t *local; struct hfa384x_tx_frame txdesc; - struct hostap_ieee80211_hdr *hdr; struct hostap_skb_tx_data *meta; int hdr_len, data_len, idx, res, ret = -1; u16 tx_control, fc; @@ -1826,7 +1825,6 @@ static int prism2_tx_80211(struct sk_buf local = iface->local; meta = (struct hostap_skb_tx_data *) skb->cb; - hdr = (struct hostap_ieee80211_hdr *) skb->data; prism2_callback(local, PRISM2_CALLBACK_TX_START); -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:49
|
IEEE 802.11 frame control has two bits reserved for protocol version. IEEE80211_FCTL_VERS was not used anywhere, but I would assume it was supposed to be a mask for the protocol field and as such, it should be 0x0003, not 0x0002. This matches with WLAN_FC_PVER definition in hostap. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/include/net/ieee80211.h =================================================================== --- netdev-2.6.orig/include/net/ieee80211.h +++ netdev-2.6/include/net/ieee80211.h @@ -103,7 +103,7 @@ struct eapol { #define MAX_FRAG_THRESHOLD 2346U /* Frame control field constants */ -#define IEEE80211_FCTL_VERS 0x0002 +#define IEEE80211_FCTL_VERS 0x0003 #define IEEE80211_FCTL_FTYPE 0x000c #define IEEE80211_FCTL_STYPE 0x00f0 #define IEEE80211_FCTL_TODS 0x0100 -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:49
|
Old AP mode code for power saving was using skb->cb for couple of flags before the more generic 802.11 TX code started using the same buffer for struct hostap_skb_tx_data. This resulted in the power save code corrupting the magic value in beginning of the buffer and TX code dropping the power saved packets because of this for the case where STAs send PS-Poll frames with PwrMgmt flag set. This patch modifies the power save code to use the same struct hostap_skb_tx_data as rest of the TX path in order to avoid corrupting the data in skb->cb. In addition, this patch reorders fields in the structure and makes them use smaller types in order to make the structure fit in skb->cb on 64-bit hosts. Signed-off-by: Jouni Malinen <jkm...@cc...> Index: netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_80211_tx.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c @@ -226,7 +226,8 @@ int hostap_data_start_xmit(struct sk_buf meta = (struct hostap_skb_tx_data *) skb->cb; memset(meta, 0, sizeof(*meta)); meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; - meta->wds = use_wds; + if (use_wds) + meta->flags |= HOSTAP_TX_FLAGS_WDS; meta->ethertype = ethertype; meta->iface = iface; @@ -410,7 +411,8 @@ int hostap_master_start_xmit(struct sk_b case AP_TX_CONTINUE_NOT_AUTHORIZED: if (local->ieee_802_1x && HOSTAP_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA && - meta->ethertype != ETH_P_PAE && !meta->wds) { + meta->ethertype != ETH_P_PAE && + !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { printk(KERN_DEBUG "%s: dropped frame to unauthorized " "port (IEEE 802.1X): ethertype=0x%04x\n", dev->name, meta->ethertype); Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.c @@ -1840,6 +1840,8 @@ static void ap_handle_dropped_data(local static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta, struct sk_buff *skb) { + struct hostap_skb_tx_data *meta; + if (!(sta->flags & WLAN_STA_PS)) { /* Station has moved to non-PS mode, so send all buffered * frames using normal device queue. */ @@ -1849,11 +1851,11 @@ static void pspoll_send_buffered(local_i /* add a flag for hostap_handle_sta_tx() to know that this skb should * be passed through even though STA is using PS */ - memcpy(skb->cb, AP_SKB_CB_MAGIC, AP_SKB_CB_MAGIC_LEN); - skb->cb[AP_SKB_CB_MAGIC_LEN] = AP_SKB_CB_BUFFERED_FRAME; + meta = (struct hostap_skb_tx_data *) skb->cb; + meta->flags |= HOSTAP_TX_FLAGS_BUFFERED_FRAME; if (!skb_queue_empty(&sta->tx_buf)) { /* indicate to STA that more frames follow */ - skb->cb[AP_SKB_CB_MAGIC_LEN] |= AP_SKB_CB_ADD_MOREDATA; + meta->flags |= HOSTAP_TX_FLAGS_ADD_MOREDATA; } dev_queue_xmit(skb); } @@ -2707,7 +2709,8 @@ ap_tx_ret hostap_handle_sta_tx(local_inf atomic_inc(&sta->users); spin_unlock(&local->ap->sta_table_lock); - if (local->iw_mode == IW_MODE_MASTER && sta == NULL && !meta->wds && + if (local->iw_mode == IW_MODE_MASTER && sta == NULL && + !(meta->flags & HOSTAP_TX_FLAGS_WDS) && meta->iface->type != HOSTAP_INTERFACE_MASTER && meta->iface->type != HOSTAP_INTERFACE_AP) { #if 0 @@ -2743,18 +2746,15 @@ ap_tx_ret hostap_handle_sta_tx(local_inf if (!(sta->flags & WLAN_STA_PS)) goto out; - if (memcmp(skb->cb, AP_SKB_CB_MAGIC, AP_SKB_CB_MAGIC_LEN) == 0) { - if (skb->cb[AP_SKB_CB_MAGIC_LEN] & AP_SKB_CB_ADD_MOREDATA) { - /* indicate to STA that more frames follow */ - hdr->frame_control |= - __constant_cpu_to_le16(WLAN_FC_MOREDATA); - } + if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { + /* indicate to STA that more frames follow */ + hdr->frame_control |= __constant_cpu_to_le16(WLAN_FC_MOREDATA); + } - if (skb->cb[AP_SKB_CB_MAGIC_LEN] & AP_SKB_CB_BUFFERED_FRAME) { - /* packet was already buffered and now send due to - * PS poll, so do not rebuffer it */ - goto out; - } + if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { + /* packet was already buffered and now send due to + * PS poll, so do not rebuffer it */ + goto out; } if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) { Index: netdev-2.6/drivers/net/wireless/hostap/hostap_ap.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_ap.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_ap.h @@ -6,15 +6,6 @@ /* maximum number of frames to buffer per STA */ #define STA_MAX_TX_BUFFER 32 -/* Flags used in skb->cb[6] to control how the packet is handled in TX path. - * skb->cb[0..5] must contain magic value 'hostap' to indicate that cb[6] is - * used. */ -#define AP_SKB_CB_MAGIC "hostap" -#define AP_SKB_CB_MAGIC_LEN 6 -#define AP_SKB_CB_BUFFERED_FRAME BIT(0) -#define AP_SKB_CB_ADD_MOREDATA BIT(1) - - /* STA flags */ #define WLAN_STA_AUTH BIT(0) #define WLAN_STA_ASSOC BIT(1) Index: netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h =================================================================== --- netdev-2.6.orig/drivers/net/wireless/hostap/hostap_wlan.h +++ netdev-2.6/drivers/net/wireless/hostap/hostap_wlan.h @@ -941,16 +941,21 @@ struct hostap_interface { #define HOSTAP_SKB_TX_DATA_MAGIC 0xf08a36a2 -/* TX meta data - stored in skb->cb buffer, so this must be not increase over - * 48-byte limit */ +/* + * TX meta data - stored in skb->cb buffer, so this must not be increased over + * the 40-byte limit + */ struct hostap_skb_tx_data { - unsigned int magic; /* HOSTAP_SKB_TX_DATA_MAGIC */ - int rate; /* transmit rate */ + u32 magic; /* HOSTAP_SKB_TX_DATA_MAGIC */ + u8 rate; /* transmit rate */ +#define HOSTAP_TX_FLAGS_WDS BIT(0) +#define HOSTAP_TX_FLAGS_BUFFERED_FRAME BIT(1) +#define HOSTAP_TX_FLAGS_ADD_MOREDATA BIT(2) + u8 flags; /* HOSTAP_TX_FLAGS_* */ + u16 tx_cb_idx; struct hostap_interface *iface; unsigned long jiffies; /* queueing timestamp */ - int wds; unsigned short ethertype; - int tx_cb_idx; }; -- -- Jouni Malinen PGP id EFC895FA |
From: Jouni M. <jkm...@cc...> - 2005-08-15 02:26:43
|
This set of patches merges a bug fix for the Host AP driver (patch 1), does some cleanup for different hardware models (patches 2-3), continues conversion to generic ieee80211 code (patches 4-6), and tests how we can handle changes that have a dependency to modify ieee80211 and hostap at the same time (patches 7-9). Please apply to suitable branch(es) in netdev-2.6. Patches 1-6 should be clear enough since they are touching only hostap (ieee80211-wifi). Patch 7 is a fix for ieee80211. Patch 8 is the most complex one: it changes three different components (ieee80211, hostap, ipw2200) due to a renamed define. Patch 9 is for hostap (ieee80211-wifi) only. Is this kind of set of patches ok for you to apply or what would be the best way of dealing with the changes done in patches 7-9? It is ok to apply just patches 1-6 if 7-9 need further changes. PS. I was asked to cc my patches to ieee80211-devel mailing list. The changes here are still mainly for hostap, but there are couple of small changes to net/ieee80211.h and the renamed define affects net/ieee80211 and ipw2200. Please let me know, if this is not suitable for the ieee80211-devel list. -- Jouni Malinen PGP id EFC895FA |
From: Ivo v. D. <iv...@gm...> - 2005-08-06 11:02:09
|
Hi, On Saturday 6 August 2005 00:59, James Ketrenos wrote: > Ivo van Doorn wrote: > >This patch adds support for the creation of RTS packets when the config > > flag CFG_IEEE80211_RTS has been set. > > Just to make sure I understand... if RTS is enabled, you want to build a > single packet, with no payload, that has the RTS bit set, correct? Yes, this is correct, this was the exact way the original Ralink drivers ar= e=20 creating a RTS packet, since they don't work with Firmware I guess it is sa= fe=20 to assume this is the correct approach for the creation of a RTS packet. > > /* When we allocate the TXB we allocate enough space for the reserve > > * and full fragment bytes (bytes_per_frag doesn't include prefix, > > * postfix, header, FCS, etc.) */ > >@@ -414,7 +418,31 @@ > > else > > txb->payload_size =3D bytes; > > > >- for (i =3D 0; i < nr_frags; i++) { > >+ i =3D 0; > > Rather than set it to 0 only to set it to 1 later, we can do: > >+ if (rts_required) { > >+ skb_frag =3D txb->fragments[i]; > >+ frag_hdr =3D (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); > >+ > >+ /* > >+ * Set header frame_ctl to the RTS. > >+ */ > >+ header.frame_ctl =3D cpu_to_le16(IEEE80211_FTYPE_CTL | > > IEEE80211_STYPE_RTS); + memcpy(frag_hdr, &header, hdr_len); > >+ > >+ /* > >+ * Restore header frame_ctl to the original data setting. > >+ */ > >+ header.frame_ctl =3D cpu_to_le16(fc); > >+ > >+ if (ieee->config & > >+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) > >+ skb_put(skb_frag, 4); > >+ > >+ txb->rts_included =3D 1; > >+ i =3D 1; > >+ } > > > > > >else i =3D 0; > > add ^^^ Sounds good to me. > I've applied this and your ieee80211_frame_3addr header fix. Updating > GIT overlay in a few minutes. > > NOTE: I've updated the GIT overlay scripts to pull the ancestor data > from .git/info vs. .git/refs If you use my git- scripts then you should > pull new copies from rsync://bughost.org/repos/scripts/ Excellent, thanks. IvD |
From: James K. <jke...@li...> - 2005-08-05 23:10:12
|
James Ketrenos wrote: >I've applied this and your ieee80211_frame_3addr header fix. Updating >GIT overlay in a few minutes. > > The GIT overlay at: rsync://bughos.org/repos/ieee80211-delta/.git/ has been updated with the patches discussed on here as well as several others. James |
From: James K. <jke...@li...> - 2005-08-05 22:59:21
|
Ivo van Doorn wrote: >This patch adds support for the creation of RTS packets when the config flag >CFG_IEEE80211_RTS has been set. > > Just to make sure I understand... if RTS is enabled, you want to build a single packet, with no payload, that has the RTS bit set, correct? > /* When we allocate the TXB we allocate enough space for the reserve > * and full fragment bytes (bytes_per_frag doesn't include prefix, > * postfix, header, FCS, etc.) */ >@@ -414,7 +418,31 @@ > else > txb->payload_size = bytes; > >- for (i = 0; i < nr_frags; i++) { >+ i = 0; > > Rather than set it to 0 only to set it to 1 later, we can do: >+ if (rts_required) { >+ skb_frag = txb->fragments[i]; >+ frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len); >+ >+ /* >+ * Set header frame_ctl to the RTS. >+ */ >+ header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); >+ memcpy(frag_hdr, &header, hdr_len); >+ >+ /* >+ * Restore header frame_ctl to the original data setting. >+ */ >+ header.frame_ctl = cpu_to_le16(fc); >+ >+ if (ieee->config & >+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) >+ skb_put(skb_frag, 4); >+ >+ txb->rts_included = 1; >+ i = 1; >+ } > >else i = 0; > > add ^^^ I've applied this and your ieee80211_frame_3addr header fix. Updating GIT overlay in a few minutes. NOTE: I've updated the GIT overlay scripts to pull the ancestor data from .git/info vs. .git/refs If you use my git- scripts then you should pull new copies from rsync://bughost.org/repos/scripts/ James |
From: James K. <jke...@li...> - 2005-08-05 16:58:58
|
Zhu Yi wrote: >You patch is correct. Another apporach is using skb_unshare() at the >beginning of ieee80211_xmit(). It will copy another skb only if the skb >is cloned. So the overload is also small. I've attached the patch FYI. > > I'll keep the current approach since there is no (vs. small) overhead associated w/ using PF_PACKET sockets then. Thanks for checking into this. James |
From: Zhu Yi <yi...@in...> - 2005-08-05 08:34:38
|
On Thu, 2005-08-04 at 14:04 -0500, James Ketrenos wrote: > James Ketrenos wrote: > > >Yi -- if you have time during your day today, can you take a look at > >this? We should be able to modify ieee80211_tx's ieee80211_xmit() > >method so that it doesn't have to overwrite the incoming SKB and can > >just stick the snap on the first TXB constructed. If I have some more > >free time today I'll take a crack at it and send out a patch if I get it > >done. If you don't see a patch from me for the above, assume I didn't > >get to look into it further. > > > > > Alright; I had few minutes. Try the attached (it runs here, don't know > if it will solve the problem though) You are right. The skb is shared between ieee80211_xmit and PF_PACKET socket (if any). So if we change it in the stack, the raw socket will also see the change. I think it is another good reason for the native ieee80211 stack. If we process protocol headers in network stacks instead of dev->hard_start_xmit, we won't have this kind of problem. Currently I think making a copy to the skb can solve it well. You patch is correct. Another apporach is using skb_unshare() at the beginning of ieee80211_xmit(). It will copy another skb only if the skb is cloned. So the overload is also small. I've attached the patch FYI. Thanks, -yi |
From: Kevin <kg...@in...> - 2005-08-04 20:30:29
|
Am Donnerstag, 4. August 2005 21:04 schrieb James Ketrenos: > James Ketrenos wrote: > >Yi -- if you have time during your day today, can you take a look at > >this? We should be able to modify ieee80211_tx's ieee80211_xmit() > >method so that it doesn't have to overwrite the incoming SKB and can > >just stick the snap on the first TXB constructed. If I have some more > >free time today I'll take a crack at it and send out a patch if I get it > >done. If you don't see a patch from me for the above, assume I didn't > >get to look into it further. > > Alright; I had few minutes. Try the attached (it runs here, don't know > if it will solve the problem though) > > % cd ieee80211-1.0.3 > % patch -p1 < ieee80211-1.0.3-skb_corrupt.patch Thanks a lot! The patch works, no more mac address troubles :) Cheers! Kevin |
From: James K. <jke...@li...> - 2005-08-04 19:05:05
|
James Ketrenos wrote: >Yi -- if you have time during your day today, can you take a look at >this? We should be able to modify ieee80211_tx's ieee80211_xmit() >method so that it doesn't have to overwrite the incoming SKB and can >just stick the snap on the first TXB constructed. If I have some more >free time today I'll take a crack at it and send out a patch if I get it >done. If you don't see a patch from me for the above, assume I didn't >get to look into it further. > > Alright; I had few minutes. Try the attached (it runs here, don't know if it will solve the problem though) % cd ieee80211-1.0.3 % patch -p1 < ieee80211-1.0.3-skb_corrupt.patch James |
From: James K. <jke...@li...> - 2005-08-04 18:26:32
|
Kevin G=F6ser wrote: >Am Donnerstag, 4. August 2005 17:33 schrieben Sie: > =20 > >>Kevin G=F6ser wrote: >> =20 >> >>>Hi, >>> >>>I just checked if the same thing happens with other traffic, too. It d= oes! >>>For example http packages are also sent with the wrong mac address as >>>source. However, the answers are always sent to the correct mac addres= s. >>>So this isn't dhcpcd related, is it? I'm not sure if dhcpcd still coul= d be >>>responsible for this. Any idea? >>> =20 >>> >>What version of the ipw2200 driver are you using? If not using 1.0.6 >>and ieee80211-1.0.3, can you upgrade to those? >> =20 >> > >Sorry, I'm already up to date :-/ Is there anything which could proof th= at it=20 >is not a driver thing? > =20 > Hmmm. When a socket buffer is passed to the ieee80211 subsystem, it uses the socket buffer as if it owns it (which it does) and overwrites the 802.3 header with an 802.11 SNAP header. If that frame is then re-used, the 802.3 header is no longer present (it has been overwritten w/ the SNAP)=20 This could explain what you are seeing. Yi -- if you have time during your day today, can you take a look at this? We should be able to modify ieee80211_tx's ieee80211_xmit() method so that it doesn't have to overwrite the incoming SKB and can just stick the snap on the first TXB constructed. If I have some more free time today I'll take a crack at it and send out a patch if I get it done. If you don't see a patch from me for the above, assume I didn't get to look into it further. James |
From: Ivo v. D. <iv...@gm...> - 2005-08-03 21:15:42
|
Hi, > >Recently a update was made in GIT where the payload variable was added to > > all ieee80211_hdr_*addr structures. But doesn this break the > >ieee80211_authentication > >ieee80211_probe_response > >ieee80211_assoc_response_frame > >Structures? Each of these have the ieee80211_hdr_3addr inside it, and by > >adding the payload variable to the header it effectively moves all > > variables inside the mgmt structures 1 byte. > >Which would cause the data from these structures to be read incorrectly. > > They are u8 payload[0], which takes no storage and essentially creates a > pointer alias to whatever comes next. > > struct foo { > u8 data1; > u8 payload[0]; > u8 data2; > } bar; > > &bar.data2 =3D=3D bar.payload Thanks for clearing this up, I always assumed u8 payload[0] would have a 1= =20 byte size. Guess I still need some C-coding lessons..;) > >A second thing I noticed, with code that is already longer in the > > repository, ieee80211_rx_mgt checks which kind of frame it is, and when > > for example it is a IEEE80211_STYPE_ASSOC_RESP frame, then > > ieee80211_handle_assoc_resp is being called which will create a network > > structure and passes it to the driver. But when should the status > > variable be checked? > > Currently, the stack doesn't know about association; it is just > performing some data transforms from 802.11 structures to native > structures (like ieee80211_network). > > As intelligence is moved inot the stack (vs. in each driver), then the > stack will start to manage the association state and need to do things > based on the status. My point is not exactly about if the stack will handle it, but with the=20 current method a non-firmware driver (like rt2x00) needs to catch the packe= t=20 and check what status it has, and then pass it to the ieee80211 stack to ge= t=20 the network structure. Wouldn't it be possible if the driver also receives the sk_buffer pointer o= r=20 header structure pointer with ieee->handle_management_frame? This way the stack creates the network structure and hands over all=20 information to the driver so the driver can do all work in one shot. > >It s possible a association request will be rejected by the AP, but with > > the current stack it means that the packet should be handled like this: > > Driver receives packet, driver checks if it is a mgmt packet, driver > > checks if it is an IEEE80211_STYPE_ASSOC_RESP frame, driver checks if > > the association succeeded, driver passes the packet to the stack, stack > > creates the network structure, and gives it back to the driver. > >Shouldn't at least the status be checked by the stack? > > With the ipw2200 at least, the IEEE80211_STYPE_ASSOC_RESP frames would > typically only come through in monitor mode (the firmware/ucode filters > out most management frames) The exception to this is that after an > associate completes, the QoS code will try and pass the payload to the > ieee80211 subsystem to try and construct a ieee80211_network structure Ah, the wonderfull world of wireless chipsets with firmware..:) Sometimes I really wish that the rt2x00 chips where I am creating the drive= r=20 for also contained firmware, it would make it much easier..:) > >So the driver only has to act when a association request succeeded. > > The current 'handle_management_frame' should probably be retyped to have > specific callbacks for each type of management frame, with a parsed > native structure filled out and provided. The parsing and calling would > only need to be done if the driver has implemented that callback. > > For example, instead of having ieee->handle_management_frame there > should be: > > handle_probe_resp() > handle_beacon() > handle_assoc_resp() > > Once the ieee80211 stack is more mature, a soft mac solution would > likely have little need for the probe_resp/beacon whereas the assoc_resp > could be used to configure the lmac to do filtering of non-network > packets (as an example) As a temporary solution, passing the sk_buffer might be usefull as well, th= at=20 provides the driver with the possibility to use the sk_buffer and use the=20 structure required for that management frame. IvD |
From: James K. <jke...@li...> - 2005-08-03 16:20:33
|
Ivo van Doorn wrote: >Hi, > >Recently a update was made in GIT where the payload variable was added to all >ieee80211_hdr_*addr structures. But doesn this break the >ieee80211_authentication >ieee80211_probe_response >ieee80211_assoc_response_frame >Structures? Each of these have the ieee80211_hdr_3addr inside it, and by >adding the payload variable to the header it effectively moves all variables >inside the mgmt structures 1 byte. >Which would cause the data from these structures to be read incorrectly. > > They are u8 payload[0], which takes no storage and essentially creates a pointer alias to whatever comes next. struct foo { u8 data1; u8 payload[0]; u8 data2; } bar; &bar.data2 == bar.payload >A second thing I noticed, with code that is already longer in the repository, >ieee80211_rx_mgt checks which kind of frame it is, and when for example it is >a IEEE80211_STYPE_ASSOC_RESP frame, then ieee80211_handle_assoc_resp is being >called which will create a network structure and passes it to the driver. >But when should the status variable be checked? > > Currently, the stack doesn't know about association; it is just performing some data transforms from 802.11 structures to native structures (like ieee80211_network). As intelligence is moved inot the stack (vs. in each driver), then the stack will start to manage the association state and need to do things based on the status. >It s possible a association request will be rejected by the AP, but with the >current stack it means that the packet should be handled like this: >Driver receives packet, driver checks if it is a mgmt packet, driver checks if >it is an IEEE80211_STYPE_ASSOC_RESP frame, driver checks if the association >succeeded, driver passes the packet to the stack, stack creates the network >structure, and gives it back to the driver. >Shouldn't at least the status be checked by the stack? > > With the ipw2200 at least, the IEEE80211_STYPE_ASSOC_RESP frames would typically only come through in monitor mode (the firmware/ucode filters out most management frames) The exception to this is that after an associate completes, the QoS code will try and pass the payload to the ieee80211 subsystem to try and construct a ieee80211_network structure >So the driver only has to act when a association request succeeded. > > The current 'handle_management_frame' should probably be retyped to have specific callbacks for each type of management frame, with a parsed native structure filled out and provided. The parsing and calling would only need to be done if the driver has implemented that callback. For example, instead of having ieee->handle_management_frame there should be: handle_probe_resp() handle_beacon() handle_assoc_resp() Once the ieee80211 stack is more mature, a soft mac solution would likely have little need for the probe_resp/beacon whereas the assoc_resp could be used to configure the lmac to do filtering of non-network packets (as an example) James |
From: Ivo v. D. <iv...@gm...> - 2005-08-03 07:20:22
|
Hi, Recently a update was made in GIT where the payload variable was added to a= ll=20 ieee80211_hdr_*addr structures. But doesn this break the=20 ieee80211_authentication ieee80211_probe_response ieee80211_assoc_response_frame Structures? Each of these have the ieee80211_hdr_3addr inside it, and by=20 adding the payload variable to the header it effectively moves all variable= s=20 inside the mgmt structures 1 byte. Which would cause the data from these structures to be read incorrectly. A second thing I noticed, with code that is already longer in the repositor= y, ieee80211_rx_mgt checks which kind of frame it is, and when for example it = is=20 a IEEE80211_STYPE_ASSOC_RESP frame, then ieee80211_handle_assoc_resp is bei= ng=20 called which will create a network structure and passes it to the driver. But when should the status variable be checked? It s possible a association request will be rejected by the AP, but with th= e=20 current stack it means that the packet should be handled like this: Driver receives packet, driver checks if it is a mgmt packet, driver checks= if=20 it is an IEEE80211_STYPE_ASSOC_RESP frame, driver checks if the associatio= n=20 succeeded, driver passes the packet to the stack, stack creates the network= =20 structure, and gives it back to the driver. Shouldn't at least the status be checked by the stack? So the driver only has to act when a association request succeeded. IvD |
From: Pedro R. <ram...@se...> - 2005-07-28 23:23:47
|
James Ketrenos wrote: > Ivo van Doorn wrote: > > >>Hi, >> >>This patch will add support for the Hiperlan2 channels which are available for >>Europe. >> >> > > As a result of the variances across geographies and various > manufacturers hardware cards, and the channels they support and have > tested against, we're moving the channel maps out of the ieee80211_geo > code and back into the drivers. Otherwise we'll end up with a mismatch > of what the ieee80211_geo code thinks is supported vs. what may actually > be supported by the cards. > > The ieee80211_geo code will provide some helper functions for verifying > channels, etc. but the actual channel maps will need to come from the > drivers themselves. > > I'll be putting up some updated code in GIT tomorrow that does this. > > James I think it would be nice to maintain some default tables in ieee80211 so that drivers that use the most "standard" tables, need not define them. I expect that there are some "standard" tables (USA/EU/Japan) plus "maximum" (all channels possible) and "minimum" (channels common to all regions/countries) tables. So it should probably be good to have some sanitized standard tables and then allow a driver to choose to use those or provide their own. It would also be nice to have the tables named so that in the future a user can get the name of the table it is using some API or application and know which set of channels a card supports ex: "USA", "EU", "Japan", "USA+12", etc.. Just a thought =:-) -- Pedro Ramalhais |
From: James K. <jke...@li...> - 2005-07-28 20:48:27
|
Ivo van Doorn wrote: >Hi, > >This patch will add support for the Hiperlan2 channels which are available for >Europe. > > As a result of the variances across geographies and various manufacturers hardware cards, and the channels they support and have tested against, we're moving the channel maps out of the ieee80211_geo code and back into the drivers. Otherwise we'll end up with a mismatch of what the ieee80211_geo code thinks is supported vs. what may actually be supported by the cards. The ieee80211_geo code will provide some helper functions for verifying channels, etc. but the actual channel maps will need to come from the drivers themselves. I'll be putting up some updated code in GIT tomorrow that does this. James >Patch is against ieee80211 1.0.3. > >Signed-Off-By: Ivo van Doorn <Iv...@gm...> > >IvD > > >diff -U 3 -H -w -E -d -r -N -- ieee80211-1.0.3/ieee80211_geo.c >ieee80211-1.0.3-hiperlan/ieee80211_geo.c >--- ieee80211-1.0.3/ieee80211_geo.c 2005-07-15 01:53:35.000000000 +0200 >+++ ieee80211-1.0.3-hiperlan/ieee80211_geo.c 2005-07-21 15:32:00.000000000 >+0200 >@@ -82,6 +82,12 @@ > { 5220, 44}, { 5240, 48}, > { 5260, 52, 1 }, { 5280, 56, 1 }, > { 5300, 60, 1 }, { 5320, 64, 1 }, >+ { 5500, 100 }, { 5520, 104 }, >+ { 5540, 108 }, { 5560, 112 }, >+ { 5580, 116 }, { 5600, 120 }, >+ { 5620, 124 }, { 5640, 128 }, >+ { 5660, 132 }, { 5680, 136 }, >+ { 5700, 140}, > { 5745,149}, { 5765,153}, > { 5785,157}, { 5805,161} }, > }, >diff -U 3 -H -w -E -d -r -N -- ieee80211-1.0.3/net/ieee80211.h >ieee80211-1.0.3-hiperlan/net/ieee80211.h >--- ieee80211-1.0.3/net/ieee80211.h 2005-07-15 01:53:35.000000000 +0200 >+++ ieee80211-1.0.3-hiperlan/net/ieee80211.h 2005-07-21 15:36:59.000000000 >+0200 >@@ -735,7 +735,7 @@ > > #define IEEE80211_52GHZ_MIN_CHANNEL 36 > #define IEEE80211_52GHZ_MAX_CHANNEL 161 >-#define IEEE80211_52GHZ_CHANNELS 16 >+#define IEEE80211_52GHZ_CHANNELS 27 > > struct ieee80211_channel { > u16 freq; > > |
From: Ivo v. D. <iv...@gm...> - 2005-07-28 15:19:15
|
On Thursday 28 July 2005 17:10, Pedro Ramalhais wrote: > Ivo van Doorn wrote: > > Hi, > > > > This patch will add the ieee80211_hdr_3addr to the > > ieee80211_assoc_request_frame structure. > > > > Patch is against ieee80211 1.0.3. > > > > IvD > > > > > > diff -U 3 -H -w -E -d -r -N -- ieee80211-1.0.3/net/ieee80211.h > > ieee80211-1.0.3-assoc/net/ieee80211.h > > --- ieee80211-1.0.3/net/ieee80211.h 2005-07-15 01:53:35.000000000 > > +0200 +++ ieee80211-1.0.3-assoc/net/ieee80211.h 2005-07-28 > > 16:58:30.000000000 +0200 > > @@ -566,6 +566,7 @@ > > } __attribute__ ((packed)); > > > > struct ieee80211_assoc_request_frame { > > + struct ieee80211_hdr_3addr header; > > u16 capability; > > u16 listen_interval; > > u8 current_ap[ETH_ALEN]; > > I don't get it. What's that good for? > Thanks! It will make more sense since the structures ieee80211_authentication ieee80211_probe_response ieee80211_assoc_response_frame also contain this ieee80211_hdr_3addr header. I cannot see a reason why it should not be in ieee80211_assoc_request_frame. IvD |