replace get_(d|s)a with ieee80211_get_(D|S)A

get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions.
Remove get_(d|s)a, use ieee80211_get_(D|S)A instead.

Link: https://lore.kernel.org/r/20210314090247.21181-2-insafonov@gmail.com
This commit is contained in:
Carlos Garces 2021-10-18 19:40:27 +02:00
parent 5ae45c1296
commit 158017aa86
4 changed files with 24 additions and 72 deletions

View File

@ -1498,7 +1498,7 @@ unsigned int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame)
if (padapter->wdinfo.driver_interface == DRIVER_WEXT)
report_survey_event(padapter, precv_frame);
p2p_listen_state_process(padapter, get_sa(pframe));
p2p_listen_state_process(padapter, ieee80211_get_SA((struct ieee80211_hdr *)pframe));
return _SUCCESS;
}
@ -1532,10 +1532,10 @@ _continue:
target_ie = rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_MANUFACTURER, NULL, &target_ielen);
if ((target_ie && (target_ielen == 4)) && (_TRUE == _rtw_memcmp((void *)target_ie, "Ozmo", 4))) {
/* psta->flag_atmel_rc = 1; */
unsigned char *sa_addr = get_sa(pframe);
unsigned char *sa_addr = ieee80211_get_SA((struct ieee80211_hdr *)pframe);
printk("%s: Find Ozmo RC -- %02x:%02x:%02x:%02x:%02x:%02x \n\n",
__func__, *sa_addr, *(sa_addr + 1), *(sa_addr + 2), *(sa_addr + 3), *(sa_addr + 4), *(sa_addr + 5));
memcpy(pstapriv->atmel_rc_pattern, get_sa(pframe), ETH_ALEN);
memcpy(pstapriv->atmel_rc_pattern, ieee80211_get_SA((struct ieee80211_hdr *)pframe), ETH_ALEN);
}
#endif
@ -1559,21 +1559,21 @@ _continue:
if (!_rtw_memcmp(p + 2, RC_OUI, sizeof(RC_OUI)))
goto _non_rc_device;
if (!_rtw_memcmp(p + 6, get_sa(pframe), ETH_ALEN)) {
if (!_rtw_memcmp(p + 6, ieee80211_get_SA((struct ieee80211_hdr *)pframe), ETH_ALEN)) {
RTW_INFO("%s, do rc pairing ("MAC_FMT"), but mac addr mismatch!("MAC_FMT")\n", __FUNCTION__,
MAC_ARG(get_sa(pframe)), MAC_ARG(p + 6));
MAC_ARG(ieee80211_get_SA((struct ieee80211_hdr *)pframe)), MAC_ARG(p + 6));
goto _non_rc_device;
}
RTW_INFO("%s, got the pairing device("MAC_FMT")\n", __FUNCTION__, MAC_ARG(get_sa(pframe)));
RTW_INFO("%s, got the pairing device("MAC_FMT")\n", __FUNCTION__, MAC_ARG(ieee80211_get_SA((struct ieee80211_hdr *)pframe)));
/* new a station */
psta = rtw_get_stainfo(pstapriv, get_sa(pframe));
psta = rtw_get_stainfo(pstapriv, ieee80211_get_SA((struct ieee80211_hdr *)pframe));
if (psta == NULL) {
/* allocate a new one */
RTW_INFO("going to alloc stainfo for rc="MAC_FMT"\n", MAC_ARG(get_sa(pframe)));
psta = rtw_alloc_stainfo(pstapriv, get_sa(pframe));
RTW_INFO("going to alloc stainfo for rc="MAC_FMT"\n", MAC_ARG(ieee80211_get_SA((struct ieee80211_hdr *)pframe)));
psta = rtw_alloc_stainfo(pstapriv, ieee80211_get_SA((struct ieee80211_hdr *)pframe));
if (psta == NULL) {
/* TODO: */
RTW_INFO(" Exceed the upper limit of supported clients...\n");
@ -1635,7 +1635,7 @@ _continue:
}
issue_probersp(padapter, get_sa(pframe), _FALSE);
issue_probersp(padapter, ieee80211_get_SA((struct ieee80211_hdr *)pframe), _FALSE);
return _SUCCESS;
@ -1685,7 +1685,7 @@ _issue_probersp:
if (((check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE &&
pmlmepriv->cur_network.join_res == _TRUE)) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
/* RTW_INFO("+issue_probersp during ap mode\n"); */
issue_probersp(padapter, get_sa(pframe), is_valid_p2p_probereq);
issue_probersp(padapter, ieee80211_get_SA((struct ieee80211_hdr *)pframe), is_valid_p2p_probereq);
}
}
@ -2325,7 +2325,7 @@ normal:
#endif /* CONFIG_IOCTL_CFG80211 */
/* check A1 matches or not */
if (!_rtw_memcmp(adapter_mac_addr(padapter), get_da(pframe), ETH_ALEN))
if (!_rtw_memcmp(adapter_mac_addr(padapter), ieee80211_get_DA((struct ieee80211_hdr *)pframe), ETH_ALEN))
return _SUCCESS;
if (!(pmlmeinfo->state & WIFI_FW_AUTH_STATE) || pmlmeext->join_abort)
@ -2776,7 +2776,7 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
RTW_INFO("%s\n", __FUNCTION__);
/* check A1 matches or not */
if (!_rtw_memcmp(adapter_mac_addr(padapter), get_da(pframe), ETH_ALEN))
if (!_rtw_memcmp(adapter_mac_addr(padapter), ieee80211_get_DA((struct ieee80211_hdr *)pframe), ETH_ALEN))
return _SUCCESS;
if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE)) || pmlmeext->join_abort)
@ -3603,7 +3603,7 @@ unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame)
#if 0
/* check A1 matches or not */
if (!_rtw_memcmp(adapter_mac_addr(padapter), get_da(pframe), ETH_ALEN))
if (!_rtw_memcmp(adapter_mac_addr(padapter), ieee80211_get_DA((struct ieee80211_hdr *)pframe), ETH_ALEN))
return _SUCCESS;
#endif

