aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
commitccc580571cf0799d0460a085a7632b77753f083e (patch)
tree018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/wireless/orinoco.c
parent0f5cabba49021d36e9f76bd97d7fa0f4a408063f (diff)
wext: Emit event stream entries correctly when compat.
Three major portions to this change: 1) Add IW_EV_COMPAT_LCP_LEN, IW_EV_COMPAT_POINT_OFF, and IW_EV_COMPAT_POINT_LEN helper defines. 2) Delete iw_stream_check_add_*(), they are unused. 3) Add iw_request_info argument to iwe_stream_add_*(), and use it to size the event and pointer lengths correctly depending upon whether IW_REQUEST_FLAG_COMPAT is set or not. 4) The mechanical transformations to the drivers and wireless stack bits to get the iw_request_info passed down into the routines modified in #3. Also, explicit references to IW_EV_LCP_LEN are replaced with iwe_stream_lcp_len(info). With a lot of help and bug fixes from Masakazu Mokuno. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/orinoco.c')
-rw-r--r--drivers/net/wireless/orinoco.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 6d13a0d15a0c..b047306bf386 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -4046,6 +4046,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
4046 * format that the Wireless Tools will understand - Jean II 4046 * format that the Wireless Tools will understand - Jean II
4047 * Return message length or -errno for fatal errors */ 4047 * Return message length or -errno for fatal errors */
4048static inline char *orinoco_translate_scan(struct net_device *dev, 4048static inline char *orinoco_translate_scan(struct net_device *dev,
4049 struct iw_request_info *info,
4049 char *current_ev, 4050 char *current_ev,
4050 char *end_buf, 4051 char *end_buf,
4051 union hermes_scan_info *bss, 4052 union hermes_scan_info *bss,
@@ -4062,7 +4063,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4062 iwe.cmd = SIOCGIWAP; 4063 iwe.cmd = SIOCGIWAP;
4063 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 4064 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
4064 memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN); 4065 memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN);
4065 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); 4066 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4067 &iwe, IW_EV_ADDR_LEN);
4066 4068
4067 /* Other entries will be displayed in the order we give them */ 4069 /* Other entries will be displayed in the order we give them */
4068 4070
@@ -4072,7 +4074,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4072 iwe.u.data.length = 32; 4074 iwe.u.data.length = 32;
4073 iwe.cmd = SIOCGIWESSID; 4075 iwe.cmd = SIOCGIWESSID;
4074 iwe.u.data.flags = 1; 4076 iwe.u.data.flags = 1;
4075 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid); 4077 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4078 &iwe, bss->a.essid);
4076 4079
4077 /* Add mode */ 4080 /* Add mode */
4078 iwe.cmd = SIOCGIWMODE; 4081 iwe.cmd = SIOCGIWMODE;
@@ -4082,7 +4085,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4082 iwe.u.mode = IW_MODE_MASTER; 4085 iwe.u.mode = IW_MODE_MASTER;
4083 else 4086 else
4084 iwe.u.mode = IW_MODE_ADHOC; 4087 iwe.u.mode = IW_MODE_ADHOC;
4085 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); 4088 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4089 &iwe, IW_EV_UINT_LEN);
4086 } 4090 }
4087 4091
4088 channel = bss->s.channel; 4092 channel = bss->s.channel;
@@ -4091,7 +4095,7 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4091 iwe.cmd = SIOCGIWFREQ; 4095 iwe.cmd = SIOCGIWFREQ;
4092 iwe.u.freq.m = channel_frequency[channel-1] * 100000; 4096 iwe.u.freq.m = channel_frequency[channel-1] * 100000;
4093 iwe.u.freq.e = 1; 4097 iwe.u.freq.e = 1;
4094 current_ev = iwe_stream_add_event(current_ev, end_buf, 4098 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4095 &iwe, IW_EV_FREQ_LEN); 4099 &iwe, IW_EV_FREQ_LEN);
4096 } 4100 }
4097 4101
@@ -4106,7 +4110,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4106 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise; 4110 iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
4107 else 4111 else
4108 iwe.u.qual.qual = 0; 4112 iwe.u.qual.qual = 0;
4109 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 4113 current_ev = iwe_stream_add_event(info, current_ev, end_buf,
4114 &iwe, IW_EV_QUAL_LEN);
4110 4115
4111 /* Add encryption capability */ 4116 /* Add encryption capability */
4112 iwe.cmd = SIOCGIWENCODE; 4117 iwe.cmd = SIOCGIWENCODE;
@@ -4115,7 +4120,8 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4115 else 4120 else
4116 iwe.u.data.flags = IW_ENCODE_DISABLED; 4121 iwe.u.data.flags = IW_ENCODE_DISABLED;
4117 iwe.u.data.length = 0; 4122 iwe.u.data.length = 0;
4118 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->a.essid); 4123 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4124 &iwe, bss->a.essid);
4119 4125
4120 /* Add EXTRA: Age to display seconds since last beacon/probe response 4126 /* Add EXTRA: Age to display seconds since last beacon/probe response
4121 * for given network. */ 4127 * for given network. */
@@ -4126,11 +4132,12 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4126 jiffies_to_msecs(jiffies - last_scanned)); 4132 jiffies_to_msecs(jiffies - last_scanned));
4127 iwe.u.data.length = p - custom; 4133 iwe.u.data.length = p - custom;
4128 if (iwe.u.data.length) 4134 if (iwe.u.data.length)
4129 current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom); 4135 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
4136 &iwe, custom);
4130 4137
4131 /* Bit rate is not available in Lucent/Agere firmwares */ 4138 /* Bit rate is not available in Lucent/Agere firmwares */
4132 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) { 4139 if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
4133 char *current_val = current_ev + IW_EV_LCP_LEN; 4140 char *current_val = current_ev + iwe_stream_lcp_len(info);
4134 int i; 4141 int i;
4135 int step; 4142 int step;
4136 4143
@@ -4149,12 +4156,13 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
4149 break; 4156 break;
4150 /* Bit rate given in 500 kb/s units (+ 0x80) */ 4157 /* Bit rate given in 500 kb/s units (+ 0x80) */
4151 iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000); 4158 iwe.u.bitrate.value = ((bss->p.rates[i] & 0x7f) * 500000);
4152 current_val = iwe_stream_add_value(current_ev, current_val, 4159 current_val = iwe_stream_add_value(info, current_ev,
4160 current_val,
4153 end_buf, &iwe, 4161 end_buf, &iwe,
4154 IW_EV_PARAM_LEN); 4162 IW_EV_PARAM_LEN);
4155 } 4163 }
4156 /* Check if we added any event */ 4164 /* Check if we added any event */
4157 if ((current_val - current_ev) > IW_EV_LCP_LEN) 4165 if ((current_val - current_ev) > iwe_stream_lcp_len(info))
4158 current_ev = current_val; 4166 current_ev = current_val;
4159 } 4167 }
4160 4168
@@ -4190,7 +4198,7 @@ static int orinoco_ioctl_getscan(struct net_device *dev,
4190 4198
4191 list_for_each_entry(bss, &priv->bss_list, list) { 4199 list_for_each_entry(bss, &priv->bss_list, list) {
4192 /* Translate to WE format this entry */ 4200 /* Translate to WE format this entry */
4193 current_ev = orinoco_translate_scan(dev, current_ev, 4201 current_ev = orinoco_translate_scan(dev, info, current_ev,
4194 extra + srq->length, 4202 extra + srq->length,
4195 &bss->bss, 4203 &bss->bss,
4196 bss->last_scanned); 4204 bss->last_scanned);