Skip to content

Commit

Permalink
staging: r8723au: Additional source patches
Browse files Browse the repository at this point in the history
These changes are fixes that were discovered late in the testing
cycle.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Larry Finger authored and Greg Kroah-Hartman committed Apr 5, 2014
1 parent 364e30e commit c17416e
Show file tree
Hide file tree
Showing 31 changed files with 343 additions and 700 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/rtl8723au/core/rtw_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,10 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf, int len)
/* beacon interval */
/* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */
p = rtw_get_beacon_interval23a_from_ie(ie);
pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p);
pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p);

/* capability */
cap = RTW_GET_LE16(ie);
cap = get_unaligned_le16(ie);

/* SSID */
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len,
Expand Down
8 changes: 5 additions & 3 deletions drivers/staging/rtl8723au/core/rtw_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ int rtw_cmd_thread23a(void *context)

pcmdpriv->cmd_issued_cnt++;

pcmd->cmdsz = _RND4(pcmd->cmdsz);/* _RND4 */
pcmd->cmdsz = ALIGN(pcmd->cmdsz, 4);

memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);

Expand Down Expand Up @@ -1141,7 +1141,9 @@ static void traffic_status_watchdog(struct rtw_adapter *padapter)
u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false;
u8 bHigherBusyTxTraffic = false;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

#ifndef CONFIG_8723AU_BT_COEXIST
int BusyThreshold = 100;
#endif
/* */
/* Determine if our traffic is busy now */
/* */
Expand Down Expand Up @@ -1638,12 +1640,12 @@ u8 rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, unsigned char *pbuf)
case P2P_PS_WK_CID:
p2p_ps_wk_hdl23a(padapter, pdrvextra_cmd->type_size);
break;
#endif /* CONFIG_8723AU_P2P */
case P2P_PROTO_WK_CID:
/* Commented by Albert 2011/07/01 */
/* I used the type_size as the type command */
p2p_protocol_wk_hdl23a(padapter, pdrvextra_cmd->type_size);
break;
#endif /* CONFIG_8723AU_P2P */
#ifdef CONFIG_8723AU_AP_MODE
case CHECK_HIQ_WK_CID:
rtw_chk_hi_queue_hdl(padapter);
Expand Down
2 changes: 0 additions & 2 deletions drivers/staging/rtl8723au/core/rtw_efuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
u32 value32;
u8 readbyte;
u16 retry;
/* u32 start = rtw_get_current_time(); */

/* Write Address */
rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff));
Expand Down Expand Up @@ -137,7 +136,6 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
value32 = rtw_read32(Adapter, EFUSE_CTRL);

*pbuf = (u8)(value32 & 0xff);
/* DBG_8723A("ReadEFuseByte23a _offset:%08u, in %d ms\n", _offset , rtw_get_passing_time_ms23a(start)); */
}

/* */
Expand Down
24 changes: 12 additions & 12 deletions drivers/staging/rtl8723au/core/rtw_ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ inline u8 *rtw_set_ie23a_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,

ie_data[0] = ttl;
ie_data[1] = flags;
RTW_PUT_LE16((u8*)&ie_data[2], reason);
RTW_PUT_LE16((u8*)&ie_data[4], precedence);
put_unaligned_le16(reason, (u8*)&ie_data[2]);
put_unaligned_le16(precedence, (u8*)&ie_data[4]);