View File

@ -1010,14 +1010,14 @@ sint OnTDLS(_adapter *adapter, union recv_frame *precv_frame)
return ret;
}
ptdls_sta = rtw_get_stainfo(pstapriv, get_sa(ptr));
ptdls_sta = rtw_get_stainfo(pstapriv, ieee80211_get_SA((struct ieee80211_hdr *)ptr));
if (ptdls_sta == NULL) {
switch (*paction) {
case TDLS_SETUP_REQUEST:
case TDLS_DISCOVERY_REQUEST:
break;
default:
RTW_INFO("[TDLS] %s - Direct Link Peer = "MAC_FMT" not found for action = %d\n", __func__, MAC_ARG(get_sa(ptr)), *paction);
RTW_INFO("[TDLS] %s - Direct Link Peer = "MAC_FMT" not found for action = %d\n", __func__, MAC_ARG(ieee80211_get_SA((struct ieee80211_hdr *)ptr)), *paction);
ret = _FAIL;
goto exit;
}
@ -1980,8 +1980,8 @@ sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame)
struct recv_stat *prxstat = (struct recv_stat *) precv_frame->u.hdr.rx_head ;
u8 *pda, *psa, *pbssid, *ptr;
ptr = precv_frame->u.hdr.rx_data;
pda = get_da(ptr);
psa = get_sa(ptr);
pda = ieee80211_get_DA((struct ieee80211_hdr *)ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
pbssid = get_hdr_bssid(ptr);
@ -3821,8 +3821,8 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe)
pattrib->order = GetOrder(ptr);
if (type == IEEE80211_FTYPE_DATA) {
pda = get_da(ptr);
psa = get_sa(ptr);
pda = ieee80211_get_DA((struct ieee80211_hdr *)ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
pbssid = get_hdr_bssid(ptr);
memcpy(pattrib->dst, pda, ETH_ALEN);

View File

@ -1771,7 +1771,7 @@ int On_TDLS_Dis_Rsp(_adapter *padapter, union recv_frame *precv_frame)
/* WFDTDLS: for sigma test, not to setup direct link automatically */
ptdlsinfo->dev_discovered = _TRUE;
psa = get_sa(ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
ptdls_sta = rtw_get_stainfo(&(padapter->stapriv), psa);
if (ptdls_sta != NULL)
ptdls_sta->sta_stats.rx_tdls_disc_rsp_pkts++;
@ -1848,7 +1848,7 @@ sint On_TDLS_Setup_Req(_adapter *padapter, union recv_frame *precv_frame, struct
goto exit;
memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
psa = get_sa(ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
if (ptdlsinfo->sta_maximum == _TRUE) {
if (ptdls_sta == NULL)
@ -2064,7 +2064,7 @@ int On_TDLS_Setup_Rsp(_adapter *padapter, union recv_frame *precv_frame, struct
u32 timeout_interval = TDLS_TPK_RESEND_COUNT;
memset(&txmgmt, 0x00, sizeof(struct tdls_txmgmt));
psa = get_sa(ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
ptr += prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE + ETH_TYPE_LEN + PAYLOAD_TYPE_LEN;
parsing_length = ((union recv_frame *)precv_frame)->u.hdr.len
@ -2235,7 +2235,7 @@ int On_TDLS_Setup_Cfm(_adapter *padapter, union recv_frame *precv_frame, struct
u16 j, pairwise_count;
int ret = _SUCCESS;
psa = get_sa(ptr);
psa = ieee80211_get_SA((struct ieee80211_hdr *)ptr);
ptr += prx_pkt_attrib->hdrlen + prx_pkt_attrib->iv_len + LLC_HEADER_SIZE + ETH_TYPE_LEN + PAYLOAD_TYPE_LEN;
parsing_length = ((union recv_frame *)precv_frame)->u.hdr.len

View File

@ -263,54 +263,6 @@ __inline static unsigned char *get_ta(unsigned char *pframe)
return ta;
}
/* can't apply to mesh mode */
__inline static unsigned char *get_da(unsigned char *pframe)
{
unsigned char *da;
unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
switch (to_fr_ds) {
case 0x00: /* ToDs=0, FromDs=0 */
da = GetAddr1Ptr(pframe);
break;
case 0x01: /* ToDs=0, FromDs=1 */
da = GetAddr1Ptr(pframe);
break;
case 0x02: /* ToDs=1, FromDs=0 */
da = GetAddr3Ptr(pframe);
break;
default: /* ToDs=1, FromDs=1 */
da = GetAddr3Ptr(pframe);
break;
}
return da;
}
/* can't apply to mesh mode */
__inline static unsigned char *get_sa(unsigned char *pframe)
{
unsigned char *sa;
unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
switch (to_fr_ds) {
case 0x00: /* ToDs=0, FromDs=0 */
sa = get_addr2_ptr(pframe);
break;
case 0x01: /* ToDs=0, FromDs=1 */
sa = GetAddr3Ptr(pframe);
break;
case 0x02: /* ToDs=1, FromDs=0 */
sa = get_addr2_ptr(pframe);
break;
default: /* ToDs=1, FromDs=1 */
sa = GetAddr4Ptr(pframe);
break;
}
return sa;
}
/* can't apply to mesh mode */
__inline static unsigned char *get_hdr_bssid(unsigned char *pframe)
{