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.c91
1 files changed, 89 insertions, 2 deletions
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
index 27f2d3342645..8c4169c227ae 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}
@@ -157,6 +159,7 @@ static int orinoco_scan(struct wiphy *wiphy, struct net_device *dev,
157} 159}
158 160
159static int orinoco_set_channel(struct wiphy *wiphy, 161static int orinoco_set_channel(struct wiphy *wiphy,
162 struct net_device *netdev,
160 struct ieee80211_channel *chan, 163 struct ieee80211_channel *chan,
161 enum nl80211_channel_type channel_type) 164 enum nl80211_channel_type channel_type)
162{ 165{
@@ -187,7 +190,7 @@ static int orinoco_set_channel(struct wiphy *wiphy,
187 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { 190 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
188 /* Fast channel change - no commit if successful */ 191 /* Fast channel change - no commit if successful */
189 hermes_t *hw = &priv->hw; 192 hermes_t *hw = &priv->hw;
190 err = hermes_docmd_wait(hw, HERMES_CMD_TEST | 193 err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
191 HERMES_TEST_SET_CHANNEL, 194 HERMES_TEST_SET_CHANNEL,
192 channel, NULL); 195 channel, NULL);
193 } 196 }
@@ -196,8 +199,92 @@ static int orinoco_set_channel(struct wiphy *wiphy,
196 return err; 199 return err;
197} 200}
198 201
202static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed)
203{
204 struct orinoco_private *priv = wiphy_priv(wiphy);
205 int frag_value = -1;
206 int rts_value = -1;
207 int err = 0;
208
209 if (changed & WIPHY_PARAM_RETRY_SHORT) {
210 /* Setting short retry not supported */
211 err = -EINVAL;
212 }
213
214 if (changed & WIPHY_PARAM_RETRY_LONG) {
215 /* Setting long retry not supported */
216 err = -EINVAL;
217 }
218
219 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
220 /* Set fragmentation */
221 if (priv->has_mwo) {
222 if (wiphy->frag_threshold < 0)
223 frag_value = 0;
224 else {
225 printk(KERN_WARNING "%s: Fixed fragmentation "
226 "is not supported on this firmware. "
227 "Using MWO robust instead.\n",
228 priv->ndev->name);
229 frag_value = 1;
230 }
231 } else {
232 if (wiphy->frag_threshold < 0)
233 frag_value = 2346;
234 else if ((wiphy->frag_threshold < 257) ||
235 (wiphy->frag_threshold > 2347))
236 err = -EINVAL;
237 else
238 /* cfg80211 value is 257-2347 (odd only)
239 * orinoco rid has range 256-2346 (even only) */
240 frag_value = wiphy->frag_threshold & ~0x1;
241 }
242 }
243
244 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
245 /* Set RTS.
246 *
247 * Prism documentation suggests default of 2432,
248 * and a range of 0-3000.
249 *
250 * Current implementation uses 2347 as the default and
251 * the upper limit.
252 */
253
254 if (wiphy->rts_threshold < 0)
255 rts_value = 2347;
256 else if (wiphy->rts_threshold > 2347)
257 err = -EINVAL;
258 else
259 rts_value = wiphy->rts_threshold;
260 }
261
262 if (!err) {
263 unsigned long flags;
264
265 if (orinoco_lock(priv, &flags) != 0)
266 return -EBUSY;
267
268 if (frag_value >= 0) {
269 if (priv->has_mwo)
270 priv->mwo_robust = frag_value;
271 else
272 priv->frag_thresh = frag_value;
273 }
274 if (rts_value >= 0)
275 priv->rts_thresh = rts_value;
276
277 err = orinoco_commit(priv);
278
279 orinoco_unlock(priv, &flags);
280 }
281
282 return err;
283}
284
199const struct cfg80211_ops orinoco_cfg_ops = { 285const struct cfg80211_ops orinoco_cfg_ops = {
200 .change_virtual_intf = orinoco_change_vif, 286 .change_virtual_intf = orinoco_change_vif,
201 .set_channel = orinoco_set_channel, 287 .set_channel = orinoco_set_channel,
202 .scan = orinoco_scan, 288 .scan = orinoco_scan,
289 .set_wiphy_params = orinoco_set_wiphy_params,
203}; 290};