Commit e573aaa4 authored by Moritz Muehlenhoff's avatar Moritz Muehlenhoff Committed by Greg Kroah-Hartman
Browse files

Staging: wlan-ng: hfa384x.h: Coding style cleanups

parent 2407486b
Loading
Loading
Loading
Loading
+492 −591
Original line number Diff line number Diff line
@@ -56,12 +56,10 @@
#ifndef _HFA384x_H
#define _HFA384x_H

/*=============================================================*/
#define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))

#include <linux/if_ether.h>

/*------ Constants --------------------------------------------*/
/*--- Mins & Maxs -----------------------------------*/
#define		HFA384x_PORTID_MAX		((u16)7)
#define		HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX+1))
@@ -109,7 +107,8 @@
#define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
#define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)

/* Mask bits for discarding unwanted pieces in AUX format 16-bit address parts */
/* Mask bits for discarding unwanted pieces in AUX format
   16-bit address parts */
#define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
#define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)

@@ -124,7 +123,6 @@
#define		HFA384x_ADDR_CMD_MKOFF(f) \
		((u16)(((u32)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK))


/*--- Controller Memory addresses -------------------*/
#define		HFA3842_PDA_BASE	(0x007f0000UL)
#define		HFA3841_PDA_BASE	(0x003f0000UL)
@@ -265,15 +263,15 @@ API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
#define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
#define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
#define		HFA384x_RID_CNFAPBCNint		((u16)0xFC33)
#define		HFA384x_RID_CNFDBMADJUST  	((u16)0xFC46) // NEW
#define		HFA384x_RID_CNFWPADATA       	((u16)0xFC48) // 1.7.0
#define		HFA384x_RID_CNFDBMADJUST  	((u16)0xFC46)
#define		HFA384x_RID_CNFWPADATA       	((u16)0xFC48)
#define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
#define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
#define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA) // NEW STA
#define		HFA384x_RID_TXPOWERMAX        	((u16)0xFCBE) // 1.7.0/1.4.0
#define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA)
#define		HFA384x_RID_TXPOWERMAX        	((u16)0xFCBE)
#define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
#define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
#define		HFA384x_RID_HOSTSCAN          	((u16)0xFCE5) // NEW STA
#define		HFA384x_RID_HOSTSCAN          	((u16)0xFCE5)

#define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
#define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
@@ -321,10 +319,6 @@ PD Record codes
#define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
#define HFA384x_PDR_END_OF_PDA		((u16)0x0000)


/*=============================================================*/
/*------ Macros -----------------------------------------------*/

/*--- Register Test/Get/Set Field macros ------------------------*/

#define		HFA384x_CMD_AINFO_SET(value)		((u16)((u16)(value) << 8))
@@ -347,19 +341,14 @@ PD Record codes
#define HFA384x_STATE_INIT	1
#define HFA384x_STATE_RUNNING	2

/*=============================================================*/
/*------ Types and their related constants --------------------*/

/*-------------------------------------------------------------*/
/* Commonly used basic types */
typedef struct hfa384x_bytestr
{
typedef struct hfa384x_bytestr {
	u16 len;
	u8 data[0];
} __attribute__ ((packed)) hfa384x_bytestr_t;

typedef struct hfa384x_bytestr32
{
typedef struct hfa384x_bytestr32 {
	u16 len;
	u8 data[32];
} __attribute__ ((packed)) hfa384x_bytestr32_t;
@@ -370,16 +359,14 @@ Configuration Record Structures:
--------------------------------------------------------------------*/

/*-- Hardware/Firmware Component Information ----------*/
typedef struct hfa384x_compident
{
typedef struct hfa384x_compident {
	u16 id;
	u16 variant;
	u16 major;
	u16 minor;
} __attribute__ ((packed)) hfa384x_compident_t;

typedef struct hfa384x_caplevel
{
typedef struct hfa384x_caplevel {
	u16 role;
	u16 id;
	u16 variant;
@@ -400,31 +387,27 @@ Configuration Record Structures:
#define HFA384x_CREATEIBSS_JOINCREATEIBSS          0

/*-- Configuration Record: HostScanRequest (data portion only) --*/
typedef struct hfa384x_HostScanRequest_data
{
typedef struct hfa384x_HostScanRequest_data {
	u16 channelList;
	u16 txRate;
	hfa384x_bytestr32_t ssid;
} __attribute__ ((packed)) hfa384x_HostScanRequest_data_t;

/*-- Configuration Record: JoinRequest (data portion only) --*/
typedef struct hfa384x_JoinRequest_data
{
typedef struct hfa384x_JoinRequest_data {
	u8 bssid[WLAN_BSSID_LEN];
	u16 channel;
} __attribute__ ((packed)) hfa384x_JoinRequest_data_t;

/*-- Configuration Record: authenticateStation (data portion only) --*/
typedef struct hfa384x_authenticateStation_data
{
typedef struct hfa384x_authenticateStation_data {
	u8 address[ETH_ALEN];
	u16 status;
	u16 algorithm;
} __attribute__ ((packed)) hfa384x_authenticateStation_data_t;

/*-- Configuration Record: WPAData       (data portion only) --*/
typedef struct hfa384x_WPAData
{
typedef struct hfa384x_WPAData {
	u16 datalen;
	u8 data[0];		// max 80
} __attribute__ ((packed)) hfa384x_WPAData_t;
@@ -435,8 +418,7 @@ Information Record Structures: NIC Information

/*-- Information Record: DownLoadBuffer --*/
/* NOTE: The page and offset are in AUX format */
typedef struct hfa384x_downloadbuffer
{
typedef struct hfa384x_downloadbuffer {
	u16 page;
	u16 offset;
	u16 len;
@@ -449,16 +431,14 @@ Information Record Structures: NIC Information
#define HFA384x_PSTATUS_CONN_IBSS	((u16)3)

/*-- Information Record: commsquality --*/
typedef struct hfa384x_commsquality
{
typedef struct hfa384x_commsquality {
	u16 CQ_currBSS;
	u16 ASL_currBSS;
	u16 ANL_currFC;
} __attribute__ ((packed)) hfa384x_commsquality_t;

/*-- Information Record: dmbcommsquality --*/
typedef struct hfa384x_dbmcommsquality
{
typedef struct hfa384x_dbmcommsquality {
	u16 CQdbm_currBSS;
	u16 ASLdbm_currBSS;
	u16 ANLdbm_currFC;
@@ -470,8 +450,7 @@ FRAME STRUCTURES: Communication Frames
Communication Frames: Transmit Frames
--------------------------------------------------------------------*/
/*-- Communication Frame: Transmit Frame Structure --*/
typedef struct hfa384x_tx_frame
{
typedef struct hfa384x_tx_frame {
	u16 status;
	u16 reserved1;
	u16 reserved2;
@@ -531,8 +510,7 @@ Communication Frames: Test/Get/Set Field Values for Transmit Frames
Communication Frames: Receive Frames
--------------------------------------------------------------------*/
/*-- Communication Frame: Receive Frame Structure --*/
typedef struct hfa384x_rx_frame
{
typedef struct hfa384x_rx_frame {
	/*-- MAC rx descriptor (hfa384x byte order) --*/
	u16 status;
	u32 time;
@@ -595,8 +573,7 @@ Information Frames: Notification Frame Structures
--------------------------------------------------------------------*/

/*--  Inquiry Frame, Diagnose: Communication Tallies --*/
typedef struct hfa384x_CommTallies16
{
typedef struct hfa384x_CommTallies16 {
	u16 txunicastframes;
	u16 txmulticastframes;
	u16 txfragments;
@@ -620,8 +597,7 @@ typedef struct hfa384x_CommTallies16
	u16 rxmsginbadmsgfrag;
} __attribute__ ((packed)) hfa384x_CommTallies16_t;

typedef struct hfa384x_CommTallies32
{
typedef struct hfa384x_CommTallies32 {
	u32 txunicastframes;
	u32 txmulticastframes;
	u32 txfragments;
@@ -646,8 +622,7 @@ typedef struct hfa384x_CommTallies32
} __attribute__ ((packed)) hfa384x_CommTallies32_t;

/*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
typedef struct hfa384x_ScanResultSub
{
typedef struct hfa384x_ScanResultSub {
	u16 chid;
	u16 anl;
	u16 sl;
@@ -659,17 +634,14 @@ typedef struct hfa384x_ScanResultSub
	u16 proberesp_rate;
} __attribute__ ((packed)) hfa384x_ScanResultSub_t;

typedef struct hfa384x_ScanResult
{
typedef struct hfa384x_ScanResult {
	u16 rsvd;
	u16 scanreason;
	hfa384x_ScanResultSub_t
		result[HFA384x_SCANRESULT_MAX];
	 hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX];
} __attribute__ ((packed)) hfa384x_ScanResult_t;

/*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
typedef struct hfa384x_ChInfoResultSub
{
typedef struct hfa384x_ChInfoResultSub {
	u16 chid;
	u16 anl;
	u16 pnl;
@@ -679,16 +651,13 @@ typedef struct hfa384x_ChInfoResultSub
#define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
#define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)

typedef struct hfa384x_ChInfoResult
{
typedef struct hfa384x_ChInfoResult {
	u16 scanchannels;
	hfa384x_ChInfoResultSub_t
		result[HFA384x_CHINFORESULT_MAX];
	 hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX];
} __attribute__ ((packed)) hfa384x_ChInfoResult_t;

/*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
typedef struct hfa384x_HScanResultSub
{
typedef struct hfa384x_HScanResultSub {
	u16 chid;
	u16 anl;
	u16 sl;
@@ -701,12 +670,10 @@ typedef struct hfa384x_HScanResultSub
	u16 atim;
} __attribute__ ((packed)) hfa384x_HScanResultSub_t;

typedef struct hfa384x_HScanResult
{
typedef struct hfa384x_HScanResult {
	u16 nresult;
	u16 rsvd;
	hfa384x_HScanResultSub_t
		result[HFA384x_HSCANRESULT_MAX];
	 hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX];
} __attribute__ ((packed)) hfa384x_HScanResult_t;

/*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
@@ -719,20 +686,17 @@ typedef struct hfa384x_HScanResult
#define HFA384x_LINK_AP_INRANGE		((u16)5)
#define HFA384x_LINK_ASSOCFAIL		((u16)6)

typedef struct hfa384x_LinkStatus
{
typedef struct hfa384x_LinkStatus {
	u16 linkstatus;
} __attribute__ ((packed)) hfa384x_LinkStatus_t;


/*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/

#define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
#define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
#define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)

typedef struct hfa384x_AssocStatus
{
typedef struct hfa384x_AssocStatus {
	u16 assocstatus;
	u8 sta_addr[ETH_ALEN];
	/* old_ap_addr is only valid if assocstatus == 2 */
@@ -743,21 +707,18 @@ typedef struct hfa384x_AssocStatus

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

typedef struct hfa384x_AuthRequest
{
typedef struct hfa384x_AuthRequest {
	u8 sta_addr[ETH_ALEN];
	u16 algorithm;
} __attribute__ ((packed)) hfa384x_AuthReq_t;

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

typedef struct hfa384x_PSUserCount
{
typedef struct hfa384x_PSUserCount {
	u16 usercnt;
} __attribute__ ((packed)) hfa384x_PSUserCount_t;

typedef struct hfa384x_KeyIDChanged
{
typedef struct hfa384x_KeyIDChanged {
	u8 sta_addr[ETH_ALEN];
	u16 keyid;
} __attribute__ ((packed)) hfa384x_KeyIDChanged_t;
@@ -776,8 +737,7 @@ typedef union hfa384x_infodata {
	hfa384x_KeyIDChanged_t keyidchanged;
} __attribute__ ((packed)) hfa384x_infodata_t;

typedef struct hfa384x_InfFrame
{
typedef struct hfa384x_InfFrame {
	u16 framelen;
	u16 infotype;
	hfa384x_infodata_t info;
@@ -930,14 +890,12 @@ typedef union hfa384x_usbin {
	u8 boguspad[3000];
} __attribute__ ((packed)) hfa384x_usbin_t;


#ifdef __KERNEL__
/*--------------------------------------------------------------------
---  MAC state structure, argument to all functions --
---  Also, a collection of support types --
--------------------------------------------------------------------*/
typedef struct hfa384x_statusresult
{
typedef struct hfa384x_statusresult {
	u16 status;
	u16 resp0;
	u16 resp1;
@@ -951,8 +909,7 @@ typedef struct hfa384x_statusresult
/* The following hfa384x_* structures are arguments to
 * the usercb() for the different CTLX types.
 */
typedef struct hfa384x_rridresult
{
typedef struct hfa384x_rridresult {
	u16 rid;
	const void *riddata;
	unsigned int riddata_len;
@@ -976,13 +933,10 @@ struct hfa384x;

typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);

typedef void (*ctlx_usercb_t)(
	struct hfa384x	*hw,
	void		*ctlxresult,
	void		*usercb_data);
typedef void (*ctlx_usercb_t) (struct hfa384x *hw,
			       void *ctlxresult, void *usercb_data);

typedef struct hfa384x_usbctlx
{
typedef struct hfa384x_usbctlx {
	struct list_head list;

	size_t outbufsize;
@@ -1001,8 +955,7 @@ typedef struct hfa384x_usbctlx
	int variant;		/* Identifies cmd variant */
} hfa384x_usbctlx_t;

typedef struct hfa384x_usbctlxq
{
typedef struct hfa384x_usbctlxq {
	spinlock_t lock;
	struct list_head pending;
	struct list_head active;
@@ -1010,8 +963,7 @@ typedef struct hfa384x_usbctlxq
	struct list_head reapable;
} hfa384x_usbctlxq_t;

typedef struct hfa484x_metacmd
{
typedef struct hfa484x_metacmd {
	u16 cmd;

	u16 parm0;
@@ -1032,15 +984,13 @@ typedef struct hfa484x_metacmd
#define WLAN_ACCESS_DENY	3	/* Do not authenticate "denied" stations. */

/* XXX These are going away ASAP */
typedef struct prism2sta_authlist
{
typedef struct prism2sta_authlist {
	unsigned int cnt;
	u8 addr[WLAN_AUTH_MAX][ETH_ALEN];
	u8 assoc[WLAN_AUTH_MAX];
} prism2sta_authlist_t;

typedef struct prism2sta_accesslist
{
typedef struct prism2sta_accesslist {
	unsigned int modify;
	unsigned int cnt;
	u8 addr[WLAN_ACCESS_MAX][ETH_ALEN];
@@ -1048,8 +998,7 @@ typedef struct prism2sta_accesslist
	u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN];
} prism2sta_accesslist_t;

typedef struct hfa384x
{
typedef struct hfa384x {
	/* USB support data */
	struct usb_device *usb;
	struct urb rx_urb;
@@ -1164,7 +1113,6 @@ typedef struct hfa384x

	hfa384x_InfFrame_t *scanresults;


	prism2sta_authlist_t authlist;	/* Authenticated station list. */
	unsigned int accessmode;	/* Access mode. */
	prism2sta_accesslist_t allow;	/* Allowed station list. */
@@ -1172,59 +1120,35 @@ typedef struct hfa384x

} hfa384x_t;

/*=============================================================*/
/*--- Function Declarations -----------------------------------*/
/*=============================================================*/
void
hfa384x_create(
	hfa384x_t *hw,
	struct usb_device *usb);

void hfa384x_create(hfa384x_t *hw, struct usb_device *usb);
void hfa384x_destroy(hfa384x_t *hw);

int
hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis);
int
hfa384x_drvr_commtallies( hfa384x_t *hw);
int
hfa384x_drvr_disable(hfa384x_t *hw, u16 macport);
int
hfa384x_drvr_enable(hfa384x_t *hw, u16 macport);
int
hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
int
hfa384x_drvr_flashdl_disable(hfa384x_t *hw);
int
hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len);
int
hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
int
hfa384x_drvr_handover( hfa384x_t *hw, u8 *addr);
int
hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr);
int
hfa384x_drvr_ramdl_disable(hfa384x_t *hw);
int
hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len);
int
hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len);

int
hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);

static inline int
hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
int hfa384x_drvr_commtallies(hfa384x_t *hw);
int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport);
int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport);
int hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
int hfa384x_drvr_flashdl_disable(hfa384x_t *hw);
int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len);
int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
int hfa384x_drvr_handover(hfa384x_t *hw, u8 *addr);
int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr);
int hfa384x_drvr_ramdl_disable(hfa384x_t *hw);
int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len);
int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len);
int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);

static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
{
	int result = 0;
	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
	if ( result == 0 ) {
	if (result == 0)
		*((u16 *) val) = hfa384x2host_16(*((u16 *) val));
	}
	return result;
}

static inline int
hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
{
	u16 value = host2hfa384x_16(val);
	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
@@ -1232,17 +1156,13 @@ hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)

int
hfa384x_drvr_getconfig_async(hfa384x_t *hw,
                              u16        rid,
                              ctlx_usercb_t usercb,
                              void          *usercb_data);
			     u16 rid, ctlx_usercb_t usercb, void *usercb_data);

int
hfa384x_drvr_setconfig_async(hfa384x_t *hw,
			     u16 rid,
			     void *buf,
                              u16 len,
                              ctlx_usercb_t usercb,
                              void *usercb_data);
			     u16 len, ctlx_usercb_t usercb, void *usercb_data);

static inline int
hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val)
@@ -1252,46 +1172,27 @@ hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val)
					    NULL, NULL);
}

int hfa384x_drvr_start(hfa384x_t *hw);
int hfa384x_drvr_stop(hfa384x_t *hw);
int
hfa384x_drvr_start(hfa384x_t *hw);
int
hfa384x_drvr_stop(hfa384x_t *hw);
int
hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
void
hfa384x_tx_timeout(wlandevice_t *wlandev);

int
hfa384x_cmd_initialize(hfa384x_t *hw);
int
hfa384x_cmd_enable(hfa384x_t *hw, u16 macport);
int
hfa384x_cmd_disable(hfa384x_t *hw, u16 macport);
hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb,
		     p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
void hfa384x_tx_timeout(wlandevice_t *wlandev);

int hfa384x_cmd_initialize(hfa384x_t *hw);
int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport);
int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport);
int hfa384x_cmd_allocate(hfa384x_t *hw, u16 len);
int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable);
int
hfa384x_cmd_allocate(hfa384x_t *hw, u16 len);
int
hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable);
int
hfa384x_cmd_download(
	hfa384x_t *hw,
	u16 mode,
	u16 lowaddr,
	u16 highaddr,
	u16 codelen);
hfa384x_cmd_download(hfa384x_t *hw,
		     u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
void
hfa384x_copy_from_aux(
	hfa384x_t *hw,
	u32	cardaddr,
	u32	auxctl,
	void	*buf,
	unsigned int	len);
hfa384x_copy_from_aux(hfa384x_t *hw,
		      u32 cardaddr, u32 auxctl, void *buf, unsigned int len);
void
hfa384x_copy_to_aux(
	hfa384x_t *hw,
	u32	cardaddr,
	u32	auxctl,
	void	*buf,
	unsigned int	len);
hfa384x_copy_to_aux(hfa384x_t *hw,
		    u32 cardaddr, u32 auxctl, void *buf, unsigned int len);

#endif /* __KERNEL__ */