From jmm@debian.org Wed Jan 21 16:31:43 2009 From: Moritz Muehlenhoff Date: Wed, 21 Jan 2009 22:00:41 +0100 Subject: Staging: wlan-ng: Remove use of WLAN_ADDR_LEN To: greg@kroah.com Cc: Moritz Muehlenhoff Message-ID: <1232571646-32579-2-git-send-email-jmm@debian.org> Replace the driver local WLAN_ADDR_LEN constant through the kernel-wide ETH_ALEN definiton. Signed-off-by: Moritz Muehlenhoff Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x.h | 32 +++++++++++++++++--------------- drivers/staging/wlan-ng/p80211conv.c | 18 +++++++++--------- drivers/staging/wlan-ng/p80211hdr.h | 19 ++++++++++--------- drivers/staging/wlan-ng/p80211netdev.c | 7 ++++--- drivers/staging/wlan-ng/p80211wext.c | 5 +++-- drivers/staging/wlan-ng/prism2sta.c | 21 +++++++++++---------- 6 files changed, 54 insertions(+), 48 deletions(-) --- a/drivers/staging/wlan-ng/hfa384x.h +++ b/drivers/staging/wlan-ng/hfa384x.h @@ -61,6 +61,8 @@ #define HFA384x_LEVEL_TO_dBm(v) (0x100 + (v) * 100 / 255 - 100) +#include + /*------ Constants --------------------------------------------*/ /*--- Mins & Maxs -----------------------------------*/ #define HFA384x_CMD_ALLOC_LEN_MIN ((u16)4) @@ -450,7 +452,7 @@ Configuration RID Lengths: Network Param include the len or code fields) --------------------------------------------------------------------*/ /* TODO: fill in the rest of these */ -#define HFA384x_RID_GROUPADDR_LEN ((u16)16 * WLAN_ADDR_LEN) +#define HFA384x_RID_GROUPADDR_LEN ((u16)16 * ETH_ALEN) #define HFA384x_RID_CREATEIBSS_LEN ((u16)0) #define HFA384x_RID_FRAGTHRESH_LEN ((u16)0) #define HFA384x_RID_RTSTHRESH_LEN ((u16)0) @@ -1130,7 +1132,7 @@ typedef struct hfa384x_JoinRequest_data /*-- Configuration Record: authenticateStation (data portion only) --*/ typedef struct hfa384x_authenticateStation_data { - u8 address[WLAN_ADDR_LEN]; + u8 address[ETH_ALEN]; u16 status; u16 algorithm; } __attribute__((packed)) hfa384x_authenticateStation_data_t; @@ -1138,7 +1140,7 @@ typedef struct hfa384x_authenticateStati /*-- Configuration Record: associateStation (data portion only) --*/ typedef struct hfa384x_associateStation_data { - u8 address[WLAN_ADDR_LEN]; + u8 address[ETH_ALEN]; u16 status; u16 type; } __attribute__((packed)) hfa384x_associateStation_data_t; @@ -1153,7 +1155,7 @@ typedef struct hfa384x_ChannelInfoReques /*-- Configuration Record: WEPKeyMapping (data portion only) --*/ typedef struct hfa384x_WEPKeyMapping { - u8 address[WLAN_ADDR_LEN]; + u8 address[ETH_ALEN]; u16 key_index; u8 key[16]; u8 mic_transmit_key[4]; @@ -1880,9 +1882,9 @@ typedef struct hfa384x_LinkStatus typedef struct hfa384x_AssocStatus { u16 assocstatus; - u8 sta_addr[WLAN_ADDR_LEN]; + u8 sta_addr[ETH_ALEN]; /* old_ap_addr is only valid if assocstatus == 2 */ - u8 old_ap_addr[WLAN_ADDR_LEN]; + u8 old_ap_addr[ETH_ALEN]; u16 reason; u16 reserved; } __attribute__((packed)) hfa384x_AssocStatus_t; @@ -1891,7 +1893,7 @@ typedef struct hfa384x_AssocStatus typedef struct hfa384x_AuthRequest { - u8 sta_addr[WLAN_ADDR_LEN]; + u8 sta_addr[ETH_ALEN]; u16 algorithm; } __attribute__((packed)) hfa384x_AuthReq_t; @@ -1899,7 +1901,7 @@ typedef struct hfa384x_AuthRequest typedef struct hfa384x_AssocRequest { - u8 sta_addr[WLAN_ADDR_LEN]; + u8 sta_addr[ETH_ALEN]; u16 type; u8 wpa_data[80]; } __attribute__((packed)) hfa384x_AssocReq_t; @@ -1912,8 +1914,8 @@ typedef struct hfa384x_AssocRequest typedef struct hfa384x_MicFailure { - u8 sender[WLAN_ADDR_LEN]; - u8 dest[WLAN_ADDR_LEN]; + u8 sender[ETH_ALEN]; + u8 dest[ETH_ALEN]; } __attribute__((packed)) hfa384x_MicFailure_t; /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ @@ -1925,7 +1927,7 @@ typedef struct hfa384x_PSUserCount typedef struct hfa384x_KeyIDChanged { - u8 sta_addr[WLAN_ADDR_LEN]; + u8 sta_addr[ETH_ALEN]; u16 keyid; } __attribute__((packed)) hfa384x_KeyIDChanged_t; @@ -2460,7 +2462,7 @@ typedef struct hfa484x_metacmd typedef struct prism2sta_authlist { unsigned int cnt; - u8 addr[WLAN_AUTH_MAX][WLAN_ADDR_LEN]; + u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; u8 assoc[WLAN_AUTH_MAX]; } prism2sta_authlist_t; @@ -2468,9 +2470,9 @@ typedef struct prism2sta_accesslist { unsigned int modify; unsigned int cnt; - u8 addr[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; + u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; unsigned int cnt1; - u8 addr1[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; + u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; } prism2sta_accesslist_t; typedef struct hfa384x @@ -2552,7 +2554,7 @@ typedef struct hfa384x /* Group Addresses - right now, there are up to a total of MAX_GRP_ADDR group addresses */ - u8 dot11_grp_addr[MAX_GRP_ADDR][WLAN_ADDR_LEN]; + u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN]; unsigned int dot11_grpcnt; /* Component Identities */ --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -198,21 +198,21 @@ int skb_ether_to_p80211( wlandevice_t *w switch ( wlandev->macmode ) { case WLAN_MACMODE_IBSS_STA: - memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a3, wlandev->bssid, WLAN_ADDR_LEN); + memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, ETH_ALEN); + memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, ETH_ALEN); + memcpy(p80211_hdr->a3.a3, wlandev->bssid, ETH_ALEN); break; case WLAN_MACMODE_ESS_STA: fc |= host2ieee16(WLAN_SET_FC_TODS(1)); - memcpy(p80211_hdr->a3.a1, wlandev->bssid, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, WLAN_ADDR_LEN); + memcpy(p80211_hdr->a3.a1, wlandev->bssid, ETH_ALEN); + memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, ETH_ALEN); + memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, ETH_ALEN); break; case WLAN_MACMODE_ESS_AP: fc |= host2ieee16(WLAN_SET_FC_FROMDS(1)); - memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a2, wlandev->bssid, WLAN_ADDR_LEN); - memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, WLAN_ADDR_LEN); + memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, ETH_ALEN); + memcpy(p80211_hdr->a3.a2, wlandev->bssid, ETH_ALEN); + memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, ETH_ALEN); break; default: WLAN_LOG_ERROR("Error: Converting eth to wlan in unknown mode.\n"); --- a/drivers/staging/wlan-ng/p80211hdr.h +++ b/drivers/staging/wlan-ng/p80211hdr.h @@ -63,6 +63,8 @@ /*================================================================*/ /* System Includes */ +#include + /*================================================================*/ /* Project Includes */ @@ -75,7 +77,6 @@ /* Constants */ /*--- Sizes -----------------------------------------------*/ -#define WLAN_ADDR_LEN 6 #define WLAN_CRC_LEN 4 #define WLAN_BSSID_LEN 6 #define WLAN_BSS_TS_LEN 8 @@ -225,9 +226,9 @@ typedef struct p80211_hdr_a3 { u16 fc; u16 dur; - u8 a1[WLAN_ADDR_LEN]; - u8 a2[WLAN_ADDR_LEN]; - u8 a3[WLAN_ADDR_LEN]; + u8 a1[ETH_ALEN]; + u8 a2[ETH_ALEN]; + u8 a3[ETH_ALEN]; u16 seq; } __attribute__((packed)) p80211_hdr_a3_t; @@ -235,11 +236,11 @@ typedef struct p80211_hdr_a4 { u16 fc; u16 dur; - u8 a1[WLAN_ADDR_LEN]; - u8 a2[WLAN_ADDR_LEN]; - u8 a3[WLAN_ADDR_LEN]; + u8 a1[ETH_ALEN]; + u8 a2[ETH_ALEN]; + u8 a3[ETH_ALEN]; u16 seq; - u8 a4[WLAN_ADDR_LEN]; + u8 a4[ETH_ALEN]; } __attribute__((packed)) p80211_hdr_a4_t; typedef union p80211_hdr @@ -282,7 +283,7 @@ inline static u16 p80211_headerlen(u16 f case WLAN_FTYPE_DATA: hdrlen = WLAN_HDR_A3_LEN; if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) { - hdrlen += WLAN_ADDR_LEN; + hdrlen += ETH_ALEN; } break; case WLAN_FTYPE_CTL: --- a/drivers/staging/wlan-ng/p80211netdev.c +++ b/drivers/staging/wlan-ng/p80211netdev.c @@ -70,6 +70,7 @@ #include #include #include +#include #include #include @@ -347,7 +348,7 @@ static void p80211netdev_rx_bh(unsigned /* perform mcast filtering */ if (wlandev->netdev->flags & IFF_ALLMULTI) { /* allow my local address through */ - if (memcmp(hdr->a1, wlandev->netdev->dev_addr, WLAN_ADDR_LEN) != 0) { + if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) { /* but reject anything else that isn't multicast */ if (!(hdr->a1[0] & 0x01)) { dev_kfree_skb(skb); @@ -728,8 +729,8 @@ static int p80211knetdev_set_mac_address macaddr->did = DIDmib_dot11mac_dot11OperationTable_dot11MACAddress; macaddr->status = P80211ENUM_msgitem_status_data_ok; macaddr->len = sizeof(macaddr->data); - macaddr->data.len = WLAN_ADDR_LEN; - memcpy(&macaddr->data.data, new_addr->sa_data, WLAN_ADDR_LEN); + macaddr->data.len = ETH_ALEN; + memcpy(&macaddr->data.data, new_addr->sa_data, ETH_ALEN); /* Set up the resultcode argument */ resultcode->did = DIDmsg_dot11req_mibset_resultcode; --- a/drivers/staging/wlan-ng/p80211wext.c +++ b/drivers/staging/wlan-ng/p80211wext.c @@ -51,6 +51,7 @@ #include #include #include +#include /*================================================================*/ /* Project Includes */ @@ -1805,9 +1806,9 @@ int p80211wext_event_associated(wlandevi /* Send the association state first */ data.ap_addr.sa_family = ARPHRD_ETHER; if (assoc) { - memcpy(data.ap_addr.sa_data, wlandev->bssid, WLAN_ADDR_LEN); + memcpy(data.ap_addr.sa_data, wlandev->bssid, ETH_ALEN); } else { - memset(data.ap_addr.sa_data, 0, WLAN_ADDR_LEN); + memset(data.ap_addr.sa_data, 0, ETH_ALEN); } if (wlan_wext_write) --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -70,6 +70,7 @@ #include #include #include +#include #include "wlan_compat.h" @@ -920,7 +921,7 @@ static int prism2sta_getcardinfo(wlandev /* Collect the MAC address */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR, - wlandev->netdev->dev_addr, WLAN_ADDR_LEN); + wlandev->netdev->dev_addr, ETH_ALEN); if ( result != 0 ) { WLAN_LOG_ERROR("Failed to retrieve mac address\n"); goto failed; @@ -1588,7 +1589,7 @@ static void prism2sta_inf_assocstatus(wl */ for (i = 0; i < hw->authlist.cnt; i++) - if (memcmp(rec.sta_addr, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0) + if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0) break; if (i >= hw->authlist.cnt) { @@ -1662,7 +1663,7 @@ static void prism2sta_inf_authreq_defer( ** authentication. */ - memcpy(rec.address, inf->info.authreq.sta_addr, WLAN_ADDR_LEN); + memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN); rec.status = P80211ENUM_status_unspec_failure; /* @@ -1679,7 +1680,7 @@ static void prism2sta_inf_authreq_defer( for (i = 0; i < hw->authlist.cnt; i++) if (memcmp(rec.address, hw->authlist.addr[i], - WLAN_ADDR_LEN) == 0) { + ETH_ALEN) == 0) { rec.status = P80211ENUM_status_successful; break; } @@ -1715,8 +1716,8 @@ static void prism2sta_inf_authreq_defer( addr = hw->allow.addr1[0]; } - for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN) - if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) { + for (i = 0; i < cnt; i++, addr += ETH_ALEN) + if (memcmp(rec.address, addr, ETH_ALEN) == 0) { rec.status = P80211ENUM_status_successful; break; } @@ -1745,8 +1746,8 @@ static void prism2sta_inf_authreq_defer( rec.status = P80211ENUM_status_successful; - for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN) - if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) { + for (i = 0; i < cnt; i++, addr += ETH_ALEN) + if (memcmp(rec.address, addr, ETH_ALEN) == 0) { rec.status = P80211ENUM_status_unspec_failure; break; } @@ -1767,7 +1768,7 @@ static void prism2sta_inf_authreq_defer( if (rec.status == P80211ENUM_status_successful) { for (i = 0; i < hw->authlist.cnt; i++) - if (memcmp(rec.address, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0) + if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN) == 0) break; if (i >= hw->authlist.cnt) { @@ -1775,7 +1776,7 @@ static void prism2sta_inf_authreq_defer( rec.status = P80211ENUM_status_ap_full; } else { memcpy(hw->authlist.addr[hw->authlist.cnt], - rec.address, WLAN_ADDR_LEN); + rec.address, ETH_ALEN); hw->authlist.cnt++; added = 1; }