diff options
Diffstat (limited to 'drivers/staging/csr')
28 files changed, 238 insertions, 1079 deletions
diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index afda44b0a925..ab626edc5ba4 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -25,7 +25,6 @@ csr_wifi-y := bh.o \ unifi_event.o \ unifi_pdu_processing.o \ unifi_sme.o \ - csr_formatted_io.o \ csr_wifi_hip_card_sdio.o \ csr_wifi_hip_card_sdio_intr.o \ csr_wifi_hip_card_sdio_mem.o \ diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c index b089c28d5610..addee05a4516 100644 --- a/drivers/staging/csr/bh.c +++ b/drivers/staging/csr/bh.c @@ -32,45 +32,49 @@ * 0 on success or else a Linux error code. * --------------------------------------------------------------------------- */ -int -uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *)) +int uf_start_thread(unifi_priv_t *priv, + struct uf_thread *thread, int (*func)(void *)) { - if (thread->thread_task != NULL) { - unifi_error(priv, "%s thread already started\n", thread->name); - return 0; - } - - /* Start the kernel thread that handles all h/w accesses. */ - thread->thread_task = kthread_run(func, priv, "%s", thread->name); - if (IS_ERR(thread->thread_task)) { - return PTR_ERR(thread->thread_task); - } - - /* Module parameter overides the thread priority */ - if (bh_priority != -1) { - if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) { - struct sched_param param; - priv->bh_thread.prio = bh_priority; - unifi_trace(priv, UDBG1, "%s thread (RT) priority = %d\n", - thread->name, bh_priority); - param.sched_priority = bh_priority; - sched_setscheduler(thread->thread_task, SCHED_FIFO, ¶m); - } else if (bh_priority > MAX_RT_PRIO && bh_priority <= MAX_PRIO) { - priv->bh_thread.prio = bh_priority; - unifi_trace(priv, UDBG1, "%s thread priority = %d\n", - thread->name, PRIO_TO_NICE(bh_priority)); - set_user_nice(thread->thread_task, PRIO_TO_NICE(bh_priority)); - } else { - priv->bh_thread.prio = DEFAULT_PRIO; - unifi_warning(priv, "%s thread unsupported (%d) priority\n", - thread->name, bh_priority); - } - } else { - priv->bh_thread.prio = DEFAULT_PRIO; - } - unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name); - - return 0; + if (thread->thread_task != NULL) { + unifi_error(priv, "%s thread already started\n", thread->name); + return 0; + } + + /* Start the kernel thread that handles all h/w accesses. */ + thread->thread_task = kthread_run(func, priv, "%s", thread->name); + if (IS_ERR(thread->thread_task)) + return PTR_ERR(thread->thread_task); + + /* Module parameter overides the thread priority */ + if (bh_priority != -1) { + if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) { + struct sched_param param; + priv->bh_thread.prio = bh_priority; + unifi_trace(priv, UDBG1, + "%s thread (RT) priority = %d\n", + thread->name, bh_priority); + param.sched_priority = bh_priority; + sched_setscheduler(thread->thread_task, + SCHED_FIFO, ¶m); + } else if (bh_priority > MAX_RT_PRIO && + bh_priority <= MAX_PRIO) { + priv->bh_thread.prio = bh_priority; + unifi_trace(priv, UDBG1, "%s thread priority = %d\n", + thread->name, + PRIO_TO_NICE(bh_priority)); + set_user_nice(thread->thread_task, + PRIO_TO_NICE(bh_priority)); + } else { + priv->bh_thread.prio = DEFAULT_PRIO; + unifi_warning(priv, + "%s thread unsupported (%d) priority\n", + thread->name, bh_priority); + } + } else + priv->bh_thread.prio = DEFAULT_PRIO; + unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name); + + return 0; } /* uf_start_thread() */ @@ -88,18 +92,18 @@ uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void * * * --------------------------------------------------------------------------- */ - void -uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread) +void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread) { - if (!thread->thread_task) { - unifi_notice(priv, "%s thread is already stopped\n", thread->name); - return; - } + if (!thread->thread_task) { + unifi_notice(priv, "%s thread is already stopped\n", + thread->name); + return; + } - unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name); + unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name); - kthread_stop(thread->thread_task); - thread->thread_task = NULL; + kthread_stop(thread->thread_task); + thread->thread_task = NULL; } /* uf_stop_thread() */ @@ -118,23 +122,24 @@ uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread) * * --------------------------------------------------------------------------- */ - void +void uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread) { - /* - * kthread_stop() cannot handle the thread exiting while - * kthread_should_stop() is false, so sleep until kthread_stop() - * wakes us up. - */ - unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n", thread->name); - set_current_state(TASK_INTERRUPTIBLE); - if (!kthread_should_stop()) { - unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name); - schedule(); - } - - thread->thread_task = NULL; - unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name); + /* + * kthread_stop() cannot handle the thread exiting while + * kthread_should_stop() is false, so sleep until kthread_stop() + * wakes us up + */ + unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n", + thread->name); + set_current_state(TASK_INTERRUPTIBLE); + if (!kthread_should_stop()) { + unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name); + schedule(); + } + + thread->thread_task = NULL; + unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name); } /* uf_wait_for_thread_to_stop() */ @@ -155,39 +160,41 @@ uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread) * None. * --------------------------------------------------------------------------- */ - static void +static void handle_bh_error(unifi_priv_t *priv) { - u8 conf_param = CONFIG_IND_ERROR; - u8 interfaceTag = 0; /* used as a loop counter */ + netInterface_priv_t *interfacePriv; + u8 conf_param = CONFIG_IND_ERROR; + u8 interfaceTag; - /* Block unifi_run_bh() until the error has been handled. */ - priv->bh_thread.block_thread = 1; + /* Block unifi_run_bh() until the error has been handled. */ + priv->bh_thread.block_thread = 1; - /* Consider UniFi to be uninitialised */ - priv->init_progress = UNIFI_INIT_NONE; + /* Consider UniFi to be uninitialised */ + priv->init_progress = UNIFI_INIT_NONE; - /* Stop the network traffic */ - for( interfaceTag =0; interfaceTag <CSR_WIFI_NUM_INTERFACES;interfaceTag ++) { - netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag]; - if (interfacePriv->netdev_registered == 1) { - netif_carrier_off(priv->netdev[interfaceTag]); - } - } + /* Stop the network traffic */ + for (interfaceTag = 0; + interfaceTag < CSR_WIFI_NUM_INTERFACES; interfaceTag++) { + interfacePriv = priv->interfacePriv[interfaceTag]; + if (interfacePriv->netdev_registered) + netif_carrier_off(priv->netdev[interfaceTag]); + } #ifdef CSR_NATIVE_LINUX - /* Force any client waiting on an mlme_wait_for_reply() to abort. */ - uf_abort_mlme(priv); + /* Force any client waiting on an mlme_wait_for_reply() to abort. */ + uf_abort_mlme(priv); - /* Cancel any pending workqueue tasks */ - flush_workqueue(priv->unifi_workqueue); + /* Cancel any pending workqueue tasks */ + flush_workqueue(priv->unifi_workqueue); #endif /* CSR_NATIVE_LINUX */ - unifi_error(priv, "handle_bh_error: fatal error is reported to the SME.\n"); - /* Notify the clients (SME or unifi_manager) for the error. */ - ul_log_config_ind(priv, &conf_param, sizeof(u8)); + unifi_error(priv, + "handle_bh_error: fatal error is reported to the SME.\n"); + /* Notify the clients (SME or unifi_manager) for the error. */ + ul_log_config_ind(priv, &conf_param, sizeof(u8)); } /* handle_bh_error() */ diff --git a/drivers/staging/csr/csr_formatted_io.c b/drivers/staging/csr/csr_formatted_io.c deleted file mode 100644 index 7213cc8fb577..000000000000 --- a/drivers/staging/csr/csr_formatted_io.c +++ /dev/null @@ -1,27 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ -#include <linux/kernel.h> -#include "csr_formatted_io.h" - -s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...) -{ - s32 r; - va_list args; - va_start(args, fmt); - r = vsnprintf(dest, n, fmt, args); - va_end(args); - - if (dest && (n > 0)) - { - dest[n - 1] = '\0'; - } - - return r; -} diff --git a/drivers/staging/csr/csr_formatted_io.h b/drivers/staging/csr/csr_formatted_io.h deleted file mode 100644 index 2e238cb98d51..000000000000 --- a/drivers/staging/csr/csr_formatted_io.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CSR_FORMATTED_IO_H__ -#define CSR_FORMATTED_IO_H__ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <linux/types.h> - -s32 CsrSnprintf(char *dest, size_t n, const char *fmt, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 12e7ddf3220a..f91a4bf4e68f 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -12,20 +12,9 @@ #include <linux/version.h> #include <linux/kthread.h> #include <linux/module.h> - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) -#include <linux/slab.h> -#endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 19) #include <linux/freezer.h> -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) -#include <asm/semaphore.h> -#else #include <linux/semaphore.h> -#endif - +#include <linux/slab.h> #include <linux/bitops.h> #include "csr_framework_ext.h" diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c index 353a829bb74c..095f7fa3ae2c 100644 --- a/drivers/staging/csr/csr_panic.c +++ b/drivers/staging/csr/csr_panic.c @@ -9,7 +9,6 @@ *****************************************************************************/ #include <linux/kernel.h> -#include <linux/version.h> #include <linux/module.h> #include "csr_panic.h" diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c index 83586ca34e8c..7b597f7622a2 100644 --- a/drivers/staging/csr/csr_time.c +++ b/drivers/staging/csr/csr_time.c @@ -10,13 +10,6 @@ #include <linux/kernel.h> #include <linux/version.h> - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) -#include <linux/autoconf.h> -#include <linux/config.h> -#endif - #include <linux/time.h> #include <linux/module.h> @@ -24,20 +17,18 @@ CsrTime CsrTimeGet(CsrTime *high) { - struct timespec ts; - u64 time; - CsrTime low; + struct timespec ts; + u64 time; + CsrTime low; - ts = current_kernel_time(); - time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + ts = current_kernel_time(); + time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; - if (high != NULL) - { - *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF); - } + if (high != NULL) + *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF); - low = (CsrTime) (time & 0xFFFFFFFF); + low = (CsrTime) (time & 0xFFFFFFFF); - return low; + return low; } EXPORT_SYMBOL_GPL(CsrTimeGet); diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 44ab00c53fec..cf148a0fec6a 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -1612,13 +1612,13 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* Reset any state carried forward from a previous life */ card->fh_command_queue.q_rd_ptr = 0; card->fh_command_queue.q_wr_ptr = 0; - (void)CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_cmd_q"); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { card->fh_traffic_queue[i].q_rd_ptr = 0; card->fh_traffic_queue[i].q_wr_ptr = 0; - (void)CsrSnprintf(card->fh_traffic_queue[i].name, + (void)scnprintf(card->fh_traffic_queue[i].name, UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); } #ifndef CSR_WIFI_HIP_TA_DISABLE @@ -1826,13 +1826,13 @@ static void card_init_soft_queues(card_t *card) /* Reset any state carried forward from a previous life */ card->fh_command_queue.q_rd_ptr = 0; card->fh_command_queue.q_wr_ptr = 0; - (void)CsrSnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, + (void)scnprintf(card->fh_command_queue.name, UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_cmd_q"); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { card->fh_traffic_queue[i].q_rd_ptr = 0; card->fh_traffic_queue[i].q_wr_ptr = 0; - (void)CsrSnprintf(card->fh_traffic_queue[i].name, + (void)scnprintf(card->fh_traffic_queue[i].name, UNIFI_QUEUE_NAME_MAX_LENGTH, "fh_data_q%d", i); } #ifndef CSR_WIFI_HIP_TA_DISABLE diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 8e4a4608ba5c..6db672caaa02 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -250,6 +250,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p if (r != CSR_RESULT_SUCCESS) { unifi_error(card->ospriv, "Failed to find BOOT_LOADER_CONTROL\n"); + kfree(pfw); return CSR_RESULT_FAILURE; } @@ -265,6 +266,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p desc = unifi_fw_open_buffer(card->ospriv, pfw, psize); if (!desc) { + kfree(pfw); return CSR_WIFI_HIP_RESULT_NO_MEMORY; } diff --git a/drivers/staging/csr/csr_wifi_hip_send.c b/drivers/staging/csr/csr_wifi_hip_send.c index 684d30459d75..86aa23cefe30 100644 --- a/drivers/staging/csr/csr_wifi_hip_send.c +++ b/drivers/staging/csr/csr_wifi_hip_send.c @@ -172,13 +172,8 @@ static CsrResult send_signal(card_t *card, const u8 *sigptr, u32 siglen, { const u8 *sig = sigptr; - unifi_error(card->ospriv, "Signal(%d): %02x %02x %02x %02x %02x %02x %02x %02x" - " %02x %02x %02x %02x %02x %02x %02x %02x\n", - siglen, - sig[0], sig[1], sig[2], sig[3], - sig[4], sig[5], sig[6], sig[7], - sig[8], sig[9], sig[10], sig[11], - sig[12], sig[13], sig[14], sig[15]); + unifi_error(card->ospriv, "Signal(%d): %*ph\n", siglen, + 16, sig); unifi_error(card->ospriv, "Bulkdata pointer %p(%d), %p(%d)\n", bulkdata != NULL?bulkdata->d[0].os_data_ptr : NULL, bulkdata != NULL?bulkdata->d[0].data_length : 0, diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index 07cfd36c4971..a65b822db698 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c @@ -64,104 +64,104 @@ s32 unifi_print_status(card_t *card, char *str, s32 *remain) } i = n = 0; - written = CsrSnprintf(p, remaining, "Chip ID %u\n", + written = scnprintf(p, remaining, "Chip ID %u\n", (u16)card->chip_id); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Chip Version %04X\n", + written = scnprintf(p, remaining, "Chip Version %04X\n", card->chip_version); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "HIP v%u.%u\n", + written = scnprintf(p, remaining, "HIP v%u.%u\n", (card->config_data.version >> 8) & 0xFF, card->config_data.version & 0xFF); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Build %lu: %s\n", + written = scnprintf(p, remaining, "Build %u: %s\n", card->build_id, card->build_id_string); UNIFI_SNPRINTF_RET(p, remaining, written); cfg = &card->config_data; - written = CsrSnprintf(p, remaining, "sdio ctrl offset %u\n", + written = scnprintf(p, remaining, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "fromhost sigbuf handle %u\n", + written = scnprintf(p, remaining, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "tohost_sigbuf_handle %u\n", + written = scnprintf(p, remaining, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "num_fromhost_sig_frags %u\n", + written = scnprintf(p, remaining, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "num_tohost_sig_frags %u\n", + written = scnprintf(p, remaining, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "num_fromhost_data_slots %u\n", + written = scnprintf(p, remaining, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "num_tohost_data_slots %u\n", + written = scnprintf(p, remaining, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "data_slot_size %u\n", + written = scnprintf(p, remaining, "data_slot_size %u\n", cfg->data_slot_size); UNIFI_SNPRINTF_RET(p, remaining, written); /* Added by protocol version 0x0001 */ - written = CsrSnprintf(p, remaining, "overlay_size %u\n", + written = scnprintf(p, remaining, "overlay_size %u\n", (u16)cfg->overlay_size); UNIFI_SNPRINTF_RET(p, remaining, written); /* Added by protocol version 0x0300 */ - written = CsrSnprintf(p, remaining, "data_slot_round %u\n", + written = scnprintf(p, remaining, "data_slot_round %u\n", cfg->data_slot_round); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "sig_frag_size %u\n", + written = scnprintf(p, remaining, "sig_frag_size %u\n", cfg->sig_frag_size); UNIFI_SNPRINTF_RET(p, remaining, written); /* Added by protocol version 0x0300 */ - written = CsrSnprintf(p, remaining, "tohost_sig_pad %u\n", + written = scnprintf(p, remaining, "tohost_sig_pad %u\n", cfg->tohost_signal_padding); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "\nInternal state:\n"); + written = scnprintf(p, remaining, "\nInternal state:\n"); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n", + written = scnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n", card->last_phy_panic_code, card->last_phy_panic_arg); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n", + written = scnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n", card->last_mac_panic_code, card->last_mac_panic_arg); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "fhsr: %u\n", + written = scnprintf(p, remaining, "fhsr: %u\n", (u16)card->from_host_signals_r); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "fhsw: %u\n", + written = scnprintf(p, remaining, "fhsw: %u\n", (u16)card->from_host_signals_w); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "thsr: %u\n", + written = scnprintf(p, remaining, "thsr: %u\n", (u16)card->to_host_signals_r); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "thsw: %u\n", + written = scnprintf(p, remaining, "thsw: %u\n", (u16)card->to_host_signals_w); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, - "fh buffer contains: %u signals, %u bytes\n", + written = scnprintf(p, remaining, + "fh buffer contains: %d signals, %td bytes\n", card->fh_buffer.count, card->fh_buffer.ptr - card->fh_buffer.buf); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "paused: "); + written = scnprintf(p, remaining, "paused: "); UNIFI_SNPRINTF_RET(p, remaining, written); for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++) { - written = CsrSnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0"); + written = scnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0"); UNIFI_SNPRINTF_RET(p, remaining, written); } - written = CsrSnprintf(p, remaining, "\n"); + written = scnprintf(p, remaining, "\n"); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, + written = scnprintf(p, remaining, "fh command q: %u waiting, %u free of %u:\n", CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue), CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue), @@ -169,7 +169,7 @@ s32 unifi_print_status(card_t *card, char *str, s32 *remain) UNIFI_SNPRINTF_RET(p, remaining, written); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) { - written = CsrSnprintf(p, remaining, + written = scnprintf(p, remaining, "fh traffic q[%u]: %u waiting, %u free of %u:\n", i, CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]), @@ -178,58 +178,58 @@ s32 unifi_print_status(card_t *card, char *str, s32 *remain) UNIFI_SNPRINTF_RET(p, remaining, written); } - written = CsrSnprintf(p, remaining, "fh data slots free: %u\n", + written = scnprintf(p, remaining, "fh data slots free: %u\n", card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "From host data slots:"); + written = scnprintf(p, remaining, "From host data slots:"); UNIFI_SNPRINTF_RET(p, remaining, written); n = card->config_data.num_fromhost_data_slots; for (i = 0; i < n && card->from_host_data; i++) { - written = CsrSnprintf(p, remaining, " %u", + written = scnprintf(p, remaining, " %u", (u16)card->from_host_data[i].bd.data_length); UNIFI_SNPRINTF_RET(p, remaining, written); } - written = CsrSnprintf(p, remaining, "\n"); + written = scnprintf(p, remaining, "\n"); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "To host data slots:"); + written = scnprintf(p, remaining, "To host data slots:"); UNIFI_SNPRINTF_RET(p, remaining, written); n = card->config_data.num_tohost_data_slots; for (i = 0; i < n && card->to_host_data; i++) { - written = CsrSnprintf(p, remaining, " %u", + written = scnprintf(p, remaining, " %u", (u16)card->to_host_data[i].data_length); UNIFI_SNPRINTF_RET(p, remaining, written); } - written = CsrSnprintf(p, remaining, "\n"); + written = scnprintf(p, remaining, "\n"); UNIFI_SNPRINTF_RET(p, remaining, written); #ifdef CSR_UNSAFE_SDIO_ACCESS - written = CsrSnprintf(p, remaining, "Host State: %s\n", states[card->host_state]); + written = scnprintf(p, remaining, "Host State: %s\n", states[card->host_state]); UNIFI_SNPRINTF_RET(p, remaining, written); r = unifi_check_io_status(card, &iostate); if (iostate == 1) { - written = CsrSnprintf(p, remaining, "I/O Check: F1 disabled\n"); + written = scnprintf(p, remaining, "I/O Check: F1 disabled\n"); UNIFI_SNPRINTF_RET(p, remaining, written); } else { if (iostate == 1) { - written = CsrSnprintf(p, remaining, "I/O Check: pending interrupt\n"); + written = scnprintf(p, remaining, "I/O Check: pending interrupt\n"); UNIFI_SNPRINTF_RET(p, remaining, written); } - written = CsrSnprintf(p, remaining, "BH reason interrupt = %d\n", + written = scnprintf(p, remaining, "BH reason interrupt = %d\n", card->bh_reason_unifi); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "BH reason host = %d\n", + written = scnprintf(p, remaining, "BH reason host = %d\n", card->bh_reason_host); UNIFI_SNPRINTF_RET(p, remaining, written); @@ -238,26 +238,26 @@ s32 unifi_print_status(card_t *card, char *str, s32 *remain) r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b); if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80))) { - written = CsrSnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n", + written = scnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n", b, card->from_host_signals_r); UNIFI_SNPRINTF_RET(p, remaining, written); break; } } iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); - written = CsrSnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n", + written = scnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n", iostate, card->to_host_signals_w); UNIFI_SNPRINTF_RET(p, remaining, written); } #endif - written = CsrSnprintf(p, remaining, "\nStats:\n"); + written = scnprintf(p, remaining, "\nStats:\n"); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Total SDIO bytes: R=%lu W=%lu\n", + written = scnprintf(p, remaining, "Total SDIO bytes: R=%u W=%u\n", card->sdio_bytes_read, card->sdio_bytes_written); UNIFI_SNPRINTF_RET(p, remaining, written); - written = CsrSnprintf(p, remaining, "Interrupts generated on card: %lu\n", + written = scnprintf(p, remaining, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq); UNIFI_SNPRINTF_RET(p, remaining, written); diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h index dc3c60b49702..2923e2ef12f2 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi.h @@ -98,7 +98,6 @@ extern "C" { #include "csr_framework_ext.h" /* from the synergy porting folder */ #include "csr_sdio.h" /* from the synergy porting folder */ #include "csr_macro.h" /* from the synergy porting folder */ -#include "csr_formatted_io.h" /* from the synergy gsp folder */ #include "csr_wifi_result.h" /* Utility MACROS. Note that UNIFI_MAC_ADDRESS_CMP returns TRUE on success */ diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index b2c27f4f03d4..249758076a75 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c @@ -15,8 +15,6 @@ * --------------------------------------------------------------------------- */ - - /* * Porting Notes: * Part of this file contains an example for how to glue the OS layer @@ -37,6 +35,7 @@ #include <linux/poll.h> #include <asm/uaccess.h> #include <linux/jiffies.h> +#include <linux/version.h> #include "csr_wifi_hip_unifiversion.h" #include "unifi_priv.h" @@ -124,11 +123,7 @@ static void udi_set_log_filter(ul_client_t *pcli, /* Mutex to protect access to priv->sme_cli */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) DEFINE_SEMAPHORE(udi_mutex); -#else -DECLARE_MUTEX(udi_mutex); -#endif s32 CsrHipResultToStatus(CsrResult csrResult) { @@ -1980,18 +1975,6 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) } /* uf_sme_queue_message() */ #endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create(_class, _parent, _devno, _priv, _fmt, _args) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create_drvdata(_class, _parent, _devno, _priv, _fmt, _args) -#else -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create(_class, _parent, _devno, _fmt, _args) -#endif - /* **************************************************************************** * @@ -2009,17 +1992,6 @@ static struct file_operations unifi_fops = { .poll = unifi_poll, }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create(_class, _parent, _devno, _priv, _fmt, _args) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create_drvdata(_class, _parent, _devno, _priv, _fmt, _args) -#else -#define UF_DEVICE_CREATE(_class, _parent, _devno, _priv, _fmt, _args) \ - device_create(_class, _parent, _devno, _fmt, _args) -#endif - static dev_t unifi_first_devno; static struct class *unifi_class; @@ -2042,11 +2014,11 @@ int uf_create_device_nodes(unifi_priv_t *priv, int bus_id) } #ifdef SDIO_EXPORTS_STRUCT_DEVICE - if (!UF_DEVICE_CREATE(unifi_class, priv->unifi_device, - devno, priv, "unifi%d", bus_id)) { + if (!device_create(unifi_class, priv->unifi_device, + devno, priv, "unifi%d", bus_id)) { #else - priv->unifi_device = UF_DEVICE_CREATE(unifi_class, NULL, - devno, priv, "unifi%d", bus_id); + priv->unifi_device = device_create(unifi_class, NULL, + devno, priv, "unifi%d", bus_id); if (priv->unifi_device == NULL) { #endif /* SDIO_EXPORTS_STRUCT_DEVICE */ @@ -2068,13 +2040,13 @@ int uf_create_device_nodes(unifi_priv_t *priv, int bus_id) return r; } - if (!UF_DEVICE_CREATE(unifi_class, + if (!device_create(unifi_class, #ifdef SDIO_EXPORTS_STRUCT_DEVICE - priv->unifi_device, + priv->unifi_device, #else - NULL, + NULL, #endif /* SDIO_EXPORTS_STRUCT_DEVICE */ - devno, priv, "unifiudi%d", bus_id)) { + devno, priv, "unifiudi%d", bus_id)) { device_destroy(unifi_class, priv->unifi_cdev.dev); cdev_del(&priv->unifiudi_cdev); cdev_del(&priv->unifi_cdev); diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c index d14e11839618..b6d8a6e52915 100644 --- a/drivers/staging/csr/firmware.c +++ b/drivers/staging/csr/firmware.c @@ -286,7 +286,7 @@ uf_run_unifihelper(unifi_priv_t *priv) unifi_trace(priv, UDBG2, "running %s %s %s\n", argv[0], argv[1], argv[2]); - r = call_usermodehelper(argv[0], argv, envp, 0); + r = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); return r; #else @@ -402,9 +402,7 @@ int uf_release_firmware_files(unifi_priv_t *priv) int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free) { if (to_free != NULL) { - if (to_free->fw_desc != NULL) { - release_firmware((const struct firmware *)to_free->fw_desc); - } + release_firmware((const struct firmware *)to_free->fw_desc); to_free->fw_desc = NULL; to_free->dl_data = NULL; to_free->dl_len = 0; diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index e6503d9620a4..caf48e3120ca 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -31,6 +31,7 @@ * --------------------------------------------------------------------------- */ #include <linux/proc_fs.h> +#include <linux/version.h> #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifiversion.h" @@ -38,7 +39,6 @@ #include "unifiio.h" #include "unifi_priv.h" - /* * Array of pointers to context structs for unifi devices that are present. * The index in the array corresponds to the wlan interface number @@ -70,11 +70,7 @@ static int In_use[MAX_UNIFI_DEVS]; * Mutex to prevent UDI clients to open the character device before the priv * is created and initialised. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) DEFINE_SEMAPHORE(Unifi_instance_mutex); -#else -DECLARE_MUTEX(Unifi_instance_mutex); -#endif /* * When the device is removed, unregister waits on Unifi_cleanup_wq * until all the UDI clients release the character device. @@ -177,21 +173,6 @@ uf_register_netdev(unifi_priv_t *priv, int interfaceTag) /* The device is registed */ interfacePriv->netdev_registered = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -#ifdef CONFIG_NET_SCHED - /* - * IMPORTANT: - * uf_install_qdisc() holds the network device lock, we can not - * install the qdisk before the network device is registered. - */ - r = uf_install_qdisc(priv->netdev[interfaceTag]); - if (r) { - unifi_error(priv, "Failed to install qdisc\n"); - return r; - } -#endif /* CONFIG_NET_SCHED */ -#endif /* LINUX_VERSION_CODE */ - #ifdef CSR_SUPPORT_SME /* * Register the inet handler; it notifies us for changes in the IP address. @@ -347,7 +328,7 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) /* * We use the slot number as unifi device index. */ - snprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance); + scnprintf(priv->proc_entry_name, 64, "driver/unifi%d", priv->instance); /* * The following complex casting is in place in order to eliminate 64-bit compilation warning * "cast to/from pointer from/to integer of different size" @@ -669,7 +650,7 @@ unregister_unifi_sdio(int bus_id) if(interfacePriv->netdev_registered) { netif_carrier_off(priv->netdev[interfaceTag]); - UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]); + netif_tx_stop_all_queues(priv->netdev[interfaceTag]); } } @@ -904,54 +885,54 @@ uf_read_proc(char *page, char **start, off_t offset, int count, orig_p = p; - written = CsrSnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n", + written = scnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n", CSR_WIFI_VERSION, __DATE__, __TIME__); UNIFI_SNPRINTF_RET(p, remain, written); #ifdef CSR_SME_USERSPACE - written = CsrSnprintf(p, remain, "SME: CSR userspace "); + written = scnprintf(p, remain, "SME: CSR userspace "); UNIFI_SNPRINTF_RET(p, remain, written); #ifdef CSR_SUPPORT_WEXT - written = CsrSnprintf(p, remain, "with WEXT support\n"); + written = scnprintf(p, remain, "with WEXT support\n"); #else - written = CsrSnprintf(p, remain, "\n"); + written = scnprintf(p, remain, "\n"); #endif /* CSR_SUPPORT_WEXT */ UNIFI_SNPRINTF_RET(p, remain, written); #endif /* CSR_SME_USERSPACE */ #ifdef CSR_NATIVE_LINUX - written = CsrSnprintf(p, remain, "SME: native\n"); + written = scnprintf(p, remain, "SME: native\n"); UNIFI_SNPRINTF_RET(p, remain, written); #endif #ifdef CSR_SUPPORT_SME - written = CsrSnprintf(p, remain, - "Firmware (ROM) build:%lu, Patch:%lu\n", + written = scnprintf(p, remain, + "Firmware (ROM) build:%u, Patch:%u\n", priv->card_info.fw_build, priv->sme_versions.firmwarePatch); UNIFI_SNPRINTF_RET(p, remain, written); #endif p += unifi_print_status(priv->card, p, &remain); - written = CsrSnprintf(p, remain, "Last dbg str: %s\n", + written = scnprintf(p, remain, "Last dbg str: %s\n", priv->last_debug_string); UNIFI_SNPRINTF_RET(p, remain, written); - written = CsrSnprintf(p, remain, "Last dbg16:"); + written = scnprintf(p, remain, "Last dbg16:"); UNIFI_SNPRINTF_RET(p, remain, written); for (i = 0; i < 8; i++) { - written = CsrSnprintf(p, remain, " %04X", + written = scnprintf(p, remain, " %04X", priv->last_debug_word16[i]); UNIFI_SNPRINTF_RET(p, remain, written); } - written = CsrSnprintf(p, remain, "\n"); + written = scnprintf(p, remain, "\n"); UNIFI_SNPRINTF_RET(p, remain, written); - written = CsrSnprintf(p, remain, " "); + written = scnprintf(p, remain, " "); UNIFI_SNPRINTF_RET(p, remain, written); for (; i < 16; i++) { - written = CsrSnprintf(p, remain, " %04X", + written = scnprintf(p, remain, " %04X", priv->last_debug_word16[i]); UNIFI_SNPRINTF_RET(p, remain, written); } - written = CsrSnprintf(p, remain, "\n"); + written = scnprintf(p, remain, "\n"); UNIFI_SNPRINTF_RET(p, remain, written); *start = page; diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c index 628782ad641e..7c524a18958e 100644 --- a/drivers/staging/csr/monitor.c +++ b/drivers/staging/csr/monitor.c @@ -10,6 +10,7 @@ * --------------------------------------------------------------------------- */ +#include <linux/version.h> #include "unifi_priv.h" #ifdef UNIFI_SNIFF_ARPHRD @@ -23,8 +24,6 @@ #define ETH_P_80211_RAW ETH_P_ALL #endif - - /* * --------------------------------------------------------------------------- * uf_start_sniff @@ -192,11 +191,7 @@ netrx_radiotap(unifi_priv_t *priv, skb->dev = dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) skb->mac_header = skb->data; -#else - skb->mac.raw = skb->data; -#endif skb->pkt_type = PACKET_OTHERHOST; skb->protocol = __constant_htons(ETH_P_80211_RAW); memset(skb->cb, 0, sizeof(skb->cb)); diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index 1e6e111a8e15..9a52ab408e1a 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c @@ -15,7 +15,6 @@ * --------------------------------------------------------------------------- */ - /* * Porting Notes: * This file implements the data plane of the UniFi linux driver. @@ -48,59 +47,14 @@ #include <linux/etherdevice.h> #include <linux/mutex.h> #include <linux/semaphore.h> - +#include <linux/version.h> #include <linux/vmalloc.h> #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_conversions.h" #include "unifi_priv.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) -#include <net/iw_handler.h> -#endif #include <net/pkt_sched.h> -/* ALLOW_Q_PAUSE: Pre 2.6.28 kernels do not support multiple driver queues (required for QoS). - * In order to support QoS in these kernels, multiple queues are implemented in the driver. But since - * there is only a single queue in the kernel (leading to multiple queues in the driver) there is no possibility - * of stopping a particular queue in the kernel. Stopping the single kernel queue leads to undesirable starvation - * of driver queues. One of the proposals is to not stop the kernel queue but to prevent dequeuing from the - * 'stopped' driver queue. Allow q pause is an experimental implementation of this scheme for pre 2.6.28 kernels. - * When NOT defined, queues are paused locally in the driver and packets are dequeued for transmission only from the - * unpaused queues. When Allow q pause is defined the kernel queue is stopped whenever any driver queue is paused. - */ -#define ALLOW_Q_PAUSE - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) -#ifdef UNIFI_NET_NAME -#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ - do { \ - static char name[8]; \ - sprintf(name, "%s%s", UNIFI_NET_NAME, _name); \ - _dev = alloc_netdev_mq(_size, name, _setup, _num_of_queues); \ - } while (0); -#else -#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ - do { \ - _dev = alloc_etherdev_mq(_size, _num_of_queues); \ - } while (0); -#endif /* UNIFI_NET_NAME */ -#else -#ifdef UNIFI_NET_NAME -#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ - do { \ - static char name[8]; \ - sprintf(name, "%s%s", UNIFI_NET_NAME, _name); \ - _dev = alloc_netdev(_size, name, _setup); \ - } while (0); -#else -#define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \ - do { \ - _dev = alloc_etherdev(_size); \ - } while (0); -#endif /* UNIFI_NET_NAME */ -#endif /* LINUX_VERSION_CODE */ - - /* Wext handler is suported only if CSR_SUPPORT_WEXT is defined */ #ifdef CSR_SUPPORT_WEXT extern struct iw_handler_def unifi_iw_handler_def; @@ -119,20 +73,8 @@ static int uf_net_open(struct net_device *dev); static int uf_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int uf_net_stop(struct net_device *dev); static struct net_device_stats *uf_net_get_stats(struct net_device *dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) static u16 uf_net_select_queue(struct net_device *dev, struct sk_buff *skb); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) static netdev_tx_t uf_net_xmit(struct sk_buff *skb, struct net_device *dev); -#else -static int uf_net_xmit(struct sk_buff *skb, struct net_device *dev); -#ifndef NETDEV_TX_OK -#define NETDEV_TX_OK 0 -#endif -#ifndef NETDEV_TX_BUSY -#define NETDEV_TX_BUSY 1 -#endif -#endif static void uf_set_multicast_list(struct net_device *dev); @@ -182,62 +124,8 @@ struct uf_tx_packet_data { unsigned long host_tag; }; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -static int uf_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd); -static int uf_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd); -static struct sk_buff *uf_qdiscop_dequeue(struct Qdisc* qd); -static void uf_qdiscop_reset(struct Qdisc* qd); -static void uf_qdiscop_destroy(struct Qdisc* qd); -static int uf_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -static int uf_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt); -static int uf_qdiscop_init(struct Qdisc *qd, struct nlattr *opt); -#else -static int uf_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt); -static int uf_qdiscop_init(struct Qdisc *qd, struct rtattr *opt); -#endif -#endif - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -/* queueing discipline operations */ -static struct Qdisc_ops uf_qdisc_ops = -{ - .next = NULL, - .cl_ops = NULL, - .id = "UniFi Qdisc", - .priv_size = sizeof(struct uf_sched_data), - - .enqueue = uf_qdiscop_enqueue, - .dequeue = uf_qdiscop_dequeue, - .requeue = uf_qdiscop_requeue, - .drop = NULL, /* drop not needed since we are always the root qdisc */ - - .init = uf_qdiscop_init, - .reset = uf_qdiscop_reset, - .destroy = uf_qdiscop_destroy, - .change = uf_qdiscop_tune, - - .dump = uf_qdiscop_dump, -}; -#endif /* LINUX_VERSION_CODE */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) -#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ - qdisc_create_dflt(dev, netdev_get_tx_queue(_dev, 0), _ops, _root) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ - qdisc_create_dflt(dev, _ops, _root) -#else -#define UF_QDISC_CREATE_DFLT(_dev, _ops, _root) \ - qdisc_create_dflt(dev, _ops) -#endif /* LINUX_VERSION_CODE */ - #endif /* CONFIG_NET_SCHED */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) static const struct net_device_ops uf_netdev_ops = { .ndo_open = uf_net_open, @@ -248,7 +136,6 @@ static const struct net_device_ops uf_netdev_ops = .ndo_set_rx_mode = uf_set_multicast_list, .ndo_select_queue = uf_net_select_queue, }; -#endif static u8 oui_rfc1042[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; static u8 oui_8021h[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; @@ -310,7 +197,7 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, * so use "eth*" (like other wireless extns drivers). */ - UF_ALLOC_NETDEV(dev, sizeof(unifi_priv_t)+sizeof(netInterface_priv_t), "%d", ether_setup, UNIFI_TRAFFIC_Q_MAX); + dev = alloc_etherdev_mq(sizeof(unifi_priv_t) + sizeof(netInterface_priv_t), UNIFI_TRAFFIC_Q_MAX); if (dev == NULL) { return NULL; @@ -332,22 +219,7 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) priv->interfacePriv[0] = interfacePriv; /* Setup / override net_device fields */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) dev->netdev_ops = &uf_netdev_ops; -#else - dev->open = uf_net_open; - dev->stop = uf_net_stop; - dev->hard_start_xmit = uf_net_xmit; - dev->do_ioctl = uf_net_ioctl; - - /* called by /proc/net/dev */ - dev->get_stats = uf_net_get_stats; - - dev->set_multicast_list = uf_set_multicast_list; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) - dev->select_queue = uf_net_select_queue; -#endif -#endif #ifdef CSR_SUPPORT_WEXT dev->wireless_handlers = &unifi_iw_handler_def; @@ -440,21 +312,13 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) interfacePriv->connected = UnifiConnectedUnknown; /* -1 unknown, 0 no, 1 yes */ #ifdef USE_DRIVER_LOCK -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) sema_init(&priv->lock, 1); -#else - init_MUTEX(&priv->lock); -#endif #endif /* USE_DRIVER_LOCK */ spin_lock_init(&priv->send_signal_lock); spin_lock_init(&priv->m4_lock); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) sema_init(&priv->ba_mutex, 1); -#else - init_MUTEX(&priv->ba_mutex); -#endif #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) spin_lock_init(&priv->wapi_lock); @@ -487,16 +351,8 @@ uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id) #endif #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -#ifdef CONFIG_NET_SCHED - /* Register the qdisc operations */ - register_qdisc(&uf_qdisc_ops); -#endif /* CONFIG_NET_SCHED */ -#endif /* LINUX_VERSION_CODE */ - priv->ref_count = 1; - priv->amp_client = NULL; priv->coredump_mode = 0; priv->ptest_mode = 0; @@ -566,7 +422,7 @@ uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag) * The RedHat 9 redhat-config-network tool doesn't recognise wlan* devices, * so use "eth*" (like other wireless extns drivers). */ - UF_ALLOC_NETDEV(dev, sizeof(netInterface_priv_t), "%d", ether_setup, 1); + dev = alloc_etherdev_mq(sizeof(netInterface_priv_t), 1); if (dev == NULL) { return FALSE; } @@ -589,19 +445,7 @@ uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag) INIT_LIST_HEAD(&interfacePriv->rx_controlled_list); /* Setup / override net_device fields */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) dev->netdev_ops = &uf_netdev_ops; -#else - dev->open = uf_net_open; - dev->stop = uf_net_stop; - dev->hard_start_xmit = uf_net_xmit; - dev->do_ioctl = uf_net_ioctl; - - /* called by /proc/net/dev */ - dev->get_stats = uf_net_get_stats; - - dev->set_multicast_list = uf_set_multicast_list; -#endif #ifdef CSR_SUPPORT_WEXT dev->wireless_handlers = &unifi_iw_handler_def; @@ -686,13 +530,6 @@ uf_free_netdevice(unifi_priv_t *priv) spin_unlock_irqrestore(&priv->wapi_lock, flags); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -#ifdef CONFIG_NET_SCHED - /* Unregister the qdisc operations */ - unregister_qdisc(&uf_qdisc_ops); -#endif /* CONFIG_NET_SCHED */ -#endif /* LINUX_VERSION_CODE */ - #ifdef CSR_SUPPORT_WEXT /* Unregister callback for netdevice state changes */ unregister_netdevice_notifier(&uf_netdev_notifier); @@ -700,10 +537,8 @@ uf_free_netdevice(unifi_priv_t *priv) #ifdef CSR_SUPPORT_SME /* Cancel work items and destroy the workqueue */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) cancel_work_sync(&priv->multicast_list_task); #endif -#endif /* Destroy the workqueues. */ flush_workqueue(priv->unifi_workqueue); destroy_workqueue(priv->unifi_workqueue); @@ -778,7 +613,7 @@ uf_net_open(struct net_device *dev) } #endif - UF_NETIF_TX_START_ALL_QUEUES(dev); + netif_tx_start_all_queues(dev); func_exit(); return 0; @@ -808,7 +643,7 @@ uf_net_stop(struct net_device *dev) func_enter(); #endif - UF_NETIF_TX_STOP_ALL_QUEUES(dev); + netif_tx_stop_all_queues(dev); func_exit(); return 0; @@ -957,7 +792,6 @@ get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr return priority; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) /* * --------------------------------------------------------------------------- * uf_net_select_queue @@ -1005,7 +839,6 @@ uf_net_select_queue(struct net_device *dev, struct sk_buff *skb) func_exit(); return (u16)queue; } /* uf_net_select_queue() */ -#endif int skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto) @@ -1915,11 +1748,7 @@ send_ma_pkt_request(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr * The controlled port is handled in the qdisc dequeue handler. * --------------------------------------------------------------------------- */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) static netdev_tx_t -#else -static int -#endif uf_net_xmit(struct sk_buff *skb, struct net_device *dev) { netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); @@ -1929,9 +1758,7 @@ uf_net_xmit(struct sk_buff *skb, struct net_device *dev) int result; static tx_signal_handler tx_handler; CSR_PRIORITY priority; -#if !defined (CONFIG_NET_SCHED) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) CsrWifiRouterCtrlPortAction port_action; -#endif /* CONFIG_NET_SCHED */ func_enter(); @@ -1956,11 +1783,6 @@ uf_net_xmit(struct sk_buff *skb, struct net_device *dev) port = UF_UNCONTROLLED_PORT_Q; } -#if defined (CONFIG_NET_SCHED) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) - /* Remove the ethernet header */ - skb_pull(skb, ETH_HLEN); - result = tx_handler(priv, skb, &ehdr, priority); -#else /* Uncontrolled port rules apply */ port_action = verify_port(priv , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode)||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI== interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest) @@ -1986,7 +1808,6 @@ uf_net_xmit(struct sk_buff *skb, struct net_device *dev) func_exit(); return NETDEV_TX_OK; } -#endif /* CONFIG_NET_SCHED */ if (result == NETDEV_TX_OK) { #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION)) @@ -2059,7 +1880,6 @@ unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue) func_enter(); unifi_trace(priv, UDBG2, "Stopping queue %d\n", queue); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) { if (netif_running(priv->netdev[i])) @@ -2067,24 +1887,6 @@ unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue) netif_stop_subqueue(priv->netdev[i], (u16)queue); } } -#else -#ifdef ALLOW_Q_PAUSE - unifi_trace(priv, UDBG2, "Stopping netif\n"); - /* stop the traffic from all the interfaces. */ - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - if (netif_running(priv->netdev[i])) { - UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[i]); - } - } -#else - if (net_is_tx_q_paused(priv, queue)) { - unifi_trace(priv, UDBG2, "Queue already stopped\n"); - return; - } - net_tx_q_pause(priv, queue); -#endif -#endif #ifdef CSR_SUPPORT_SME if(queue<=3) { @@ -2108,7 +1910,6 @@ unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) func_enter(); unifi_trace(priv, UDBG2, "Waking queue %d\n", queue); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) { if (netif_running(priv->netdev[i])) @@ -2116,25 +1917,6 @@ unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue) netif_wake_subqueue(priv->netdev[i], (u16)queue); } } -#else -#ifdef ALLOW_Q_PAUSE - /* Need to supply queue number depending on Kernel support */ - /* Resume the traffic from all the interfaces */ - for(i=0;i<CSR_WIFI_NUM_INTERFACES;i++) - { - if (netif_running(priv->netdev[i])) { - UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[i]); - } - } -#else - if (!(net_is_tx_q_paused(priv, queue))) { - unifi_trace(priv, UDBG2, "Queue already running\n"); - func_exit(); - return; - } - net_tx_q_unpause(priv, queue); -#endif -#endif #ifdef CSR_SUPPORT_SME if(queue <=3) { @@ -2349,13 +2131,7 @@ uf_resume_data_plane(unifi_priv_t *priv, int queue, { #ifdef CONFIG_NET_SCHED if (netif_running(priv->netdev[interfaceTag])) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) netif_tx_schedule_all(priv->netdev[interfaceTag]); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - netif_schedule_queue(netdev_get_tx_queue(priv->netdev[interfaceTag], 0)); -#else - netif_schedule(priv->netdev[interfaceTag]); -#endif /* LINUX_VERSION_CODE */ } #endif uf_process_rx_pending_queue(priv, queue, peer_address, 1,interfaceTag); @@ -2998,19 +2774,13 @@ uf_set_multicast_list(struct net_device *dev) #else u8 *mc_list = interfacePriv->mc_list; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) struct netdev_hw_addr *mc_addr; int mc_addr_count; -#else - struct dev_mc_list *p; /* Pointer to the addresses structure. */ - int i; -#endif if (priv->init_progress != UNIFI_INIT_COMPLETED) { return; } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34) mc_addr_count = netdev_mc_count(dev); unifi_trace(priv, UDBG3, @@ -3029,25 +2799,6 @@ uf_set_multicast_list(struct net_device *dev) mc_list += ETH_ALEN; } -#else - unifi_trace(priv, UDBG3, - "uf_set_multicast_list (count=%d)\n", dev->mc_count); - - /* Not enough space? */ - if (dev->mc_count > UNIFI_MAX_MULTICAST_ADDRESSES) { - return; - } - - /* Store the list to be processed by the work item. */ - interfacePriv->mc_list_count = dev->mc_count; - p = dev->mc_list; - for (i = 0; i < dev->mc_count; i++) { - memcpy(mc_list, p->dmi_addr, ETH_ALEN); - p = p->next; - mc_list += ETH_ALEN; - } -#endif - /* Send a message to the workqueue */ queue_work(priv->unifi_workqueue, &priv->multicast_list_task); #endif @@ -3181,375 +2932,6 @@ void uf_net_get_name(struct net_device *dev, char *name, int len) } /* uf_net_get_name */ - - - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -#ifdef CONFIG_NET_SCHED - -/* - * --------------------------------------------------------------------------- - * uf_install_qdisc - * - * Creates a root qdisc, registers our qdisc handlers and - * overrides the device's qdisc_sleeping to prevent the system - * from creating a new one for our network device. - * - * Arguments: - * dev Pointer to the network device. - * - * Returns: - * 0 on success, Linux error code otherwise. - * - * Notes: - * This function holds the qdisk lock so it needs to be called - * after registering the network device in uf_register_netdev(). - * Also, the qdisc_create_dflt() API has changed in 2.6.20 to - * include the parentid. - * --------------------------------------------------------------------------- - */ -int uf_install_qdisc(struct net_device *dev) -{ - struct Qdisc *qdisc; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - struct netdev_queue *queue0; -#endif /* LINUX_VERSION_CODE */ - - - func_enter(); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) - /* - * check that there is no qdisc currently attached to device - * this ensures that we will be the root qdisc. (I can't find a better - * way to test this explicitly) - */ - if (dev->qdisc_sleeping != &noop_qdisc) { - func_exit_r(-EFAULT); - return -EINVAL; - } -#endif /* LINUX_VERSION_CODE */ - - qdisc = UF_QDISC_CREATE_DFLT(dev, &uf_qdisc_ops, TC_H_ROOT); - if (!qdisc) { - unifi_error(NULL, "%s: qdisc installation failed\n", dev->name); - func_exit_r(-EFAULT); - return -EFAULT; - } - unifi_trace(NULL, UDBG5, "%s: parent qdisc=0x%p\n", - dev->name, qdisc); - - qdisc->handle = 0x80020000; - qdisc->flags = 0x0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - queue0 = netdev_get_tx_queue(dev, 0); - if (queue0 == NULL) { - unifi_error(NULL, "%s: netdev_get_tx_queue returned no queue\n", - dev->name); - func_exit_r(-EFAULT); - return -EFAULT; - } - queue0->qdisc = qdisc; - queue0->qdisc_sleeping = qdisc; -#else - qdisc_lock_tree(dev); - list_add_tail(&qdisc->list, &dev->qdisc_list); - dev->qdisc_sleeping = qdisc; - qdisc_unlock_tree(dev); -#endif /* LINUX_VERSION_CODE */ - - func_exit_r(0); - return 0; - -} /* uf_install_qdisc() */ - -static int uf_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev_queue->dev); -#else - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev); -#endif /* LINUX_VERSION_CODE */ - unifi_priv_t *priv = interfacePriv->privPtr; - struct uf_sched_data *q = qdisc_priv(qd); - struct uf_tx_packet_data *pkt_data = (struct uf_tx_packet_data *) skb->cb; - struct ethhdr ehdr; - struct Qdisc *qdisc; - int r, proto; - - func_enter(); - - memcpy(&ehdr, skb->data, ETH_HLEN); - proto = ntohs(ehdr.h_proto); - - /* 802.1x - apply controlled/uncontrolled port rules */ - if ((proto != ETH_P_PAE) -#ifdef CSR_WIFI_SECURITY_WAPI_ENABLE - && (proto != ETH_P_WAI) -#endif - ) { - /* queues 0 - 3 */ - pkt_data->priority = get_packet_priority(priv, skb, &ehdr, interfacePriv); - pkt_data->queue = unifi_frame_priority_to_queue(pkt_data->priority); - } else { - pkt_data->queue = UNIFI_TRAFFIC_Q_EAPOL; - } - - qdisc = q->queues[pkt_data->queue]; - r = qdisc->enqueue(skb, qdisc); - if (r == NET_XMIT_SUCCESS) { - qd->q.qlen++; - qd->bstats.bytes += skb->len; - qd->bstats.packets++; - func_exit_r(NET_XMIT_SUCCESS); - return NET_XMIT_SUCCESS; - } - - unifi_error(priv, "uf_qdiscop_enqueue: dropped\n"); - qd->qstats.drops++; - - func_exit_r(r); - return r; - -} /* uf_qdiscop_enqueue() */ - - -static int uf_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(qd->dev_queue->dev); -#else - netInterface_priv_t *interfacePriv = (netInterface_priv_t*)netdev_priv(qd->dev); -#endif /* LINUX_VERSION_CODE */ - unifi_priv_t *priv = interfacePriv->privPtr; - struct uf_sched_data *q = qdisc_priv(qd); - struct uf_tx_packet_data *pkt_data = (struct uf_tx_packet_data *) skb->cb; - struct Qdisc *qdisc; - int r; - - func_enter(); - - unifi_trace(priv, UDBG5, "uf_qdiscop_requeue: (q=%d), tag=%u\n", - pkt_data->queue, pkt_data->host_tag); - - /* we recorded which queue to use earlier! */ - qdisc = q->queues[pkt_data->queue]; - - if ((r = qdisc->ops->requeue(skb, qdisc)) == 0) { - qd->q.qlen++; - func_exit_r(0); - return 0; - } - - unifi_error(priv, "uf_qdiscop_requeue: dropped\n"); - qd->qstats.drops++; - - func_exit_r(r); - return r; -} /* uf_qdiscop_requeue() */ - -static struct sk_buff *uf_qdiscop_dequeue(struct Qdisc* qd) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev_queue->dev); -#else - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(qd->dev); -#endif /* LINUX_VERSION_CODE */ - unifi_priv_t *priv = interfacePriv->privPtr; - struct uf_sched_data *q = qdisc_priv(qd); - struct sk_buff *skb; - struct Qdisc *qdisc; - int queue, i; - struct ethhdr ehdr; - struct uf_tx_packet_data *pkt_data; - CsrWifiRouterCtrlPortAction port_action; - - func_enter(); - - /* check all the queues */ - for (i = UNIFI_TRAFFIC_Q_MAX - 1; i >= 0; i--) { - - if (i != UNIFI_TRAFFIC_Q_EAPOL) { - queue = priv->prev_queue; - if (++priv->prev_queue >= UNIFI_TRAFFIC_Q_EAPOL) { - priv->prev_queue = 0; - } - } else { - queue = i; - } - -#ifndef ALLOW_Q_PAUSE - /* If queue is paused, do not dequeue */ - if (net_is_tx_q_paused(priv, queue)) { - unifi_trace(priv, UDBG5, - "uf_qdiscop_dequeue: tx queue paused (q=%d)\n", queue); - continue; - } -#endif - - qdisc = q->queues[queue]; - skb = qdisc->dequeue(qdisc); - if (skb) { - /* A packet has been dequeued, decrease the queued packets count */ - qd->q.qlen--; - - pkt_data = (struct uf_tx_packet_data *) skb->cb; - - /* Check the (un)controlled port status */ - memcpy(&ehdr, skb->data, ETH_HLEN); - - port_action = verify_port(priv - , (((CSR_WIFI_ROUTER_CTRL_MODE_STA == interfacePriv->interfaceMode) ||(CSR_WIFI_ROUTER_CTRL_MODE_P2PCLI == interfacePriv->interfaceMode))? interfacePriv->bssid.a: ehdr.h_dest) - , (UNIFI_TRAFFIC_Q_EAPOL == queue? UF_UNCONTROLLED_PORT_Q: UF_CONTROLLED_PORT_Q) - , interfacePriv->InterfaceTag); - - /* Dequeue packet if port is open */ - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_OPEN) { - unifi_trace(priv, UDBG5, - "uf_qdiscop_dequeue: new (q=%d), tag=%u\n", - queue, pkt_data->host_tag); - - func_exit(); - return skb; - } - - /* Discard or block the packet if necessary */ - if (port_action == CSR_WIFI_ROUTER_CTRL_PORT_ACTION_8021X_PORT_CLOSED_DISCARD) { - unifi_trace(priv, UDBG5, - "uf_qdiscop_dequeue: drop (q=%d), tag=%u\n", - queue, pkt_data->host_tag); - kfree_skb(skb); - break; - } - - /* We can not send the packet now, put it back to the queue */ - if (qdisc->ops->requeue(skb, qdisc) != 0) { - unifi_error(priv, - "uf_qdiscop_dequeue: requeue (q=%d) failed, tag=%u, drop it\n", - queue, pkt_data->host_tag); - - /* Requeue failed, drop the packet */ - kfree_skb(skb); - break; - } - /* We requeued the packet, increase the queued packets count */ - qd->q.qlen++; - - unifi_trace(priv, UDBG5, - "uf_qdiscop_dequeue: skip (q=%d), tag=%u\n", - queue, pkt_data->host_tag); - } - } - - func_exit(); - return NULL; -} /* uf_qdiscop_dequeue() */ - - -static void uf_qdiscop_reset(struct Qdisc* qd) -{ - struct uf_sched_data *q = qdisc_priv(qd); - int queue; - func_enter(); - - for (queue = 0; queue < UNIFI_TRAFFIC_Q_MAX; queue++) { - qdisc_reset(q->queues[queue]); - } - qd->q.qlen = 0; - - func_exit(); -} /* uf_qdiscop_reset() */ - - -static void uf_qdiscop_destroy(struct Qdisc* qd) -{ - struct uf_sched_data *q = qdisc_priv(qd); - int queue; - - func_enter(); - - for (queue=0; queue < UNIFI_TRAFFIC_Q_MAX; queue++) { - qdisc_destroy(q->queues[queue]); - q->queues[queue] = &noop_qdisc; - } - - func_exit(); -} /* uf_qdiscop_destroy() */ - - -/* called whenever parameters are updated on existing qdisc */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -static int uf_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt) -#else -static int uf_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt) -#endif -{ - func_enter(); - func_exit(); - return 0; -} /* uf_qdiscop_tune() */ - - -/* called during initial creation of qdisc on device */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -static int uf_qdiscop_init(struct Qdisc *qd, struct nlattr *opt) -#else -static int uf_qdiscop_init(struct Qdisc *qd, struct rtattr *opt) -#endif -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - struct net_device *dev = qd->dev_queue->dev; -#else - struct net_device *dev = qd->dev; -#endif /* LINUX_VERSION_CODE */ - netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); - unifi_priv_t *priv = interfacePriv->privPtr; - struct uf_sched_data *q = qdisc_priv(qd); - int err = 0, i; - - func_enter(); - - /* make sure we do not mess with the ingress qdisc */ - if (qd->flags & TCQ_F_INGRESS) { - func_exit(); - return -EINVAL; - } - - /* if options were passed in, set them */ - if (opt) { - err = uf_qdiscop_tune(qd, opt); - } - - /* create child queues */ - for (i = 0; i < UNIFI_TRAFFIC_Q_MAX; i++) { - q->queues[i] = UF_QDISC_CREATE_DFLT(dev, &pfifo_qdisc_ops, - qd->handle); - if (!q->queues[i]) { - q->queues[i] = &noop_qdisc; - unifi_error(priv, "%s child qdisc %i creation failed\n"); - } - - unifi_trace(priv, UDBG5, "%s: child qdisc=0x%p\n", - dev->name, q->queues[i]); - } - - func_exit_r(err); - return err; -} /* uf_qdiscop_init() */ - - -static int uf_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb) -{ - func_enter(); - func_exit_r(skb->len); - return skb->len; -} /* uf_qdiscop_dump() */ - -#endif /* CONFIG_NET_SCHED */ -#endif /* LINUX_VERSION_CODE */ - #ifdef CSR_SUPPORT_WEXT /* @@ -3595,7 +2977,7 @@ uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) { interfacePriv->wait_netdev_change ? "" : "not"); if (interfacePriv->wait_netdev_change) { - UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[interfacePriv->InterfaceTag]); + netif_tx_wake_all_queues(priv->netdev[interfacePriv->InterfaceTag]); interfacePriv->connected = UnifiConnected; interfacePriv->wait_netdev_change = FALSE; /* Note: passing the broadcast address here will allow anyone to attempt to join our adhoc network */ diff --git a/drivers/staging/csr/sdio_events.c b/drivers/staging/csr/sdio_events.c index 6892c2e281bc..2a80b9eb0200 100644 --- a/drivers/staging/csr/sdio_events.c +++ b/drivers/staging/csr/sdio_events.c @@ -66,7 +66,7 @@ void unifi_suspend(void *ospriv) unifi_trace(priv, UDBG1, "unifi_suspend: netif_carrier_off"); netif_carrier_off(priv->netdev[interfaceTag]); } - UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[interfaceTag]); + netif_tx_stop_all_queues(priv->netdev[interfaceTag]); } } @@ -119,7 +119,7 @@ void unifi_resume(void *ospriv) if (interfacePriv->netdev_registered == 1) { netif_carrier_on(priv->netdev[interfaceTag]); - UF_NETIF_TX_START_ALL_QUEUES(priv->netdev[interfaceTag]); + netif_tx_start_all_queues(priv->netdev[interfaceTag]); } } diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c index d3fd57cdde0b..af3e40bb5010 100644 --- a/drivers/staging/csr/sdio_mmc.c +++ b/drivers/staging/csr/sdio_mmc.c @@ -14,7 +14,7 @@ #include <linux/kernel.h> #include <linux/mutex.h> #include <linux/gfp.h> - +#include <linux/version.h> #include <linux/mmc/core.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> @@ -31,7 +31,6 @@ struct wake_lock unifi_sdio_wake_lock; /* wakelock to prevent suspend while resu static CsrSdioFunctionDriver *sdio_func_drv; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM static int uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void *ptr); #endif @@ -45,7 +44,6 @@ static int uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long ev * returning immediately (at least on x86). */ static int card_is_powered = 1; -#endif /* 2.6.32 */ /* MMC uses ENOMEDIUM to indicate card gone away */ @@ -637,7 +635,6 @@ CsrSdioFunctionIdle(CsrSdioFunction *function) CsrResult CsrSdioPowerOn(CsrSdioFunction *function) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) struct sdio_func *func = (struct sdio_func *)function->priv; struct mmc_host *host = func->card->host; @@ -649,7 +646,6 @@ CsrSdioPowerOn(CsrSdioFunction *function) printk(KERN_INFO "SDIO: Skip power on; card is already powered.\n"); } _sdio_release_host(func); -#endif /* 2.6.32 */ return CSR_RESULT_SUCCESS; } /* CsrSdioPowerOn() */ @@ -667,7 +663,6 @@ CsrSdioPowerOn(CsrSdioFunction *function) void CsrSdioPowerOff(CsrSdioFunction *function) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) struct sdio_func *func = (struct sdio_func *)function->priv; struct mmc_host *host = func->card->host; @@ -679,7 +674,6 @@ CsrSdioPowerOff(CsrSdioFunction *function) printk(KERN_INFO "SDIO: Skip power off; card is already powered off.\n"); } _sdio_release_host(func); -#endif /* 2.6.32 */ } /* CsrSdioPowerOff() */ @@ -845,19 +839,18 @@ uf_glue_sdio_int_handler(struct sdio_func *func) * Status of the removal. * --------------------------------------------------------------------------- */ -int -csr_sdio_linux_remove_irq(CsrSdioFunction *function) +int csr_sdio_linux_remove_irq(CsrSdioFunction *function) { - struct sdio_func *func = (struct sdio_func *)function->priv; - int r; + struct sdio_func *func = (struct sdio_func *)function->priv; + int r; - unifi_trace(NULL, UDBG1, "csr_sdio_linux_remove_irq\n"); + unifi_trace(NULL, UDBG1, "csr_sdio_linux_remove_irq\n"); - sdio_claim_host(func); - r = sdio_release_irq(func); - sdio_release_host(func); + sdio_claim_host(func); + r = sdio_release_irq(func); + sdio_release_host(func); - return r; + return r; } /* csr_sdio_linux_remove_irq() */ @@ -876,28 +869,25 @@ csr_sdio_linux_remove_irq(CsrSdioFunction *function) * Status of the removal. * --------------------------------------------------------------------------- */ -int -csr_sdio_linux_install_irq(CsrSdioFunction *function) +int csr_sdio_linux_install_irq(CsrSdioFunction *function) { - struct sdio_func *func = (struct sdio_func *)function->priv; - int r; + struct sdio_func *func = (struct sdio_func *)function->priv; + int r; - unifi_trace(NULL, UDBG1, "csr_sdio_linux_install_irq\n"); + unifi_trace(NULL, UDBG1, "csr_sdio_linux_install_irq\n"); - /* Register our interrupt handle */ - sdio_claim_host(func); - r = sdio_claim_irq(func, uf_glue_sdio_int_handler); - sdio_release_host(func); + /* Register our interrupt handle */ + sdio_claim_host(func); + r = sdio_claim_irq(func, uf_glue_sdio_int_handler); + sdio_release_host(func); - /* If the interrupt was installed earlier, is fine */ - if (r == -EBUSY) { - r = 0; - } + /* If the interrupt was installed earlier, is fine */ + if (r == -EBUSY) + r = 0; - return r; + return r; } /* csr_sdio_linux_install_irq() */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM /* @@ -1023,7 +1013,6 @@ uf_sdio_mmc_power_event(struct notifier_block *this, unsigned long event, void * } #endif /* CONFIG_PM */ -#endif /* 2.6.32 */ /* * --------------------------------------------------------------------------- @@ -1050,10 +1039,8 @@ uf_glue_sdio_probe(struct sdio_func *func, /* First of all claim the SDIO driver */ sdio_claim_host(func); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) /* Assume that the card is already powered */ card_is_powered = 1; -#endif /* Assumes one card per host, which is true for SDIO */ instance = func->card->host->index; @@ -1093,14 +1080,12 @@ uf_glue_sdio_probe(struct sdio_func *func, /* Pass context to the SDIO driver */ sdio_set_drvdata(func, sdio_ctx); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM /* Register to get PM events */ if (uf_sdio_mmc_register_pm_notifier(sdio_ctx) == NULL) { unifi_error(NULL, "%s: Failed to register for PM events\n", __FUNCTION__); } #endif -#endif /* Register this device with the SDIO function driver */ /* Call the main UniFi driver inserted handler */ @@ -1156,12 +1141,10 @@ uf_glue_sdio_remove(struct sdio_func *func) sdio_func_drv->removed(sdio_ctx); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM /* Unregister for PM events */ uf_sdio_mmc_unregister_pm_notifier(sdio_ctx); #endif -#endif kfree(sdio_ctx); @@ -1182,7 +1165,6 @@ static const struct sdio_device_id unifi_ids[] = { MODULE_DEVICE_TABLE(sdio, unifi_ids); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM /* @@ -1252,16 +1234,13 @@ static struct dev_pm_ops unifi_pm_ops = { #define UNIFI_PM_OPS NULL #endif /* CONFIG_PM */ -#endif /* 2.6.32 */ static struct sdio_driver unifi_driver = { .probe = uf_glue_sdio_probe, .remove = uf_glue_sdio_remove, .name = "unifi", .id_table = unifi_ids, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) .drv.pm = UNIFI_PM_OPS, -#endif /* 2.6.32 */ }; @@ -1305,12 +1284,10 @@ CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *sdio_drv) */ sdio_func_drv = sdio_drv; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #ifdef CONFIG_PM /* Initialise PM notifier list */ INIT_LIST_HEAD(&uf_sdio_mmc_pm_notifiers.list); #endif -#endif /* Register ourself with mmc_core */ r = sdio_register_driver(&unifi_driver); diff --git a/drivers/staging/csr/sme_blocking.c b/drivers/staging/csr/sme_blocking.c index acf0f0fe3b37..543e8f2c407a 100644 --- a/drivers/staging/csr/sme_blocking.c +++ b/drivers/staging/csr/sme_blocking.c @@ -18,10 +18,10 @@ /* - * This file also contains the implementation of the asyncronous + * This file also contains the implementation of the asynchronous * requests to the SME. * - * Before calling an asyncronous SME function, we call sme_init_request() + * Before calling an asynchronous SME function, we call sme_init_request() * which gets hold of the SME semaphore and updates the request status. * The semaphore makes sure that there is only one pending request to * the SME at a time. diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c index 229268fd746c..d7a5125d9a8e 100644 --- a/drivers/staging/csr/sme_native.c +++ b/drivers/staging/csr/sme_native.c @@ -12,7 +12,7 @@ */ #include <linux/netdevice.h> - +#include <linux/version.h> #include "unifi_priv.h" #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_conversions.h" @@ -24,11 +24,7 @@ uf_sme_init(unifi_priv_t *priv) { func_enter(); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) sema_init(&priv->mlme_blocking_mutex, 1); -#else - init_MUTEX(&priv->mlme_blocking_mutex); -#endif #ifdef CSR_SUPPORT_WEXT { diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c index 99de27e678d2..5b26c41c01f6 100644 --- a/drivers/staging/csr/sme_sys.c +++ b/drivers/staging/csr/sme_sys.c @@ -14,6 +14,7 @@ * --------------------------------------------------------------------------- */ +#include <linux/version.h> #include "csr_wifi_hip_unifiversion.h" #include "unifi_priv.h" #include "csr_wifi_hip_conversions.h" @@ -21,7 +22,6 @@ #include "csr_wifi_sme_sef.h" #endif - /* * This file implements the SME SYS API and contains the following functions: * CsrWifiRouterCtrlMediaStatusReqHandler() @@ -192,7 +192,7 @@ void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) #endif unifi_trace(priv, UDBG1, "CsrWifiRouterCtrlMediaStatusReqHandler: AP/P2PGO setting netif_carrier_on\n"); - UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[req->interfaceTag]); + netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]); break; default: @@ -226,7 +226,7 @@ void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) unifi_trace(priv, UDBG1, "CsrWifiRouterMediaStatusReqHandler: UnifiConnected && netif_carrier_on\n"); netif_carrier_on(priv->netdev[req->interfaceTag]); - UF_NETIF_TX_WAKE_ALL_QUEUES(priv->netdev[req->interfaceTag]); + netif_tx_wake_all_queues(priv->netdev[req->interfaceTag]); uf_process_rx_pending_queue(priv, UF_UNCONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); uf_process_rx_pending_queue(priv, UF_CONTROLLED_PORT_Q, broadcast_address, 1, interfacePriv->InterfaceTag); } @@ -869,7 +869,6 @@ wifi_off(unifi_priv_t *priv) unifi_trace(priv, UDBG1, "wifi_off\n"); /* Destroy the Traffic Analysis Module */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) cancel_work_sync(&priv->ta_ind_work.task); cancel_work_sync(&priv->ta_sample_ind_work.task); #ifdef CSR_SUPPORT_WEXT @@ -884,7 +883,6 @@ wifi_off(unifi_priv_t *priv) cancel_work_sync(&netpriv->send_m4_ready_task); } } -#endif flush_workqueue(priv->unifi_workqueue); /* fw_init parameter can prevent power off UniFi, for debugging */ @@ -955,7 +953,7 @@ void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg) netInterface_priv_t *interfacePriv = priv->interfacePriv[i]; if (interfacePriv->netdev_registered == 1) { netif_carrier_off(priv->netdev[i]); - UF_NETIF_TX_STOP_ALL_QUEUES(priv->netdev[i]); + netif_tx_stop_all_queues(priv->netdev[i]); interfacePriv->connected = UnifiConnectedUnknown; } interfacePriv->interfaceMode = 0; @@ -2123,7 +2121,7 @@ static int peer_add_new_record(unifi_priv_t *priv,CsrWifiRouterCtrlPeerAddReq *r /* Allocate for the new station record , to avoid race condition would happen between ADD_PEER & * DEL_PEER the allocation made atomic memory rather than kernel memory */ - newRecord = (CsrWifiRouterCtrlStaInfo_t *) kmalloc(sizeof(CsrWifiRouterCtrlStaInfo_t), GFP_ATOMIC); + newRecord = kmalloc(sizeof(CsrWifiRouterCtrlStaInfo_t), GFP_ATOMIC); if (!newRecord) { unifi_error(priv, "failed to allocate the %d bytes of mem for station record\n", sizeof(CsrWifiRouterCtrlStaInfo_t)); @@ -2815,12 +2813,11 @@ u8 blockack_session_start(unifi_priv_t *priv, } /* create and populate the new BA session structure */ - ba_session_tx = kmalloc(sizeof(ba_session_tx_struct), GFP_KERNEL); + ba_session_tx = kzalloc(sizeof(ba_session_tx_struct), GFP_KERNEL); if (!ba_session_tx) { unifi_error(priv, "%s: kmalloc failed for ba_session_tx\n", __FUNCTION__); return FALSE; } - memset(ba_session_tx, 0, sizeof(ba_session_tx_struct)); ba_session_tx->interfacePriv = interfacePriv; ba_session_tx->tID = tID; @@ -2905,26 +2902,23 @@ u8 blockack_session_start(unifi_priv_t *priv, return FALSE; } - ba_session_rx = kmalloc(sizeof(ba_session_rx_struct), GFP_KERNEL); + ba_session_rx = kzalloc(sizeof(ba_session_rx_struct), GFP_KERNEL); if (!ba_session_rx) { unifi_error(priv, "%s: kmalloc failed for ba_session_rx\n", __FUNCTION__); return FALSE; } - memset(ba_session_rx, 0, sizeof(ba_session_rx_struct)); ba_session_rx->wind_size = wind_size; ba_session_rx->start_sn = ba_session_rx->expected_sn = start_sn; ba_session_rx->trigger_ba_after_ssn = FALSE; - ba_session_rx->buffer = kmalloc(ba_session_rx->wind_size*sizeof(frame_desc_struct), GFP_KERNEL); + ba_session_rx->buffer = kzalloc(ba_session_rx->wind_size*sizeof(frame_desc_struct), GFP_KERNEL); if (!ba_session_rx->buffer) { kfree(ba_session_rx); unifi_error(priv, "%s: kmalloc failed for buffer\n", __FUNCTION__); return FALSE; } - memset(ba_session_rx->buffer, 0, ba_session_rx->wind_size*sizeof(frame_desc_struct)); - INIT_WORK(&ba_session_rx->send_ba_err_task, uf_send_ba_err_wq); if (timeout) { ba_session_rx->timeout = timeout; diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c index 7e85907e29a3..b58c0c6b171c 100644 --- a/drivers/staging/csr/sme_wext.c +++ b/drivers/staging/csr/sme_wext.c @@ -1191,8 +1191,6 @@ unifi_siwap(struct net_device *dev, struct iw_request_info *info, netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev); unifi_priv_t *priv = interfacePriv->privPtr; int err = 0; - const unsigned char zero_bssid[ETH_ALEN] = {0x00, 0x00, 0x00, - 0x00, 0x00, 0x00}; func_enter(); @@ -1213,7 +1211,7 @@ unifi_siwap(struct net_device *dev, struct iw_request_info *info, unifi_trace(priv, UDBG1, "unifi_siwap: asked for %pM\n", wrqu->ap_addr.sa_data); - if (!memcmp(wrqu->ap_addr.sa_data, zero_bssid, ETH_ALEN)) { + if (is_zero_ether_addr(wrqu->ap_addr.sa_data)) { priv->ignore_bssid_join = FALSE; err = sme_mgt_disconnect(priv); if (err) { @@ -3043,8 +3041,8 @@ _unifi_siwencodeext(struct net_device *dev, struct iw_request_info *info, memcpy(sme_key.address.a, ext->addr.sa_data, ETH_ALEN); if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - unifi_trace(priv, UDBG5, "RSC first 6 bytes = %02X:%02X:%02X:%02X:%02X:%02X\n", - ext->rx_seq[0], ext->rx_seq[1], ext->rx_seq[2], ext->rx_seq[3], ext->rx_seq[4], ext->rx_seq[5]); + unifi_trace(priv, UDBG5, "RSC first 6 bytes = %*phC\n", + 6, ext->rx_seq); /* memcpy((u8*)(&sme_key.keyRsc), ext->rx_seq, 8); */ sme_key.keyRsc[0] = ext->rx_seq[1] << 8 | ext->rx_seq[0]; diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c index 46d3507fd8f1..4013d021ebbf 100644 --- a/drivers/staging/csr/ul_int.c +++ b/drivers/staging/csr/ul_int.c @@ -12,6 +12,7 @@ * * *************************************************************************** */ +#include <linux/version.h> #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_conversions.h" #include "unifi_priv.h" @@ -44,11 +45,7 @@ ul_init_clients(unifi_priv_t *priv) int id; ul_client_t *ul_clients; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) sema_init(&priv->udi_logging_mutex, 1); -#else - init_MUTEX(&priv->udi_logging_mutex); -#endif priv->logging_client = NULL; ul_clients = priv->ul_clients; diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c index 7c7e8d49ae42..ae7c8fc94092 100644 --- a/drivers/staging/csr/unifi_pdu_processing.c +++ b/drivers/staging/csr/unifi_pdu_processing.c @@ -14,7 +14,7 @@ * --------------------------------------------------------------------------- */ - +#include <linux/version.h> #include <linux/types.h> #include <linux/etherdevice.h> #include <linux/vmalloc.h> @@ -23,9 +23,6 @@ #include "csr_wifi_hip_conversions.h" #include "csr_time.h" #include "unifi_priv.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) -#include <net/iw_handler.h> -#endif #include <net/pkt_sched.h> #ifdef CSR_SUPPORT_SME diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h index 6d6b46191a1a..aec8e28fb60d 100644 --- a/drivers/staging/csr/unifi_priv.h +++ b/drivers/staging/csr/unifi_priv.h @@ -29,9 +29,7 @@ #include <linux/wireless.h> #include <linux/cdev.h> #include <linux/kthread.h> -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) #include <linux/freezer.h> -#endif #ifdef CSR_WIFI_SUPPORT_MMC_DRIVER #include <linux/mmc/core.h> @@ -73,33 +71,6 @@ extern struct wake_lock unifi_sdio_wake_lock; #include "unifi_clients.h" - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -#include <linux/workqueue.h> - -#undef INIT_WORK -#define INIT_WORK(_work, _func) \ - do { \ - INIT_LIST_HEAD(&(_work)->entry); \ - (_work)->pending = 0; \ - PREPARE_WORK((_work), (_func), (_work)); \ - init_timer(&(_work)->timer); \ - } while(0) - -#endif /* Linux kernel < 2.6.20 */ - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev) netif_tx_wake_all_queues(_netdev) -#define UF_NETIF_TX_START_ALL_QUEUES(_netdev) netif_tx_start_all_queues(_netdev) -#define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev) netif_tx_stop_all_queues(_netdev) -#else -#define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev) netif_wake_queue(_netdev) -#define UF_NETIF_TX_START_ALL_QUEUES(_netdev) netif_start_queue(_netdev) -#define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev) netif_stop_queue(_netdev) -#endif /* Linux kernel >= 2.6.27 */ - - #ifdef CSR_NATIVE_LINUX #include "sme_native/unifi_native.h" #else @@ -634,12 +605,10 @@ struct unifi_priv { spinlock_t wapi_lock; #endif -#ifndef ALLOW_Q_PAUSE /* Array to indicate if a particular Tx queue is paused, this may not be * required in a multiqueue implementation since we can directly stop kernel * queues */ u8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX]; -#endif #ifdef CSR_WIFI_RX_PATH_SPLIT struct workqueue_struct *rx_workqueue; @@ -798,12 +767,6 @@ typedef struct netInterface_priv u8 bcTimSetReqQueued; } netInterface_priv_t; -#ifndef ALLOW_Q_PAUSE -#define net_is_tx_q_paused(priv, q) (priv->tx_q_paused_flag[q]) -#define net_tx_q_unpause(priv, q) (priv->tx_q_paused_flag[q] = 0) -#define net_tx_q_pause(priv, q) (priv->tx_q_paused_flag[q] = 1) -#endif - #ifdef CSR_SUPPORT_SME #define routerStartBuffering(priv,queue) priv->routerBufferEnable[(queue)] = TRUE; #define routerStopBuffering(priv,queue) priv->routerBufferEnable[(queue)] = FALSE; @@ -1088,9 +1051,6 @@ CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_p void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress); void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -int uf_install_qdisc(struct net_device *dev); -#endif void uf_resume_data_plane(unifi_priv_t *priv, int queue, CsrWifiMacAddress peer_address, diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h index 6d7a99595083..6834c43abfbb 100644 --- a/drivers/staging/csr/unifi_wext.h +++ b/drivers/staging/csr/unifi_wext.h @@ -16,6 +16,7 @@ #define __LINUX_UNIFI_WEXT_H__ 1 #include <linux/kernel.h> +#include <linux/version.h> #include <net/iw_handler.h> #include "csr_wifi_sme_prim.h" @@ -70,15 +71,9 @@ uf_iwe_stream_add_point(struct iw_request_info *info, char *start, char *stop, { char *new_start; - new_start = iwe_stream_add_point( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined (IW_REQUEST_FLAG_COMPAT) - info, -#endif - start, stop, piwe, extra); + new_start = iwe_stream_add_point(info, start, stop, piwe, extra); if (unlikely(new_start == start)) - { return -E2BIG; - } return (new_start - start); } @@ -90,14 +85,9 @@ uf_iwe_stream_add_event(struct iw_request_info *info, char *start, char *stop, { char *new_start; - new_start = iwe_stream_add_event( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined(IW_REQUEST_FLAG_COMPAT) - info, -#endif - start, stop, piwe, len); - if (unlikely(new_start == start)) { + new_start = iwe_stream_add_event(info, start, stop, piwe, len); + if (unlikely(new_start == start)) return -E2BIG; - } return (new_start - start); } @@ -108,14 +98,9 @@ uf_iwe_stream_add_value(struct iw_request_info *info, char *stream, char *start, { char *new_start; - new_start = iwe_stream_add_value( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) || defined(IW_REQUEST_FLAG_COMPAT) - info, -#endif - stream, start, stop, piwe, len); - if (unlikely(new_start == start)) { + new_start = iwe_stream_add_value(info, stream, start, stop, piwe, len); + if (unlikely(new_start == start)) return -E2BIG; - } return (new_start - start); } diff --git a/drivers/staging/csr/wext_events.c b/drivers/staging/csr/wext_events.c index d356887ac4c6..9860ea30da25 100644 --- a/drivers/staging/csr/wext_events.c +++ b/drivers/staging/csr/wext_events.c @@ -194,11 +194,9 @@ _send_michaelmicfailure_event(struct net_device *dev, union iwreq_data wrqu; char buf[128]; - sprintf(buf, - "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%02x:%02x:%02x:%02x:%02x:%02x)", - key_idx, (key_type == CSR_GROUP) ? "broad" : "uni", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); + sprintf(buf, + "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)", + key_idx, (key_type == CSR_GROUP) ? "broad" : "uni", macaddr); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = strlen(buf); wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); |