orinoco: implement set_wiphy_params
PATCH 1/3 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 <[email protected]>
--- drivers/net/wireless/orinoco/cfg.c | 88 +++++++++++++++- drivers/net/wireless/orinoco/hw.c | 26 +++++ drivers/net/wireless/orinoco/orinoco.h | 2 + drivers/net/wireless/orinoco/wext.c | 183 +------------------------------- 4 files changed, 120 insertions(+), 179 deletions(-)
drivers/net/wireless/orinoco/cfg.c +87 -1
@@ -88,7 +88,9 @@ int orinoco_wiphy_register(struct wiphy *wiphy) wiphy->rts_threshold = priv->rts_thresh;if (!priv->has_mwo) - wiphy->frag_threshold = priv->frag_thresh; + wiphy->frag_threshold = priv->frag_thresh +1 ; + wiphy->retry_short = priv->short_retry_limit; + wiphy->retry_long = priv->long_retry_limit;return wiphy_register (wiphy); }
@@ -196,8 +198,92 @@ static int orinoco_set_channel(struct wiphy *wiphy,return err; } +static int orinoco_set_wiphy_params (struct wiphy *wiphy,u32 changed) +{ +struct orinoco_private *priv =wiphy_priv (wiphy); +int frag_value =-1 ; +int rts_value =-1 ; +int err =0 ; + +if (changed &WIPHY_PARAM_RETRY_SHORT ) { +/* Setting short retry not supported */ + err = -EINVAL ; + } + +if (changed &WIPHY_PARAM_RETRY_LONG ) { +/* Setting long retry not supported */ + err = -EINVAL ; + } + +if (changed &WIPHY_PARAM_FRAG_THRESHOLD ) { +/* Set fragmentation */ +if (priv->has_mwo) { +if (wiphy->frag_threshold <0 ) + frag_value =0 ; +else { +printk (KERN_WARNING "%s: Fixed fragmentation " +"is not supported on this firmware. " +"Using MWO robust instead.\n" , + priv->ndev->name); + frag_value =1 ; + } + }else { +if (wiphy->frag_threshold <0 ) + frag_value =2346 ; +else if ((wiphy->frag_threshold <257 ) || + (wiphy->frag_threshold >2347 )) + err = -EINVAL ; +else +/* cfg80211 value is 257-2347 (odd only) +* orinoco rid has range 256-2346 (even only) */ + frag_value = wiphy->frag_threshold & ~0x1 ; + } + } + +if (changed &WIPHY_PARAM_RTS_THRESHOLD ) { +/* Set RTS. +* +* Prism documentation suggests default of 2432, +* and a range of 0-3000. +* +* Current implementation uses 2347 as the default and +* the upper limit. +*/ + +if (wiphy->rts_threshold <0 ) + rts_value =2347 ; +else if (wiphy->rts_threshold >2347 ) + err = -EINVAL ; +else + rts_value = wiphy->rts_threshold; + } + +if (!err) { +unsigned long flags; + +if (orinoco_lock (priv, &flags) !=0 ) +return -EBUSY ; + +if (frag_value >=0 ) { +if (priv->has_mwo) + priv->mwo_robust = frag_value; +else + priv->frag_thresh = frag_value; + } +if (rts_value >=0 ) + priv->rts_thresh = rts_value; + + err =orinoco_commit (priv); + +orinoco_unlock (priv, &flags); + } + +return err; +} +const struct cfg80211_ops orinoco_cfg_ops = { .change_virtual_intf = orinoco_change_vif, .set_channel = orinoco_set_channel, .scan = orinoco_scan, + .set_wiphy_params = orinoco_set_wiphy_params, };
drivers/net/wireless/orinoco/hw.c +26 -0
@@ -374,6 +374,32 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_CNFPREAMBLE_SYMBOL , &priv->preamble); +if (err) { +dev_err (dev,"Failed to read preamble setup\n" ); + goto out; + } + } + +/* Retry settings */ + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_SHORTRETRYLIMIT , + &priv->short_retry_limit); +if (err) { +dev_err (dev,"Failed to read short retry limit\n" ); + goto out; + } + + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_LONGRETRYLIMIT , + &priv->long_retry_limit); +if (err) { +dev_err (dev,"Failed to read long retry limit\n" ); + goto out; + } + + err =hermes_read_wordrec (hw,USER_BAP ,HERMES_RID_MAXTRANSMITLIFETIME , + &priv->retry_lifetime); +if (err) { +dev_err (dev,"Failed to read max retry lifetime\n" ); + goto out; } out:
drivers/net/wireless/orinoco/orinoco.h +2 -0
@@ -131,6 +131,8 @@ struct orinoco_private {u16 ap_density, rts_thresh;u16 pm_on, pm_mcast, pm_period, pm_timeout;u16 preamble; +u16 short_retry_limit, long_retry_limit; +u16 retry_lifetime;#ifdef WIRELESS_SPY struct iw_spy_data spy_data;/* iwspy support */ struct iw_public_data wireless_data;
drivers/net/wireless/orinoco/wext.c +5 -178
201 lines not on this page · raw message
Signature · 1 line
1.6.4.4
PATCH 2/3 orinoco: use cfg80211_find_ie
Instead of using a local function.
Signed-off-by David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/main.h | 12 ------------ drivers/net/wireless/orinoco/scan.c | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-)
drivers/net/wireless/orinoco/main.h +0 -12
@@ -33,18 +33,6 @@ int orinoco_commit(struct orinoco_private *priv);void orinoco_reset (struct work_struct *work);/* Information element helpers - find a home for these... */ -static inline u8 *orinoco_get_ie (u8 *data,size_t len, -enum ieee80211_eid eid) -{ -u8 *p = data; -while ((p +2 ) < (data + len)) { -if (p[0 ] == eid) -return p; - p += p[1 ] +2 ; - } -return NULL ; -} -#define WPA_OUI_TYPE "\x00\x50\xF2\x01"#define WPA_SELECTOR_LEN 4static inline u8 *orinoco_get_wpa_ie (u8 *data,size_t len)
drivers/net/wireless/orinoco/scan.c +2 -2
@@ -127,7 +127,7 @@ void orinoco_add_extscan_result(struct orinoco_private *priv, {struct wiphy *wiphy =priv_to_wiphy (priv);struct ieee80211_channel *channel; -u8 *ie; +const u8 *ie;u64 timestamp;s32 signal;u16 capability;
@@ -136,7 +136,7 @@ void orinoco_add_extscan_result(struct orinoco_private *priv,int chan, freq; ie_len = len -sizeof (*bss); - ie =orinoco_get_ie (bss->data, ie_len,WLAN_EID_DS_PARAMS ); + ie =cfg80211_find_ie (WLAN_EID_DS_PARAMS , bss->data, ie_len); chan = ie ? ie[2 ] :0 ; freq =ieee80211_dsss_chan_to_freq (chan); channel =ieee80211_get_channel (wiphy, freq);
Signature · 1 line
1.6.4.4
PATCH 3/3 orinoco: have sparse check endian issues
In reply to David KilroyOrinoco should be endian clean, so enable the checking.
Signed-off-by David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/Makefile | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/orinoco/Makefile +3 -0
@@ -11,3 +11,6 @@ obj-$(CONFIG_PCI_HERMES) += orinoco_pci.o obj-$(CONFIG_TMD_HERMES) += orinoco_tmd.o obj-$(CONFIG_NORTEL_HERMES) += orinoco_nortel.o obj-$(CONFIG_PCMCIA_SPECTRUM) += spectrum_cs.o + +# Orinoco should be endian clean. +ccflags-y += -D__CHECK_ENDIAN__
Signature · 1 line
1.6.4.4