From: Jes Sorensen Date: Fri, 9 May 2014 13:03:33 +0000 (+0200) Subject: staging: rtl8723au: Fold get_hdr_bssid() into update_recvframe_phyinfo() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9c4a961debe9ec8a6b87fa921396e170d7d5cf93;p=linux-beck.git staging: rtl8723au: Fold get_hdr_bssid() into update_recvframe_phyinfo() Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c index 6857e5e7dfeb..3a266abe9ad5 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c @@ -201,14 +201,36 @@ void update_recvframe_phyinfo(struct recv_frame *precvframe, 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 = - (!ieee80211_is_ctl(hdr->frame_control) && - !pattrib->icv_err && - !pattrib->crc_err && - !memcmp(get_hdr_bssid(wlanhdr), - get_bssid(&padapter->mlmepriv), ETH_ALEN)); + 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 && diff --git a/drivers/staging/rtl8723au/include/wifi.h b/drivers/staging/rtl8723au/include/wifi.h index e7c34b73ff1d..1c1b2f6a2287 100644 --- a/drivers/staging/rtl8723au/include/wifi.h +++ b/drivers/staging/rtl8723au/include/wifi.h @@ -158,35 +158,6 @@ enum WIFI_REG_DOMAIN { (((ieee80211_has_tods(pbuf)<<1) | \ ieee80211_has_fromds(pbuf)) == 3 ? 30 : 24))) & 0x000f) -static inline unsigned char *get_hdr_bssid(unsigned char *pframe) -{ - unsigned char *sa; - unsigned int to_fr_ds; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) pframe; - - to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) | - ieee80211_has_fromds(hdr->frame_control); - - switch (to_fr_ds) { - case 0x00: /* ToDs=0, FromDs=0 */ - sa = hdr->addr3; - break; - case 0x01: /* ToDs=0, FromDs=1 */ - sa = hdr->addr2; - break; - case 0x02: /* ToDs=1, FromDs=0 */ - sa = hdr->addr1; - break; - case 0x03: /* ToDs=1, FromDs=1 */ - sa = hdr->addr1; - break; - default: - sa = NULL; /* */ - break; - } - return sa; -} - /*----------------------------------------------------------------------------- Below is for the security related definition ------------------------------------------------------------------------------*/