diff --git a/arch/arm/configs/surnia_defconfig b/arch/arm/configs/surnia_defconfig index 9384edbc149a..f97eb639d8ae 100644 --- a/arch/arm/configs/surnia_defconfig +++ b/arch/arm/configs/surnia_defconfig @@ -3158,7 +3158,7 @@ CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y CONFIG_WLAN_FEATURE_11W=y CONFIG_QCOM_TDLS=y CONFIG_QCOM_VOWIFI_11R=y -# CONFIG_ENABLE_LINUX_REG is not set +CONFIG_ENABLE_LINUX_REG=y # # Qualcomm MSM specific device drivers diff --git a/drivers/clk/qcom/clock-gcc-8936.c b/drivers/clk/qcom/clock-gcc-8936.c index 1886cfadc911..8a3c0fe606f6 100644 --- a/drivers/clk/qcom/clock-gcc-8936.c +++ b/drivers/clk/qcom/clock-gcc-8936.c @@ -273,6 +273,7 @@ static void __iomem *virt_dbgbase; #define BIMC_GFX_CBCR 0x31024 #define BIMC_GPU_CBCR 0x31040 #define GCC_SPARE3_REG 0x7E004 +#define SNOC_QOSGEN 0x2601C #define APCS_CCI_PLL_MODE 0x00000 #define APCS_CCI_PLL_L_VAL 0x00004 @@ -2986,6 +2987,18 @@ static struct pll_config_regs gpll4_regs = { .base = &virt_bases[GCC_BASE], }; +static struct gate_clk gcc_snoc_qosgen_clk = { + .en_mask = BIT(0), + .en_reg = SNOC_QOSGEN, + .base = &virt_bases[GCC_BASE], + .c = { + .dbg_name = "gcc_snoc_qosgen_clk", + .ops = &clk_ops_gate, + .flags = CLKFLAG_SKIP_HANDOFF, + CLK_INIT(gcc_snoc_qosgen_clk.c), + }, +}; + static struct mux_clk gcc_debug_mux; static struct clk_ops clk_ops_debug_mux; @@ -3324,6 +3337,9 @@ static struct clk_lookup msm_clocks_lookup[] = { CLK_LIST(gcc_crypto_ahb_clk), CLK_LIST(gcc_crypto_axi_clk), CLK_LIST(crypto_clk_src), + + /* QoS Reference clock */ + CLK_LIST(gcc_snoc_qosgen_clk), }; static struct clk_lookup msm_clocks_lookup_v1[] = { diff --git a/drivers/input/touchscreen/synaptics_fw_update.c b/drivers/input/touchscreen/synaptics_fw_update.c index a2b63e6a4539..a7e859b3209f 100644 --- a/drivers/input/touchscreen/synaptics_fw_update.c +++ b/drivers/input/touchscreen/synaptics_fw_update.c @@ -16,7 +16,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ - +#include #include #include #include @@ -693,7 +693,6 @@ static int fwu_wait_for_idle(int timeout_ms) static enum flash_area fwu_go_nogo(void) { int retval = 0; - int index = 0; int deviceFirmwareID; int imageConfigID; int deviceConfigID; @@ -798,6 +797,8 @@ static enum flash_area fwu_go_nogo(void) __func__); imageFirmwareID = img->firmware_id; } else { + size_t index, max_index; + if (!fwu->image_name) { dev_info(&i2c_client->dev, "%s: Unknown image file name\n", @@ -814,8 +815,11 @@ static enum flash_area fwu_go_nogo(void) goto exit; } + max_index = min((ptrdiff_t)(MAX_FIRMWARE_ID_LEN - 1), + &fwu->image_name[NAME_BUFFER_SIZE] - strptr); + index = 0; strptr += 2; - while (strptr[index] >= '0' && strptr[index] <= '9') { + while (index < max_index && isdigit(strptr[index])) { imagePR[index] = strptr[index]; index++; } diff --git a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c index 823cc0bb57b8..6687f6bb4667 100644 --- a/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c +++ b/drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c @@ -90,11 +90,6 @@ static void msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl, struct msm_camera_i2c_reg_array *i2c_tbl = a_ctrl->i2c_reg_tbl; CDBG("Enter\n"); for (i = 0; i < size; i++) { - /* check that the index into i2c_tbl cannot grow larger that - the allocated size of i2c_tbl */ - if ((a_ctrl->total_steps + 1) < (a_ctrl->i2c_tbl_index)) { - break; - } if (write_arr[i].reg_write_type == MSM_ACTUATOR_WRITE_DAC) { value = (next_lens_position << write_arr[i].data_shift) | @@ -108,6 +103,11 @@ static void msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl, i2c_byte2 = value & 0xFF; CDBG("byte1:0x%x, byte2:0x%x\n", i2c_byte1, i2c_byte2); + if (a_ctrl->i2c_tbl_index > + a_ctrl->total_steps) { + pr_err("failed:i2c table index out of bound\n"); + break; + } i2c_tbl[a_ctrl->i2c_tbl_index]. reg_addr = i2c_byte1; i2c_tbl[a_ctrl->i2c_tbl_index]. @@ -128,6 +128,10 @@ static void msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl, i2c_byte2 = (hw_dword & write_arr[i].hw_mask) >> write_arr[i].hw_shift; } + if (a_ctrl->i2c_tbl_index > a_ctrl->total_steps) { + pr_err("failed: i2c table index out of bound\n"); + break; + } CDBG("i2c_byte1:0x%x, i2c_byte2:0x%x\n", i2c_byte1, i2c_byte2); i2c_tbl[a_ctrl->i2c_tbl_index].reg_addr = i2c_byte1; i2c_tbl[a_ctrl->i2c_tbl_index].reg_data = i2c_byte2; diff --git a/drivers/misc/qcom/qdsp6v2/audio_utils_aio.c b/drivers/misc/qcom/qdsp6v2/audio_utils_aio.c index 980492f09dc2..66ae8e66c5cd 100644 --- a/drivers/misc/qcom/qdsp6v2/audio_utils_aio.c +++ b/drivers/misc/qcom/qdsp6v2/audio_utils_aio.c @@ -1,6 +1,6 @@ /* Copyright (C) 2008 Google, Inc. * Copyright (C) 2008 HTC Corporation - * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2009-2016, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -570,6 +570,8 @@ int audio_aio_release(struct inode *inode, struct file *file) struct q6audio_aio *audio = file->private_data; pr_debug("%s[%p]\n", __func__, audio); mutex_lock(&audio->lock); + mutex_lock(&audio->read_lock); + mutex_lock(&audio->write_lock); audio->wflush = 1; if (audio->enabled) audio_aio_flush(audio); @@ -584,6 +586,8 @@ int audio_aio_release(struct inode *inode, struct file *file) wake_up(&audio->event_wait); audio_aio_reset_event_queue(audio); q6asm_audio_client_free(audio->ac); + mutex_unlock(&audio->write_lock); + mutex_unlock(&audio->read_lock); mutex_unlock(&audio->lock); mutex_destroy(&audio->lock); mutex_destroy(&audio->read_lock); @@ -1681,7 +1685,11 @@ static long audio_aio_ioctl(struct file *file, unsigned int cmd, __func__); rc = -EFAULT; } else { + mutex_lock(&audio->read_lock); + mutex_lock(&audio->write_lock); rc = audio_aio_ion_add(audio, &info); + mutex_unlock(&audio->write_lock); + mutex_unlock(&audio->read_lock); } mutex_unlock(&audio->lock); break; @@ -1696,7 +1704,11 @@ static long audio_aio_ioctl(struct file *file, unsigned int cmd, __func__); rc = -EFAULT; } else { + mutex_lock(&audio->read_lock); + mutex_lock(&audio->write_lock); rc = audio_aio_ion_remove(audio, &info); + mutex_unlock(&audio->write_lock); + mutex_unlock(&audio->read_lock); } mutex_unlock(&audio->lock); break; @@ -1998,7 +2010,11 @@ static long audio_aio_compat_ioctl(struct file *file, unsigned int cmd, } else { info.fd = info_32.fd; info.vaddr = compat_ptr(info_32.vaddr); + mutex_lock(&audio->read_lock); + mutex_lock(&audio->write_lock); rc = audio_aio_ion_add(audio, &info); + mutex_unlock(&audio->write_lock); + mutex_unlock(&audio->read_lock); } mutex_unlock(&audio->lock); break; @@ -2015,7 +2031,11 @@ static long audio_aio_compat_ioctl(struct file *file, unsigned int cmd, } else { info.fd = info_32.fd; info.vaddr = compat_ptr(info_32.vaddr); + mutex_lock(&audio->read_lock); + mutex_lock(&audio->write_lock); rc = audio_aio_ion_remove(audio, &info); + mutex_unlock(&audio->write_lock); + mutex_unlock(&audio->read_lock); } mutex_unlock(&audio->lock); break; diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 35c4acfaff36..0c27bc662b17 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -533,7 +533,7 @@ static void binder_insert_free_buffer(struct binder_proc *proc, new_buffer_size = binder_buffer_size(proc, new_buffer); binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: add free buffer, size %zd, at %p\n", + "%d: add free buffer, size %zd, at %pK\n", proc->pid, new_buffer_size, new_buffer); while (*p) { @@ -612,7 +612,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, struct mm_struct *mm; binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: %s pages %p-%p\n", proc->pid, + "%d: %s pages %pK-%pK\n", proc->pid, allocate ? "allocate" : "free", start, end); if (end <= start) @@ -654,7 +654,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, BUG_ON(*page); *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); if (*page == NULL) { - pr_err("%d: binder_alloc_buf failed for page at %p\n", + pr_err("%d: binder_alloc_buf failed for page at %pK\n", proc->pid, page_addr); goto err_alloc_page_failed; } @@ -663,7 +663,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, page_array_ptr = page; ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr); if (ret) { - pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n", + pr_err("%d: binder_alloc_buf failed to map page at %pK in kernel\n", proc->pid, page_addr); goto err_map_kernel_failed; } @@ -769,7 +769,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, } binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: binder_alloc_buf size %zd got buffer %p size %zd\n", + "%d: binder_alloc_buf size %zd got buffer %pK size %zd\n", proc->pid, size, buffer, buffer_size); has_page_addr = @@ -798,7 +798,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, binder_insert_free_buffer(proc, new_buffer); } binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: binder_alloc_buf size %zd got %p\n", + "%d: binder_alloc_buf size %zd got %pK\n", proc->pid, size, buffer); buffer->data_size = data_size; buffer->offsets_size = offsets_size; @@ -838,7 +838,7 @@ static void binder_delete_free_buffer(struct binder_proc *proc, if (buffer_end_page(prev) == buffer_end_page(buffer)) free_page_end = 0; binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: merge free, buffer %p share page with %p\n", + "%d: merge free, buffer %pK share page with %pK\n", proc->pid, buffer, prev); } @@ -851,14 +851,14 @@ static void binder_delete_free_buffer(struct binder_proc *proc, buffer_start_page(buffer)) free_page_start = 0; binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: merge free, buffer %p share page with %p\n", + "%d: merge free, buffer %pK share page with %pK\n", proc->pid, buffer, prev); } } list_del(&buffer->entry); if (free_page_start || free_page_end) { binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: merge free, buffer %p do not share page%s%s with %p or %p\n", + "%d: merge free, buffer %pK do not share page%s%s with %pK or %pK\n", proc->pid, buffer, free_page_start ? "" : " end", free_page_end ? "" : " start", prev, next); binder_update_page_range(proc, 0, free_page_start ? @@ -879,7 +879,7 @@ static void binder_free_buf(struct binder_proc *proc, ALIGN(buffer->offsets_size, sizeof(void *)); binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%d: binder_free_buf %p size %zd buffer_size %zd\n", + "%d: binder_free_buf %pK size %zd buffer_size %zd\n", proc->pid, buffer, size, buffer_size); BUG_ON(buffer->free); @@ -1306,7 +1306,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, int debug_id = buffer->debug_id; binder_debug(BINDER_DEBUG_TRANSACTION, - "%d buffer release %d, size %zd-%zd, failed at %p\n", + "%d buffer release %d, size %zd-%zd, failed at %pK\n", proc->pid, buffer->debug_id, buffer->data_size, buffer->offsets_size, failed_at); @@ -2154,7 +2154,7 @@ static int binder_thread_write(struct binder_proc *proc, } } binder_debug(BINDER_DEBUG_DEAD_BINDER, - "%d:%d BC_DEAD_BINDER_DONE %016llx found %p\n", + "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n", proc->pid, thread->pid, (u64)cookie, death); if (death == NULL) { binder_user_error("%d:%d BC_DEAD_BINDER_DONE %016llx not found\n", @@ -2952,7 +2952,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) #ifdef CONFIG_CPU_CACHE_VIPT if (cache_is_vipt_aliasing()) { while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) { - pr_info("binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); + pr_info("binder_mmap: %d %lx-%lx maps %pK bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer); vma->vm_start += PAGE_SIZE; } } @@ -2988,7 +2988,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) proc->vma = vma; proc->vma_vm_mm = vma->vm_mm; - /*pr_info("binder_mmap: %d %lx-%lx maps %p\n", + /*pr_info("binder_mmap: %d %lx-%lx maps %pK\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/ return 0; @@ -3210,7 +3210,7 @@ static void binder_deferred_release(struct binder_proc *proc) page_addr = proc->buffer + i * PAGE_SIZE; binder_debug(BINDER_DEBUG_BUFFER_ALLOC, - "%s: %d: page %d at %p not freed\n", + "%s: %d: page %d at %pK not freed\n", __func__, proc->pid, i, page_addr); unmap_kernel_range((unsigned long)page_addr, PAGE_SIZE); __free_page(proc->pages[i]); @@ -3294,7 +3294,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix, struct binder_transaction *t) { seq_printf(m, - "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d", + "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld r%d", prefix, t->debug_id, t, t->from ? t->from->proc->pid : 0, t->from ? t->from->pid : 0, @@ -3308,7 +3308,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix, if (t->buffer->target_node) seq_printf(m, " node %d", t->buffer->target_node->debug_id); - seq_printf(m, " size %zd:%zd data %p\n", + seq_printf(m, " size %zd:%zd data %pK\n", t->buffer->data_size, t->buffer->offsets_size, t->buffer->data); } @@ -3316,7 +3316,7 @@ static void print_binder_transaction(struct seq_file *m, const char *prefix, static void print_binder_buffer(struct seq_file *m, const char *prefix, struct binder_buffer *buffer) { - seq_printf(m, "%s %d: %p size %zd:%zd %s\n", + seq_printf(m, "%s %d: %pK size %zd:%zd %s\n", prefix, buffer->debug_id, buffer->data, buffer->data_size, buffer->offsets_size, buffer->transaction ? "active" : "delivered"); diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c old mode 100644 new mode 100755 index d4d774ed346c..6ac8661e1233 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -406,13 +406,22 @@ static void ion_handle_get(struct ion_handle *handle) kref_get(&handle->ref); } +static int ion_handle_put_nolock(struct ion_handle *handle) +{ + int ret; + + ret = kref_put(&handle->ref, ion_handle_destroy); + + return ret; +} + int ion_handle_put(struct ion_handle *handle) { struct ion_client *client = handle->client; int ret; mutex_lock(&client->lock); - ret = kref_put(&handle->ref, ion_handle_destroy); + ret = ion_handle_put_nolock(handle); mutex_unlock(&client->lock); return ret; @@ -435,20 +444,30 @@ static struct ion_handle *ion_handle_lookup(struct ion_client *client, return ERR_PTR(-EINVAL); } -struct ion_handle *ion_handle_get_by_id(struct ion_client *client, +static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client *client, int id) { struct ion_handle *handle; - mutex_lock(&client->lock); handle = idr_find(&client->idr, id); if (handle) ion_handle_get(handle); - mutex_unlock(&client->lock); return handle ? handle : ERR_PTR(-EINVAL); } +struct ion_handle *ion_handle_get_by_id(struct ion_client *client, + int id) +{ + struct ion_handle *handle; + + mutex_lock(&client->lock); + handle = ion_handle_get_by_id_nolock(client, id); + mutex_unlock(&client->lock); + + return handle; +} + static bool ion_handle_validate(struct ion_client *client, struct ion_handle *handle) { @@ -601,21 +620,27 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, } EXPORT_SYMBOL(ion_alloc); -void ion_free(struct ion_client *client, struct ion_handle *handle) +static void ion_free_nolock(struct ion_client *client, struct ion_handle *handle) { bool valid_handle; BUG_ON(client != handle->client); - mutex_lock(&client->lock); valid_handle = ion_handle_validate(client, handle); if (!valid_handle) { WARN(1, "%s: invalid handle passed to free.\n", __func__); - mutex_unlock(&client->lock); return; } + ion_handle_put_nolock(handle); +} + +void ion_free(struct ion_client *client, struct ion_handle *handle) +{ + BUG_ON(client != handle->client); + + mutex_lock(&client->lock); + ion_free_nolock(client, handle); mutex_unlock(&client->lock); - ion_handle_put(handle); } EXPORT_SYMBOL(ion_free); @@ -782,7 +807,7 @@ static int ion_debug_client_show(struct seq_file *s, void *unused) struct ion_handle *handle = rb_entry(n, struct ion_handle, node); - seq_printf(s, "%16.16s: %16zx : %16d : %12p", + seq_printf(s, "%16.16s: %16zx : %16d : %12pK", handle->buffer->heap->name, handle->buffer->size, atomic_read(&handle->ref.refcount), @@ -1138,7 +1163,7 @@ static void ion_vm_open(struct vm_area_struct *vma) mutex_lock(&buffer->lock); list_add(&vma_list->list, &buffer->vmas); mutex_unlock(&buffer->lock); - pr_debug("%s: adding %p\n", __func__, vma); + pr_debug("%s: adding %pK\n", __func__, vma); } static void ion_vm_close(struct vm_area_struct *vma) @@ -1153,7 +1178,7 @@ static void ion_vm_close(struct vm_area_struct *vma) continue; list_del(&vma_list->list); kfree(vma_list); - pr_debug("%s: deleting %p\n", __func__, vma); + pr_debug("%s: deleting %pK\n", __func__, vma); break; } mutex_unlock(&buffer->lock); @@ -1441,11 +1466,15 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct ion_handle *handle; - handle = ion_handle_get_by_id(client, data.handle.handle); - if (IS_ERR(handle)) + mutex_lock(&client->lock); + handle = ion_handle_get_by_id_nolock(client, data.handle.handle); + if (IS_ERR(handle)) { + mutex_unlock(&client->lock); return PTR_ERR(handle); - ion_free(client, handle); - ion_handle_put(handle); + } + ion_free_nolock(client, handle); + ion_handle_put_nolock(handle); + mutex_unlock(&client->lock); break; } case ION_IOC_SHARE: diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index 583774e2e939..01ca23611a48 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -302,8 +302,9 @@ struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data) switch (heap_data->type) { case ION_HEAP_TYPE_SYSTEM_CONTIG: - heap = ion_system_contig_heap_create(heap_data); - break; + pr_err("%s: Heap type is disabled: %d\n", __func__, + heap_data->type); + return ERR_PTR(-EINVAL); case ION_HEAP_TYPE_SYSTEM: heap = ion_system_heap_create(heap_data); break; @@ -342,7 +343,8 @@ void ion_heap_destroy(struct ion_heap *heap) switch (heap->type) { case ION_HEAP_TYPE_SYSTEM_CONTIG: - ion_system_contig_heap_destroy(heap); + pr_err("%s: Heap type is disabled: %d\n", __func__, + heap->type); break; case ION_HEAP_TYPE_SYSTEM: ion_system_heap_destroy(heap); diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h index bec55c5c49fe..5a51247fbc65 100644 --- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h +++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h @@ -611,16 +611,30 @@ typedef enum #define CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ( 10000 ) #define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT ( 30 ) +/* Max Dwell time during BTC eSCO call in msec*/ #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_NAME "gActiveMaxChannelTimeBtc" #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MIN ( 0 ) #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MAX ( 10000 ) #define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_DEFAULT ( 120 ) +/* Min Dwell time during BTC eSCO call in msec*/ #define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_NAME "gActiveMinChannelTimeBtc" #define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MIN ( 0 ) #define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MAX ( 10000 ) #define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_DEFAULT ( 60 ) +/* Min Dwell time during BTC SCO call in msec*/ +#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_NAME "gActiveMinChannelTimeBtcSCO" +#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_MIN (0) +#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_MAX (10000) +#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_DEFAULT (20) + +/* Max Dwell time during BTC SCO call in msec*/ +#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_NAME "gActiveMaxChannelTimeBtcSCO" +#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_MIN (0) +#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_MAX (10000) +#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_DEFAULT (40) + #define CFG_RETRY_LIMIT_ZERO_NAME "gRetryLimitZero" #define CFG_RETRY_LIMIT_ZERO_MIN ( 0 ) #define CFG_RETRY_LIMIT_ZERO_MAX ( 15 ) @@ -917,7 +931,7 @@ typedef enum * Max: Max rate for 1x1 transmission */ #define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD "gPERRoamUpThresholdRate" -#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MIN (10) +#define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MIN (20) #define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_MAX (3330) #define CFG_PER_ROAM_SCAN_RATE_UP_THRESHOLD_DEFAULT (400) @@ -936,13 +950,13 @@ typedef enum * Value : seconds */ #define CFG_PER_ROAM_SCAN_WAIT_TIME "gPERRoamScanInterval" -#define CFG_PER_ROAM_SCAN_WAIT_TIME_MIN (0) +#define CFG_PER_ROAM_SCAN_WAIT_TIME_MIN (10) #define CFG_PER_ROAM_SCAN_WAIT_TIME_MAX (3600) #define CFG_PER_ROAM_SCAN_WAIT_TIME_DEFAULT (300) /* Time to collect stats to trigger roam scan for Tx path */ #define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD "gPERRoamStatsTime" -#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MIN (0) +#define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MIN (5) #define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_MAX (25) #define CFG_PER_ROAM_SCAN_PER_TIME_THRESHOLD_DEFAULT (10) @@ -975,6 +989,11 @@ typedef enum #define CFG_PER_ROAM_SCAN_CCA_ENABLED_MIN (0) #define CFG_PER_ROAM_SCAN_CCA_ENABLED_MAX (1) #define CFG_PER_ROAM_SCAN_CCA_ENABLED_DEFAULT (0) + +#define CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD "gPERRoamFullScanRssiDiffThreshold" +#define CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_MIN (5) +#define CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_MAX (50) +#define CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_DEFAULT (10) #endif #define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME "PktClassificationBasis" // DSCP or 802.1Q @@ -2992,8 +3011,10 @@ typedef struct v_U32_t nInitialDwellTime; //in units of milliseconds - v_U32_t nActiveMinChnTimeBtc; //in units of milliseconds - v_U32_t nActiveMaxChnTimeBtc; //in units of milliseconds + uint32_t min_chntime_btc_esco; //in units of milliseconds + uint32_t max_chntime_btc_esco; //in units of milliseconds + uint32_t min_chntime_btc_sco; + uint32_t max_chntime_btc_sco; #ifdef WLAN_AP_STA_CONCURRENCY v_U32_t nPassiveMinChnTimeConc; //in units of milliseconds v_U32_t nPassiveMaxChnTimeConc; //in units of milliseconds @@ -3053,6 +3074,7 @@ typedef struct v_BOOL_t isPERRoamEnabled; v_BOOL_t isPERRoamRxPathEnabled; v_BOOL_t isPERRoamCCAEnabled; + v_S15_t PERRoamFullScanThreshold; v_U16_t rateUpThreshold; v_U16_t rateDownThreshold; v_U16_t PERroamTriggerPercent; diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c index dbd85d5ad268..933a2df781d1 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c @@ -1786,7 +1786,8 @@ static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCs (int)pRoamInfo->pBssDesc->channelId); hddLog(LOG1, "assocReqlen %d assocRsplen %d", assocReqlen, assocRsplen); - if (pHddCtx->cfg_ini->gEnableRoamDelayStats) + if (pHddCtx->cfg_ini && + pHddCtx->cfg_ini->gEnableRoamDelayStats) { vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); } @@ -1840,7 +1841,8 @@ static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCs if(ft_carrier_on) { hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength); - if (pHddCtx->cfg_ini->gEnableRoamDelayStats) + if (pHddCtx->cfg_ini && + pHddCtx->cfg_ini->gEnableRoamDelayStats) { vos_record_roam_event(e_HDD_SEND_REASSOC_RSP, NULL, 0); } @@ -1934,7 +1936,7 @@ static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCs hddLog(VOS_TRACE_LEVEL_INFO, FL("Enabling queues")); netif_tx_wake_all_queues(dev); } - if (pHddCtx->cfg_ini->gEnableRoamDelayStats) + if (pHddCtx->cfg_ini && pHddCtx->cfg_ini->gEnableRoamDelayStats) { vos_record_roam_event(e_HDD_ENABLE_TX_QUEUE, NULL, 0); } @@ -2488,7 +2490,7 @@ static void hdd_ReConfigSuspendDataClearedDuringRoaming(hdd_context_t *pHddCtx) vstatus = hdd_conf_arp_offload(pAdapter, TRUE); if (!VOS_IS_STATUS_SUCCESS(vstatus)) { - hddLog(VOS_TRACE_LEVEL_ERROR, + hddLog(VOS_TRACE_LEVEL_INFO, FL("Failed to disable ARPOffload Feature %d"), vstatus); } } diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c index c659b1c3ab09..a14cca2c216e 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c @@ -791,19 +791,33 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ), REG_VARIABLE( CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_NAME, WLAN_PARAM_Integer, - hdd_config_t, nActiveMaxChnTimeBtc, + hdd_config_t, max_chntime_btc_esco, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_DEFAULT, CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MIN, CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MAX ), REG_VARIABLE( CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_NAME, WLAN_PARAM_Integer, - hdd_config_t, nActiveMinChnTimeBtc, + hdd_config_t, min_chntime_btc_esco, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_DEFAULT, CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MIN, CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MAX ), + REG_VARIABLE(CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_NAME, WLAN_PARAM_Integer, + hdd_config_t, min_chntime_btc_sco, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_DEFAULT, + CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_MIN, + CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_SCO_MAX ), + + REG_VARIABLE(CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_NAME, WLAN_PARAM_Integer, + hdd_config_t, max_chntime_btc_sco, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_DEFAULT, + CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_MIN, + CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_SCO_MAX ), + REG_VARIABLE( CFG_RETRY_LIMIT_ZERO_NAME, WLAN_PARAM_Integer, hdd_config_t, retryLimitZero, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -2839,6 +2853,13 @@ REG_VARIABLE( CFG_EXTSCAN_ENABLE, WLAN_PARAM_Integer, CFG_PER_ROAM_SCAN_CCA_ENABLED_DEFAULT, CFG_PER_ROAM_SCAN_CCA_ENABLED_MIN, CFG_PER_ROAM_SCAN_CCA_ENABLED_MAX), + + REG_VARIABLE(CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD, WLAN_PARAM_SignedInteger, + hdd_config_t, PERRoamFullScanThreshold, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_DEFAULT, + CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_MIN, + CFG_PER_ROAM_FULL_SCAN_RSSI_THRESHOLD_MAX), #endif REG_VARIABLE( CFG_ENABLE_ADAPT_RX_DRAIN_NAME, WLAN_PARAM_Integer, @@ -4233,6 +4254,10 @@ static void print_hdd_cfg(hdd_context_t *pHddCtx) "Name = [gPERRoamCCAEnabled] Value = [%u] ", pHddCtx->cfg_ini->isPERRoamCCAEnabled); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, + "Name = [gPERRoamFullScanThreshold] Value = [%u] ", + pHddCtx->cfg_ini->PERRoamFullScanThreshold); + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gPERRoamScanInterval] Value = [%lu] ", (long unsigned int)pHddCtx->cfg_ini->waitPeriodForNextPERScan); @@ -5928,8 +5953,14 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx ) smeConfig->csrConfig.nActiveMinChnTime = pConfig->nActiveMinChnTime; smeConfig->csrConfig.nPassiveMaxChnTime = pConfig->nPassiveMaxChnTime; smeConfig->csrConfig.nPassiveMinChnTime = pConfig->nPassiveMinChnTime; - smeConfig->csrConfig.nActiveMaxChnTimeBtc = pConfig->nActiveMaxChnTimeBtc; - smeConfig->csrConfig.nActiveMinChnTimeBtc = pConfig->nActiveMinChnTimeBtc; + smeConfig->csrConfig.max_chntime_btc_esco = + pConfig->max_chntime_btc_esco; + smeConfig->csrConfig.min_chntime_btc_esco = + pConfig->min_chntime_btc_esco; + smeConfig->csrConfig.min_chntime_btc_sco = + pConfig->min_chntime_btc_sco; + smeConfig->csrConfig.max_chntime_btc_sco = + pConfig->max_chntime_btc_sco; smeConfig->csrConfig.disableAggWithBtc = pConfig->disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY smeConfig->csrConfig.nActiveMaxChnTimeConc = pConfig->nActiveMaxChnTimeConc; @@ -6041,6 +6072,8 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx ) pConfig->waitPeriodForNextPERScan; smeConfig->csrConfig.PERtimerThreshold = pConfig->PERtimerThreshold; smeConfig->csrConfig.isPERRoamCCAEnabled = pConfig->isPERRoamCCAEnabled; + smeConfig->csrConfig.PERRoamFullScanThreshold = + pConfig->PERRoamFullScanThreshold * -1; smeConfig->csrConfig.PERroamTriggerPercent = pConfig->PERroamTriggerPercent; diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c index 1158afd3bd96..529c5b17f6a3 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -3902,6 +3902,7 @@ __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, uint32_t request_id; char ssid_string[SIR_MAC_MAX_SSID_LENGTH + 1] = {'\0'}; int ssid_len; + int ssid_length; eHalStatus status; int i, rem, retval; unsigned long rc; @@ -3992,12 +3993,15 @@ __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, hddLog(LOGE, FL("attr ssid failed")); goto fail; } - nla_memcpy(ssid_string, - tb2[PARAM_SSID], - sizeof(ssid_string)); + ssid_length = nla_strlcpy(ssid_string, tb2[PARAM_SSID], + sizeof(ssid_string)); hddLog(LOG1, FL("SSID %s"), ssid_string); ssid_len = strlen(ssid_string); + if (ssid_length > SIR_MAC_MAX_SSID_LENGTH) { + hddLog(LOGE, FL("Invalid ssid length")); + goto fail; + } memcpy(request->ssid[i].ssid.ssId, ssid_string, ssid_len); request->ssid[i].ssid.length = ssid_len; request->ssid[i].ssid.ssId[ssid_len] = '\0'; @@ -12620,6 +12624,42 @@ VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, } #endif + +/** + * wlan_hdd_cfg80211_validate_scan_req - validate scan request + * @scan_req: scan request to be checked + * + * Return: true or false + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) +static inline bool wlan_hdd_cfg80211_validate_scan_req(struct + cfg80211_scan_request + *scan_req) +{ + if (!scan_req || !scan_req->wiphy) { + hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); + return false; + } + if (vos_is_load_unload_in_progress(VOS_MODULE_ID_HDD, NULL)) { + hddLog(VOS_TRACE_LEVEL_ERROR, "Load/Unload in progress"); + return false; + } + return true; +} +#else +static inline bool wlan_hdd_cfg80211_validate_scan_req(struct + cfg80211_scan_request + *scan_req) +{ + if (!scan_req || !scan_req->wiphy) { + hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); + return false; + } + return true; +} +#endif + + /* * FUNCTION: hdd_cfg80211_scan_done_callback * scanning callback function, called after finishing scan @@ -12736,9 +12776,17 @@ static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, /* Scan is no longer pending */ pScanInfo->mScanPending = VOS_FALSE; - if (!req || req->wiphy == NULL) + if (!wlan_hdd_cfg80211_validate_scan_req(req)) { - hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) + hddLog(VOS_TRACE_LEVEL_ERROR, FL("interface state %s"), + iface_down ? "up" : "down"); +#endif + + if (pAdapter->dev) { + hddLog(VOS_TRACE_LEVEL_ERROR, FL("device name %s"), + pAdapter->dev->name); + } complete(&pScanInfo->abortscan_event_var); goto allow_suspend; } @@ -12825,13 +12873,6 @@ v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) v_U8_t staId = 0; v_U8_t *staMac = NULL; - if (TRUE == pHddCtx->btCoexModeSet) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, - FL("BTCoex Mode operation in progress")); - return VOS_TRUE; - } - status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) @@ -13057,6 +13098,12 @@ int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, /* Check if scan is allowed at this point of time. */ + if (TRUE == pHddCtx->btCoexModeSet) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + FL("BTCoex Mode operation in progress")); + return -EBUSY; + } if (hdd_isConnectionInProgress(pHddCtx)) { hddLog(VOS_TRACE_LEVEL_ERROR, FL("Scan not allowed")); @@ -17347,7 +17394,7 @@ static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, // Assuming the PNO disable was success. // Returning error from here, because we timeout, results // in side effect of Wifi (Wifi Setting) not to work. - VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, FL("Timed out waiting for PNO to be disabled")); ret = 0; } diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c index 296f43584cd9..a6a9e89daf5d 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -657,7 +657,7 @@ void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) if (!VOS_IS_STATUS_SUCCESS(vstatus)) { - hddLog(VOS_TRACE_LEVEL_ERROR, + hddLog(VOS_TRACE_LEVEL_INFO, "Failed to enable ARPOFfloadFeature %d", vstatus); } diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c index ca2c8125deba..9bc83726bef2 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c @@ -911,7 +911,7 @@ static int oem_msg_callback(struct sk_buff *skb) } aniMsgBody = (char *)((char *)msg_hdr + sizeof(tAniMsgHdr)); oemMsgSubType = (tANI_U32*) aniMsgBody; - hddLog(LOGE, FL("oemMsgSubType: 0x%x"), *oemMsgSubType); + hddLog(LOG1, FL("oemMsgSubType: 0x%x"), *oemMsgSubType); oem_process_data_req_msg(msg_hdr->length, (char *) ((char *)msg_hdr + diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c index 8d916febf4e8..90f5d73cc9c3 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c @@ -260,6 +260,13 @@ eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx, pRemainChanCtx = cfgState->remain_on_chan_ctx; if ( pRemainChanCtx ) { + /* Trigger kernel panic if ROC timer state is not set to unused state + * before freeing the ROC ctx. + */ + if (VOS_TIMER_STATE_UNUSED != vos_timer_getCurrentState( + &pRemainChanCtx->hdd_remain_on_chan_timer)) + VOS_BUG(0); + if (pRemainChanCtx->action_pkt_buff.frame_ptr != NULL && pRemainChanCtx->action_pkt_buff.frame_length != 0) { @@ -764,10 +771,13 @@ static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy, return -EBUSY; } - /* When P2P-GO and if we are trying to unload the driver then - * wlan driver is keep on receiving the remain on channel command - * and which is resulting in crash. So not allowing any remain on - * channel requets when Load/Unload is in progress*/ + if (TRUE == pHddCtx->btCoexModeSet) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + FL("BTCoex Mode operation in progress")); + return -EBUSY; + } + if(hdd_isConnectionInProgress((hdd_context_t *)pAdapter->pHddCtx)) { hddLog( LOGE, @@ -777,6 +787,9 @@ static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy, mutex_lock(&pHddCtx->roc_lock); + if (cfgState->remain_on_chan_ctx) + VOS_BUG(0); + pRemainChanCtx = vos_mem_malloc( sizeof(hdd_remain_on_chan_ctx_t) ); if( NULL == pRemainChanCtx ) { diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c index 3ab228d32147..d181ed768449 100644 --- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c +++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c @@ -3764,6 +3764,70 @@ static int iw_get_linkspeed_priv(struct net_device *dev, return ret; } +/* + * Support for the RSSI & RSSI-APPROX private commands + * Per the WiFi framework the response must be of the form + * " rssi " + * unless we are not associated, in which case the response is + * "OK" + */ +static int iw_get_rssi(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + char *cmd = extra; + int len = wrqu->data.length; + v_S7_t s7Rssi = 0; + hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); + int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; + VOS_STATUS vosStatus; + int rc; + + if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || + (0 == ssidlen) || (ssidlen >= len)) + { + /* we are not connected or our SSID is too long + so we cannot report an rssi */ + rc = scnprintf(cmd, len, "OK"); + } + else + { + /* we are connected with a valid SSID + so we can write the SSID into the return buffer + (note that it is not NUL-terminated) */ + memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen ); + + wlan_hdd_get_station_stats(pAdapter); + vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi); + + if (VOS_STATUS_SUCCESS == vosStatus) + { + /* append the rssi to the ssid in the format required by + the WiFI Framework */ + rc = scnprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi); + rc += ssidlen; + } + else + { + rc = -1; + } + } + + /* verify that we wrote a valid response */ + if ((rc < 0) || (rc >= len)) + { + // encoding or length error? + hddLog(VOS_TRACE_LEVEL_ERROR, + "%s: Unable to encode RSSI, got [%s]", + __func__, cmd); + return -EIO; + } + + /* a value is being successfully returned */ + return rc; +} + /* * Support for SoftAP channel range private command */ @@ -4199,6 +4263,333 @@ void* wlan_hdd_change_country_code_callback(void *pAdapter) return NULL; } +static int __iw_set_priv(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + hdd_adapter_t *pAdapter; + char *cmd = NULL; + int cmd_len = wrqu->data.length; + int rc = 0, ret = 0; + VOS_STATUS vos_status = VOS_STATUS_SUCCESS; + + hdd_context_t *pHddCtx; + + ENTER(); + + pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + if (NULL == pAdapter) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "mem_alloc_copy_from_user_helper fail"); + return -EINVAL; + } + pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + rc = wlan_hdd_validate_context(pHddCtx); + if (0 != rc) + { + return rc; + } + + cmd = mem_alloc_copy_from_user_helper(wrqu->data.pointer, + wrqu->data.length); + if (NULL == cmd) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "mem_alloc_copy_from_user_helper fail"); + return -ENOMEM; + } + + if (ioctl_debug) + { + pr_info("%s: req [%s] len [%d]\n", __func__, cmd, cmd_len); + } + + hddLog(VOS_TRACE_LEVEL_INFO_MED, + "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd); + + if (strncmp(cmd, "CSCAN", 5) == 0 ) + { + if (eHAL_STATUS_SUCCESS != iw_set_cscan(dev, info, wrqu, cmd)) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: Error in iw_set_scan!", __func__); + rc = -EINVAL; + } + } + else if( strcasecmp(cmd, "start") == 0 ) { + + hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command"); + /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/ + + vos_status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter); + if (vos_status == VOS_STATUS_SUCCESS) + { + union iwreq_data wrqu; + char buf[10]; + + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = strlcpy(buf, "START", sizeof(buf)); + wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); + } + else + { + hddLog(VOS_TRACE_LEVEL_ERROR, "%s: START CMD Status %d", __func__, vos_status); + rc = -EIO; + } + goto done; + } + else if( strcasecmp(cmd, "stop") == 0 ) + { + union iwreq_data wrqu; + char buf[10]; + + hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command"); + + wlan_hdd_enter_lowpower(pHddCtx); + memset(&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf)); + wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); + goto done; + } + else if (strcasecmp(cmd, "macaddr") == 0) + { + ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes)); + } + else if (strcasecmp(cmd, "scan-active") == 0) + { + hddLog(LOG1, + FL("making default scan to active")); + pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; + ret = snprintf(cmd, cmd_len, "OK"); + } + else if (strcasecmp(cmd, "scan-passive") == 0) + { + hddLog(LOG1, + FL("making default scan to passive")); + pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN; + ret = snprintf(cmd, cmd_len, "OK"); + } + else if( strcasecmp(cmd, "scan-mode") == 0 ) + { + ret = snprintf(cmd, cmd_len, "ScanMode = %u", pHddCtx->scan_info.scan_mode); + } + else if( strcasecmp(cmd, "linkspeed") == 0 ) + { + ret = iw_get_linkspeed(dev, info, wrqu, cmd); + } + else if( strncasecmp(cmd, "rssi", 4) == 0 ) + { + ret = iw_get_rssi(dev, info, wrqu, cmd); + } + else if( strncasecmp(cmd, "powermode", 9) == 0 ) { + int mode; + char *ptr; + + if (9 < cmd_len) + { + ptr = (char*)(cmd + 9); + + }else{ + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "CMD LENGTH %d is not correct",cmd_len); + kfree(cmd); + return -EINVAL; + } + + if (1 != sscanf(ptr,"%d",&mode)) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "powermode input %s is not correct",ptr); + kfree(cmd); + return -EIO; + } + + wlan_hdd_enter_bmps(pAdapter, mode); + /*TODO:Set the power mode*/ + } + else if (strncasecmp(cmd, "getpower", 8) == 0 ) { + v_U32_t pmc_state; + v_U16_t value; + + pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter)); + if(pmc_state == BMPS) { + value = DRIVER_POWER_MODE_AUTO; + } + else { + value = DRIVER_POWER_MODE_ACTIVE; + } + ret = snprintf(cmd, cmd_len, "powermode = %u", value); + } + else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) { + hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode"); + /*TODO: set the btcoexmode*/ + } + else if( strcasecmp(cmd, "btcoexstat") == 0 ) { + + hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status"); + /*TODO: Return the btcoex status*/ + } + else if( strcasecmp(cmd, "rxfilter-start") == 0 ) { + + hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command"); + + /*TODO: Enable Rx data Filter*/ + } + else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) { + + hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command"); + + /*TODO: Disable Rx data Filter*/ + } + else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) { + + hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command"); + /*TODO: rxfilter-statistics*/ + } + else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) { + + hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add"); + /*TODO: rxfilter-add*/ + } + else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) { + + hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove"); + /*TODO: rxfilter-remove*/ + } +#ifdef FEATURE_WLAN_SCAN_PNO + else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) { + hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup"); + /*TODO: support pnosetup*/ + } + else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) { + hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce"); + /*TODO: support pnoforce*/ + } + else if( strncasecmp(cmd, "pno",3) == 0 ) { + + hddLog( VOS_TRACE_LEVEL_INFO, "pno"); + vos_status = iw_set_pno(dev, info, wrqu, cmd, 3); + kfree(cmd); + return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; + } + else if( strncasecmp(cmd, "rssifilter",10) == 0 ) { + hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter"); + vos_status = iw_set_rssi_filter(dev, info, wrqu, cmd, 10); + kfree(cmd); + return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; + } +#endif /*FEATURE_WLAN_SCAN_PNO*/ + else if( strncasecmp(cmd, "powerparams",11) == 0 ) { + hddLog( VOS_TRACE_LEVEL_INFO, "powerparams"); + vos_status = iw_set_power_params(dev, info, wrqu, cmd, 11); + kfree(cmd); + return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; + } + else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) { + tSirTxPerTrackingParam tTxPerTrackingParam; + char *ptr; + + if (18 < cmd_len) + { + ptr = (char*)(cmd + 18); + }else{ + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "CMD LENGTH %d is not correct",cmd_len); + kfree(cmd); + return -EINVAL; + } + + if (4 != sscanf(ptr,"%hhu %hhu %hhu %u", + &(tTxPerTrackingParam.ucTxPerTrackingEnable), + &(tTxPerTrackingParam.ucTxPerTrackingPeriod), + &(tTxPerTrackingParam.ucTxPerTrackingRatio), + &(tTxPerTrackingParam.uTxPerTrackingWatermark))) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "CONFIG-TX-TRACKING %s input is not correct",ptr); + kfree(cmd); + return -EIO; + } + + // parameters checking + // period has to be larger than 0 + if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct"); + kfree(cmd); + return -EIO; + } + + // use default value 5 is the input is not reasonable. in unit of 10% + if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio)) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5"); + tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO; + } + + // default is 5 + if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark) + { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5"); + tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK; + } + + if (eHAL_STATUS_SUCCESS != + sme_SetTxPerTracking(pHddCtx->hHal, + hdd_tx_per_hit_cb, + (void*)pAdapter, &tTxPerTrackingParam)) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!"); + rc = -EIO; + } + } + else { + hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s", + __func__, cmd); + } +done: + /* many of the commands write information back into the command + string using snprintf(). check the return value here in one + place */ + if ((ret < 0) || (ret >= cmd_len)) + { + /* there was an encoding error or overflow */ + rc = -EINVAL; + } + else if (ret > 0) + { + if (copy_to_user(wrqu->data.pointer, cmd, ret)) + { + hddLog(VOS_TRACE_LEVEL_ERROR, + "%s: failed to copy data to user buffer", __func__); + kfree(cmd); + return -EFAULT; + } + wrqu->data.length = ret; + } + + if (ioctl_debug) + { + pr_info("%s: rsp [%s] len [%d] status %d\n", + __func__, cmd, wrqu->data.length, rc); + } + kfree(cmd); + EXIT(); + return rc; +} + +static int iw_set_priv(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + int ret; + vos_ssr_protect(__func__); + ret = __iw_set_priv(dev, info, wrqu, extra); + vos_ssr_unprotect(__func__); + + return ret; +} + static int __iw_set_nick(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -10380,7 +10771,7 @@ static const iw_handler we_handler[] = (iw_handler) NULL, /* SIOCGIWSENS */ (iw_handler) NULL, /* SIOCSIWRANGE */ (iw_handler) iw_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ + (iw_handler) iw_set_priv, /* SIOCSIWPRIV */ (iw_handler) NULL, /* SIOCGIWPRIV */ (iw_handler) NULL, /* SIOCSIWSTATS */ (iw_handler) NULL, /* SIOCGIWSTATS */ diff --git a/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h b/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h index c6c13e30a5fe..b885a07c01ea 100644 --- a/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h +++ b/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h @@ -44,8 +44,8 @@ BRIEF DESCRIPTION: #define QWLAN_VERSION_PATCH 11 #define QWLAN_VERSION_EXTRA "" -#define QWLAN_VERSION_BUILD 49 +#define QWLAN_VERSION_BUILD 61 -#define QWLAN_VERSIONSTR "3.0.11.49" +#define QWLAN_VERSIONSTR "3.0.11.61" #endif /* QWLAN_VERSION_H */ diff --git a/drivers/staging/prima/CORE/MAC/inc/sirApi.h b/drivers/staging/prima/CORE/MAC/inc/sirApi.h index 8994dc3a925e..08f6c2253d7d 100644 --- a/drivers/staging/prima/CORE/MAC/inc/sirApi.h +++ b/drivers/staging/prima/CORE/MAC/inc/sirApi.h @@ -857,8 +857,8 @@ typedef struct sSirSmeScanReq * Values of 0xC0, 0x80 & 0x40 are to be used by * Roaming/application when 11d is enabled. */ - tANI_U32 minChannelTimeBtc; //in units of milliseconds - tANI_U32 maxChannelTimeBtc; //in units of milliseconds + tANI_U32 min_chntime_btc_esco; //in units of milliseconds + tANI_U32 max_chntime_btc_esco; //in units of milliseconds tANI_U8 returnAfterFirstMatch; /** @@ -3977,7 +3977,7 @@ typedef struct #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD #define SIR_PER_ROAM_MAX_AP_CNT 20 -#define SIR_PER_ROAM_MAX_CANDIDATE_CNT 10 +#define SIR_PER_ROAM_MAX_CANDIDATE_CNT 32 typedef struct __attribute__((packed)) { tANI_U8 channelNumber; @@ -4072,6 +4072,7 @@ typedef struct sSirPERRoamOffloadScanReq tANI_U32 waitPeriodForNextPERScan; tANI_U32 PERtimerThreshold; tANI_U32 PERroamTriggerPercent; + tANI_S16 PERRoamFullScanThreshold; } tSirPERRoamOffloadScanReq, *tpSirPERRoamOffloadScanReq; typedef struct sSirPERRoamTriggerScanReq diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h index 449697b30405..1ed099653c67 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h +++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -282,8 +282,8 @@ typedef struct sLimMlmScanReq tSirScanType scanType; tANI_U32 minChannelTime; tANI_U32 maxChannelTime; - tANI_U32 minChannelTimeBtc; - tANI_U32 maxChannelTimeBtc; + tANI_U32 min_chntime_btc_esco; + tANI_U32 max_chntime_btc_esco; tSirBackgroundScanMode backgroundScanMode; tANI_U32 dot11mode; /* Number of SSIDs to scan(send Probe request) */ diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h b/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h index dbe206aae563..da3f0e3c5af3 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h +++ b/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -93,7 +93,8 @@ void schSetBeaconInterval(tpAniSirGlobal pMac,tpPESession psessionEntry); tSirRetStatus schSendBeaconReq( tpAniSirGlobal, tANI_U8 *, tANI_U16, tpPESession psessionEntry ); -void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal,tDot11fBeacon1*,tANI_U32*,tDot11fProbeResponse*); +tSirRetStatus limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal, + tDot11fBeacon1*, tpPESession psessionEntry); void limUpdateProbeRspTemplateIeBitmapBeacon2(tpAniSirGlobal,tDot11fBeacon2*,tANI_U32*,tDot11fProbeResponse*); void SetProbeRspIeBitmap(tANI_U32*,tANI_U32); tANI_U32 limSendProbeRspTemplateToHal(tpAniSirGlobal,tpPESession, diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c index 94aa90f827aa..6632497d652e 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -479,11 +479,19 @@ void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry) { if (!pMac->sys.gSysEnableLinkMonitorMode) return; + /* Ignore HB if channel switch is in progress */ + if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == + eLIM_11H_CHANSW_RUNNING) { + limLog(pMac, LOGE, + FL("Ignore Heartbeat failure as Channel switch is in progress")); + pMac->pmm.inMissedBeaconScenario = false; + return; + } /** * Beacon frame not received within heartbeat timeout. */ - PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure"));) + limLog(pMac, LOGW, FL("Heartbeat Failure")); pMac->lim.gLimHBfailureCntInLinkEstState++; /** diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c index d7cb4b1eff92..cb83c73df283 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c @@ -767,12 +767,15 @@ limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg) WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)); /* Max candidates allowed */ - if (candidateChanInfo->candidateCount > SIR_PER_ROAM_MAX_AP_CNT) + if (candidateChanInfo->candidateCount > + SIR_PER_ROAM_MAX_CANDIDATE_CNT) { limLog(pMac, LOGE, - FL("Got maximum candidates as %d setting default"), - candidateChanInfo->candidateCount); - candidateChanInfo->candidateCount = SIR_PER_ROAM_MAX_AP_CNT; + FL("Got maximum candidates as %d, setting count as %d"), + candidateChanInfo->candidateCount, + SIR_PER_ROAM_MAX_CANDIDATE_CNT); + candidateChanInfo->candidateCount = + SIR_PER_ROAM_MAX_CANDIDATE_CNT; } vos_mem_set(&pMac->candidateChannelInfo, diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c index 9227d6e9d499..9f7f4b871e2a 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c @@ -1532,8 +1532,10 @@ __limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime; } - pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc; - pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc; + pMlmScanReq->min_chntime_btc_esco = + pScanReq->min_chntime_btc_esco; + pMlmScanReq->max_chntime_btc_esco = + pScanReq->max_chntime_btc_esco; pMlmScanReq->dot11mode = pScanReq->dot11mode; pMlmScanReq->p2pSearch = pScanReq->p2pSearch; diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c index 3c7b02da9a38..618c71fc6583 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c @@ -1468,7 +1468,7 @@ limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession pses pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId; pSirSmeDisassocInd->transactionId = psessionEntry->transactionId; - pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason; + pSirSmeDisassocInd->statusCode = eSIR_SME_DEAUTH_STATUS; pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason; pSirSmeDisassocInd->assocId = pStaDs->assocId; diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c index 1e3d52239f07..023727137129 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1046,17 +1046,24 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if(pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime); - if (pMac->btc.btcScanCompromise) + if (pMac->btc.btc_scan_compromise_esco) { - if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc) + if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco) { - val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc); + val = SYS_MS_TO_TICKS( + pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco); limLog(pMac, LOG1, FL("Using BTC Min Active Scan time")); } else { limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set")); } + } else if (pMac->btc.btc_scan_compromise_sco && + pMac->roam.configParam.min_chntime_btc_sco) { + val = SYS_MS_TO_TICKS( + pMac->roam.configParam.min_chntime_btc_sco); + limLog(pMac, LOG1, + FL("Using BTC SCO Min Active Scan time %d"), val); } } else @@ -1091,17 +1098,24 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if(pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2; - if (pMac->btc.btcScanCompromise) + if (pMac->btc.btc_scan_compromise_esco) { - if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc) + if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco) { - val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)/2; + val = SYS_MS_TO_TICKS( + pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)/2; limLog(pMac, LOG1, FL("Using BTC Min Active Scan time")); } else { limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set")); } + } else if (pMac->btc.btc_scan_compromise_sco && + pMac->roam.configParam.min_chntime_btc_sco) { + val = SYS_MS_TO_TICKS( + pMac->roam.configParam.min_chntime_btc_sco / 2); + limLog(pMac, LOG1, + FL("Using BTC SCO Min Active Scan time %d"), val); } } /*If val is 0 it means min Channel timer is 0 so take the value from maxChannelTimer*/ @@ -1111,17 +1125,24 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if(pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime)/2; - if (pMac->btc.btcScanCompromise) + if (pMac->btc.btc_scan_compromise_esco) { - if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc) + if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco) { - val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc)/2; + val = SYS_MS_TO_TICKS( + pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)/2; limLog(pMac, LOG1, FL("Using BTC Max Active Scan time")); } else { limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set")); } + } else if (pMac->btc.btc_scan_compromise_sco && + pMac->roam.configParam.max_chntime_btc_sco) { + val = SYS_MS_TO_TICKS( + pMac->roam.configParam.max_chntime_btc_sco / 2); + limLog(pMac, LOG1, + FL("Using BTC SCO Max Active Scan time %d"), val); } } else @@ -1183,17 +1204,24 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if(pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime); - if (pMac->btc.btcScanCompromise) + if (pMac->btc.btc_scan_compromise_esco) { - if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc) + if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco) { - val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc); + val = SYS_MS_TO_TICKS( + pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco); limLog(pMac, LOG1, FL("Using BTC Max Active Scan time")); } else { limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set")); } + } else if (pMac->btc.btc_scan_compromise_sco && + pMac->roam.configParam.max_chntime_btc_sco) { + val = SYS_MS_TO_TICKS( + pMac->roam.configParam.max_chntime_btc_sco); + limLog(pMac, LOG1, + FL("Using BTC SCO Max Active Scan time %d"), val); } } else diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c index 827f4bb6c35f..f8c315a8cf09 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c @@ -2591,9 +2591,9 @@ void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac) tpPESession psessionEntry = NULL; tANI_U8 channel; // This is received and stored from channelSwitch Action frame - if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) - { - limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); + if ((psessionEntry = peFindSessionBySessionId(pMac, + pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) { + limLog(pMac, LOGW,FL("Session Does not exist for given sessionID")); return; } @@ -2602,6 +2602,13 @@ void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac) PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d", psessionEntry->limSystemRole);) return; } + if (psessionEntry->gLimSpecMgmt.dot11hChanSwState != + eLIM_11H_CHANSW_RUNNING) { + limLog(pMac, LOGW, + FL("Channel switch timer should not have been running in state %d"), + psessionEntry->gLimSpecMgmt.dot11hChanSwState); + return; + } channel = psessionEntry->gLimChannelSwitch.primaryChannel; /* @@ -2665,9 +2672,14 @@ void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac) * then we cannot switch the channel. Just disassociate from AP. * We will find a better AP !!! */ - limTearDownLinkWithAp(pMac, + if ((psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) && + (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&& + (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) { + limLog(pMac, LOGE, FL("Invalid channel!! Disconnect..")); + limTearDownLinkWithAp(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId, eSIR_MAC_UNSPEC_FAILURE_REASON); + } return; } limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false); diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c index 12ca74491528..0fc798995ae4 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c @@ -286,9 +286,15 @@ tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEn vos_mem_set(( tANI_U8* )&(psessionEntry->probeRespFrame), sizeof(psessionEntry->probeRespFrame), 0); - /* Can be efficiently updated whenever new IE added in Probe response in future */ - limUpdateProbeRspTemplateIeBitmapBeacon1(pMac,pBcn1,&psessionEntry->DefProbeRspIeBitmap[0], - &psessionEntry->probeRespFrame); + /* Can be efficiently updated whenever new IE added + * in Probe response in future + */ + if (limUpdateProbeRspTemplateIeBitmapBeacon1(pMac, pBcn1, + psessionEntry) != eSIR_SUCCESS) + { + schLog(pMac, LOGE, + FL("Failed to build ProbeRsp template")); + } } nStatus = dot11fPackBeacon1( pMac, pBcn1, ptr, @@ -506,11 +512,21 @@ tSirRetStatus schSetFixedBeaconFields(tpAniSirGlobal pMac,tpPESession psessionEn return eSIR_SUCCESS; } -void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac, +tSirRetStatus limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac, tDot11fBeacon1* beacon1, - tANI_U32* DefProbeRspIeBitmap, - tDot11fProbeResponse* prb_rsp) + tpPESession psessionEntry) { + tANI_U32* DefProbeRspIeBitmap; + tDot11fProbeResponse* prb_rsp; + + if (!psessionEntry) { + schLog(pMac, LOGE, FL("PESession is null!")); + return eSIR_FAILURE; + } + + DefProbeRspIeBitmap = &psessionEntry->DefProbeRspIeBitmap[0]; + prb_rsp = &psessionEntry->probeRespFrame; + prb_rsp->BeaconInterval = beacon1->BeaconInterval; vos_mem_copy((void *)&prb_rsp->Capabilities, (void *)&beacon1->Capabilities, sizeof(beacon1->Capabilities)); @@ -519,8 +535,10 @@ void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac, if(beacon1->SSID.present) { SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_SSID_EID); - /* populating it, because probe response has to go with SSID even in hidden case */ - PopulateDot11fSSID2( pMac, &prb_rsp->SSID ); + /* populating it, because probe response has to go with + * SSID even in hidden case + */ + PopulateDot11fSSID(pMac, &psessionEntry->ssId, &prb_rsp->SSID); } /* supported rates */ if(beacon1->SuppRates.present) @@ -540,6 +558,8 @@ void limUpdateProbeRspTemplateIeBitmapBeacon1(tpAniSirGlobal pMac, } /* IBSS params will not be present in the Beacons transmitted by AP */ + + return eSIR_SUCCESS; } void limUpdateProbeRspTemplateIeBitmapBeacon2(tpAniSirGlobal pMac, diff --git a/drivers/staging/prima/CORE/SME/inc/btcApi.h b/drivers/staging/prima/CORE/SME/inc/btcApi.h index bab11f42d9cf..c6da770b5fff 100644 --- a/drivers/staging/prima/CORE/SME/inc/btcApi.h +++ b/drivers/staging/prima/CORE/SME/inc/btcApi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -366,7 +366,10 @@ typedef struct sSmeBtcInfo v_BOOL_t fA2DPTrafStop;/*flag to check A2DP_STOP event has come before MODE_CHANGED*/ v_U16_t btcScoHandles[BT_MAX_SCO_SUPPORT]; /* Handles for SCO, if any*/ v_BOOL_t fA2DPUp; /*remember whether A2DP is in session*/ - v_BOOL_t btcScanCompromise; + /* Scan compromise due to eSCO */ + bool btc_scan_compromise_esco; + /* Scan compromise due to SCO */ + bool btc_scan_compromise_sco; v_U8_t btcBssfordisableaggr[VOS_MAC_ADDRESS_LEN]; vos_timer_t enableUapsdTimer; } tSmeBtcInfo, *tpSmeBtcInfo; diff --git a/drivers/staging/prima/CORE/SME/inc/csrApi.h b/drivers/staging/prima/CORE/SME/inc/csrApi.h index 292aada14d00..ef7f97d3dd37 100644 --- a/drivers/staging/prima/CORE/SME/inc/csrApi.h +++ b/drivers/staging/prima/CORE/SME/inc/csrApi.h @@ -291,8 +291,8 @@ typedef struct tagCsrScanRequest tCsrChannelInfo ChannelInfo; tANI_U32 minChnTime; //in units of milliseconds tANI_U32 maxChnTime; //in units of milliseconds - tANI_U32 minChnTimeBtc; //in units of milliseconds - tANI_U32 maxChnTimeBtc; //in units of milliseconds + tANI_U32 min_chntime_btc_esco; //in units of milliseconds + tANI_U32 max_chntime_btc_esco; //in units of milliseconds tANI_U32 restTime; //in units of milliseconds //ignored when not connected tANI_U32 uIEFieldLen; tANI_U8 *pIEField; @@ -309,8 +309,8 @@ typedef struct tagCsrBGScanRequest tANI_U32 scanInterval; //in units of milliseconds tANI_U32 minChnTime; //in units of milliseconds tANI_U32 maxChnTime; //in units of milliseconds - tANI_U32 minChnTimeBtc; //in units of milliseconds - tANI_U32 maxChnTimeBtc; //in units of milliseconds + tANI_U32 min_chntime_btc_esco; //in units of milliseconds + tANI_U32 max_chntime_btc_esco; //in units of milliseconds tANI_U32 restTime; //in units of milliseconds //ignored when not connected tANI_U32 throughputImpact; //specify whether BG scan cares about impacting throughput //ignored when not connected tCsrBssid bssid; //how to use it?? Apple @@ -1097,8 +1097,10 @@ typedef struct tagCsrConfigParam tANI_U32 nInitialDwellTime; //in units of milliseconds - tANI_U32 nActiveMinChnTimeBtc; //in units of milliseconds - tANI_U32 nActiveMaxChnTimeBtc; //in units of milliseconds + uint32_t min_chntime_btc_esco; //in units of milliseconds + uint32_t max_chntime_btc_esco; //in units of milliseconds + uint32_t min_chntime_btc_sco; + uint32_t max_chntime_btc_sco; tANI_U32 disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY tANI_U32 nPassiveMinChnTimeConc; //in units of milliseconds @@ -1188,6 +1190,7 @@ typedef struct tagCsrConfigParam tANI_BOOLEAN bFastRoamInConIniFeatureEnabled; v_BOOL_t isPERRoamEnabled; v_BOOL_t isPERRoamCCAEnabled; + v_S15_t PERRoamFullScanThreshold; v_U32_t rateUpThreshold; v_U32_t rateDownThreshold; v_U32_t waitPeriodForNextPERScan; diff --git a/drivers/staging/prima/CORE/SME/inc/csrInternal.h b/drivers/staging/prima/CORE/SME/inc/csrInternal.h index cb13a47862bf..318c25517c25 100644 --- a/drivers/staging/prima/CORE/SME/inc/csrInternal.h +++ b/drivers/staging/prima/CORE/SME/inc/csrInternal.h @@ -400,7 +400,6 @@ typedef struct tagScanCmd csrScanCompleteCallback callback; void *pContext; eCsrScanReason reason; - eCsrRoamState lastRoamState[CSR_ROAM_SESSION_MAX]; tCsrRoamProfile *pToRoamProfile; tANI_U32 roamId; //this is the ID related to the pToRoamProfile union @@ -588,8 +587,10 @@ typedef struct tagCsrConfig tANI_U32 nInitialDwellTime; //in units of milliseconds - tANI_U32 nActiveMinChnTimeBtc; //in units of milliseconds - tANI_U32 nActiveMaxChnTimeBtc; //in units of milliseconds + uint32_t min_chntime_btc_esco; //in units of milliseconds + uint32_t max_chntime_btc_esco; //in units of milliseconds + uint32_t min_chntime_btc_sco; + uint32_t max_chntime_btc_sco; tANI_U8 disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY tANI_U32 nPassiveMinChnTimeConc; //in units of milliseconds @@ -625,6 +626,7 @@ typedef struct tagCsrConfig tANI_BOOLEAN bFastRoamInConIniFeatureEnabled; v_BOOL_t isPERRoamEnabled; v_BOOL_t isPERRoamCCAEnabled; + v_S15_t PERRoamFullScanThreshold; tANI_U32 rateUpThreshold; tANI_U32 rateDownThreshold; tANI_U32 waitPeriodForNextPERScan; @@ -1006,6 +1008,7 @@ typedef struct tagCsrRoamStruct tCsrChannel base40MHzChannels; //center channels for 40MHz channels eCsrRoamState curState[CSR_ROAM_SESSION_MAX]; eCsrRoamSubState curSubState[CSR_ROAM_SESSION_MAX]; + eCsrRoamState prev_state[CSR_ROAM_SESSION_MAX]; //This may or may not have the up-to-date valid channel list //It is used to get WNI_CFG_VALID_CHANNEL_LIST and not allocate memory all the time tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; diff --git a/drivers/staging/prima/CORE/SME/inc/pmc.h b/drivers/staging/prima/CORE/SME/inc/pmc.h index 5c75647ecac8..e6ffe81d06a2 100644 --- a/drivers/staging/prima/CORE/SME/inc/pmc.h +++ b/drivers/staging/prima/CORE/SME/inc/pmc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -146,6 +146,8 @@ typedef struct sPmcInfo tANI_BOOLEAN bmpsRequestQueued; /*If a enter BMPS request is queued*/ tANI_BOOLEAN smpsEnabled; /* TRUE if SMPS is enabled */ tANI_BOOLEAN remainInPowerActiveTillDHCP; /* Remain in Power active till DHCP completes */ + /* Remain in Power active till set key is done */ + bool full_power_till_set_key; tANI_U32 remainInPowerActiveThreshold; /*Remain in Power active till DHCP threshold*/ tANI_U32 impsPeriod; /* amount of time to remain in IMPS */ void (*impsCallbackRoutine) (void *callbackContext, eHalStatus status); /* routine to call when IMPS period diff --git a/drivers/staging/prima/CORE/SME/src/btc/btcApi.c b/drivers/staging/prima/CORE/SME/src/btc/btcApi.c index 4e1e9ea34a83..cc529179c78d 100644 --- a/drivers/staging/prima/CORE/SME/src/btc/btcApi.c +++ b/drivers/staging/prima/CORE/SME/src/btc/btcApi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -96,7 +96,8 @@ VOS_STATUS btcOpen (tHalHandle hHal) pMac->btc.btcReady = VOS_FALSE; pMac->btc.btcEventState = 0; pMac->btc.btcHBActive = VOS_TRUE; - pMac->btc.btcScanCompromise = VOS_FALSE; + pMac->btc.btc_scan_compromise_esco = false; + pMac->btc.btc_scan_compromise_sco = false; for (i = 0; i < MWS_COEX_MAX_VICTIM_TABLE; i++) { @@ -1988,13 +1989,21 @@ eHalStatus btcHandleCoexInd(tHalHandle hHal, void* pMsg) } else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_COMPROMISED) { - pMac->btc.btcScanCompromise = VOS_TRUE; - smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_COMPROMISED", - __func__); + smsLog(pMac, LOGW, + FL("Coex indication SIR_COEX_IND_TYPE_SCAN_COMPROMISED data[0] %d"), + pSmeCoexInd->coexIndData[0]); + + /* coexIndData[0] will be 1 for SCO call and 0 for eSCO call */ + if (pSmeCoexInd->coexIndData[0]) + pMac->btc.btc_scan_compromise_sco = true; + else + pMac->btc.btc_scan_compromise_esco = true; + } else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED) { - pMac->btc.btcScanCompromise = VOS_FALSE; + pMac->btc.btc_scan_compromise_esco = false; + pMac->btc.btc_scan_compromise_sco = false; smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED", __func__); } diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c index f3fe802a710d..6b36c8a73fdd 100644 --- a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c +++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c @@ -1230,8 +1230,14 @@ static void initConfigParam(tpAniSirGlobal pMac) pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; - pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; - pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; + pMac->roam.configParam.max_chntime_btc_esco = + CSR_ACTIVE_MAX_CHANNEL_TIME_ESCO_BTC; + pMac->roam.configParam.min_chntime_btc_esco = + CSR_ACTIVE_MIN_CHANNEL_TIME_ESCO_BTC; + pMac->roam.configParam.min_chntime_btc_sco = + CSR_ACTIVE_MIN_CHANNEL_TIME_SCO_BTC; + pMac->roam.configParam.max_chntime_btc_sco= + CSR_ACTIVE_MAX_CHANNEL_TIME_SCO_BTC; pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; #ifdef WLAN_AP_STA_CONCURRENCY pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; @@ -1799,14 +1805,22 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa cfgSetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL, pParam->nOBSSScanWidthTriggerInterval); } - if (pParam->nActiveMaxChnTimeBtc) + if (pParam->max_chntime_btc_esco) { - pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; + pMac->roam.configParam.max_chntime_btc_esco = + pParam->max_chntime_btc_esco; } - if (pParam->nActiveMinChnTimeBtc) + if (pParam->min_chntime_btc_esco) { - pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; + pMac->roam.configParam.min_chntime_btc_esco = + pParam->min_chntime_btc_esco; } + if (pParam->min_chntime_btc_sco) + pMac->roam.configParam.min_chntime_btc_sco = + pParam->min_chntime_btc_sco; + if (pParam->max_chntime_btc_sco) + pMac->roam.configParam.max_chntime_btc_sco = + pParam->max_chntime_btc_sco; #ifdef WLAN_AP_STA_CONCURRENCY if (pParam->nActiveMaxChnTimeConc) { @@ -1947,6 +1961,8 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa pMac->roam.configParam.PERtimerThreshold = pParam->PERtimerThreshold; pMac->roam.configParam.isPERRoamCCAEnabled = pParam->isPERRoamCCAEnabled; + pMac->roam.configParam.PERRoamFullScanThreshold = + pParam->PERRoamFullScanThreshold; pMac->roam.configParam.PERroamTriggerPercent = pParam->PERroamTriggerPercent; #endif @@ -2081,8 +2097,14 @@ eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; - pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pParam->max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pParam->min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; + pParam->min_chntime_btc_sco = + pMac->roam.configParam.min_chntime_btc_sco; + pParam->max_chntime_btc_sco = + pMac->roam.configParam.max_chntime_btc_sco; pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; @@ -2165,6 +2187,8 @@ eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->PERtimerThreshold = pMac->roam.configParam.PERtimerThreshold; pParam->isPERRoamCCAEnabled = pMac->roam.configParam.isPERRoamCCAEnabled; + pParam->PERRoamFullScanThreshold = + pMac->roam.configParam.PERRoamFullScanThreshold; pParam->PERroamTriggerPercent = pMac->roam.configParam.PERroamTriggerPercent; #endif @@ -5614,11 +5638,11 @@ static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pComman */ //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); - /* Reset remainInPowerActiveTillDHCP as it might have been set + /* Reset full_power_till_set_key as it might have been set * by last failed secured connection. * It should be set only for secured connection. */ - pMac->pmc.remainInPowerActiveTillDHCP = FALSE; + pMac->pmc.full_power_till_set_key = false; if( CSR_IS_INFRASTRUCTURE( pProfile ) ) { pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; @@ -5873,15 +5897,14 @@ static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pComman //enough to let security and DHCP handshake succeed before entry into BMPS if (pmcShouldBmpsTimerRun(pMac)) { - /* Set remainInPowerActiveTillDHCP to make sure we wait for + /* Set full_power_till_set_key to make sure we wait for * until keys are set before going into BMPS. */ if(eANI_BOOLEAN_TRUE == roamInfo.fAuthRequired) { - pMac->pmc.remainInPowerActiveTillDHCP = TRUE; - smsLog(pMac, LOG1, FL("Set remainInPowerActiveTillDHCP " - "to make sure we wait until keys are set before" - " going to BMPS")); + pMac->pmc.full_power_till_set_key = true; + smsLog(pMac, LOG1, + FL("Set full_power_till_set_key to make sure we wait until keys are set before going to BMPS")); } if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) @@ -8314,7 +8337,7 @@ static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSm tCsrRoamInfo roamInfo; tANI_U32 roamId = 0; tANI_U32 current_timestamp, max_time = -1; - tANI_U32 candidateApCnt, oldestIndex; + tANI_U32 candidateApCnt, oldestIndex = 0; tANI_U8 nilMac[6] = {0}; if (eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode) @@ -10096,6 +10119,13 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) &roamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_DISASSOC_IND); + pSession = CSR_GET_SESSION(pMac, + pDisConDoneInd->sessionId); + if (pSession && + !CSR_IS_INFRA_AP(&pSession->connectedProfile)) + csrRoamStateChange(pMac, + eCSR_ROAMING_STATE_IDLE, + pDisConDoneInd->sessionId); } else { @@ -10587,9 +10617,8 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) } if( pRsp->peerMacAddr[0] & 0x01 ) { - pMac->pmc.remainInPowerActiveTillDHCP = FALSE; - smsLog(pMac, LOG1, FL("Reset" - "remainInPowerActiveTillDHCP to allow BMPS")); + pMac->pmc.full_power_till_set_key = false; + smsLog(pMac, LOG1, FL("Reset full_power_till_set_key to allow BMPS")); } setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); @@ -16643,8 +16672,8 @@ csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, || V | RSO_START | RSO_STOP | RSO_RESTART | RSO_UPDATE_CFG || || --------------------------------------------------------------------------|| || RSO_START | NO | YES | NO | NO || -|| RSO_STOP | YES | YES | YES | YES || -|| RSO_RESTART | YES | NO | NO | YES || +|| RSO_STOP | YES | NO | YES | YES || +|| RSO_RESTART | YES | NO | YES | YES || || RSO_UPDATE_CFG | YES | NO | YES | YES || ||===========================================================================|| */ @@ -16656,9 +16685,10 @@ csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, #define RSO_START_ALLOW_MASK ( RSO_STOP_BIT ) #define RSO_STOP_ALLOW_MASK ( RSO_UPDATE_CFG_BIT | RSO_RESTART_BIT | \ - RSO_STOP_BIT | RSO_START_BIT ) -#define RSO_RESTART_ALLOW_MASK ( RSO_UPDATE_CFG_BIT | RSO_START_BIT ) -#define RSO_UPDATE_CFG_ALLOW_MASK (RSO_UPDATE_CFG_BIT | RSO_STOP_BIT | \ + RSO_START_BIT ) +#define RSO_RESTART_ALLOW_MASK ( RSO_UPDATE_CFG_BIT | RSO_START_BIT | \ + RSO_RESTART_BIT ) +#define RSO_UPDATE_CFG_ALLOW_MASK (RSO_UPDATE_CFG_BIT | RSO_RESTART_BIT | \ RSO_START_BIT) tANI_BOOLEAN CsrIsRSOCommandAllowed(tpAniSirGlobal pMac, tANI_U8 command) @@ -17202,6 +17232,8 @@ eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reas pMac->roam.configParam.PERtimerThreshold; PERRoamReqBuf->isPERRoamCCAEnabled = pMac->roam.configParam.isPERRoamCCAEnabled; + PERRoamReqBuf->PERRoamFullScanThreshold = + pMac->roam.configParam.PERRoamFullScanThreshold; PERRoamReqBuf->PERroamTriggerPercent = pMac->roam.configParam.PERroamTriggerPercent; PERRoamReqBuf->sessionId = sessionId; diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c index 2aa3af518aab..7ae5f941580c 100644 --- a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c +++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c @@ -310,8 +310,10 @@ static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTimeConc; pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTimeConc; } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pScanRequest->max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pScanRequest->min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc; @@ -336,8 +338,10 @@ static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime; } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pScanRequest->max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pScanRequest->min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; #ifdef WLAN_AP_STA_CONCURRENCY //No rest time if no sessions are connected. @@ -724,8 +728,10 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, pScanRequest->minChnTime); } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pScanRequest->max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pScanRequest->min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; //Need to make the following atomic pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around @@ -791,8 +797,10 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + scanReq.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + scanReq.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; } if (pMac->roam.configParam.nInitialDwellTime) { @@ -913,8 +921,8 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, pTempScanReq->p2pSearch, pTempScanReq->minChnTime, pTempScanReq->maxChnTime, - pTempScanReq->minChnTimeBtc, - pTempScanReq->maxChnTimeBtc ); + pTempScanReq->min_chntime_btc_esco, + pTempScanReq->max_chntime_btc_esco); //Start process the command #ifdef WLAN_AP_STA_CONCURRENCY if (!pMac->fScanOffload) @@ -1061,8 +1069,10 @@ eHalStatus csrScanAllChannels(tpAniSirGlobal pMac, eCsrRequestType reqType) scanReq.requestType = reqType; scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + scanReq.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + scanReq.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; //Scan with invalid sessionId. //This results in SME using the first available session to scan. status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, @@ -1349,8 +1359,10 @@ eHalStatus csrScanRequestLostLink1( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; if(pSession->connectedProfile.SSID.length) { @@ -1526,8 +1538,10 @@ eHalStatus csrScanRequestLostLink2( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; if(pSession->pCurRoamProfile) { @@ -1640,8 +1654,10 @@ eHalStatus csrScanRequestLostLink3( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; + pCommand->u.scanCmd.u.scanRequest.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pCommand->u.scanCmd.u.scanRequest.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; vos_mem_copy(&pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid)); //Put to the head of pending queue @@ -2086,7 +2102,7 @@ static tANI_U32 calculateBssScore(tSirBssDescription *bssInfo, tANI_S32 score = 0; tANI_S32 ap_load = 0; tANI_S32 normalised_width = PER_ROAM_20MHZ; - tANI_S32 normalised_rssi; + tANI_S32 normalised_rssi = 0; tANI_S32 channel_weight; if (bssInfo->rssi) { /* Calculate % of rssi we are getting @@ -2147,7 +2163,6 @@ static tANI_U32 calculateBssScore(tSirBssDescription *bssInfo, ap_load = (bssInfo->QBSS_ChanLoad * PER_ROAM_MAX_WEIGHT) / MAX_AP_LOAD; } #endif - //TODO we don't have this info for current AP, need to check /* if CCA consideration is off in configuration, FW will send 50% for every channel which should be considered as it is */ if (ap_load) @@ -2193,6 +2208,13 @@ static tANI_S32 csrFindCongestionScore (tpAniSirGlobal pMac, tCsrScanResult *pBs return -1; } + if (bssInfo->rssi < PER_BAD_RSSI) { + smsLog(pMac, LOG1, + FL("discrarding candidate due to low rssi=%d bssid " + MAC_ADDRESS_STR), bssInfo->rssi, + MAC_ADDR_ARRAY(pBss->Result.BssDescriptor.bssId)); + return 0; + } /* find best RSSI of other AP in this channel */ best_rssi = MIN_RSSI; for (other_ap_cnt = 0; other_ap_cnt < @@ -3150,6 +3172,7 @@ eHalStatus csrScanningStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) eHalStatus status = eHAL_STATUS_SUCCESS; tSirMbMsg *pMsg = (tSirMbMsg *)pMsgBuf; tSirSmeDisConDoneInd *pDisConDoneInd; + tCsrRoamSession *pSession; tCsrRoamInfo roamInfo = {0}; if((eWNI_SME_SCAN_RSP == pMsg->type) || @@ -3163,7 +3186,6 @@ eHalStatus csrScanningStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) { case eWNI_SME_UPPER_LAYER_ASSOC_CNF: { - tCsrRoamSession *pSession; tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; tCsrRoamInfo *pRoamInfo = NULL; tANI_U32 sessionId; @@ -3242,6 +3264,20 @@ eHalStatus csrScanningStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) &roamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_DISASSOC_IND); + pSession = CSR_GET_SESSION(pMac, + pDisConDoneInd->sessionId); + /* + * Update the previous state if + * previous state was eCSR_ROAMING_STATE_JOINED + * as we are disconnected and + * currunt state is scanning + */ + if (pSession && + !CSR_IS_INFRA_AP(&pSession->connectedProfile) + && (eCSR_ROAMING_STATE_IDLE != + pMac->roam.prev_state[pDisConDoneInd->sessionId])) + pMac->roam.prev_state[pDisConDoneInd->sessionId] = + eCSR_ROAMING_STATE_IDLE; } else { @@ -3571,6 +3607,7 @@ static void csrMoveTempScanResultsToMainList( tpAniSirGlobal pMac, tANI_U8 reaso tANI_U32 sessionId = CSR_SESSION_ID_INVALID; tAniSSID tmpSsid; v_TIME_t timer=0; + tANI_U8 occupied_chan_count = pMac->scan.occupiedChannels.numChannels; tmpSsid.length = 0; @@ -3659,6 +3696,19 @@ static void csrMoveTempScanResultsToMainList( tpAniSirGlobal pMac, tANI_U8 reaso } } +#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD + if (sme_IsFeatureSupportedByFW(PER_BASED_ROAMING) && + (csrGetInfraSessionId(pMac) != -1) && + (pMac->scan.occupiedChannels.numChannels != occupied_chan_count)) + { + /* Update FW with new list */ + smsLog(pMac, LOGW, + FL("Updating occupied channel list, new chanNum %d"), + pMac->scan.occupiedChannels.numChannels); + csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, + REASON_CHANNEL_LIST_CHANGED); + } +#endif pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_LOCK ); //we don't need to update CC while connected to an AP which is advertising CC already if (csrIs11dSupported(pMac)) @@ -6159,8 +6209,10 @@ eHalStatus csrSendMBScanReq( tpAniSirGlobal pMac, tANI_U16 sessionId, pMsg->minChannelTime = pal_cpu_to_be32(minChnTime); pMsg->maxChannelTime = pal_cpu_to_be32(maxChnTime); - pMsg->minChannelTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; - pMsg->maxChannelTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; + pMsg->min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; + pMsg->max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; //hidden SSID option pMsg->hiddenSsid = pScanReqParam->hiddenSsid; //rest time @@ -6422,21 +6474,21 @@ eHalStatus csrProcessScanCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) { for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) { - pCommand->u.scanCmd.lastRoamState[i] = + pMac->roam.prev_state[i]= csrRoamStateChange( pMac, eCSR_ROAMING_STATE_SCANNING, i); smsLog( pMac, LOG3, "starting SCAN command from %d state...." - " reason is %d", pCommand->u.scanCmd.lastRoamState[i], + " reason is %d", pMac->roam.prev_state[i], pCommand->u.scanCmd.reason ); } } else { - pCommand->u.scanCmd.lastRoamState[pCommand->sessionId] = + pMac->roam.prev_state[pCommand->sessionId] = csrRoamStateChange(pMac, eCSR_ROAMING_STATE_SCANNING, pCommand->sessionId); smsLog( pMac, LOG3, "starting SCAN command from %d state.... reason is %d", - pCommand->u.scanCmd.lastRoamState[pCommand->sessionId], + pMac->roam.prev_state[pCommand->sessionId], pCommand->u.scanCmd.reason ); } @@ -7669,12 +7721,13 @@ void csrReleaseScanCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatu { tANI_U32 i; for(i = 0; i < CSR_ROAM_SESSION_MAX; i++) - csrRoamStateChange(pMac, pCommand->u.scanCmd.lastRoamState[i], i); + csrRoamStateChange(pMac, + pMac->roam.prev_state[i], i); } else { csrRoamStateChange(pMac, - pCommand->u.scanCmd.lastRoamState[pCommand->sessionId], + pMac->roam.prev_state[pCommand->sessionId], pCommand->sessionId); } @@ -7948,10 +8001,10 @@ eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi pScanCmd->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; } - pScanCmd->u.scanCmd.u.scanRequest.maxChnTimeBtc = - pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanCmd->u.scanCmd.u.scanRequest.minChnTimeBtc = - pMac->roam.configParam.nActiveMinChnTimeBtc; + pScanCmd->u.scanCmd.u.scanRequest.max_chntime_btc_esco = + pMac->roam.configParam.max_chntime_btc_esco; + pScanCmd->u.scanCmd.u.scanRequest.min_chntime_btc_esco = + pMac->roam.configParam.min_chntime_btc_esco; if(pProfile->BSSIDs.numOfBSSIDs == 1) { vos_mem_copy(pScanCmd->u.scanCmd.u.scanRequest.bssid, diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h b/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h index f9a38bfba4fb..b297d3d45e58 100644 --- a/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h +++ b/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h @@ -48,8 +48,11 @@ #define CSR_ACTIVE_MAX_CHANNEL_TIME 40 #define CSR_ACTIVE_MIN_CHANNEL_TIME 20 -#define CSR_ACTIVE_MAX_CHANNEL_TIME_BTC 120 -#define CSR_ACTIVE_MIN_CHANNEL_TIME_BTC 60 +#define CSR_ACTIVE_MAX_CHANNEL_TIME_ESCO_BTC 120 +#define CSR_ACTIVE_MIN_CHANNEL_TIME_ESCO_BTC 60 + +#define CSR_ACTIVE_MIN_CHANNEL_TIME_SCO_BTC 20 +#define CSR_ACTIVE_MAX_CHANNEL_TIME_SCO_BTC 40 #ifdef WLAN_AP_STA_CONCURRENCY #define CSR_PASSIVE_MAX_CHANNEL_TIME_CONC 110 @@ -138,6 +141,7 @@ #define PER_EXCELENT_RSSI -40 #define PER_GOOD_RSSI -55 #define PER_POOR_RSSI -65 +#define PER_BAD_RSSI -80 #define PER_ROAM_EXCELLENT_RSSI_WEIGHT 100 #define PER_ROAM_GOOD_RSSI_WEIGHT 80 #define PER_ROAM_BAD_RSSI_WEIGHT 60 diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c b/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c index 14f67562c6cf..da1f2cf29c66 100644 --- a/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c +++ b/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c @@ -2216,15 +2216,10 @@ static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac) else { -#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD - if (pMac->PERroamCandidatesCnt == 0) -#endif - { - /* There is no candidate or We are not roaming Now. - * Inform the FW to restart Roam Offload Scan */ - csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, - REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW); - } + /* There is no candidate or We are not roaming Now. + * Inform the FW to restart Roam Offload Scan */ + csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, + REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW); } } CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); diff --git a/drivers/staging/prima/CORE/SME/src/pmc/pmc.c b/drivers/staging/prima/CORE/SME/src/pmc/pmc.c index 66474d7de438..f87339e92b2d 100644 --- a/drivers/staging/prima/CORE/SME/src/pmc/pmc.c +++ b/drivers/staging/prima/CORE/SME/src/pmc/pmc.c @@ -989,11 +989,12 @@ void pmcTrafficTimerExpired (tHalHandle hHal) return; } - /* Untill DHCP is not completed remain in power active */ - if(pMac->pmc.remainInPowerActiveTillDHCP) + /* Untill DHCP and set key is not completed remain in power active */ + if (pMac->pmc.remainInPowerActiveTillDHCP || pMac->pmc.full_power_till_set_key) { - pmcLog(pMac, LOG1, FL("BMPS Traffic Timer expired before DHCP" - " completion ignore enter BMPS")); + pmcLog(pMac, LOG1, + FL("BMPS Traffic Timer expired before DHCP (%d) or set key (%d) completion ignore enter BMPS"), + pMac->pmc.remainInPowerActiveTillDHCP, pMac->pmc.full_power_till_set_key); pMac->pmc.remainInPowerActiveThreshold++; if( pMac->pmc.remainInPowerActiveThreshold >= DHCP_REMAIN_POWER_ACTIVE_THRESHOLD) { @@ -1001,6 +1002,7 @@ void pmcTrafficTimerExpired (tHalHandle hHal) FL("Remain in power active DHCP threshold reached FALLBACK to enable enter BMPS")); /*FALLBACK: reset the flag to make BMPS entry possible*/ pMac->pmc.remainInPowerActiveTillDHCP = FALSE; + pMac->pmc.full_power_till_set_key = false; pMac->pmc.remainInPowerActiveThreshold = 0; } //Activate the Traffic Timer again for entering into BMPS @@ -2494,10 +2496,10 @@ tANI_BOOLEAN pmcShouldBmpsTimerRun( tpAniSirGlobal pMac ) return eANI_BOOLEAN_FALSE; } - if(pMac->pmc.isHostPsEn && pMac->pmc.remainInPowerActiveTillDHCP) + if (pMac->pmc.isHostPsEn && pMac->pmc.remainInPowerActiveTillDHCP) { pmcLog(pMac, LOG1, - FL("Host controlled ps enabled and host wants active mode, so dont allow BMPS")); + FL("Host controlled ps enabled, so don't run the timer")); return eANI_BOOLEAN_FALSE; } diff --git a/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c b/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c index 3d520c402cb1..406317df43f9 100644 --- a/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c +++ b/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -205,6 +205,7 @@ eHalStatus pmcStart (tHalHandle hHal) pMac->pmc.wowlExitSrc = eWOWL_EXIT_USER; pMac->pmc.bmpsRequestedByHdd = FALSE; pMac->pmc.remainInPowerActiveTillDHCP = FALSE; + pMac->pmc.full_power_till_set_key = false; pMac->pmc.remainInPowerActiveThreshold = 0; /* WLAN Switch initial states. */ diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c index fd2d9a8f6a89..7902ac7df434 100644 --- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c +++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c @@ -8973,7 +8973,7 @@ static void WLANTL_ClearOldPERStats(WLANTL_CbType *pTLCb, v_U8_t incrementCnt) static void WLANTL_updatePERStats(WLANTL_CbType *pTLCb, v_U8_t rateIndex) { - v_U8_t incrementCnt; + v_U8_t incrementCnt = 0; v_U64_t currentTime, timeDifference; /* diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c index 07964961cace..7563dc04ce9e 100644 --- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c +++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c @@ -8851,8 +8851,6 @@ VOS_STATUS WDA_ProcessAggrAddTSReq(tWDA_CbContext *pWDA, { VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, "Failure in ADD TS REQ Params WDI API, free all the memory " ); - vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ; - vos_mem_free(pWdaParams); /* send the failure response back to PE*/ for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ ) @@ -8862,6 +8860,10 @@ VOS_STATUS WDA_ProcessAggrAddTSReq(tWDA_CbContext *pWDA, WDA_SendMsg(pWdaParams->pWdaContext, WDA_AGGR_QOS_RSP, (void *)pAggrAddTsReqParams , 0) ; + + vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ; + vos_mem_free(pWdaParams); + } return CONVERT_WDI2VOS_STATUS(status) ; } @@ -13357,7 +13359,9 @@ VOS_STATUS WDA_HALDumpCmdReq(tpAniSirGlobal pMac, tANI_U32 cmd, VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: WDA_HALDUMP reporting other error",__func__); } - VOS_BUG(0); + if (!(vos_isLoadUnloadInProgress() || + vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL))) + VOS_BUG(0); } } return status; @@ -18142,6 +18146,8 @@ VOS_STATUS WDA_ProcessPERRoamScanOffloadReq(tWDA_CbContext *pWDA, pPERRoamOffloadScanReqParams->PERtimerThreshold; pwdiPERRoamOffloadScanInfo->isPERRoamCCAEnabled = pPERRoamOffloadScanReqParams->isPERRoamCCAEnabled; + pwdiPERRoamOffloadScanInfo->PERRoamFullScanThreshold = + pPERRoamOffloadScanReqParams->PERRoamFullScanThreshold; pwdiPERRoamOffloadScanInfo->PERroamTriggerPercent = pPERRoamOffloadScanReqParams->PERroamTriggerPercent; diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h index b44e3f75379e..6f0864d8af32 100644 --- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h +++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h @@ -5592,6 +5592,7 @@ typedef struct wpt_uint32 waitPeriodForNextPERScan; wpt_uint32 PERtimerThreshold; wpt_uint32 PERroamTriggerPercent; + wpt_int16 PERRoamFullScanThreshold; } WDI_PERRoamOffloadScanInfo; typedef struct diff --git a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c index 381006f7794e..46bd75813eab 100644 --- a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c +++ b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c @@ -27163,10 +27163,17 @@ WDI_ProcessPERRoamScanOffloadReq(WDI_ControlBlockType *pWDICtx, WDI_PERRoamOffloadScanCb wdiPERRoamOffloadScancb = NULL; tSetPerRoamConfigReq halPERRoamConfigReq; + if (!pEventData) { + WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, + "%s: *pEventdata is null", __func__); + WDI_ASSERT(0); + return WDI_STATUS_E_FAILURE; + } + wdiPERRoamOffloadReq = (WDI_PERRoamOffloadScanInfo *)pEventData->pEventData; wdiPERRoamOffloadScancb = (WDI_PERRoamOffloadScanCb)pEventData->pCBfnc; - if ((!pEventData) || (!wdiPERRoamOffloadReq)|| (!wdiPERRoamOffloadScancb)) { + if (!wdiPERRoamOffloadReq || !wdiPERRoamOffloadScancb) { WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, "%s: Invalid parameters", __func__); WDI_ASSERT(0); @@ -27195,6 +27202,8 @@ WDI_ProcessPERRoamScanOffloadReq(WDI_ControlBlockType *pWDICtx, wdiPERRoamOffloadReq->rateDownThreshold; halPERRoamConfigReq.perRoamConfigParams.isPERRoamCCAEnabled = wdiPERRoamOffloadReq->isPERRoamCCAEnabled; + halPERRoamConfigReq.perRoamConfigParams.PERRoamFullScanThreshold = + wdiPERRoamOffloadReq->PERRoamFullScanThreshold; halPERRoamConfigReq.perRoamConfigParams.PERroamTriggerPercent = wdiPERRoamOffloadReq->PERroamTriggerPercent; halPERRoamConfigReq.perRoamConfigParams.PERtimerThreshold = @@ -27206,15 +27215,18 @@ WDI_ProcessPERRoamScanOffloadReq(WDI_ControlBlockType *pWDICtx, &halPERRoamConfigReq.perRoamConfigParams, sizeof(halPERRoamConfigReq.perRoamConfigParams)); - WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, - "request_id %d waitPeriodForNextPERScan=%d rateUpThreshold=%d rateDownThreshold=%d isPERRoamCCAEnabled=%d PERtimerThreshold=%d PERroamTriggerPercent =%d", - halPERRoamConfigReq.perRoamConfigParams.request_id, + WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, + "waitPeriodForNextPERScan=%d rateUpThreshold=%d rateDownThreshold=%d isPERRoamCCAEnabled=%d", halPERRoamConfigReq.perRoamConfigParams.waitPeriodForNextPERScan, halPERRoamConfigReq.perRoamConfigParams.rateUpThreshold, halPERRoamConfigReq.perRoamConfigParams.rateDownThreshold, - halPERRoamConfigReq.perRoamConfigParams.isPERRoamCCAEnabled, + halPERRoamConfigReq.perRoamConfigParams.isPERRoamCCAEnabled); + WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, + "PERtimerThreshold=%d PERroamTriggerPercent =%d PERRoamFullScanThreshold %d", halPERRoamConfigReq.perRoamConfigParams.PERtimerThreshold, - halPERRoamConfigReq.perRoamConfigParams.PERroamTriggerPercent); + halPERRoamConfigReq.perRoamConfigParams.PERroamTriggerPercent, + halPERRoamConfigReq.perRoamConfigParams.PERRoamFullScanThreshold); + return WDI_SendMsg(pWDICtx, pSendBuffer, usSendSize, wdiPERRoamOffloadScancb, pEventData->pUserData, WDI_PER_ROAM_SCAN_OFFLOAD_RSP); @@ -27231,10 +27243,17 @@ WDI_ProcessPERRoamScanTriggerReq(WDI_ControlBlockType *pWDICtx, WDI_PERRoamTriggerScanInfo *wdiPERRoamTriggerReq; tStartRoamScanReq halPERRoamTriggerReq; + if (!pEventData) { + WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, + "%s: pEventdata is null", __func__); + WDI_ASSERT(0); + return WDI_STATUS_E_FAILURE; + } + wdiPERRoamTriggerReq = (WDI_PERRoamTriggerScanInfo *) pEventData->pEventData; wdiPERRoamTriggerScancb = (WDI_PERRoamTriggerScanCb)pEventData->pCBfnc; - if ((!pEventData) || (!wdiPERRoamTriggerReq) || (!wdiPERRoamTriggerScancb)) { + if (!wdiPERRoamTriggerReq || !wdiPERRoamTriggerScancb) { WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, "%s: Invalid parameters", __func__); WDI_ASSERT(0); @@ -37659,8 +37678,6 @@ WDI_StartOemDataReqIndNew { WDI_EventInfoType wdiEventData; - VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR, - "%s: %d",__func__, __LINE__); /*------------------------------------------------------------------------ Sanity Check ------------------------------------------------------------------------*/ @@ -37705,9 +37722,6 @@ WDI_ProcessStartOemDataReqIndNew tpStartOemDataReqParamsNew pHalStartOemDataReqParamsNew; WDI_Status wdiStatus = WDI_STATUS_SUCCESS; - VOS_TRACE( VOS_MODULE_ID_WDI, VOS_TRACE_LEVEL_ERROR, - "%s: %d",__func__, __LINE__); - if (( NULL == pWDICtx ) || ( NULL == pEventData ) || ( NULL == pEventData->pEventData)) { diff --git a/drivers/staging/prima/riva/inc/wlan_hal_msg.h b/drivers/staging/prima/riva/inc/wlan_hal_msg.h index 820f0ace18b0..581862c9307c 100644 --- a/drivers/staging/prima/riva/inc/wlan_hal_msg.h +++ b/drivers/staging/prima/riva/inc/wlan_hal_msg.h @@ -9008,7 +9008,8 @@ typedef PACKED_PRE struct PACKED_POST { tANI_U32 waitPeriodForNextPERScan; tANI_U32 PERtimerThreshold; tANI_U32 PERroamTriggerPercent; - tANI_U32 reserved; + tANI_S16 PERRoamFullScanThreshold; + tANI_U16 reserved; } tPerRoamConfigParams, * tpPerRoamConfigParams; typedef PACKED_PRE struct PACKED_POST diff --git a/drivers/usb/gadget/f_mbim.c b/drivers/usb/gadget/f_mbim.c index c7dbacf60187..b29c484c32ec 100644 --- a/drivers/usb/gadget/f_mbim.c +++ b/drivers/usb/gadget/f_mbim.c @@ -605,24 +605,24 @@ static void fmbim_ctrl_response_available(struct f_mbim *dev) int ret; int ep_queue_trials; - pr_debug("dev:%p portno#%d\n", dev, dev->port_num); + pr_debug("dev:%pK portno#%d\n", dev, dev->port_num); spin_lock_irqsave(&dev->lock, flags); if (!atomic_read(&dev->online)) { - pr_err("dev:%p is not online\n", dev); + pr_err("dev:%pK is not online\n", dev); spin_unlock_irqrestore(&dev->lock, flags); return; } if (!req) { - pr_err("dev:%p req is NULL\n", dev); + pr_err("dev:%pK req is NULL\n", dev); spin_unlock_irqrestore(&dev->lock, flags); return; } if (!req->buf) { - pr_err("dev:%p req->buf is NULL\n", dev); + pr_err("dev:%pK req->buf is NULL\n", dev); spin_unlock_irqrestore(&dev->lock, flags); return; } @@ -674,21 +674,21 @@ fmbim_send_cpkt_response(struct f_mbim *gr, struct ctrl_pkt *cpkt) unsigned long flags; if (!gr || !cpkt) { - pr_err("Invalid cpkt, dev:%p cpkt:%p\n", + pr_err("Invalid cpkt, dev:%pK cpkt:%pK\n", gr, cpkt); return -ENODEV; } - pr_debug("dev:%p port_num#%d\n", dev, dev->port_num); + pr_debug("dev:%pK port_num#%d\n", dev, dev->port_num); if (!atomic_read(&dev->online)) { - pr_err("dev:%p is not connected\n", dev); + pr_err("dev:%pK is not connected\n", dev); mbim_free_ctrl_pkt(cpkt); return 0; } if (dev->not_port.notify_state != MBIM_NOTIFY_RESPONSE_AVAILABLE) { - pr_err("dev:%p state=%d, recover!!\n", dev, + pr_err("dev:%pK state=%d, recover!!\n", dev, dev->not_port.notify_state); mbim_free_ctrl_pkt(cpkt); return 0; @@ -729,7 +729,7 @@ static int mbim_bam_connect(struct f_mbim *dev) enum peer_bam bam_name = (dev->xport == USB_GADGET_XPORT_BAM2BAM_IPA) ? IPA_P_BAM : A2_P_BAM; - pr_info("dev:%p portno:%d\n", dev, dev->port_num); + pr_info("dev:%pK portno:%d\n", dev, dev->port_num); ret = bam2bam_data_port_select(MBIM_DEFAULT_PORT); if (ret) { @@ -762,7 +762,7 @@ static int mbim_bam_connect(struct f_mbim *dev) static int mbim_bam_disconnect(struct f_mbim *dev) { - pr_info("%s - dev:%p port:%d\n", __func__, dev, dev->port_num); + pr_info("%s - dev:%pK port:%d\n", __func__, dev, dev->port_num); bam_data_disconnect(&dev->bam_port, dev->port_num); return 0; @@ -899,7 +899,7 @@ static void mbim_notify_complete(struct usb_ep *ep, struct usb_request *req) struct f_mbim *mbim = req->context; struct usb_cdc_notification *event = req->buf; - pr_debug("dev:%p\n", mbim); + pr_debug("dev:%pK\n", mbim); spin_lock(&mbim->lock); switch (req->status) { @@ -929,7 +929,7 @@ static void mbim_notify_complete(struct usb_ep *ep, struct usb_request *req) mbim_do_notify(mbim); spin_unlock(&mbim->lock); - pr_debug("dev:%p Exit\n", mbim); + pr_debug("dev:%pK Exit\n", mbim); } static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req) @@ -940,7 +940,7 @@ static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req) struct f_mbim *mbim = func_to_mbim(f); struct mbim_ntb_input_size *ntb = NULL; - pr_debug("dev:%p\n", mbim); + pr_debug("dev:%pK\n", mbim); req->context = NULL; if (req->status || req->actual != req->length) { @@ -978,7 +978,7 @@ static void mbim_ep0out_complete(struct usb_ep *ep, struct usb_request *req) invalid: usb_ep_set_halt(ep); - pr_err("dev:%p Failed\n", mbim); + pr_err("dev:%pK Failed\n", mbim); return; } @@ -1000,7 +1000,7 @@ fmbim_cmd_complete(struct usb_ep *ep, struct usb_request *req) return; } - pr_debug("dev:%p port#%d\n", dev, dev->port_num); + pr_debug("dev:%pK port#%d\n", dev, dev->port_num); cpkt = mbim_alloc_ctrl_pkt(len, GFP_ATOMIC); if (!cpkt) { @@ -1313,7 +1313,7 @@ static int mbim_set_alt(struct usb_function *f, unsigned intf, unsigned alt) return ret; } - pr_info("Set mbim port in_desc = 0x%p\n", + pr_info("Set mbim port in_desc = 0x%pK\n", mbim->bam_port.in->desc); ret = config_ep_by_speed(cdev->gadget, f, @@ -1325,7 +1325,7 @@ static int mbim_set_alt(struct usb_function *f, unsigned intf, unsigned alt) return ret; } - pr_info("Set mbim port out_desc = 0x%p\n", + pr_info("Set mbim port out_desc = 0x%pK\n", mbim->bam_port.out->desc); if (mbim->xport == USB_GADGET_XPORT_BAM2BAM_IPA @@ -1464,7 +1464,7 @@ static void mbim_suspend(struct usb_function *f) if (mbim->bam_port.out->desc) mbim->out_ep_desc_backup = mbim->bam_port.out->desc; - pr_debug("in_ep_desc_backup = %p, out_ep_desc_backup = %p", + pr_debug("in_ep_desc_backup = %pK, out_ep_desc_backup = %pK", mbim->in_ep_desc_backup, mbim->out_ep_desc_backup); mbim_bam_disconnect(mbim); @@ -1504,7 +1504,7 @@ static void mbim_resume(struct usb_function *f) mbim->bam_port.in->desc = mbim->in_ep_desc_backup; mbim->bam_port.out->desc = mbim->out_ep_desc_backup; - pr_debug("in_ep_desc_backup = %p, out_ep_desc_backup = %p", + pr_debug("in_ep_desc_backup = %pK, out_ep_desc_backup = %pK", mbim->in_ep_desc_backup, mbim->out_ep_desc_backup); mbim_bam_connect(mbim); diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index f26570d83d14..2a358ae7754a 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c @@ -196,7 +196,7 @@ int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to) int tooff = 0, fromoff = 0; int size; - if (!to || !from) + if (!to || !from || (int)(to->start) < 0) return -EINVAL; if (to->start > from->start) diff --git a/drivers/video/msm/mdss/mdp3.c b/drivers/video/msm/mdss/mdp3.c index d15bda5e9b7f..e09d58be4d30 100644 --- a/drivers/video/msm/mdss/mdp3.c +++ b/drivers/video/msm/mdss/mdp3.c @@ -964,7 +964,7 @@ static int mdp3_res_init(void) mdp3_res->ion_client = msm_ion_client_create(mdp3_res->pdev->name); if (IS_ERR_OR_NULL(mdp3_res->ion_client)) { - pr_err("msm_ion_client_create() return error (%p)\n", + pr_err("msm_ion_client_create() return error (%pK)\n", mdp3_res->ion_client); mdp3_res->ion_client = NULL; return -EINVAL; @@ -1397,7 +1397,7 @@ int mdp3_get_img(struct msmfb_data *img, struct mdp3_img_data *data) data->addr += img->offset; data->len -= img->offset; - pr_debug("mem=%d ihdl=%p buf=0x%pa len=0x%x\n", img->memory_id, + pr_debug("mem=%d ihdl=%pK buf=0x%pa len=0x%x\n", img->memory_id, data->srcp_ihdl, &data->addr, data->len); } else { mdp3_put_img(data); @@ -1544,7 +1544,7 @@ static int mdp3_alloc(struct msm_fb_data_type *mfd) pr_err("fail to map to IOMMU %d\n", ret); return ret; } - pr_info("allocating %u bytes at %p (%lx phys) for fb %d\n", + pr_info("allocating %u bytes at %pK (%lx phys) for fb %d\n", size, virt, phys, mfd->index); mfd->fbi->screen_base = virt; diff --git a/drivers/video/msm/mdss/mdss_debug.c b/drivers/video/msm/mdss/mdss_debug.c index 85cab0a364a4..67ec0bfc54ae 100644 --- a/drivers/video/msm/mdss/mdss_debug.c +++ b/drivers/video/msm/mdss/mdss_debug.c @@ -775,7 +775,7 @@ void mdss_dump_reg(char __iomem *base, int len) x4 = readl_relaxed(addr+0x4); x8 = readl_relaxed(addr+0x8); xc = readl_relaxed(addr+0xc); - pr_info("%p : %08x %08x %08x %08x\n", addr, x0, x4, x8, xc); + pr_info("%pK : %08x %08x %08x %08x\n", addr, x0, x4, x8, xc); addr += 16; } mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); @@ -895,7 +895,7 @@ static inline struct mdss_mdp_misr_map *mdss_misr_get_map(u32 block_id, return NULL; } - pr_debug("MISR Module(%d) CTRL(0x%x) SIG(0x%x) intf_base(0x%p)\n", + pr_debug("MISR Module(%d) CTRL(0x%x) SIG(0x%x) intf_base(0x%pK)\n", block_id, map->ctrl_reg, map->value_reg, intf_base); return map; } @@ -938,7 +938,7 @@ int mdss_misr_set(struct mdss_data_type *mdata, bool use_mdp_up_misr = false; if (!mdata || !req || !ctl) { - pr_err("Invalid input params: mdata = %p req = %p ctl = %p", + pr_err("Invalid input params: mdata = %pK req = %pK ctl = %pK", mdata, req, ctl); return -EINVAL; } diff --git a/drivers/video/msm/mdss/mdss_dsi.c b/drivers/video/msm/mdss/mdss_dsi.c index ae05c9c1f52a..6698a18c14dc 100644 --- a/drivers/video/msm/mdss/mdss_dsi.c +++ b/drivers/video/msm/mdss/mdss_dsi.c @@ -479,7 +479,7 @@ static int mdss_dsi_off(struct mdss_panel_data *pdata, int power_state) mutex_lock(&ctrl_pdata->mutex); panel_info = &ctrl_pdata->panel_data.panel_info; - pr_debug("%s+: ctrl=%p ndx=%d power_state=%d\n", + pr_debug("%s+: ctrl=%pK ndx=%d power_state=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx, power_state); pr_info("%s+: ctrl=%p ndx=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx); @@ -572,7 +572,7 @@ int mdss_dsi_on(struct mdss_panel_data *pdata) panel_data); cur_power_state = pdata->panel_info.panel_power_state; - pr_debug("%s+: ctrl=%p ndx=%d cur_power_state=%d\n", __func__, + pr_debug("%s+: ctrl=%pK ndx=%d cur_power_state=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx, cur_power_state); pr_info("%s+: ctrl=%p ndx=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx); @@ -745,7 +745,7 @@ static int mdss_dsi_unblank(struct mdss_panel_data *pdata) panel_data); mipi = &pdata->panel_info.mipi; - pr_debug("%s+: ctrl=%p ndx=%d cur_blank_state=%d\n", __func__, + pr_debug("%s+: ctrl=%pK ndx=%d cur_blank_state=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx, pdata->panel_info.blank_state); mdss_dsi_clk_ctrl(ctrl_pdata, DSI_ALL_CLKS, 1); @@ -798,7 +798,7 @@ static int mdss_dsi_blank(struct mdss_panel_data *pdata, int power_state) panel_data); mipi = &pdata->panel_info.mipi; - pr_debug("%s+: ctrl=%p ndx=%d power_state=%d\n", + pr_debug("%s+: ctrl=%pK ndx=%d power_state=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx, power_state); mdss_dsi_clk_ctrl(ctrl_pdata, DSI_ALL_CLKS, 1); @@ -874,7 +874,7 @@ int mdss_dsi_cont_splash_on(struct mdss_panel_data *pdata) ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); - pr_debug("%s+: ctrl=%p ndx=%d\n", __func__, + pr_debug("%s+: ctrl=%pK ndx=%d\n", __func__, ctrl_pdata, ctrl_pdata->ndx); WARN((ctrl_pdata->ctrl_state & CTRL_STATE_PANEL_INIT), @@ -1720,7 +1720,7 @@ int mdss_dsi_retrieve_ctrl_resources(struct platform_device *pdev, int mode, return rc; } - pr_info("%s: ctrl_base=%p ctrl_size=%x phy_base=%p phy_size=%x\n", + pr_info("%s: ctrl_base=%pK ctrl_size=%x phy_base=%pK phy_size=%x\n", __func__, ctrl->ctrl_base, ctrl->reg_size, ctrl->phy_io.base, ctrl->phy_io.len); diff --git a/drivers/video/msm/mdss/mdss_dsi_host.c b/drivers/video/msm/mdss/mdss_dsi_host.c index d2ce884c217c..087543ee4fc7 100644 --- a/drivers/video/msm/mdss/mdss_dsi_host.c +++ b/drivers/video/msm/mdss/mdss_dsi_host.c @@ -95,7 +95,7 @@ void mdss_dsi_ctrl_init(struct device *ctrl_dev, if (ctrl->mdss_util->register_irq(ctrl->dsi_hw)) pr_err("%s: mdss_register_irq failed.\n", __func__); - pr_debug("%s: ndx=%d base=%p\n", __func__, ctrl->ndx, ctrl->ctrl_base); + pr_debug("%s: ndx=%d base=%pK\n", __func__, ctrl->ndx, ctrl->ctrl_base); init_completion(&ctrl->dma_comp); init_completion(&ctrl->mdp_comp); diff --git a/drivers/video/msm/mdss/mdss_dsi_panel.c b/drivers/video/msm/mdss/mdss_dsi_panel.c index 43bdc1b071fc..3d2897743955 100644 --- a/drivers/video/msm/mdss/mdss_dsi_panel.c +++ b/drivers/video/msm/mdss/mdss_dsi_panel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -837,7 +837,7 @@ static int mdss_dsi_panel_pre_on(struct mdss_panel_data *pdata) ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); - pr_info("%s+: ctrl=%p ndx=%d\n", __func__, ctrl, ctrl->ndx); + pr_info("%s+: ctrl=%pK ndx=%d\n", __func__, ctrl, ctrl->ndx); if (pinfo->dcs_cmd_by_left) { if (ctrl->ndx != DSI_CTRL_LEFT) @@ -874,7 +874,7 @@ static int mdss_dsi_panel_on(struct mdss_panel_data *pdata) ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); - pr_info("%s+: ctrl=%p ndx=%d\n", __func__, ctrl, ctrl->ndx); + pr_info("%s+: ctrl=%pK ndx=%d\n", __func__, ctrl, ctrl->ndx); if (pinfo->dcs_cmd_by_left) { if (ctrl->ndx != DSI_CTRL_LEFT) @@ -948,7 +948,7 @@ static int mdss_dsi_panel_off(struct mdss_panel_data *pdata) ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); - pr_info("%s+: ctrl=%p ndx=%d\n", __func__, ctrl, ctrl->ndx); + pr_info("%s+: ctrl=%pK ndx=%d\n", __func__, ctrl, ctrl->ndx); if (pinfo->dcs_cmd_by_left) { if (ctrl->ndx != DSI_CTRL_LEFT) @@ -984,7 +984,7 @@ static int mdss_dsi_panel_low_power_config(struct mdss_panel_data *pdata, ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); - pr_debug("%s: ctrl=%p ndx=%d enable=%d\n", __func__, ctrl, ctrl->ndx, + pr_debug("%s: ctrl=%pK ndx=%d enable=%d\n", __func__, ctrl, ctrl->ndx, enable); /* Any panel specific low power commands/config */ diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c index 9da7be633f1a..96daa8ddb7ba 100644 --- a/drivers/video/msm/mdss/mdss_fb.c +++ b/drivers/video/msm/mdss/mdss_fb.c @@ -1909,7 +1909,7 @@ int mdss_fb_alloc_fb_ion_memory(struct msm_fb_data_type *mfd, size_t fb_size) goto fb_mmap_failed; } - pr_debug("alloc 0x%zuB vaddr = %p (%pa iova) for fb%d\n", fb_size, + pr_debug("alloc 0x%zuB vaddr = %pK (%pa iova) for fb%d\n", fb_size, vaddr, &mfd->iova, mfd->index); mfd->fbi->screen_base = (char *) vaddr; @@ -2002,7 +2002,7 @@ static int mdss_fb_fbmem_ion_mmap(struct fb_info *info, vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - pr_debug("vma=%p, addr=%x len=%ld\n", + pr_debug("vma=%pK, addr=%x len=%ld\n", vma, (unsigned int)addr, len); pr_debug("vm_start=%x vm_end=%x vm_page_prot=%ld\n", (unsigned int)vma->vm_start, @@ -2172,7 +2172,7 @@ static int mdss_fb_alloc_fbmem_iommu(struct msm_fb_data_type *mfd, int dom) if (rc) pr_warn("Cannot map fb_mem %pa to IOMMU. rc=%d\n", &phys, rc); - pr_debug("alloc 0x%zxB @ (%pa phys) (0x%p virt) (%pa iova) for fb%d\n", + pr_debug("alloc 0x%zxB @ (%pa phys) (0x%pK virt) (%pa iova) for fb%d\n", size, &phys, virt, &mfd->iova, mfd->index); mfd->fbi->screen_base = virt; diff --git a/drivers/video/msm/mdss/mdss_hdmi_tx.c b/drivers/video/msm/mdss/mdss_hdmi_tx.c index 90f92678948c..140a460b2acb 100644 --- a/drivers/video/msm/mdss/mdss_hdmi_tx.c +++ b/drivers/video/msm/mdss/mdss_hdmi_tx.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2014,2016 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1035,7 +1035,7 @@ static int hdmi_tx_sysfs_create(struct hdmi_tx_ctrl *hdmi_ctrl, return rc; } hdmi_ctrl->kobj = &fbi->dev->kobj; - DEV_DBG("%s: sysfs group %p\n", __func__, hdmi_ctrl->kobj); + DEV_DBG("%s: sysfs group %pK\n", __func__, hdmi_ctrl->kobj); return 0; } /* hdmi_tx_sysfs_create */ @@ -3556,7 +3556,7 @@ static int hdmi_tx_init_resource(struct hdmi_tx_ctrl *hdmi_ctrl) DEV_DBG("%s: '%s' remap failed or not available\n", __func__, hdmi_tx_io_name(i)); } - DEV_INFO("%s: '%s': start = 0x%p, len=0x%x\n", __func__, + DEV_INFO("%s: '%s': start = 0x%pK, len=0x%x\n", __func__, hdmi_tx_io_name(i), pdata->io[i].base, pdata->io[i].len); } diff --git a/drivers/video/msm/mdss/mdss_hdmi_util.c b/drivers/video/msm/mdss/mdss_hdmi_util.c index b40ff288551c..b50aee348328 100644 --- a/drivers/video/msm/mdss/mdss_hdmi_util.c +++ b/drivers/video/msm/mdss/mdss_hdmi_util.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2010-2014,2016 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -178,7 +178,7 @@ static void hdmi_ddc_print_data(struct hdmi_tx_ddc_data *ddc_data, return; } - DEV_DBG("%s: buf=%p, d_len=0x%x, d_addr=0x%x, no_align=%d\n", + DEV_DBG("%s: buf=%pK, d_len=0x%x, d_addr=0x%x, no_align=%d\n", caller, ddc_data->data_buf, ddc_data->data_len, ddc_data->dev_addr, ddc_data->no_align); DEV_DBG("%s: offset=0x%x, req_len=0x%x, retry=%d, what=%s\n", diff --git a/drivers/video/msm/mdss/mdss_mdp.c b/drivers/video/msm/mdss/mdss_mdp.c index 6bc48c471a62..632ffb7dad19 100644 --- a/drivers/video/msm/mdss/mdss_mdp.c +++ b/drivers/video/msm/mdss/mdss_mdp.c @@ -1218,7 +1218,7 @@ static u32 mdss_mdp_res_init(struct mdss_data_type *mdata) mdata->iclient = msm_ion_client_create(mdata->pdev->name); if (IS_ERR_OR_NULL(mdata->iclient)) { - pr_err("msm_ion_client_create() return error (%p)\n", + pr_err("msm_ion_client_create() return error (%pK)\n", mdata->iclient); mdata->iclient = NULL; } @@ -1537,7 +1537,7 @@ static int mdss_mdp_probe(struct platform_device *pdev) if (rc) pr_debug("unable to map MDSS VBIF non-realtime base\n"); else - pr_debug("MDSS VBIF NRT HW Base addr=%p len=0x%x\n", + pr_debug("MDSS VBIF NRT HW Base addr=%pK len=0x%x\n", mdata->vbif_nrt_io.base, mdata->vbif_nrt_io.len); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); diff --git a/drivers/video/msm/mdss/mdss_mdp_debug.c b/drivers/video/msm/mdss/mdss_mdp_debug.c index 39230d196842..9b1ab8d9ab26 100644 --- a/drivers/video/msm/mdss/mdss_mdp_debug.c +++ b/drivers/video/msm/mdss/mdss_mdp_debug.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * Copyright (c) 2014,2016 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -57,13 +57,13 @@ static void __dump_pipe(struct seq_file *s, struct mdss_mdp_pipe *pipe) seq_puts(s, "Data:\n"); if (pipe->front_buf.num_planes) { buf = pipe->front_buf.p; - seq_printf(s, "\tfront_buf ihdl=0x%p addr=%pa size=%lu\n", + seq_printf(s, "\tfront_buf ihdl=0x%pK addr=%pa size=%lu\n", buf->srcp_ihdl, &buf->addr, buf->len); } if (pipe->back_buf.num_planes) { buf = pipe->back_buf.p; - seq_printf(s, "\tback_buf ihdl=0x%p addr=%pa size=%lu\n", + seq_printf(s, "\tback_buf ihdl=0x%pK addr=%pa size=%lu\n", buf->srcp_ihdl, &buf->addr, buf->len); } } diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c b/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c index 162643807494..85833b6462e5 100644 --- a/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c +++ b/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -582,7 +582,7 @@ static int mdss_mdp_cmd_wait4pingpong(struct mdss_mdp_ctl *ctl, void *arg) ctx->rdptr_enabled, ctl->roi_bkup.w, ctl->roi_bkup.h); - pr_debug("%s: intf_num=%d ctx=%p koff_cnt=%d\n", __func__, + pr_debug("%s: intf_num=%d ctx=%pK koff_cnt=%d\n", __func__, ctl->intf_num, ctx, atomic_read(&ctx->koff_cnt)); rc = wait_event_timeout(ctx->pp_waitq, @@ -1109,7 +1109,7 @@ static int mdss_mdp_cmd_intfs_setup(struct mdss_mdp_ctl *ctl, ctx->intf_recovery.fxn = mdss_mdp_cmd_intf_recovery; ctx->intf_recovery.data = ctx; - pr_debug("%s: ctx=%p num=%d mixer=%d\n", __func__, + pr_debug("%s: ctx=%pK num=%d mixer=%d\n", __func__, ctx, ctx->pp_num, mixer->num); MDSS_XLOG(ctl->num, atomic_read(&ctx->koff_cnt), ctx->clk_enabled, ctx->rdptr_enabled); diff --git a/drivers/video/msm/mdss/mdss_mdp_intf_video.c b/drivers/video/msm/mdss/mdss_mdp_intf_video.c index e4da76ebee5b..2eff0d3a2ded 100644 --- a/drivers/video/msm/mdss/mdss_mdp_intf_video.c +++ b/drivers/video/msm/mdss/mdss_mdp_intf_video.c @@ -114,7 +114,7 @@ int mdss_mdp_video_addr_setup(struct mdss_data_type *mdata, for (i = 0; i < count; i++) { head[i].base = mdata->mdss_io.base + offsets[i]; - pr_debug("adding Video Intf #%d offset=0x%x virt=%p\n", i, + pr_debug("adding Video Intf #%d offset=0x%x virt=%pK\n", i, offsets[i], head[i].base); head[i].ref_cnt = 0; head[i].intf_num = i + MDSS_MDP_INTF0; @@ -440,7 +440,7 @@ static int mdss_mdp_video_intfs_stop(struct mdss_mdp_ctl *ctl, pr_err("Intf %d not in use\n", (inum + MDSS_MDP_INTF0)); return -ENODEV; } - pr_debug("stop ctl=%d video Intf #%d base=%p", ctl->num, + pr_debug("stop ctl=%d video Intf #%d base=%pK", ctl->num, ctx->intf_num, ctx->base); } else { pr_err("Invalid intf number: %d\n", (inum + MDSS_MDP_INTF0)); @@ -1179,7 +1179,7 @@ static int mdss_mdp_video_intfs_setup(struct mdss_mdp_ctl *ctl, (inum + MDSS_MDP_INTF0)); return -EBUSY; } - pr_debug("video Intf #%d base=%p", ctx->intf_num, ctx->base); + pr_debug("video Intf #%d base=%pK", ctx->intf_num, ctx->base); ctx->ref_cnt++; } else { pr_err("Invalid intf number: %d\n", (inum + MDSS_MDP_INTF0)); diff --git a/drivers/video/msm/mdss/mdss_mdp_pipe.c b/drivers/video/msm/mdss/mdss_mdp_pipe.c index bf9a9b86aa0c..f4d0748b0fa1 100644 --- a/drivers/video/msm/mdss/mdss_mdp_pipe.c +++ b/drivers/video/msm/mdss/mdss_mdp_pipe.c @@ -1697,7 +1697,7 @@ int mdss_mdp_pipe_queue_data(struct mdss_mdp_pipe *pipe, } if (src_data == NULL) { - pr_debug("src_data=%p pipe num=%dx\n", + pr_debug("src_data=%pK pipe num=%dx\n", src_data, pipe->num); goto update_nobuf; } diff --git a/drivers/video/msm/mdss/mdss_mdp_pp.c b/drivers/video/msm/mdss/mdss_mdp_pp.c index 871dea4cf91b..d53cfaa0bdf1 100644 --- a/drivers/video/msm/mdss/mdss_mdp_pp.c +++ b/drivers/video/msm/mdss/mdss_mdp_pp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -2169,7 +2169,7 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out, pr_debug("AD not supported on device.\n"); return ret; } else if (ret || !ad) { - pr_err("Failed to get ad info: ret = %d, ad = 0x%p.\n", + pr_err("Failed to get ad info: ret = %d, ad = 0x%pK.\n", ret, ad); return ret; } @@ -2185,7 +2185,7 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out, if (!ad->bl_mfd || !ad->bl_mfd->panel_info || !ad->bl_att_lut) { - pr_err("Invalid ad info: bl_mfd = 0x%p, ad->bl_mfd->panel_info = 0x%p, bl_att_lut = 0x%p\n", + pr_err("Invalid ad info: bl_mfd = 0x%pK, ad->bl_mfd->panel_info = 0x%pK, bl_att_lut = 0x%pK\n", ad->bl_mfd, (!ad->bl_mfd) ? NULL : ad->bl_mfd->panel_info, ad->bl_att_lut); @@ -3400,7 +3400,7 @@ static int pp_hist_enable(struct pp_hist_col_info *hist_info, spin_lock_irqsave(&hist_info->hist_lock, flag); if (hist_info->col_en) { spin_unlock_irqrestore(&hist_info->hist_lock, flag); - pr_info("%s Hist collection has already been enabled %p\n", + pr_info("%s Hist collection has already been enabled %pK\n", __func__, hist_info->base); goto exit; } @@ -3537,7 +3537,7 @@ static int pp_hist_disable(struct pp_hist_col_info *hist_info) spin_lock_irqsave(&hist_info->hist_lock, flag); if (hist_info->col_en == false) { spin_unlock_irqrestore(&hist_info->hist_lock, flag); - pr_debug("Histogram already disabled (%p)\n", hist_info->base); + pr_debug("Histogram already disabled (%pK)\n", hist_info->base); ret = -EINVAL; goto exit; } @@ -3651,7 +3651,7 @@ int mdss_mdp_hist_intr_req(struct mdss_intr *intr, u32 bits, bool en) unsigned long flag; int ret = 0; if (!intr) { - pr_err("NULL addr passed, %p\n", intr); + pr_err("NULL addr passed, %pK\n", intr); return -EINVAL; } @@ -4405,7 +4405,7 @@ static int pp_ad_invalidate_input(struct msm_fb_data_type *mfd) ret = mdss_mdp_get_ad(mfd, &ad); if (ret || !ad) { - pr_err("Fail to get ad: ret = %d, ad = 0x%p\n", ret, ad); + pr_err("Fail to get ad: ret = %d, ad = 0x%pK\n", ret, ad); return -EINVAL; } pr_debug("AD backlight level changed (%d), trigger update to AD\n", diff --git a/drivers/video/msm/mdss/mdss_mdp_util.c b/drivers/video/msm/mdss/mdss_mdp_util.c index 59bef37315d0..1a2a94f37657 100644 --- a/drivers/video/msm/mdss/mdss_mdp_util.c +++ b/drivers/video/msm/mdss/mdss_mdp_util.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -507,7 +507,7 @@ static int mdss_mdp_put_img(struct mdss_mdp_img_data *data) pr_debug("pmem buf=0x%pa\n", &data->addr); data->srcp_file = NULL; } else if (!IS_ERR_OR_NULL(data->srcp_ihdl)) { - pr_debug("ion hdl=%p buf=0x%pa\n", data->srcp_ihdl, + pr_debug("ion hdl=%pK buf=0x%pa\n", data->srcp_ihdl, &data->addr); if (!iclient) { pr_err("invalid ion client\n"); @@ -599,7 +599,7 @@ static int mdss_mdp_get_img(struct msmfb_data *img, data->addr += data->offset; data->len -= data->offset; - pr_debug("mem=%d ihdl=%p buf=0x%pa len=0x%lu\n", img->memory_id, + pr_debug("mem=%d ihdl=%pK buf=0x%pa len=0x%lu\n", img->memory_id, data->srcp_ihdl, &data->addr, data->len); } else { mdss_mdp_put_img(data); @@ -652,7 +652,7 @@ static int mdss_mdp_map_buffer(struct mdss_mdp_img_data *data) data->addr += data->offset; data->len -= data->offset; - pr_debug("ihdl=%p buf=0x%pa len=0x%lu\n", + pr_debug("ihdl=%pK buf=0x%pa len=0x%lu\n", data->srcp_ihdl, &data->addr, data->len); } else { mdss_mdp_put_img(data); diff --git a/drivers/video/msm/mdss/mdss_mdp_wb.c b/drivers/video/msm/mdss/mdss_mdp_wb.c index 93b960a51b13..3e9fde0dadb0 100644 --- a/drivers/video/msm/mdss/mdss_mdp_wb.c +++ b/drivers/video/msm/mdss/mdss_mdp_wb.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -95,7 +95,7 @@ struct mdss_mdp_data *mdss_mdp_wb_debug_buffer(struct msm_fb_data_type *mfd) ihdl = ion_alloc(iclient, img_size, SZ_4K, ION_HEAP(ION_SF_HEAP_ID), 0); if (IS_ERR_OR_NULL(ihdl)) { - pr_err("unable to alloc fbmem from ion (%p)\n", ihdl); + pr_err("unable to alloc fbmem from ion (%pK)\n", ihdl); return NULL; } @@ -122,7 +122,7 @@ struct mdss_mdp_data *mdss_mdp_wb_debug_buffer(struct msm_fb_data_type *mfd) img->len = img_size; } - pr_debug("ihdl=%p virt=%p phys=0x%pa iova=0x%pa size=%u\n", + pr_debug("ihdl=%pK virt=%pK phys=0x%pa iova=0x%pa size=%u\n", ihdl, videomemory, &mdss_wb_mem, &img->addr, img_size); } return &mdss_wb_buffer; @@ -431,7 +431,7 @@ static struct mdss_mdp_wb_data *get_user_node(struct msm_fb_data_type *mfd, list_for_each_entry(node, &wb->register_queue, registered_entry) if ((node->buf_data.p[0].srcp_ihdl == ihdl) && (node->buf_info.offset == data->offset)) { - pr_debug("found fd=%d hdl=%p off=%x addr=%pa\n", + pr_debug("found fd=%d hdl=%pK off=%x addr=%pa\n", data->memory_id, ihdl, data->offset, &node->buf_data.p[0].addr); @@ -497,7 +497,7 @@ static void mdss_mdp_wb_free_node(struct mdss_mdp_wb_data *node) if (node->user_alloc) { buf = &node->buf_data.p[0]; - pr_debug("free user mem_id=%d ihdl=%p, offset=%u addr=0x%pa\n", + pr_debug("free user mem_id=%d ihdl=%pK, offset=%u addr=0x%pa\n", node->buf_info.memory_id, buf->srcp_ihdl, node->buf_info.offset, diff --git a/drivers/video/msm/mdss/mdss_util.c b/drivers/video/msm/mdss/mdss_util.c index 6d4e4f95a426..22c3803ffae4 100644 --- a/drivers/video/msm/mdss/mdss_util.c +++ b/drivers/video/msm/mdss/mdss_util.c @@ -1,5 +1,4 @@ - -/* Copyright (c) 2007-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2007-2014,2016 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -33,7 +32,7 @@ int mdss_register_irq(struct mdss_hw *hw) if (!mdss_irq_handlers[hw->hw_ndx]) mdss_irq_handlers[hw->hw_ndx] = hw; else - pr_err("panel %d's irq at %p is already registered\n", + pr_err("panel %d's irq at %pK is already registered\n", hw->hw_ndx, hw->irq_handler); spin_unlock_irqrestore(&mdss_lock, irq_flags); diff --git a/fs/fs_struct.c b/fs/fs_struct.c index d8ac61d0c932..8e19779c9d5e 100644 --- a/fs/fs_struct.c +++ b/fs/fs_struct.c @@ -128,6 +128,7 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) return fs; } +EXPORT_SYMBOL_GPL(copy_fs_struct); int unshare_fs_struct(void) { struct fs_struct *fs = current->fs; diff --git a/fs/sdcardfs/derived_perm.c b/fs/sdcardfs/derived_perm.c index 903e89068170..b4cc97c47bce 100755 --- a/fs/sdcardfs/derived_perm.c +++ b/fs/sdcardfs/derived_perm.c @@ -30,11 +30,12 @@ static void inherit_derived_state(struct inode *parent, struct inode *child) ci->userid = pi->userid; ci->d_uid = pi->d_uid; ci->under_android = pi->under_android; + ci->top = pi->top; } /* helper function for derived state */ -void setup_derived_state(struct inode *inode, perm_t perm, - userid_t userid, uid_t uid, bool under_android) +void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid, + uid_t uid, bool under_android, struct inode *top) { struct sdcardfs_inode_info *info = SDCARDFS_I(inode); @@ -42,6 +43,7 @@ void setup_derived_state(struct inode *inode, perm_t perm, info->userid = userid; info->d_uid = uid; info->under_android = under_android; + info->top = top; } /* While renaming, there is a point where we want the path from dentry, but the name from newdentry */ @@ -71,6 +73,7 @@ void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, st /* Legacy internal layout places users at top level */ info->perm = PERM_ROOT; info->userid = simple_strtoul(newdentry->d_name.name, NULL, 10); + info->top = &info->vfs_inode; break; case PERM_ROOT: /* Assume masked off by default. */ @@ -78,19 +81,23 @@ void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, st /* App-specific directories inside; let anyone traverse */ info->perm = PERM_ANDROID; info->under_android = true; + info->top = &info->vfs_inode; } break; case PERM_ANDROID: if (!strcasecmp(newdentry->d_name.name, "data")) { /* App-specific directories inside; let anyone traverse */ info->perm = PERM_ANDROID_DATA; + info->top = &info->vfs_inode; } else if (!strcasecmp(newdentry->d_name.name, "obb")) { /* App-specific directories inside; let anyone traverse */ info->perm = PERM_ANDROID_OBB; + info->top = &info->vfs_inode; /* Single OBB directory is always shared */ } else if (!strcasecmp(newdentry->d_name.name, "media")) { /* App-specific directories inside; let anyone traverse */ info->perm = PERM_ANDROID_MEDIA; + info->top = &info->vfs_inode; } break; case PERM_ANDROID_DATA: @@ -100,6 +107,7 @@ void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, st if (appid != 0) { info->d_uid = multiuser_get_uid(parent_info->userid, appid); } + info->top = &info->vfs_inode; break; } } @@ -109,17 +117,63 @@ void get_derived_permission(struct dentry *parent, struct dentry *dentry) get_derived_permission_new(parent, dentry, dentry); } -void get_derive_permissions_recursive(struct dentry *parent) { +static int descendant_may_need_fixup(perm_t perm) { + if (perm == PERM_PRE_ROOT || perm == PERM_ROOT || perm == PERM_ANDROID) + return 1; + return 0; +} + +static int needs_fixup(perm_t perm) { + if (perm == PERM_ANDROID_DATA || perm == PERM_ANDROID_OBB + || perm == PERM_ANDROID_MEDIA) + return 1; + return 0; +} + +void fixup_perms_recursive(struct dentry *dentry, const char* name, size_t len) { + struct dentry *child; + struct sdcardfs_inode_info *info; + if (!dentry || !dentry->d_inode) + return; + info = SDCARDFS_I(dentry->d_inode); + + if (needs_fixup(info->perm)) { + mutex_lock(&dentry->d_inode->i_mutex); + child = lookup_one_len(name, dentry, len); + mutex_unlock(&dentry->d_inode->i_mutex); + if (!IS_ERR(child)) { + if (child->d_inode) { + get_derived_permission(dentry, child); + fix_derived_permission(child->d_inode); + } + dput(child); + } + } else if (descendant_may_need_fixup(info->perm)) { + mutex_lock(&dentry->d_inode->i_mutex); + list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { + fixup_perms_recursive(child, name, len); + } + mutex_unlock(&dentry->d_inode->i_mutex); + } +} + +void fixup_top_recursive(struct dentry *parent) { struct dentry *dentry; + struct sdcardfs_inode_info *info; + if (!parent->d_inode) + return; + info = SDCARDFS_I(parent->d_inode); + spin_lock(&parent->d_lock); list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) { if (dentry->d_inode) { - mutex_lock(&dentry->d_inode->i_mutex); - get_derived_permission(parent, dentry); - fix_derived_permission(dentry->d_inode); - get_derive_permissions_recursive(dentry); - mutex_unlock(&dentry->d_inode->i_mutex); + if (SDCARDFS_I(parent->d_inode)->top != SDCARDFS_I(dentry->d_inode)->top) { + get_derived_permission(parent, dentry); + fix_derived_permission(dentry->d_inode); + fixup_top_recursive(dentry); + } } } + spin_unlock(&parent->d_lock); } /* main function for updating derived permission */ @@ -135,7 +189,6 @@ inline void update_derived_permission_lock(struct dentry *dentry) * 1. need to check whether the dentry is updated or not * 2. remove the root dentry update */ - mutex_lock(&dentry->d_inode->i_mutex); if(IS_ROOT(dentry)) { //setup_default_pre_root_state(dentry->d_inode); } else { @@ -146,7 +199,6 @@ inline void update_derived_permission_lock(struct dentry *dentry) } } fix_derived_permission(dentry->d_inode); - mutex_unlock(&dentry->d_inode->i_mutex); } int need_graft_path(struct dentry *dentry) diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c index 0f4aa17645d6..597dcf912e9a 100755 --- a/fs/sdcardfs/inode.c +++ b/fs/sdcardfs/inode.c @@ -19,6 +19,7 @@ */ #include "sdcardfs.h" +#include /* Do not directly use this function. Use OVERRIDE_CRED() instead. */ const struct cred * override_fsids(struct sdcardfs_sb_info* sbi) @@ -56,6 +57,8 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry, struct dentry *lower_parent_dentry = NULL; struct path lower_path; const struct cred *saved_cred = NULL; + struct fs_struct *saved_fs; + struct fs_struct *copied_fs; if(!check_caller_access_to_name(dir, dentry->d_name.name)) { printk(KERN_INFO "%s: need to check the caller's gid in packages.list\n" @@ -74,6 +77,12 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry, /* set last 16bytes of mode field to 0664 */ mode = (mode & S_IFMT) | 00664; + + /* temporarily change umask for lower fs write */ + saved_fs = current->fs; + copied_fs = copy_fs_struct(current->fs); + current->fs = copied_fs; + current->fs->umask = 0; err = vfs_create(lower_parent_dentry->d_inode, lower_dentry, mode, want_excl); if (err) goto out; @@ -85,6 +94,8 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry, fsstack_copy_inode_size(dir, lower_parent_dentry->d_inode); out: + current->fs = saved_fs; + free_fs_struct(copied_fs); unlock_dir(lower_parent_dentry); sdcardfs_put_lower_path(dentry, &lower_path); REVERT_CRED(saved_cred); @@ -245,11 +256,9 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode struct sdcardfs_sb_info *sbi = SDCARDFS_SB(dentry->d_sb); const struct cred *saved_cred = NULL; struct sdcardfs_inode_info *pi = SDCARDFS_I(dir); - char *page_buf; - char *nomedia_dir_name; - char *nomedia_fullpath; - int fullpath_namelen; int touch_err = 0; + struct fs_struct *saved_fs; + struct fs_struct *copied_fs; if(!check_caller_access_to_name(dir, dentry->d_name.name)) { printk(KERN_INFO "%s: need to check the caller's gid in packages.list\n" @@ -276,6 +285,12 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode /* set last 16bytes of mode field to 0775 */ mode = (mode & S_IFMT) | 00775; + + /* temporarily change umask for lower fs write */ + saved_fs = current->fs; + copied_fs = copy_fs_struct(current->fs); + current->fs = copied_fs; + current->fs->umask = 0; err = vfs_mkdir(lower_parent_dentry->d_inode, lower_dentry, mode); if (err) @@ -316,42 +331,17 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode /* When creating /Android/data and /Android/obb, mark them as .nomedia */ if (make_nomedia_in_obb || ((pi->perm == PERM_ANDROID) && (!strcasecmp(dentry->d_name.name, "data")))) { - - page_buf = (char *)__get_free_page(GFP_KERNEL); - if (!page_buf) { - printk(KERN_ERR "sdcardfs: failed to allocate page buf\n"); - goto out; - } - - nomedia_dir_name = d_absolute_path(&lower_path, page_buf, PAGE_SIZE); - if (IS_ERR(nomedia_dir_name)) { - free_page((unsigned long)page_buf); - printk(KERN_ERR "sdcardfs: failed to get .nomedia dir name\n"); - goto out; - } - - fullpath_namelen = page_buf + PAGE_SIZE - nomedia_dir_name - 1; - fullpath_namelen += strlen("/.nomedia"); - nomedia_fullpath = kzalloc(fullpath_namelen + 1, GFP_KERNEL); - if (!nomedia_fullpath) { - free_page((unsigned long)page_buf); - printk(KERN_ERR "sdcardfs: failed to allocate .nomedia fullpath buf\n"); - goto out; - } - - strcpy(nomedia_fullpath, nomedia_dir_name); - free_page((unsigned long)page_buf); - strcat(nomedia_fullpath, "/.nomedia"); - touch_err = touch(nomedia_fullpath, 0664); + set_fs_pwd(current->fs, &lower_path); + touch_err = touch(".nomedia", 0664); if (touch_err) { - printk(KERN_ERR "sdcardfs: failed to touch(%s): %d\n", - nomedia_fullpath, touch_err); - kfree(nomedia_fullpath); + printk(KERN_ERR "sdcardfs: failed to create .nomedia in %s: %d\n", + lower_path.dentry->d_name.name, touch_err); goto out; } - kfree(nomedia_fullpath); } out: + current->fs = saved_fs; + free_fs_struct(copied_fs); unlock_dir(lower_parent_dentry); sdcardfs_put_lower_path(dentry, &lower_path); out_revert: @@ -512,11 +502,9 @@ static int sdcardfs_rename(struct inode *old_dir, struct dentry *old_dentry, } /* At this point, not all dentry information has been moved, so * we pass along new_dentry for the name.*/ - mutex_lock(&old_dentry->d_inode->i_mutex); get_derived_permission_new(new_dentry->d_parent, old_dentry, new_dentry); fix_derived_permission(old_dentry->d_inode); - get_derive_permissions_recursive(old_dentry); - mutex_unlock(&old_dentry->d_inode->i_mutex); + fixup_top_recursive(old_dentry); out: unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); dput(lower_old_dir_dentry); @@ -601,6 +589,13 @@ static void sdcardfs_put_link(struct dentry *dentry, struct nameidata *nd, static int sdcardfs_permission(struct inode *inode, int mask) { int err; + struct inode *top = SDCARDFS_I(inode)->top; + + /* Ensure owner is up to date */ + if (inode->i_uid != top->i_uid) { + SDCARDFS_I(inode)->d_uid = SDCARDFS_I(top)->d_uid; + fix_derived_permission(inode); + } /* * Permission check on sdcardfs inode. @@ -636,6 +631,24 @@ static int sdcardfs_permission(struct inode *inode, int mask) } +static void sdcardfs_fillattr(struct inode *inode, struct kstat *stat) +{ + struct sdcardfs_inode_info *info = SDCARDFS_I(inode); + stat->dev = inode->i_sb->s_dev; + stat->ino = inode->i_ino; + stat->mode = (inode->i_mode & S_IFMT) | get_mode(SDCARDFS_I(info->top)); + stat->nlink = inode->i_nlink; + stat->uid = SDCARDFS_I(info->top)->d_uid; + stat->gid = get_gid(SDCARDFS_I(info->top)); + stat->rdev = inode->i_rdev; + stat->size = i_size_read(inode); + stat->atime = inode->i_atime; + stat->mtime = inode->i_mtime; + stat->ctime = inode->i_ctime; + stat->blksize = (1 << inode->i_blkbits); + stat->blocks = inode->i_blocks; +} + static int sdcardfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { @@ -665,8 +678,7 @@ static int sdcardfs_getattr(struct vfsmount *mnt, struct dentry *dentry, sdcardfs_copy_and_fix_attrs(inode, lower_inode); fsstack_copy_inode_size(inode, lower_inode); - - generic_fillattr(inode, stat); + sdcardfs_fillattr(inode, stat); sdcardfs_put_lower_path(dentry, &lower_path); return 0; } @@ -788,9 +800,7 @@ const struct inode_operations sdcardfs_symlink_iops = { const struct inode_operations sdcardfs_dir_iops = { .create = sdcardfs_create, .lookup = sdcardfs_lookup, -#if 0 .permission = sdcardfs_permission, -#endif .unlink = sdcardfs_unlink, .mkdir = sdcardfs_mkdir, .rmdir = sdcardfs_rmdir, diff --git a/fs/sdcardfs/lookup.c b/fs/sdcardfs/lookup.c index a01b06a514fd..4c3b2e831e6a 100755 --- a/fs/sdcardfs/lookup.c +++ b/fs/sdcardfs/lookup.c @@ -236,10 +236,31 @@ static struct dentry *__sdcardfs_lookup(struct dentry *dentry, /* now start the actual lookup procedure */ lower_dir_dentry = lower_parent_path->dentry; lower_dir_mnt = lower_parent_path->mnt; - /* Use vfs_path_lookup to check if the dentry exists or not */ err = vfs_path_lookup(lower_dir_dentry, lower_dir_mnt, name, 0, &lower_path); + /* check for other cases */ + if (err == -ENOENT) { + struct dentry *child; + struct dentry *match = NULL; + spin_lock(&lower_dir_dentry->d_lock); + list_for_each_entry(child, &lower_dir_dentry->d_subdirs, d_u.d_child) { + if (child && child->d_inode) { + if (strcasecmp(child->d_name.name, name)==0) { + match = dget(child); + break; + } + } + } + spin_unlock(&lower_dir_dentry->d_lock); + if (match) { + err = vfs_path_lookup(lower_dir_dentry, + lower_dir_mnt, + match->d_name.name, 0, + &lower_path); + dput(match); + } + } /* no error: handle positive dentries */ if (!err) { @@ -365,11 +386,9 @@ struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry, if (dentry->d_inode) { fsstack_copy_attr_times(dentry->d_inode, sdcardfs_lower_inode(dentry->d_inode)); - /* get drived permission */ - mutex_lock(&dentry->d_inode->i_mutex); + /* get derived permission */ get_derived_permission(parent, dentry); fix_derived_permission(dentry->d_inode); - mutex_unlock(&dentry->d_inode->i_mutex); } /* update parent directory's atime */ fsstack_copy_attr_atime(parent->d_inode, diff --git a/fs/sdcardfs/main.c b/fs/sdcardfs/main.c index 8326e9838069..3666aef3e0f0 100755 --- a/fs/sdcardfs/main.c +++ b/fs/sdcardfs/main.c @@ -268,13 +268,13 @@ static int sdcardfs_read_super(struct super_block *sb, const char *dev_name, sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL); mutex_lock(&sdcardfs_super_list_lock); if(sb_info->options.multiuser) { - setup_derived_state(sb->s_root->d_inode, PERM_PRE_ROOT, sb_info->options.fs_user_id, AID_ROOT, false); + setup_derived_state(sb->s_root->d_inode, PERM_PRE_ROOT, sb_info->options.fs_user_id, AID_ROOT, false, sb->s_root->d_inode); snprintf(sb_info->obbpath_s, PATH_MAX, "%s/obb", dev_name); /*err = prepare_dir(sb_info->obbpath_s, sb_info->options.fs_low_uid, sb_info->options.fs_low_gid, 00755);*/ } else { - setup_derived_state(sb->s_root->d_inode, PERM_ROOT, sb_info->options.fs_user_id, AID_ROOT, false); + setup_derived_state(sb->s_root->d_inode, PERM_ROOT, sb_info->options.fs_user_id, AID_ROOT, false, sb->s_root->d_inode); snprintf(sb_info->obbpath_s, PATH_MAX, "%s/Android/obb", dev_name); } fix_derived_permission(sb->s_root->d_inode); diff --git a/fs/sdcardfs/packagelist.c b/fs/sdcardfs/packagelist.c index 0cf9c345d05e..d1961cf5677a 100755 --- a/fs/sdcardfs/packagelist.c +++ b/fs/sdcardfs/packagelist.c @@ -44,7 +44,7 @@ struct sb_list { struct packagelist_data { DECLARE_HASHTABLE(package_to_appid,8); - struct mutex hashtable_lock; + spinlock_t hashtable_lock; }; @@ -71,15 +71,15 @@ appid_t get_appid(void *pkgl_id, const char *app_name) unsigned int hash = str_hash(app_name); appid_t ret_id; - mutex_lock(&pkgl_dat->hashtable_lock); + spin_lock(&pkgl_dat->hashtable_lock); hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, hlist, hash) { if (!strcasecmp(app_name, hash_cur->key)) { ret_id = (appid_t)hash_cur->value; - mutex_unlock(&pkgl_dat->hashtable_lock); + spin_unlock(&pkgl_dat->hashtable_lock); return ret_id; } } - mutex_unlock(&pkgl_dat->hashtable_lock); + spin_unlock(&pkgl_dat->hashtable_lock); return 0; } @@ -133,20 +133,18 @@ static int insert_str_to_int_lock(struct packagelist_data *pkgl_dat, char *key, return 0; } } - new_entry = kmem_cache_alloc(hashtable_entry_cachep, GFP_KERNEL); + new_entry = kmem_cache_alloc(hashtable_entry_cachep, GFP_ATOMIC); if (!new_entry) return -ENOMEM; - new_entry->key = kstrdup(key, GFP_KERNEL); + new_entry->key = kstrdup(key, GFP_ATOMIC); new_entry->value = value; hash_add(pkgl_dat->package_to_appid, &new_entry->hlist, hash); return 0; } -static void fixup_perms(struct super_block *sb) { +static void fixup_perms(struct super_block *sb, const char *key) { if (sb && sb->s_magic == SDCARDFS_SUPER_MAGIC) { - mutex_lock(&sb->s_root->d_inode->i_mutex); - get_derive_permissions_recursive(sb->s_root); - mutex_unlock(&sb->s_root->d_inode->i_mutex); + fixup_perms_recursive(sb->s_root, key, strlen(key)); } } @@ -155,13 +153,13 @@ static int insert_str_to_int(struct packagelist_data *pkgl_dat, char *key, int ret; struct sdcardfs_sb_info *sbinfo; mutex_lock(&sdcardfs_super_list_lock); - mutex_lock(&pkgl_dat->hashtable_lock); + spin_lock(&pkgl_dat->hashtable_lock); ret = insert_str_to_int_lock(pkgl_dat, key, value); - mutex_unlock(&pkgl_dat->hashtable_lock); + spin_unlock(&pkgl_dat->hashtable_lock); list_for_each_entry(sbinfo, &sdcardfs_super_list, list) { if (sbinfo) { - fixup_perms(sbinfo->sb); + fixup_perms(sbinfo->sb, key); } } mutex_unlock(&sdcardfs_super_list_lock); @@ -180,17 +178,17 @@ static void remove_str_to_int(struct packagelist_data *pkgl_dat, const char *key struct hashtable_entry *hash_cur; unsigned int hash = str_hash(key); mutex_lock(&sdcardfs_super_list_lock); - mutex_lock(&pkgl_dat->hashtable_lock); + spin_lock(&pkgl_data_all->hashtable_lock); hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, hlist, hash) { if (!strcasecmp(key, hash_cur->key)) { remove_str_to_int_lock(hash_cur); break; } } - mutex_unlock(&pkgl_dat->hashtable_lock); + spin_unlock(&pkgl_data_all->hashtable_lock); list_for_each_entry(sbinfo, &sdcardfs_super_list, list) { if (sbinfo) { - fixup_perms(sbinfo->sb); + fixup_perms(sbinfo->sb, key); } } mutex_unlock(&sdcardfs_super_list_lock); @@ -202,10 +200,10 @@ static void remove_all_hashentrys(struct packagelist_data *pkgl_dat) struct hashtable_entry *hash_cur; struct hlist_node *h_t; int i; - mutex_lock(&pkgl_dat->hashtable_lock); + spin_lock(&pkgl_data_all->hashtable_lock); hash_for_each_safe(pkgl_dat->package_to_appid, i, h_t, hash_cur, hlist) remove_str_to_int_lock(hash_cur); - mutex_unlock(&pkgl_dat->hashtable_lock); + spin_unlock(&pkgl_data_all->hashtable_lock); hash_init(pkgl_dat->package_to_appid); } @@ -219,7 +217,7 @@ static struct packagelist_data * packagelist_create(void) return ERR_PTR(-ENOMEM); } - mutex_init(&pkgl_dat->hashtable_lock); + spin_lock_init(&pkgl_dat->hashtable_lock); hash_init(pkgl_dat->package_to_appid); return pkgl_dat; @@ -352,7 +350,7 @@ static ssize_t packages_attr_show(struct config_item *item, int count = 0, written = 0; char errormsg[] = "\n"; - mutex_lock(&pkgl_data_all->hashtable_lock); + spin_lock(&pkgl_data_all->hashtable_lock); hash_for_each_safe(pkgl_data_all->package_to_appid, i, h_t, hash_cur, hlist) { written = scnprintf(page + count, PAGE_SIZE - sizeof(errormsg) - count, "%s %d\n", (char *)hash_cur->key, hash_cur->value); if (count + written == PAGE_SIZE - sizeof(errormsg)) { @@ -361,7 +359,7 @@ static ssize_t packages_attr_show(struct config_item *item, } count += written; } - mutex_unlock(&pkgl_data_all->hashtable_lock); + spin_unlock(&pkgl_data_all->hashtable_lock); return count; } diff --git a/fs/sdcardfs/sdcardfs.h b/fs/sdcardfs/sdcardfs.h index 7f3dee3b1f1d..113d722b803b 100755 --- a/fs/sdcardfs/sdcardfs.h +++ b/fs/sdcardfs/sdcardfs.h @@ -169,6 +169,8 @@ struct sdcardfs_inode_info { userid_t userid; uid_t d_uid; bool under_android; + /* top folder for ownership */ + struct inode *top; struct inode vfs_inode; }; @@ -403,11 +405,12 @@ extern int packagelist_init(void); extern void packagelist_exit(void); /* for derived_perm.c */ -extern void setup_derived_state(struct inode *inode, perm_t perm, - userid_t userid, uid_t uid, bool under_android); +extern void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid, + uid_t uid, bool under_android, struct inode *top); extern void get_derived_permission(struct dentry *parent, struct dentry *dentry); extern void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, struct dentry *newdentry); -extern void get_derive_permissions_recursive(struct dentry *parent); +extern void fixup_top_recursive(struct dentry *parent); +extern void fixup_perms_recursive(struct dentry *dentry, const char *name, size_t len); extern void update_derived_permission_lock(struct dentry *dentry); extern int need_graft_path(struct dentry *dentry); diff --git a/include/dt-bindings/clock/msm-clocks-8936.h b/include/dt-bindings/clock/msm-clocks-8936.h index 78a9a2bfb1d6..fff648ab1337 100644 --- a/include/dt-bindings/clock/msm-clocks-8936.h +++ b/include/dt-bindings/clock/msm-clocks-8936.h @@ -197,6 +197,7 @@ #define clk_pixel_clk_src 0x8b6f83d8 #define clk_byte_clk_src 0x3a911c53 +#define clk_gcc_snoc_qosgen_clk 0x37d40ce2 /* clock_rpm controlled clocks */ #define clk_pcnoc_clk 0xc1296d0f diff --git a/include/linux/security.h b/include/linux/security.h index 3fd19934af2b..4b5df69059d5 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -2450,7 +2450,7 @@ static inline int security_task_prctl(int option, unsigned long arg2, unsigned long arg4, unsigned long arg5) { - return cap_task_prctl(option, arg2, arg3, arg3, arg5); + return cap_task_prctl(option, arg2, arg3, arg4, arg5); } static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) diff --git a/kernel/audit.c b/kernel/audit.c index a6c632757e57..9677a7f85bab 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -686,6 +686,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) return err; } if (status_get->mask & AUDIT_STATUS_PID) { + /* NOTE: we are using task_tgid_vnr() below because + * the s.pid value is relative to the namespace + * of the caller; at present this doesn't matter + * much since you can really only run auditd + * from the initial pid namespace, but something + * to keep in mind if this changes */ int new_pid = status_get->pid; if (audit_enabled != AUDIT_OFF) @@ -1617,7 +1623,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) " euid=%u suid=%u fsuid=%u" " egid=%u sgid=%u fsgid=%u ses=%u tty=%s", sys_getppid(), - tsk->pid, + task_tgid_nr(tsk), from_kuid(&init_user_ns, audit_get_loginuid(tsk)), from_kuid(&init_user_ns, cred->uid), from_kgid(&init_user_ns, cred->gid), diff --git a/kernel/auditsc.c b/kernel/auditsc.c index cabff35912d3..64791a23756a 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -469,7 +469,7 @@ static int audit_filter_rules(struct task_struct *tsk, switch (f->type) { case AUDIT_PID: - result = audit_comparator(tsk->pid, f->op, f->val); + result = audit_comparator(task_tgid_nr(tsk), f->op, f->val); break; case AUDIT_PPID: if (ctx) { @@ -2001,7 +2001,7 @@ int audit_set_loginuid(kuid_t loginuid) audit_log_format(ab, "login pid=%d uid=%u " "old auid=%u new auid=%u" " old ses=%u new ses=%u", - task->pid, + task_tgid_nr(task), from_kuid(&init_user_ns, task_uid(task)), from_kuid(&init_user_ns, task->loginuid), from_kuid(&init_user_ns, loginuid), @@ -2209,7 +2209,7 @@ void __audit_ptrace(struct task_struct *t) { struct audit_context *context = current->audit_context; - context->target_pid = t->pid; + context->target_pid = task_tgid_nr(t); context->target_auid = audit_get_loginuid(t); context->target_uid = task_uid(t); context->target_sessionid = audit_get_sessionid(t); @@ -2234,7 +2234,7 @@ int __audit_signal_info(int sig, struct task_struct *t) if (audit_pid && t->tgid == audit_pid) { if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) { - audit_sig_pid = tsk->pid; + audit_sig_pid = task_tgid_nr(tsk); if (uid_valid(tsk->loginuid)) audit_sig_uid = tsk->loginuid; else @@ -2339,7 +2339,7 @@ void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old) { struct audit_context *context = current->audit_context; - context->capset.pid = pid; + context->capset.pid = task_tgid_nr(current); context->capset.cap.effective = new->cap_effective; context->capset.cap.inheritable = new->cap_effective; context->capset.cap.permitted = new->cap_permitted; @@ -2370,7 +2370,7 @@ static void audit_log_task(struct audit_buffer *ab) from_kgid(&init_user_ns, gid), sessionid); audit_log_task_context(ab); - audit_log_format(ab, " pid=%d comm=", current->pid); + audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); audit_log_untrustedstring(ab, current->comm); } diff --git a/mm/memory.c b/mm/memory.c index 043058822837..3c519e09a348 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3268,6 +3268,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, pte_unmap(page_table); + /* File mapping without ->vm_ops ? */ + if (vma->vm_flags & VM_SHARED) + return VM_FAULT_SIGBUS; + /* Check if we need to add a guard page to the stack */ if (check_stack_guard_page(vma, address) < 0) return VM_FAULT_SIGBUS; @@ -3533,6 +3537,9 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; pte_unmap(page_table); + /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ + if (!vma->vm_ops->fault) + return VM_FAULT_SIGBUS; return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); } @@ -3744,11 +3751,9 @@ int handle_pte_fault(struct mm_struct *mm, entry = *pte; if (!pte_present(entry)) { if (pte_none(entry)) { - if (vma->vm_ops) { - if (likely(vma->vm_ops->fault)) - return do_linear_fault(mm, vma, address, + if (vma->vm_ops) + return do_linear_fault(mm, vma, address, pte, pmd, flags, entry); - } return do_anonymous_page(mm, vma, address, pte, pmd, flags); } diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 339139db680d..299e6c3aaa27 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -651,7 +651,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len, void *user_icmph, size_t icmph_len) { u8 type, code; - if (len > 0xFFFF) + if (len > 0xFFFF || len < icmph_len) return -EMSGSIZE; /* diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 9832d54571eb..5bd3ef750f7d 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -188,7 +188,7 @@ EXPORT_SYMBOL_GPL(nf_ct_invert_tuple); static void clean_from_lists(struct nf_conn *ct) { - pr_debug("clean_from_lists(%p)\n", ct); + pr_debug("clean_from_lists(%pK)\n", ct); hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode); hlist_nulls_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode); @@ -203,7 +203,7 @@ destroy_conntrack(struct nf_conntrack *nfct) struct net *net = nf_ct_net(ct); struct nf_conntrack_l4proto *l4proto; - pr_debug("destroy_conntrack(%p)\n", ct); + pr_debug("destroy_conntrack(%pK)\n", ct); NF_CT_ASSERT(atomic_read(&nfct->use) == 0); NF_CT_ASSERT(!timer_pending(&ct->timeout)); @@ -234,7 +234,7 @@ destroy_conntrack(struct nf_conntrack *nfct) if (ct->master) nf_ct_put(ct->master); - pr_debug("destroy_conntrack: returning ct=%p to slab\n", ct); + pr_debug("destroy_conntrack: returning ct=%pK to slab\n", ct); nf_conntrack_free(ct); } @@ -496,7 +496,7 @@ __nf_conntrack_confirm(struct sk_buff *skb) /* No external references means no one else could have confirmed us. */ NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); - pr_debug("Confirming conntrack %p\n", ct); + pr_debug("Confirming conntrack %pK\n", ct); spin_lock_bh(&nf_conntrack_lock); @@ -827,7 +827,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, spin_lock_bh(&nf_conntrack_lock); exp = nf_ct_find_expectation(net, zone, tuple); if (exp) { - pr_debug("conntrack: expectation arrives ct=%p exp=%p\n", + pr_debug("conntrack: expectation arrives ct=%pK exp=%pK\n", ct, exp); /* Welcome, Mr. Bond. We've been expecting you... */ __set_bit(IPS_EXPECTED_BIT, &ct->status); @@ -917,14 +917,14 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl, } else { /* Once we've had two way comms, always ESTABLISHED. */ if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { - pr_debug("nf_conntrack_in: normal packet for %p\n", ct); + pr_debug("nf_conntrack_in: normal packet for %pK\n", ct); *ctinfo = IP_CT_ESTABLISHED; } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { - pr_debug("nf_conntrack_in: related packet for %p\n", + pr_debug("nf_conntrack_in: related packet for %pK\n", ct); *ctinfo = IP_CT_RELATED; } else { - pr_debug("nf_conntrack_in: new packet for %p\n", ct); + pr_debug("nf_conntrack_in: new packet for %pK\n", ct); *ctinfo = IP_CT_NEW; } *set_reply = 0; @@ -1066,7 +1066,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct, /* Should be unconfirmed, so not in hash table yet */ NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); - pr_debug("Altering reply tuple of %p to ", ct); + pr_debug("Altering reply tuple of %pK to ", ct); nf_ct_dump_tuple(newreply); ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; @@ -1641,7 +1641,7 @@ int nf_conntrack_init_net(struct net *net) goto err_stat; } - net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%p", net); + net->ct.slabname = kasprintf(GFP_KERNEL, "nf_conntrack_%pK", net); if (!net->ct.slabname) { ret = -ENOMEM; goto err_slabname; diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index df9dfb6b473e..52a9e08556bf 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -3136,19 +3136,25 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv if (optlen != sizeof(val)) return -EINVAL; - if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) - return -EBUSY; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; switch (val) { case TPACKET_V1: case TPACKET_V2: case TPACKET_V3: - po->tp_version = val; - return 0; + break; default: return -EINVAL; } + lock_sock(sk); + if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { + ret = -EBUSY; + } else { + po->tp_version = val; + ret = 0; + } + release_sock(sk); + return ret; } case PACKET_RESERVE: { @@ -3603,6 +3609,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, /* Added to avoid minimal code churn */ struct tpacket_req *req = &req_u->req; + lock_sock(sk); /* Opening a Tx-ring is NOT supported in TPACKET_V3 */ if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) { WARN(1, "Tx-ring is not supported.\n"); @@ -3680,7 +3687,6 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, goto out; } - lock_sock(sk); /* Detach socket from network */ spin_lock(&po->bind_lock); @@ -3729,11 +3735,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, if (!tx_ring) prb_shutdown_retire_blk_timer(po, tx_ring, rb_queue); } - release_sock(sk); if (pg_vec) free_pg_vec(pg_vec, order, req->tp_block_nr); out: + release_sock(sk); return err; } diff --git a/security/lsm_audit.c b/security/lsm_audit.c index fe7d8636c393..4f021ad69762 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -222,7 +222,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, if (tsk->cred) audit_log_format(ab, " uid=%d", tsk->cred->uid); - audit_log_format(ab, " pid=%d comm=", tsk->pid); + audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); audit_log_untrustedstring(ab, tsk->comm); switch (a->type) { @@ -298,7 +298,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, if (tsk && tsk->pid) { if (tsk->cred) audit_log_format(ab, " uid=%d", tsk->cred->uid); - audit_log_format(ab, " pid=%d comm=", tsk->pid); + audit_log_format(ab, " pid=%d comm=", task_tgid_nr(tsk)); audit_log_untrustedstring(ab, tsk->comm); } break;