Skip to content

Commit

Permalink
rtl8192du: Remove dead code for CONFIG_P2P
Browse files Browse the repository at this point in the history
All of this functionality can be handled by cfg80211.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
  • Loading branch information
lwfinger committed Jul 21, 2014
1 parent a4fad2a commit 2c499cd
Show file tree
Hide file tree
Showing 25 changed files with 145 additions and 9,613 deletions.
8 changes: 0 additions & 8 deletions core/rtw_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,6 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network);
struct HT_info_element *pht_info = NULL;
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif /* CONFIG_P2P */
u8 cbw40_enable = 0;
u8 change_band = false;

Expand Down Expand Up @@ -952,11 +949,6 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf)
/* let pnetwork_mlmeext == pnetwork_mlme. */
memcpy(pnetwork_mlmeext, pnetwork, pnetwork->Length);

#ifdef CONFIG_P2P
memcpy(pwdinfo->p2p_group_ssid, pnetwork->Ssid.Ssid, pnetwork->Ssid.SsidLength);
pwdinfo->p2p_group_ssid_len = pnetwork->Ssid.SsidLength;
#endif /* CONFIG_P2P */

if (pmlmeext->bstart_bss) {
update_beacon(padapter, _TIM_IE_, NULL, false);

Expand Down
49 changes: 0 additions & 49 deletions core/rtw_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,6 @@ u8 rtw_sitesurvey_cmd(struct rtw_adapter *padapter, struct ndis_802_11_ssid *ssi
}
#endif

#ifdef CONFIG_P2P_PS
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1);
}
#endif /* CONFIG_P2P_PS */

ph2c = (struct cmd_obj *)kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
if (ph2c == NULL)
return _FAIL;
Expand Down Expand Up @@ -1831,44 +1825,6 @@ static void power_saving_wk_hdl(struct rtw_adapter *padapter, u8 *pbuf, int sz)
rtw_ps_processor(padapter);
}

#ifdef CONFIG_P2P
u8 p2p_protocol_wk_cmd(struct rtw_adapter *padapter, int intCmdType)
{
struct cmd_obj *ph2c;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
return res;

ph2c = (struct cmd_obj *)kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
if (ph2c == NULL) {
res = _FAIL;
goto exit;
}

pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
if (pdrvextra_cmd_parm == NULL) {
kfree(ph2c);
res = _FAIL;
goto exit;
}

pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID;
pdrvextra_cmd_parm->type_size = intCmdType; /* As the command tppe. */
pdrvextra_cmd_parm->pbuf = NULL; /* Must be NULL here */

init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_SET_DRV_EXTRA));

res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit:

return res;
}
#endif /* CONFIG_P2P */

u8 rtw_ps_cmd(struct rtw_adapter *padapter)
{
struct cmd_obj *ppscmd;
Expand Down Expand Up @@ -2092,11 +2048,6 @@ u8 rtw_drvextra_cmd_hdl(struct rtw_adapter *padapter, unsigned char *pbuf)
antenna_select_wk_hdl(padapter, pdrvextra_cmd->type_size);
break;
#endif
#ifdef CONFIG_P2P_PS
case P2P_PS_WK_CID:
p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size);
break;
#endif /* CONFIG_P2P_PS */
case P2P_PROTO_WK_CID:
/* Commented by Albert 2011/07/01 */
/* I used the type_size as the type command */
Expand Down
222 changes: 0 additions & 222 deletions core/rtw_ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,9 +1118,6 @@ void dump_ies(u8 *buf, u32 buf_len)
len = *(pos+1);

DBG_8192D("%s ID:%u, LEN:%u\n", __func__, id, len);
#ifdef CONFIG_P2P
dump_p2p_ie(pos, len);
#endif
dump_wps_ie(pos, len);

pos += (2+len);
Expand Down Expand Up @@ -1151,225 +1148,6 @@ void dump_wps_ie(u8 *ie, u32 ie_len)
}
}

#ifdef CONFIG_P2P
void dump_p2p_ie(u8 *ie, u32 ie_len)
{
u8 *pos = (u8 *)ie;
u8 id;
u16 len;

u8 *p2p_ie;
uint p2p_ielen;

p2p_ie = rtw_get_p2p_ie(ie, ie_len, NULL, &p2p_ielen);
if (p2p_ie != ie || p2p_ielen == 0)
return;

pos += 6;
while (pos-ie < ie_len) {
id = *pos;
len = RTW_GET_LE16(pos+1);

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

pos += (3 + len);
}
}

