staging: rtl8723au: issue_beacon23a(): Use struct ieee80211_mgmt to build beacon
authorJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 19 Jun 2014 09:37:28 +0000 (11:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2014 20:08:51 +0000 (13:08 -0700)
Why on Earth we have two functions in the driver constructing beacon
frames is beyond me ... but one step at a time

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_mlme_ext.c

index 265fd2a..9b83a70 100644 (file)
@@ -2390,7 +2390,7 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms)
        struct xmit_frame *pmgntframe;
        struct pkt_attrib *pattrib;
        unsigned char *pframe;
-       struct ieee80211_hdr *pwlanhdr;
+       struct ieee80211_mgmt *mgmt;
        unsigned int rate_len;
        struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
        struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -2421,40 +2421,26 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms)
        memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
 
        pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-       pwlanhdr = (struct ieee80211_hdr *)pframe;
-
-       pwlanhdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
-                                             IEEE80211_STYPE_BEACON);
-       pwlanhdr->seq_ctrl = 0;
-
-       ether_addr_copy(pwlanhdr->addr1, bc_addr);
-       ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
-       ether_addr_copy(pwlanhdr->addr3, get_my_bssid23a(cur_network));
+       mgmt = (struct ieee80211_mgmt *)pframe;
 
-       pframe += sizeof(struct ieee80211_hdr_3addr);
-       pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
+       mgmt->frame_control =
+               cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
+       mgmt->seq_ctrl = 0;
 
-       /* below for ad-hoc mode */
+       ether_addr_copy(mgmt->da, bc_addr);
+       ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv));
+       ether_addr_copy(mgmt->bssid, get_my_bssid23a(cur_network));
 
        /* timestamp will be inserted by hardware */
-       pframe += 8;
-       pattrib->pktlen += 8;
-
-       /*  beacon interval: 2 bytes */
 
-       memcpy(pframe, (unsigned char *)
-              rtw_get_beacon_interval23a_from_ie(cur_network->IEs), 2);
+       put_unaligned_le16(cur_network->beacon_interval,
+                          &mgmt->u.beacon.beacon_int);
 
-       pframe += 2;
-       pattrib->pktlen += 2;
+       put_unaligned_le16(cur_network->capability,
+                          &mgmt->u.beacon.capab_info);
 
-       /*  capability info: 2 bytes */
-
-       memcpy(pframe, (unsigned char *)
-              rtw_get_capability23a_from_ie(cur_network->IEs), 2);
-
-       pframe += 2;
-       pattrib->pktlen += 2;
+       pframe = mgmt->u.beacon.variable;
+       pattrib->pktlen = offsetof(struct ieee80211_mgmt, u.beacon.variable);
 
        if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
                u8 *iebuf;