return rtw_set_ie23a(buf, 0x118, 6, ie_data, buf_len);
}
Expand Down Expand Up @@ -585,7 +585,7 @@ int rtw_parse_wpa_ie23a(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pair
/* pairwise_cipher */
if (left >= 2) {
/* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos);
count = get_unaligned_le16(pos);
pos += 2;
left -= 2;

Expand Down Expand Up @@ -661,7 +661,7 @@ int rtw_parse_wpa2_ie23a(u8* rsn_ie, int rsn_ie_len, int *group_cipher,
/* pairwise_cipher */
if (left >= 2) {
/* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos);
count = get_unaligned_le16(pos);
pos += 2;
left -= 2;

Expand Down Expand Up @@ -876,8 +876,8 @@ u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id,

while (attr_ptr - wps_ie < wps_ielen) {
/* 4 = 2(Attribute ID) + 2(Length) */
u16 attr_id = RTW_GET_BE16(attr_ptr);
u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2);
u16 attr_id = get_unaligned_be16(attr_ptr);
u16 attr_data_len = get_unaligned_be16(attr_ptr + 2);
u16 attr_len = attr_data_len + 4;

/* DBG_8723A("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
Expand Down Expand Up @@ -1246,8 +1246,8 @@ void dump_wps_ie23a(u8 *ie, u32 ie_len) {

pos+= 6;
while (pos-ie < ie_len) {
id = RTW_GET_BE16(pos);
len = RTW_GET_BE16(pos + 2);
id = get_unaligned_be16(pos);
len = get_unaligned_be16(pos + 2);

DBG_8723A("%s ID:0x%04x, LEN:%u\n", __func__, id, len);

Expand All @@ -1271,7 +1271,7 @@ void dump_p2p_ie23a(u8 *ie, u32 ie_len) {
pos += 6;
while (pos-ie < ie_len) {
id = *pos;
len = RTW_GET_LE16(pos+1);
len = get_unaligned_le16(pos+1);

DBG_8723A("%s ID:%u, LEN:%u\n", __func__, id, len);

Expand Down Expand Up @@ -1362,7 +1362,7 @@ u8 *rtw_get_p2p_attr23a(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id,
while (attr_ptr - p2p_ie < p2p_ielen) {
/* 3 = 1(Attribute ID) + 2(Length) */
u8 attr_id = *attr_ptr;
u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1);
u16 attr_data_len = get_unaligned_le16(attr_ptr + 1);
u16 attr_len = attr_data_len + 3;

/* DBG_8723A("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
Expand Down Expand Up @@ -1429,7 +1429,7 @@ u32 rtw_set_p2p_attr_content23a(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_at
*pbuf = attr_id;

/* u16*)(pbuf + 1) = cpu_to_le16(attr_len); */
RTW_PUT_LE16(pbuf + 1, attr_len);
put_unaligned_le16(attr_len, pbuf + 1);

if (pdata_attr)
memcpy(pbuf + 3, pdata_attr, attr_len);
Expand Down Expand Up @@ -1561,7 +1561,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id,
/* 1 (WFD IE) + 1 (Length) + 3 (OUI) + 1 (OUI Type) */
cnt = 6;
while (cnt < wfd_ielen) {
u16 attrlen = RTW_GET_BE16(wfd_ie + cnt + 1);
u16 attrlen = get_unaligned_be16(wfd_ie + cnt + 1);

attr_id = wfd_ie[cnt];
if (attr_id == target_attr_id) {
Expand Down
13 changes: 7 additions & 6 deletions drivers/staging/rtl8723au/core/rtw_mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ int _rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
return res;
}

#ifdef CONFIG_8723AU_AP_MODE
static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
{
if(*ppie)
Expand All @@ -78,6 +79,7 @@ static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen)
*ppie=NULL;
}
}
#endif

void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
{
Expand All @@ -94,9 +96,7 @@ void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_resp_ie, &pmlmepriv->p2p_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_go_probe_resp_ie, &pmlmepriv->p2p_go_probe_resp_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len);
#endif

#if defined(CONFIG_8723AU_P2P)
rtw_free_mlme_ie_data(&pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len);
rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len);
Expand Down Expand Up @@ -941,7 +941,7 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter)

/* set ips_deny_time to avoid enter IPS before LPS leave */
padapter->pwrctrlpriv.ips_deny_time =
rtw_get_current_time() + rtw_ms_to_systime23a(3000);
jiffies + msecs_to_jiffies(3000);

_clr_fwstate_(pmlmepriv, _FW_LINKED);

Expand Down Expand Up @@ -1675,7 +1675,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv
}

/* check ssid, if needed */
if (pmlmepriv->assoc_ssid.ssid && pmlmepriv->assoc_ssid.ssid_len) {
if (pmlmepriv->assoc_ssid.ssid_len) {
if (competitor->network.Ssid.ssid_len !=
pmlmepriv->assoc_ssid.ssid_len ||
memcmp(competitor->network.Ssid.ssid,
Expand Down Expand Up @@ -1839,8 +1839,7 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
res = _FAIL; /* try again */
goto exit;
}
psetkeyparm = (struct setkey_parm *)
kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
if (!psetkeyparm) {
kfree(pcmd);
res = _FAIL;
Expand Down Expand Up @@ -1902,6 +1901,8 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
"%x (must be 1 or 2 or 4 or 5)\n",
psecuritypriv->dot11PrivacyAlgrthm));
res = _FAIL;
kfree(pcmd);
kfree(psetkeyparm);
goto exit;
}

Expand Down
38 changes: 20 additions & 18 deletions drivers/staging/rtl8723au/core/rtw_mlme_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,9 @@ unsigned int OnProbeRsp23a(struct rtw_adapter *padapter,
struct recv_frame *precv_frame)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
#ifdef CONFIG_8723AU_P2P
struct sk_buff *skb = precv_frame->pkt;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
#ifdef CONFIG_8723AU_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
#endif

Expand Down Expand Up @@ -1309,10 +1309,10 @@ unsigned int OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *prec
goto asoc_class2_error;
}

capab_info = RTW_GET_LE16(pframe + sizeof(struct ieee80211_hdr_3addr));
capab_info = get_unaligned_le16(pframe + sizeof(struct ieee80211_hdr_3addr));
/* capab_info = le16_to_cpu(*(unsigned short *)(pframe + sizeof(struct ieee80211_hdr_3addr))); */
/* listen_interval = le16_to_cpu(*(unsigned short *)(pframe + sizeof(struct ieee80211_hdr_3addr)+2)); */
listen_interval = RTW_GET_LE16(pframe + sizeof(struct ieee80211_hdr_3addr)+2);
listen_interval = get_unaligned_le16(pframe + sizeof(struct ieee80211_hdr_3addr)+2);

