void update_recvframe_phyinfo(struct recv_frame *precvframe, struct phy_stat *pphy_status) { struct rtw_adapter *padapter = precvframe->adapter; struct rx_pkt_attrib *pattrib = &precvframe->attrib; struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); struct odm_phy_info *pPHYInfo = (struct odm_phy_info *)(&pattrib->phy_info); struct odm_packet_info pkt_info; u8 *sa = NULL, *da; struct sta_priv *pstapriv; struct sta_info *psta; struct sk_buff *skb = precvframe->pkt; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; u8 *wlanhdr = skb->data; pkt_info.bPacketMatchBSSID = false; pkt_info.bPacketToSelf = false; pkt_info.bPacketBeacon = false; pkt_info.bPacketMatchBSSID = (!ieee80211_is_ctl(hdr->frame_control) && !pattrib->icv_err && !pattrib->crc_err && !memcmp(get_hdr_bssid(wlanhdr), get_bssid(&padapter->mlmepriv), ETH_ALEN)); da = ieee80211_get_DA(hdr); pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && (!memcmp(da, myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && ieee80211_is_beacon(hdr->frame_control); pkt_info.StationID = 0xFF; if (pkt_info.bPacketBeacon) { if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true) sa = padapter->mlmepriv.cur_network.network.MacAddress; /* to do Ad-hoc */ } else { sa = ieee80211_get_SA(hdr); } pstapriv = &padapter->stapriv; psta = rtw_get_stainfo23a(pstapriv, sa); if (psta) { pkt_info.StationID = psta->mac_id; /* printk("%s ==> StationID(%d)\n", __FUNCTION__, pkt_info.StationID); */ } pkt_info.Rate = pattrib->mcs_rate; ODM_PhyStatusQuery23a(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &pkt_info); precvframe->psta = NULL; if (pkt_info.bPacketMatchBSSID && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) { if (psta) { precvframe->psta = psta; rtl8723a_process_phy_info(padapter, precvframe); } } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) { if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true) { if (psta) precvframe->psta = psta; } rtl8723a_process_phy_info(padapter, precvframe); } }
void update_recvframe_phyinfo(struct recv_frame *precvframe, struct phy_stat *pphy_status) { struct rtw_adapter *padapter = precvframe->adapter; struct rx_pkt_attrib *pattrib = &precvframe->attrib; struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); struct phy_info *pPHYInfo = &pattrib->phy_info; struct odm_packet_info pkt_info; u8 *sa = NULL, *da; struct sta_priv *pstapriv; struct sta_info *psta; struct sk_buff *skb = precvframe->pkt; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; bool matchbssid = false; u8 *bssid; matchbssid = (!ieee80211_is_ctl(hdr->frame_control) && !pattrib->icv_err && !pattrib->crc_err); if (matchbssid) { switch (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { case cpu_to_le16(IEEE80211_FCTL_TODS): bssid = hdr->addr1; break; case cpu_to_le16(IEEE80211_FCTL_FROMDS): bssid = hdr->addr2; break; case cpu_to_le16(0): bssid = hdr->addr3; break; default: bssid = NULL; matchbssid = false; } if (bssid) matchbssid = ether_addr_equal( get_bssid(&padapter->mlmepriv), bssid); } pkt_info.bPacketMatchBSSID = matchbssid; da = ieee80211_get_DA(hdr); pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && (!memcmp(da, myid(&padapter->eeprompriv), ETH_ALEN)); pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && ieee80211_is_beacon(hdr->frame_control); pkt_info.StationID = 0xFF; if (pkt_info.bPacketBeacon) { if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true) sa = padapter->mlmepriv.cur_network.network.MacAddress; /* to do Ad-hoc */ } else { sa = ieee80211_get_SA(hdr); } pstapriv = &padapter->stapriv; psta = rtw_get_stainfo23a(pstapriv, sa); if (psta) { pkt_info.StationID = psta->mac_id; /* printk("%s ==> StationID(%d)\n", __func__, pkt_info.StationID); */ } pkt_info.Rate = pattrib->mcs_rate; ODM_PhyStatusQuery23a(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &pkt_info); precvframe->psta = NULL; if (pkt_info.bPacketMatchBSSID && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) { if (psta) { precvframe->psta = psta; rtl8723a_process_phy_info(padapter, precvframe); } } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) { if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true) { if (psta) precvframe->psta = psta; } rtl8723a_process_phy_info(padapter, precvframe); } }