From: Sukesh Srikakula Date: Fri, 13 May 2011 09:59:45 +0000 (+0200) Subject: staging: brcm80211: Added support to change roaming parameters from brcmfmac driver X-Git-Tag: v3.0-rc1~336^2~229 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1e962b64ffd1f96412bf1d4baf78bb6e0a2c797;p=profile%2Fivi%2Fkernel-x86-ivi.git staging: brcm80211: Added support to change roaming parameters from brcmfmac driver 'wl_dongle_roam' function moved out of conditional compilation to allow the fullmac driver to change FW roaming parameters Cc: devel@linuxdriverproject.org Cc: linux-wireless@vger.kernel.org Reviewed-by: Franky (Zhenhui) Lin Reviewed-by: Brett Rudley Signed-off-by: Arend van Spriel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c index 27baf56..e90015c 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c @@ -259,8 +259,6 @@ static s32 wl_dongle_up(struct net_device *ndev, u32 up); static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode); static s32 wl_dongle_glom(struct net_device *ndev, u32 glom, u32 dongle_align); -static s32 wl_dongle_roam(struct net_device *ndev, u32 roamvar, - u32 bcn_timeout); static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, s32 scan_unassoc_time); static s32 wl_dongle_offload(struct net_device *ndev, s32 arpoe, @@ -272,6 +270,8 @@ static s32 wl_update_wiphybands(struct wl_priv *wl); static s32 wl_dongle_eventmsg(struct net_device *ndev); static s32 wl_config_dongle(struct wl_priv *wl, bool need_lock); +static s32 wl_dongle_roam(struct net_device *ndev, u32 roamvar, + u32 bcn_timeout); /* ** iscan handler @@ -3633,36 +3633,6 @@ dongle_glom_out: } static s32 -wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) -{ - s8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + - '\0' + bitvec */ - s32 err = 0; - - /* Setup timeout if Beacons are lost and roam is - off to report link down */ - if (roamvar) { - bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, - sizeof(iovbuf)); - err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - if (unlikely(err)) { - WL_ERR("bcn_timeout error (%d)\n", err); - goto dongle_rom_out; - } - } - /* Enable/Disable built-in roaming to allow supplicant - to take care of roaming */ - bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); - err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - if (unlikely(err)) { - WL_ERR("roam_off error (%d)\n", err); - goto dongle_rom_out; - } -dongle_rom_out: - return err; -} - -static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, s32 scan_unassoc_time) { @@ -3890,6 +3860,63 @@ dongle_eventmsg_out: return err; } +static s32 +wl_dongle_roam(struct net_device *ndev, u32 roamvar, u32 bcn_timeout) +{ + s8 iovbuf[32]; + s32 roamtrigger[2]; + s32 roam_delta[2]; + s32 err = 0; + + /* + * Setup timeout if Beacons are lost and roam is + * off to report link down + */ + if (roamvar) { + bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, + sizeof(bcn_timeout), iovbuf, sizeof(iovbuf)); + err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); + if (unlikely(err)) { + WL_ERR("bcn_timeout error (%d)\n", err); + goto dongle_rom_out; + } + } + + /* + * Enable/Disable built-in roaming to allow supplicant + * to take care of roaming + */ + WL_INFO("Internal Roaming = %s\n", roamvar ? "Off" : "On"); + bcm_mkiovar("roam_off", (char *)&roamvar, + sizeof(roamvar), iovbuf, sizeof(iovbuf)); + err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); + if (unlikely(err)) { + WL_ERR("roam_off error (%d)\n", err); + goto dongle_rom_out; + } + + roamtrigger[0] = WL_ROAM_TRIGGER_LEVEL; + roamtrigger[1] = WLC_BAND_ALL; + err = wl_dev_ioctl(ndev, WLC_SET_ROAM_TRIGGER, + (void *)roamtrigger, sizeof(roamtrigger)); + if (unlikely(err)) { + WL_ERR("WLC_SET_ROAM_TRIGGER error (%d)\n", err); + goto dongle_rom_out; + } + + roam_delta[0] = WL_ROAM_DELTA; + roam_delta[1] = WLC_BAND_ALL; + err = wl_dev_ioctl(ndev, WLC_SET_ROAM_DELTA, + (void *)roam_delta, sizeof(roam_delta)); + if (unlikely(err)) { + WL_ERR("WLC_SET_ROAM_DELTA error (%d)\n", err); + goto dongle_rom_out; + } + +dongle_rom_out: + return err; +} + s32 wl_config_dongle(struct wl_priv *wl, bool need_lock) { #ifndef DHD_SDALIGN @@ -3920,9 +3947,6 @@ s32 wl_config_dongle(struct wl_priv *wl, bool need_lock) err = wl_dongle_glom(ndev, 0, DHD_SDALIGN); if (unlikely(err)) goto default_conf_out; - err = wl_dongle_roam(ndev, (wl->roam_on ? 0 : 1), 3); - if (unlikely(err)) - goto default_conf_out; wl_dongle_scantime(ndev, 40, 80); wl_dongle_offload(ndev, 1, 0xf); wl_dongle_filter(ndev, 1); @@ -3931,6 +3955,9 @@ s32 wl_config_dongle(struct wl_priv *wl, bool need_lock) err = wl_dongle_eventmsg(ndev); if (unlikely(err)) goto default_conf_out; + err = wl_dongle_roam(ndev, (wl->roam_on ? 0 : 1), WL_BEACON_TIMEOUT); + if (unlikely(err)) + goto default_conf_out; err = wl_dongle_mode(ndev, wdev->iftype); if (unlikely(err && err != -EINPROGRESS)) goto default_conf_out; diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h index 6b61010..04381a9 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h @@ -95,6 +95,10 @@ do { \ */ #define WL_FILE_NAME_MAX 256 +#define WL_ROAM_TRIGGER_LEVEL -75 +#define WL_ROAM_DELTA 20 +#define WL_BEACON_TIMEOUT 3 + /* dongle status */ enum wl_status { WL_STATUS_READY,