left = pkt_len - (sizeof(struct ieee80211_hdr_3addr) + ie_offset);
pos = pframe + (sizeof(struct ieee80211_hdr_3addr) + ie_offset);
Expand Down Expand Up @@ -1665,7 +1665,7 @@ unsigned int OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *prec
rtw_get_wfd_attr_content(wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen);
if (attr_contentlen)
{
pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16(attr_content + 2);
pwdinfo->wfd_info->peer_rtsp_ctrlport = get_unaligned_be16(attr_content + 2);
DBG_8723A("[%s] Peer PORT NUM = %d\n", __func__, pwdinfo->wfd_info->peer_rtsp_ctrlport);
}
}
Expand Down Expand Up @@ -2091,7 +2091,7 @@ unsigned int OnAction23a_back23a(struct rtw_adapter *padapter, struct recv_frame
}
break;
case WLAN_ACTION_ADDBA_RESP: /* ADDBA response */
status = RTW_GET_LE16(&frame_body[3]);
status = get_unaligned_le16(&frame_body[3]);
tid = ((frame_body[5] >> 2) & 0x7);
if (status == 0) { /* successful */
DBG_8723A("agg_enable for TID =%d\n", tid);
Expand All @@ -2110,7 +2110,7 @@ unsigned int OnAction23a_back23a(struct rtw_adapter *padapter, struct recv_frame
~(1 << ((frame_body[3] >> 4) & 0xf));

/* reason_code = frame_body[4] | (frame_body[5] << 8); */
reason_code = RTW_GET_LE16(&frame_body[4]);
reason_code = get_unaligned_le16(&frame_body[4]);
} else if ((frame_body[3] & BIT(3)) == BIT(3)) {
tid = (frame_body[3] >> 4) & 0x0F;

Expand Down Expand Up @@ -4531,14 +4531,14 @@ static s32 rtw_action_public_decache(struct recv_frame *recv_frame, s32 token)

static unsigned int on_action_public23a_p2p(struct recv_frame *precv_frame)
{
struct rtw_adapter *padapter = precv_frame->adapter;
struct sk_buff *skb = precv_frame->pkt;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
u8 *pframe = skb->data;
uint len = skb->len;
u8 *frame_body;
u8 dialogToken = 0;
#ifdef CONFIG_8723AU_P2P
struct rtw_adapter *padapter = precv_frame->adapter;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
uint len = skb->len;
u8 *p2p_ie;
u32 p2p_ielen;
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
Expand Down Expand Up @@ -5262,9 +5262,7 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms)
unsigned short *fctrl;
unsigned int rate_len;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
#ifdef CONFIG_8723AU_AP_MODE
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
#endif
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;
Expand Down Expand Up @@ -5579,6 +5577,13 @@ void issue_probersp23a(struct rtw_adapter *padapter, unsigned char *da,
#ifdef CONFIG_8723AU_AP_MODE
u8 *pwps_ie;
uint wps_ielen;
u8 *ssid_ie;
int ssid_ielen;
int ssid_ielen_diff;
u8 buf[MAX_IE_SZ];
u8 *ies;
#endif
#if defined(CONFIG_8723AU_AP_MODE) || defined(CONFIG_8723AU_P2P)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
#endif
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
Expand All @@ -5588,11 +5593,6 @@ void issue_probersp23a(struct rtw_adapter *padapter, unsigned char *da,
#ifdef CONFIG_8723AU_P2P
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
#endif /* CONFIG_8723AU_P2P */
u8 *ssid_ie;
int ssid_ielen;
int ssid_ielen_diff;
u8 buf[MAX_IE_SZ];
u8 *ies;

/* DBG_8723A("%s\n", __func__); */

Expand Down Expand Up @@ -7559,6 +7559,7 @@ unsigned int send_beacon23a(struct rtw_adapter *padapter)
int issue = 0;
int poll = 0;
unsigned long start = jiffies;
unsigned int passing_time;

rtw_hal_set_hwreg23a(padapter, HW_VAR_BCN_VALID, NULL);
do {
Expand All @@ -7578,11 +7579,12 @@ unsigned int send_beacon23a(struct rtw_adapter *padapter)
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
return _FAIL;

passing_time = jiffies_to_msecs(jiffies - start);

if (!bxmitok) {
DBG_8723A("%s fail! %u ms\n", __func__, rtw_get_passing_time_ms23a(start));
DBG_8723A("%s fail! %u ms\n", __func__, passing_time);
return _FAIL;
} else {
unsigned int passing_time = jiffies_to_msecs(jiffies - start);

if (passing_time > 100 || issue > 3)
DBG_8723A("%s success, issue:%d, poll:%d, %u ms\n",
Expand Down
Loading

0 comments on commit c17416e

Please sign in to comment.