aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/cfg.c
diff options
context:
space:
mode:
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};