diff options
Diffstat (limited to 'drivers/staging/wlan-ng/prism2sta.c')
-rw-r--r-- | drivers/staging/wlan-ng/prism2sta.c | 91 |
1 files changed, 62 insertions, 29 deletions
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 6cd09352f893..ed751f418db9 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -83,8 +83,6 @@ #include "hfa384x.h" #include "prism2mgmt.h" -#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a))) - /* Create a string of printable chars from something that might not be */ /* It's recommended that the str be 4*len + 1 bytes long */ #define wlan_mkprintstr(buf, buflen, str, strlen) \ @@ -99,8 +97,8 @@ } else { \ (str)[j] = '\\'; \ (str)[j+1] = 'x'; \ - (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \ - (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \ + (str)[j+2] = hex_asc_hi((buf)[i]); \ + (str)[j+3] = hex_asc_lo((buf)[i]); \ j += 4; \ } \ } \ @@ -124,13 +122,17 @@ MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms"); MODULE_LICENSE("Dual MPL/GPL"); +void prism2_connect_result(wlandevice_t *wlandev, u8 failed); +void prism2_disconnected(wlandevice_t *wlandev); +void prism2_roamed(wlandevice_t *wlandev); + static int prism2sta_open(wlandevice_t *wlandev); static int prism2sta_close(wlandevice_t *wlandev); static void prism2sta_reset(wlandevice_t *wlandev); static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, - p80211_hdr_t *p80211_hdr, - p80211_metawep_t *p80211_wep); -static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg); + union p80211_hdr *p80211_hdr, + struct p80211_metawep *p80211_wep); +static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg); static int prism2sta_getcardinfo(wlandevice_t *wlandev); static int prism2sta_globalsetup(wlandevice_t *wlandev); static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev); @@ -266,8 +268,8 @@ static void prism2sta_reset(wlandevice_t *wlandev) * process thread ----------------------------------------------------------------*/ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, - p80211_hdr_t *p80211_hdr, - p80211_metawep_t *p80211_wep) + union p80211_hdr *p80211_hdr, + struct p80211_metawep *p80211_wep) { hfa384x_t *hw = (hfa384x_t *) wlandev->priv; int result; @@ -307,7 +309,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, * Call context: * process thread ----------------------------------------------------------------*/ -static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) +static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg) { hfa384x_t *hw = (hfa384x_t *) wlandev->priv; @@ -364,9 +366,9 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) break; /* ignore me. */ case DIDmsg_lnxreq_ifstate: { - p80211msg_lnxreq_ifstate_t *ifstatemsg; + struct p80211msg_lnxreq_ifstate *ifstatemsg; pr_debug("Received mlme ifstate request\n"); - ifstatemsg = (p80211msg_lnxreq_ifstate_t *) msg; + ifstatemsg = (struct p80211msg_lnxreq_ifstate *) msg; result = prism2sta_ifstate(wlandev, ifstatemsg->ifstate.data); @@ -385,11 +387,11 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) result = prism2mgmt_autojoin(wlandev, msg); break; case DIDmsg_lnxreq_commsquality:{ - p80211msg_lnxreq_commsquality_t *qualmsg; + struct p80211msg_lnxreq_commsquality *qualmsg; pr_debug("Received commsquality request\n"); - qualmsg = (p80211msg_lnxreq_commsquality_t *) msg; + qualmsg = (struct p80211msg_lnxreq_commsquality *) msg; qualmsg->link.status = P80211ENUM_msgitem_status_data_ok; @@ -401,6 +403,7 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS); qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS); qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC); + qualmsg->txrate.data = hw->txrate; break; } @@ -1300,6 +1303,9 @@ void prism2sta_processing_defer(struct work_struct *data) (portstatus == HFA384x_PSTATUS_CONN_IBSS) ? WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA; + /* signal back up to cfg80211 layer */ + prism2_connect_result(wlandev, P80211ENUM_truth_false); + /* Get the ball rolling on the comms quality stuff */ prism2sta_commsqual_defer(&hw->commsqual_bh); } @@ -1315,25 +1321,16 @@ void prism2sta_processing_defer(struct work_struct *data) * Indicate Deauthentication * Block Transmits, Ignore receives of data frames */ - if (hw->join_ap == 2) { - hfa384x_JoinRequest_data_t joinreq; - joinreq = hw->joinreq; - /* Send the join request */ - hfa384x_drvr_setconfig(hw, - HFA384x_RID_JOINREQUEST, - &joinreq, - HFA384x_RID_JOINREQUEST_LEN); + if (wlandev->netdev->type == ARPHRD_ETHER) printk(KERN_INFO - "linkstatus=DISCONNECTED (re-submitting join)\n"); - } else { - if (wlandev->netdev->type == ARPHRD_ETHER) - printk(KERN_INFO - "linkstatus=DISCONNECTED (unhandled)\n"); - } + "linkstatus=DISCONNECTED (unhandled)\n"); wlandev->macmode = WLAN_MACMODE_NONE; netif_carrier_off(wlandev->netdev); + /* signal back up to cfg80211 layer */ + prism2_disconnected(wlandev); + break; case HFA384x_LINK_AP_CHANGE: @@ -1376,6 +1373,9 @@ void prism2sta_processing_defer(struct work_struct *data) hw->link_status = HFA384x_LINK_CONNECTED; netif_carrier_on(wlandev->netdev); + /* signal back up to cfg80211 layer */ + prism2_roamed(wlandev); + break; case HFA384x_LINK_AP_OUTOFRANGE: @@ -1435,6 +1435,9 @@ void prism2sta_processing_defer(struct work_struct *data) netif_carrier_off(wlandev->netdev); + /* signal back up to cfg80211 layer */ + prism2_connect_result(wlandev, P80211ENUM_truth_true); + break; default: @@ -1446,7 +1449,6 @@ void prism2sta_processing_defer(struct work_struct *data) } wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED); - p80211wext_event_associated(wlandev, wlandev->linkstatus); failed: return; @@ -1985,6 +1987,9 @@ void prism2sta_commsqual_defer(struct work_struct *data) hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh); wlandevice_t *wlandev = hw->wlandev; hfa384x_bytestr32_t ssid; + struct p80211msg_dot11req_mibget msg; + p80211item_uint32_t *mibitem = (p80211item_uint32_t *) + &msg.mibattribute.data; int result = 0; if (hw->wlandev->hwremoved) @@ -2013,6 +2018,34 @@ void prism2sta_commsqual_defer(struct work_struct *data) le16_to_cpu(hw->qual.ANL_currFC)); } + /* Get the signal rate */ + msg.msgcode = DIDmsg_dot11req_mibget; + mibitem->did = DIDmib_p2_p2MAC_p2CurrentTxRate; + result = p80211req_dorequest(wlandev, (u8 *) &msg); + + if (result) { + pr_debug("get signal rate failed, result = %d\n", + result); + goto done; + } + + switch (mibitem->data) { + case HFA384x_RATEBIT_1: + hw->txrate = 10; + break; + case HFA384x_RATEBIT_2: + hw->txrate = 20; + break; + case HFA384x_RATEBIT_5dot5: + hw->txrate = 55; + break; + case HFA384x_RATEBIT_11: + hw->txrate = 110; + break; + default: + pr_debug("Bad ratebit (%d)\n", mibitem->data); + } + /* Lastly, we need to make sure the BSSID didn't change on us */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CURRENTBSSID, |