aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/cfg.c
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2010-04-19 03:16:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-19 16:41:42 -0400
commitc3d415030c1a00cc21935c38f8761db46ef1d7ff (patch)
tree86fe257df362d102e0b327c0e4fa3220c70b305b /drivers/net/wireless/orinoco/cfg.c
parent3393a608c4979a94d1887efc05b792849d361a65 (diff)
orinoco: implement set_wiphy_params
... to set fragmentation and RTS thresholds. Also report RTS retry settings during wiphy init. Note that the existing semantics for enabling microwave robustness are preserved on firmwares that have it. Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/cfg.c')
-rw-r--r--drivers/net/wireless/orinoco/cfg.c88
1 files changed, 87 insertions, 1 deletions
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index 27f2d3342645..90dd4d0595c3 100644
--- a/drivers/net/wireless/orinoco/cfg.c
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -88,7 +88,9 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
88 88
89 wiphy->rts_threshold = priv->rts_thresh; 89 wiphy->rts_threshold = priv->rts_thresh;
90 if (!priv->has_mwo) 90 if (!priv->has_mwo)
91 wiphy->frag_threshold = priv->frag_thresh; 91 wiphy->frag_threshold = priv->frag_thresh + 1;
92 wiphy->retry_short = priv->short_retry_limit;
93 wiphy->retry_long = priv->long_retry_limit;
92 94
93 return wiphy_register(wiphy); 95 return wiphy_register(wiphy);
94} 96}
@@ -196,8 +198,92 @@ static int orinoco_set_channel(struct wiphy *wiphy,
196 return err; 198 return err;
197} 199}
198 200
201static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed)
202{
203 struct orinoco_private *priv = wiphy_priv(wiphy);
204 int frag_value = -1;
205 int rts_value = -1;
206 int err = 0;
207
208 if (changed & WIPHY_PARAM_RETRY_SHORT) {
209 /* Setting short retry not supported */
210 err = -EINVAL;
211 }
212
213 if (changed & WIPHY_PARAM_RETRY_LONG) {
214 /* Setting long retry not supported */
215 err = -EINVAL;
216 }
217
218 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
219 /* Set fragmentation */
220 if (priv->has_mwo) {
221 if (wiphy->frag_threshold < 0)
222 frag_value = 0;
223 else {
224 printk(KERN_WARNING "%s: Fixed fragmentation "
225 "is not supported on this firmware. "
226 "Using MWO robust instead.\n",
227 priv->ndev->name);
228 frag_value = 1;
229 }
230 } else {
231 if (wiphy->frag_threshold < 0)
232 frag_value = 2346;
233 else if ((wiphy->frag_threshold < 257) ||
234 (wiphy->frag_threshold > 2347))
235 err = -EINVAL;
236 else
237 /* cfg80211 value is 257-2347 (odd only)
238 * orinoco rid has range 256-2346 (even only) */
239 frag_value = wiphy->frag_threshold & ~0x1;
240 }
241 }
242
243 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
244 /* Set RTS.
245 *
246 * Prism documentation suggests default of 2432,
247 * and a range of 0-3000.
248 *
249 * Current implementation uses 2347 as the default and
250 * the upper limit.
251 */
252
253 if (wiphy->rts_threshold < 0)
254 rts_value = 2347;
255 else if (wiphy->rts_threshold > 2347)
256 err = -EINVAL;
257 else
258 rts_value = wiphy->rts_threshold;
259 }
260
261 if (!err) {
262 unsigned long flags;
263
264 if (orinoco_lock(priv, &flags) != 0)
265 return -EBUSY;
266
267 if (frag_value >= 0) {
268 if (priv->has_mwo)
269 priv->mwo_robust = frag_value;
270 else
271 priv->frag_thresh = frag_value;
272 }
273 if (rts_value >= 0)
274 priv->rts_thresh = rts_value;
275
276 err = orinoco_commit(priv);
277
278 orinoco_unlock(priv, &flags);
279 }
280
281 return err;
282}
283
199const struct cfg80211_ops orinoco_cfg_ops = { 284const struct cfg80211_ops orinoco_cfg_ops = {
200 .change_virtual_intf = orinoco_change_vif, 285 .change_virtual_intf = orinoco_change_vif,
201 .set_channel = orinoco_set_channel, 286 .set_channel = orinoco_set_channel,
202 .scan = orinoco_scan, 287 .scan = orinoco_scan,
288 .set_wiphy_params = orinoco_set_wiphy_params,
203}; 289};