diff options
Diffstat (limited to 'drivers/staging/ath6kl/os/linux/ar6000_drv.c')
-rw-r--r-- | drivers/staging/ath6kl/os/linux/ar6000_drv.c | 1617 |
1 files changed, 836 insertions, 781 deletions
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 126a36a2daa6..97d6ce63b5c0 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -47,8 +47,8 @@ #define LINUX_HACK_FUDGE_FACTOR 16 #define BDATA_BDADDR_OFFSET 28 -A_UINT8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -A_UINT8 null_mac[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; +u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +u8 null_mac[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; #ifdef DEBUG @@ -60,7 +60,7 @@ A_UINT8 null_mac[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; #define ATH_DEBUG_HTC_RAW ATH_DEBUG_MAKE_MODULE_MASK(5) #define ATH_DEBUG_HCI_BRIDGE ATH_DEBUG_MAKE_MODULE_MASK(6) -static ATH_DEBUG_MASK_DESCRIPTION driver_debug_desc[] = { +static struct ath_debug_mask_description driver_debug_desc[] = { { ATH_DEBUG_DBG_LOG , "Target Debug Logs"}, { ATH_DEBUG_WLAN_CONNECT , "WLAN connect"}, { ATH_DEBUG_WLAN_SCAN , "WLAN scan"}, @@ -102,7 +102,7 @@ MODULE_LICENSE("Dual BSD/GPL"); #define APTC_LOWER_THROUGHPUT_THRESHOLD 2000 /* Kbps */ typedef struct aptc_traffic_record { - A_BOOL timerScheduled; + bool timerScheduled; struct timeval samplingTS; unsigned long bytesReceived; unsigned long bytesTransmitted; @@ -114,7 +114,7 @@ APTC_TRAFFIC_RECORD aptcTR; #ifdef EXPORT_HCI_BRIDGE_INTERFACE // callbacks registered by HCI transport driver -HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks = { NULL }; +struct hci_transport_callbacks ar6kHciTransCallbacks = { NULL }; #endif unsigned int processDot11Hdr = 0; @@ -123,7 +123,7 @@ int bmienable = BMIENABLE_DEFAULT; char ifname[IFNAMSIZ] = {0,}; int wlaninitmode = WLAN_INIT_MODE_DEFAULT; -unsigned int bypasswmi = 0; +static bool bypasswmi; unsigned int debuglevel = 0; int tspecCompliance = ATHEROS_COMPLIANCE; unsigned int busspeedlow = 0; @@ -165,7 +165,7 @@ unsigned int eppingtest=0; module_param_string(ifname, ifname, sizeof(ifname), 0644); module_param(wlaninitmode, int, 0644); module_param(bmienable, int, 0644); -module_param(bypasswmi, uint, 0644); +module_param(bypasswmi, bool, 0644); module_param(debuglevel, uint, 0644); module_param(tspecCompliance, int, 0644); module_param(onebitmode, uint, 0644); @@ -207,7 +207,7 @@ unsigned int _mboxnum = HTC_MAILBOX_NUM_MAX; #define mboxnum &_mboxnum #ifdef DEBUG -A_UINT32 g_dbg_flags = DBG_DEFAULTS; +u32 g_dbg_flags = DBG_DEFAULTS; unsigned int debugflags = 0; int debugdriver = 0; unsigned int debughtc = 0; @@ -254,22 +254,22 @@ module_param(blocktx, int, 0644); #endif /* BLOCK_TX_PATH_FLAG */ typedef struct user_rssi_compensation_t { - A_UINT16 customerID; + u16 customerID; union { - A_UINT16 a_enable; - A_UINT16 bg_enable; - A_UINT16 enable; + u16 a_enable; + u16 bg_enable; + u16 enable; }; - A_INT16 bg_param_a; - A_INT16 bg_param_b; - A_INT16 a_param_a; - A_INT16 a_param_b; - A_UINT32 reserved; + s16 bg_param_a; + s16 bg_param_b; + s16 a_param_a; + s16 a_param_b; + u32 reserved; } USER_RSSI_CPENSATION; static USER_RSSI_CPENSATION rssi_compensation_param; -static A_INT16 rssi_compensation_table[96]; +static s16 rssi_compensation_table[96]; int reconnect_flag = 0; static ar6k_pal_config_t ar6k_pal_config_g; @@ -281,7 +281,7 @@ static void ar6000_cleanup_module(void); int ar6000_init(struct net_device *dev); static int ar6000_open(struct net_device *dev); static int ar6000_close(struct net_device *dev); -static void ar6000_init_control_info(AR_SOFTC_T *ar); +static void ar6000_init_control_info(struct ar6_softc *ar); static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev); void ar6000_destroy(struct net_device *dev, unsigned int unregister); @@ -292,7 +292,7 @@ static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev); static void disconnect_timer_handler(unsigned long ptr); -void read_rssi_compensation_param(AR_SOFTC_T *ar); +void read_rssi_compensation_param(struct ar6_softc *ar); /* for android builds we call external APIs that handle firmware download and configuration */ #ifdef ANDROID_ENV @@ -305,33 +305,33 @@ extern void android_module_exit(void); /* * HTC service connection handlers */ -static A_STATUS ar6000_avail_ev(void *context, void *hif_handle); +static int ar6000_avail_ev(void *context, void *hif_handle); -static A_STATUS ar6000_unavail_ev(void *context, void *hif_handle); +static int ar6000_unavail_ev(void *context, void *hif_handle); -A_STATUS ar6000_configure_target(AR_SOFTC_T *ar); +int ar6000_configure_target(struct ar6_softc *ar); -static void ar6000_target_failure(void *Instance, A_STATUS Status); +static void ar6000_target_failure(void *Instance, int Status); -static void ar6000_rx(void *Context, HTC_PACKET *pPacket); +static void ar6000_rx(void *Context, struct htc_packet *pPacket); static void ar6000_rx_refill(void *Context,HTC_ENDPOINT_ID Endpoint); -static void ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPackets); +static void ar6000_tx_complete(void *Context, struct htc_packet_queue *pPackets); -static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPacket); +static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, struct htc_packet *pPacket); #ifdef ATH_AR6K_11N_SUPPORT -static void ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num); +static void ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, u16 num); #endif static void ar6000_deliver_frames_to_nw_stack(void * dev, void *osbuf); //static void ar6000_deliver_frames_to_bt_stack(void * dev, void *osbuf); -static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length); +static struct htc_packet *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length); -static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count); +static void ar6000_refill_amsdu_rxbufs(struct ar6_softc *ar, int Count); -static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar); +static void ar6000_cleanup_amsdu_rxbufs(struct ar6_softc *ar); static ssize_t ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, @@ -343,18 +343,18 @@ ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t count); -static A_STATUS -ar6000_sysfs_bmi_init(AR_SOFTC_T *ar); +static int +ar6000_sysfs_bmi_init(struct ar6_softc *ar); /* HCI PAL callback function declarations */ -A_STATUS ar6k_setup_hci_pal(AR_SOFTC_T *ar); -void ar6k_cleanup_hci_pal(AR_SOFTC_T *ar); +int ar6k_setup_hci_pal(struct ar6_softc *ar); +void ar6k_cleanup_hci_pal(struct ar6_softc *ar); static void -ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar); +ar6000_sysfs_bmi_deinit(struct ar6_softc *ar); -A_STATUS -ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode); +int +ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode); /* * Static variables @@ -364,13 +364,13 @@ struct net_device *ar6000_devices[MAX_AR6000]; static int is_netdev_registered; extern struct iw_handler_def ath_iw_handler_def; DECLARE_WAIT_QUEUE_HEAD(arEvent); -static void ar6000_cookie_init(AR_SOFTC_T *ar); -static void ar6000_cookie_cleanup(AR_SOFTC_T *ar); -static void ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie); -static struct ar_cookie *ar6000_alloc_cookie(AR_SOFTC_T *ar); +static void ar6000_cookie_init(struct ar6_softc *ar); +static void ar6000_cookie_cleanup(struct ar6_softc *ar); +static void ar6000_free_cookie(struct ar6_softc *ar, struct ar_cookie * cookie); +static struct ar_cookie *ar6000_alloc_cookie(struct ar6_softc *ar); #ifdef USER_KEYS -static A_STATUS ar6000_reinstall_keys(AR_SOFTC_T *ar,A_UINT8 key_op_ctrl); +static int ar6000_reinstall_keys(struct ar6_softc *ar,u8 key_op_ctrl); #endif #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT @@ -402,39 +402,38 @@ static struct net_device_ops ar6000_netdev_ops = { */ #define REPORT_DEBUG_LOGS_TO_APP -A_STATUS -ar6000_set_host_app_area(AR_SOFTC_T *ar) +int +ar6000_set_host_app_area(struct ar6_softc *ar) { - A_UINT32 address, data; + u32 address, data; struct host_app_area_s host_app_area; /* Fetch the address of the host_app_area_s instance in the host interest area */ address = TARG_VTOP(ar->arTargetType, HOST_INTEREST_ITEM_ADDRESS(ar, hi_app_host_interest)); - if (ar6000_ReadRegDiag(ar->arHifDevice, &address, &data) != A_OK) { + if (ar6000_ReadRegDiag(ar->arHifDevice, &address, &data) != 0) { return A_ERROR; } address = TARG_VTOP(ar->arTargetType, data); host_app_area.wmi_protocol_ver = WMI_PROTOCOL_VERSION; if (ar6000_WriteDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&host_app_area, - sizeof(struct host_app_area_s)) != A_OK) + (u8 *)&host_app_area, + sizeof(struct host_app_area_s)) != 0) { return A_ERROR; } - return A_OK; + return 0; } -A_UINT32 -dbglog_get_debug_hdr_ptr(AR_SOFTC_T *ar) +u32 dbglog_get_debug_hdr_ptr(struct ar6_softc *ar) { - A_UINT32 param; - A_UINT32 address; - A_STATUS status; + u32 param; + u32 address; + int status; address = TARG_VTOP(ar->arTargetType, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbglog_hdr)); if ((status = ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)¶m, 4)) != A_OK) + (u8 *)¶m, 4)) != 0) { param = 0; } @@ -447,22 +446,21 @@ dbglog_get_debug_hdr_ptr(AR_SOFTC_T *ar) * data stuctures over the diagnostic window. */ void -ar6000_dbglog_init_done(AR_SOFTC_T *ar) +ar6000_dbglog_init_done(struct ar6_softc *ar) { - ar->dbglog_init_done = TRUE; + ar->dbglog_init_done = true; } -A_UINT32 -dbglog_get_debug_fragment(A_INT8 *datap, A_UINT32 len, A_UINT32 limit) +u32 dbglog_get_debug_fragment(s8 *datap, u32 len, u32 limit) { - A_INT32 *buffer; - A_UINT32 count; - A_UINT32 numargs; - A_UINT32 length; - A_UINT32 fraglen; + s32 *buffer; + u32 count; + u32 numargs; + u32 length; + u32 fraglen; count = fraglen = 0; - buffer = (A_INT32 *)datap; + buffer = (s32 *)datap; length = (limit >> 2); if (len <= limit) { @@ -479,18 +477,18 @@ dbglog_get_debug_fragment(A_INT8 *datap, A_UINT32 len, A_UINT32 limit) } void -dbglog_parse_debug_logs(A_INT8 *datap, A_UINT32 len) +dbglog_parse_debug_logs(s8 *datap, u32 len) { - A_INT32 *buffer; - A_UINT32 count; - A_UINT32 timestamp; - A_UINT32 debugid; - A_UINT32 moduleid; - A_UINT32 numargs; - A_UINT32 length; + s32 *buffer; + u32 count; + u32 timestamp; + u32 debugid; + u32 moduleid; + u32 numargs; + u32 length; count = 0; - buffer = (A_INT32 *)datap; + buffer = (s32 *)datap; length = (len >> 2); while (count < length) { debugid = DBGLOG_GET_DBGID(buffer[count]); @@ -520,14 +518,14 @@ dbglog_parse_debug_logs(A_INT8 *datap, A_UINT32 len) } int -ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) +ar6000_dbglog_get_debug_logs(struct ar6_softc *ar) { - A_UINT32 data[8]; /* Should be able to accomodate struct dbglog_buf_s */ - A_UINT32 address; - A_UINT32 length; - A_UINT32 dropped; - A_UINT32 firstbuf; - A_UINT32 debug_hdr_ptr; + u32 data[8]; /* Should be able to accommodate struct dbglog_buf_s */ + u32 address; + u32 length; + u32 dropped; + u32 firstbuf; + u32 debug_hdr_ptr; if (!ar->dbglog_init_done) return A_ERROR; @@ -540,7 +538,7 @@ ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) } /* block out others */ - ar->dbgLogFetchInProgress = TRUE; + ar->dbgLogFetchInProgress = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); @@ -552,13 +550,13 @@ ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) address = TARG_VTOP(ar->arTargetType, debug_hdr_ptr); length = 4 /* sizeof(dbuf) */ + 4 /* sizeof(dropped) */; A_MEMZERO(data, sizeof(data)); - ar6000_ReadDataDiag(ar->arHifDevice, address, (A_UCHAR *)data, length); + ar6000_ReadDataDiag(ar->arHifDevice, address, (u8 *)data, length); address = TARG_VTOP(ar->arTargetType, data[0] /* dbuf */); firstbuf = address; dropped = data[1]; /* dropped */ length = 4 /* sizeof(next) */ + 4 /* sizeof(buffer) */ + 4 /* sizeof(bufsize) */ + 4 /* sizeof(length) */ + 4 /* sizeof(count) */ + 4 /* sizeof(free) */; A_MEMZERO(data, sizeof(data)); - ar6000_ReadDataDiag(ar->arHifDevice, address, (A_UCHAR *)&data, length); + ar6000_ReadDataDiag(ar->arHifDevice, address, (u8 *)&data, length); do { address = TARG_VTOP(ar->arTargetType, data[1] /* buffer*/); @@ -568,12 +566,12 @@ ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) if (ar->log_cnt > (DBGLOG_HOST_LOG_BUFFER_SIZE - length)) { ar->log_cnt = 0; } - if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&ar->log_buffer[ar->log_cnt], length)) + if(0 != ar6000_ReadDataDiag(ar->arHifDevice, address, + (u8 *)&ar->log_buffer[ar->log_cnt], length)) { break; } - ar6000_dbglog_event(ar, dropped, (A_INT8*)&ar->log_buffer[ar->log_cnt], length); + ar6000_dbglog_event(ar, dropped, (s8 *)&ar->log_buffer[ar->log_cnt], length); ar->log_cnt += length; } else { AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("Length: %d (Total size: %d)\n", @@ -583,8 +581,8 @@ ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) address = TARG_VTOP(ar->arTargetType, data[0] /* next */); length = 4 /* sizeof(next) */ + 4 /* sizeof(buffer) */ + 4 /* sizeof(bufsize) */ + 4 /* sizeof(length) */ + 4 /* sizeof(count) */ + 4 /* sizeof(free) */; A_MEMZERO(data, sizeof(data)); - if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&data, length)) + if(0 != ar6000_ReadDataDiag(ar->arHifDevice, address, + (u8 *)&data, length)) { break; } @@ -592,14 +590,14 @@ ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) } while (address != firstbuf); } - ar->dbgLogFetchInProgress = FALSE; + ar->dbgLogFetchInProgress = false; - return A_OK; + return 0; } void -ar6000_dbglog_event(AR_SOFTC_T *ar, A_UINT32 dropped, - A_INT8 *buffer, A_UINT32 length) +ar6000_dbglog_event(struct ar6_softc *ar, u32 dropped, + s8 *buffer, u32 length) { #ifdef REPORT_DEBUG_LOGS_TO_APP #define MAX_WIRELESS_EVENT_SIZE 252 @@ -608,13 +606,13 @@ ar6000_dbglog_event(AR_SOFTC_T *ar, A_UINT32 dropped, * There seems to be a limitation on the length of message that could be * transmitted to the user app via this mechanism. */ - A_UINT32 send, sent; + u32 send, sent; sent = 0; send = dbglog_get_debug_fragment(&buffer[sent], length - sent, MAX_WIRELESS_EVENT_SIZE); while (send) { - ar6000_send_event_to_app(ar, WMIX_DBGLOG_EVENTID, (A_UINT8*)&buffer[sent], send); + ar6000_send_event_to_app(ar, WMIX_DBGLOG_EVENTID, (u8 *)&buffer[sent], send); sent += send; send = dbglog_get_debug_fragment(&buffer[sent], length - sent, MAX_WIRELESS_EVENT_SIZE); @@ -624,7 +622,7 @@ ar6000_dbglog_event(AR_SOFTC_T *ar, A_UINT32 dropped, dropped, length)); /* Interpret the debug logs */ - dbglog_parse_debug_logs((A_INT8*)buffer, length); + dbglog_parse_debug_logs((s8 *)buffer, length); #endif /* REPORT_DEBUG_LOGS_TO_APP */ } @@ -633,7 +631,7 @@ static int __init ar6000_init_module(void) { static int probed = 0; - A_STATUS status; + int status; OSDRV_CALLBACKS osdrvCallbacks; a_module_debug_support_init(); @@ -694,7 +692,7 @@ ar6000_init_module(void) #endif /* CONFIG_HOST_GPIO_SUPPORT */ status = HIFInit(&osdrvCallbacks); - if(status != A_OK) + if (status) return -ENODEV; return 0; @@ -738,12 +736,12 @@ ar6000_cleanup_module(void) void aptcTimerHandler(unsigned long arg) { - A_UINT32 numbytes; - A_UINT32 throughput; - AR_SOFTC_T *ar; - A_STATUS status; + u32 numbytes; + u32 throughput; + struct ar6_softc *ar; + int status; - ar = (AR_SOFTC_T *)arg; + ar = (struct ar6_softc *)arg; A_ASSERT(ar != NULL); A_ASSERT(!timer_pending(&aptcTimer)); @@ -757,12 +755,12 @@ aptcTimerHandler(unsigned long arg) throughput = ((numbytes * 8)/APTC_TRAFFIC_SAMPLING_INTERVAL); /* Kbps */ if (throughput < APTC_LOWER_THROUGHPUT_THRESHOLD) { /* Enable Sleep and delete the timer */ - A_ASSERT(ar->arWmiReady == TRUE); + A_ASSERT(ar->arWmiReady == true); AR6000_SPIN_UNLOCK(&ar->arLock, 0); status = wmi_powermode_cmd(ar->arWmi, REC_POWER); AR6000_SPIN_LOCK(&ar->arLock, 0); - A_ASSERT(status == A_OK); - aptcTR.timerScheduled = FALSE; + A_ASSERT(status == 0); + aptcTR.timerScheduled = false; } else { A_TIMEOUT_MS(&aptcTimer, APTC_TRAFFIC_SAMPLING_INTERVAL, 0); } @@ -773,7 +771,7 @@ aptcTimerHandler(unsigned long arg) #ifdef ATH_AR6K_11N_SUPPORT static void -ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num) +ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, u16 num) { void * osbuf; @@ -804,12 +802,12 @@ ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, char *buf, loff_t pos, size_t count) { int index; - AR_SOFTC_T *ar; - HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; + struct ar6_softc *ar; + struct hif_device_os_device_info *osDevInfo; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", (A_UINT32)count)); + AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", (u32)count)); for (index=0; index < MAX_AR6000; index++) { - ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]); + ar = (struct ar6_softc *)ar6k_priv(ar6000_devices[index]); osDevInfo = &ar->osDevInfo; if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { break; @@ -818,7 +816,7 @@ ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, if (index == MAX_AR6000) return 0; - if ((BMIRawRead(ar->arHifDevice, (A_UCHAR*)buf, count, TRUE)) != A_OK) { + if ((BMIRawRead(ar->arHifDevice, (u8*)buf, count, true)) != 0) { return 0; } @@ -831,12 +829,12 @@ ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj, char *buf, loff_t pos, size_t count) { int index; - AR_SOFTC_T *ar; - HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; + struct ar6_softc *ar; + struct hif_device_os_device_info *osDevInfo; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Write %d bytes\n", (A_UINT32)count)); + AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Write %d bytes\n", (u32)count)); for (index=0; index < MAX_AR6000; index++) { - ar = (AR_SOFTC_T *)ar6k_priv(ar6000_devices[index]); + ar = (struct ar6_softc *)ar6k_priv(ar6000_devices[index]); osDevInfo = &ar->osDevInfo; if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { break; @@ -845,28 +843,28 @@ ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj, if (index == MAX_AR6000) return 0; - if ((BMIRawWrite(ar->arHifDevice, (A_UCHAR*)buf, count)) != A_OK) { + if ((BMIRawWrite(ar->arHifDevice, (u8*)buf, count)) != 0) { return 0; } return count; } -static A_STATUS -ar6000_sysfs_bmi_init(AR_SOFTC_T *ar) +static int +ar6000_sysfs_bmi_init(struct ar6_softc *ar) { - A_STATUS status; + int status; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Creating sysfs entry\n")); - A_MEMZERO(&ar->osDevInfo, sizeof(HIF_DEVICE_OS_DEVICE_INFO)); + A_MEMZERO(&ar->osDevInfo, sizeof(struct hif_device_os_device_info)); /* Get the underlying OS device */ status = HIFConfigureDevice(ar->arHifDevice, HIF_DEVICE_GET_OS_DEVICE, &ar->osDevInfo, - sizeof(HIF_DEVICE_OS_DEVICE_INFO)); + sizeof(struct hif_device_os_device_info)); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI: Failed to get OS device info from HIF\n")); return A_ERROR; } @@ -878,11 +876,11 @@ ar6000_sysfs_bmi_init(AR_SOFTC_T *ar) return A_ERROR; } - return A_OK; + return 0; } static void -ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar) +ar6000_sysfs_bmi_deinit(struct ar6_softc *ar) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Deleting sysfs entry\n")); @@ -890,7 +888,7 @@ ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar) } #define bmifn(fn) do { \ - if ((fn) < A_OK) { \ + if ((fn) < 0) { \ AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); \ return A_ERROR; \ } \ @@ -902,28 +900,28 @@ ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar) #define AR6002_MAC_ADDRESS_OFFSET 0x0A #define AR6003_MAC_ADDRESS_OFFSET 0x16 static -void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data) +void calculate_crc(u32 TargetType, u8 *eeprom_data) { - A_UINT16 *ptr_crc; - A_UINT16 *ptr16_eeprom; - A_UINT16 checksum; - A_UINT32 i; - A_UINT32 eeprom_size; + u16 *ptr_crc; + u16 *ptr16_eeprom; + u16 checksum; + u32 i; + u32 eeprom_size; if (TargetType == TARGET_TYPE_AR6001) { eeprom_size = 512; - ptr_crc = (A_UINT16 *)eeprom_data; + ptr_crc = (u16 *)eeprom_data; } else if (TargetType == TARGET_TYPE_AR6003) { eeprom_size = 1024; - ptr_crc = (A_UINT16 *)((A_UCHAR *)eeprom_data + 0x04); + ptr_crc = (u16 *)((u8 *)eeprom_data + 0x04); } else { eeprom_size = 768; - ptr_crc = (A_UINT16 *)((A_UCHAR *)eeprom_data + 0x04); + ptr_crc = (u16 *)((u8 *)eeprom_data + 0x04); } @@ -932,7 +930,7 @@ void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data) // Recalculate new CRC checksum = 0; - ptr16_eeprom = (A_UINT16 *)eeprom_data; + ptr16_eeprom = (u16 *)eeprom_data; for (i = 0;i < eeprom_size; i += 2) { checksum = checksum ^ (*ptr16_eeprom); @@ -943,17 +941,17 @@ void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data) } static void -ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t size) +ar6000_softmac_update(struct ar6_softc *ar, u8 *eeprom_data, size_t size) { const char *source = "random generated"; const struct firmware *softmac_entry; - A_UCHAR *ptr_mac; + u8 *ptr_mac; switch (ar->arTargetType) { case TARGET_TYPE_AR6002: - ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6002_MAC_ADDRESS_OFFSET); + ptr_mac = (u8 *)((u8 *)eeprom_data + AR6002_MAC_ADDRESS_OFFSET); break; case TARGET_TYPE_AR6003: - ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6003_MAC_ADDRESS_OFFSET); + ptr_mac = (u8 *)((u8 *)eeprom_data + AR6003_MAC_ADDRESS_OFFSET); break; default: AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Invalid Target Type\n")); @@ -970,7 +968,7 @@ ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t size) ptr_mac[5] = random32() & 0xff; if ((A_REQUEST_FIRMWARE(&softmac_entry, "softmac", ((struct device *)ar->osDevInfo.pOSDevice))) == 0) { - A_CHAR *macbuf = A_MALLOC_NOWAIT(softmac_entry->size+1); + char *macbuf = A_MALLOC_NOWAIT(softmac_entry->size+1); if (macbuf) { unsigned int softmac[6]; memcpy(macbuf, softmac_entry->data, softmac_entry->size); @@ -993,13 +991,13 @@ ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t size) } #endif /* SOFTMAC_FILE_USED */ -static A_STATUS -ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A_BOOL compressed) +static int +ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, bool compressed) { - A_STATUS status; + int status; const char *filename; const struct firmware *fw_entry; - A_UINT32 fw_entry_size; + u32 fw_entry_size; switch (file) { case AR6K_OTP_FILE: @@ -1024,7 +1022,7 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A } if (eppingtest) { - bypasswmi = TRUE; + bypasswmi = true; if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { filename = AR6003_REV1_EPPING_FIRMWARE_FILE; } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { @@ -1034,7 +1032,7 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A ar->arVersion.target_ver)); return A_ERROR; } - compressed = 0; + compressed = false; } #ifdef CONFIG_HOST_TCMD_SUPPORT @@ -1047,7 +1045,7 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); return A_ERROR; } - compressed = 0; + compressed = false; } #endif #ifdef HTC_RAW_INTERFACE @@ -1060,7 +1058,7 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); return A_ERROR; } - compressed = 0; + compressed = false; } #endif break; @@ -1099,7 +1097,7 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A #ifdef SOFTMAC_FILE_USED if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) { - ar6000_softmac_update(ar, (A_UCHAR *)fw_entry->data, fw_entry->size); + ar6000_softmac_update(ar, (u8 *)fw_entry->data, fw_entry->size); } #endif @@ -1108,9 +1106,9 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A /* Load extended board data for AR6003 */ if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) { - A_UINT32 board_ext_address; - A_UINT32 board_ext_data_size; - A_UINT32 board_data_size; + u32 board_ext_address; + u32 board_ext_data_size; + u32 board_data_size; board_ext_data_size = (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_BOARD_EXT_DATA_SZ : \ (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_BOARD_EXT_DATA_SZ : 0)); @@ -1119,16 +1117,16 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_BOARD_DATA_SZ : 0)); /* Determine where in Target RAM to write Board Data */ - bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data), (A_UCHAR *)&board_ext_address, 4)); + bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data), (u8 *)&board_ext_address, 4)); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address)); /* check whether the target has allocated memory for extended board data and file contains extended board data */ if ((board_ext_address) && (fw_entry->size == (board_data_size + board_ext_data_size))) { - A_UINT32 param; + u32 param; - status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (A_UCHAR *)(fw_entry->data + board_data_size), board_ext_data_size); + status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (u8 *)(fw_entry->data + board_data_size), board_ext_data_size); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); A_RELEASE_FIRMWARE(fw_entry); return A_ERROR; @@ -1136,42 +1134,42 @@ ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A /* Record the fact that extended board Data IS initialized */ param = 1; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data_initialized), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data_initialized), (u8 *)¶m, 4)); } fw_entry_size = board_data_size; } if (compressed) { - status = BMIFastDownload(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry_size); + status = BMIFastDownload(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); } else { - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry_size); + status = BMIWriteMemory(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); } - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); A_RELEASE_FIRMWARE(fw_entry); return A_ERROR; } A_RELEASE_FIRMWARE(fw_entry); - return A_OK; + return 0; } #endif /* INIT_MODE_DRV_ENABLED */ -A_STATUS -ar6000_update_bdaddr(AR_SOFTC_T *ar) +int +ar6000_update_bdaddr(struct ar6_softc *ar) { if (setupbtdev != 0) { - A_UINT32 address; + u32 address; if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data), (A_UCHAR *)&address, 4) != A_OK) + HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data), (u8 *)&address, 4) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for hi_board_data failed\n")); return A_ERROR; } - if (BMIReadMemory(ar->arHifDevice, address + BDATA_BDADDR_OFFSET, (A_UCHAR *)ar->bdaddr, 6) != A_OK) + if (BMIReadMemory(ar->arHifDevice, address + BDATA_BDADDR_OFFSET, (u8 *)ar->bdaddr, 6) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for BD address failed\n")); return A_ERROR; @@ -1181,16 +1179,16 @@ ar6000_update_bdaddr(AR_SOFTC_T *ar) ar->bdaddr[4], ar->bdaddr[5])); } -return A_OK; +return 0; } -A_STATUS -ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) +int +ar6000_sysfs_bmi_get_config(struct ar6_softc *ar, u32 mode) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Requesting device specific configuration\n")); if (mode == WLAN_INIT_MODE_UDEV) { - A_CHAR version[16]; + char version[16]; const struct firmware *fw_entry; /* Get config using udev through a script in user space */ @@ -1205,8 +1203,8 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) #ifdef INIT_MODE_DRV_ENABLED } else { /* The config is contained within the driver itself */ - A_STATUS status; - A_UINT32 param, options, sleep, address; + int status; + u32 param, options, sleep, address; /* Temporarily disable system sleep */ address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS; @@ -1236,7 +1234,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) param = 0; if (ar->arTargetType == TARGET_TYPE_AR6002) { - bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ext_clk_detected), (A_UCHAR *)¶m, 4)); + bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ext_clk_detected), (u8 *)¶m, 4)); } /* LPO_CAL.ENABLE = 1 if no external clk is detected */ @@ -1269,7 +1267,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) if (ar->arTargetType == TARGET_TYPE_AR6003) { /* hi_ext_clk_detected = 0 */ param = 0; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ext_clk_detected), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_ext_clk_detected), (u8 *)¶m, 4)); /* CLOCK_CONTROL &= ~LF_CLK32 */ address = RTC_BASE_ADDRESS + CLOCK_CONTROL_ADDRESS; @@ -1282,22 +1280,22 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) /* Transfer Board Data from Target EEPROM to Target RAM */ if (ar->arTargetType == TARGET_TYPE_AR6003) { /* Determine where in Target RAM to write Board Data */ - bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data), (A_UCHAR *)&address, 4)); + bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data), (u8 *)&address, 4)); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board Data download address: 0x%x\n", address)); /* Write EEPROM data to Target RAM */ - if ((ar6000_transfer_bin_file(ar, AR6K_BOARD_DATA_FILE, address, FALSE)) != A_OK) { + if ((ar6000_transfer_bin_file(ar, AR6K_BOARD_DATA_FILE, address, false)) != 0) { return A_ERROR; } /* Record the fact that Board Data IS initialized */ param = 1; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data_initialized), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_data_initialized), (u8 *)¶m, 4)); /* Transfer One time Programmable data */ AR6K_DATA_DOWNLOAD_ADDRESS(address, ar->arVersion.target_ver); - status = ar6000_transfer_bin_file(ar, AR6K_OTP_FILE, address, TRUE); - if (status == A_OK) { + status = ar6000_transfer_bin_file(ar, AR6K_OTP_FILE, address, true); + if (status == 0) { /* Execute the OTP code */ param = 0; AR6K_APP_START_OVERRIDE_ADDRESS(address, ar->arVersion.target_ver); @@ -1312,7 +1310,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) /* Download Target firmware */ AR6K_DATA_DOWNLOAD_ADDRESS(address, ar->arVersion.target_ver); - if ((ar6000_transfer_bin_file(ar, AR6K_FIRMWARE_FILE, address, TRUE)) != A_OK) { + if ((ar6000_transfer_bin_file(ar, AR6K_FIRMWARE_FILE, address, true)) != 0) { return A_ERROR; } @@ -1322,12 +1320,12 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) /* Apply the patches */ AR6K_PATCH_DOWNLOAD_ADDRESS(address, ar->arVersion.target_ver); - if ((ar6000_transfer_bin_file(ar, AR6K_PATCH_FILE, address, FALSE)) != A_OK) { + if ((ar6000_transfer_bin_file(ar, AR6K_PATCH_FILE, address, false)) != 0) { return A_ERROR; } param = address; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dset_list_head), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dset_list_head), (u8 *)¶m, 4)); if (ar->arTargetType == TARGET_TYPE_AR6003) { if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { @@ -1337,7 +1335,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) /* Reserve 6.5K of RAM */ param = 6656; } - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_end_RAM_reserve_sz), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_end_RAM_reserve_sz), (u8 *)¶m, 4)); } /* Restore system sleep */ @@ -1354,7 +1352,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) #define CONFIG_AR600x_DEBUG_UART_TX_PIN 8 #endif param = CONFIG_AR600x_DEBUG_UART_TX_PIN; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbg_uart_txpin), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_dbg_uart_txpin), (u8 *)¶m, 4)); #if (CONFIG_AR600x_DEBUG_UART_TX_PIN == 23) { @@ -1369,7 +1367,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) #ifdef ATH6KL_CONFIG_GPIO_BT_RESET #define CONFIG_AR600x_BT_RESET_PIN 0x16 param = CONFIG_AR600x_BT_RESET_PIN; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_support_pins), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_support_pins), (u8 *)¶m, 4)); #endif /* ATH6KL_CONFIG_GPIO_BT_RESET */ /* Configure UART flow control polarity */ @@ -1380,7 +1378,7 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) #if (CONFIG_ATH6KL_BT_UART_FC_POLARITY == 1) if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { param = ((CONFIG_ATH6KL_BT_UART_FC_POLARITY << 1) & 0x2); - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_pwr_mgmt_params), (A_UCHAR *)¶m, 4)); + bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_pwr_mgmt_params), (u8 *)¶m, 4)); } #endif /* CONFIG_ATH6KL_BT_UART_FC_POLARITY */ } @@ -1396,19 +1394,19 @@ ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) #endif /* INIT_MODE_DRV_ENABLED */ } - return A_OK; + return 0; } -A_STATUS -ar6000_configure_target(AR_SOFTC_T *ar) +int +ar6000_configure_target(struct ar6_softc *ar) { - A_UINT32 param; + u32 param; if (enableuartprint) { param = 1; if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_serial_enable), - (A_UCHAR *)¶m, - 4)!= A_OK) + (u8 *)¶m, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for enableuartprint failed \n")); return A_ERROR; @@ -1420,8 +1418,8 @@ ar6000_configure_target(AR_SOFTC_T *ar) param = HTC_PROTOCOL_VERSION; if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_app_host_interest), - (A_UCHAR *)¶m, - 4)!= A_OK) + (u8 *)¶m, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for htc version failed \n")); return A_ERROR; @@ -1435,12 +1433,12 @@ ar6000_configure_target(AR_SOFTC_T *ar) } #endif if (enabletimerwar) { - A_UINT32 param; + u32 param; if (BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) + (u8 *)¶m, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for enabletimerwar failed \n")); return A_ERROR; @@ -1450,8 +1448,8 @@ ar6000_configure_target(AR_SOFTC_T *ar) if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) + (u8 *)¶m, + 4) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for enabletimerwar failed \n")); return A_ERROR; @@ -1461,12 +1459,12 @@ ar6000_configure_target(AR_SOFTC_T *ar) /* set the firmware mode to STA/IBSS/AP */ { - A_UINT32 param; + u32 param; if (BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) + (u8 *)¶m, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for setting fwmode failed \n")); return A_ERROR; @@ -1476,8 +1474,8 @@ ar6000_configure_target(AR_SOFTC_T *ar) if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) + (u8 *)¶m, + 4) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for setting fwmode failed \n")); return A_ERROR; @@ -1487,12 +1485,12 @@ ar6000_configure_target(AR_SOFTC_T *ar) #ifdef ATH6KL_DISABLE_TARGET_DBGLOGS { - A_UINT32 param; + u32 param; if (BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) + (u8 *)¶m, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for disabling debug logs failed\n")); return A_ERROR; @@ -1502,8 +1500,8 @@ ar6000_configure_target(AR_SOFTC_T *ar) if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) + (u8 *)¶m, + 4) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for HI_OPTION_DISABLE_DBGLOG\n")); return A_ERROR; @@ -1524,8 +1522,8 @@ ar6000_configure_target(AR_SOFTC_T *ar) param = AR6003_BOARD_EXT_DATA_ADDRESS; if (BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_board_ext_data), - (A_UCHAR *)¶m, - 4) != A_OK) + (u8 *)¶m, + 4) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for hi_board_ext_data failed \n")); return A_ERROR; @@ -1536,22 +1534,20 @@ ar6000_configure_target(AR_SOFTC_T *ar) /* since BMIInit is called in the driver layer, we have to set the block * size here for the target */ - if (A_FAILED(ar6000_set_htc_params(ar->arHifDevice, - ar->arTargetType, - mbox_yield_limit, - 0 /* use default number of control buffers */ - ))) { + if (ar6000_set_htc_params(ar->arHifDevice, ar->arTargetType, + mbox_yield_limit, 0)) { + /* use default number of control buffers */ return A_ERROR; } if (setupbtdev != 0) { - if (A_FAILED(ar6000_set_hci_bridge_flags(ar->arHifDevice, - ar->arTargetType, - setupbtdev))) { + if (ar6000_set_hci_bridge_flags(ar->arHifDevice, + ar->arTargetType, + setupbtdev)) { return A_ERROR; } } - return A_OK; + return 0; } static void @@ -1595,19 +1591,27 @@ init_netdev(struct net_device *dev, char *name) /* * HTC Event handlers */ -static A_STATUS +static int ar6000_avail_ev(void *context, void *hif_handle) { int i; struct net_device *dev; void *ar_netif; - AR_SOFTC_T *ar; + struct ar6_softc *ar; int device_index = 0; - HTC_INIT_INFO htcInfo; + struct htc_init_info htcInfo; #ifdef ATH6K_CONFIG_CFG80211 struct wireless_dev *wdev; #endif /* ATH6K_CONFIG_CFG80211 */ - A_STATUS init_status = A_OK; + int init_status = 0; + struct hif_device_os_device_info osDevInfo; + + memset(&osDevInfo, 0, sizeof(osDevInfo)); + if (HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, + &osDevInfo, sizeof(osDevInfo))) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: Failed to get OS device instance\n", __func__)); + return A_ERROR; + } AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_available\n")); @@ -1627,14 +1631,14 @@ ar6000_avail_ev(void *context, void *hif_handle) device_index = i; #ifdef ATH6K_CONFIG_CFG80211 - wdev = ar6k_cfg80211_init(NULL); + wdev = ar6k_cfg80211_init(osDevInfo.pOSDevice); if (IS_ERR(wdev)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ar6k_cfg80211_init failed\n", __func__)); return A_ERROR; } ar_netif = wdev_priv(wdev); #else - dev = alloc_etherdev(sizeof(AR_SOFTC_T)); + dev = alloc_etherdev(sizeof(struct ar6_softc)); if (dev == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_available: can't alloc etherdev\n")); return A_ERROR; @@ -1648,8 +1652,8 @@ ar6000_avail_ev(void *context, void *hif_handle) return A_ERROR; } - A_MEMZERO(ar_netif, sizeof(AR_SOFTC_T)); - ar = (AR_SOFTC_T *)ar_netif; + A_MEMZERO(ar_netif, sizeof(struct ar6_softc)); + ar = (struct ar6_softc *)ar_netif; #ifdef ATH6K_CONFIG_CFG80211 ar->wdev = wdev; @@ -1666,18 +1670,14 @@ ar6000_avail_ev(void *context, void *hif_handle) SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); wdev->netdev = dev; ar->arNetworkType = INFRA_NETWORK; + ar->smeState = SME_DISCONNECTED; #endif /* ATH6K_CONFIG_CFG80211 */ init_netdev(dev, ifname); #ifdef SET_NETDEV_DEV if (ar_netif) { - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); - if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, - &osDevInfo, sizeof(osDevInfo))) ) { - SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); - } + SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); } #endif @@ -1687,10 +1687,10 @@ ar6000_avail_ev(void *context, void *hif_handle) ar->arDeviceIndex = device_index; ar->arWlanPowerState = WLAN_POWER_STATE_ON; - ar->arWlanOff = FALSE; /* We are in ON state */ + ar->arWlanOff = false; /* We are in ON state */ #ifdef CONFIG_PM ar->arWowState = WLAN_WOW_STATE_NONE; - ar->arBTOff = TRUE; /* BT chip assumed to be OFF */ + ar->arBTOff = true; /* BT chip assumed to be OFF */ ar->arBTSharing = WLAN_CONFIG_BT_SHARING; ar->arWlanOffConfig = WLAN_CONFIG_WLAN_OFF; ar->arSuspendConfig = WLAN_CONFIG_PM_SUSPEND; @@ -1699,7 +1699,7 @@ ar6000_avail_ev(void *context, void *hif_handle) A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, dev); ar->arHBChallengeResp.seqNum = 0; - ar->arHBChallengeResp.outstanding = FALSE; + ar->arHBChallengeResp.outstanding = false; ar->arHBChallengeResp.missCnt = 0; ar->arHBChallengeResp.frequency = AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT; ar->arHBChallengeResp.missThres = AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAULT; @@ -1707,7 +1707,7 @@ ar6000_avail_ev(void *context, void *hif_handle) ar6000_init_control_info(ar); init_waitqueue_head(&arEvent); sema_init(&ar->arSem, 1); - ar->bIsDestroyProgress = FALSE; + ar->bIsDestroyProgress = false; INIT_HTC_PACKET_QUEUE(&ar->amsdu_rx_buffer_queue); @@ -1726,7 +1726,7 @@ ar6000_avail_ev(void *context, void *hif_handle) { struct bmi_target_info targ_info; - if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != A_OK) { + if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != 0) { init_status = A_ERROR; goto avail_ev_failed; } @@ -1737,14 +1737,14 @@ ar6000_avail_ev(void *context, void *hif_handle) /* do any target-specific preparation that can be done through BMI */ if (ar6000_prepare_target(ar->arHifDevice, targ_info.target_type, - targ_info.target_ver) != A_OK) { + targ_info.target_ver) != 0) { init_status = A_ERROR; goto avail_ev_failed; } } - if (ar6000_configure_target(ar) != A_OK) { + if (ar6000_configure_target(ar) != 0) { init_status = A_ERROR; goto avail_ev_failed; } @@ -1799,25 +1799,27 @@ ar6000_avail_ev(void *context, void *hif_handle) if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || (wlaninitmode == WLAN_INIT_MODE_DRV)) { - A_STATUS status = A_OK; + int status = 0; do { - if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK) + if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); break; } #ifdef HTC_RAW_INTERFACE - break; /* Don't call ar6000_init for ART */ + if (!eppingtest && bypasswmi) { + break; /* Don't call ar6000_init for ART */ + } #endif rtnl_lock(); - status = (ar6000_init(dev)==0) ? A_OK : A_ERROR; + status = (ar6000_init(dev)==0) ? 0 : A_ERROR; rtnl_unlock(); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); } - } while (FALSE); + } while (false); - if (status != A_OK) { + if (status) { init_status = status; goto avail_ev_failed; } @@ -1841,7 +1843,7 @@ ar6000_avail_ev(void *context, void *hif_handle) (unsigned long)ar)); avail_ev_failed : - if (A_FAILED(init_status)) { + if (init_status) { if (bmienable) { ar6000_sysfs_bmi_deinit(ar); } @@ -1850,13 +1852,13 @@ avail_ev_failed : return init_status; } -static void ar6000_target_failure(void *Instance, A_STATUS Status) +static void ar6000_target_failure(void *Instance, int Status) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)Instance; + struct ar6_softc *ar = (struct ar6_softc *)Instance; WMI_TARGET_ERROR_REPORT_EVENT errEvent; - static A_BOOL sip = FALSE; + static bool sip = false; - if (Status != A_OK) { + if (Status != 0) { printk(KERN_ERR "ar6000_target_failure: target asserted \n"); @@ -1875,47 +1877,47 @@ static void ar6000_target_failure(void *Instance, A_STATUS Status) /* Report the error only once */ if (!sip) { - sip = TRUE; + sip = true; errEvent.errorVal = WMI_TARGET_COM_ERR | WMI_TARGET_FATAL_ERR; ar6000_send_event_to_app(ar, WMI_ERROR_REPORT_EVENTID, - (A_UINT8 *)&errEvent, + (u8 *)&errEvent, sizeof(WMI_TARGET_ERROR_REPORT_EVENT)); } } } -static A_STATUS +static int ar6000_unavail_ev(void *context, void *hif_handle) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)context; + struct ar6_softc *ar = (struct ar6_softc *)context; /* NULL out it's entry in the global list */ ar6000_devices[ar->arDeviceIndex] = NULL; ar6000_destroy(ar->arNetDev, 1); - return A_OK; + return 0; } void ar6000_restart_endpoint(struct net_device *dev) { - A_STATUS status = A_OK; - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + int status = 0; + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); BMIInit(); do { - if ( (status=ar6000_configure_target(ar))!=A_OK) + if ( (status=ar6000_configure_target(ar))!= 0) break; - if ( (status=ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK) + if ( (status=ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); break; } rtnl_lock(); - status = (ar6000_init(dev)==0) ? A_OK : A_ERROR; + status = (ar6000_init(dev)==0) ? 0 : A_ERROR; rtnl_unlock(); - if (status!=A_OK) { + if (status) { break; } if (ar->arSsidLen && ar->arWlanState == WLAN_ENABLED) { @@ -1923,7 +1925,7 @@ ar6000_restart_endpoint(struct net_device *dev) } } while (0); - if (status==A_OK) { + if (status== 0) { return; } @@ -1932,27 +1934,24 @@ ar6000_restart_endpoint(struct net_device *dev) } void -ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglogs) +ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); /* Stop the transmit queues */ netif_stop_queue(dev); /* Disable the target and the interrupts associated with it */ - if (ar->arWmiReady == TRUE) + if (ar->arWmiReady == true) { if (!bypasswmi) { - if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Disconnect\n", __func__)); - if (!keepprofile) { - AR6000_SPIN_LOCK(&ar->arLock, 0); - ar6000_init_profile_info(ar); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - } - wmi_disconnect_cmd(ar->arWmi); + bool disconnectIssued; + + disconnectIssued = (ar->arConnected) || (ar->arConnectPending); + ar6000_disconnect(ar); + if (!keepprofile) { + ar6000_init_profile_info(ar); } A_UNTIMEOUT(&ar->disconnect_timer); @@ -1961,9 +1960,9 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo ar6000_dbglog_get_debug_logs(ar); } - ar->arWmiReady = FALSE; + ar->arWmiReady = false; wmi_shutdown(ar->arWmi); - ar->arWmiEnabled = FALSE; + ar->arWmiEnabled = false; ar->arWmi = NULL; /* * After wmi_shudown all WMI events will be dropped. @@ -1974,14 +1973,12 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo * Sometimes disconnect_event will be received when the debug logs * are collected. */ - if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) { + if (disconnectIssued) { if(ar->arNetworkType & AP_NETWORK) { ar6000_disconnect_event(ar, DISCONNECT_CMD, bcast_mac, 0, NULL, 0); } else { ar6000_disconnect_event(ar, DISCONNECT_CMD, ar->arBssid, 0, NULL, 0); } - ar->arConnected = FALSE; - ar->arConnectPending = FALSE; } #ifdef USER_KEYS ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; @@ -1997,11 +1994,11 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo __func__, (unsigned long) ar, (unsigned long) ar->arWmi)); /* Shut down WMI if we have started it */ - if(ar->arWmiEnabled == TRUE) + if(ar->arWmiEnabled == true) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Shut down WMI\n", __func__)); wmi_shutdown(ar->arWmi); - ar->arWmiEnabled = FALSE; + ar->arWmiEnabled = false; ar->arWmi = NULL; } } @@ -2014,13 +2011,13 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo #else // FIXME: workaround to reset BT's UART baud rate to default if (NULL != ar->exitCallback) { - AR3K_CONFIG_INFO ar3kconfig; - A_STATUS status; + struct ar3k_config_info ar3kconfig; + int status; A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig)); ar6000_set_default_ar3kconfig(ar, (void *)&ar3kconfig); status = ar->exitCallback(&ar3kconfig); - if (A_OK != status) { + if (0 != status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to reset AR3K baud rate! \n")); } } @@ -2048,14 +2045,17 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo * a debug session */ AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Attempting to reset target on instance destroy.... \n")); if (ar->arHifDevice != NULL) { - A_BOOL coldReset = (ar->arTargetType == TARGET_TYPE_AR6003) ? TRUE: FALSE; - ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, coldReset); + bool coldReset = (ar->arTargetType == TARGET_TYPE_AR6003) ? true: false; + ar6000_reset_device(ar->arHifDevice, ar->arTargetType, true, coldReset); } } else { AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Host does not want target reset. \n")); } /* Done with cookies */ ar6000_cookie_cleanup(ar); + + /* cleanup any allocated AMSDU buffers */ + ar6000_cleanup_amsdu_rxbufs(ar); } /* * We need to differentiate between the surprise and planned removal of the @@ -2063,7 +2063,7 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo * - In case of surprise removal, the hcd already frees up the pending * for the device and hence there is no need to unregister the function * driver inorder to get these requests. For planned removal, the function - * driver has to explictly unregister itself to have the hcd return all the + * driver has to explicitly unregister itself to have the hcd return all the * pending requests before the data structures for the devices are freed up. * Note that as per the current implementation, the function driver will * end up releasing all the devices since there is no API to selectively @@ -2074,7 +2074,7 @@ ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglo void ar6000_destroy(struct net_device *dev, unsigned int unregister) { - AR_SOFTC_T *ar; + struct ar6_softc *ar; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("+ar6000_destroy \n")); @@ -2084,7 +2084,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) return; } - ar->bIsDestroyProgress = TRUE; + ar->bIsDestroyProgress = true; if (down_interruptible(&ar->arSem)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): down_interruptible failed \n", __func__)); @@ -2093,7 +2093,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) if (ar->arWlanPowerState != WLAN_POWER_STATE_CUT_PWR) { /* only stop endpoint if we are not stop it in suspend_ev */ - ar6000_stop_endpoint(dev, FALSE, TRUE); + ar6000_stop_endpoint(dev, false, true); } else { /* clear up the platform power state before rmmod */ plat_setup_power(1,0); @@ -2159,18 +2159,18 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) static void disconnect_timer_handler(unsigned long ptr) { struct net_device *dev = (struct net_device *)ptr; - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); A_UNTIMEOUT(&ar->disconnect_timer); ar6000_init_profile_info(ar); - wmi_disconnect_cmd(ar->arWmi); + ar6000_disconnect(ar); } static void ar6000_detect_error(unsigned long ptr) { struct net_device *dev = (struct net_device *)ptr; - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); WMI_TARGET_ERROR_REPORT_EVENT errEvent; AR6000_SPIN_LOCK(&ar->arLock, 0); @@ -2188,19 +2188,19 @@ static void ar6000_detect_error(unsigned long ptr) errEvent.errorVal = WMI_TARGET_COM_ERR | WMI_TARGET_FATAL_ERR; AR6000_SPIN_UNLOCK(&ar->arLock, 0); ar6000_send_event_to_app(ar, WMI_ERROR_REPORT_EVENTID, - (A_UINT8 *)&errEvent, + (u8 *)&errEvent, sizeof(WMI_TARGET_ERROR_REPORT_EVENT)); return; } /* Generate the sequence number for the next challenge */ ar->arHBChallengeResp.seqNum++; - ar->arHBChallengeResp.outstanding = TRUE; + ar->arHBChallengeResp.outstanding = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); /* Send the challenge on the control channel */ - if (wmi_get_challenge_resp_cmd(ar->arWmi, ar->arHBChallengeResp.seqNum, DRV_HB_CHALLENGE) != A_OK) { + if (wmi_get_challenge_resp_cmd(ar->arWmi, ar->arHBChallengeResp.seqNum, DRV_HB_CHALLENGE) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to send heart beat challenge\n")); } @@ -2209,7 +2209,7 @@ static void ar6000_detect_error(unsigned long ptr) A_TIMEOUT_MS(&ar->arHBChallengeResp.timer, ar->arHBChallengeResp.frequency * 1000, 0); } -void ar6000_init_profile_info(AR_SOFTC_T *ar) +void ar6000_init_profile_info(struct ar6_softc *ar) { ar->arSsidLen = 0; A_MEMZERO(ar->arSsid, sizeof(ar->arSsid)); @@ -2236,13 +2236,12 @@ void ar6000_init_profile_info(AR_SOFTC_T *ar) A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid)); A_MEMZERO(ar->arBssid, sizeof(ar->arBssid)); ar->arBssChannel = 0; - ar->arConnected = FALSE; } static void -ar6000_init_control_info(AR_SOFTC_T *ar) +ar6000_init_control_info(struct ar6_softc *ar) { - ar->arWmiEnabled = FALSE; + ar->arWmiEnabled = false; ar6000_init_profile_info(ar); ar->arDefTxKeyIndex = 0; A_MEMZERO(ar->arWepKeyList, sizeof(ar->arWepKeyList)); @@ -2252,12 +2251,12 @@ ar6000_init_control_info(AR_SOFTC_T *ar) ar->arVersion.host_ver = AR6K_SW_VERSION; ar->arRssi = 0; ar->arTxPwr = 0; - ar->arTxPwrSet = FALSE; + ar->arTxPwrSet = false; ar->arSkipScan = 0; ar->arBeaconInterval = 0; ar->arBitRate = 0; ar->arMaxRetries = 0; - ar->arWmmEnabled = TRUE; + ar->arWmmEnabled = true; ar->intra_bss = 1; ar->scan_triggered = 0; A_MEMZERO(&ar->scParams, sizeof(ar->scParams)); @@ -2266,8 +2265,8 @@ ar6000_init_control_info(AR_SOFTC_T *ar) /* Initialize the AP mode state info */ { - A_UINT8 ctr; - A_MEMZERO((A_UINT8 *)ar->sta_list, AP_MAX_NUM_STA * sizeof(sta_t)); + u8 ctr; + A_MEMZERO((u8 *)ar->sta_list, AP_MAX_NUM_STA * sizeof(sta_t)); /* init the Mutexes */ A_MUTEX_INIT(&ar->mcastpsqLock); @@ -2281,7 +2280,7 @@ ar6000_init_control_info(AR_SOFTC_T *ar) ar->ap_profile_flag = 0; A_NETBUF_QUEUE_INIT(&ar->mcastpsq); - A_MEMCPY(ar->ap_country_code, DEF_AP_COUNTRY_CODE, 3); + memcpy(ar->ap_country_code, DEF_AP_COUNTRY_CODE, 3); ar->ap_wmode = DEF_AP_WMODE_G; ar->ap_dtim_period = DEF_AP_DTIM; ar->ap_beacon_interval = DEF_BEACON_INTERVAL; @@ -2292,7 +2291,7 @@ static int ar6000_open(struct net_device *dev) { unsigned long flags; - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); spin_lock_irqsave(&ar->arLock, flags); @@ -2318,38 +2317,33 @@ static int ar6000_close(struct net_device *dev) { #ifdef ATH6K_CONFIG_CFG80211 - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); #endif /* ATH6K_CONFIG_CFG80211 */ netif_stop_queue(dev); #ifdef ATH6K_CONFIG_CFG80211 - AR6000_SPIN_LOCK(&ar->arLock, 0); - if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) { - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - wmi_disconnect_cmd(ar->arWmi); - } else { - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - } + ar6000_disconnect(ar); - if(ar->arWmiReady == TRUE) { + if(ar->arWmiReady == true) { if (wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0, - 0, 0, 0, 0, 0, 0, 0, 0) != A_OK) { + 0, 0, 0, 0, 0, 0, 0, 0) != 0) { return -EIO; } ar->arWlanState = WLAN_DISABLED; } + ar6k_cfg80211_scanComplete_event(ar, A_ECANCELED); #endif /* ATH6K_CONFIG_CFG80211 */ return 0; } /* connect to a service */ -static A_STATUS ar6000_connectservice(AR_SOFTC_T *ar, - HTC_SERVICE_CONNECT_REQ *pConnect, - char *pDesc) +static int ar6000_connectservice(struct ar6_softc *ar, + struct htc_service_connect_req *pConnect, + char *pDesc) { - A_STATUS status; - HTC_SERVICE_CONNECT_RESP response; + int status; + struct htc_service_connect_resp response; do { @@ -2359,7 +2353,7 @@ static A_STATUS ar6000_connectservice(AR_SOFTC_T *ar, pConnect, &response); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Failed to connect to %s service status:%d \n", pDesc, status)); break; @@ -2391,12 +2385,12 @@ static A_STATUS ar6000_connectservice(AR_SOFTC_T *ar, break; } - } while (FALSE); + } while (false); return status; } -void ar6000_TxDataCleanup(AR_SOFTC_T *ar) +void ar6000_TxDataCleanup(struct ar6_softc *ar) { /* flush all the data (non-control) streams * we only flush packets that are tagged as data, we leave any control packets that @@ -2416,32 +2410,148 @@ void ar6000_TxDataCleanup(AR_SOFTC_T *ar) } HTC_ENDPOINT_ID -ar6000_ac2_endpoint_id ( void * devt, A_UINT8 ac) +ar6000_ac2_endpoint_id ( void * devt, u8 ac) { - AR_SOFTC_T *ar = (AR_SOFTC_T *) devt; + struct ar6_softc *ar = (struct ar6_softc *) devt; return(arAc2EndpointID(ar, ac)); } -A_UINT8 -ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep ) +u8 ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep ) { - AR_SOFTC_T *ar = (AR_SOFTC_T *) devt; + struct ar6_softc *ar = (struct ar6_softc *) devt; return(arEndpoint2Ac(ar, ep )); } -/* This function does one time initialization for the lifetime of the device */ -int ar6000_init(struct net_device *dev) +/* + * This function applies WLAN specific configuration defined in wlan_config.h + */ +int ar6000_target_config_wlan_params(struct ar6_softc *ar) { - AR_SOFTC_T *ar; - A_STATUS status; - A_INT32 timeleft; - A_INT16 i; - int ret = 0; + int status = 0; #if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd; WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd; #endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ +#ifdef CONFIG_HOST_TCMD_SUPPORT + if (ar->arTargetMode != AR6000_WLAN_MODE) { + return 0; + } +#endif /* CONFIG_HOST_TCMD_SUPPORT */ + + /* + * configure the device for rx dot11 header rules 0,0 are the default values + * therefore this command can be skipped if the inputs are 0,FALSE,FALSE.Required + * if checksum offload is needed. Set RxMetaVersion to 2 + */ + if ((wmi_set_rx_frame_format_cmd(ar->arWmi,ar->rxMetaVersion, processDot11Hdr, processDot11Hdr)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set the rx frame format.\n")); + status = A_ERROR; + } + +#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) + /* Configure the type of BT collocated with WLAN */ + memset(&sbcb_cmd, 0, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD)); +#ifdef CONFIG_AR600x_BT_QCOM + sbcb_cmd.btcoexCoLocatedBTdev = 1; +#elif defined(CONFIG_AR600x_BT_CSR) + sbcb_cmd.btcoexCoLocatedBTdev = 2; +#elif defined(CONFIG_AR600x_BT_AR3001) + sbcb_cmd.btcoexCoLocatedBTdev = 3; +#else +#error Unsupported Bluetooth Type +#endif /* Collocated Bluetooth Type */ + + if ((wmi_set_btcoex_colocated_bt_dev_cmd(ar->arWmi, &sbcb_cmd)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set collocated BT type\n")); + status = A_ERROR; + } + + /* Configure the type of BT collocated with WLAN */ + memset(&sbfa_cmd, 0, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)); +#ifdef CONFIG_AR600x_DUAL_ANTENNA + sbfa_cmd.btcoexFeAntType = 2; +#elif defined(CONFIG_AR600x_SINGLE_ANTENNA) + sbfa_cmd.btcoexFeAntType = 1; +#else +#error Unsupported Front-End Antenna Configuration +#endif /* AR600x Front-End Antenna Configuration */ + + if ((wmi_set_btcoex_fe_ant_cmd(ar->arWmi, &sbfa_cmd)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n")); + status = A_ERROR; + } +#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ + +#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN + if ((wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set power save fail event policy\n")); + status = A_ERROR; + } +#endif + +#if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP + if ((wmi_set_lpreamble_cmd(ar->arWmi, 0, WMI_DONOT_IGNORE_BARKER_IN_ERP)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set barker preamble policy\n")); + status = A_ERROR; + } +#endif + + if ((wmi_set_keepalive_cmd(ar->arWmi, WLAN_CONFIG_KEEP_ALIVE_INTERVAL)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set keep alive interval\n")); + status = A_ERROR; + } + +#if WLAN_CONFIG_DISABLE_11N + { + WMI_SET_HT_CAP_CMD htCap; + + memset(&htCap, 0, sizeof(WMI_SET_HT_CAP_CMD)); + htCap.band = 0; + if ((wmi_set_ht_cap_cmd(ar->arWmi, &htCap)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set ht capabilities \n")); + status = A_ERROR; + } + + htCap.band = 1; + if ((wmi_set_ht_cap_cmd(ar->arWmi, &htCap)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set ht capabilities \n")); + status = A_ERROR; + } + } +#endif /* WLAN_CONFIG_DISABLE_11N */ + +#ifdef ATH6K_CONFIG_OTA_MODE + if ((wmi_powermode_cmd(ar->arWmi, MAX_PERF_POWER)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set power mode \n")); + status = A_ERROR; + } +#endif + + if ((wmi_disctimeout_cmd(ar->arWmi, WLAN_CONFIG_DISCONNECT_TIMEOUT)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set disconnect timeout \n")); + status = A_ERROR; + } + +#if WLAN_CONFIG_DISABLE_TX_BURSTING + if ((wmi_set_wmm_txop(ar->arWmi, WMI_TXOP_DISABLED)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set txop bursting \n")); + status = A_ERROR; + } +#endif + + return status; +} + +/* This function does one time initialization for the lifetime of the device */ +int ar6000_init(struct net_device *dev) +{ + struct ar6_softc *ar; + int status; + s32 timeleft; + s16 i; + int ret = 0; + if((ar = ar6k_priv(dev)) == NULL) { return -EIO; @@ -2465,7 +2575,7 @@ int ar6000_init(struct net_device *dev) /* Do we need to finish the BMI phase */ if ((wlaninitmode == WLAN_INIT_MODE_USR || wlaninitmode == WLAN_INIT_MODE_DRV) && - (BMIDone(ar->arHifDevice) != A_OK)) + (BMIDone(ar->arHifDevice) != 0)) { ret = -EIO; goto ar6000_init_done; @@ -2482,7 +2592,7 @@ int ar6000_init(struct net_device *dev) #endif /* Indicate that WMI is enabled (although not ready yet) */ - ar->arWmiEnabled = TRUE; + ar->arWmiEnabled = true; if ((ar->arWmi = wmi_init((void *) ar)) == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize WMI.\n", __func__)); @@ -2495,14 +2605,14 @@ int ar6000_init(struct net_device *dev) } do { - HTC_SERVICE_CONNECT_REQ connect; + struct htc_service_connect_req connect; /* the reason we have to wait for the target here is that the driver layer * has to init BMI in order to set the host block size, */ status = HTCWaitTarget(ar->arHtcTarget); - if (A_FAILED(status)) { + if (status) { break; } @@ -2533,7 +2643,7 @@ int ar6000_init(struct net_device *dev) status = ar6000_connectservice(ar, &connect, "WMI CONTROL"); - if (A_FAILED(status)) { + if (status) { break; } @@ -2555,7 +2665,7 @@ int ar6000_init(struct net_device *dev) * of 0-3 */ connect.ConnectionFlags &= ~HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK; connect.ConnectionFlags |= - ((A_UINT16)reduce_credit_dribble - 1) & HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK; + ((u16)reduce_credit_dribble - 1) & HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK; } /* connect to best-effort service */ connect.ServiceID = WMI_DATA_BE_SVC; @@ -2563,7 +2673,7 @@ int ar6000_init(struct net_device *dev) status = ar6000_connectservice(ar, &connect, "WMI DATA BE"); - if (A_FAILED(status)) { + if (status) { break; } @@ -2573,7 +2683,7 @@ int ar6000_init(struct net_device *dev) status = ar6000_connectservice(ar, &connect, "WMI DATA BK"); - if (A_FAILED(status)) { + if (status) { break; } @@ -2583,7 +2693,7 @@ int ar6000_init(struct net_device *dev) status = ar6000_connectservice(ar, &connect, "WMI DATA VI"); - if (A_FAILED(status)) { + if (status) { break; } @@ -2596,7 +2706,7 @@ int ar6000_init(struct net_device *dev) status = ar6000_connectservice(ar, &connect, "WMI DATA VO"); - if (A_FAILED(status)) { + if (status) { break; } @@ -2613,12 +2723,12 @@ int ar6000_init(struct net_device *dev) #ifdef EXPORT_HCI_BRIDGE_INTERFACE if (setuphci && (NULL != ar6kHciTransCallbacks.setupTransport)) { - HCI_TRANSPORT_MISC_HANDLES hciHandles; + struct hci_transport_misc_handles hciHandles; hciHandles.netDevice = ar->arNetDev; hciHandles.hifDevice = ar->arHifDevice; hciHandles.htcHandle = ar->arHtcTarget; - status = (A_STATUS)(ar6kHciTransCallbacks.setupTransport(&hciHandles)); + status = (int)(ar6kHciTransCallbacks.setupTransport(&hciHandles)); } #else if (setuphci) { @@ -2634,9 +2744,9 @@ int ar6000_init(struct net_device *dev) status = ar6k_setup_hci_pal(ar); #endif - } while (FALSE); + } while (false); - if (A_FAILED(status)) { + if (status) { ret = -EIO; goto ar6000_init_done; } @@ -2671,10 +2781,10 @@ int ar6000_init(struct net_device *dev) /* start HTC */ status = HTCStart(ar->arHtcTarget); - if (status != A_OK) { - if (ar->arWmiEnabled == TRUE) { + if (status) { + if (ar->arWmiEnabled == true) { wmi_shutdown(ar->arWmi); - ar->arWmiEnabled = FALSE; + ar->arWmiEnabled = false; ar->arWmi = NULL; } ar6000_cookie_cleanup(ar); @@ -2685,7 +2795,7 @@ int ar6000_init(struct net_device *dev) if (!bypasswmi) { /* Wait for Wmi event to be ready */ timeleft = wait_event_interruptible_timeout(arEvent, - (ar->arWmiReady == TRUE), wmitimeout * HZ); + (ar->arWmiReady == true), wmitimeout * HZ); if (ar->arVersion.abi_ver != AR6K_ABI_VERSION) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ABI Version mismatch: Host(0x%x), Target(0x%x)\n", AR6K_ABI_VERSION, ar->arVersion.abi_ver)); @@ -2705,49 +2815,10 @@ int ar6000_init(struct net_device *dev) AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() WMI is ready\n", __func__)); /* Communicate the wmi protocol verision to the target */ - if ((ar6000_set_host_app_area(ar)) != A_OK) { + if ((ar6000_set_host_app_area(ar)) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set the host app area\n")); } - - /* configure the device for rx dot11 header rules 0,0 are the default values - * therefore this command can be skipped if the inputs are 0,FALSE,FALSE.Required - if checksum offload is needed. Set RxMetaVersion to 2*/ - if ((wmi_set_rx_frame_format_cmd(ar->arWmi,ar->rxMetaVersion, processDot11Hdr, processDot11Hdr)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set the rx frame format.\n")); - } - -#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) - /* Configure the type of BT collocated with WLAN */ - A_MEMZERO(&sbcb_cmd, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD)); -#ifdef CONFIG_AR600x_BT_QCOM - sbcb_cmd.btcoexCoLocatedBTdev = 1; -#elif defined(CONFIG_AR600x_BT_CSR) - sbcb_cmd.btcoexCoLocatedBTdev = 2; -#elif defined(CONFIG_AR600x_BT_AR3001) - sbcb_cmd.btcoexCoLocatedBTdev = 3; -#else -#error Unsupported Bluetooth Type -#endif /* Collocated Bluetooth Type */ - - if ((wmi_set_btcoex_colocated_bt_dev_cmd(ar->arWmi, &sbcb_cmd)) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set collocated BT type\n")); - } - - /* Configure the type of BT collocated with WLAN */ - A_MEMZERO(&sbfa_cmd, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)); -#ifdef CONFIG_AR600x_DUAL_ANTENNA - sbfa_cmd.btcoexFeAntType = 2; -#elif defined(CONFIG_AR600x_SINGLE_ANTENNA) - sbfa_cmd.btcoexFeAntType = 1; -#else -#error Unsupported Front-End Antenna Configuration -#endif /* AR600x Front-End Antenna Configuration */ - - if ((wmi_set_btcoex_fe_ant_cmd(ar->arWmi, &sbfa_cmd)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n")); - } -#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ + ar6000_target_config_wlan_params(ar); } ar->arNumDataEndPts = 1; @@ -2772,27 +2843,27 @@ ar6000_init_done: void -ar6000_bitrate_rx(void *devt, A_INT32 rateKbps) +ar6000_bitrate_rx(void *devt, s32 rateKbps) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arBitRate = rateKbps; wake_up(&arEvent); } void -ar6000_ratemask_rx(void *devt, A_UINT32 ratemask) +ar6000_ratemask_rx(void *devt, u32 ratemask) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arRateMask = ratemask; wake_up(&arEvent); } void -ar6000_txPwr_rx(void *devt, A_UINT8 txPwr) +ar6000_txPwr_rx(void *devt, u8 txPwr) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arTxPwr = txPwr; wake_up(&arEvent); @@ -2800,23 +2871,22 @@ ar6000_txPwr_rx(void *devt, A_UINT8 txPwr) void -ar6000_channelList_rx(void *devt, A_INT8 numChan, A_UINT16 *chanList) +ar6000_channelList_rx(void *devt, s8 numChan, u16 *chanList) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; - A_MEMCPY(ar->arChannelList, chanList, numChan * sizeof (A_UINT16)); + memcpy(ar->arChannelList, chanList, numChan * sizeof (u16)); ar->arNumChannels = numChan; wake_up(&arEvent); } -A_UINT8 -ar6000_ibss_map_epid(struct sk_buff *skb, struct net_device *dev, A_UINT32 * mapNo) +u8 ar6000_ibss_map_epid(struct sk_buff *skb, struct net_device *dev, u32 *mapNo) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); - A_UINT8 *datap; + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); + u8 *datap; ATH_MAC_HDR *macHdr; - A_UINT32 i, eptMap; + u32 i, eptMap; (*mapNo) = 0; datap = A_NETBUF_DATA(skb); @@ -2844,7 +2914,7 @@ ar6000_ibss_map_epid(struct sk_buff *skb, struct net_device *dev, A_UINT32 * map A_ASSERT(ar->arNodeNum <= MAX_NODE_NUM); } - A_MEMCPY(ar->arNodeMap[eptMap].macAddress, macHdr->dstMac, IEEE80211_ADDR_LEN); + memcpy(ar->arNodeMap[eptMap].macAddress, macHdr->dstMac, IEEE80211_ADDR_LEN); for (i = ENDPOINT_2; i <= ENDPOINT_5; i ++) { if (!ar->arTxPending[i]) { @@ -2882,22 +2952,22 @@ static void ar6000_dump_skb(struct sk_buff *skb) #endif #ifdef HTC_TEST_SEND_PKTS -static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *skb); +static void DoHTCSendPktsTest(struct ar6_softc *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *skb); #endif static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) { #define AC_NOT_MAPPED 99 - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); - A_UINT8 ac = AC_NOT_MAPPED; + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); + u8 ac = AC_NOT_MAPPED; HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED; - A_UINT32 mapNo = 0; + u32 mapNo = 0; int len; struct ar_cookie *cookie; - A_BOOL checkAdHocPsMapping = FALSE,bMoreData = FALSE; + bool checkAdHocPsMapping = false,bMoreData = false; HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG; - A_UINT8 dot11Hdr = processDot11Hdr; + u8 dot11Hdr = processDot11Hdr; #ifdef CONFIG_PM if (ar->arWowState != WLAN_WOW_STATE_NONE) { A_NETBUF_FREE(skb); @@ -2912,7 +2982,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) /* If target is not associated */ if( (!ar->arConnected && !bypasswmi) #ifdef CONFIG_HOST_TCMD_SUPPORT - /* TCMD doesnt support any data, free the buf and return */ + /* TCMD doesn't support any data, free the buf and return */ || (ar->arTargetMode == AR6000_TCMD_MODE) #endif ) { @@ -2922,7 +2992,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) do { - if (ar->arWmiReady == FALSE && bypasswmi == 0) { + if (ar->arWmiReady == false && bypasswmi == 0) { break; } @@ -2944,20 +3014,20 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) * mcastq */ if (IEEE80211_IS_MULTICAST(datap->dstMac)) { - A_UINT8 ctr=0; - A_BOOL qMcast=FALSE; + u8 ctr=0; + bool qMcast=false; for (ctr=0; ctr<AP_MAX_NUM_STA; ctr++) { if (STA_IS_PWR_SLEEP((&ar->sta_list[ctr]))) { - qMcast = TRUE; + qMcast = true; } } if(qMcast) { /* If this transmit is not because of a Dtim Expiry q it */ - if (ar->DTIMExpired == FALSE) { - A_BOOL isMcastqEmpty = FALSE; + if (ar->DTIMExpired == false) { + bool isMcastqEmpty = false; A_MUTEX_LOCK(&ar->mcastpsqLock); isMcastqEmpty = A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq); @@ -2978,7 +3048,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) */ A_MUTEX_LOCK(&ar->mcastpsqLock); if(!A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq)) { - bMoreData = TRUE; + bMoreData = true; } A_MUTEX_UNLOCK(&ar->mcastpsqLock); } @@ -2989,7 +3059,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) if (STA_IS_PWR_SLEEP(conn)) { /* If this transmit is not because of a PsPoll q it*/ if (!STA_IS_PS_POLLED(conn)) { - A_BOOL isPsqEmpty = FALSE; + bool isPsqEmpty = false; /* Queue the frames if the STA is sleeping */ A_MUTEX_LOCK(&conn->psqLock); isPsqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->psq); @@ -3010,7 +3080,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) */ A_MUTEX_LOCK(&conn->psqLock); if (!A_NETBUF_QUEUE_EMPTY(&conn->psq)) { - bMoreData = TRUE; + bMoreData = true; } A_MUTEX_UNLOCK(&conn->psqLock); } @@ -3026,9 +3096,9 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) if (ar->arWmiEnabled) { #ifdef CONFIG_CHECKSUM_OFFLOAD - A_UINT8 csumStart=0; - A_UINT8 csumDest=0; - A_UINT8 csum=skb->ip_summed; + u8 csumStart=0; + u8 csumDest=0; + u8 csum=skb->ip_summed; if(csumOffload && (csum==CHECKSUM_PARTIAL)){ csumStart = (skb->head + skb->csum_start - skb_network_header(skb) + sizeof(ATH_LLC_SNAP_HDR)); @@ -3048,19 +3118,19 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) break; } A_NETBUF_PUT(newbuf, len); - A_MEMCPY(A_NETBUF_DATA(newbuf), A_NETBUF_DATA(skb), len); + memcpy(A_NETBUF_DATA(newbuf), A_NETBUF_DATA(skb), len); A_NETBUF_FREE(skb); skb = newbuf; /* fall through and assemble header */ } if (dot11Hdr) { - if (wmi_dot11_hdr_add(ar->arWmi,skb,ar->arNetworkType) != A_OK) { + if (wmi_dot11_hdr_add(ar->arWmi,skb,ar->arNetworkType) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx-wmi_dot11_hdr_add failed\n")); break; } } else { - if (wmi_dix_2_dot3(ar->arWmi, skb) != A_OK) { + if (wmi_dix_2_dot3(ar->arWmi, skb) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_dix_2_dot3 failed\n")); break; } @@ -3072,7 +3142,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) metaV2.csumDest = csumDest; metaV2.csumFlags = 0x1;/*instruct target to calculate checksum*/ if (wmi_data_hdr_add(ar->arWmi, skb, DATA_MSGTYPE, bMoreData, dot11Hdr, - WMI_META_VERSION_2,&metaV2) != A_OK) { + WMI_META_VERSION_2,&metaV2) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_data_hdr_add failed\n")); break; } @@ -3081,7 +3151,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) else #endif { - if (wmi_data_hdr_add(ar->arWmi, skb, DATA_MSGTYPE, bMoreData, dot11Hdr,0,NULL) != A_OK) { + if (wmi_data_hdr_add(ar->arWmi, skb, DATA_MSGTYPE, bMoreData, dot11Hdr,0,NULL) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_data_hdr_add failed\n")); break; } @@ -3091,7 +3161,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) if ((ar->arNetworkType == ADHOC_NETWORK) && ar->arIbssPsEnable && ar->arConnected) { /* flag to check adhoc mapping once we take the lock below: */ - checkAdHocPsMapping = TRUE; + checkAdHocPsMapping = true; } else { /* get the stream mapping */ @@ -3115,7 +3185,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) if (ac == HCI_TRANSPORT_STREAM_NUM) { /* pass this to HCI */ #ifndef EXPORT_HCI_BRIDGE_INTERFACE - if (A_SUCCESS(hci_test_send(ar,skb))) { + if (!hci_test_send(ar,skb)) { return 0; } #endif @@ -3136,7 +3206,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) } } - } while (FALSE); + } while (false); /* did we succeed ? */ if ((ac == AC_NOT_MAPPED) && !checkAdHocPsMapping) { @@ -3173,7 +3243,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) ar->arTotalTxDataPending++; } - } while (FALSE); + } while (false); AR6000_SPIN_UNLOCK(&ar->arLock, 0); @@ -3211,7 +3281,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) int ar6000_acl_data_tx(struct sk_buff *skb, struct net_device *dev) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); struct ar_cookie *cookie; HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED; @@ -3267,13 +3337,13 @@ tvsub(register struct timeval *out, register struct timeval *in) } void -applyAPTCHeuristics(AR_SOFTC_T *ar) +applyAPTCHeuristics(struct ar6_softc *ar) { - A_UINT32 duration; - A_UINT32 numbytes; - A_UINT32 throughput; + u32 duration; + u32 numbytes; + u32 throughput; struct timeval ts; - A_STATUS status; + int status; AR6000_SPIN_LOCK(&ar->arLock, 0); @@ -3292,12 +3362,12 @@ applyAPTCHeuristics(AR_SOFTC_T *ar) throughput = ((numbytes * 8) / duration); if (throughput > APTC_UPPER_THROUGHPUT_THRESHOLD) { /* Disable Sleep and schedule a timer */ - A_ASSERT(ar->arWmiReady == TRUE); + A_ASSERT(ar->arWmiReady == true); AR6000_SPIN_UNLOCK(&ar->arLock, 0); status = wmi_powermode_cmd(ar->arWmi, MAX_PERF_POWER); AR6000_SPIN_LOCK(&ar->arLock, 0); A_TIMEOUT_MS(&aptcTimer, APTC_TRAFFIC_SAMPLING_INTERVAL, 0); - aptcTR.timerScheduled = TRUE; + aptcTR.timerScheduled = true; } } } @@ -3306,11 +3376,11 @@ applyAPTCHeuristics(AR_SOFTC_T *ar) } #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ -static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPacket) +static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, struct htc_packet *pPacket) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; + struct ar6_softc *ar = (struct ar6_softc *)Context; HTC_SEND_FULL_ACTION action = HTC_SEND_FULL_KEEP; - A_BOOL stopNet = FALSE; + bool stopNet = false; HTC_ENDPOINT_ID Endpoint = HTC_GET_ENDPOINT_FROM_PKT(pPacket); do { @@ -3327,10 +3397,10 @@ static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac /* for endpoint ping testing drop Best Effort and Background */ if ((accessClass == WMM_AC_BE) || (accessClass == WMM_AC_BK)) { action = HTC_SEND_FULL_DROP; - stopNet = FALSE; + stopNet = false; } else { /* keep but stop the netqueues */ - stopNet = TRUE; + stopNet = true; } break; } @@ -3341,11 +3411,11 @@ static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac * the only exception to this is during testing using endpointping */ AR6000_SPIN_LOCK(&ar->arLock, 0); /* set flag to handle subsequent messages */ - ar->arWMIControlEpFull = TRUE; + ar->arWMIControlEpFull = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("WMI Control Endpoint is FULL!!! \n")); /* no need to stop the network */ - stopNet = FALSE; + stopNet = false; break; } @@ -3359,7 +3429,7 @@ static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac if (ar->arNetworkType == ADHOC_NETWORK) { /* in adhoc mode, we cannot differentiate traffic priorities so there is no need to * continue, however we should stop the network */ - stopNet = TRUE; + stopNet = true; break; } /* the last MAX_HI_COOKIE_NUM "batch" of cookies are reserved for the highest @@ -3371,15 +3441,15 @@ static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac * HTC to drop the packet that overflowed */ action = HTC_SEND_FULL_DROP; /* since we are dropping packets, no need to stop the network */ - stopNet = FALSE; + stopNet = false; break; } - } while (FALSE); + } while (false); if (stopNet) { AR6000_SPIN_LOCK(&ar->arLock, 0); - ar->arNetQueueStopped = TRUE; + ar->arNetQueueStopped = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); /* one of the data endpoints queues is getting full..need to stop network stack * the queue will resume in ar6000_tx_complete() */ @@ -3391,18 +3461,18 @@ static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPac static void -ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) +ar6000_tx_complete(void *Context, struct htc_packet_queue *pPacketQueue) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - A_UINT32 mapNo = 0; - A_STATUS status; + struct ar6_softc *ar = (struct ar6_softc *)Context; + u32 mapNo = 0; + int status; struct ar_cookie * ar_cookie; HTC_ENDPOINT_ID eid; - A_BOOL wakeEvent = FALSE; + bool wakeEvent = false; struct sk_buff_head skb_queue; - HTC_PACKET *pPacket; + struct htc_packet *pPacket; struct sk_buff *pktSkb; - A_BOOL flushing = FALSE; + bool flushing = false; skb_queue_head_init(&skb_queue); @@ -3428,7 +3498,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) /* add this to the list, use faster non-lock API */ __skb_queue_tail(&skb_queue,pktSkb); - if (A_SUCCESS(status)) { + if (!status) { A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb)); } @@ -3447,18 +3517,18 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) { if (ar->arWMIControlEpFull) { /* since this packet completed, the WMI EP is no longer full */ - ar->arWMIControlEpFull = FALSE; + ar->arWMIControlEpFull = false; } if (ar->arTxPending[eid] == 0) { - wakeEvent = TRUE; + wakeEvent = true; } } - if (A_FAILED(status)) { + if (status) { if (status == A_ECANCELED) { /* a packet was flushed */ - flushing = TRUE; + flushing = true; } AR6000_STAT_INC(ar, tx_errors); if (status != A_NO_RESOURCE) { @@ -3467,7 +3537,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) } } else { AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("OK\n")); - flushing = FALSE; + flushing = false; AR6000_STAT_INC(ar, tx_packets); ar->arNetStats.tx_bytes += A_NETBUF_LEN(pktSkb); #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL @@ -3484,7 +3554,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) ar->arNodeMap[mapNo].txPending --; if (!ar->arNodeMap[mapNo].txPending && (mapNo == (ar->arNodeNum - 1))) { - A_UINT32 i; + u32 i; for (i = ar->arNodeNum; i > 0; i --) { if (!ar->arNodeMap[i - 1].txPending) { A_MEMZERO(&ar->arNodeMap[i - 1], sizeof(struct ar_node_mapping)); @@ -3499,7 +3569,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) ar6000_free_cookie(ar, ar_cookie); if (ar->arNetQueueStopped) { - ar->arNetQueueStopped = FALSE; + ar->arNetQueueStopped = false; } } @@ -3514,7 +3584,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) A_NETBUF_FREE(pktSkb); } - if ((ar->arConnected == TRUE) || (bypasswmi)) { + if ((ar->arConnected == true) || bypasswmi) { if (!flushing) { /* don't wake the queue if we are flushing, other wise it will just * keep queueing packets, which will keep failing */ @@ -3529,10 +3599,10 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) } sta_t * -ieee80211_find_conn(AR_SOFTC_T *ar, A_UINT8 *node_addr) +ieee80211_find_conn(struct ar6_softc *ar, u8 *node_addr) { sta_t *conn = NULL; - A_UINT8 i, max_conn; + u8 i, max_conn; switch(ar->arNetworkType) { case AP_NETWORK: @@ -3553,10 +3623,10 @@ ieee80211_find_conn(AR_SOFTC_T *ar, A_UINT8 *node_addr) return conn; } -sta_t *ieee80211_find_conn_for_aid(AR_SOFTC_T *ar, A_UINT8 aid) +sta_t *ieee80211_find_conn_for_aid(struct ar6_softc *ar, u8 aid) { sta_t *conn = NULL; - A_UINT8 ctr; + u8 ctr; for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { if (ar->sta_list[ctr].aid == aid) { @@ -3572,22 +3642,22 @@ sta_t *ieee80211_find_conn_for_aid(AR_SOFTC_T *ar, A_UINT8 aid) */ int pktcount; static void -ar6000_rx(void *Context, HTC_PACKET *pPacket) +ar6000_rx(void *Context, struct htc_packet *pPacket) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; + struct ar6_softc *ar = (struct ar6_softc *)Context; struct sk_buff *skb = (struct sk_buff *)pPacket->pPktContext; int minHdrLen; - A_UINT8 containsDot11Hdr = 0; - A_STATUS status = pPacket->Status; + u8 containsDot11Hdr = 0; + int status = pPacket->Status; HTC_ENDPOINT_ID ept = pPacket->Endpoint; - A_ASSERT((status != A_OK) || + A_ASSERT((status) || (pPacket->pBuffer == (A_NETBUF_DATA(skb) + HTC_HEADER_LEN))); AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_rx ar=0x%lx eid=%d, skb=0x%lx, data=0x%lx, len=0x%x status:%d", (unsigned long)ar, ept, (unsigned long)skb, (unsigned long)pPacket->pBuffer, pPacket->ActualLength, status)); - if (status != A_OK) { + if (status) { if (status != A_ECANCELED) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("RX ERR (%d) \n",status)); } @@ -3597,7 +3667,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) * and adaptive power throughput state */ AR6000_SPIN_LOCK(&ar->arLock, 0); - if (A_SUCCESS(status)) { + if (!status) { AR6000_STAT_INC(ar, rx_packets); ar->arNetStats.rx_bytes += pPacket->ActualLength; #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL @@ -3618,24 +3688,26 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) AR6000_SPIN_UNLOCK(&ar->arLock, 0); skb->dev = ar->arNetDev; - if (status != A_OK) { + if (status) { AR6000_STAT_INC(ar, rx_errors); A_NETBUF_FREE(skb); - } else if (ar->arWmiEnabled == TRUE) { + } else if (ar->arWmiEnabled == true) { if (ept == ar->arControlEp) { /* * this is a wmi control msg */ #ifdef CONFIG_PM - ar6000_check_wow_status(ar, skb, TRUE); + ar6000_check_wow_status(ar, skb, true); #endif /* CONFIG_PM */ wmi_control_rx(ar->arWmi, skb); } else { WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb); - A_UINT8 is_amsdu, tid, is_acl_data_frame; + bool is_amsdu; + u8 tid; + bool is_acl_data_frame; is_acl_data_frame = WMI_DATA_HDR_GET_DATA_TYPE(dhdr) == WMI_DATA_HDR_DATA_TYPE_ACL; #ifdef CONFIG_PM - ar6000_check_wow_status(ar, NULL, FALSE); + ar6000_check_wow_status(ar, NULL, false); #endif /* CONFIG_PM */ /* * this is a wmi data packet @@ -3667,8 +3739,8 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) AR6000_STAT_INC(ar, rx_length_errors); A_NETBUF_FREE(skb); } else { - A_UINT16 seq_no; - A_UINT8 meta_type; + u16 seq_no; + u8 meta_type; #if 0 /* Access RSSI values here */ @@ -3678,9 +3750,9 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) /* Get the Power save state of the STA */ if (ar->arNetworkType == AP_NETWORK) { sta_t *conn = NULL; - A_UINT8 psState=0,prevPsState; + u8 psState=0,prevPsState; ATH_MAC_HDR *datap=NULL; - A_UINT16 offset; + u16 offset; meta_type = WMI_DATA_HDR_GET_META(dhdr); @@ -3742,7 +3814,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) } } else { /* This frame is from a STA that is not associated*/ - A_ASSERT(FALSE); + A_ASSERT(false); } /* Drop NULL data frames here */ @@ -3753,7 +3825,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) } } - is_amsdu = WMI_DATA_HDR_IS_AMSDU(dhdr); + is_amsdu = WMI_DATA_HDR_IS_AMSDU(dhdr) ? true : false; tid = WMI_DATA_HDR_GET_UP(dhdr); seq_no = WMI_DATA_HDR_GET_SEQNO(dhdr); meta_type = WMI_DATA_HDR_GET_META(dhdr); @@ -3785,7 +3857,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) break; } - A_ASSERT(status == A_OK); + A_ASSERT(status == 0); /* NWF: print the 802.11 hdr bytes */ if(containsDot11Hdr) { @@ -3794,7 +3866,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) status = wmi_dot3_2_dix(skb); } - if (status != A_OK) { + if (status) { /* Drop frames that could not be processed (lack of memory, etc.) */ A_NETBUF_FREE(skb); goto rx_done; @@ -3805,7 +3877,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) *((short *)A_NETBUF_DATA(skb)) = WMI_ACL_DATA_EVENTID; /* send the data packet to PAL driver */ if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) { - if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, skb) == TRUE) + if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, skb) == true) goto rx_done; } } @@ -3870,7 +3942,7 @@ ar6000_deliver_frames_to_nw_stack(void *dev, void *osbuf) skb->dev = dev; if ((skb->dev->flags & IFF_UP) == IFF_UP) { #ifdef CONFIG_PM - ar6000_check_wow_status((AR_SOFTC_T *)ar6k_priv(dev), skb, FALSE); + ar6000_check_wow_status((struct ar6_softc *)ar6k_priv(dev), skb, false); #endif /* CONFIG_PM */ skb->protocol = eth_type_trans(skb, skb->dev); /* @@ -3915,12 +3987,12 @@ ar6000_deliver_frames_to_bt_stack(void *dev, void *osbuf) static void ar6000_rx_refill(void *Context, HTC_ENDPOINT_ID Endpoint) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; + struct ar6_softc *ar = (struct ar6_softc *)Context; void *osBuf; int RxBuffers; int buffersToRefill; - HTC_PACKET *pPacket; - HTC_PACKET_QUEUE queue; + struct htc_packet *pPacket; + struct htc_packet_queue queue; buffersToRefill = (int)AR6000_MAX_RX_BUFFERS - HTCGetNumRecvBuffers(ar->arHtcTarget, Endpoint); @@ -3942,7 +4014,7 @@ ar6000_rx_refill(void *Context, HTC_ENDPOINT_ID Endpoint) } /* the HTC packet wrapper is at the head of the reserved area * in the skb */ - pPacket = (HTC_PACKET *)(A_NETBUF_HEAD(osBuf)); + pPacket = (struct htc_packet *)(A_NETBUF_HEAD(osBuf)); /* set re-fill info */ SET_HTC_PACKET_INFO_RX_REFILL(pPacket,osBuf,A_NETBUF_DATA(osBuf),AR6000_BUFFER_SIZE,Endpoint); /* add to queue */ @@ -3957,13 +4029,13 @@ ar6000_rx_refill(void *Context, HTC_ENDPOINT_ID Endpoint) } /* clean up our amsdu buffer list */ -static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar) +static void ar6000_cleanup_amsdu_rxbufs(struct ar6_softc *ar) { - HTC_PACKET *pPacket; + struct htc_packet *pPacket; void *osBuf; /* empty AMSDU buffer queue and free OS bufs */ - while (TRUE) { + while (true) { AR6000_SPIN_LOCK(&ar->arLock, 0); pPacket = HTC_PACKET_DEQUEUE(&ar->amsdu_rx_buffer_queue); @@ -3975,7 +4047,7 @@ static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar) osBuf = pPacket->pPktContext; if (NULL == osBuf) { - A_ASSERT(FALSE); + A_ASSERT(false); break; } @@ -3986,9 +4058,9 @@ static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar) /* refill the amsdu buffer list */ -static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count) +static void ar6000_refill_amsdu_rxbufs(struct ar6_softc *ar, int Count) { - HTC_PACKET *pPacket; + struct htc_packet *pPacket; void *osBuf; while (Count > 0) { @@ -3998,7 +4070,7 @@ static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count) } /* the HTC packet wrapper is at the head of the reserved area * in the skb */ - pPacket = (HTC_PACKET *)(A_NETBUF_HEAD(osBuf)); + pPacket = (struct htc_packet *)(A_NETBUF_HEAD(osBuf)); /* set re-fill info */ SET_HTC_PACKET_INFO_RX_REFILL(pPacket,osBuf,A_NETBUF_DATA(osBuf),AR6000_AMSDU_BUFFER_SIZE,0); @@ -4018,10 +4090,10 @@ static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count) * keep the allocation size the same to optimize cached-slab allocations. * * */ -static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length) +static struct htc_packet *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length) { - HTC_PACKET *pPacket = NULL; - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; + struct htc_packet *pPacket = NULL; + struct ar6_softc *ar = (struct ar6_softc *)Context; int refillCount = 0; AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_alloc_amsdu_rxbuf: eid=%d, Length:%d\n",Endpoint,Length)); @@ -4030,12 +4102,12 @@ static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpo if (Length <= AR6000_BUFFER_SIZE) { /* shouldn't be getting called on normal sized packets */ - A_ASSERT(FALSE); + A_ASSERT(false); break; } if (Length > AR6000_AMSDU_BUFFER_SIZE) { - A_ASSERT(FALSE); + A_ASSERT(false); break; } @@ -4052,7 +4124,7 @@ static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpo /* set actual endpoint ID */ pPacket->Endpoint = Endpoint; - } while (FALSE); + } while (false); if (refillCount >= AR6000_AMSDU_REFILL_THRESHOLD) { ar6000_refill_amsdu_rxbufs(ar,refillCount); @@ -4070,19 +4142,19 @@ ar6000_set_multicast_list(struct net_device *dev) static struct net_device_stats * ar6000_get_stats(struct net_device *dev) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); return &ar->arNetStats; } static struct iw_statistics * ar6000_get_iwstats(struct net_device * dev) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); TARGET_STATS *pStats = &ar->arTargetStats; struct iw_statistics * pIwStats = &ar->arIwStats; int rtnllocked; - if (ar->bIsDestroyProgress || ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED) + if (ar->bIsDestroyProgress || ar->arWmiReady == false || ar->arWlanState == WLAN_DISABLED) { pIwStats->status = 0; pIwStats->qual.qual = 0; @@ -4132,13 +4204,13 @@ ar6000_get_iwstats(struct net_device * dev) break; } - ar->statsUpdatePending = TRUE; + ar->statsUpdatePending = true; - if(wmi_get_stats_cmd(ar->arWmi) != A_OK) { + if(wmi_get_stats_cmd(ar->arWmi) != 0) { break; } - wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == FALSE, wmitimeout * HZ); + wait_event_interruptible_timeout(arEvent, ar->statsUpdatePending == false, wmitimeout * HZ); if (signal_pending(current)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : WMI get stats timeout \n")); break; @@ -4162,12 +4234,12 @@ err_exit: } void -ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver, A_UINT32 abi_ver) +ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; struct net_device *dev = ar->arNetDev; - A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN); + memcpy(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN); AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], dev->dev_addr[3], @@ -4178,43 +4250,18 @@ ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver, ar->arVersion.abi_ver = abi_ver; /* Indicate to the waiting thread that the ready event was received */ - ar->arWmiReady = TRUE; + ar->arWmiReady = true; wake_up(&arEvent); - -#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN - wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN); -#endif -#if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP - wmi_set_lpreamble_cmd(ar->arWmi, 0, WMI_DONOT_IGNORE_BARKER_IN_ERP); -#endif - wmi_set_keepalive_cmd(ar->arWmi, WLAN_CONFIG_KEEP_ALIVE_INTERVAL); -#if WLAN_CONFIG_DISABLE_11N - { - WMI_SET_HT_CAP_CMD htCap; - - A_MEMZERO(&htCap, sizeof(WMI_SET_HT_CAP_CMD)); - htCap.band = 0; - wmi_set_ht_cap_cmd(ar->arWmi, &htCap); - - htCap.band = 1; - wmi_set_ht_cap_cmd(ar->arWmi, &htCap); - } -#endif /* WLAN_CONFIG_DISABLE_11N */ - -#ifdef ATH6K_CONFIG_OTA_MODE - wmi_powermode_cmd(ar->arWmi, MAX_PERF_POWER); -#endif - wmi_disctimeout_cmd(ar->arWmi, WLAN_CONFIG_DISCONNECT_TIMEOUT); } void -add_new_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 aid, A_UINT8 *wpaie, - A_UINT8 ielen, A_UINT8 keymgmt, A_UINT8 ucipher, A_UINT8 auth) +add_new_sta(struct ar6_softc *ar, u8 *mac, u16 aid, u8 *wpaie, + u8 ielen, u8 keymgmt, u8 ucipher, u8 auth) { - A_UINT8 free_slot=aid-1; + u8 free_slot=aid-1; - A_MEMCPY(ar->sta_list[free_slot].mac, mac, ATH_MAC_LEN); - A_MEMCPY(ar->sta_list[free_slot].wpa_ie, wpaie, ielen); + memcpy(ar->sta_list[free_slot].mac, mac, ATH_MAC_LEN); + memcpy(ar->sta_list[free_slot].wpa_ie, wpaie, ielen); ar->sta_list[free_slot].aid = aid; ar->sta_list[free_slot].keymgmt = keymgmt; ar->sta_list[free_slot].ucipher = ucipher; @@ -4224,11 +4271,11 @@ add_new_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 aid, A_UINT8 *wpaie, } void -ar6000_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_UINT8 *bssid, - A_UINT16 listenInterval, A_UINT16 beaconInterval, - NETWORK_TYPE networkType, A_UINT8 beaconIeLen, - A_UINT8 assocReqLen, A_UINT8 assocRespLen, - A_UINT8 *assocInfo) +ar6000_connect_event(struct ar6_softc *ar, u16 channel, u8 *bssid, + u16 listenInterval, u16 beaconInterval, + NETWORK_TYPE networkType, u8 beaconIeLen, + u8 assocReqLen, u8 assocRespLen, + u8 *assocInfo) { union iwreq_data wrqu; int i, beacon_ie_pos, assoc_resp_ie_pos, assoc_req_ie_pos; @@ -4237,14 +4284,14 @@ ar6000_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_UINT8 *bssid, static const char *beaconIetag = "BEACONIE="; char buf[WMI_CONTROL_MSG_MAX_LEN * 2 + strlen(tag1) + 1]; char *pos; - A_UINT8 key_op_ctrl; + u8 key_op_ctrl; unsigned long flags; struct ieee80211req_key *ik; CRYPTO_TYPE keyType = NONE_CRYPT; if(ar->arNetworkType & AP_NETWORK) { struct net_device *dev = ar->arNetDev; - if(A_MEMCMP(dev->dev_addr, bssid, ATH_MAC_LEN)==0) { + if(memcmp(dev->dev_addr, bssid, ATH_MAC_LEN)==0) { ar->arACS = channel; ik = &ar->ap_mode_bkey; @@ -4273,14 +4320,14 @@ ar6000_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_UINT8 *bssid, goto skip_key; } wmi_addKey_cmd(ar->arWmi, ik->ik_keyix, keyType, GROUP_USAGE, - ik->ik_keylen, (A_UINT8 *)&ik->ik_keyrsc, + ik->ik_keylen, (u8 *)&ik->ik_keyrsc, ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr, SYNC_BOTH_WMIFLAG); break; } skip_key: - ar->arConnected = TRUE; + ar->arConnected = true; return; } @@ -4336,7 +4383,7 @@ skip_key: /* Send event to application */ A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, bssid, ATH_MAC_LEN); + memcpy(wrqu.addr.sa_data, bssid, ATH_MAC_LEN); wireless_send_event(ar->arNetDev, IWEVREGISTERED, &wrqu, NULL); /* In case the queue is stopped when we switch modes, this will * wake it up @@ -4353,7 +4400,7 @@ skip_key: assocInfo); #endif /* ATH6K_CONFIG_CFG80211 */ - A_MEMCPY(ar->arBssid, bssid, sizeof(ar->arBssid)); + memcpy(ar->arBssid, bssid, sizeof(ar->arBssid)); ar->arBssChannel = channel; A_PRINTF("AR6000 connected event on freq %d ", channel); @@ -4400,9 +4447,9 @@ skip_key: if (assocRespLen && (sizeof(buf) > (12 + (assocRespLen * 2)))) { assoc_resp_ie_pos = beaconIeLen + assocReqLen + - sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16) + /* status Code */ - sizeof(A_UINT16) ; /* associd */ + sizeof(u16) + /* capinfo*/ + sizeof(u16) + /* status Code */ + sizeof(u16) ; /* associd */ A_MEMZERO(buf, sizeof(buf)); sprintf(buf, "%s", tag2); pos = buf + 12; @@ -4429,8 +4476,8 @@ skip_key: * assoc Request includes capability and listen interval. Skip these. */ assoc_req_ie_pos = beaconIeLen + - sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16); /* listen interval */ + sizeof(u16) + /* capinfo*/ + sizeof(u16); /* listen interval */ A_MEMZERO(buf, sizeof(buf)); sprintf(buf, "%s", tag1); @@ -4450,7 +4497,7 @@ skip_key: #ifdef USER_KEYS if (ar->user_savedkeys_stat == USER_SAVEDKEYS_STAT_RUN && - ar->user_saved_keys.keyOk == TRUE) + ar->user_saved_keys.keyOk == true) { key_op_ctrl = KEY_OP_VALID_MASK & ~KEY_OP_INIT_TSC; @@ -4487,8 +4534,8 @@ skip_key: /* Update connect & link status atomically */ spin_lock_irqsave(&ar->arLock, flags); - ar->arConnected = TRUE; - ar->arConnectPending = FALSE; + ar->arConnected = true; + ar->arConnectPending = false; netif_carrier_on(ar->arNetDev); spin_unlock_irqrestore(&ar->arLock, flags); /* reset the rx aggr state */ @@ -4496,7 +4543,7 @@ skip_key: reconnect_flag = 0; A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, bssid, IEEE80211_ADDR_LEN); + memcpy(wrqu.addr.sa_data, bssid, IEEE80211_ADDR_LEN); wrqu.addr.sa_family = ARPHRD_ETHER; wireless_send_event(ar->arNetDev, SIOCGIWAP, &wrqu, NULL); if ((ar->arNetworkType == ADHOC_NETWORK) && ar->arIbssPsEnable) { @@ -4510,14 +4557,14 @@ skip_key: } -void ar6000_set_numdataendpts(AR_SOFTC_T *ar, A_UINT32 num) +void ar6000_set_numdataendpts(struct ar6_softc *ar, u32 num) { A_ASSERT(num <= (HTC_MAILBOX_NUM_MAX - 1)); ar->arNumDataEndPts = num; } void -sta_cleanup(AR_SOFTC_T *ar, A_UINT8 i) +sta_cleanup(struct ar6_softc *ar, u8 i) { struct sk_buff *skb; @@ -4540,10 +4587,9 @@ sta_cleanup(AR_SOFTC_T *ar, A_UINT8 i) } -A_UINT8 -remove_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 reason) +u8 remove_sta(struct ar6_softc *ar, u8 *mac, u16 reason) { - A_UINT8 i, removed=0; + u8 i, removed=0; if(IS_MAC_NULL(mac)) { return removed; @@ -4559,7 +4605,7 @@ remove_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 reason) } } else { for(i=0; i < AP_MAX_NUM_STA; i++) { - if(A_MEMCMP(ar->sta_list[i].mac, mac, ATH_MAC_LEN)==0) { + if(memcmp(ar->sta_list[i].mac, mac, ATH_MAC_LEN)==0) { A_PRINTF("DEL STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " " aid=%d REASON=%d\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], ar->sta_list[i].aid, reason); @@ -4574,10 +4620,10 @@ remove_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 reason) } void -ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, - A_UINT8 assocRespLen, A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus) +ar6000_disconnect_event(struct ar6_softc *ar, u8 reason, u8 *bssid, + u8 assocRespLen, u8 *assocInfo, u16 protocolReasonStatus) { - A_UINT8 i; + u8 i; unsigned long flags; union iwreq_data wrqu; @@ -4607,9 +4653,11 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, if(!IS_MAC_BCAST(bssid)) { /* Send event to application */ A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, bssid, ATH_MAC_LEN); + memcpy(wrqu.addr.sa_data, bssid, ATH_MAC_LEN); wireless_send_event(ar->arNetDev, IWEVEXPIRED, &wrqu, NULL); } + + ar->arConnected = false; return; } @@ -4654,15 +4702,14 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, */ if( reason == DISCONNECT_CMD) { - ar->arConnectPending = FALSE; if ((!ar->arUserBssFilter) && (ar->arWmiReady)) { wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0); } } else { - ar->arConnectPending = TRUE; + ar->arConnectPending = true; if (((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x11)) || ((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x0) && (reconnect_flag == 1))) { - ar->arConnected = TRUE; + ar->arConnected = true; return; } } @@ -4684,7 +4731,7 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, * Find the nodes based on SSID and remove it * NOTE :: This case will not work out for Hidden-SSID */ - pWmiSsidnode = wmi_find_Ssidnode (ar->arWmi, ar->arSsid, ar->arSsidLen, FALSE, TRUE); + pWmiSsidnode = wmi_find_Ssidnode (ar->arWmi, ar->arSsid, ar->arSsidLen, false, true); if (pWmiSsidnode) { @@ -4696,7 +4743,7 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, /* Update connect & link status atomically */ spin_lock_irqsave(&ar->arLock, flags); - ar->arConnected = FALSE; + ar->arConnected = false; netif_carrier_off(ar->arNetDev); spin_unlock_irqrestore(&ar->arLock, flags); @@ -4721,7 +4768,7 @@ ar6000_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, A_UINT8 *bssid, } void -ar6000_regDomain_event(AR_SOFTC_T *ar, A_UINT32 regCode) +ar6000_regDomain_event(struct ar6_softc *ar, u32 regCode) { A_PRINTF("AR6000 Reg Code = 0x%x\n", regCode); ar->arRegCode = regCode; @@ -4729,7 +4776,7 @@ ar6000_regDomain_event(AR_SOFTC_T *ar, A_UINT32 regCode) #ifdef ATH_AR6K_11N_SUPPORT void -ar6000_aggr_rcv_addba_req_evt(AR_SOFTC_T *ar, WMI_ADDBA_REQ_EVENT *evt) +ar6000_aggr_rcv_addba_req_evt(struct ar6_softc *ar, WMI_ADDBA_REQ_EVENT *evt) { if(evt->status == 0) { aggr_recv_addba_req_evt(ar->aggr_cntxt, evt->tid, evt->st_seq_no, evt->win_sz); @@ -4737,7 +4784,7 @@ ar6000_aggr_rcv_addba_req_evt(AR_SOFTC_T *ar, WMI_ADDBA_REQ_EVENT *evt) } void -ar6000_aggr_rcv_addba_resp_evt(AR_SOFTC_T *ar, WMI_ADDBA_RESP_EVENT *evt) +ar6000_aggr_rcv_addba_resp_evt(struct ar6_softc *ar, WMI_ADDBA_RESP_EVENT *evt) { A_PRINTF("ADDBA RESP. tid %d status %d, sz %d\n", evt->tid, evt->status, evt->amsdu_sz); if(evt->status == 0) { @@ -4745,7 +4792,7 @@ ar6000_aggr_rcv_addba_resp_evt(AR_SOFTC_T *ar, WMI_ADDBA_RESP_EVENT *evt) } void -ar6000_aggr_rcv_delba_req_evt(AR_SOFTC_T *ar, WMI_DELBA_EVENT *evt) +ar6000_aggr_rcv_delba_req_evt(struct ar6_softc *ar, WMI_DELBA_EVENT *evt) { aggr_recv_delba_req_evt(ar->aggr_cntxt, evt->tid); } @@ -4760,9 +4807,9 @@ void ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd) { void *osbuf = NULL; - A_INT8 i; - A_UINT8 size, *buf; - A_STATUS ret = A_OK; + s8 i; + u8 size, *buf; + int ret = 0; size = cmd->evt_buf_sz + 4; osbuf = A_NETBUF_ALLOC(size); @@ -4773,18 +4820,18 @@ ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd) } A_NETBUF_PUT(osbuf, size); - buf = (A_UINT8 *)A_NETBUF_DATA(osbuf); + buf = (u8 *)A_NETBUF_DATA(osbuf); /* First 2-bytes carry HCI event/ACL data type * the next 2 are free */ *((short *)buf) = WMI_HCI_EVENT_EVENTID; buf += sizeof(int); - A_MEMCPY(buf, cmd->buf, cmd->evt_buf_sz); + memcpy(buf, cmd->buf, cmd->evt_buf_sz); if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) { /* pass the cmd packet to PAL driver */ - if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, osbuf) == TRUE) + if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(ar->hcipal_info, osbuf) == true) return; } ar6000_deliver_frames_to_nw_stack(ar->arNetDev, osbuf); @@ -4802,7 +4849,7 @@ ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd) } void -ar6000_neighborReport_event(AR_SOFTC_T *ar, int numAps, WMI_NEIGHBOR_INFO *info) +ar6000_neighborReport_event(struct ar6_softc *ar, int numAps, WMI_NEIGHBOR_INFO *info) { #if WIRELESS_EXT >= 18 struct iw_pmkid_cand *pmkcand; @@ -4833,7 +4880,7 @@ ar6000_neighborReport_event(AR_SOFTC_T *ar, int numAps, WMI_NEIGHBOR_INFO *info) A_MEMZERO(pmkcand, sizeof(struct iw_pmkid_cand)); pmkcand->index = i; pmkcand->flags = info->bssFlags; - A_MEMCPY(pmkcand->bssid.sa_data, info->bssid, ATH_MAC_LEN); + memcpy(pmkcand->bssid.sa_data, info->bssid, ATH_MAC_LEN); wrqu.data.length = sizeof(struct iw_pmkid_cand); wireless_send_event(ar->arNetDev, IWEVPMKIDCAND, &wrqu, (char *)pmkcand); A_FREE(pmkcand); @@ -4850,7 +4897,7 @@ ar6000_neighborReport_event(AR_SOFTC_T *ar, int numAps, WMI_NEIGHBOR_INFO *info) } void -ar6000_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast) +ar6000_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast) { static const char *tag = "MLME-MICHAELMICFAILURE.indication"; char buf[128]; @@ -4887,7 +4934,7 @@ ar6000_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast) } void -ar6000_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) +ar6000_scanComplete_event(struct ar6_softc *ar, int status) { #ifdef ATH6K_CONFIG_CFG80211 @@ -4898,7 +4945,7 @@ ar6000_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0); } if (ar->scan_triggered) { - if (status==A_OK) { + if (status== 0) { union iwreq_data wrqu; A_MEMZERO(&wrqu, sizeof(wrqu)); wireless_send_event(ar->arNetDev, SIOCGIWSCAN, &wrqu, NULL); @@ -4910,9 +4957,9 @@ ar6000_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) } void -ar6000_targetStats_event(AR_SOFTC_T *ar, A_UINT8 *ptr, A_UINT32 len) +ar6000_targetStats_event(struct ar6_softc *ar, u8 *ptr, u32 len) { - A_UINT8 ac; + u8 ac; if(ar->arNetworkType == AP_NETWORK) { WMI_AP_MODE_STAT *p = (WMI_AP_MODE_STAT *)ptr; @@ -5028,14 +5075,14 @@ ar6000_targetStats_event(AR_SOFTC_T *ar, A_UINT8 *ptr, A_UINT32 len) pStats->arp_replied += pTarget->arpStats.arp_replied; if (ar->statsUpdatePending) { - ar->statsUpdatePending = FALSE; + ar->statsUpdatePending = false; wake_up(&arEvent); } } } void -ar6000_rssiThreshold_event(AR_SOFTC_T *ar, WMI_RSSI_THRESHOLD_VAL newThreshold, A_INT16 rssi) +ar6000_rssiThreshold_event(struct ar6_softc *ar, WMI_RSSI_THRESHOLD_VAL newThreshold, s16 rssi) { USER_RSSI_THOLD userRssiThold; @@ -5051,28 +5098,28 @@ ar6000_rssiThreshold_event(AR_SOFTC_T *ar, WMI_RSSI_THRESHOLD_VAL newThreshold, A_PRINTF("rssi Threshold range = %d tag = %d rssi = %d\n", newThreshold, userRssiThold.tag, userRssiThold.rssi); - ar6000_send_event_to_app(ar, WMI_RSSI_THRESHOLD_EVENTID,(A_UINT8 *)&userRssiThold, sizeof(USER_RSSI_THOLD)); + ar6000_send_event_to_app(ar, WMI_RSSI_THRESHOLD_EVENTID,(u8 *)&userRssiThold, sizeof(USER_RSSI_THOLD)); } void -ar6000_hbChallengeResp_event(AR_SOFTC_T *ar, A_UINT32 cookie, A_UINT32 source) +ar6000_hbChallengeResp_event(struct ar6_softc *ar, u32 cookie, u32 source) { if (source == APP_HB_CHALLENGE) { /* Report it to the app in case it wants a positive acknowledgement */ ar6000_send_event_to_app(ar, WMIX_HB_CHALLENGE_RESP_EVENTID, - (A_UINT8 *)&cookie, sizeof(cookie)); + (u8 *)&cookie, sizeof(cookie)); } else { /* This would ignore the replys that come in after their due time */ if (cookie == ar->arHBChallengeResp.seqNum) { - ar->arHBChallengeResp.outstanding = FALSE; + ar->arHBChallengeResp.outstanding = false; } } } void -ar6000_reportError_event(AR_SOFTC_T *ar, WMI_TARGET_ERROR_VAL errorVal) +ar6000_reportError_event(struct ar6_softc *ar, WMI_TARGET_ERROR_VAL errorVal) { static const char * const errString[] = { [WMI_TARGET_PM_ERR_FAIL] "WMI_TARGET_PM_ERR_FAIL", @@ -5107,8 +5154,8 @@ ar6000_reportError_event(AR_SOFTC_T *ar, WMI_TARGET_ERROR_VAL errorVal) void -ar6000_cac_event(AR_SOFTC_T *ar, A_UINT8 ac, A_UINT8 cacIndication, - A_UINT8 statusCode, A_UINT8 *tspecSuggestion) +ar6000_cac_event(struct ar6_softc *ar, u8 ac, u8 cacIndication, + u8 statusCode, u8 *tspecSuggestion) { WMM_TSPEC_IE *tspecIe; @@ -5130,8 +5177,8 @@ ar6000_cac_event(AR_SOFTC_T *ar, A_UINT8 ac, A_UINT8 cacIndication, } void -ar6000_channel_change_event(AR_SOFTC_T *ar, A_UINT16 oldChannel, - A_UINT16 newChannel) +ar6000_channel_change_event(struct ar6_softc *ar, u16 oldChannel, + u16 newChannel) { A_PRINTF("Channel Change notification\nOld Channel: %d, New Channel: %d\n", oldChannel, newChannel); @@ -5144,9 +5191,9 @@ ar6000_channel_change_event(AR_SOFTC_T *ar, A_UINT16 oldChannel, } while(0) void -ar6000_roam_tbl_event(AR_SOFTC_T *ar, WMI_TARGET_ROAM_TBL *pTbl) +ar6000_roam_tbl_event(struct ar6_softc *ar, WMI_TARGET_ROAM_TBL *pTbl) { - A_UINT8 i; + u8 i; A_PRINTF("ROAM TABLE NO OF ENTRIES is %d ROAM MODE is %d\n", pTbl->numEntries, pTbl->roamMode); @@ -5169,9 +5216,9 @@ ar6000_roam_tbl_event(AR_SOFTC_T *ar, WMI_TARGET_ROAM_TBL *pTbl) } void -ar6000_wow_list_event(struct ar6_softc *ar, A_UINT8 num_filters, WMI_GET_WOW_LIST_REPLY *wow_reply) +ar6000_wow_list_event(struct ar6_softc *ar, u8 num_filters, WMI_GET_WOW_LIST_REPLY *wow_reply) { - A_UINT8 i,j; + u8 i,j; /*Each event now contains exactly one filter, see bug 26613*/ A_PRINTF("WOW pattern %d of %d patterns\n", wow_reply->this_filter_num, wow_reply->num_filters); @@ -5223,7 +5270,7 @@ ar6000_display_roam_time(WMI_TARGET_ROAM_TIME *p) } void -ar6000_roam_data_event(AR_SOFTC_T *ar, WMI_TARGET_ROAM_DATA *p) +ar6000_roam_data_event(struct ar6_softc *ar, WMI_TARGET_ROAM_DATA *p) { switch (p->roamDataType) { case ROAM_DATA_TIME: @@ -5235,7 +5282,7 @@ ar6000_roam_data_event(AR_SOFTC_T *ar, WMI_TARGET_ROAM_DATA *p) } void -ar6000_bssInfo_event_rx(AR_SOFTC_T *ar, A_UINT8 *datap, int len) +ar6000_bssInfo_event_rx(struct ar6_softc *ar, u8 *datap, int len) { struct sk_buff *skb; WMI_BSS_INFO_HDR *bih = (WMI_BSS_INFO_HDR *)datap; @@ -5255,9 +5302,9 @@ ar6000_bssInfo_event_rx(AR_SOFTC_T *ar, A_UINT8 *datap, int len) if ((skb = A_NETBUF_ALLOC_RAW(len)) != NULL) { A_NETBUF_PUT(skb, len); - A_MEMCPY(A_NETBUF_DATA(skb), datap, len); + memcpy(A_NETBUF_DATA(skb), datap, len); skb->dev = ar->arNetDev; - A_MEMCPY(skb_mac_header(skb), A_NETBUF_DATA(skb), 6); + memcpy(skb_mac_header(skb), A_NETBUF_DATA(skb), 6); skb->ip_summed = CHECKSUM_NONE; skb->pkt_type = PACKET_OTHERHOST; skb->protocol = __constant_htons(0x0019); @@ -5265,13 +5312,13 @@ ar6000_bssInfo_event_rx(AR_SOFTC_T *ar, A_UINT8 *datap, int len) } } -A_UINT32 wmiSendCmdNum; +u32 wmiSendCmdNum; -A_STATUS +int ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; - A_STATUS status = A_OK; + struct ar6_softc *ar = (struct ar6_softc *)devt; + int status = 0; struct ar_cookie *cookie = NULL; int i; #ifdef CONFIG_PM @@ -5306,13 +5353,13 @@ ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid) if(logWmiRawMsgs) { A_PRINTF("WMI cmd send, msgNo %d :", wmiSendCmdNum); for(i = 0; i < a_netbuf_to_len(osbuf); i++) - A_PRINTF("%x ", ((A_UINT8 *)a_netbuf_to_data(osbuf))[i]); + A_PRINTF("%x ", ((u8 *)a_netbuf_to_data(osbuf))[i]); A_PRINTF("\n"); } wmiSendCmdNum++; - } while (FALSE); + } while (false); if (cookie != NULL) { /* got a structure to send it out on */ @@ -5337,19 +5384,19 @@ ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid) /* this interface is asynchronous, if there is an error, cleanup will happen in the * TX completion callback */ HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt); - status = A_OK; + status = 0; } - if (status != A_OK) { + if (status) { A_NETBUF_FREE(osbuf); } return status; } /* indicate tx activity or inactivity on a WMI stream */ -void ar6000_indicate_tx_activity(void *devt, A_UINT8 TrafficClass, A_BOOL Active) +void ar6000_indicate_tx_activity(void *devt, u8 TrafficClass, bool Active) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; HTC_ENDPOINT_ID eid ; int i; @@ -5407,7 +5454,7 @@ void ar6000_indicate_tx_activity(void *devt, A_UINT8 TrafficClass, A_BOOL Active } void -ar6000_btcoex_config_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len) +ar6000_btcoex_config_event(struct ar6_softc *ar, u8 *ptr, u32 len) { WMI_BTCOEX_CONFIG_EVENT *pBtcoexConfig = (WMI_BTCOEX_CONFIG_EVENT *)ptr; @@ -5421,39 +5468,39 @@ ar6000_btcoex_config_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len) switch (pBtcoexConfig->btProfileType) { case WMI_BTCOEX_BT_PROFILE_SCO: - A_MEMCPY(&pArbtcoexConfig->info.scoConfigCmd, &pBtcoexConfig->info.scoConfigCmd, + memcpy(&pArbtcoexConfig->info.scoConfigCmd, &pBtcoexConfig->info.scoConfigCmd, sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD)); break; case WMI_BTCOEX_BT_PROFILE_A2DP: - A_MEMCPY(&pArbtcoexConfig->info.a2dpConfigCmd, &pBtcoexConfig->info.a2dpConfigCmd, + memcpy(&pArbtcoexConfig->info.a2dpConfigCmd, &pBtcoexConfig->info.a2dpConfigCmd, sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD)); break; case WMI_BTCOEX_BT_PROFILE_ACLCOEX: - A_MEMCPY(&pArbtcoexConfig->info.aclcoexConfig, &pBtcoexConfig->info.aclcoexConfig, + memcpy(&pArbtcoexConfig->info.aclcoexConfig, &pBtcoexConfig->info.aclcoexConfig, sizeof(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD)); break; case WMI_BTCOEX_BT_PROFILE_INQUIRY_PAGE: - A_MEMCPY(&pArbtcoexConfig->info.btinquiryPageConfigCmd, &pBtcoexConfig->info.btinquiryPageConfigCmd, + memcpy(&pArbtcoexConfig->info.btinquiryPageConfigCmd, &pBtcoexConfig->info.btinquiryPageConfigCmd, sizeof(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD)); break; } if (ar->statsUpdatePending) { - ar->statsUpdatePending = FALSE; + ar->statsUpdatePending = false; wake_up(&arEvent); } } void -ar6000_btcoex_stats_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len) +ar6000_btcoex_stats_event(struct ar6_softc *ar, u8 *ptr, u32 len) { WMI_BTCOEX_STATS_EVENT *pBtcoexStats = (WMI_BTCOEX_STATS_EVENT *)ptr; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 BTCOEX CONFIG EVENT \n")); - A_MEMCPY(&ar->arBtcoexStats, pBtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT)); + memcpy(&ar->arBtcoexStats, pBtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT)); if (ar->statsUpdatePending) { - ar->statsUpdatePending = FALSE; + ar->statsUpdatePending = false; wake_up(&arEvent); } @@ -5463,9 +5510,9 @@ module_exit(ar6000_cleanup_module); /* Init cookie queue */ static void -ar6000_cookie_init(AR_SOFTC_T *ar) +ar6000_cookie_init(struct ar6_softc *ar) { - A_UINT32 i; + u32 i; ar->arCookieList = NULL; ar->arCookieCount = 0; @@ -5479,7 +5526,7 @@ ar6000_cookie_init(AR_SOFTC_T *ar) /* cleanup cookie queue */ static void -ar6000_cookie_cleanup(AR_SOFTC_T *ar) +ar6000_cookie_cleanup(struct ar6_softc *ar) { /* It is gone .... */ ar->arCookieList = NULL; @@ -5488,7 +5535,7 @@ ar6000_cookie_cleanup(AR_SOFTC_T *ar) /* Init cookie queue */ static void -ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie) +ar6000_free_cookie(struct ar6_softc *ar, struct ar_cookie * cookie) { /* Insert first */ A_ASSERT(ar != NULL); @@ -5501,7 +5548,7 @@ ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie) /* cleanup cookie queue */ static struct ar_cookie * -ar6000_alloc_cookie(AR_SOFTC_T *ar) +ar6000_alloc_cookie(struct ar6_softc *ar) { struct ar_cookie *cookie; @@ -5522,8 +5569,8 @@ ar6000_alloc_cookie(AR_SOFTC_T *ar) * the event ID and event content. */ #define EVENT_ID_LEN 2 -void ar6000_send_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, - A_UINT8 *datap, int len) +void ar6000_send_event_to_app(struct ar6_softc *ar, u16 eventId, + u8 *datap, int len) { #if (WIRELESS_EXT >= 15) @@ -5531,7 +5578,7 @@ void ar6000_send_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, /* note: IWEVCUSTOM only exists in wireless extensions after version 15 */ char *buf; - A_UINT16 size; + u16 size; union iwreq_data wrqu; size = len + EVENT_ID_LEN; @@ -5549,10 +5596,10 @@ void ar6000_send_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, } A_MEMZERO(buf, size); - A_MEMCPY(buf, &eventId, EVENT_ID_LEN); - A_MEMCPY(buf+EVENT_ID_LEN, datap, len); + memcpy(buf, &eventId, EVENT_ID_LEN); + memcpy(buf+EVENT_ID_LEN, datap, len); - //AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("event ID = %d,len = %d\n",*(A_UINT16*)buf, size)); + //AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("event ID = %d,len = %d\n",*(u16 *)buf, size)); A_MEMZERO(&wrqu, sizeof(wrqu)); wrqu.data.length = size; wireless_send_event(ar->arNetDev, IWEVCUSTOM, &wrqu, buf); @@ -5567,8 +5614,8 @@ void ar6000_send_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, * to the application. The buf which is sent to application * includes the event ID and event content. */ -void ar6000_send_generic_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, - A_UINT8 *datap, int len) +void ar6000_send_generic_event_to_app(struct ar6_softc *ar, u16 eventId, + u8 *datap, int len) { #if (WIRELESS_EXT >= 18) @@ -5576,7 +5623,7 @@ void ar6000_send_generic_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, /* IWEVGENIE exists in wireless extensions version 18 onwards */ char *buf; - A_UINT16 size; + u16 size; union iwreq_data wrqu; size = len + EVENT_ID_LEN; @@ -5594,8 +5641,8 @@ void ar6000_send_generic_event_to_app(AR_SOFTC_T *ar, A_UINT16 eventId, } A_MEMZERO(buf, size); - A_MEMCPY(buf, &eventId, EVENT_ID_LEN); - A_MEMCPY(buf+EVENT_ID_LEN, datap, len); + memcpy(buf, &eventId, EVENT_ID_LEN); + memcpy(buf+EVENT_ID_LEN, datap, len); A_MEMZERO(&wrqu, sizeof(wrqu)); wrqu.data.length = size; @@ -5616,54 +5663,52 @@ ar6000_tx_retry_err_event(void *devt) } void -ar6000_snrThresholdEvent_rx(void *devt, WMI_SNR_THRESHOLD_VAL newThreshold, A_UINT8 snr) +ar6000_snrThresholdEvent_rx(void *devt, WMI_SNR_THRESHOLD_VAL newThreshold, u8 snr) { WMI_SNR_THRESHOLD_EVENT event; - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; event.range = newThreshold; event.snr = snr; - ar6000_send_event_to_app(ar, WMI_SNR_THRESHOLD_EVENTID, (A_UINT8 *)&event, + ar6000_send_event_to_app(ar, WMI_SNR_THRESHOLD_EVENTID, (u8 *)&event, sizeof(WMI_SNR_THRESHOLD_EVENT)); } void -ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL newThreshold, A_UINT8 lq) +ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL newThreshold, u8 lq) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("lq threshold range %d, lq %d\n", newThreshold, lq)); } -A_UINT32 -a_copy_to_user(void *to, const void *from, A_UINT32 n) +u32 a_copy_to_user(void *to, const void *from, u32 n) { return(copy_to_user(to, from, n)); } -A_UINT32 -a_copy_from_user(void *to, const void *from, A_UINT32 n) +u32 a_copy_from_user(void *to, const void *from, u32 n) { return(copy_from_user(to, from, n)); } -A_STATUS +int ar6000_get_driver_cfg(struct net_device *dev, - A_UINT16 cfgParam, + u16 cfgParam, void *result) { - A_STATUS ret = 0; + int ret = 0; switch(cfgParam) { case AR6000_DRIVER_CFG_GET_WLANNODECACHING: - *((A_UINT32 *)result) = wlanNodeCaching; + *((u32 *)result) = wlanNodeCaching; break; case AR6000_DRIVER_CFG_LOG_RAW_WMI_MSGS: - *((A_UINT32 *)result) = logWmiRawMsgs; + *((u32 *)result) = logWmiRawMsgs; break; default: ret = EINVAL; @@ -5674,19 +5719,19 @@ ar6000_get_driver_cfg(struct net_device *dev, } void -ar6000_keepalive_rx(void *devt, A_UINT8 configured) +ar6000_keepalive_rx(void *devt, u8 configured) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)devt; + struct ar6_softc *ar = (struct ar6_softc *)devt; ar->arKeepaliveConfigured = configured; wake_up(&arEvent); } void -ar6000_pmkid_list_event(void *devt, A_UINT8 numPMKID, WMI_PMKID *pmkidList, - A_UINT8 *bssidList) +ar6000_pmkid_list_event(void *devt, u8 numPMKID, WMI_PMKID *pmkidList, + u8 *bssidList) { - A_UINT8 i, j; + u8 i, j; A_PRINTF("Number of Cached PMKIDs is %d\n", numPMKID); @@ -5700,15 +5745,15 @@ ar6000_pmkid_list_event(void *devt, A_UINT8 numPMKID, WMI_PMKID *pmkidList, for (j = 0; j < WMI_PMKID_LEN; j++) { A_PRINTF("%2.2x", pmkidList->pmkid[j]); } - pmkidList = (WMI_PMKID *)((A_UINT8 *)pmkidList + ATH_MAC_LEN + + pmkidList = (WMI_PMKID *)((u8 *)pmkidList + ATH_MAC_LEN + WMI_PMKID_LEN); } } -void ar6000_pspoll_event(AR_SOFTC_T *ar,A_UINT8 aid) +void ar6000_pspoll_event(struct ar6_softc *ar,u8 aid) { sta_t *conn=NULL; - A_BOOL isPsqEmpty = FALSE; + bool isPsqEmpty = false; conn = ieee80211_find_conn_for_aid(ar, aid); @@ -5745,9 +5790,9 @@ void ar6000_pspoll_event(AR_SOFTC_T *ar,A_UINT8 aid) } } -void ar6000_dtimexpiry_event(AR_SOFTC_T *ar) +void ar6000_dtimexpiry_event(struct ar6_softc *ar) { - A_BOOL isMcastQueued = FALSE; + bool isMcastQueued = false; struct sk_buff *skb = NULL; /* If there are no associated STAs, ignore the DTIM expiry event. @@ -5766,11 +5811,11 @@ void ar6000_dtimexpiry_event(AR_SOFTC_T *ar) isMcastQueued = A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq); A_MUTEX_UNLOCK(&ar->mcastpsqLock); - A_ASSERT(isMcastQueued == FALSE); + A_ASSERT(isMcastQueued == false); /* Flush the mcast psq to the target */ /* Set the STA flag to DTIMExpired, so that the frame will go out */ - ar->DTIMExpired = TRUE; + ar->DTIMExpired = true; A_MUTEX_LOCK(&ar->mcastpsqLock); while (!A_NETBUF_QUEUE_EMPTY(&ar->mcastpsq)) { @@ -5784,37 +5829,37 @@ void ar6000_dtimexpiry_event(AR_SOFTC_T *ar) A_MUTEX_UNLOCK(&ar->mcastpsqLock); /* Reset the DTIMExpired flag back to 0 */ - ar->DTIMExpired = FALSE; + ar->DTIMExpired = false; /* Clear the LSB of the BitMapCtl field of the TIM IE */ wmi_set_pvb_cmd(ar->arWmi, MCAST_AID, 0); } void -read_rssi_compensation_param(AR_SOFTC_T *ar) +read_rssi_compensation_param(struct ar6_softc *ar) { - A_UINT8 *cust_data_ptr; + u8 *cust_data_ptr; //#define RSSICOMPENSATION_PRINT #ifdef RSSICOMPENSATION_PRINT - A_INT16 i; + s16 i; cust_data_ptr = ar6000_get_cust_data_buffer(ar->arTargetType); for (i=0; i<16; i++) { - A_PRINTF("cust_data_%d = %x \n", i, *(A_UINT8 *)cust_data_ptr); + A_PRINTF("cust_data_%d = %x \n", i, *(u8 *)cust_data_ptr); cust_data_ptr += 1; } #endif cust_data_ptr = ar6000_get_cust_data_buffer(ar->arTargetType); - rssi_compensation_param.customerID = *(A_UINT16 *)cust_data_ptr & 0xffff; - rssi_compensation_param.enable = *(A_UINT16 *)(cust_data_ptr+2) & 0xffff; - rssi_compensation_param.bg_param_a = *(A_UINT16 *)(cust_data_ptr+4) & 0xffff; - rssi_compensation_param.bg_param_b = *(A_UINT16 *)(cust_data_ptr+6) & 0xffff; - rssi_compensation_param.a_param_a = *(A_UINT16 *)(cust_data_ptr+8) & 0xffff; - rssi_compensation_param.a_param_b = *(A_UINT16 *)(cust_data_ptr+10) &0xffff; - rssi_compensation_param.reserved = *(A_UINT32 *)(cust_data_ptr+12); + rssi_compensation_param.customerID = *(u16 *)cust_data_ptr & 0xffff; + rssi_compensation_param.enable = *(u16 *)(cust_data_ptr+2) & 0xffff; + rssi_compensation_param.bg_param_a = *(u16 *)(cust_data_ptr+4) & 0xffff; + rssi_compensation_param.bg_param_b = *(u16 *)(cust_data_ptr+6) & 0xffff; + rssi_compensation_param.a_param_a = *(u16 *)(cust_data_ptr+8) & 0xffff; + rssi_compensation_param.a_param_b = *(u16 *)(cust_data_ptr+10) &0xffff; + rssi_compensation_param.reserved = *(u32 *)(cust_data_ptr+12); #ifdef RSSICOMPENSATION_PRINT A_PRINTF("customerID = 0x%x \n", rssi_compensation_param.customerID); @@ -5833,8 +5878,7 @@ read_rssi_compensation_param(AR_SOFTC_T *ar) return; } -A_INT32 -rssi_compensation_calc_tcmd(A_UINT32 freq, A_INT32 rssi, A_UINT32 totalPkt) +s32 rssi_compensation_calc_tcmd(u32 freq, s32 rssi, u32 totalPkt) { if (freq > 5000) @@ -5863,8 +5907,7 @@ rssi_compensation_calc_tcmd(A_UINT32 freq, A_INT32 rssi, A_UINT32 totalPkt) return rssi; } -A_INT16 -rssi_compensation_calc(AR_SOFTC_T *ar, A_INT16 rssi) +s16 rssi_compensation_calc(struct ar6_softc *ar, s16 rssi) { if (ar->arBssChannel > 5000) { @@ -5892,10 +5935,9 @@ rssi_compensation_calc(AR_SOFTC_T *ar, A_INT16 rssi) return rssi; } -A_INT16 -rssi_compensation_reverse_calc(AR_SOFTC_T *ar, A_INT16 rssi, A_BOOL Above) +s16 rssi_compensation_reverse_calc(struct ar6_softc *ar, s16 rssi, bool Above) { - A_INT16 i; + s16 i; if (ar->arBssChannel > 5000) { @@ -5938,16 +5980,16 @@ rssi_compensation_reverse_calc(AR_SOFTC_T *ar, A_INT16 rssi, A_BOOL Above) } #ifdef WAPI_ENABLE -void ap_wapi_rekey_event(AR_SOFTC_T *ar, A_UINT8 type, A_UINT8 *mac) +void ap_wapi_rekey_event(struct ar6_softc *ar, u8 type, u8 *mac) { union iwreq_data wrqu; - A_CHAR buf[20]; + char buf[20]; A_MEMZERO(buf, sizeof(buf)); strcpy(buf, "WAPI_REKEY"); buf[10] = type; - A_MEMCPY(&buf[11], mac, ATH_MAC_LEN); + memcpy(&buf[11], mac, ATH_MAC_LEN); A_MEMZERO(&wrqu, sizeof(wrqu)); wrqu.data.length = 10+1+ATH_MAC_LEN; @@ -5958,11 +6000,11 @@ void ap_wapi_rekey_event(AR_SOFTC_T *ar, A_UINT8 type, A_UINT8 *mac) #endif #ifdef USER_KEYS -static A_STATUS +static int -ar6000_reinstall_keys(AR_SOFTC_T *ar, A_UINT8 key_op_ctrl) +ar6000_reinstall_keys(struct ar6_softc *ar, u8 key_op_ctrl) { - A_STATUS status = A_OK; + int status = 0; struct ieee80211req_key *uik = &ar->user_saved_keys.ucast_ik; struct ieee80211req_key *bik = &ar->user_saved_keys.bcast_ik; CRYPTO_TYPE keyType = ar->user_saved_keys.keyType; @@ -5975,7 +6017,7 @@ ar6000_reinstall_keys(AR_SOFTC_T *ar, A_UINT8 key_op_ctrl) if (uik->ik_keylen) { status = wmi_addKey_cmd(ar->arWmi, uik->ik_keyix, ar->user_saved_keys.keyType, PAIRWISE_USAGE, - uik->ik_keylen, (A_UINT8 *)&uik->ik_keyrsc, + uik->ik_keylen, (u8 *)&uik->ik_keyrsc, uik->ik_keydata, key_op_ctrl, uik->ik_macaddr, SYNC_BEFORE_WMIFLAG); } @@ -5991,7 +6033,7 @@ ar6000_reinstall_keys(AR_SOFTC_T *ar, A_UINT8 key_op_ctrl) if (bik->ik_keylen) { status = wmi_addKey_cmd(ar->arWmi, bik->ik_keyix, ar->user_saved_keys.keyType, GROUP_USAGE, - bik->ik_keylen, (A_UINT8 *)&bik->ik_keyrsc, + bik->ik_keylen, (u8 *)&bik->ik_keyrsc, bik->ik_keydata, key_op_ctrl, bik->ik_macaddr, NO_SYNC_WMIFLAG); } } else { @@ -6010,17 +6052,17 @@ _reinstall_keys_out: void ar6000_dset_open_req( void *context, - A_UINT32 id, - A_UINT32 targHandle, - A_UINT32 targReplyFn, - A_UINT32 targReplyArg) + u32 id, + u32 targHandle, + u32 targReplyFn, + u32 targReplyArg) { } void ar6000_dset_close( void *context, - A_UINT32 access_cookie) + u32 access_cookie) { return; } @@ -6028,12 +6070,12 @@ ar6000_dset_close( void ar6000_dset_data_req( void *context, - A_UINT32 accessCookie, - A_UINT32 offset, - A_UINT32 length, - A_UINT32 targBuf, - A_UINT32 targReplyFn, - A_UINT32 targReplyArg) + u32 accessCookie, + u32 offset, + u32 length, + u32 targBuf, + u32 targReplyFn, + u32 targReplyArg) { } @@ -6079,7 +6121,7 @@ ar6000_ap_mode_profile_commit(struct ar6_softc *ar) A_MEMZERO(&p,sizeof(p)); p.ssidLength = ar->arSsidLen; - A_MEMCPY(p.ssid,ar->arSsid,p.ssidLength); + memcpy(p.ssid,ar->arSsid,p.ssidLength); p.channel = ar->arChannelHint; p.networkType = ar->arNetworkType; @@ -6091,26 +6133,24 @@ ar6000_ap_mode_profile_commit(struct ar6_softc *ar) p.groupCryptoLen = ar->arGroupCryptoLen; p.ctrl_flags = ar->arConnectCtrlFlags; - ar->arConnected = FALSE; - wmi_ap_profile_commit(ar->arWmi, &p); spin_lock_irqsave(&ar->arLock, flags); - ar->arConnected = TRUE; + ar->arConnected = true; netif_carrier_on(ar->arNetDev); spin_unlock_irqrestore(&ar->arLock, flags); ar->ap_profile_flag = 0; return 0; } -A_STATUS +int ar6000_connect_to_ap(struct ar6_softc *ar) { /* The ssid length check prevents second "essid off" from the user, to be treated as a connect cmd. The second "essid off" is ignored. */ - if((ar->arWmiReady == TRUE) && (ar->arSsidLen > 0) && ar->arNetworkType!=AP_NETWORK) + if((ar->arWmiReady == true) && (ar->arSsidLen > 0) && ar->arNetworkType!=AP_NETWORK) { - A_STATUS status; + int status; if((ADHOC_NETWORK != ar->arNetworkType) && (NONE_AUTH==ar->arAuthMode) && (WEP_CRYPT==ar->arPairwiseCrypto)) { @@ -6118,7 +6158,7 @@ ar6000_connect_to_ap(struct ar6_softc *ar) } if (!ar->arUserBssFilter) { - if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != A_OK) { + if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != 0) { return -EIO; } } @@ -6142,7 +6182,7 @@ ar6000_connect_to_ap(struct ar6_softc *ar) /* Set the listen interval into 1000TUs or more. This value will be indicated to Ap in the conn. later set it back locally at the STA to 100/1000 TUs depending on the power mode */ if ((ar->arNetworkType == INFRA_NETWORK)) { - wmi_listeninterval_cmd(ar->arWmi, max(ar->arListenIntervalT, (A_UINT16)A_MAX_WOW_LISTEN_INTERVAL), 0); + wmi_listeninterval_cmd(ar->arWmi, max(ar->arListenIntervalT, (u16)A_MAX_WOW_LISTEN_INTERVAL), 0); } status = wmi_connect_cmd(ar->arWmi, ar->arNetworkType, ar->arDot11AuthMode, ar->arAuthMode, @@ -6151,7 +6191,7 @@ ar6000_connect_to_ap(struct ar6_softc *ar) ar->arSsidLen, ar->arSsid, ar->arReqBssid, ar->arChannelHint, ar->arConnectCtrlFlags); - if (status != A_OK) { + if (status) { wmi_listeninterval_cmd(ar->arWmi, ar->arListenIntervalT, ar->arListenIntervalB); if (!ar->arUserBssFilter) { wmi_bssfilter_cmd(ar->arWmi, NONE_BSS_FILTER, 0); @@ -6167,13 +6207,28 @@ ar6000_connect_to_ap(struct ar6_softc *ar) ar->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD; - ar->arConnectPending = TRUE; + ar->arConnectPending = true; return status; } return A_ERROR; } -A_STATUS +int +ar6000_disconnect(struct ar6_softc *ar) +{ + if ((ar->arConnected == true) || (ar->arConnectPending == true)) { + wmi_disconnect_cmd(ar->arWmi); + /* + * Disconnect cmd is issued, clear connectPending. + * arConnected will be cleard in disconnect_event notification. + */ + ar->arConnectPending = false; + } + + return 0; +} + +int ar6000_ap_mode_get_wpa_ie(struct ar6_softc *ar, struct ieee80211req_wpaie *wpaie) { sta_t *conn = NULL; @@ -6183,38 +6238,38 @@ ar6000_ap_mode_get_wpa_ie(struct ar6_softc *ar, struct ieee80211req_wpaie *wpaie A_MEMZERO(wpaie->rsn_ie, IEEE80211_MAX_IE); if(conn) { - A_MEMCPY(wpaie->wpa_ie, conn->wpa_ie, IEEE80211_MAX_IE); + memcpy(wpaie->wpa_ie, conn->wpa_ie, IEEE80211_MAX_IE); } return 0; } -A_STATUS -is_iwioctl_allowed(A_UINT8 mode, A_UINT16 cmd) +int +is_iwioctl_allowed(u8 mode, u16 cmd) { if(cmd >= SIOCSIWCOMMIT && cmd <= SIOCGIWPOWER) { cmd -= SIOCSIWCOMMIT; - if(sioctl_filter[cmd] == 0xFF) return A_OK; - if(sioctl_filter[cmd] & mode) return A_OK; + if(sioctl_filter[cmd] == 0xFF) return 0; + if(sioctl_filter[cmd] & mode) return 0; } else if(cmd >= SIOCIWFIRSTPRIV && cmd <= (SIOCIWFIRSTPRIV+30)) { cmd -= SIOCIWFIRSTPRIV; - if(pioctl_filter[cmd] == 0xFF) return A_OK; - if(pioctl_filter[cmd] & mode) return A_OK; + if(pioctl_filter[cmd] == 0xFF) return 0; + if(pioctl_filter[cmd] & mode) return 0; } else { return A_ERROR; } return A_ENOTSUP; } -A_STATUS -is_xioctl_allowed(A_UINT8 mode, int cmd) +int +is_xioctl_allowed(u8 mode, int cmd) { if(sizeof(xioctl_filter)-1 < cmd) { A_PRINTF("Filter for this cmd=%d not defined\n",cmd); return 0; } - if(xioctl_filter[cmd] == 0xFF) return A_OK; - if(xioctl_filter[cmd] & mode) return A_OK; + if(xioctl_filter[cmd] == 0xFF) return 0; + if(xioctl_filter[cmd] & mode) return 0; return A_ERROR; } @@ -6224,9 +6279,9 @@ ap_set_wapi_key(struct ar6_softc *ar, void *ikey) { struct ieee80211req_key *ik = (struct ieee80211req_key *)ikey; KEY_USAGE keyUsage = 0; - A_STATUS status; + int status; - if (A_MEMCMP(ik->ik_macaddr, bcast_mac, IEEE80211_ADDR_LEN) == 0) { + if (memcmp(ik->ik_macaddr, bcast_mac, IEEE80211_ADDR_LEN) == 0) { keyUsage = GROUP_USAGE; } else { keyUsage = PAIRWISE_USAGE; @@ -6236,11 +6291,11 @@ ap_set_wapi_key(struct ar6_softc *ar, void *ikey) ik->ik_keylen); status = wmi_addKey_cmd(ar->arWmi, ik->ik_keyix, WAPI_CRYPT, keyUsage, - ik->ik_keylen, (A_UINT8 *)&ik->ik_keyrsc, + ik->ik_keylen, (u8 *)&ik->ik_keyrsc, ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr, SYNC_BOTH_WMIFLAG); - if (A_OK != status) { + if (0 != status) { return -EIO; } return 0; @@ -6249,10 +6304,10 @@ ap_set_wapi_key(struct ar6_softc *ar, void *ikey) void ar6000_peer_event( void *context, - A_UINT8 eventCode, - A_UINT8 *macAddr) + u8 eventCode, + u8 *macAddr) { - A_UINT8 pos; + u8 pos; for (pos=0;pos<6;pos++) printk("%02x: ",*(macAddr+pos)); @@ -6261,14 +6316,14 @@ void ar6000_peer_event( #ifdef HTC_TEST_SEND_PKTS #define HTC_TEST_DUPLICATE 8 -static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *dupskb) +static void DoHTCSendPktsTest(struct ar6_softc *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *dupskb) { struct ar_cookie *cookie; struct ar_cookie *cookieArray[HTC_TEST_DUPLICATE]; struct sk_buff *new_skb; int i; int pkts = 0; - HTC_PACKET_QUEUE pktQueue; + struct htc_packet_queue pktQueue; EPPING_HEADER *eppingHdr; eppingHdr = A_NETBUF_DATA(dupskb); @@ -6338,44 +6393,44 @@ static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, st /* * Add support for adding and removing a virtual adapter for soft AP. * Some OS requires different adapters names for station and soft AP mode. - * To support these requirement, create and destory a netdevice instance + * To support these requirement, create and destroy a netdevice instance * when the AP mode is operational. A full fledged support for virual device * is not implemented. Rather a virtual interface is created and is linked * with the existing physical device instance during the operation of the * AP mode. */ -A_STATUS ar6000_start_ap_interface(AR_SOFTC_T *ar) +int ar6000_start_ap_interface(struct ar6_softc *ar) { - AR_VIRTUAL_INTERFACE_T *arApDev; + struct ar_virtual_interface *arApDev; /* Change net_device to point to AP instance */ - arApDev = (AR_VIRTUAL_INTERFACE_T *)ar->arApDev; + arApDev = (struct ar_virtual_interface *)ar->arApDev; ar->arNetDev = arApDev->arNetDev; - return A_OK; + return 0; } -A_STATUS ar6000_stop_ap_interface(AR_SOFTC_T *ar) +int ar6000_stop_ap_interface(struct ar6_softc *ar) { - AR_VIRTUAL_INTERFACE_T *arApDev; + struct ar_virtual_interface *arApDev; /* Change net_device to point to sta instance */ - arApDev = (AR_VIRTUAL_INTERFACE_T *)ar->arApDev; + arApDev = (struct ar_virtual_interface *)ar->arApDev; if (arApDev) { ar->arNetDev = arApDev->arStaNetDev; } - return A_OK; + return 0; } -A_STATUS ar6000_create_ap_interface(AR_SOFTC_T *ar, char *ap_ifname) +int ar6000_create_ap_interface(struct ar6_softc *ar, char *ap_ifname) { struct net_device *dev; - AR_VIRTUAL_INTERFACE_T *arApDev; + struct ar_virtual_interface *arApDev; - dev = alloc_etherdev(sizeof(AR_VIRTUAL_INTERFACE_T)); + dev = alloc_etherdev(sizeof(struct ar_virtual_interface)); if (dev == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_create_ap_interface: can't alloc etherdev\n")); return A_ERROR; @@ -6398,20 +6453,20 @@ A_STATUS ar6000_create_ap_interface(AR_SOFTC_T *ar, char *ap_ifname) arApNetDev = dev; /* Copy the MAC address */ - A_MEMCPY(dev->dev_addr, ar->arNetDev->dev_addr, AR6000_ETH_ADDR_LEN); + memcpy(dev->dev_addr, ar->arNetDev->dev_addr, AR6000_ETH_ADDR_LEN); - return A_OK; + return 0; } -A_STATUS ar6000_add_ap_interface(AR_SOFTC_T *ar, char *ap_ifname) +int ar6000_add_ap_interface(struct ar6_softc *ar, char *ap_ifname) { /* Interface already added, need not proceed further */ if (ar->arApDev != NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_add_ap_interface: interface already present \n")); - return A_OK; + return 0; } - if (ar6000_create_ap_interface(ar, ap_ifname) != A_OK) { + if (ar6000_create_ap_interface(ar, ap_ifname) != 0) { return A_ERROR; } @@ -6420,7 +6475,7 @@ A_STATUS ar6000_add_ap_interface(AR_SOFTC_T *ar, char *ap_ifname) return ar6000_start_ap_interface(ar); } -A_STATUS ar6000_remove_ap_interface(AR_SOFTC_T *ar) +int ar6000_remove_ap_interface(struct ar6_softc *ar) { if (arApNetDev) { ar6000_stop_ap_interface(ar); @@ -6434,7 +6489,7 @@ A_STATUS ar6000_remove_ap_interface(AR_SOFTC_T *ar) arApNetDev = NULL; - return A_OK; + return 0; } #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */ |