Wireless handoff process

 

In most of the wireless card, handoff process (scan, authentication, association) is performed by firmware. Driver just init the firmware, and set some configurations.

 

Orinoco driver

 

Note: Original Orinoco driver does not support host scan feature. You can download the host scan patch from the Orinoco driver web site. Then, we can see the scanning related codes from the Orinoco driver.

 

Initialization

__orinoco_program_rids(struct net_device *dev);

 Set the MAC address

Set up the link mode(CNFPORTTYPE) -> INFRA/AD_HOC

Set the channel/frequency

Set the desired ESSID

Set RTS threshold

Set bitrate

 

Active Scan

*Command

HERMES_INQ_SCAN

*Argument

No : So, we cannot set channel list for scanning.

* Usage

err = hermes_inquire(hw, HERMES_INQ_SCAN);

static inline int hermes_inquire(hermes_t *hw, u16 rid)

{return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL);}

 

* Channel mask

In Orinoco dirver, we can get the mask value for channel scanning using HERMES_RID_CHANNELLIST. But, we cannot set the value. It seems the value is set by firmware or chip.

err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, &priv->channel_mask);

So, we found we cannot change the channel list for scanning.

 

 

 

HostAP driver

 

0. Initialization

int prism2_setup_rids(struct net_device *dev) : hostap_hw.c

A lot of configurations are set in this function.

Port type is set. -> hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp);

temp value is set using hostap_get_porttype(local_info_t *local) function. We can set the mode into Managed by setting local.iw_mode -> IW_MODE_INFRA.

hostap_set_roaming() is called. -> set hostap_roaming mode.  (hostap.c )

 

1. Active Scan

* Command

HFA384X_RID_SCANREQUEST :

HFA384X_RID_HOSTSCAN     : faster, but requires firmware 1.3.x

* Argument

Channel List (channel_list) : unsigned 16 (bit mask)

   When ith(LSB 0, MSB 16) bit is 1, ith channel is scanned, when 0, ith channel is passed.  Ex) 0x01111111111 -> channel 11 is not scanned.

Transmission rate (txrate)

* Usage

struct hfa384x_scan_request scan_req;

memset(&scan_req, 0, sizeof(scan_req));

scan_req.channel_list = __constant_cpu_to_le16(0x3fff);

scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS);

if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, &scan_req,

              sizeof(scan_req))) {

             printk(KERN_DEBUG "SCANREQUEST failed\n");

             ret = -EINVAL;

}

 

2. Roaming

*Command

HFA384X_RID_JOINREQUEST

*Argument

Bssid

Channel

*Usage

struct hfa384x_join_request req;

memcpy(req.bssid, selected->bssid, 6);

req.channel = selected->chid;

if (local->func->set_rid(dev, HFA384X_RID_JOINREQUEST, &req, sizeof(req))) {

             printk(KERN_DEBUG "%s: JoinRequest failed\n", dev->name);

}

Please refer to : static void prism2_host_roaming(local_info_t *local) : hostap_info.c

 

3. Passive scanning

hostAP driver support ap_scan command(./prism_param wlan0 ap_scan <interval in secs>). Ap_scan command activate passive scanning. Currently, we don¡¯t know how active scanning is performed and why this command is supported(What for..).

 

When timer is expired, hostap_passive_scan() function is called. It seems only current channel is changed to next channel when this function is called. So, if we set the interval as 1sec, channel is changed per second, and client is disconnected to current AP and reassociate to new AP.

We have to figure it out why this is happening.

 

4. host_roaming mode.

 

Fortunately, hostAP driver and prism2 chipset allow us to change host_roaming mode. We can change the host roaming mode using prism_param util.

Host roaming mode 0: default mode. All scanning and roaming(authentication and association) is performed by firmware.

Host roaming mode 1: Roaming is performed by driver, but scanning is performed by firmware. Driver just uses scanning result from firmware to select new AP.

Roaming is performed in prism2_host_roaming() function. This function is called only when host_roaming mode is 1 and iw_mode is INFRA, and this function is called by handle_info_queue_scanresults()->handle_info_queue()-> HW IRQ.

Host roaming mode 2: All scanning and roaming should be performed manually. So, automatic handoff is performed in this mode. We can use this mode to apply our algorithm.

 

 

New hostAP driver

 

1. Strategy.

 

In prism2_init_local_data() (hostap_hw.c), the function name that will be called when passive scanning timer is expired using local->passive_scan_timer.function = hostap_passive_scan; We can use this thread by checking the signal strength of current AP instead of doing passive scan.

 

1. write the function for checking the signal strength of the current AP. In this function, we compare the signal strength with the threshold value. If it is lower than threshold value, we call function for active scan with our own channel list.

struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev)

if (local->func->get_rid(local->dev,

                                       HFA384X_RID_COMMSQUALITY,

                                       &sq, sizeof(sq), 1) >= 0) {

             local->wstats.qual.qual = le16_to_cpu(sq.comm_qual);

             local->wstats.qual.level = HFA384X_LEVEL_TO_dBm(

le16_to_cpu(sq.signal_level));

             local->wstats.qual.noise = HFA384X_LEVEL_TO_dBm(

                                     le16_to_cpu(sq.noise_level));

             local->wstats.qual.updated = 7;

}

 

2. change the function name: local->passive_scan_timer.function = check_signal_strengh¡¦.

 

 

 

 

 

 

Copyright © 2003 Sangho Shin