From: Moritz Muehlenhoff Date: Wed, 21 Jan 2009 21:00:41 +0000 (+0100) Subject: Staging: wlan-ng: Remove use of WLAN_ADDR_LEN X-Git-Tag: v2.6.30-rc1~202^2~630 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=28b17a4bdf148b7591c004efd10a8850d52849ec;p=karo-tx-linux.git Staging: wlan-ng: Remove use of WLAN_ADDR_LEN 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 --- diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h index f7d69e084e65..b88bfe437822 100644 --- 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, Dynamic Config Entities 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_authenticateStation_data /*-- 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_ChannelInfoRequest_data /*-- 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 */ diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index dfc7b3a1e9c9..342715af82d7 100644 --- 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 *wlandev, u32 ethconv, struct sk_buff *skb 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"); diff --git a/drivers/staging/wlan-ng/p80211hdr.h b/drivers/staging/wlan-ng/p80211hdr.h index f4a1a34ff0a7..0a7163fdfcdc 100644 --- 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 fctl) 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: diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c index 59e5ad10dbda..8081058ebe9a 100644 --- 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 long arg) /* 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(netdevice_t *dev, void *addr) 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; diff --git a/drivers/staging/wlan-ng/p80211wext.c b/drivers/staging/wlan-ng/p80211wext.c index 0d570f1f378c..f817fe4c16f5 100644 --- 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(wlandevice_t *wlandev, int assoc) /* 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) diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index b279c97cbc02..a871cbb158d8 100644 --- 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(wlandevice_t *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(wlandevice_t *wlandev, */ 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(wlandevice_t *wlandev, ** 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(wlandevice_t *wlandev, 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(wlandevice_t *wlandev, 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(wlandevice_t *wlandev, 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(wlandevice_t *wlandev, 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(wlandevice_t *wlandev, 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; }