/**
* rtw_get_p2p_ie - Search P2P IE from a series of IEs
* @in_ie: Address of IEs to search
* @in_len: Length limit from in_ie
* @p2p_ie: If not NULL and P2P IE is found, P2P IE will be copied to the buf starting from p2p_ie
* @p2p_ielen: If not NULL and P2P IE is found, will set to the length of the entire P2P IE
*
* Returns: The address of the P2P IE found, or NULL
*/
u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
{
uint cnt = 0;
u8 *p2p_ie_ptr;
u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};

if (p2p_ielen != NULL)
*p2p_ielen = 0;

while (cnt < in_len) {
eid = in_ie[cnt];
if ((in_len < 0) || (cnt > MAX_IE_SZ)) {
dump_stack();
return NULL;
}
if ((eid == _VENDOR_SPECIFIC_IE_) &&
(_rtw_memcmp(&in_ie[cnt+2], p2p_oui, 4) == true)) {
p2p_ie_ptr = in_ie + cnt;

if (p2p_ie != NULL)
memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);

if (p2p_ielen != NULL)
*p2p_ielen = in_ie[cnt + 1] + 2;

return p2p_ie_ptr;

break;
} else {
cnt += in_ie[cnt + 1] + 2; /* goto next */
}
}
return NULL;
}

/**
* rtw_get_p2p_attr - Search a specific P2P attribute from a given P2P IE
* @p2p_ie: Address of P2P IE to search
* @p2p_ielen: Length limit from p2p_ie
* @target_attr_id: The attribute ID of P2P attribute to search
* @buf_attr: If not NULL and the P2P attribute is found, P2P attribute will be copied to the buf starting from buf_attr
* @len_attr: If not NULL and the P2P attribute is found, will set to the length of the entire P2P attribute
*
* Returns: the address of the specific WPS attribute found, or NULL
*/
u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id, u8 *buf_attr, u32 *len_attr)
{
u8 *attr_ptr = NULL;
u8 *target_attr_ptr = NULL;
u8 p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};

if (len_attr)
*len_attr = 0;

if (!p2p_ie || (p2p_ie[0] != _VENDOR_SPECIFIC_IE_) ||
(_rtw_memcmp(p2p_ie + 2, p2p_oui, 4) != true))
return attr_ptr;

/* 6 = 1(Element ID) + 1(Length) + 3 (OUI) + 1(OUI Type) */
attr_ptr = p2p_ie + 6; /* goto first attr */

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_len = attr_data_len + 3;

if (attr_id == target_attr_id) {
target_attr_ptr = attr_ptr;

if (buf_attr)
memcpy(buf_attr, attr_ptr, attr_len);

if (len_attr)
*len_attr = attr_len;

break;
} else {
attr_ptr += attr_len; /* goto next */
}
}

return target_attr_ptr;
}

/**
* rtw_get_p2p_attr_content - Search a specific P2P attribute content from a given P2P IE
* @p2p_ie: Address of P2P IE to search
* @p2p_ielen: Length limit from p2p_ie
* @target_attr_id: The attribute ID of P2P attribute to search
* @buf_content: If not NULL and the P2P attribute is found, P2P attribute content will be copied to the buf starting from buf_content
* @len_content: If not NULL and the P2P attribute is found, will set to the length of the P2P attribute content
*
* Returns: the address of the specific P2P attribute content found, or NULL
*/
u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id, u8 *buf_content, uint *len_content)
{
u8 *attr_ptr;
u32 attr_len;

if (len_content)
*len_content = 0;

attr_ptr = rtw_get_p2p_attr(p2p_ie, p2p_ielen, target_attr_id, NULL, &attr_len);

if (attr_ptr && attr_len) {
if (buf_content)
memcpy(buf_content, attr_ptr+3, attr_len-3);

if (len_content)
*len_content = attr_len-3;

return attr_ptr+3;
}

return NULL;
}

u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr)
{
u32 a_len;

*pbuf = attr_id;

RTW_PUT_LE16(pbuf + 1, attr_len);

if (pdata_attr)
memcpy(pbuf + 3, pdata_attr, attr_len);

a_len = attr_len + 3;

return a_len;
}

