Skip to content

Commit

Permalink
Staging: wlan-ng: Remove use of WLAN_ADDR_LEN
Browse files Browse the repository at this point in the history
Replace the driver local WLAN_ADDR_LEN constant through the kernel-wide ETH_ALEN definiton.

Signed-off-by: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Moritz Muehlenhoff authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent 9cba46d commit 28b17a4
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 48 deletions.
32 changes: 17 additions & 15 deletions drivers/staging/wlan-ng/hfa384x.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@

#define HFA384x_LEVEL_TO_dBm(v) (0x100 + (v) * 100 / 255 - 100)

#include <linux/if_ether.h>

/*------ Constants --------------------------------------------*/
/*--- Mins & Maxs -----------------------------------*/
#define HFA384x_CMD_ALLOC_LEN_MIN ((u16)4)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1130,15 +1132,15 @@ 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;

/*-- 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;
Expand All @@ -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];
Expand Down Expand Up @@ -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;
Expand All @@ -1891,15 +1893,15 @@ 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;

/*-- Unsolicited Frame, MAC Mgmt: AssocRequest (AP Only) --*/

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;
Expand All @@ -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) --*/
Expand All @@ -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;

Expand Down Expand Up @@ -2460,17 +2462,17 @@ 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;

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
Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 9 additions & 9 deletions drivers/staging/wlan-ng/p80211conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
19 changes: 10 additions & 9 deletions drivers/staging/wlan-ng/p80211hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
/*================================================================*/
/* System Includes */

#include <linux/if_ether.h>

/*================================================================*/
/* Project Includes */

Expand All @@ -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
Expand Down Expand Up @@ -225,21 +226,21 @@ 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;

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
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions drivers/staging/wlan-ng/p80211netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <linux/wireless.h>
#include <linux/sockios.h>
#include <linux/etherdevice.h>
#include <linux/if_ether.h>

#include <asm/bitops.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions drivers/staging/wlan-ng/p80211wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <linux/if_ether.h>

/*================================================================*/
/* Project Includes */
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 11 additions & 10 deletions drivers/staging/wlan-ng/prism2sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <linux/delay.h>
#include <asm/byteorder.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>

#include "wlan_compat.h"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

/*
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -1767,15 +1768,15 @@ 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) {
if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
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;
}
Expand Down

0 comments on commit 28b17a4

Please sign in to comment.