aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@gmail.com>2008-08-21 18:27:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-22 19:28:04 -0400
commit17a1a887041ea39a19c5d469f1e31df940b00622 (patch)
treeb4ed13156184085dd2eed0504d15e4abc4cd04a6
parent0753bba2d45762f83b9f4db94d15a3047f592964 (diff)
orinoco: Update scan translation
Report channel, beacon interval and capabilities. Use WEXT defines instead of magic numbers. State quality stats in dB. Also a few changes to keep line length less than 80. Signed-off-by: David Kilroy <kilroyd@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/orinoco.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index a60b459a9a99..00b1d595fa3c 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -3948,7 +3948,7 @@ static int orinoco_ioctl_getrid(struct net_device *dev,
3948 return err; 3948 return err;
3949} 3949}
3950 3950
3951/* Trigger a scan (look for other cells in the vicinity */ 3951/* Trigger a scan (look for other cells in the vicinity) */
3952static int orinoco_ioctl_setscan(struct net_device *dev, 3952static int orinoco_ioctl_setscan(struct net_device *dev,
3953 struct iw_request_info *info, 3953 struct iw_request_info *info,
3954 struct iw_param *srq, 3954 struct iw_param *srq,
@@ -3988,7 +3988,6 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
3988 * we access scan variables in priv is critical. 3988 * we access scan variables in priv is critical.
3989 * o scan_inprogress : not touched by irq handler 3989 * o scan_inprogress : not touched by irq handler
3990 * o scan_mode : not touched by irq handler 3990 * o scan_mode : not touched by irq handler
3991 * o scan_len : synchronised with scan_result
3992 * Before modifying anything on those variables, please think hard ! 3991 * Before modifying anything on those variables, please think hard !
3993 * Jean II */ 3992 * Jean II */
3994 3993
@@ -4054,8 +4053,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
4054#define MAX_CUSTOM_LEN 64 4053#define MAX_CUSTOM_LEN 64
4055 4054
4056/* Translate scan data returned from the card to a card independant 4055/* Translate scan data returned from the card to a card independant
4057 * format that the Wireless Tools will understand - Jean II 4056 * format that the Wireless Tools will understand - Jean II */
4058 * Return message length or -errno for fatal errors */
4059static inline char *orinoco_translate_scan(struct net_device *dev, 4057static inline char *orinoco_translate_scan(struct net_device *dev,
4060 struct iw_request_info *info, 4058 struct iw_request_info *info,
4061 char *current_ev, 4059 char *current_ev,
@@ -4067,9 +4065,10 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4067 u16 capabilities; 4065 u16 capabilities;
4068 u16 channel; 4066 u16 channel;
4069 struct iw_event iwe; /* Temporary buffer */ 4067 struct iw_event iwe; /* Temporary buffer */
4070 char *p;
4071 char custom[MAX_CUSTOM_LEN]; 4068 char custom[MAX_CUSTOM_LEN];
4072 4069
4070 memset(&iwe, 0, sizeof(iwe));
4071
4073 /* First entry *MUST* be the AP MAC address */ 4072 /* First entry *MUST* be the AP MAC address */
4074 iwe.cmd = SIOCGIWAP; 4073 iwe.cmd = SIOCGIWAP;
4075 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 4074 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
@@ -4091,8 +4090,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4091 /* Add mode */ 4090 /* Add mode */
4092 iwe.cmd = SIOCGIWMODE; 4091 iwe.cmd = SIOCGIWMODE;
4093 capabilities = le16_to_cpu(bss->a.capabilities); 4092 capabilities = le16_to_cpu(bss->a.capabilities);
4094 if (capabilities & 0x3) { 4093 if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
4095 if (capabilities & 0x1) 4094 if (capabilities & WLAN_CAPABILITY_ESS)
4096 iwe.u.mode = IW_MODE_MASTER; 4095 iwe.u.mode = IW_MODE_MASTER;
4097 else 4096 else
4098 iwe.u.mode = IW_MODE_ADHOC; 4097 iwe.u.mode = IW_MODE_ADHOC;
@@ -4102,17 +4101,22 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4102 4101
4103 channel = bss->s.channel; 4102 channel = bss->s.channel;
4104 if ((channel >= 1) && (channel <= NUM_CHANNELS)) { 4103 if ((channel >= 1) && (channel <= NUM_CHANNELS)) {
4105 /* Add frequency */ 4104 /* Add channel and frequency */
4106 iwe.cmd = SIOCGIWFREQ; 4105 iwe.cmd = SIOCGIWFREQ;
4106 iwe.u.freq.m = channel;
4107 iwe.u.freq.e = 0;
4108 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4109 &iwe, IW_EV_FREQ_LEN);
4110
4107 iwe.u.freq.m = channel_frequency[channel-1] * 100000; 4111 iwe.u.freq.m = channel_frequency[channel-1] * 100000;
4108 iwe.u.freq.e = 1; 4112 iwe.u.freq.e = 1;
4109 current_ev = iwe_stream_add_event(info, current_ev, end_buf, 4113 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4110 &iwe, IW_EV_FREQ_LEN); 4114 &iwe, IW_EV_FREQ_LEN);
4111 } 4115 }
4112 4116
4113 /* Add quality statistics */ 4117 /* Add quality statistics. level and noise in dB. No link quality */
4114 iwe.cmd = IWEVQUAL; 4118 iwe.cmd = IWEVQUAL;
4115 iwe.u.qual.updated = 0x10; /* no link quality */ 4119 iwe.u.qual.updated = IW_QUAL_DBM | IW_QUAL_QUAL_INVALID;
4116 iwe.u.qual.level = (__u8) le16_to_cpu(bss->a.level) - 0x95; 4120 iwe.u.qual.level = (__u8) le16_to_cpu(bss->a.level) - 0x95;
4117 iwe.u.qual.noise = (__u8) le16_to_cpu(bss->a.noise) - 0x95; 4121 iwe.u.qual.noise = (__u8) le16_to_cpu(bss->a.noise) - 0x95;
4118 /* Wireless tools prior to 27.pre22 will show link quality 4122 /* Wireless tools prior to 27.pre22 will show link quality
@@ -4126,25 +4130,13 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4126 4130
4127 /* Add encryption capability */ 4131 /* Add encryption capability */
4128 iwe.cmd = SIOCGIWENCODE; 4132 iwe.cmd = SIOCGIWENCODE;
4129 if (capabilities & 0x10) 4133 if (capabilities & WLAN_CAPABILITY_PRIVACY)
4130 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 4134 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
4131 else 4135 else
4132 iwe.u.data.flags = IW_ENCODE_DISABLED; 4136 iwe.u.data.flags = IW_ENCODE_DISABLED;
4133 iwe.u.data.length = 0; 4137 iwe.u.data.length = 0;
4134 current_ev = iwe_stream_add_point(info, current_ev, end_buf, 4138 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4135 &iwe, bss->a.essid); 4139 &iwe, NULL);
4136
4137 /* Add EXTRA: Age to display seconds since last beacon/probe response
4138 * for given network. */
4139 iwe.cmd = IWEVCUSTOM;
4140 p = custom;
4141 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
4142 " Last beacon: %dms ago",
4143 jiffies_to_msecs(jiffies - last_scanned));
4144 iwe.u.data.length = p - custom;
4145 if (iwe.u.data.length)
4146 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4147 &iwe, custom);
4148 4140
4149 /* Bit rate is not available in Lucent/Agere firmwares */ 4141 /* Bit rate is not available in Lucent/Agere firmwares */
4150 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) { 4142 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
@@ -4166,7 +4158,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4166 if (bss->p.rates[i] == 0x0) 4158 if (bss->p.rates[i] == 0x0)
4167 break; 4159 break;
4168 /* Bit rate given in 500 kb/s units (+ 0x80) */ 4160 /* Bit rate given in 500 kb/s units (+ 0x80) */
4169 iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000); 4161 iwe.u.bitrate.value =
4162 ((bss->p.rates[i] & 0x7f) * 500000);
4170 current_val = iwe_stream_add_value(info, current_ev, 4163 current_val = iwe_stream_add_value(info, current_ev,
4171 current_val, 4164 current_val,
4172 end_buf, &iwe, 4165 end_buf, &iwe,
@@ -4177,6 +4170,34 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4177 current_ev = current_val; 4170 current_ev = current_val;
4178 } 4171 }
4179 4172
4173 /* Beacon interval */
4174 iwe.cmd = IWEVCUSTOM;
4175 iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
4176 "bcn_int=%d",
4177 le16_to_cpu(bss->a.beacon_interv));
4178 if (iwe.u.data.length)
4179 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4180 &iwe, custom);
4181
4182 /* Capabilites */
4183 iwe.cmd = IWEVCUSTOM;
4184 iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
4185 "capab=0x%04x",
4186 capabilities);
4187 if (iwe.u.data.length)
4188 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4189 &iwe, custom);
4190
4191 /* Add EXTRA: Age to display seconds since last beacon/probe response
4192 * for given network. */
4193 iwe.cmd = IWEVCUSTOM;
4194 iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
4195 " Last beacon: %dms ago",
4196 jiffies_to_msecs(jiffies - last_scanned));
4197 if (iwe.u.data.length)
4198 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4199 &iwe, custom);
4200
4180 return current_ev; 4201 return current_ev;
4181} 4202}
4182 4203