static uint rtw_p2p_attr_remove(u8 *ie, uint ielen_ori, u8 attr_id)
{
u8 *target_attr;
u32 target_attr_len;
uint ielen = ielen_ori;
int index = 0;

while (1) {
target_attr = rtw_get_p2p_attr(ie, ielen, attr_id, NULL, &target_attr_len);
if (target_attr && target_attr_len) {
u8 *next_attr = target_attr+target_attr_len;
uint remain_len = ielen-(next_attr-ie);

memset(target_attr, 0, target_attr_len);
memcpy(target_attr, next_attr, remain_len);
memset(target_attr+remain_len, 0, target_attr_len);
*(ie+1) -= target_attr_len;
ielen -= target_attr_len;
} else {
break;
}
}

return ielen;
}

void rtw_wlan_bssid_ex_remove_p2p_attr(struct wlan_bssid_ex *bss_ex, u8 attr_id)
{
u8 *p2p_ie;
uint p2p_ielen, p2p_ielen_ori;
int cnt;

p2p_ie = rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_,
bss_ex->IELength-_FIXED_IE_LENGTH_,
NULL, &p2p_ielen_ori);
if (p2p_ie) {
p2p_ielen = rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id);
if (p2p_ielen != p2p_ielen_ori) {
u8 *next_ie_ori = p2p_ie+p2p_ielen_ori;
u8 *next_ie = p2p_ie+p2p_ielen;
uint remain_len = bss_ex->IELength-(next_ie_ori-bss_ex->IEs);

memcpy(next_ie, next_ie_ori, remain_len);
memset(next_ie+remain_len, 0, p2p_ielen_ori-p2p_ielen);
bss_ex->IELength -= p2p_ielen_ori-p2p_ielen;
}
}
}

#endif /* CONFIG_P2P */

/* Baron adds to avoid FreeBSD warning */
int ieee80211_is_empty_essid(const char *essid, int essid_len)
{
Expand Down
29 changes: 2 additions & 27 deletions core/rtw_mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,9 @@ static void rtw_add_network(struct rtw_adapter *adapter,
struct mlme_priv *pmlmepriv =
&(((struct rtw_adapter *)adapter)->mlmepriv);

/* spin_lock_bh(&queue->lock); */

#if defined(CONFIG_P2P) && defined(CONFIG_P2P_REMOVE_GROUP_INFO)
rtw_wlan_bssid_ex_remove_p2p_attr(pnetwork, P2P_ATTR_GROUP_INFO);
#endif

update_current_network(adapter, pnetwork);

rtw_update_scanned_network(adapter, pnetwork);

/* spin_unlock_bh(&queue->lock); */

}

/* select the desired network based on the capability of the (i)bss. */
Expand Down Expand Up @@ -1039,12 +1030,6 @@ void rtw_surveydone_event_callback(struct rtw_adapter *adapter, u8 *pbuf)

spin_unlock_bh(&pmlmepriv->lock);

#ifdef CONFIG_P2P_PS
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
p2p_ps_wk_cmd(adapter, P2P_PS_SCAN_DONE, 0);
}
#endif /* CONFIG_P2P_PS */

rtw_os_xmit_schedule(adapter);
#ifdef CONFIG_CONCURRENT_MODE
rtw_os_xmit_schedule(adapter->pbuddy_adapter);
Expand Down Expand Up @@ -1227,10 +1212,6 @@ void rtw_indicate_disconnect(struct rtw_adapter *padapter)
rtw_led_control(padapter, LED_CTL_NO_LINK);
rtw_clear_scan_deny(padapter);
}
#ifdef CONFIG_P2P_PS
p2p_ps_wk_cmd(padapter, P2P_PS_DISABLE, 1);
#endif /* CONFIG_P2P_PS */

#ifdef CONFIG_LPS
#ifdef CONFIG_WOWLAN
if (padapter->pwrctrlpriv.wowlan_mode == false)
Expand Down Expand Up @@ -2055,14 +2036,8 @@ void rtw_dynamic_check_timer_handlder(struct rtw_adapter *adapter)
rtw_dynamic_chk_wk_cmd(adapter);

if (pregistrypriv->wifi_spec == 1) {
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
#endif
{
/* auto site survey */
rtw_auto_scan_handler(adapter);
}
/* auto site survey */
rtw_auto_scan_handler(adapter);
}
}

Expand Down
Loading

0 comments on commit 2c499cd

Please sign in to comment.