staging: rtl8723au: Fold get_hdr_bssid() into update_recvframe_phyinfo()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:33 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:11:58 +0000 (13:11 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/hal/rtl8723au_recv.c
drivers/staging/rtl8723au/include/wifi.h

index 6857e5e7dfebb9c00d7a634963cc8bb056beab4e..3a266abe9ad59a1e59c61e9cb0774c857cb9daf1 100644 (file)
@@ -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 &&
index e7c34b73ff1d7227e8997265f2696bee61df708e..1c1b2f6a2287bef8a1736c2d0b949332bc53370e 100644 (file)
@@ -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
 ------------------------------------------------------------------------------*/