diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-12-21 00:00:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:05 -0500 |
commit | 3eb9b41f2474c53fe469fbe383955d5aae9e76e4 (patch) | |
tree | f7d5934859df6e1642af9ec583c8515e4c45bef2 /drivers | |
parent | 329e2c0067d5a2da88aa844bf57b2aaba9fceb2f (diff) |
airo: last of endianness annotations
sanitize handling of ConfigRid
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/airo.c | 444 |
1 files changed, 218 insertions, 226 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index f4a32a323642..932d6b1c9d0b 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -520,121 +520,124 @@ typedef struct { | |||
520 | } SsidRid; | 520 | } SsidRid; |
521 | 521 | ||
522 | typedef struct { | 522 | typedef struct { |
523 | u16 len; | 523 | __le16 len; |
524 | u16 modulation; | 524 | __le16 modulation; |
525 | #define MOD_DEFAULT 0 | 525 | #define MOD_DEFAULT cpu_to_le16(0) |
526 | #define MOD_CCK 1 | 526 | #define MOD_CCK cpu_to_le16(1) |
527 | #define MOD_MOK 2 | 527 | #define MOD_MOK cpu_to_le16(2) |
528 | } ModulationRid; | 528 | } ModulationRid; |
529 | 529 | ||
530 | typedef struct { | 530 | typedef struct { |
531 | u16 len; /* sizeof(ConfigRid) */ | 531 | __le16 len; /* sizeof(ConfigRid) */ |
532 | u16 opmode; /* operating mode */ | 532 | __le16 opmode; /* operating mode */ |
533 | #define MODE_STA_IBSS 0 | 533 | #define MODE_STA_IBSS cpu_to_le16(0) |
534 | #define MODE_STA_ESS 1 | 534 | #define MODE_STA_ESS cpu_to_le16(1) |
535 | #define MODE_AP 2 | 535 | #define MODE_AP cpu_to_le16(2) |
536 | #define MODE_AP_RPTR 3 | 536 | #define MODE_AP_RPTR cpu_to_le16(3) |
537 | #define MODE_ETHERNET_HOST (0<<8) /* rx payloads converted */ | 537 | #define MODE_CFG_MASK cpu_to_le16(0xff) |
538 | #define MODE_LLC_HOST (1<<8) /* rx payloads left as is */ | 538 | #define MODE_ETHERNET_HOST cpu_to_le16(0<<8) /* rx payloads converted */ |
539 | #define MODE_AIRONET_EXTEND (1<<9) /* enable Aironet extenstions */ | 539 | #define MODE_LLC_HOST cpu_to_le16(1<<8) /* rx payloads left as is */ |
540 | #define MODE_AP_INTERFACE (1<<10) /* enable ap interface extensions */ | 540 | #define MODE_AIRONET_EXTEND cpu_to_le16(1<<9) /* enable Aironet extenstions */ |
541 | #define MODE_ANTENNA_ALIGN (1<<11) /* enable antenna alignment */ | 541 | #define MODE_AP_INTERFACE cpu_to_le16(1<<10) /* enable ap interface extensions */ |
542 | #define MODE_ETHER_LLC (1<<12) /* enable ethernet LLC */ | 542 | #define MODE_ANTENNA_ALIGN cpu_to_le16(1<<11) /* enable antenna alignment */ |
543 | #define MODE_LEAF_NODE (1<<13) /* enable leaf node bridge */ | 543 | #define MODE_ETHER_LLC cpu_to_le16(1<<12) /* enable ethernet LLC */ |
544 | #define MODE_CF_POLLABLE (1<<14) /* enable CF pollable */ | 544 | #define MODE_LEAF_NODE cpu_to_le16(1<<13) /* enable leaf node bridge */ |
545 | #define MODE_MIC (1<<15) /* enable MIC */ | 545 | #define MODE_CF_POLLABLE cpu_to_le16(1<<14) /* enable CF pollable */ |
546 | u16 rmode; /* receive mode */ | 546 | #define MODE_MIC cpu_to_le16(1<<15) /* enable MIC */ |
547 | #define RXMODE_BC_MC_ADDR 0 | 547 | __le16 rmode; /* receive mode */ |
548 | #define RXMODE_BC_ADDR 1 /* ignore multicasts */ | 548 | #define RXMODE_BC_MC_ADDR cpu_to_le16(0) |
549 | #define RXMODE_ADDR 2 /* ignore multicast and broadcast */ | 549 | #define RXMODE_BC_ADDR cpu_to_le16(1) /* ignore multicasts */ |
550 | #define RXMODE_RFMON 3 /* wireless monitor mode */ | 550 | #define RXMODE_ADDR cpu_to_le16(2) /* ignore multicast and broadcast */ |
551 | #define RXMODE_RFMON_ANYBSS 4 | 551 | #define RXMODE_RFMON cpu_to_le16(3) /* wireless monitor mode */ |
552 | #define RXMODE_LANMON 5 /* lan style monitor -- data packets only */ | 552 | #define RXMODE_RFMON_ANYBSS cpu_to_le16(4) |
553 | #define RXMODE_DISABLE_802_3_HEADER (1<<8) /* disables 802.3 header on rx */ | 553 | #define RXMODE_LANMON cpu_to_le16(5) /* lan style monitor -- data packets only */ |
554 | #define RXMODE_NORMALIZED_RSSI (1<<9) /* return normalized RSSI */ | 554 | #define RXMODE_MASK cpu_to_le16(255) |
555 | u16 fragThresh; | 555 | #define RXMODE_DISABLE_802_3_HEADER cpu_to_le16(1<<8) /* disables 802.3 header on rx */ |
556 | u16 rtsThres; | 556 | #define RXMODE_FULL_MASK (RXMODE_MASK | RXMODE_DISABLE_802_3_HEADER) |
557 | #define RXMODE_NORMALIZED_RSSI cpu_to_le16(1<<9) /* return normalized RSSI */ | ||
558 | __le16 fragThresh; | ||
559 | __le16 rtsThres; | ||
557 | u8 macAddr[ETH_ALEN]; | 560 | u8 macAddr[ETH_ALEN]; |
558 | u8 rates[8]; | 561 | u8 rates[8]; |
559 | u16 shortRetryLimit; | 562 | __le16 shortRetryLimit; |
560 | u16 longRetryLimit; | 563 | __le16 longRetryLimit; |
561 | u16 txLifetime; /* in kusec */ | 564 | __le16 txLifetime; /* in kusec */ |
562 | u16 rxLifetime; /* in kusec */ | 565 | __le16 rxLifetime; /* in kusec */ |
563 | u16 stationary; | 566 | __le16 stationary; |
564 | u16 ordering; | 567 | __le16 ordering; |
565 | u16 u16deviceType; /* for overriding device type */ | 568 | __le16 u16deviceType; /* for overriding device type */ |
566 | u16 cfpRate; | 569 | __le16 cfpRate; |
567 | u16 cfpDuration; | 570 | __le16 cfpDuration; |
568 | u16 _reserved1[3]; | 571 | __le16 _reserved1[3]; |
569 | /*---------- Scanning/Associating ----------*/ | 572 | /*---------- Scanning/Associating ----------*/ |
570 | u16 scanMode; | 573 | __le16 scanMode; |
571 | #define SCANMODE_ACTIVE 0 | 574 | #define SCANMODE_ACTIVE cpu_to_le16(0) |
572 | #define SCANMODE_PASSIVE 1 | 575 | #define SCANMODE_PASSIVE cpu_to_le16(1) |
573 | #define SCANMODE_AIROSCAN 2 | 576 | #define SCANMODE_AIROSCAN cpu_to_le16(2) |
574 | u16 probeDelay; /* in kusec */ | 577 | __le16 probeDelay; /* in kusec */ |
575 | u16 probeEnergyTimeout; /* in kusec */ | 578 | __le16 probeEnergyTimeout; /* in kusec */ |
576 | u16 probeResponseTimeout; | 579 | __le16 probeResponseTimeout; |
577 | u16 beaconListenTimeout; | 580 | __le16 beaconListenTimeout; |
578 | u16 joinNetTimeout; | 581 | __le16 joinNetTimeout; |
579 | u16 authTimeout; | 582 | __le16 authTimeout; |
580 | u16 authType; | 583 | __le16 authType; |
581 | #define AUTH_OPEN 0x1 | 584 | #define AUTH_OPEN cpu_to_le16(0x1) |
582 | #define AUTH_ENCRYPT 0x101 | 585 | #define AUTH_ENCRYPT cpu_to_le16(0x101) |
583 | #define AUTH_SHAREDKEY 0x102 | 586 | #define AUTH_SHAREDKEY cpu_to_le16(0x102) |
584 | #define AUTH_ALLOW_UNENCRYPTED 0x200 | 587 | #define AUTH_ALLOW_UNENCRYPTED cpu_to_le16(0x200) |
585 | u16 associationTimeout; | 588 | __le16 associationTimeout; |
586 | u16 specifiedApTimeout; | 589 | __le16 specifiedApTimeout; |
587 | u16 offlineScanInterval; | 590 | __le16 offlineScanInterval; |
588 | u16 offlineScanDuration; | 591 | __le16 offlineScanDuration; |
589 | u16 linkLossDelay; | 592 | __le16 linkLossDelay; |
590 | u16 maxBeaconLostTime; | 593 | __le16 maxBeaconLostTime; |
591 | u16 refreshInterval; | 594 | __le16 refreshInterval; |
592 | #define DISABLE_REFRESH 0xFFFF | 595 | #define DISABLE_REFRESH cpu_to_le16(0xFFFF) |
593 | u16 _reserved1a[1]; | 596 | __le16 _reserved1a[1]; |
594 | /*---------- Power save operation ----------*/ | 597 | /*---------- Power save operation ----------*/ |
595 | u16 powerSaveMode; | 598 | __le16 powerSaveMode; |
596 | #define POWERSAVE_CAM 0 | 599 | #define POWERSAVE_CAM cpu_to_le16(0) |
597 | #define POWERSAVE_PSP 1 | 600 | #define POWERSAVE_PSP cpu_to_le16(1) |
598 | #define POWERSAVE_PSPCAM 2 | 601 | #define POWERSAVE_PSPCAM cpu_to_le16(2) |
599 | u16 sleepForDtims; | 602 | __le16 sleepForDtims; |
600 | u16 listenInterval; | 603 | __le16 listenInterval; |
601 | u16 fastListenInterval; | 604 | __le16 fastListenInterval; |
602 | u16 listenDecay; | 605 | __le16 listenDecay; |
603 | u16 fastListenDelay; | 606 | __le16 fastListenDelay; |
604 | u16 _reserved2[2]; | 607 | __le16 _reserved2[2]; |
605 | /*---------- Ap/Ibss config items ----------*/ | 608 | /*---------- Ap/Ibss config items ----------*/ |
606 | u16 beaconPeriod; | 609 | __le16 beaconPeriod; |
607 | u16 atimDuration; | 610 | __le16 atimDuration; |
608 | u16 hopPeriod; | 611 | __le16 hopPeriod; |
609 | u16 channelSet; | 612 | __le16 channelSet; |
610 | u16 channel; | 613 | __le16 channel; |
611 | u16 dtimPeriod; | 614 | __le16 dtimPeriod; |
612 | u16 bridgeDistance; | 615 | __le16 bridgeDistance; |
613 | u16 radioID; | 616 | __le16 radioID; |
614 | /*---------- Radio configuration ----------*/ | 617 | /*---------- Radio configuration ----------*/ |
615 | u16 radioType; | 618 | __le16 radioType; |
616 | #define RADIOTYPE_DEFAULT 0 | 619 | #define RADIOTYPE_DEFAULT cpu_to_le16(0) |
617 | #define RADIOTYPE_802_11 1 | 620 | #define RADIOTYPE_802_11 cpu_to_le16(1) |
618 | #define RADIOTYPE_LEGACY 2 | 621 | #define RADIOTYPE_LEGACY cpu_to_le16(2) |
619 | u8 rxDiversity; | 622 | u8 rxDiversity; |
620 | u8 txDiversity; | 623 | u8 txDiversity; |
621 | u16 txPower; | 624 | __le16 txPower; |
622 | #define TXPOWER_DEFAULT 0 | 625 | #define TXPOWER_DEFAULT 0 |
623 | u16 rssiThreshold; | 626 | __le16 rssiThreshold; |
624 | #define RSSI_DEFAULT 0 | 627 | #define RSSI_DEFAULT 0 |
625 | u16 modulation; | 628 | __le16 modulation; |
626 | #define PREAMBLE_AUTO 0 | 629 | #define PREAMBLE_AUTO cpu_to_le16(0) |
627 | #define PREAMBLE_LONG 1 | 630 | #define PREAMBLE_LONG cpu_to_le16(1) |
628 | #define PREAMBLE_SHORT 2 | 631 | #define PREAMBLE_SHORT cpu_to_le16(2) |
629 | u16 preamble; | 632 | __le16 preamble; |
630 | u16 homeProduct; | 633 | __le16 homeProduct; |
631 | u16 radioSpecific; | 634 | __le16 radioSpecific; |
632 | /*---------- Aironet Extensions ----------*/ | 635 | /*---------- Aironet Extensions ----------*/ |
633 | u8 nodeName[16]; | 636 | u8 nodeName[16]; |
634 | u16 arlThreshold; | 637 | __le16 arlThreshold; |
635 | u16 arlDecay; | 638 | __le16 arlDecay; |
636 | u16 arlDelay; | 639 | __le16 arlDelay; |
637 | u16 _reserved4[1]; | 640 | __le16 _reserved4[1]; |
638 | /*---------- Aironet Extensions ----------*/ | 641 | /*---------- Aironet Extensions ----------*/ |
639 | u8 magicAction; | 642 | u8 magicAction; |
640 | #define MAGIC_ACTION_STSCHG 1 | 643 | #define MAGIC_ACTION_STSCHG 1 |
@@ -644,7 +647,7 @@ typedef struct { | |||
644 | #define MAGIC_SWITCH_TO_PSP (0<<10) | 647 | #define MAGIC_SWITCH_TO_PSP (0<<10) |
645 | #define MAGIC_STAY_IN_CAM (1<<10) | 648 | #define MAGIC_STAY_IN_CAM (1<<10) |
646 | u8 magicControl; | 649 | u8 magicControl; |
647 | u16 autoWake; | 650 | __le16 autoWake; |
648 | } ConfigRid; | 651 | } ConfigRid; |
649 | 652 | ||
650 | typedef struct { | 653 | typedef struct { |
@@ -1780,9 +1783,9 @@ static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr, int lock) | |||
1780 | return PC4500_writerid(ai, RID_SSID, pssidr, sizeof(*pssidr), lock); | 1783 | return PC4500_writerid(ai, RID_SSID, pssidr, sizeof(*pssidr), lock); |
1781 | } | 1784 | } |
1782 | 1785 | ||
1783 | static int readConfigRid(struct airo_info*ai, int lock) { | 1786 | static int readConfigRid(struct airo_info *ai, int lock) |
1787 | { | ||
1784 | int rc; | 1788 | int rc; |
1785 | u16 *s; | ||
1786 | ConfigRid cfg; | 1789 | ConfigRid cfg; |
1787 | 1790 | ||
1788 | if (ai->config.len) | 1791 | if (ai->config.len) |
@@ -1792,24 +1795,12 @@ static int readConfigRid(struct airo_info*ai, int lock) { | |||
1792 | if (rc != SUCCESS) | 1795 | if (rc != SUCCESS) |
1793 | return rc; | 1796 | return rc; |
1794 | 1797 | ||
1795 | for(s = &cfg.len; s <= &cfg.rtsThres; s++) *s = le16_to_cpu(*s); | ||
1796 | |||
1797 | for(s = &cfg.shortRetryLimit; s <= &cfg.radioType; s++) | ||
1798 | *s = le16_to_cpu(*s); | ||
1799 | |||
1800 | for(s = &cfg.txPower; s <= &cfg.radioSpecific; s++) | ||
1801 | *s = le16_to_cpu(*s); | ||
1802 | |||
1803 | for(s = &cfg.arlThreshold; s <= &cfg._reserved4[0]; s++) | ||
1804 | *s = cpu_to_le16(*s); | ||
1805 | |||
1806 | for(s = &cfg.autoWake; s <= &cfg.autoWake; s++) | ||
1807 | *s = cpu_to_le16(*s); | ||
1808 | |||
1809 | ai->config = cfg; | 1798 | ai->config = cfg; |
1810 | return SUCCESS; | 1799 | return SUCCESS; |
1811 | } | 1800 | } |
1812 | static inline void checkThrottle(struct airo_info *ai) { | 1801 | |
1802 | static inline void checkThrottle(struct airo_info *ai) | ||
1803 | { | ||
1813 | int i; | 1804 | int i; |
1814 | /* Old hardware had a limit on encryption speed */ | 1805 | /* Old hardware had a limit on encryption speed */ |
1815 | if (ai->config.authType != AUTH_OPEN && maxencrypt) { | 1806 | if (ai->config.authType != AUTH_OPEN && maxencrypt) { |
@@ -1820,8 +1811,9 @@ static inline void checkThrottle(struct airo_info *ai) { | |||
1820 | } | 1811 | } |
1821 | } | 1812 | } |
1822 | } | 1813 | } |
1823 | static int writeConfigRid(struct airo_info*ai, int lock) { | 1814 | |
1824 | u16 *s; | 1815 | static int writeConfigRid(struct airo_info *ai, int lock) |
1816 | { | ||
1825 | ConfigRid cfgr; | 1817 | ConfigRid cfgr; |
1826 | 1818 | ||
1827 | if (!test_bit (FLAG_COMMIT, &ai->flags)) | 1819 | if (!test_bit (FLAG_COMMIT, &ai->flags)) |
@@ -1832,25 +1824,11 @@ static int writeConfigRid(struct airo_info*ai, int lock) { | |||
1832 | checkThrottle(ai); | 1824 | checkThrottle(ai); |
1833 | cfgr = ai->config; | 1825 | cfgr = ai->config; |
1834 | 1826 | ||
1835 | if ((cfgr.opmode & 0xFF) == MODE_STA_IBSS) | 1827 | if ((cfgr.opmode & MODE_CFG_MASK) == MODE_STA_IBSS) |
1836 | set_bit(FLAG_ADHOC, &ai->flags); | 1828 | set_bit(FLAG_ADHOC, &ai->flags); |
1837 | else | 1829 | else |
1838 | clear_bit(FLAG_ADHOC, &ai->flags); | 1830 | clear_bit(FLAG_ADHOC, &ai->flags); |
1839 | 1831 | ||
1840 | for(s = &cfgr.len; s <= &cfgr.rtsThres; s++) *s = cpu_to_le16(*s); | ||
1841 | |||
1842 | for(s = &cfgr.shortRetryLimit; s <= &cfgr.radioType; s++) | ||
1843 | *s = cpu_to_le16(*s); | ||
1844 | |||
1845 | for(s = &cfgr.txPower; s <= &cfgr.radioSpecific; s++) | ||
1846 | *s = cpu_to_le16(*s); | ||
1847 | |||
1848 | for(s = &cfgr.arlThreshold; s <= &cfgr._reserved4[0]; s++) | ||
1849 | *s = cpu_to_le16(*s); | ||
1850 | |||
1851 | for(s = &cfgr.autoWake; s <= &cfgr.autoWake; s++) | ||
1852 | *s = cpu_to_le16(*s); | ||
1853 | |||
1854 | return PC4500_writerid( ai, RID_CONFIG, &cfgr, sizeof(cfgr), lock); | 1832 | return PC4500_writerid( ai, RID_CONFIG, &cfgr, sizeof(cfgr), lock); |
1855 | } | 1833 | } |
1856 | 1834 | ||
@@ -4788,7 +4766,14 @@ static int airo_config_commit(struct net_device *dev, | |||
4788 | struct iw_request_info *info, void *zwrq, | 4766 | struct iw_request_info *info, void *zwrq, |
4789 | char *extra); | 4767 | char *extra); |
4790 | 4768 | ||
4791 | static void proc_config_on_close( struct inode *inode, struct file *file ) { | 4769 | static inline int sniffing_mode(struct airo_info *ai) |
4770 | { | ||
4771 | return le16_to_cpu(ai->config.rmode & RXMODE_MASK) >= | ||
4772 | le16_to_cpu(RXMODE_RFMON); | ||
4773 | } | ||
4774 | |||
4775 | static void proc_config_on_close(struct inode *inode, struct file *file) | ||
4776 | { | ||
4792 | struct proc_data *data = file->private_data; | 4777 | struct proc_data *data = file->private_data; |
4793 | struct proc_dir_entry *dp = PDE(inode); | 4778 | struct proc_dir_entry *dp = PDE(inode); |
4794 | struct net_device *dev = dp->data; | 4779 | struct net_device *dev = dp->data; |
@@ -4805,16 +4790,16 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4805 | /*** Mode processing */ | 4790 | /*** Mode processing */ |
4806 | if ( !strncmp( line, "Mode: ", 6 ) ) { | 4791 | if ( !strncmp( line, "Mode: ", 6 ) ) { |
4807 | line += 6; | 4792 | line += 6; |
4808 | if ((ai->config.rmode & 0xff) >= RXMODE_RFMON) | 4793 | if (sniffing_mode(ai)) |
4809 | set_bit (FLAG_RESET, &ai->flags); | 4794 | set_bit (FLAG_RESET, &ai->flags); |
4810 | ai->config.rmode &= 0xfe00; | 4795 | ai->config.rmode &= ~RXMODE_FULL_MASK; |
4811 | clear_bit (FLAG_802_11, &ai->flags); | 4796 | clear_bit (FLAG_802_11, &ai->flags); |
4812 | ai->config.opmode &= 0xFF00; | 4797 | ai->config.opmode &= ~MODE_CFG_MASK; |
4813 | ai->config.scanMode = SCANMODE_ACTIVE; | 4798 | ai->config.scanMode = SCANMODE_ACTIVE; |
4814 | if ( line[0] == 'a' ) { | 4799 | if ( line[0] == 'a' ) { |
4815 | ai->config.opmode |= 0; | 4800 | ai->config.opmode |= MODE_STA_IBSS; |
4816 | } else { | 4801 | } else { |
4817 | ai->config.opmode |= 1; | 4802 | ai->config.opmode |= MODE_STA_ESS; |
4818 | if ( line[0] == 'r' ) { | 4803 | if ( line[0] == 'r' ) { |
4819 | ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; | 4804 | ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; |
4820 | ai->config.scanMode = SCANMODE_PASSIVE; | 4805 | ai->config.scanMode = SCANMODE_PASSIVE; |
@@ -4880,7 +4865,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4880 | line += 9; | 4865 | line += 9; |
4881 | v = get_dec_u16(line, &i, i+3); | 4866 | v = get_dec_u16(line, &i, i+3); |
4882 | if ( v != -1 ) { | 4867 | if ( v != -1 ) { |
4883 | ai->config.channelSet = (u16)v; | 4868 | ai->config.channelSet = cpu_to_le16(v); |
4884 | set_bit (FLAG_COMMIT, &ai->flags); | 4869 | set_bit (FLAG_COMMIT, &ai->flags); |
4885 | } | 4870 | } |
4886 | } else if ( !strncmp( line, "XmitPower: ", 11 ) ) { | 4871 | } else if ( !strncmp( line, "XmitPower: ", 11 ) ) { |
@@ -4888,20 +4873,20 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4888 | line += 11; | 4873 | line += 11; |
4889 | v = get_dec_u16(line, &i, i+3); | 4874 | v = get_dec_u16(line, &i, i+3); |
4890 | if ( v != -1 ) { | 4875 | if ( v != -1 ) { |
4891 | ai->config.txPower = (u16)v; | 4876 | ai->config.txPower = cpu_to_le16(v); |
4892 | set_bit (FLAG_COMMIT, &ai->flags); | 4877 | set_bit (FLAG_COMMIT, &ai->flags); |
4893 | } | 4878 | } |
4894 | } else if ( !strncmp( line, "WEP: ", 5 ) ) { | 4879 | } else if ( !strncmp( line, "WEP: ", 5 ) ) { |
4895 | line += 5; | 4880 | line += 5; |
4896 | switch( line[0] ) { | 4881 | switch( line[0] ) { |
4897 | case 's': | 4882 | case 's': |
4898 | ai->config.authType = (u16)AUTH_SHAREDKEY; | 4883 | ai->config.authType = AUTH_SHAREDKEY; |
4899 | break; | 4884 | break; |
4900 | case 'e': | 4885 | case 'e': |
4901 | ai->config.authType = (u16)AUTH_ENCRYPT; | 4886 | ai->config.authType = AUTH_ENCRYPT; |
4902 | break; | 4887 | break; |
4903 | default: | 4888 | default: |
4904 | ai->config.authType = (u16)AUTH_OPEN; | 4889 | ai->config.authType = AUTH_OPEN; |
4905 | break; | 4890 | break; |
4906 | } | 4891 | } |
4907 | set_bit (FLAG_COMMIT, &ai->flags); | 4892 | set_bit (FLAG_COMMIT, &ai->flags); |
@@ -4911,7 +4896,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4911 | line += 16; | 4896 | line += 16; |
4912 | v = get_dec_u16(line, &i, 3); | 4897 | v = get_dec_u16(line, &i, 3); |
4913 | v = (v<0) ? 0 : ((v>255) ? 255 : v); | 4898 | v = (v<0) ? 0 : ((v>255) ? 255 : v); |
4914 | ai->config.longRetryLimit = (u16)v; | 4899 | ai->config.longRetryLimit = cpu_to_le16(v); |
4915 | set_bit (FLAG_COMMIT, &ai->flags); | 4900 | set_bit (FLAG_COMMIT, &ai->flags); |
4916 | } else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) { | 4901 | } else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) { |
4917 | int v, i = 0; | 4902 | int v, i = 0; |
@@ -4919,7 +4904,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4919 | line += 17; | 4904 | line += 17; |
4920 | v = get_dec_u16(line, &i, 3); | 4905 | v = get_dec_u16(line, &i, 3); |
4921 | v = (v<0) ? 0 : ((v>255) ? 255 : v); | 4906 | v = (v<0) ? 0 : ((v>255) ? 255 : v); |
4922 | ai->config.shortRetryLimit = (u16)v; | 4907 | ai->config.shortRetryLimit = cpu_to_le16(v); |
4923 | set_bit (FLAG_COMMIT, &ai->flags); | 4908 | set_bit (FLAG_COMMIT, &ai->flags); |
4924 | } else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) { | 4909 | } else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) { |
4925 | int v, i = 0; | 4910 | int v, i = 0; |
@@ -4927,7 +4912,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4927 | line += 14; | 4912 | line += 14; |
4928 | v = get_dec_u16(line, &i, 4); | 4913 | v = get_dec_u16(line, &i, 4); |
4929 | v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); | 4914 | v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); |
4930 | ai->config.rtsThres = (u16)v; | 4915 | ai->config.rtsThres = cpu_to_le16(v); |
4931 | set_bit (FLAG_COMMIT, &ai->flags); | 4916 | set_bit (FLAG_COMMIT, &ai->flags); |
4932 | } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { | 4917 | } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { |
4933 | int v, i = 0; | 4918 | int v, i = 0; |
@@ -4935,7 +4920,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4935 | line += 16; | 4920 | line += 16; |
4936 | v = get_dec_u16(line, &i, 5); | 4921 | v = get_dec_u16(line, &i, 5); |
4937 | v = (v<0) ? 0 : v; | 4922 | v = (v<0) ? 0 : v; |
4938 | ai->config.txLifetime = (u16)v; | 4923 | ai->config.txLifetime = cpu_to_le16(v); |
4939 | set_bit (FLAG_COMMIT, &ai->flags); | 4924 | set_bit (FLAG_COMMIT, &ai->flags); |
4940 | } else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) { | 4925 | } else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) { |
4941 | int v, i = 0; | 4926 | int v, i = 0; |
@@ -4943,7 +4928,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4943 | line += 16; | 4928 | line += 16; |
4944 | v = get_dec_u16(line, &i, 5); | 4929 | v = get_dec_u16(line, &i, 5); |
4945 | v = (v<0) ? 0 : v; | 4930 | v = (v<0) ? 0 : v; |
4946 | ai->config.rxLifetime = (u16)v; | 4931 | ai->config.rxLifetime = cpu_to_le16(v); |
4947 | set_bit (FLAG_COMMIT, &ai->flags); | 4932 | set_bit (FLAG_COMMIT, &ai->flags); |
4948 | } else if ( !strncmp( line, "TXDiversity: ", 13 ) ) { | 4933 | } else if ( !strncmp( line, "TXDiversity: ", 13 ) ) { |
4949 | ai->config.txDiversity = | 4934 | ai->config.txDiversity = |
@@ -4962,7 +4947,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4962 | v = get_dec_u16(line, &i, 4); | 4947 | v = get_dec_u16(line, &i, 4); |
4963 | v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); | 4948 | v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); |
4964 | v = v & 0xfffe; /* Make sure its even */ | 4949 | v = v & 0xfffe; /* Make sure its even */ |
4965 | ai->config.fragThresh = (u16)v; | 4950 | ai->config.fragThresh = cpu_to_le16(v); |
4966 | set_bit (FLAG_COMMIT, &ai->flags); | 4951 | set_bit (FLAG_COMMIT, &ai->flags); |
4967 | } else if (!strncmp(line, "Modulation: ", 12)) { | 4952 | } else if (!strncmp(line, "Modulation: ", 12)) { |
4968 | line += 12; | 4953 | line += 12; |
@@ -4989,8 +4974,9 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) { | |||
4989 | airo_config_commit(dev, NULL, NULL, NULL); | 4974 | airo_config_commit(dev, NULL, NULL, NULL); |
4990 | } | 4975 | } |
4991 | 4976 | ||
4992 | static char *get_rmode(u16 mode) { | 4977 | static char *get_rmode(__le16 mode) |
4993 | switch(mode&0xff) { | 4978 | { |
4979 | switch(mode & RXMODE_MASK) { | ||
4994 | case RXMODE_RFMON: return "rfmon"; | 4980 | case RXMODE_RFMON: return "rfmon"; |
4995 | case RXMODE_RFMON_ANYBSS: return "yna (any) bss rfmon"; | 4981 | case RXMODE_RFMON_ANYBSS: return "yna (any) bss rfmon"; |
4996 | case RXMODE_LANMON: return "lanmon"; | 4982 | case RXMODE_LANMON: return "lanmon"; |
@@ -4998,12 +4984,14 @@ static char *get_rmode(u16 mode) { | |||
4998 | return "ESS"; | 4984 | return "ESS"; |
4999 | } | 4985 | } |
5000 | 4986 | ||
5001 | static int proc_config_open( struct inode *inode, struct file *file ) { | 4987 | static int proc_config_open(struct inode *inode, struct file *file) |
4988 | { | ||
5002 | struct proc_data *data; | 4989 | struct proc_data *data; |
5003 | struct proc_dir_entry *dp = PDE(inode); | 4990 | struct proc_dir_entry *dp = PDE(inode); |
5004 | struct net_device *dev = dp->data; | 4991 | struct net_device *dev = dp->data; |
5005 | struct airo_info *ai = dev->priv; | 4992 | struct airo_info *ai = dev->priv; |
5006 | int i; | 4993 | int i; |
4994 | __le16 mode; | ||
5007 | 4995 | ||
5008 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) | 4996 | if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) |
5009 | return -ENOMEM; | 4997 | return -ENOMEM; |
@@ -5022,6 +5010,7 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
5022 | 5010 | ||
5023 | readConfigRid(ai, 1); | 5011 | readConfigRid(ai, 1); |
5024 | 5012 | ||
5013 | mode = ai->config.opmode & MODE_CFG_MASK; | ||
5025 | i = sprintf( data->rbuffer, | 5014 | i = sprintf( data->rbuffer, |
5026 | "Mode: %s\n" | 5015 | "Mode: %s\n" |
5027 | "Radio: %s\n" | 5016 | "Radio: %s\n" |
@@ -5030,15 +5019,16 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
5030 | "DataRates: %d %d %d %d %d %d %d %d\n" | 5019 | "DataRates: %d %d %d %d %d %d %d %d\n" |
5031 | "Channel: %d\n" | 5020 | "Channel: %d\n" |
5032 | "XmitPower: %d\n", | 5021 | "XmitPower: %d\n", |
5033 | (ai->config.opmode & 0xFF) == 0 ? "adhoc" : | 5022 | mode == MODE_STA_IBSS ? "adhoc" : |
5034 | (ai->config.opmode & 0xFF) == 1 ? get_rmode(ai->config.rmode): | 5023 | mode == MODE_STA_ESS ? get_rmode(ai->config.rmode): |
5035 | (ai->config.opmode & 0xFF) == 2 ? "AP" : | 5024 | mode == MODE_AP ? "AP" : |
5036 | (ai->config.opmode & 0xFF) == 3 ? "AP RPTR" : "Error", | 5025 | mode == MODE_AP_RPTR ? "AP RPTR" : "Error", |
5037 | test_bit(FLAG_RADIO_OFF, &ai->flags) ? "off" : "on", | 5026 | test_bit(FLAG_RADIO_OFF, &ai->flags) ? "off" : "on", |
5038 | ai->config.nodeName, | 5027 | ai->config.nodeName, |
5039 | ai->config.powerSaveMode == 0 ? "CAM" : | 5028 | ai->config.powerSaveMode == POWERSAVE_CAM ? "CAM" : |
5040 | ai->config.powerSaveMode == 1 ? "PSP" : | 5029 | ai->config.powerSaveMode == POWERSAVE_PSP ? "PSP" : |
5041 | ai->config.powerSaveMode == 2 ? "PSPCAM" : "Error", | 5030 | ai->config.powerSaveMode == POWERSAVE_PSPCAM ? "PSPCAM" : |
5031 | "Error", | ||
5042 | (int)ai->config.rates[0], | 5032 | (int)ai->config.rates[0], |
5043 | (int)ai->config.rates[1], | 5033 | (int)ai->config.rates[1], |
5044 | (int)ai->config.rates[2], | 5034 | (int)ai->config.rates[2], |
@@ -5047,8 +5037,8 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
5047 | (int)ai->config.rates[5], | 5037 | (int)ai->config.rates[5], |
5048 | (int)ai->config.rates[6], | 5038 | (int)ai->config.rates[6], |
5049 | (int)ai->config.rates[7], | 5039 | (int)ai->config.rates[7], |
5050 | (int)ai->config.channelSet, | 5040 | le16_to_cpu(ai->config.channelSet), |
5051 | (int)ai->config.txPower | 5041 | le16_to_cpu(ai->config.txPower) |
5052 | ); | 5042 | ); |
5053 | sprintf( data->rbuffer + i, | 5043 | sprintf( data->rbuffer + i, |
5054 | "LongRetryLimit: %d\n" | 5044 | "LongRetryLimit: %d\n" |
@@ -5062,19 +5052,19 @@ static int proc_config_open( struct inode *inode, struct file *file ) { | |||
5062 | "WEP: %s\n" | 5052 | "WEP: %s\n" |
5063 | "Modulation: %s\n" | 5053 | "Modulation: %s\n" |
5064 | "Preamble: %s\n", | 5054 | "Preamble: %s\n", |
5065 | (int)ai->config.longRetryLimit, | 5055 | le16_to_cpu(ai->config.longRetryLimit), |
5066 | (int)ai->config.shortRetryLimit, | 5056 | le16_to_cpu(ai->config.shortRetryLimit), |
5067 | (int)ai->config.rtsThres, | 5057 | le16_to_cpu(ai->config.rtsThres), |
5068 | (int)ai->config.txLifetime, | 5058 | le16_to_cpu(ai->config.txLifetime), |
5069 | (int)ai->config.rxLifetime, | 5059 | le16_to_cpu(ai->config.rxLifetime), |
5070 | ai->config.txDiversity == 1 ? "left" : | 5060 | ai->config.txDiversity == 1 ? "left" : |
5071 | ai->config.txDiversity == 2 ? "right" : "both", | 5061 | ai->config.txDiversity == 2 ? "right" : "both", |
5072 | ai->config.rxDiversity == 1 ? "left" : | 5062 | ai->config.rxDiversity == 1 ? "left" : |
5073 | ai->config.rxDiversity == 2 ? "right" : "both", | 5063 | ai->config.rxDiversity == 2 ? "right" : "both", |
5074 | (int)ai->config.fragThresh, | 5064 | le16_to_cpu(ai->config.fragThresh), |
5075 | ai->config.authType == AUTH_ENCRYPT ? "encrypt" : | 5065 | ai->config.authType == AUTH_ENCRYPT ? "encrypt" : |
5076 | ai->config.authType == AUTH_SHAREDKEY ? "shared" : "open", | 5066 | ai->config.authType == AUTH_SHAREDKEY ? "shared" : "open", |
5077 | ai->config.modulation == 0 ? "default" : | 5067 | ai->config.modulation == MOD_DEFAULT ? "default" : |
5078 | ai->config.modulation == MOD_CCK ? "cck" : | 5068 | ai->config.modulation == MOD_CCK ? "cck" : |
5079 | ai->config.modulation == MOD_MOK ? "mok" : "error", | 5069 | ai->config.modulation == MOD_MOK ? "mok" : "error", |
5080 | ai->config.preamble == PREAMBLE_AUTO ? "auto" : | 5070 | ai->config.preamble == PREAMBLE_AUTO ? "auto" : |
@@ -5800,7 +5790,7 @@ static int airo_set_freq(struct net_device *dev, | |||
5800 | } else { | 5790 | } else { |
5801 | readConfigRid(local, 1); | 5791 | readConfigRid(local, 1); |
5802 | /* Yes ! We can set it !!! */ | 5792 | /* Yes ! We can set it !!! */ |
5803 | local->config.channelSet = (u16) channel; | 5793 | local->config.channelSet = cpu_to_le16(channel); |
5804 | set_bit (FLAG_COMMIT, &local->flags); | 5794 | set_bit (FLAG_COMMIT, &local->flags); |
5805 | } | 5795 | } |
5806 | } | 5796 | } |
@@ -5821,8 +5811,8 @@ static int airo_get_freq(struct net_device *dev, | |||
5821 | int ch; | 5811 | int ch; |
5822 | 5812 | ||
5823 | readConfigRid(local, 1); | 5813 | readConfigRid(local, 1); |
5824 | if ((local->config.opmode & 0xFF) == MODE_STA_ESS) | 5814 | if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS) |
5825 | status_rid.channel = cpu_to_le16(local->config.channelSet); | 5815 | status_rid.channel = local->config.channelSet; |
5826 | else | 5816 | else |
5827 | readStatusRid(local, &status_rid, 1); | 5817 | readStatusRid(local, &status_rid, 1); |
5828 | 5818 | ||
@@ -6122,7 +6112,7 @@ static int airo_set_rts(struct net_device *dev, | |||
6122 | return -EINVAL; | 6112 | return -EINVAL; |
6123 | } | 6113 | } |
6124 | readConfigRid(local, 1); | 6114 | readConfigRid(local, 1); |
6125 | local->config.rtsThres = rthr; | 6115 | local->config.rtsThres = cpu_to_le16(rthr); |
6126 | set_bit (FLAG_COMMIT, &local->flags); | 6116 | set_bit (FLAG_COMMIT, &local->flags); |
6127 | 6117 | ||
6128 | return -EINPROGRESS; /* Call commit handler */ | 6118 | return -EINPROGRESS; /* Call commit handler */ |
@@ -6140,7 +6130,7 @@ static int airo_get_rts(struct net_device *dev, | |||
6140 | struct airo_info *local = dev->priv; | 6130 | struct airo_info *local = dev->priv; |
6141 | 6131 | ||
6142 | readConfigRid(local, 1); | 6132 | readConfigRid(local, 1); |
6143 | vwrq->value = local->config.rtsThres; | 6133 | vwrq->value = le16_to_cpu(local->config.rtsThres); |
6144 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); | 6134 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); |
6145 | vwrq->fixed = 1; | 6135 | vwrq->fixed = 1; |
6146 | 6136 | ||
@@ -6166,7 +6156,7 @@ static int airo_set_frag(struct net_device *dev, | |||
6166 | } | 6156 | } |
6167 | fthr &= ~0x1; /* Get an even value - is it really needed ??? */ | 6157 | fthr &= ~0x1; /* Get an even value - is it really needed ??? */ |
6168 | readConfigRid(local, 1); | 6158 | readConfigRid(local, 1); |
6169 | local->config.fragThresh = (u16)fthr; | 6159 | local->config.fragThresh = cpu_to_le16(fthr); |
6170 | set_bit (FLAG_COMMIT, &local->flags); | 6160 | set_bit (FLAG_COMMIT, &local->flags); |
6171 | 6161 | ||
6172 | return -EINPROGRESS; /* Call commit handler */ | 6162 | return -EINPROGRESS; /* Call commit handler */ |
@@ -6184,7 +6174,7 @@ static int airo_get_frag(struct net_device *dev, | |||
6184 | struct airo_info *local = dev->priv; | 6174 | struct airo_info *local = dev->priv; |
6185 | 6175 | ||
6186 | readConfigRid(local, 1); | 6176 | readConfigRid(local, 1); |
6187 | vwrq->value = local->config.fragThresh; | 6177 | vwrq->value = le16_to_cpu(local->config.fragThresh); |
6188 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); | 6178 | vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); |
6189 | vwrq->fixed = 1; | 6179 | vwrq->fixed = 1; |
6190 | 6180 | ||
@@ -6204,42 +6194,42 @@ static int airo_set_mode(struct net_device *dev, | |||
6204 | int reset = 0; | 6194 | int reset = 0; |
6205 | 6195 | ||
6206 | readConfigRid(local, 1); | 6196 | readConfigRid(local, 1); |
6207 | if ((local->config.rmode & 0xff) >= RXMODE_RFMON) | 6197 | if (sniffing_mode(local)) |
6208 | reset = 1; | 6198 | reset = 1; |
6209 | 6199 | ||
6210 | switch(*uwrq) { | 6200 | switch(*uwrq) { |
6211 | case IW_MODE_ADHOC: | 6201 | case IW_MODE_ADHOC: |
6212 | local->config.opmode &= 0xFF00; | 6202 | local->config.opmode &= ~MODE_CFG_MASK; |
6213 | local->config.opmode |= MODE_STA_IBSS; | 6203 | local->config.opmode |= MODE_STA_IBSS; |
6214 | local->config.rmode &= 0xfe00; | 6204 | local->config.rmode &= ~RXMODE_FULL_MASK; |
6215 | local->config.scanMode = SCANMODE_ACTIVE; | 6205 | local->config.scanMode = SCANMODE_ACTIVE; |
6216 | clear_bit (FLAG_802_11, &local->flags); | 6206 | clear_bit (FLAG_802_11, &local->flags); |
6217 | break; | 6207 | break; |
6218 | case IW_MODE_INFRA: | 6208 | case IW_MODE_INFRA: |
6219 | local->config.opmode &= 0xFF00; | 6209 | local->config.opmode &= ~MODE_CFG_MASK; |
6220 | local->config.opmode |= MODE_STA_ESS; | 6210 | local->config.opmode |= MODE_STA_ESS; |
6221 | local->config.rmode &= 0xfe00; | 6211 | local->config.rmode &= ~RXMODE_FULL_MASK; |
6222 | local->config.scanMode = SCANMODE_ACTIVE; | 6212 | local->config.scanMode = SCANMODE_ACTIVE; |
6223 | clear_bit (FLAG_802_11, &local->flags); | 6213 | clear_bit (FLAG_802_11, &local->flags); |
6224 | break; | 6214 | break; |
6225 | case IW_MODE_MASTER: | 6215 | case IW_MODE_MASTER: |
6226 | local->config.opmode &= 0xFF00; | 6216 | local->config.opmode &= ~MODE_CFG_MASK; |
6227 | local->config.opmode |= MODE_AP; | 6217 | local->config.opmode |= MODE_AP; |
6228 | local->config.rmode &= 0xfe00; | 6218 | local->config.rmode &= ~RXMODE_FULL_MASK; |
6229 | local->config.scanMode = SCANMODE_ACTIVE; | 6219 | local->config.scanMode = SCANMODE_ACTIVE; |
6230 | clear_bit (FLAG_802_11, &local->flags); | 6220 | clear_bit (FLAG_802_11, &local->flags); |
6231 | break; | 6221 | break; |
6232 | case IW_MODE_REPEAT: | 6222 | case IW_MODE_REPEAT: |
6233 | local->config.opmode &= 0xFF00; | 6223 | local->config.opmode &= ~MODE_CFG_MASK; |
6234 | local->config.opmode |= MODE_AP_RPTR; | 6224 | local->config.opmode |= MODE_AP_RPTR; |
6235 | local->config.rmode &= 0xfe00; | 6225 | local->config.rmode &= ~RXMODE_FULL_MASK; |
6236 | local->config.scanMode = SCANMODE_ACTIVE; | 6226 | local->config.scanMode = SCANMODE_ACTIVE; |
6237 | clear_bit (FLAG_802_11, &local->flags); | 6227 | clear_bit (FLAG_802_11, &local->flags); |
6238 | break; | 6228 | break; |
6239 | case IW_MODE_MONITOR: | 6229 | case IW_MODE_MONITOR: |
6240 | local->config.opmode &= 0xFF00; | 6230 | local->config.opmode &= ~MODE_CFG_MASK; |
6241 | local->config.opmode |= MODE_STA_ESS; | 6231 | local->config.opmode |= MODE_STA_ESS; |
6242 | local->config.rmode &= 0xfe00; | 6232 | local->config.rmode &= ~RXMODE_FULL_MASK; |
6243 | local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; | 6233 | local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; |
6244 | local->config.scanMode = SCANMODE_PASSIVE; | 6234 | local->config.scanMode = SCANMODE_PASSIVE; |
6245 | set_bit (FLAG_802_11, &local->flags); | 6235 | set_bit (FLAG_802_11, &local->flags); |
@@ -6267,7 +6257,7 @@ static int airo_get_mode(struct net_device *dev, | |||
6267 | 6257 | ||
6268 | readConfigRid(local, 1); | 6258 | readConfigRid(local, 1); |
6269 | /* If not managed, assume it's ad-hoc */ | 6259 | /* If not managed, assume it's ad-hoc */ |
6270 | switch (local->config.opmode & 0xFF) { | 6260 | switch (local->config.opmode & MODE_CFG_MASK) { |
6271 | case MODE_STA_ESS: | 6261 | case MODE_STA_ESS: |
6272 | *uwrq = IW_MODE_INFRA; | 6262 | *uwrq = IW_MODE_INFRA; |
6273 | break; | 6263 | break; |
@@ -6303,7 +6293,7 @@ static int airo_set_encode(struct net_device *dev, | |||
6303 | struct airo_info *local = dev->priv; | 6293 | struct airo_info *local = dev->priv; |
6304 | CapabilityRid cap_rid; /* Card capability info */ | 6294 | CapabilityRid cap_rid; /* Card capability info */ |
6305 | int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 ); | 6295 | int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 ); |
6306 | u16 currentAuthType = local->config.authType; | 6296 | __le16 currentAuthType = local->config.authType; |
6307 | 6297 | ||
6308 | /* Is WEP supported ? */ | 6298 | /* Is WEP supported ? */ |
6309 | readCapabilityRid(local, &cap_rid, 1); | 6299 | readCapabilityRid(local, &cap_rid, 1); |
@@ -6440,7 +6430,7 @@ static int airo_set_encodeext(struct net_device *dev, | |||
6440 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 6430 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
6441 | CapabilityRid cap_rid; /* Card capability info */ | 6431 | CapabilityRid cap_rid; /* Card capability info */ |
6442 | int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); | 6432 | int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); |
6443 | u16 currentAuthType = local->config.authType; | 6433 | __le16 currentAuthType = local->config.authType; |
6444 | int idx, key_len, alg = ext->alg, set_key = 1; | 6434 | int idx, key_len, alg = ext->alg, set_key = 1; |
6445 | wep_key_t key; | 6435 | wep_key_t key; |
6446 | 6436 | ||
@@ -6586,7 +6576,7 @@ static int airo_set_auth(struct net_device *dev, | |||
6586 | { | 6576 | { |
6587 | struct airo_info *local = dev->priv; | 6577 | struct airo_info *local = dev->priv; |
6588 | struct iw_param *param = &wrqu->param; | 6578 | struct iw_param *param = &wrqu->param; |
6589 | u16 currentAuthType = local->config.authType; | 6579 | __le16 currentAuthType = local->config.authType; |
6590 | 6580 | ||
6591 | switch (param->flags & IW_AUTH_INDEX) { | 6581 | switch (param->flags & IW_AUTH_INDEX) { |
6592 | case IW_AUTH_WPA_VERSION: | 6582 | case IW_AUTH_WPA_VERSION: |
@@ -6654,7 +6644,7 @@ static int airo_get_auth(struct net_device *dev, | |||
6654 | { | 6644 | { |
6655 | struct airo_info *local = dev->priv; | 6645 | struct airo_info *local = dev->priv; |
6656 | struct iw_param *param = &wrqu->param; | 6646 | struct iw_param *param = &wrqu->param; |
6657 | u16 currentAuthType = local->config.authType; | 6647 | __le16 currentAuthType = local->config.authType; |
6658 | 6648 | ||
6659 | switch (param->flags & IW_AUTH_INDEX) { | 6649 | switch (param->flags & IW_AUTH_INDEX) { |
6660 | case IW_AUTH_DROP_UNENCRYPTED: | 6650 | case IW_AUTH_DROP_UNENCRYPTED: |
@@ -6705,6 +6695,7 @@ static int airo_set_txpow(struct net_device *dev, | |||
6705 | CapabilityRid cap_rid; /* Card capability info */ | 6695 | CapabilityRid cap_rid; /* Card capability info */ |
6706 | int i; | 6696 | int i; |
6707 | int rc = -EINVAL; | 6697 | int rc = -EINVAL; |
6698 | __le16 v = cpu_to_le16(vwrq->value); | ||
6708 | 6699 | ||
6709 | readCapabilityRid(local, &cap_rid, 1); | 6700 | readCapabilityRid(local, &cap_rid, 1); |
6710 | 6701 | ||
@@ -6718,9 +6709,9 @@ static int airo_set_txpow(struct net_device *dev, | |||
6718 | } | 6709 | } |
6719 | clear_bit (FLAG_RADIO_OFF, &local->flags); | 6710 | clear_bit (FLAG_RADIO_OFF, &local->flags); |
6720 | for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++) | 6711 | for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++) |
6721 | if (vwrq->value == le16_to_cpu(cap_rid.txPowerLevels[i])) { | 6712 | if (v == cap_rid.txPowerLevels[i]) { |
6722 | readConfigRid(local, 1); | 6713 | readConfigRid(local, 1); |
6723 | local->config.txPower = vwrq->value; | 6714 | local->config.txPower = v; |
6724 | set_bit (FLAG_COMMIT, &local->flags); | 6715 | set_bit (FLAG_COMMIT, &local->flags); |
6725 | rc = -EINPROGRESS; /* Call commit handler */ | 6716 | rc = -EINPROGRESS; /* Call commit handler */ |
6726 | break; | 6717 | break; |
@@ -6740,7 +6731,7 @@ static int airo_get_txpow(struct net_device *dev, | |||
6740 | struct airo_info *local = dev->priv; | 6731 | struct airo_info *local = dev->priv; |
6741 | 6732 | ||
6742 | readConfigRid(local, 1); | 6733 | readConfigRid(local, 1); |
6743 | vwrq->value = local->config.txPower; | 6734 | vwrq->value = le16_to_cpu(local->config.txPower); |
6744 | vwrq->fixed = 1; /* No power control */ | 6735 | vwrq->fixed = 1; /* No power control */ |
6745 | vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); | 6736 | vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); |
6746 | vwrq->flags = IW_TXPOW_MWATT; | 6737 | vwrq->flags = IW_TXPOW_MWATT; |
@@ -6765,20 +6756,21 @@ static int airo_set_retry(struct net_device *dev, | |||
6765 | } | 6756 | } |
6766 | readConfigRid(local, 1); | 6757 | readConfigRid(local, 1); |
6767 | if(vwrq->flags & IW_RETRY_LIMIT) { | 6758 | if(vwrq->flags & IW_RETRY_LIMIT) { |
6759 | __le16 v = cpu_to_le16(vwrq->value); | ||
6768 | if(vwrq->flags & IW_RETRY_LONG) | 6760 | if(vwrq->flags & IW_RETRY_LONG) |
6769 | local->config.longRetryLimit = vwrq->value; | 6761 | local->config.longRetryLimit = v; |
6770 | else if (vwrq->flags & IW_RETRY_SHORT) | 6762 | else if (vwrq->flags & IW_RETRY_SHORT) |
6771 | local->config.shortRetryLimit = vwrq->value; | 6763 | local->config.shortRetryLimit = v; |
6772 | else { | 6764 | else { |
6773 | /* No modifier : set both */ | 6765 | /* No modifier : set both */ |
6774 | local->config.longRetryLimit = vwrq->value; | 6766 | local->config.longRetryLimit = v; |
6775 | local->config.shortRetryLimit = vwrq->value; | 6767 | local->config.shortRetryLimit = v; |
6776 | } | 6768 | } |
6777 | set_bit (FLAG_COMMIT, &local->flags); | 6769 | set_bit (FLAG_COMMIT, &local->flags); |
6778 | rc = -EINPROGRESS; /* Call commit handler */ | 6770 | rc = -EINPROGRESS; /* Call commit handler */ |
6779 | } | 6771 | } |
6780 | if(vwrq->flags & IW_RETRY_LIFETIME) { | 6772 | if(vwrq->flags & IW_RETRY_LIFETIME) { |
6781 | local->config.txLifetime = vwrq->value / 1024; | 6773 | local->config.txLifetime = cpu_to_le16(vwrq->value / 1024); |
6782 | set_bit (FLAG_COMMIT, &local->flags); | 6774 | set_bit (FLAG_COMMIT, &local->flags); |
6783 | rc = -EINPROGRESS; /* Call commit handler */ | 6775 | rc = -EINPROGRESS; /* Call commit handler */ |
6784 | } | 6776 | } |
@@ -6802,14 +6794,14 @@ static int airo_get_retry(struct net_device *dev, | |||
6802 | /* Note : by default, display the min retry number */ | 6794 | /* Note : by default, display the min retry number */ |
6803 | if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | 6795 | if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { |
6804 | vwrq->flags = IW_RETRY_LIFETIME; | 6796 | vwrq->flags = IW_RETRY_LIFETIME; |
6805 | vwrq->value = (int)local->config.txLifetime * 1024; | 6797 | vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024; |
6806 | } else if((vwrq->flags & IW_RETRY_LONG)) { | 6798 | } else if((vwrq->flags & IW_RETRY_LONG)) { |
6807 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | 6799 | vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
6808 | vwrq->value = (int)local->config.longRetryLimit; | 6800 | vwrq->value = le16_to_cpu(local->config.longRetryLimit); |
6809 | } else { | 6801 | } else { |
6810 | vwrq->flags = IW_RETRY_LIMIT; | 6802 | vwrq->flags = IW_RETRY_LIMIT; |
6811 | vwrq->value = (int)local->config.shortRetryLimit; | 6803 | vwrq->value = le16_to_cpu(local->config.shortRetryLimit); |
6812 | if((int)local->config.shortRetryLimit != (int)local->config.longRetryLimit) | 6804 | if(local->config.shortRetryLimit != local->config.longRetryLimit) |
6813 | vwrq->flags |= IW_RETRY_SHORT; | 6805 | vwrq->flags |= IW_RETRY_SHORT; |
6814 | } | 6806 | } |
6815 | 6807 | ||
@@ -6954,38 +6946,37 @@ static int airo_set_power(struct net_device *dev, | |||
6954 | 6946 | ||
6955 | readConfigRid(local, 1); | 6947 | readConfigRid(local, 1); |
6956 | if (vwrq->disabled) { | 6948 | if (vwrq->disabled) { |
6957 | if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) { | 6949 | if (sniffing_mode(local)) |
6958 | return -EINVAL; | 6950 | return -EINVAL; |
6959 | } | ||
6960 | local->config.powerSaveMode = POWERSAVE_CAM; | 6951 | local->config.powerSaveMode = POWERSAVE_CAM; |
6961 | local->config.rmode &= 0xFF00; | 6952 | local->config.rmode &= ~RXMODE_MASK; |
6962 | local->config.rmode |= RXMODE_BC_MC_ADDR; | 6953 | local->config.rmode |= RXMODE_BC_MC_ADDR; |
6963 | set_bit (FLAG_COMMIT, &local->flags); | 6954 | set_bit (FLAG_COMMIT, &local->flags); |
6964 | return -EINPROGRESS; /* Call commit handler */ | 6955 | return -EINPROGRESS; /* Call commit handler */ |
6965 | } | 6956 | } |
6966 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 6957 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
6967 | local->config.fastListenDelay = (vwrq->value + 500) / 1024; | 6958 | local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024); |
6968 | local->config.powerSaveMode = POWERSAVE_PSPCAM; | 6959 | local->config.powerSaveMode = POWERSAVE_PSPCAM; |
6969 | set_bit (FLAG_COMMIT, &local->flags); | 6960 | set_bit (FLAG_COMMIT, &local->flags); |
6970 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { | 6961 | } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { |
6971 | local->config.fastListenInterval = local->config.listenInterval = (vwrq->value + 500) / 1024; | 6962 | local->config.fastListenInterval = |
6963 | local->config.listenInterval = | ||
6964 | cpu_to_le16((vwrq->value + 500) / 1024); | ||
6972 | local->config.powerSaveMode = POWERSAVE_PSPCAM; | 6965 | local->config.powerSaveMode = POWERSAVE_PSPCAM; |
6973 | set_bit (FLAG_COMMIT, &local->flags); | 6966 | set_bit (FLAG_COMMIT, &local->flags); |
6974 | } | 6967 | } |
6975 | switch (vwrq->flags & IW_POWER_MODE) { | 6968 | switch (vwrq->flags & IW_POWER_MODE) { |
6976 | case IW_POWER_UNICAST_R: | 6969 | case IW_POWER_UNICAST_R: |
6977 | if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) { | 6970 | if (sniffing_mode(local)) |
6978 | return -EINVAL; | 6971 | return -EINVAL; |
6979 | } | 6972 | local->config.rmode &= ~RXMODE_MASK; |
6980 | local->config.rmode &= 0xFF00; | ||
6981 | local->config.rmode |= RXMODE_ADDR; | 6973 | local->config.rmode |= RXMODE_ADDR; |
6982 | set_bit (FLAG_COMMIT, &local->flags); | 6974 | set_bit (FLAG_COMMIT, &local->flags); |
6983 | break; | 6975 | break; |
6984 | case IW_POWER_ALL_R: | 6976 | case IW_POWER_ALL_R: |
6985 | if ((local->config.rmode & 0xFF) >= RXMODE_RFMON) { | 6977 | if (sniffing_mode(local)) |
6986 | return -EINVAL; | 6978 | return -EINVAL; |
6987 | } | 6979 | local->config.rmode &= ~RXMODE_MASK; |
6988 | local->config.rmode &= 0xFF00; | ||
6989 | local->config.rmode |= RXMODE_BC_MC_ADDR; | 6980 | local->config.rmode |= RXMODE_BC_MC_ADDR; |
6990 | set_bit (FLAG_COMMIT, &local->flags); | 6981 | set_bit (FLAG_COMMIT, &local->flags); |
6991 | case IW_POWER_ON: | 6982 | case IW_POWER_ON: |
@@ -7009,20 +7000,20 @@ static int airo_get_power(struct net_device *dev, | |||
7009 | char *extra) | 7000 | char *extra) |
7010 | { | 7001 | { |
7011 | struct airo_info *local = dev->priv; | 7002 | struct airo_info *local = dev->priv; |
7012 | int mode; | 7003 | __le16 mode; |
7013 | 7004 | ||
7014 | readConfigRid(local, 1); | 7005 | readConfigRid(local, 1); |
7015 | mode = local->config.powerSaveMode; | 7006 | mode = local->config.powerSaveMode; |
7016 | if ((vwrq->disabled = (mode == POWERSAVE_CAM))) | 7007 | if ((vwrq->disabled = (mode == POWERSAVE_CAM))) |
7017 | return 0; | 7008 | return 0; |
7018 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 7009 | if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
7019 | vwrq->value = (int)local->config.fastListenDelay * 1024; | 7010 | vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; |
7020 | vwrq->flags = IW_POWER_TIMEOUT; | 7011 | vwrq->flags = IW_POWER_TIMEOUT; |
7021 | } else { | 7012 | } else { |
7022 | vwrq->value = (int)local->config.fastListenInterval * 1024; | 7013 | vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; |
7023 | vwrq->flags = IW_POWER_PERIOD; | 7014 | vwrq->flags = IW_POWER_PERIOD; |
7024 | } | 7015 | } |
7025 | if ((local->config.rmode & 0xFF) == RXMODE_ADDR) | 7016 | if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) |
7026 | vwrq->flags |= IW_POWER_UNICAST_R; | 7017 | vwrq->flags |= IW_POWER_UNICAST_R; |
7027 | else | 7018 | else |
7028 | vwrq->flags |= IW_POWER_ALL_R; | 7019 | vwrq->flags |= IW_POWER_ALL_R; |
@@ -7042,7 +7033,8 @@ static int airo_set_sens(struct net_device *dev, | |||
7042 | struct airo_info *local = dev->priv; | 7033 | struct airo_info *local = dev->priv; |
7043 | 7034 | ||
7044 | readConfigRid(local, 1); | 7035 | readConfigRid(local, 1); |
7045 | local->config.rssiThreshold = vwrq->disabled ? RSSI_DEFAULT : vwrq->value; | 7036 | local->config.rssiThreshold = |
7037 | cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value); | ||
7046 | set_bit (FLAG_COMMIT, &local->flags); | 7038 | set_bit (FLAG_COMMIT, &local->flags); |
7047 | 7039 | ||
7048 | return -EINPROGRESS; /* Call commit handler */ | 7040 | return -EINPROGRESS; /* Call commit handler */ |
@@ -7060,7 +7052,7 @@ static int airo_get_sens(struct net_device *dev, | |||
7060 | struct airo_info *local = dev->priv; | 7052 | struct airo_info *local = dev->priv; |
7061 | 7053 | ||
7062 | readConfigRid(local, 1); | 7054 | readConfigRid(local, 1); |
7063 | vwrq->value = local->config.rssiThreshold; | 7055 | vwrq->value = le16_to_cpu(local->config.rssiThreshold); |
7064 | vwrq->disabled = (vwrq->value == 0); | 7056 | vwrq->disabled = (vwrq->value == 0); |
7065 | vwrq->fixed = 1; | 7057 | vwrq->fixed = 1; |
7066 | 7058 | ||
@@ -7861,9 +7853,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { | |||
7861 | ConfigRid *cfg = (ConfigRid *)iobuf; | 7853 | ConfigRid *cfg = (ConfigRid *)iobuf; |
7862 | 7854 | ||
7863 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) | 7855 | if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) |
7864 | cfg->opmode |= cpu_to_le16(MODE_MIC); | 7856 | cfg->opmode |= MODE_MIC; |
7865 | 7857 | ||
7866 | if ((le16_to_cpu(cfg->opmode) & 0xFF) == MODE_STA_IBSS) | 7858 | if ((cfg->opmode & MODE_CFG_MASK) == MODE_STA_IBSS) |
7867 | set_bit (FLAG_ADHOC, &ai->flags); | 7859 | set_bit (FLAG_ADHOC, &ai->flags); |
7868 | else | 7860 | else |
7869 | clear_bit (FLAG_ADHOC, &ai->flags); | 7861 | clear_bit (FLAG_ADHOC, &ai->flags); |