Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (21 commits)
[PATCH] wext: Fix RtNetlink ENCODE security permissions
[PATCH] bcm43xx: iw_priv_args names should be <16 characters
[PATCH] bcm43xx: sysfs code cleanup
[PATCH] bcm43xx: fix pctl slowclock limit calculation
[PATCH] bcm43xx: fix dyn tssi2dbm memleak
[PATCH] bcm43xx: fix config menu alignment
[PATCH] bcm43xx wireless: fix printk format warnings
[PATCH] softmac: report when scanning has finished
[PATCH] softmac: fix event sending
[PATCH] softmac: handle iw_mode properly
[PATCH] softmac: dont send out packets while scanning
[PATCH] softmac: return -EAGAIN from getscan while scanning
[PATCH] bcm43xx: set trans_start on TX to prevent bogus timeouts
[PATCH] orinoco: fix truncating commsquality RID with the latest Symbol firmware
[PATCH] softmac: fix spinlock recursion on reassoc
[PATCH] Revert NET_RADIO Kconfig title change
[PATCH] wext: Fix IWENCODEEXT security permissions
[PATCH] wireless/atmel: send WEXT scan completion events
[PATCH] wireless/airo: clean up WEXT association and scan events
[PATCH] softmac uses Wiress Ext.
...

+290 -172
+1 -1
drivers/net/ne.c
··· 226 226 netdev_boot_setup_check(dev); 227 227 228 228 #ifdef CONFIG_TOSHIBA_RBTX4938 229 - dev->base_addr = 0x07f20280; 229 + dev->base_addr = RBTX4938_RTL_8019_BASE; 230 230 dev->irq = RBTX4938_RTL_8019_IRQ; 231 231 #endif 232 232 err = do_ne_probe(dev);
+1 -1
drivers/net/wireless/Kconfig
··· 6 6 depends on NETDEVICES 7 7 8 8 config NET_RADIO 9 - bool "Wireless LAN drivers (non-hamradio)" 9 + bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions" 10 10 select WIRELESS_EXT 11 11 ---help--- 12 12 Support for wireless LANs and everything having to do with radio,
+17 -29
drivers/net/wireless/airo.c
··· 3139 3139 } 3140 3140 if ( status & EV_LINK ) { 3141 3141 union iwreq_data wrqu; 3142 + int scan_forceloss = 0; 3142 3143 /* The link status has changed, if you want to put a 3143 3144 monitor hook in, do it here. (Remember that 3144 3145 interrupts are still disabled!) ··· 3158 3157 code) */ 3159 3158 #define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason 3160 3159 code) */ 3161 - #define ASSOCIATED 0x0400 /* Assocatied */ 3160 + #define ASSOCIATED 0x0400 /* Associated */ 3161 + #define REASSOCIATED 0x0600 /* Reassociated? Only on firmware >= 5.30.17 */ 3162 3162 #define RC_RESERVED 0 /* Reserved return code */ 3163 3163 #define RC_NOREASON 1 /* Unspecified reason */ 3164 3164 #define RC_AUTHINV 2 /* Previous authentication invalid */ ··· 3176 3174 leaving BSS */ 3177 3175 #define RC_NOAUTH 9 /* Station requesting (Re)Association is not 3178 3176 Authenticated with the responding station */ 3179 - if (newStatus != ASSOCIATED) { 3180 - if (auto_wep && !apriv->expires) { 3181 - apriv->expires = RUN_AT(3*HZ); 3182 - wake_up_interruptible(&apriv->thr_wait); 3183 - } 3184 - } else { 3185 - struct task_struct *task = apriv->task; 3177 + if (newStatus == FORCELOSS && apriv->scan_timeout > 0) 3178 + scan_forceloss = 1; 3179 + if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) { 3186 3180 if (auto_wep) 3187 3181 apriv->expires = 0; 3188 - if (task) 3189 - wake_up_process (task); 3182 + if (apriv->task) 3183 + wake_up_process (apriv->task); 3190 3184 set_bit(FLAG_UPDATE_UNI, &apriv->flags); 3191 3185 set_bit(FLAG_UPDATE_MULTI, &apriv->flags); 3192 - } 3193 - /* Question : is ASSOCIATED the only status 3194 - * that is valid ? We want to catch handover 3195 - * and reassociations as valid status 3196 - * Jean II */ 3197 - if(newStatus == ASSOCIATED) { 3198 - #if 0 3199 - /* FIXME: Grabbing scan results here 3200 - * seems to be too early??? Just wait for 3201 - * timeout instead. */ 3202 - if (apriv->scan_timeout > 0) { 3203 - set_bit(JOB_SCAN_RESULTS, &apriv->flags); 3204 - wake_up_interruptible(&apriv->thr_wait); 3205 - } 3206 - #endif 3186 + 3207 3187 if (down_trylock(&apriv->sem) != 0) { 3208 3188 set_bit(JOB_EVENT, &apriv->flags); 3209 3189 wake_up_interruptible(&apriv->thr_wait); 3210 3190 } else 3211 3191 airo_send_event(dev); 3212 - } else { 3213 - memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); 3214 - wrqu.ap_addr.sa_family = ARPHRD_ETHER; 3192 + } else if (!scan_forceloss) { 3193 + if (auto_wep && !apriv->expires) { 3194 + apriv->expires = RUN_AT(3*HZ); 3195 + wake_up_interruptible(&apriv->thr_wait); 3196 + } 3215 3197 3216 3198 /* Send event to user space */ 3199 + memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); 3200 + wrqu.ap_addr.sa_family = ARPHRD_ETHER; 3217 3201 wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL); 3218 3202 } 3219 3203 } ··· 7124 7136 goto out; 7125 7137 7126 7138 /* Initiate a scan command */ 7139 + ai->scan_timeout = RUN_AT(3*HZ); 7127 7140 memset(&cmd, 0, sizeof(cmd)); 7128 7141 cmd.cmd=CMD_LISTBSS; 7129 7142 issuecommand(ai, &cmd, &rsp); 7130 - ai->scan_timeout = RUN_AT(3*HZ); 7131 7143 wake = 1; 7132 7144 7133 7145 out:
+11
drivers/net/wireless/atmel.c
··· 3463 3463 u8 status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET)); 3464 3464 u8 command = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET)); 3465 3465 int fast_scan; 3466 + union iwreq_data wrqu; 3466 3467 3467 3468 if (status == CMD_STATUS_IDLE || 3468 3469 status == CMD_STATUS_IN_PROGRESS) ··· 3488 3487 atmel_scan(priv, 1); 3489 3488 } else { 3490 3489 int bss_index = retrieve_bss(priv); 3490 + int notify_scan_complete = 1; 3491 3491 if (bss_index != -1) { 3492 3492 atmel_join_bss(priv, bss_index); 3493 3493 } else if (priv->operating_mode == IW_MODE_ADHOC && ··· 3497 3495 } else { 3498 3496 priv->fast_scan = !fast_scan; 3499 3497 atmel_scan(priv, 1); 3498 + notify_scan_complete = 0; 3500 3499 } 3501 3500 priv->site_survey_state = SITE_SURVEY_COMPLETED; 3501 + if (notify_scan_complete) { 3502 + wrqu.data.length = 0; 3503 + wrqu.data.flags = 0; 3504 + wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); 3505 + } 3502 3506 } 3503 3507 break; 3504 3508 ··· 3517 3509 priv->site_survey_state = SITE_SURVEY_COMPLETED; 3518 3510 if (priv->station_is_associated) { 3519 3511 atmel_enter_state(priv, STATION_STATE_READY); 3512 + wrqu.data.length = 0; 3513 + wrqu.data.flags = 0; 3514 + wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); 3520 3515 } else { 3521 3516 atmel_scan(priv, 1); 3522 3517 }
+3
drivers/net/wireless/bcm43xx/Kconfig
··· 17 17 18 18 config BCM43XX_DMA 19 19 bool 20 + depends on BCM43XX 21 + 20 22 config BCM43XX_PIO 21 23 bool 24 + depends on BCM43XX 22 25 23 26 choice 24 27 prompt "BCM43xx data transfer mode"
+14 -3
drivers/net/wireless/bcm43xx/bcm43xx.h
··· 15 15 16 16 #include "bcm43xx_debugfs.h" 17 17 #include "bcm43xx_leds.h" 18 - #include "bcm43xx_sysfs.h" 19 18 20 19 21 20 #define PFX KBUILD_MODNAME ": " ··· 637 638 }; 638 639 639 640 struct bcm43xx_private { 640 - struct bcm43xx_sysfs sysfs; 641 - 642 641 struct ieee80211_device *ieee; 643 642 struct ieee80211softmac_device *softmac; 644 643 ··· 767 770 struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) 768 771 { 769 772 return ieee80211softmac_priv(dev); 773 + } 774 + 775 + struct device; 776 + 777 + static inline 778 + struct bcm43xx_private * dev_to_bcm(struct device *dev) 779 + { 780 + struct net_device *net_dev; 781 + struct bcm43xx_private *bcm; 782 + 783 + net_dev = dev_get_drvdata(dev); 784 + bcm = bcm43xx_priv(net_dev); 785 + 786 + return bcm; 770 787 } 771 788 772 789
+4 -4
drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
··· 452 452 size_t i; 453 453 char c; 454 454 455 - printk(KERN_INFO PFX "Data dump (%s, %u bytes):", 455 + printk(KERN_INFO PFX "Data dump (%s, %zd bytes):", 456 456 description, size); 457 457 for (i = 0; i < size; i++) { 458 458 c = data[i]; 459 459 if (i % 8 == 0) 460 - printk("\n" KERN_INFO PFX "0x%08x: 0x%02x, ", i, c & 0xff); 460 + printk("\n" KERN_INFO PFX "0x%08zx: 0x%02x, ", i, c & 0xff); 461 461 else 462 462 printk("0x%02x, ", c & 0xff); 463 463 } ··· 472 472 int j; 473 473 const unsigned char *d; 474 474 475 - printk(KERN_INFO PFX "*** Bitdump (%s, %u bytes, %s) ***", 475 + printk(KERN_INFO PFX "*** Bitdump (%s, %zd bytes, %s) ***", 476 476 description, bytes, msb_to_lsb ? "MSB to LSB" : "LSB to MSB"); 477 477 for (i = 0; i < bytes; i++) { 478 478 d = data + i; 479 479 if (i % 8 == 0) 480 - printk("\n" KERN_INFO PFX "0x%08x: ", i); 480 + printk("\n" KERN_INFO PFX "0x%08zx: ", i); 481 481 if (msb_to_lsb) { 482 482 for (j = 7; j >= 0; j--) { 483 483 if (*d & (1 << j))
+7 -6
drivers/net/wireless/bcm43xx/bcm43xx_dma.c
··· 196 196 } 197 197 if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) { 198 198 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G " 199 - "(0x%08x, len: %lu)\n", 200 - ring->dmabase, BCM43xx_DMA_RINGMEMSIZE); 199 + "(0x%llx, len: %lu)\n", 200 + (unsigned long long)ring->dmabase, 201 + BCM43xx_DMA_RINGMEMSIZE); 201 202 dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE, 202 203 ring->vbase, ring->dmabase); 203 204 return -ENOMEM; ··· 308 307 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); 309 308 dev_kfree_skb_any(skb); 310 309 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G " 311 - "(0x%08x, len: %u)\n", 312 - dmaaddr, ring->rx_buffersize); 310 + "(0x%llx, len: %u)\n", 311 + (unsigned long long)dmaaddr, ring->rx_buffersize); 313 312 return -ENOMEM; 314 313 } 315 314 meta->skb = skb; ··· 730 729 if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) { 731 730 return_slot(ring, slot); 732 731 printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G " 733 - "(0x%08x, len: %u)\n", 734 - meta->dmaaddr, skb->len); 732 + "(0x%llx, len: %u)\n", 733 + (unsigned long long)meta->dmaaddr, skb->len); 735 734 return -ENOMEM; 736 735 } 737 736
+2
drivers/net/wireless/bcm43xx/bcm43xx_main.c
··· 52 52 #include "bcm43xx_wx.h" 53 53 #include "bcm43xx_ethtool.h" 54 54 #include "bcm43xx_xmit.h" 55 + #include "bcm43xx_sysfs.h" 55 56 56 57 57 58 MODULE_DESCRIPTION("Broadcom BCM43xx wireless driver"); ··· 3523 3522 err = bcm43xx_pio_tx(bcm, txb); 3524 3523 else 3525 3524 err = bcm43xx_dma_tx(bcm, txb); 3525 + bcm->net_dev->trans_start = jiffies; 3526 3526 3527 3527 return err; 3528 3528 }
+1
drivers/net/wireless/bcm43xx/bcm43xx_phy.c
··· 2151 2151 phy->tssi2dbm = NULL; 2152 2152 printk(KERN_ERR PFX "Could not generate " 2153 2153 "tssi2dBm table\n"); 2154 + kfree(dyn_tssi2dbm); 2154 2155 return -ENODEV; 2155 2156 } 2156 2157 phy->tssi2dbm = dyn_tssi2dbm;
+69 -48
drivers/net/wireless/bcm43xx/bcm43xx_power.c
··· 35 35 #include "bcm43xx_main.h" 36 36 37 37 38 + /* Get the Slow Clock Source */ 39 + static int bcm43xx_pctl_get_slowclksrc(struct bcm43xx_private *bcm) 40 + { 41 + u32 tmp; 42 + int err; 43 + 44 + assert(bcm->current_core == &bcm->core_chipcommon); 45 + if (bcm->current_core->rev < 6) { 46 + if (bcm->bustype == BCM43xx_BUSTYPE_PCMCIA || 47 + bcm->bustype == BCM43xx_BUSTYPE_SB) 48 + return BCM43xx_PCTL_CLKSRC_XTALOS; 49 + if (bcm->bustype == BCM43xx_BUSTYPE_PCI) { 50 + err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp); 51 + assert(!err); 52 + if (tmp & 0x10) 53 + return BCM43xx_PCTL_CLKSRC_PCI; 54 + return BCM43xx_PCTL_CLKSRC_XTALOS; 55 + } 56 + } 57 + if (bcm->current_core->rev < 10) { 58 + tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); 59 + tmp &= 0x7; 60 + if (tmp == 0) 61 + return BCM43xx_PCTL_CLKSRC_LOPWROS; 62 + if (tmp == 1) 63 + return BCM43xx_PCTL_CLKSRC_XTALOS; 64 + if (tmp == 2) 65 + return BCM43xx_PCTL_CLKSRC_PCI; 66 + } 67 + 68 + return BCM43xx_PCTL_CLKSRC_XTALOS; 69 + } 70 + 38 71 /* Get max/min slowclock frequency 39 72 * as described in http://bcm-specs.sipsolutions.net/PowerControl 40 73 */ 41 74 static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm, 42 75 int get_max) 43 76 { 44 - int limit = 0; 77 + int limit; 78 + int clocksrc; 45 79 int divisor; 46 - int selection; 47 - int err; 48 80 u32 tmp; 49 - struct bcm43xx_coreinfo *old_core; 50 81 51 - if (!(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL)) 52 - goto out; 53 - old_core = bcm->current_core; 54 - err = bcm43xx_switch_core(bcm, &bcm->core_chipcommon); 55 - if (err) 56 - goto out; 82 + assert(bcm->chipcommon_capabilities & BCM43xx_CAPABILITIES_PCTL); 83 + assert(bcm->current_core == &bcm->core_chipcommon); 57 84 85 + clocksrc = bcm43xx_pctl_get_slowclksrc(bcm); 58 86 if (bcm->current_core->rev < 6) { 59 - if ((bcm->bustype == BCM43xx_BUSTYPE_PCMCIA) || 60 - (bcm->bustype == BCM43xx_BUSTYPE_SB)) { 61 - selection = 1; 87 + switch (clocksrc) { 88 + case BCM43xx_PCTL_CLKSRC_PCI: 89 + divisor = 64; 90 + break; 91 + case BCM43xx_PCTL_CLKSRC_XTALOS: 62 92 divisor = 32; 63 - } else { 64 - err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, &tmp); 65 - if (err) { 66 - printk(KERN_ERR PFX "clockfreqlimit pcicfg read failure\n"); 67 - goto out_switchback; 68 - } 69 - if (tmp & 0x10) { 70 - /* PCI */ 71 - selection = 2; 72 - divisor = 64; 73 - } else { 74 - /* XTAL */ 75 - selection = 1; 76 - divisor = 32; 77 - } 93 + break; 94 + default: 95 + assert(0); 96 + divisor = 1; 78 97 } 79 98 } else if (bcm->current_core->rev < 10) { 80 - selection = (tmp & 0x07); 81 - if (selection) { 82 - tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); 83 - divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); 84 - } else 99 + switch (clocksrc) { 100 + case BCM43xx_PCTL_CLKSRC_LOPWROS: 85 101 divisor = 1; 102 + break; 103 + case BCM43xx_PCTL_CLKSRC_XTALOS: 104 + case BCM43xx_PCTL_CLKSRC_PCI: 105 + tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL); 106 + divisor = ((tmp & 0xFFFF0000) >> 16) + 1; 107 + divisor *= 4; 108 + break; 109 + default: 110 + assert(0); 111 + divisor = 1; 112 + } 86 113 } else { 87 114 tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SYSCLKCTL); 88 - divisor = 4 * (1 + ((tmp & 0xFFFF0000) >> 16)); 89 - selection = 1; 115 + divisor = ((tmp & 0xFFFF0000) >> 16) + 1; 116 + divisor *= 4; 90 117 } 91 - 92 - switch (selection) { 93 - case 0: 94 - /* LPO */ 118 + 119 + switch (clocksrc) { 120 + case BCM43xx_PCTL_CLKSRC_LOPWROS: 95 121 if (get_max) 96 122 limit = 43000; 97 123 else 98 124 limit = 25000; 99 125 break; 100 - case 1: 101 - /* XTAL */ 126 + case BCM43xx_PCTL_CLKSRC_XTALOS: 102 127 if (get_max) 103 128 limit = 20200000; 104 129 else 105 130 limit = 19800000; 106 131 break; 107 - case 2: 108 - /* PCI */ 132 + case BCM43xx_PCTL_CLKSRC_PCI: 109 133 if (get_max) 110 134 limit = 34000000; 111 135 else ··· 137 113 break; 138 114 default: 139 115 assert(0); 116 + limit = 0; 140 117 } 141 118 limit /= divisor; 142 119 143 - out_switchback: 144 - err = bcm43xx_switch_core(bcm, old_core); 145 - assert(err == 0); 146 - 147 - out: 148 120 return limit; 149 121 } 122 + 150 123 151 124 /* init power control 152 125 * as described in http://bcm-specs.sipsolutions.net/PowerControl
+9
drivers/net/wireless/bcm43xx/bcm43xx_power.h
··· 33 33 34 34 #include <linux/types.h> 35 35 36 + /* Clock sources */ 37 + enum { 38 + /* PCI clock */ 39 + BCM43xx_PCTL_CLKSRC_PCI, 40 + /* Crystal slow clock oscillator */ 41 + BCM43xx_PCTL_CLKSRC_XTALOS, 42 + /* Low power oscillator */ 43 + BCM43xx_PCTL_CLKSRC_LOPWROS, 44 + }; 36 45 37 46 struct bcm43xx_private; 38 47
+67 -48
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
··· 71 71 return -EINVAL; 72 72 } 73 73 74 + static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len) 75 + { 76 + int i, pos = 0; 77 + 78 + for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { 79 + pos += snprintf(buf + pos, buf_len - pos - 1, 80 + "%04X", swab16(sprom[i]) & 0xFFFF); 81 + } 82 + pos += snprintf(buf + pos, buf_len - pos - 1, "\n"); 83 + 84 + return pos + 1; 85 + } 86 + 87 + static int hex2sprom(u16 *sprom, const char *dump, size_t len) 88 + { 89 + char tmp[5] = { 0 }; 90 + int cnt = 0; 91 + unsigned long parsed; 92 + 93 + if (len < BCM43xx_SPROM_SIZE * sizeof(u16) * 2) 94 + return -EINVAL; 95 + 96 + while (cnt < BCM43xx_SPROM_SIZE) { 97 + memcpy(tmp, dump, 4); 98 + dump += 4; 99 + parsed = simple_strtoul(tmp, NULL, 16); 100 + sprom[cnt++] = swab16((u16)parsed); 101 + } 102 + 103 + return 0; 104 + } 105 + 74 106 static ssize_t bcm43xx_attr_sprom_show(struct device *dev, 75 107 struct device_attribute *attr, 76 108 char *buf) 77 109 { 78 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); 110 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 79 111 u16 *sprom; 80 112 unsigned long flags; 81 - int i, err; 113 + int err; 82 114 83 115 if (!capable(CAP_NET_ADMIN)) 84 116 return -EPERM; ··· 123 91 bcm43xx_lock_mmio(bcm, flags); 124 92 assert(bcm->initialized); 125 93 err = bcm43xx_sprom_read(bcm, sprom); 126 - if (!err) { 127 - for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { 128 - buf[i * 2] = sprom[i] & 0x00FF; 129 - buf[i * 2 + 1] = (sprom[i] & 0xFF00) >> 8; 130 - } 131 - } 94 + if (!err) 95 + err = sprom2hex(sprom, buf, PAGE_SIZE); 132 96 bcm43xx_unlock_mmio(bcm, flags); 133 97 kfree(sprom); 134 98 135 - return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16); 99 + return err; 136 100 } 137 101 138 102 static ssize_t bcm43xx_attr_sprom_store(struct device *dev, 139 103 struct device_attribute *attr, 140 104 const char *buf, size_t count) 141 105 { 142 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom); 106 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 143 107 u16 *sprom; 144 108 unsigned long flags; 145 - int i, err; 109 + int err; 146 110 147 111 if (!capable(CAP_NET_ADMIN)) 148 112 return -EPERM; 149 113 150 - if (count != BCM43xx_SPROM_SIZE * sizeof(u16)) 151 - return -EINVAL; 152 114 sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom), 153 115 GFP_KERNEL); 154 116 if (!sprom) 155 117 return -ENOMEM; 156 - for (i = 0; i < BCM43xx_SPROM_SIZE; i++) { 157 - sprom[i] = buf[i * 2] & 0xFF; 158 - sprom[i] |= ((u16)(buf[i * 2 + 1] & 0xFF)) << 8; 159 - } 118 + err = hex2sprom(sprom, buf, count); 119 + if (err) 120 + goto out_kfree; 160 121 bcm43xx_lock_mmio(bcm, flags); 161 122 assert(bcm->initialized); 162 123 err = bcm43xx_sprom_write(bcm, sprom); 163 124 bcm43xx_unlock_mmio(bcm, flags); 125 + out_kfree: 164 126 kfree(sprom); 165 127 166 128 return err ? err : count; 167 129 168 130 } 169 131 132 + static DEVICE_ATTR(sprom, 0600, 133 + bcm43xx_attr_sprom_show, 134 + bcm43xx_attr_sprom_store); 135 + 170 136 static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, 171 137 struct device_attribute *attr, 172 138 char *buf) 173 139 { 174 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); 140 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 175 141 unsigned long flags; 176 142 int err; 177 143 ssize_t count = 0; ··· 205 175 struct device_attribute *attr, 206 176 const char *buf, size_t count) 207 177 { 208 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode); 178 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 209 179 unsigned long flags; 210 180 int err; 211 181 int mode; ··· 245 215 return err ? err : count; 246 216 } 247 217 218 + static DEVICE_ATTR(interference, 0644, 219 + bcm43xx_attr_interfmode_show, 220 + bcm43xx_attr_interfmode_store); 221 + 248 222 static ssize_t bcm43xx_attr_preamble_show(struct device *dev, 249 223 struct device_attribute *attr, 250 224 char *buf) 251 225 { 252 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); 226 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 253 227 unsigned long flags; 254 228 int err; 255 229 ssize_t count; ··· 279 245 struct device_attribute *attr, 280 246 const char *buf, size_t count) 281 247 { 282 - struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_preamble); 248 + struct bcm43xx_private *bcm = dev_to_bcm(dev); 283 249 unsigned long flags; 284 250 int err; 285 251 int value; ··· 301 267 return err ? err : count; 302 268 } 303 269 270 + static DEVICE_ATTR(shortpreamble, 0644, 271 + bcm43xx_attr_preamble_show, 272 + bcm43xx_attr_preamble_store); 273 + 304 274 int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) 305 275 { 306 276 struct device *dev = &bcm->pci_dev->dev; 307 - struct bcm43xx_sysfs *sysfs = &bcm->sysfs; 308 277 int err; 309 278 310 279 assert(bcm->initialized); 311 280 312 - sysfs->attr_sprom.attr.name = "sprom"; 313 - sysfs->attr_sprom.attr.owner = THIS_MODULE; 314 - sysfs->attr_sprom.attr.mode = 0600; 315 - sysfs->attr_sprom.show = bcm43xx_attr_sprom_show; 316 - sysfs->attr_sprom.store = bcm43xx_attr_sprom_store; 317 - err = device_create_file(dev, &sysfs->attr_sprom); 281 + err = device_create_file(dev, &dev_attr_sprom); 318 282 if (err) 319 283 goto out; 320 - 321 - sysfs->attr_interfmode.attr.name = "interference"; 322 - sysfs->attr_interfmode.attr.owner = THIS_MODULE; 323 - sysfs->attr_interfmode.attr.mode = 0600; 324 - sysfs->attr_interfmode.show = bcm43xx_attr_interfmode_show; 325 - sysfs->attr_interfmode.store = bcm43xx_attr_interfmode_store; 326 - err = device_create_file(dev, &sysfs->attr_interfmode); 284 + err = device_create_file(dev, &dev_attr_interference); 327 285 if (err) 328 286 goto err_remove_sprom; 329 - 330 - sysfs->attr_preamble.attr.name = "shortpreamble"; 331 - sysfs->attr_preamble.attr.owner = THIS_MODULE; 332 - sysfs->attr_preamble.attr.mode = 0600; 333 - sysfs->attr_preamble.show = bcm43xx_attr_preamble_show; 334 - sysfs->attr_preamble.store = bcm43xx_attr_preamble_store; 335 - err = device_create_file(dev, &sysfs->attr_preamble); 287 + err = device_create_file(dev, &dev_attr_shortpreamble); 336 288 if (err) 337 289 goto err_remove_interfmode; 338 290 339 291 out: 340 292 return err; 341 293 err_remove_interfmode: 342 - device_remove_file(dev, &sysfs->attr_interfmode); 294 + device_remove_file(dev, &dev_attr_interference); 343 295 err_remove_sprom: 344 - device_remove_file(dev, &sysfs->attr_sprom); 296 + device_remove_file(dev, &dev_attr_sprom); 345 297 goto out; 346 298 } 347 299 348 300 void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm) 349 301 { 350 302 struct device *dev = &bcm->pci_dev->dev; 351 - struct bcm43xx_sysfs *sysfs = &bcm->sysfs; 352 303 353 - device_remove_file(dev, &sysfs->attr_preamble); 354 - device_remove_file(dev, &sysfs->attr_interfmode); 355 - device_remove_file(dev, &sysfs->attr_sprom); 304 + device_remove_file(dev, &dev_attr_shortpreamble); 305 + device_remove_file(dev, &dev_attr_interference); 306 + device_remove_file(dev, &dev_attr_sprom); 356 307 }
-16
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h
··· 1 1 #ifndef BCM43xx_SYSFS_H_ 2 2 #define BCM43xx_SYSFS_H_ 3 3 4 - #include <linux/device.h> 5 - 6 - 7 - struct bcm43xx_sysfs { 8 - struct device_attribute attr_sprom; 9 - struct device_attribute attr_interfmode; 10 - struct device_attribute attr_preamble; 11 - }; 12 - 13 - #define devattr_to_bcm(attr, attr_name) ({ \ 14 - struct bcm43xx_sysfs *__s; struct bcm43xx_private *__p; \ 15 - __s = container_of((attr), struct bcm43xx_sysfs, attr_name); \ 16 - __p = container_of(__s, struct bcm43xx_private, sysfs); \ 17 - __p; \ 18 - }) 19 - 20 4 struct bcm43xx_private; 21 5 22 6 int bcm43xx_sysfs_register(struct bcm43xx_private *bcm);
+4 -4
drivers/net/wireless/bcm43xx/bcm43xx_wx.c
··· 962 962 { 963 963 .cmd = PRIV_WX_SET_SHORTPREAMBLE, 964 964 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 965 - .name = "set_shortpreambl", 965 + .name = "set_shortpreamb", 966 966 }, 967 967 { 968 968 .cmd = PRIV_WX_GET_SHORTPREAMBLE, 969 969 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 970 - .name = "get_shortpreambl", 970 + .name = "get_shortpreamb", 971 971 }, 972 972 { 973 973 .cmd = PRIV_WX_SET_SWENCRYPTION, 974 974 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 975 - .name = "set_swencryption", 975 + .name = "set_swencrypt", 976 976 }, 977 977 { 978 978 .cmd = PRIV_WX_GET_SWENCRYPTION, 979 979 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 980 - .name = "get_swencryption", 980 + .name = "get_swencrypt", 981 981 }, 982 982 { 983 983 .cmd = PRIV_WX_SPROM_WRITE,
+1 -1
drivers/net/wireless/orinoco.c
··· 390 390 } 391 391 } else { 392 392 struct { 393 - __le16 qual, signal, noise; 393 + __le16 qual, signal, noise, unused; 394 394 } __attribute__ ((packed)) cq; 395 395 396 396 err = HERMES_READ_RECORD(hw, USER_BAP,
+2 -1
include/net/ieee80211softmac.h
··· 267 267 #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 268 268 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 269 269 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 270 + #define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8 270 271 /* keep this updated! */ 271 - #define IEEE80211SOFTMAC_EVENT_LAST 7 272 + #define IEEE80211SOFTMAC_EVENT_LAST 8 272 273 /* 273 274 * If you want to be notified of certain events, you can call 274 275 * ieee80211softmac_notify[_atomic] with
+2 -1
net/core/dev.c
··· 2698 2698 /* If command is `set a parameter', or 2699 2699 * `get the encoding parameters', check if 2700 2700 * the user has the right to do it */ 2701 - if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE) { 2701 + if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE 2702 + || cmd == SIOCGIWENCODEEXT) { 2702 2703 if (!capable(CAP_NET_ADMIN)) 2703 2704 return -EPERM; 2704 2705 }
+8
net/core/wireless.c
··· 1726 1726 if(!IW_IS_GET(request->cmd)) 1727 1727 return -EOPNOTSUPP; 1728 1728 1729 + /* If command is `get the encoding parameters', check if 1730 + * the user has the right to do it */ 1731 + if (request->cmd == SIOCGIWENCODE || 1732 + request->cmd == SIOCGIWENCODEEXT) { 1733 + if (!capable(CAP_NET_ADMIN)) 1734 + return -EPERM; 1735 + } 1736 + 1729 1737 /* Special cases */ 1730 1738 if(request->cmd == SIOCGIWSTATS) 1731 1739 /* Get Wireless Stats */
+1
net/ieee80211/softmac/Kconfig
··· 1 1 config IEEE80211_SOFTMAC 2 2 tristate "Software MAC add-on to the IEEE 802.11 networking stack" 3 3 depends on IEEE80211 && EXPERIMENTAL 4 + select WIRELESS_EXT 4 5 ---help--- 5 6 This option enables the hardware independent software MAC addon 6 7 for the IEEE 802.11 networking stack.
+4 -1
net/ieee80211/softmac/ieee80211softmac_assoc.c
··· 101 101 /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ 102 102 mac->associated = 0; 103 103 mac->associnfo.associating = 0; 104 + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); 104 105 spin_unlock_irqrestore(&mac->lock, flags); 105 106 } 106 107 ··· 374 373 spin_lock_irqsave(&mac->lock, flags); 375 374 mac->associnfo.bssvalid = 0; 376 375 mac->associated = 0; 376 + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); 377 377 schedule_work(&mac->associnfo.work); 378 378 spin_unlock_irqrestore(&mac->lock, flags); 379 379 ··· 393 391 dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); 394 392 return 0; 395 393 } 396 - ieee80211softmac_assoc(mac, network); 394 + schedule_work(&mac->associnfo.work); 395 + 397 396 return 0; 398 397 }
+35 -5
net/ieee80211/softmac/ieee80211softmac_event.c
··· 67 67 "authenticating failed", 68 68 "authenticating timed out", 69 69 "associating failed because no suitable network was found", 70 + "disassociated", 70 71 }; 71 72 72 73 ··· 129 128 ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) 130 129 { 131 130 struct ieee80211softmac_event *eventptr, *tmp; 132 - union iwreq_data wrqu; 133 - char *msg; 131 + struct ieee80211softmac_network *network; 134 132 135 133 if (event >= 0) { 136 - msg = event_descriptions[event]; 137 - wrqu.data.length = strlen(msg); 138 - wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); 134 + union iwreq_data wrqu; 135 + int we_event; 136 + char *msg = NULL; 137 + 138 + switch(event) { 139 + case IEEE80211SOFTMAC_EVENT_ASSOCIATED: 140 + network = (struct ieee80211softmac_network *)event_ctx; 141 + wrqu.data.length = 0; 142 + wrqu.data.flags = 0; 143 + memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); 144 + wrqu.ap_addr.sa_family = ARPHRD_ETHER; 145 + we_event = SIOCGIWAP; 146 + break; 147 + case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: 148 + wrqu.data.length = 0; 149 + wrqu.data.flags = 0; 150 + memset(&wrqu, '\0', sizeof (union iwreq_data)); 151 + wrqu.ap_addr.sa_family = ARPHRD_ETHER; 152 + we_event = SIOCGIWAP; 153 + break; 154 + case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: 155 + wrqu.data.length = 0; 156 + wrqu.data.flags = 0; 157 + memset(&wrqu, '\0', sizeof (union iwreq_data)); 158 + we_event = SIOCGIWSCAN; 159 + break; 160 + default: 161 + msg = event_descriptions[event]; 162 + wrqu.data.length = strlen(msg); 163 + we_event = IWEVCUSTOM; 164 + break; 165 + } 166 + wireless_send_event(mac->dev, we_event, &wrqu, msg); 139 167 } 140 168 141 169 if (!list_empty(&mac->events))
+15 -3
net/ieee80211/softmac/ieee80211softmac_io.c
··· 180 180 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); 181 181 182 182 /* Fill in capability Info */ 183 - (*pkt)->capability = (mac->ieee->iw_mode == IW_MODE_MASTER) || (mac->ieee->iw_mode == IW_MODE_INFRA) ? 184 - cpu_to_le16(WLAN_CAPABILITY_ESS) : 185 - cpu_to_le16(WLAN_CAPABILITY_IBSS); 183 + switch (mac->ieee->iw_mode) { 184 + case IW_MODE_INFRA: 185 + (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_ESS); 186 + break; 187 + case IW_MODE_ADHOC: 188 + (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); 189 + break; 190 + case IW_MODE_AUTO: 191 + (*pkt)->capability = net->capabilities & (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS); 192 + break; 193 + default: 194 + /* bleh. we don't ever go to these modes */ 195 + printk(KERN_ERR PFX "invalid iw_mode!\n"); 196 + break; 197 + } 186 198 /* Need to add this 187 199 (*pkt)->capability |= mac->ieee->short_slot ? 188 200 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0;
+2
net/ieee80211/softmac/ieee80211softmac_scan.c
··· 47 47 sm->scanning = 1; 48 48 spin_unlock_irqrestore(&sm->lock, flags); 49 49 50 + netif_tx_disable(sm->ieee->dev); 50 51 ret = sm->start_scan(sm->dev); 51 52 if (ret) { 52 53 spin_lock_irqsave(&sm->lock, flags); ··· 240 239 if (net) 241 240 sm->set_channel(sm->dev, net->channel); 242 241 } 242 + netif_wake_queue(sm->ieee->dev); 243 243 ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); 244 244 } 245 245 EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished);
+10
net/ieee80211/softmac/ieee80211softmac_wx.c
··· 41 41 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan); 42 42 43 43 44 + /* if we're still scanning, return -EAGAIN so that userspace tools 45 + * can get the complete scan results, otherwise return 0. */ 44 46 int 45 47 ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, 46 48 struct iw_request_info *info, 47 49 union iwreq_data *data, 48 50 char *extra) 49 51 { 52 + unsigned long flags; 50 53 struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); 54 + 55 + spin_lock_irqsave(&sm->lock, flags); 56 + if (sm->scanning) { 57 + spin_unlock_irqrestore(&sm->lock, flags); 58 + return -EAGAIN; 59 + } 60 + spin_unlock_irqrestore(&sm->lock, flags); 51 61 return ieee80211_wx_get_scan(sm->ieee, info, data, extra); 52 62 } 53 63 EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results);