aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Jezak <josejx@gentoo.org>2006-06-01 12:12:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-06-05 15:51:30 -0400
commitc4b3d1bb3206513d7f10cd60bbac97c82624c2d3 (patch)
tree33cd40b28136809c4fc462742c9f1519b4b2ed73
parent6ae15df16ef3dc3f5f043e94bb2cd4aa6c7f2aa8 (diff)
[PATCH] softmac: unified capabilities computation
This patch moves the capabilities field computation to a function for clarity and adds some previously unimplemented bits. Signed off by Joseph Jezak <josejx@gentoo.org> Signed-off-by: Daniel Drake <dsd@gentoo.org> Acked-By: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_io.c85
1 files changed, 53 insertions, 32 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c
index 44f51175a2fc..09541611e48c 100644
--- a/net/ieee80211/softmac/ieee80211softmac_io.c
+++ b/net/ieee80211/softmac/ieee80211softmac_io.c
@@ -149,6 +149,56 @@ ieee80211softmac_hdr_3addr(struct ieee80211softmac_device *mac,
149 * shouldn't the sequence number be in ieee80211? */ 149 * shouldn't the sequence number be in ieee80211? */
150} 150}
151 151
152static u16
153ieee80211softmac_capabilities(struct ieee80211softmac_device *mac,
154 struct ieee80211softmac_network *net)
155{
156 u16 capability = 0;
157
158 /* ESS and IBSS bits are set according to the current mode */
159 switch (mac->ieee->iw_mode) {
160 case IW_MODE_INFRA:
161 capability = cpu_to_le16(WLAN_CAPABILITY_ESS);
162 break;
163 case IW_MODE_ADHOC:
164 capability = cpu_to_le16(WLAN_CAPABILITY_IBSS);
165 break;
166 case IW_MODE_AUTO:
167 capability = net->capabilities &
168 (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS);
169 break;
170 default:
171 /* bleh. we don't ever go to these modes */
172 printk(KERN_ERR PFX "invalid iw_mode!\n");
173 break;
174 }
175
176 /* CF Pollable / CF Poll Request */
177 /* Needs to be implemented, for now, the 0's == not supported */
178
179 /* Privacy Bit */
180 capability |= mac->ieee->sec.level ?
181 cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0;
182
183 /* Short Preamble */
184 /* Always supported: we probably won't ever be powering devices which
185 * dont support this... */
186 capability |= WLAN_CAPABILITY_SHORT_PREAMBLE;
187
188 /* PBCC */
189 /* Not widely used */
190
191 /* Channel Agility */
192 /* Not widely used */
193
194 /* Short Slot */
195 /* Will be implemented later */
196
197 /* DSSS-OFDM */
198 /* Not widely used */
199
200 return capability;
201}
152 202
153/***************************************************************************** 203/*****************************************************************************
154 * Create Management packets 204 * Create Management packets
@@ -179,27 +229,6 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt,
179 return 0; 229 return 0;
180 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); 230 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid);
181 231
182 /* Fill in capability Info */
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 }
198 /* Need to add this
199 (*pkt)->capability |= mac->ieee->short_slot ?
200 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0;
201 */
202 (*pkt)->capability |= mac->ieee->sec.level ? cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0;
203 /* Fill in Listen Interval (?) */ 232 /* Fill in Listen Interval (?) */
204 (*pkt)->listen_interval = cpu_to_le16(10); 233 (*pkt)->listen_interval = cpu_to_le16(10);
205 234
@@ -239,17 +268,9 @@ ieee80211softmac_reassoc_req(struct ieee80211_reassoc_request **pkt,
239 return 0; 268 return 0;
240 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid); 269 ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_REASSOC_REQ, net->bssid, net->bssid);
241 270
242 /* Fill in capability Info */ 271 /* Fill in the capabilities */
243 (*pkt)->capability = mac->ieee->iw_mode == IW_MODE_MASTER ? 272 (*pkt)->capability = ieee80211softmac_capabilities(mac, net);
244 cpu_to_le16(WLAN_CAPABILITY_ESS) : 273
245 cpu_to_le16(WLAN_CAPABILITY_IBSS);
246 /*
247 (*pkt)->capability |= mac->ieee->short_slot ?
248 cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0;
249 */
250 (*pkt)->capability |= mac->ieee->sec.level ?
251 cpu_to_le16(WLAN_CAPABILITY_PRIVACY) : 0;
252
253 /* Fill in Listen Interval (?) */ 274 /* Fill in Listen Interval (?) */
254 (*pkt)->listen_interval = cpu_to_le16(10); 275 (*pkt)->listen_interval = cpu_to_le16(10);
255 /* Fill in the current AP MAC */ 276 /* Fill in the current AP MAC */