Merge "Merge android-4.4.167 (ad9ce19
) into msm-4.4"
This commit is contained in:
commit
361feeef4f
114 changed files with 1134 additions and 400 deletions
5
Makefile
5
Makefile
|
@ -1,6 +1,6 @@
|
|||
VERSION = 4
|
||||
PATCHLEVEL = 4
|
||||
SUBLEVEL = 166
|
||||
SUBLEVEL = 167
|
||||
EXTRAVERSION =
|
||||
NAME = Blurry Fish Butt
|
||||
|
||||
|
@ -814,6 +814,9 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
|||
# disable pointer signed / unsigned warnings in gcc 4.0
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
|
||||
|
||||
# disable stringop warnings in gcc 8+
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
|
||||
|
||||
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ endmenu
|
|||
|
||||
choice
|
||||
prompt "ARC Instruction Set"
|
||||
default ISA_ARCOMPACT
|
||||
default ISA_ARCV2
|
||||
|
||||
config ISA_ARCOMPACT
|
||||
bool "ARCompact ISA"
|
||||
|
|
|
@ -12,7 +12,7 @@ ifeq ($(CROSS_COMPILE),)
|
|||
CROSS_COMPILE := arc-linux-
|
||||
endif
|
||||
|
||||
KBUILD_DEFCONFIG := nsim_700_defconfig
|
||||
KBUILD_DEFCONFIG := nsim_hs_defconfig
|
||||
|
||||
cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
|
||||
cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
|
||||
|
|
|
@ -17,6 +17,7 @@ CONFIG_PERF_EVENTS=y
|
|||
# CONFIG_VM_EVENT_COUNTERS is not set
|
||||
# CONFIG_SLUB_DEBUG is not set
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_ISA_ARCOMPACT=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_PARTITION_ADVANCED=y
|
||||
CONFIG_ARC_PLAT_AXS10X=y
|
||||
|
@ -97,6 +98,7 @@ CONFIG_NTFS_FS=y
|
|||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
|
|
|
@ -103,6 +103,7 @@ CONFIG_NTFS_FS=y
|
|||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
|
|
|
@ -104,6 +104,7 @@ CONFIG_NTFS_FS=y
|
|||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
|
|
|
@ -16,6 +16,7 @@ CONFIG_KALLSYMS_ALL=y
|
|||
CONFIG_EMBEDDED=y
|
||||
# CONFIG_SLUB_DEBUG is not set
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_ISA_ARCOMPACT=y
|
||||
CONFIG_KPROBES=y
|
||||
CONFIG_MODULES=y
|
||||
# CONFIG_LBDAF is not set
|
||||
|
|
|
@ -17,6 +17,7 @@ CONFIG_KALLSYMS_ALL=y
|
|||
CONFIG_EMBEDDED=y
|
||||
# CONFIG_SLUB_DEBUG is not set
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_ISA_ARCOMPACT=y
|
||||
CONFIG_KPROBES=y
|
||||
CONFIG_MODULES=y
|
||||
# CONFIG_LBDAF is not set
|
||||
|
@ -69,5 +70,6 @@ CONFIG_EXT2_FS_XATTR=y
|
|||
CONFIG_TMPFS=y
|
||||
# CONFIG_MISC_FILESYSTEMS is not set
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
|
|
|
@ -69,5 +69,6 @@ CONFIG_EXT2_FS_XATTR=y
|
|||
CONFIG_TMPFS=y
|
||||
# CONFIG_MISC_FILESYSTEMS is not set
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
|
|
|
@ -88,6 +88,7 @@ CONFIG_EXT2_FS_XATTR=y
|
|||
CONFIG_TMPFS=y
|
||||
# CONFIG_MISC_FILESYSTEMS is not set
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
CONFIG_FTRACE=y
|
||||
|
|
|
@ -19,6 +19,7 @@ CONFIG_KALLSYMS_ALL=y
|
|||
# CONFIG_AIO is not set
|
||||
CONFIG_EMBEDDED=y
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_ISA_ARCOMPACT=y
|
||||
CONFIG_SLAB=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_FORCE_LOAD=y
|
||||
|
|
|
@ -89,6 +89,7 @@ CONFIG_NTFS_FS=y
|
|||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
|
|
|
@ -91,6 +91,7 @@ CONFIG_NTFS_FS=y
|
|||
CONFIG_TMPFS=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3_ACL=y
|
||||
CONFIG_NLS_CODEPAGE_437=y
|
||||
CONFIG_NLS_ISO8859_1=y
|
||||
# CONFIG_ENABLE_WARN_DEPRECATED is not set
|
||||
|
|
|
@ -227,6 +227,7 @@ CONFIG_USB_USBNET=y
|
|||
# CONFIG_USB_NET_NET1080 is not set
|
||||
# CONFIG_USB_NET_CDC_SUBSET is not set
|
||||
# CONFIG_USB_NET_ZAURUS is not set
|
||||
CONFIG_VIRT_WIFI=y
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_INPUT_KEYRESET=y
|
||||
# CONFIG_INPUT_KEYBOARD is not set
|
||||
|
|
|
@ -51,7 +51,7 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
|
|||
#ifdef CONFIG_64BIT
|
||||
case 4: case 5: case 6: case 7:
|
||||
#ifdef CONFIG_MIPS32_O32
|
||||
if (test_thread_flag(TIF_32BIT_REGS))
|
||||
if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
|
||||
return get_user(*arg, (int *)usp + n);
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -81,7 +81,7 @@ static struct rt2880_pmx_func pcie_rst_grp[] = {
|
|||
};
|
||||
static struct rt2880_pmx_func nd_sd_grp[] = {
|
||||
FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15),
|
||||
FUNC("sd", MT7620_GPIO_MODE_SD, 45, 15)
|
||||
FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13)
|
||||
};
|
||||
|
||||
static struct rt2880_pmx_group mt7620a_pinmux_data[] = {
|
||||
|
|
|
@ -247,6 +247,7 @@ CONFIG_USB_USBNET=y
|
|||
# CONFIG_USB_NET_CDC_SUBSET is not set
|
||||
# CONFIG_USB_NET_ZAURUS is not set
|
||||
CONFIG_MAC80211_HWSIM=y
|
||||
CONFIG_VIRT_WIFI=y
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_INPUT_KEYRESET=y
|
||||
# CONFIG_INPUT_KEYBOARD is not set
|
||||
|
|
|
@ -4174,9 +4174,9 @@ static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, bool zap_page,
|
|||
}
|
||||
|
||||
static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa,
|
||||
const u8 *new, int *bytes)
|
||||
int *bytes)
|
||||
{
|
||||
u64 gentry;
|
||||
u64 gentry = 0;
|
||||
int r;
|
||||
|
||||
/*
|
||||
|
@ -4188,22 +4188,12 @@ static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa,
|
|||
/* Handle a 32-bit guest writing two halves of a 64-bit gpte */
|
||||
*gpa &= ~(gpa_t)7;
|
||||
*bytes = 8;
|
||||
r = kvm_vcpu_read_guest(vcpu, *gpa, &gentry, 8);
|
||||
if (r)
|
||||
gentry = 0;
|
||||
new = (const u8 *)&gentry;
|
||||
}
|
||||
|
||||
switch (*bytes) {
|
||||
case 4:
|
||||
gentry = *(const u32 *)new;
|
||||
break;
|
||||
case 8:
|
||||
gentry = *(const u64 *)new;
|
||||
break;
|
||||
default:
|
||||
gentry = 0;
|
||||
break;
|
||||
if (*bytes == 4 || *bytes == 8) {
|
||||
r = kvm_vcpu_read_guest_atomic(vcpu, *gpa, &gentry, *bytes);
|
||||
if (r)
|
||||
gentry = 0;
|
||||
}
|
||||
|
||||
return gentry;
|
||||
|
@ -4313,8 +4303,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
|
|||
|
||||
pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes);
|
||||
|
||||
gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, new, &bytes);
|
||||
|
||||
/*
|
||||
* No need to care whether allocation memory is successful
|
||||
* or not since pte prefetch is skiped if it does not have
|
||||
|
@ -4323,6 +4311,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
|
|||
mmu_topup_memory_caches(vcpu);
|
||||
|
||||
spin_lock(&vcpu->kvm->mmu_lock);
|
||||
|
||||
gentry = mmu_pte_write_fetch_gpte(vcpu, &gpa, &bytes);
|
||||
|
||||
++vcpu->kvm->stat.mmu_pte_write;
|
||||
kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE);
|
||||
|
||||
|
|
|
@ -90,14 +90,14 @@ int main(void)
|
|||
DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
|
||||
DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
|
||||
#if XTENSA_HAVE_COPROCESSORS
|
||||
DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp));
|
||||
DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0));
|
||||
DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1));
|
||||
DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2));
|
||||
DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3));
|
||||
DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4));
|
||||
DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5));
|
||||
DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6));
|
||||
DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7));
|
||||
#endif
|
||||
DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
|
||||
DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
|
||||
|
|
|
@ -83,18 +83,21 @@ void coprocessor_release_all(struct thread_info *ti)
|
|||
|
||||
void coprocessor_flush_all(struct thread_info *ti)
|
||||
{
|
||||
unsigned long cpenable;
|
||||
unsigned long cpenable, old_cpenable;
|
||||
int i;
|
||||
|
||||
preempt_disable();
|
||||
|
||||
RSR_CPENABLE(old_cpenable);
|
||||
cpenable = ti->cpenable;
|
||||
WSR_CPENABLE(cpenable);
|
||||
|
||||
for (i = 0; i < XCHAL_CP_MAX; i++) {
|
||||
if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti)
|
||||
coprocessor_flush(ti, i);
|
||||
cpenable >>= 1;
|
||||
}
|
||||
WSR_CPENABLE(old_cpenable);
|
||||
|
||||
preempt_enable();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ DEFCONFIG=cuttlefish_defconfig
|
|||
EXTRA_CMDS=''
|
||||
KERNEL_DIR=common
|
||||
POST_DEFCONFIG_CMDS="check_defconfig"
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r328903/bin
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r346389b/bin
|
||||
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
|
||||
FILES="
|
||||
arch/arm64/boot/Image.gz
|
||||
|
|
|
@ -6,7 +6,7 @@ DEFCONFIG=x86_64_cuttlefish_defconfig
|
|||
EXTRA_CMDS=''
|
||||
KERNEL_DIR=common
|
||||
POST_DEFCONFIG_CMDS="check_defconfig"
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r328903/bin
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r346389b/bin
|
||||
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
|
||||
FILES="
|
||||
arch/x86/boot/bzImage
|
||||
|
|
|
@ -3138,7 +3138,6 @@ static void binder_transaction(struct binder_proc *proc,
|
|||
t->buffer = NULL;
|
||||
goto err_binder_alloc_buf_failed;
|
||||
}
|
||||
t->buffer->allow_user_free = 0;
|
||||
t->buffer->debug_id = t->debug_id;
|
||||
t->buffer->transaction = t;
|
||||
t->buffer->target_node = target_node;
|
||||
|
@ -3634,14 +3633,18 @@ static int binder_thread_write(struct binder_proc *proc,
|
|||
|
||||
buffer = binder_alloc_prepare_to_free(&proc->alloc,
|
||||
data_ptr);
|
||||
if (buffer == NULL) {
|
||||
binder_user_error("%d:%d BC_FREE_BUFFER u%016llx no match\n",
|
||||
proc->pid, thread->pid, (u64)data_ptr);
|
||||
break;
|
||||
}
|
||||
if (!buffer->allow_user_free) {
|
||||
binder_user_error("%d:%d BC_FREE_BUFFER u%016llx matched unreturned buffer\n",
|
||||
proc->pid, thread->pid, (u64)data_ptr);
|
||||
if (IS_ERR_OR_NULL(buffer)) {
|
||||
if (PTR_ERR(buffer) == -EPERM) {
|
||||
binder_user_error(
|
||||
"%d:%d BC_FREE_BUFFER u%016llx matched unreturned or currently freeing buffer\n",
|
||||
proc->pid, thread->pid,
|
||||
(u64)data_ptr);
|
||||
} else {
|
||||
binder_user_error(
|
||||
"%d:%d BC_FREE_BUFFER u%016llx no match\n",
|
||||
proc->pid, thread->pid,
|
||||
(u64)data_ptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
binder_debug(BINDER_DEBUG_FREE_BUFFER,
|
||||
|
|
|
@ -149,14 +149,12 @@ static struct binder_buffer *binder_alloc_prepare_to_free_locked(
|
|||
else {
|
||||
/*
|
||||
* Guard against user threads attempting to
|
||||
* free the buffer twice
|
||||
* free the buffer when in use by kernel or
|
||||
* after it's already been freed.
|
||||
*/
|
||||
if (buffer->free_in_progress) {
|
||||
pr_err("%d:%d FREE_BUFFER u%016llx user freed buffer twice\n",
|
||||
alloc->pid, current->pid, (u64)user_ptr);
|
||||
return NULL;
|
||||
}
|
||||
buffer->free_in_progress = 1;
|
||||
if (!buffer->allow_user_free)
|
||||
return ERR_PTR(-EPERM);
|
||||
buffer->allow_user_free = 0;
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +461,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
|
|||
|
||||
rb_erase(best_fit, &alloc->free_buffers);
|
||||
buffer->free = 0;
|
||||
buffer->free_in_progress = 0;
|
||||
buffer->allow_user_free = 0;
|
||||
binder_insert_allocated_buffer_locked(alloc, buffer);
|
||||
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,
|
||||
"%d: binder_alloc_buf size %zd got %pK\n",
|
||||
|
|
|
@ -50,8 +50,7 @@ struct binder_buffer {
|
|||
unsigned free:1;
|
||||
unsigned allow_user_free:1;
|
||||
unsigned async_transaction:1;
|
||||
unsigned free_in_progress:1;
|
||||
unsigned debug_id:28;
|
||||
unsigned debug_id:29;
|
||||
|
||||
struct binder_transaction *transaction;
|
||||
|
||||
|
|
|
@ -1781,6 +1781,12 @@ static void atc_free_chan_resources(struct dma_chan *chan)
|
|||
atchan->descs_allocated = 0;
|
||||
atchan->status = 0;
|
||||
|
||||
/*
|
||||
* Free atslave allocated in at_dma_xlate()
|
||||
*/
|
||||
kfree(chan->private);
|
||||
chan->private = NULL;
|
||||
|
||||
dev_vdbg(chan2dev(chan), "free_chan_resources: done\n");
|
||||
}
|
||||
|
||||
|
@ -1815,7 +1821,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
|
|||
dma_cap_zero(mask);
|
||||
dma_cap_set(DMA_SLAVE, mask);
|
||||
|
||||
atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL);
|
||||
atslave = kzalloc(sizeof(*atslave), GFP_KERNEL);
|
||||
if (!atslave)
|
||||
return NULL;
|
||||
|
||||
|
@ -2146,6 +2152,8 @@ static int at_dma_remove(struct platform_device *pdev)
|
|||
struct resource *io;
|
||||
|
||||
at_dma_off(atdma);
|
||||
if (pdev->dev.of_node)
|
||||
of_dma_controller_free(pdev->dev.of_node);
|
||||
dma_async_device_unregister(&atdma->dma_common);
|
||||
|
||||
dma_pool_destroy(atdma->memset_pool);
|
||||
|
|
|
@ -557,7 +557,8 @@ int ast_driver_unload(struct drm_device *dev)
|
|||
drm_mode_config_cleanup(dev);
|
||||
|
||||
ast_mm_fini(ast);
|
||||
pci_iounmap(dev->pdev, ast->ioregs);
|
||||
if (ast->ioregs != ast->regs + AST_IO_MM_OFFSET)
|
||||
pci_iounmap(dev->pdev, ast->ioregs);
|
||||
pci_iounmap(dev->pdev, ast->regs);
|
||||
kfree(ast);
|
||||
return 0;
|
||||
|
|
|
@ -99,7 +99,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe)
|
|||
/* Wait for for the pipe enable to take effect. */
|
||||
for (count = 0; count < COUNT_MAX; count++) {
|
||||
temp = REG_READ(map->conf);
|
||||
if ((temp & PIPEACONF_PIPE_STATE) == 1)
|
||||
if (temp & PIPEACONF_PIPE_STATE)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1289,7 +1289,9 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task,
|
|||
IB_MR_CHECK_SIG_STATUS, &mr_status);
|
||||
if (ret) {
|
||||
pr_err("ib_check_mr_status failed, ret %d\n", ret);
|
||||
goto err;
|
||||
/* Not a lot we can do, return ambiguous guard error */
|
||||
*sector = 0;
|
||||
return 0x1;
|
||||
}
|
||||
|
||||
if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) {
|
||||
|
@ -1317,7 +1319,4 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task,
|
|||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
/* Not alot we can do here, return ambiguous guard error */
|
||||
return 0x1;
|
||||
}
|
||||
|
|
|
@ -483,18 +483,18 @@ static const u8 xboxone_hori_init[] = {
|
|||
};
|
||||
|
||||
/*
|
||||
* This packet is required for some of the PDP pads to start
|
||||
* This packet is required for most (all?) of the PDP pads to start
|
||||
* sending input reports. These pads include: (0x0e6f:0x02ab),
|
||||
* (0x0e6f:0x02a4).
|
||||
* (0x0e6f:0x02a4), (0x0e6f:0x02a6).
|
||||
*/
|
||||
static const u8 xboxone_pdp_init1[] = {
|
||||
0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14
|
||||
};
|
||||
|
||||
/*
|
||||
* This packet is required for some of the PDP pads to start
|
||||
* This packet is required for most (all?) of the PDP pads to start
|
||||
* sending input reports. These pads include: (0x0e6f:0x02ab),
|
||||
* (0x0e6f:0x02a4).
|
||||
* (0x0e6f:0x02a4), (0x0e6f:0x02a6).
|
||||
*/
|
||||
static const u8 xboxone_pdp_init2[] = {
|
||||
0x06, 0x20, 0x00, 0x02, 0x01, 0x00
|
||||
|
@ -530,12 +530,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
|
|||
XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
|
||||
XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
|
||||
XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),
|
||||
XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),
|
||||
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
|
||||
XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
|
||||
XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
|
||||
|
|
|
@ -405,7 +405,7 @@ matrix_keypad_parse_dt(struct device *dev)
|
|||
struct matrix_keypad_platform_data *pdata;
|
||||
struct device_node *np = dev->of_node;
|
||||
unsigned int *gpios;
|
||||
int i, nrow, ncol;
|
||||
int ret, i, nrow, ncol;
|
||||
|
||||
if (!np) {
|
||||
dev_err(dev, "device lacks DT data\n");
|
||||
|
@ -447,12 +447,19 @@ matrix_keypad_parse_dt(struct device *dev)
|
|||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
for (i = 0; i < pdata->num_row_gpios; i++)
|
||||
gpios[i] = of_get_named_gpio(np, "row-gpios", i);
|
||||
for (i = 0; i < nrow; i++) {
|
||||
ret = of_get_named_gpio(np, "row-gpios", i);
|
||||
if (ret < 0)
|
||||
return ERR_PTR(ret);
|
||||
gpios[i] = ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < pdata->num_col_gpios; i++)
|
||||
gpios[pdata->num_row_gpios + i] =
|
||||
of_get_named_gpio(np, "col-gpios", i);
|
||||
for (i = 0; i < ncol; i++) {
|
||||
ret = of_get_named_gpio(np, "col-gpios", i);
|
||||
if (ret < 0)
|
||||
return ERR_PTR(ret);
|
||||
gpios[nrow + i] = ret;
|
||||
}
|
||||
|
||||
pdata->row_gpios = gpios;
|
||||
pdata->col_gpios = &gpios[pdata->num_row_gpios];
|
||||
|
@ -479,10 +486,8 @@ static int matrix_keypad_probe(struct platform_device *pdev)
|
|||
pdata = dev_get_platdata(&pdev->dev);
|
||||
if (!pdata) {
|
||||
pdata = matrix_keypad_parse_dt(&pdev->dev);
|
||||
if (IS_ERR(pdata)) {
|
||||
dev_err(&pdev->dev, "no platform data defined\n");
|
||||
if (IS_ERR(pdata))
|
||||
return PTR_ERR(pdata);
|
||||
}
|
||||
} else if (!pdata->keymap_data) {
|
||||
dev_err(&pdev->dev, "no keymap data defined\n");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -1253,6 +1253,9 @@ static const struct acpi_device_id elan_acpi_id[] = {
|
|||
{ "ELAN0618", 0 },
|
||||
{ "ELAN061C", 0 },
|
||||
{ "ELAN061D", 0 },
|
||||
{ "ELAN061E", 0 },
|
||||
{ "ELAN0620", 0 },
|
||||
{ "ELAN0621", 0 },
|
||||
{ "ELAN0622", 0 },
|
||||
{ "ELAN1000", 0 },
|
||||
{ }
|
||||
|
|
|
@ -2977,7 +2977,7 @@ static int copy_context_table(struct intel_iommu *iommu,
|
|||
}
|
||||
|
||||
if (old_ce)
|
||||
iounmap(old_ce);
|
||||
memunmap(old_ce);
|
||||
|
||||
ret = 0;
|
||||
if (devfn < 0x80)
|
||||
|
|
|
@ -558,7 +558,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)
|
|||
pr_err("%s: Page request without PASID: %08llx %08llx\n",
|
||||
iommu->name, ((unsigned long long *)req)[0],
|
||||
((unsigned long long *)req)[1]);
|
||||
goto bad_req;
|
||||
goto no_pasid;
|
||||
}
|
||||
|
||||
if (!svm || svm->pasid != req->pasid) {
|
||||
|
|
|
@ -372,6 +372,9 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain)
|
|||
|
||||
static void ipmmu_domain_destroy_context(struct ipmmu_vmsa_domain *domain)
|
||||
{
|
||||
if (!domain->mmu)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Disable the context. Flush the TLB as required when modifying the
|
||||
* context registers.
|
||||
|
|
|
@ -265,12 +265,13 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
|
|||
up_write(&led_cdev->trigger_lock);
|
||||
#endif
|
||||
|
||||
cancel_work_sync(&led_cdev->set_brightness_work);
|
||||
|
||||
/* Stop blinking */
|
||||
led_stop_software_blink(led_cdev);
|
||||
|
||||
led_set_brightness(led_cdev, LED_OFF);
|
||||
|
||||
flush_work(&led_cdev->set_brightness_work);
|
||||
|
||||
device_unregister(led_cdev->dev);
|
||||
|
||||
down_write(&leds_list_lock);
|
||||
|
|
|
@ -118,8 +118,8 @@ static int create_gpio_led(const struct gpio_led *template,
|
|||
return ret;
|
||||
|
||||
led_dat->gpiod = gpio_to_desc(template->gpio);
|
||||
if (IS_ERR(led_dat->gpiod))
|
||||
return PTR_ERR(led_dat->gpiod);
|
||||
if (!led_dat->gpiod)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
led_dat->cdev.name = template->name;
|
||||
|
|
|
@ -132,6 +132,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
|
|||
ret = led_classdev_register(dev, &led_data->cdev);
|
||||
if (ret == 0) {
|
||||
priv->num_leds++;
|
||||
led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
|
||||
} else {
|
||||
dev_err(dev, "failed to register PWM led for %s: %d\n",
|
||||
led->name, ret);
|
||||
|
|
|
@ -1806,6 +1806,8 @@ static int em28xx_dvb_fini(struct em28xx *dev)
|
|||
}
|
||||
}
|
||||
|
||||
em28xx_unregister_dvb(dvb);
|
||||
|
||||
/* remove I2C SEC */
|
||||
client = dvb->i2c_client_sec;
|
||||
if (client) {
|
||||
|
@ -1827,7 +1829,6 @@ static int em28xx_dvb_fini(struct em28xx *dev)
|
|||
i2c_unregister_device(client);
|
||||
}
|
||||
|
||||
em28xx_unregister_dvb(dvb);
|
||||
kfree(dvb);
|
||||
dev->dvb = NULL;
|
||||
kref_put(&dev->ref, em28xx_free_device);
|
||||
|
|
|
@ -414,7 +414,7 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev,
|
|||
if (err)
|
||||
goto error_window;
|
||||
err = scif_map_page(&window->num_pages_lookup.lookup[j],
|
||||
vmalloc_dma_phys ?
|
||||
vmalloc_num_pages ?
|
||||
vmalloc_to_page(&window->num_pages[i]) :
|
||||
virt_to_page(&window->num_pages[i]),
|
||||
remote_dev);
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#define RCAR_CAN_DRV_NAME "rcar_can"
|
||||
|
||||
#define RCAR_SUPPORTED_CLOCKS (BIT(CLKR_CLKP1) | BIT(CLKR_CLKP2) | \
|
||||
BIT(CLKR_CLKEXT))
|
||||
|
||||
/* Mailbox configuration:
|
||||
* mailbox 60 - 63 - Rx FIFO mailboxes
|
||||
* mailbox 56 - 59 - Tx FIFO mailboxes
|
||||
|
@ -789,7 +792,7 @@ static int rcar_can_probe(struct platform_device *pdev)
|
|||
goto fail_clk;
|
||||
}
|
||||
|
||||
if (clock_select >= ARRAY_SIZE(clock_names)) {
|
||||
if (!(BIT(clock_select) & RCAR_SUPPORTED_CLOCKS)) {
|
||||
err = -EINVAL;
|
||||
dev_err(&pdev->dev, "invalid CAN clock selected\n");
|
||||
goto fail_clk;
|
||||
|
|
|
@ -1419,7 +1419,7 @@ static int sparc_lance_probe_one(struct platform_device *op,
|
|||
|
||||
prop = of_get_property(nd, "tpe-link-test?", NULL);
|
||||
if (!prop)
|
||||
goto no_link_test;
|
||||
goto node_put;
|
||||
|
||||
if (strcmp(prop, "true")) {
|
||||
printk(KERN_NOTICE "SunLance: warning: overriding option "
|
||||
|
@ -1428,6 +1428,8 @@ static int sparc_lance_probe_one(struct platform_device *op,
|
|||
"to ecd@skynet.be\n");
|
||||
auxio_set_lte(AUXIO_LTE_ON);
|
||||
}
|
||||
node_put:
|
||||
of_node_put(nd);
|
||||
no_link_test:
|
||||
lp->auto_select = 1;
|
||||
lp->tpe = 0;
|
||||
|
|
|
@ -2291,6 +2291,13 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
|
|||
#define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \
|
||||
E1HVN_MAX)
|
||||
|
||||
/* Following is the DMAE channel number allocation for the clients.
|
||||
* MFW: OCBB/OCSD implementations use DMAE channels 14/15 respectively.
|
||||
* Driver: 0-3 and 8-11 (for PF dmae operations)
|
||||
* 4 and 12 (for stats requests)
|
||||
*/
|
||||
#define BNX2X_FW_DMAE_C 13 /* Channel for FW DMAE operations */
|
||||
|
||||
/* PCIE link and speed */
|
||||
#define PCICFG_LINK_WIDTH 0x1f00000
|
||||
#define PCICFG_LINK_WIDTH_SHIFT 20
|
||||
|
|
|
@ -5931,6 +5931,7 @@ static inline int bnx2x_func_send_start(struct bnx2x *bp,
|
|||
rdata->sd_vlan_tag = cpu_to_le16(start_params->sd_vlan_tag);
|
||||
rdata->path_id = BP_PATH(bp);
|
||||
rdata->network_cos_mode = start_params->network_cos_mode;
|
||||
rdata->dmae_cmd_id = BNX2X_FW_DMAE_C;
|
||||
|
||||
rdata->vxlan_dst_port = cpu_to_le16(start_params->vxlan_dst_port);
|
||||
rdata->geneve_dst_port = cpu_to_le16(start_params->geneve_dst_port);
|
||||
|
|
|
@ -865,11 +865,10 @@ static irqreturn_t ftmac100_interrupt(int irq, void *dev_id)
|
|||
struct net_device *netdev = dev_id;
|
||||
struct ftmac100 *priv = netdev_priv(netdev);
|
||||
|
||||
if (likely(netif_running(netdev))) {
|
||||
/* Disable interrupts for polling */
|
||||
ftmac100_disable_all_int(priv);
|
||||
/* Disable interrupts for polling */
|
||||
ftmac100_disable_all_int(priv);
|
||||
if (likely(netif_running(netdev)))
|
||||
napi_schedule(&priv->napi);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@ void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc)
|
|||
static u32 __mlx4_alloc_from_zone(struct mlx4_zone_entry *zone, int count,
|
||||
int align, u32 skip_mask, u32 *puid)
|
||||
{
|
||||
u32 uid;
|
||||
u32 uid = 0;
|
||||
u32 res;
|
||||
struct mlx4_zone_allocator *zone_alloc = zone->allocator;
|
||||
struct mlx4_zone_entry *curr_node;
|
||||
|
|
|
@ -537,8 +537,8 @@ struct slave_list {
|
|||
struct resource_allocator {
|
||||
spinlock_t alloc_lock; /* protect quotas */
|
||||
union {
|
||||
int res_reserved;
|
||||
int res_port_rsvd[MLX4_MAX_PORTS];
|
||||
unsigned int res_reserved;
|
||||
unsigned int res_port_rsvd[MLX4_MAX_PORTS];
|
||||
};
|
||||
union {
|
||||
int res_free;
|
||||
|
|
|
@ -366,6 +366,7 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
|
|||
container_of((void *)mpt_entry, struct mlx4_cmd_mailbox,
|
||||
buf);
|
||||
|
||||
(*mpt_entry)->lkey = 0;
|
||||
err = mlx4_SW2HW_MPT(dev, mailbox, key);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn)
|
|||
*/
|
||||
do {
|
||||
index = p_sb_attn->sb_index;
|
||||
/* finish reading index before the loop condition */
|
||||
dma_rmb();
|
||||
attn_bits = le32_to_cpu(p_sb_attn->atten_bits);
|
||||
attn_acks = le32_to_cpu(p_sb_attn->atten_ack);
|
||||
} while (index != p_sb_attn->sb_index);
|
||||
|
|
|
@ -1124,9 +1124,9 @@ static int qed_drain(struct qed_dev *cdev)
|
|||
return -EBUSY;
|
||||
}
|
||||
rc = qed_mcp_drain(hwfn, ptt);
|
||||
qed_ptt_release(hwfn, ptt);
|
||||
if (rc)
|
||||
return rc;
|
||||
qed_ptt_release(hwfn, ptt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -215,9 +215,9 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
|||
* it just report sending a packet to the target
|
||||
* (without actual packet transfer).
|
||||
*/
|
||||
dev_kfree_skb_any(skb);
|
||||
ndev->stats.tx_packets++;
|
||||
ndev->stats.tx_bytes += skb->len;
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ struct ipheth_device {
|
|||
struct usb_device *udev;
|
||||
struct usb_interface *intf;
|
||||
struct net_device *net;
|
||||
struct sk_buff *tx_skb;
|
||||
struct urb *tx_urb;
|
||||
struct urb *rx_urb;
|
||||
unsigned char *tx_buf;
|
||||
|
@ -229,6 +228,7 @@ static void ipheth_rcvbulk_callback(struct urb *urb)
|
|||
case -ENOENT:
|
||||
case -ECONNRESET:
|
||||
case -ESHUTDOWN:
|
||||
case -EPROTO:
|
||||
return;
|
||||
case 0:
|
||||
break;
|
||||
|
@ -280,7 +280,6 @@ static void ipheth_sndbulk_callback(struct urb *urb)
|
|||
dev_err(&dev->intf->dev, "%s: urb status: %d\n",
|
||||
__func__, status);
|
||||
|
||||
dev_kfree_skb_irq(dev->tx_skb);
|
||||
netif_wake_queue(dev->net);
|
||||
}
|
||||
|
||||
|
@ -410,7 +409,7 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net)
|
|||
if (skb->len > IPHETH_BUF_SIZE) {
|
||||
WARN(1, "%s: skb too large: %d bytes\n", __func__, skb->len);
|
||||
dev->net->stats.tx_dropped++;
|
||||
dev_kfree_skb_irq(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
|
@ -430,12 +429,11 @@ static int ipheth_tx(struct sk_buff *skb, struct net_device *net)
|
|||
dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n",
|
||||
__func__, retval);
|
||||
dev->net->stats.tx_errors++;
|
||||
dev_kfree_skb_irq(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
} else {
|
||||
dev->tx_skb = skb;
|
||||
|
||||
dev->net->stats.tx_packets++;
|
||||
dev->net->stats.tx_bytes += skb->len;
|
||||
dev_consume_skb_any(skb);
|
||||
netif_stop_queue(net);
|
||||
}
|
||||
|
||||
|
|
|
@ -256,6 +256,13 @@ config MAC80211_HWSIM
|
|||
To compile this driver as a module, choose M here: the module will be
|
||||
called mac80211_hwsim. If unsure, say N.
|
||||
|
||||
config VIRT_WIFI
|
||||
tristate "Wifi wrapper for ethernet drivers"
|
||||
depends on CFG80211
|
||||
---help---
|
||||
This option adds support for ethernet connections to appear as if they
|
||||
are wifi connections through a special rtnetlink device.
|
||||
|
||||
config MWL8K
|
||||
tristate "Marvell 88W8xxx PCI/PCIe Wireless support"
|
||||
depends on MAC80211 && PCI
|
||||
|
|
|
@ -51,6 +51,8 @@ obj-$(CONFIG_ATH_CARDS) += ath/
|
|||
|
||||
obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
|
||||
|
||||
obj-$(CONFIG_VIRT_WIFI) += virt_wifi.o
|
||||
|
||||
obj-$(CONFIG_WL_TI) += ti/
|
||||
|
||||
obj-$(CONFIG_MWIFIEX) += mwifiex/
|
||||
|
|
|
@ -2515,6 +2515,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
|
|||
if (param->no_vif)
|
||||
ieee80211_hw_set(hw, NO_AUTO_VIF);
|
||||
|
||||
tasklet_hrtimer_init(&data->beacon_timer,
|
||||
mac80211_hwsim_beacon,
|
||||
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
|
||||
|
||||
err = ieee80211_register_hw(hw);
|
||||
if (err < 0) {
|
||||
printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
|
||||
|
@ -2539,10 +2543,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
|
|||
data->debugfs,
|
||||
data, &hwsim_simulate_radar);
|
||||
|
||||
tasklet_hrtimer_init(&data->beacon_timer,
|
||||
mac80211_hwsim_beacon,
|
||||
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
|
||||
|
||||
spin_lock_bh(&hwsim_radio_lock);
|
||||
list_add_tail(&data->list, &hwsim_radios);
|
||||
spin_unlock_bh(&hwsim_radio_lock);
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "wl12xx_80211.h"
|
||||
#include "cmd.h"
|
||||
#include "event.h"
|
||||
#include "ps.h"
|
||||
#include "tx.h"
|
||||
#include "hw_ops.h"
|
||||
|
||||
|
@ -192,10 +191,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
|
|||
|
||||
timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
|
||||
|
||||
ret = wl1271_ps_elp_wakeup(wl);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
do {
|
||||
if (time_after(jiffies, timeout_time)) {
|
||||
wl1271_debug(DEBUG_CMD, "timeout waiting for event %d",
|
||||
|
@ -227,7 +222,6 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
|
|||
} while (!event);
|
||||
|
||||
out:
|
||||
wl1271_ps_elp_sleep(wl);
|
||||
kfree(events_vector);
|
||||
return ret;
|
||||
}
|
||||
|
|
629
drivers/net/wireless/virt_wifi.c
Normal file
629
drivers/net/wireless/virt_wifi.c
Normal file
|
@ -0,0 +1,629 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* drivers/net/wireless/virt_wifi.c
|
||||
*
|
||||
* A fake implementation of cfg80211_ops that can be tacked on to an ethernet
|
||||
* net_device to make it appear as a wireless connection.
|
||||
*
|
||||
* Copyright (C) 2018 Google, Inc.
|
||||
*
|
||||
* Author: schuffelen@google.com
|
||||
*/
|
||||
|
||||
#include <net/cfg80211.h>
|
||||
#include <net/rtnetlink.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <net/cfg80211.h>
|
||||
#include <net/rtnetlink.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
static struct wiphy *common_wiphy;
|
||||
|
||||
struct virt_wifi_wiphy_priv {
|
||||
struct delayed_work scan_result;
|
||||
struct cfg80211_scan_request *scan_request;
|
||||
bool being_deleted;
|
||||
};
|
||||
|
||||
static struct ieee80211_channel channel_2ghz = {
|
||||
.band = IEEE80211_BAND_2GHZ,
|
||||
.center_freq = 2432,
|
||||
.hw_value = 2432,
|
||||
.max_power = 20,
|
||||
};
|
||||
|
||||
static struct ieee80211_rate bitrates_2ghz[] = {
|
||||
{ .bitrate = 10 },
|
||||
{ .bitrate = 20 },
|
||||
{ .bitrate = 55 },
|
||||
{ .bitrate = 110 },
|
||||
{ .bitrate = 60 },
|
||||
{ .bitrate = 120 },
|
||||
{ .bitrate = 240 },
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band band_2ghz = {
|
||||
.channels = &channel_2ghz,
|
||||
.bitrates = bitrates_2ghz,
|
||||
.band = IEEE80211_BAND_2GHZ,
|
||||
.n_channels = 1,
|
||||
.n_bitrates = ARRAY_SIZE(bitrates_2ghz),
|
||||
.ht_cap = {
|
||||
.ht_supported = true,
|
||||
.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
|
||||
IEEE80211_HT_CAP_GRN_FLD |
|
||||
IEEE80211_HT_CAP_SGI_20 |
|
||||
IEEE80211_HT_CAP_SGI_40 |
|
||||
IEEE80211_HT_CAP_DSSSCCK40,
|
||||
.ampdu_factor = 0x3,
|
||||
.ampdu_density = 0x6,
|
||||
.mcs = {
|
||||
.rx_mask = {0xff, 0xff},
|
||||
.tx_params = IEEE80211_HT_MCS_TX_DEFINED,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct ieee80211_channel channel_5ghz = {
|
||||
.band = IEEE80211_BAND_5GHZ,
|
||||
.center_freq = 5240,
|
||||
.hw_value = 5240,
|
||||
.max_power = 20,
|
||||
};
|
||||
|
||||
static struct ieee80211_rate bitrates_5ghz[] = {
|
||||
{ .bitrate = 60 },
|
||||
{ .bitrate = 120 },
|
||||
{ .bitrate = 240 },
|
||||
};
|
||||
|
||||
#define RX_MCS_MAP (IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 14)
|
||||
|
||||
#define TX_MCS_MAP (IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | \
|
||||
IEEE80211_VHT_MCS_SUPPORT_0_9 << 14)
|
||||
|
||||
static struct ieee80211_supported_band band_5ghz = {
|
||||
.channels = &channel_5ghz,
|
||||
.bitrates = bitrates_5ghz,
|
||||
.band = IEEE80211_BAND_5GHZ,
|
||||
.n_channels = 1,
|
||||
.n_bitrates = ARRAY_SIZE(bitrates_5ghz),
|
||||
.ht_cap = {
|
||||
.ht_supported = true,
|
||||
.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
|
||||
IEEE80211_HT_CAP_GRN_FLD |
|
||||
IEEE80211_HT_CAP_SGI_20 |
|
||||
IEEE80211_HT_CAP_SGI_40 |
|
||||
IEEE80211_HT_CAP_DSSSCCK40,
|
||||
.ampdu_factor = 0x3,
|
||||
.ampdu_density = 0x6,
|
||||
.mcs = {
|
||||
.rx_mask = {0xff, 0xff},
|
||||
.tx_params = IEEE80211_HT_MCS_TX_DEFINED,
|
||||
},
|
||||
},
|
||||
.vht_cap = {
|
||||
.vht_supported = true,
|
||||
.cap = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
|
||||
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
|
||||
IEEE80211_VHT_CAP_RXLDPC |
|
||||
IEEE80211_VHT_CAP_SHORT_GI_80 |
|
||||
IEEE80211_VHT_CAP_SHORT_GI_160 |
|
||||
IEEE80211_VHT_CAP_TXSTBC |
|
||||
IEEE80211_VHT_CAP_RXSTBC_1 |
|
||||
IEEE80211_VHT_CAP_RXSTBC_2 |
|
||||
IEEE80211_VHT_CAP_RXSTBC_3 |
|
||||
IEEE80211_VHT_CAP_RXSTBC_4 |
|
||||
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
|
||||
.vht_mcs = {
|
||||
.rx_mcs_map = cpu_to_le16(RX_MCS_MAP),
|
||||
.tx_mcs_map = cpu_to_le16(TX_MCS_MAP),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/* Assigned at module init. Guaranteed locally-administered and unicast. */
|
||||
static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {};
|
||||
|
||||
/* Called with the rtnl lock held. */
|
||||
static int virt_wifi_scan(struct wiphy *wiphy,
|
||||
struct cfg80211_scan_request *request)
|
||||
{
|
||||
struct virt_wifi_wiphy_priv *priv = wiphy_priv(wiphy);
|
||||
|
||||
wiphy_debug(wiphy, "scan\n");
|
||||
|
||||
if (priv->scan_request || priv->being_deleted)
|
||||
return -EBUSY;
|
||||
|
||||
priv->scan_request = request;
|
||||
schedule_delayed_work(&priv->scan_result, HZ * 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Acquires and releases the rdev BSS lock. */
|
||||
static void virt_wifi_scan_result(struct work_struct *work)
|
||||
{
|
||||
struct {
|
||||
u8 tag;
|
||||
u8 len;
|
||||
u8 ssid[8];
|
||||
} __packed ssid = {
|
||||
.tag = WLAN_EID_SSID, .len = 8, .ssid = "VirtWifi",
|
||||
};
|
||||
struct cfg80211_bss *informed_bss;
|
||||
struct virt_wifi_wiphy_priv *priv =
|
||||
container_of(work, struct virt_wifi_wiphy_priv,
|
||||
scan_result.work);
|
||||
struct wiphy *wiphy = priv_to_wiphy(priv);
|
||||
|
||||
informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz,
|
||||
CFG80211_BSS_FTYPE_PRESP,
|
||||
fake_router_bssid,
|
||||
ktime_get_boot_ns(),
|
||||
WLAN_CAPABILITY_ESS, 0,
|
||||
(void *)&ssid, sizeof(ssid),
|
||||
DBM_TO_MBM(-50), GFP_KERNEL);
|
||||
cfg80211_put_bss(wiphy, informed_bss);
|
||||
|
||||
/* Schedules work which acquires and releases the rtnl lock. */
|
||||
cfg80211_scan_done(priv->scan_request, false);
|
||||
priv->scan_request = NULL;
|
||||
}
|
||||
|
||||
/* May acquire and release the rdev BSS lock. */
|
||||
static void virt_wifi_cancel_scan(struct wiphy *wiphy)
|
||||
{
|
||||
struct virt_wifi_wiphy_priv *priv = wiphy_priv(wiphy);
|
||||
|
||||
cancel_delayed_work_sync(&priv->scan_result);
|
||||
/* Clean up dangling callbacks if necessary. */
|
||||
if (priv->scan_request) {
|
||||
/* Schedules work which acquires and releases the rtnl lock. */
|
||||
cfg80211_scan_done(priv->scan_request, true);
|
||||
priv->scan_request = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct virt_wifi_netdev_priv {
|
||||
struct delayed_work connect;
|
||||
struct net_device *lowerdev;
|
||||
struct net_device *upperdev;
|
||||
u32 tx_packets;
|
||||
u32 tx_failed;
|
||||
u8 connect_requested_bss[ETH_ALEN];
|
||||
bool is_up;
|
||||
bool is_connected;
|
||||
bool being_deleted;
|
||||
};
|
||||
|
||||
/* Called with the rtnl lock held. */
|
||||
static int virt_wifi_connect(struct wiphy *wiphy, struct net_device *netdev,
|
||||
struct cfg80211_connect_params *sme)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
|
||||
bool could_schedule;
|
||||
|
||||
if (priv->being_deleted || !priv->is_up)
|
||||
return -EBUSY;
|
||||
|
||||
could_schedule = schedule_delayed_work(&priv->connect, HZ * 2);
|
||||
if (!could_schedule)
|
||||
return -EBUSY;
|
||||
|
||||
if (sme->bssid)
|
||||
ether_addr_copy(priv->connect_requested_bss, sme->bssid);
|
||||
else
|
||||
eth_zero_addr(priv->connect_requested_bss);
|
||||
|
||||
wiphy_debug(wiphy, "connect\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Acquires and releases the rdev event lock. */
|
||||
static void virt_wifi_connect_complete(struct work_struct *work)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv =
|
||||
container_of(work, struct virt_wifi_netdev_priv, connect.work);
|
||||
u8 *requested_bss = priv->connect_requested_bss;
|
||||
bool has_addr = !is_zero_ether_addr(requested_bss);
|
||||
bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid);
|
||||
u16 status = WLAN_STATUS_SUCCESS;
|
||||
|
||||
if (!priv->is_up || (has_addr && !right_addr))
|
||||
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
else
|
||||
priv->is_connected = true;
|
||||
|
||||
/* Schedules an event that acquires the rtnl lock. */
|
||||
cfg80211_connect_result(priv->upperdev, requested_bss, NULL, 0, NULL, 0,
|
||||
status, GFP_KERNEL);
|
||||
netif_carrier_on(priv->upperdev);
|
||||
}
|
||||
|
||||
/* May acquire and release the rdev event lock. */
|
||||
static void virt_wifi_cancel_connect(struct net_device *netdev)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
|
||||
|
||||
/* If there is work pending, clean up dangling callbacks. */
|
||||
if (cancel_delayed_work_sync(&priv->connect)) {
|
||||
/* Schedules an event that acquires the rtnl lock. */
|
||||
cfg80211_connect_result(priv->upperdev,
|
||||
priv->connect_requested_bss, NULL, 0,
|
||||
NULL, 0,
|
||||
WLAN_STATUS_UNSPECIFIED_FAILURE,
|
||||
GFP_KERNEL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called with the rtnl lock held. Acquires the rdev event lock. */
|
||||
static int virt_wifi_disconnect(struct wiphy *wiphy, struct net_device *netdev,
|
||||
u16 reason_code)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(netdev);
|
||||
|
||||
if (priv->being_deleted)
|
||||
return -EBUSY;
|
||||
|
||||
wiphy_debug(wiphy, "disconnect\n");
|
||||
virt_wifi_cancel_connect(netdev);
|
||||
|
||||
cfg80211_disconnected(netdev, reason_code, NULL, 0, true, GFP_KERNEL);
|
||||
priv->is_connected = false;
|
||||
netif_carrier_off(netdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called with the rtnl lock held. */
|
||||
static int virt_wifi_get_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
const u8 *mac, struct station_info *sinfo)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
|
||||
wiphy_debug(wiphy, "get_station\n");
|
||||
|
||||
if (!priv->is_connected || !ether_addr_equal(mac, fake_router_bssid))
|
||||
return -ENOENT;
|
||||
|
||||
sinfo->filled = BIT_ULL(NL80211_STA_INFO_TX_PACKETS) |
|
||||
BIT_ULL(NL80211_STA_INFO_TX_FAILED) |
|
||||
BIT_ULL(NL80211_STA_INFO_SIGNAL) |
|
||||
BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
|
||||
sinfo->tx_packets = priv->tx_packets;
|
||||
sinfo->tx_failed = priv->tx_failed;
|
||||
/* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_ */
|
||||
sinfo->signal = -50;
|
||||
sinfo->txrate = (struct rate_info) {
|
||||
.legacy = 10, /* units are 100kbit/s */
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called with the rtnl lock held. */
|
||||
static int virt_wifi_dump_station(struct wiphy *wiphy, struct net_device *dev,
|
||||
int idx, u8 *mac, struct station_info *sinfo)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
|
||||
wiphy_debug(wiphy, "dump_station\n");
|
||||
|
||||
if (idx != 0 || !priv->is_connected)
|
||||
return -ENOENT;
|
||||
|
||||
ether_addr_copy(mac, fake_router_bssid);
|
||||
return virt_wifi_get_station(wiphy, dev, fake_router_bssid, sinfo);
|
||||
}
|
||||
|
||||
static const struct cfg80211_ops virt_wifi_cfg80211_ops = {
|
||||
.scan = virt_wifi_scan,
|
||||
|
||||
.connect = virt_wifi_connect,
|
||||
.disconnect = virt_wifi_disconnect,
|
||||
|
||||
.get_station = virt_wifi_get_station,
|
||||
.dump_station = virt_wifi_dump_station,
|
||||
};
|
||||
|
||||
/* Acquires and releases the rtnl lock. */
|
||||
static struct wiphy *virt_wifi_make_wiphy(void)
|
||||
{
|
||||
struct wiphy *wiphy;
|
||||
struct virt_wifi_wiphy_priv *priv;
|
||||
int err;
|
||||
|
||||
wiphy = wiphy_new(&virt_wifi_cfg80211_ops, sizeof(*priv));
|
||||
|
||||
if (!wiphy)
|
||||
return NULL;
|
||||
|
||||
wiphy->max_scan_ssids = 4;
|
||||
wiphy->max_scan_ie_len = 1000;
|
||||
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
|
||||
|
||||
wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2ghz;
|
||||
wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5ghz;
|
||||
wiphy->bands[IEEE80211_BAND_60GHZ] = NULL;
|
||||
|
||||
wiphy->regulatory_flags = REGULATORY_WIPHY_SELF_MANAGED;
|
||||
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
|
||||
|
||||
priv = wiphy_priv(wiphy);
|
||||
priv->being_deleted = false;
|
||||
priv->scan_request = NULL;
|
||||
INIT_DELAYED_WORK(&priv->scan_result, virt_wifi_scan_result);
|
||||
|
||||
err = wiphy_register(wiphy);
|
||||
if (err < 0) {
|
||||
wiphy_free(wiphy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wiphy;
|
||||
}
|
||||
|
||||
/* Acquires and releases the rtnl lock. */
|
||||
static void virt_wifi_destroy_wiphy(struct wiphy *wiphy)
|
||||
{
|
||||
struct virt_wifi_wiphy_priv *priv;
|
||||
|
||||
WARN(!wiphy, "%s called with null wiphy", __func__);
|
||||
if (!wiphy)
|
||||
return;
|
||||
|
||||
priv = wiphy_priv(wiphy);
|
||||
priv->being_deleted = true;
|
||||
virt_wifi_cancel_scan(wiphy);
|
||||
|
||||
if (wiphy->registered)
|
||||
wiphy_unregister(wiphy);
|
||||
wiphy_free(wiphy);
|
||||
}
|
||||
|
||||
/* Enters and exits a RCU-bh critical section. */
|
||||
static netdev_tx_t virt_wifi_start_xmit(struct sk_buff *skb,
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
|
||||
priv->tx_packets++;
|
||||
if (!priv->is_connected) {
|
||||
priv->tx_failed++;
|
||||
return NET_XMIT_DROP;
|
||||
}
|
||||
|
||||
skb->dev = priv->lowerdev;
|
||||
return dev_queue_xmit(skb);
|
||||
}
|
||||
|
||||
/* Called with rtnl lock held. */
|
||||
static int virt_wifi_net_device_open(struct net_device *dev)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
|
||||
priv->is_up = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called with rtnl lock held. */
|
||||
static int virt_wifi_net_device_stop(struct net_device *dev)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *n_priv = netdev_priv(dev);
|
||||
struct virt_wifi_wiphy_priv *w_priv;
|
||||
|
||||
n_priv->is_up = false;
|
||||
|
||||
if (!dev->ieee80211_ptr)
|
||||
return 0;
|
||||
w_priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
|
||||
|
||||
virt_wifi_cancel_scan(dev->ieee80211_ptr->wiphy);
|
||||
virt_wifi_cancel_connect(dev);
|
||||
netif_carrier_off(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_device_ops virt_wifi_ops = {
|
||||
.ndo_start_xmit = virt_wifi_start_xmit,
|
||||
.ndo_open = virt_wifi_net_device_open,
|
||||
.ndo_stop = virt_wifi_net_device_stop,
|
||||
};
|
||||
|
||||
/* Invoked as part of rtnl lock release. */
|
||||
static void virt_wifi_net_device_destructor(struct net_device *dev)
|
||||
{
|
||||
/* Delayed past dellink to allow nl80211 to react to the device being
|
||||
* deleted.
|
||||
*/
|
||||
kfree(dev->ieee80211_ptr);
|
||||
dev->ieee80211_ptr = NULL;
|
||||
free_netdev(dev);
|
||||
}
|
||||
|
||||
/* No lock interaction. */
|
||||
static void virt_wifi_setup(struct net_device *dev)
|
||||
{
|
||||
ether_setup(dev);
|
||||
dev->netdev_ops = &virt_wifi_ops;
|
||||
dev->destructor = virt_wifi_net_device_destructor;
|
||||
}
|
||||
|
||||
/* Called in a RCU read critical section from netif_receive_skb */
|
||||
static rx_handler_result_t virt_wifi_rx_handler(struct sk_buff **pskb)
|
||||
{
|
||||
struct sk_buff *skb = *pskb;
|
||||
struct virt_wifi_netdev_priv *priv =
|
||||
rcu_dereference(skb->dev->rx_handler_data);
|
||||
|
||||
if (!priv->is_connected)
|
||||
return RX_HANDLER_PASS;
|
||||
|
||||
/* GFP_ATOMIC because this is a packet interrupt handler. */
|
||||
skb = skb_share_check(skb, GFP_ATOMIC);
|
||||
if (!skb) {
|
||||
dev_err(&priv->upperdev->dev, "can't skb_share_check\n");
|
||||
return RX_HANDLER_CONSUMED;
|
||||
}
|
||||
|
||||
*pskb = skb;
|
||||
skb->dev = priv->upperdev;
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
return RX_HANDLER_ANOTHER;
|
||||
}
|
||||
|
||||
/* Called with rtnl lock held. */
|
||||
static int virt_wifi_newlink(struct net *src_net, struct net_device *dev,
|
||||
struct nlattr *tb[], struct nlattr *data[])
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
int err;
|
||||
|
||||
if (!tb[IFLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
netif_carrier_off(dev);
|
||||
|
||||
priv->upperdev = dev;
|
||||
priv->lowerdev = __dev_get_by_index(src_net,
|
||||
nla_get_u32(tb[IFLA_LINK]));
|
||||
|
||||
if (!priv->lowerdev)
|
||||
return -ENODEV;
|
||||
if (!tb[IFLA_MTU])
|
||||
dev->mtu = priv->lowerdev->mtu;
|
||||
else if (dev->mtu > priv->lowerdev->mtu)
|
||||
return -EINVAL;
|
||||
|
||||
err = netdev_rx_handler_register(priv->lowerdev, virt_wifi_rx_handler,
|
||||
priv);
|
||||
if (err) {
|
||||
dev_err(&priv->lowerdev->dev,
|
||||
"can't netdev_rx_handler_register: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
eth_hw_addr_inherit(dev, priv->lowerdev);
|
||||
netif_stacked_transfer_operstate(priv->lowerdev, dev);
|
||||
|
||||
SET_NETDEV_DEV(dev, &priv->lowerdev->dev);
|
||||
dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL);
|
||||
|
||||
if (!dev->ieee80211_ptr)
|
||||
goto remove_handler;
|
||||
|
||||
dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
|
||||
dev->ieee80211_ptr->wiphy = common_wiphy;
|
||||
|
||||
err = register_netdevice(dev);
|
||||
if (err) {
|
||||
dev_err(&priv->lowerdev->dev, "can't register_netdevice: %d\n",
|
||||
err);
|
||||
goto free_wireless_dev;
|
||||
}
|
||||
|
||||
err = netdev_upper_dev_link(priv->lowerdev, dev);
|
||||
if (err) {
|
||||
dev_err(&priv->lowerdev->dev, "can't netdev_upper_dev_link: %d\n",
|
||||
err);
|
||||
goto unregister_netdev;
|
||||
}
|
||||
|
||||
priv->being_deleted = false;
|
||||
priv->is_connected = false;
|
||||
priv->is_up = false;
|
||||
INIT_DELAYED_WORK(&priv->connect, virt_wifi_connect_complete);
|
||||
|
||||
return 0;
|
||||
unregister_netdev:
|
||||
unregister_netdevice(dev);
|
||||
free_wireless_dev:
|
||||
kfree(dev->ieee80211_ptr);
|
||||
dev->ieee80211_ptr = NULL;
|
||||
remove_handler:
|
||||
netdev_rx_handler_unregister(priv->lowerdev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Called with rtnl lock held. */
|
||||
static void virt_wifi_dellink(struct net_device *dev,
|
||||
struct list_head *head)
|
||||
{
|
||||
struct virt_wifi_netdev_priv *priv = netdev_priv(dev);
|
||||
|
||||
if (dev->ieee80211_ptr)
|
||||
virt_wifi_cancel_scan(dev->ieee80211_ptr->wiphy);
|
||||
|
||||
priv->being_deleted = true;
|
||||
virt_wifi_cancel_connect(dev);
|
||||
netif_carrier_off(dev);
|
||||
|
||||
netdev_rx_handler_unregister(priv->lowerdev);
|
||||
netdev_upper_dev_unlink(priv->lowerdev, dev);
|
||||
|
||||
unregister_netdevice_queue(dev, head);
|
||||
|
||||
/* Deleting the wiphy is handled in the module destructor. */
|
||||
}
|
||||
|
||||
static struct rtnl_link_ops virt_wifi_link_ops = {
|
||||
.kind = "virt_wifi",
|
||||
.setup = virt_wifi_setup,
|
||||
.newlink = virt_wifi_newlink,
|
||||
.dellink = virt_wifi_dellink,
|
||||
.priv_size = sizeof(struct virt_wifi_netdev_priv),
|
||||
};
|
||||
|
||||
/* Acquires and releases the rtnl lock. */
|
||||
static int __init virt_wifi_init_module(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Guaranteed to be locallly-administered and not multicast. */
|
||||
eth_random_addr(fake_router_bssid);
|
||||
|
||||
common_wiphy = virt_wifi_make_wiphy();
|
||||
if (!common_wiphy)
|
||||
return -ENOMEM;
|
||||
|
||||
err = rtnl_link_register(&virt_wifi_link_ops);
|
||||
if (err)
|
||||
virt_wifi_destroy_wiphy(common_wiphy);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Acquires and releases the rtnl lock. */
|
||||
static void __exit virt_wifi_cleanup_module(void)
|
||||
{
|
||||
/* Will delete any devices that depend on the wiphy. */
|
||||
rtnl_link_unregister(&virt_wifi_link_ops);
|
||||
virt_wifi_destroy_wiphy(common_wiphy);
|
||||
}
|
||||
|
||||
module_init(virt_wifi_init_module);
|
||||
module_exit(virt_wifi_cleanup_module);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Cody Schuffelen <schuffelen@google.com>");
|
||||
MODULE_DESCRIPTION("Driver for a wireless wrapper of ethernet devices");
|
||||
MODULE_ALIAS_RTNL_LINK("virt_wifi");
|
|
@ -4519,8 +4519,8 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
|
|||
{
|
||||
struct qeth_ipa_cmd *cmd;
|
||||
struct qeth_arp_query_info *qinfo;
|
||||
struct qeth_snmp_cmd *snmp;
|
||||
unsigned char *data;
|
||||
void *snmp_data;
|
||||
__u16 data_len;
|
||||
|
||||
QETH_CARD_TEXT(card, 3, "snpcmdcb");
|
||||
|
@ -4528,7 +4528,6 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
|
|||
cmd = (struct qeth_ipa_cmd *) sdata;
|
||||
data = (unsigned char *)((char *)cmd - reply->offset);
|
||||
qinfo = (struct qeth_arp_query_info *) reply->param;
|
||||
snmp = &cmd->data.setadapterparms.data.snmp;
|
||||
|
||||
if (cmd->hdr.return_code) {
|
||||
QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code);
|
||||
|
@ -4541,10 +4540,15 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
|
|||
return 0;
|
||||
}
|
||||
data_len = *((__u16 *)QETH_IPA_PDU_LEN_PDU1(data));
|
||||
if (cmd->data.setadapterparms.hdr.seq_no == 1)
|
||||
data_len -= (__u16)((char *)&snmp->data - (char *)cmd);
|
||||
else
|
||||
data_len -= (__u16)((char *)&snmp->request - (char *)cmd);
|
||||
if (cmd->data.setadapterparms.hdr.seq_no == 1) {
|
||||
snmp_data = &cmd->data.setadapterparms.data.snmp;
|
||||
data_len -= offsetof(struct qeth_ipa_cmd,
|
||||
data.setadapterparms.data.snmp);
|
||||
} else {
|
||||
snmp_data = &cmd->data.setadapterparms.data.snmp.request;
|
||||
data_len -= offsetof(struct qeth_ipa_cmd,
|
||||
data.setadapterparms.data.snmp.request);
|
||||
}
|
||||
|
||||
/* check if there is enough room in userspace */
|
||||
if ((qinfo->udata_len - qinfo->udata_offset) < data_len) {
|
||||
|
@ -4557,16 +4561,9 @@ static int qeth_snmp_command_cb(struct qeth_card *card,
|
|||
QETH_CARD_TEXT_(card, 4, "sseqn%i",
|
||||
cmd->data.setadapterparms.hdr.seq_no);
|
||||
/*copy entries to user buffer*/
|
||||
if (cmd->data.setadapterparms.hdr.seq_no == 1) {
|
||||
memcpy(qinfo->udata + qinfo->udata_offset,
|
||||
(char *)snmp,
|
||||
data_len + offsetof(struct qeth_snmp_cmd, data));
|
||||
qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data);
|
||||
} else {
|
||||
memcpy(qinfo->udata + qinfo->udata_offset,
|
||||
(char *)&snmp->request, data_len);
|
||||
}
|
||||
memcpy(qinfo->udata + qinfo->udata_offset, snmp_data, data_len);
|
||||
qinfo->udata_offset += data_len;
|
||||
|
||||
/* check if all replies received ... */
|
||||
QETH_CARD_TEXT_(card, 4, "srtot%i",
|
||||
cmd->data.setadapterparms.hdr.used_total);
|
||||
|
|
|
@ -59,6 +59,7 @@ struct virtio_ccw_device {
|
|||
unsigned int revision; /* Transport revision */
|
||||
wait_queue_head_t wait_q;
|
||||
spinlock_t lock;
|
||||
struct mutex io_lock; /* Serializes I/O requests */
|
||||
struct list_head virtqueues;
|
||||
unsigned long indicators;
|
||||
unsigned long indicators2;
|
||||
|
@ -307,6 +308,7 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev,
|
|||
unsigned long flags;
|
||||
int flag = intparm & VIRTIO_CCW_INTPARM_MASK;
|
||||
|
||||
mutex_lock(&vcdev->io_lock);
|
||||
do {
|
||||
spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags);
|
||||
ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0);
|
||||
|
@ -319,7 +321,9 @@ static int ccw_io_helper(struct virtio_ccw_device *vcdev,
|
|||
cpu_relax();
|
||||
} while (ret == -EBUSY);
|
||||
wait_event(vcdev->wait_q, doing_io(vcdev, flag) == 0);
|
||||
return ret ? ret : vcdev->err;
|
||||
ret = ret ? ret : vcdev->err;
|
||||
mutex_unlock(&vcdev->io_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,
|
||||
|
@ -833,6 +837,7 @@ static void virtio_ccw_get_config(struct virtio_device *vdev,
|
|||
int ret;
|
||||
struct ccw1 *ccw;
|
||||
void *config_area;
|
||||
unsigned long flags;
|
||||
|
||||
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
|
||||
if (!ccw)
|
||||
|
@ -851,11 +856,13 @@ static void virtio_ccw_get_config(struct virtio_device *vdev,
|
|||
if (ret)
|
||||
goto out_free;
|
||||
|
||||
spin_lock_irqsave(&vcdev->lock, flags);
|
||||
memcpy(vcdev->config, config_area, offset + len);
|
||||
if (buf)
|
||||
memcpy(buf, &vcdev->config[offset], len);
|
||||
if (vcdev->config_ready < offset + len)
|
||||
vcdev->config_ready = offset + len;
|
||||
spin_unlock_irqrestore(&vcdev->lock, flags);
|
||||
if (buf)
|
||||
memcpy(buf, config_area + offset, len);
|
||||
|
||||
out_free:
|
||||
kfree(config_area);
|
||||
|
@ -869,6 +876,7 @@ static void virtio_ccw_set_config(struct virtio_device *vdev,
|
|||
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
|
||||
struct ccw1 *ccw;
|
||||
void *config_area;
|
||||
unsigned long flags;
|
||||
|
||||
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
|
||||
if (!ccw)
|
||||
|
@ -881,9 +889,11 @@ static void virtio_ccw_set_config(struct virtio_device *vdev,
|
|||
/* Make sure we don't overwrite fields. */
|
||||
if (vcdev->config_ready < offset)
|
||||
virtio_ccw_get_config(vdev, 0, NULL, offset);
|
||||
spin_lock_irqsave(&vcdev->lock, flags);
|
||||
memcpy(&vcdev->config[offset], buf, len);
|
||||
/* Write the config area to the host. */
|
||||
memcpy(config_area, vcdev->config, sizeof(vcdev->config));
|
||||
spin_unlock_irqrestore(&vcdev->lock, flags);
|
||||
ccw->cmd_code = CCW_CMD_WRITE_CONF;
|
||||
ccw->flags = 0;
|
||||
ccw->count = offset + len;
|
||||
|
@ -1230,6 +1240,7 @@ static int virtio_ccw_online(struct ccw_device *cdev)
|
|||
init_waitqueue_head(&vcdev->wait_q);
|
||||
INIT_LIST_HEAD(&vcdev->virtqueues);
|
||||
spin_lock_init(&vcdev->lock);
|
||||
mutex_init(&vcdev->io_lock);
|
||||
|
||||
spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
|
||||
dev_set_drvdata(&cdev->dev, vcdev);
|
||||
|
|
|
@ -1249,8 +1249,8 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
|
|||
memset(rspnid, 0, sizeof(struct fcgs_rspnid_req_s));
|
||||
|
||||
rspnid->dap = s_id;
|
||||
rspnid->spn_len = (u8) strlen((char *)name);
|
||||
strncpy((char *)rspnid->spn, (char *)name, rspnid->spn_len);
|
||||
strlcpy(rspnid->spn, name, sizeof(rspnid->spn));
|
||||
rspnid->spn_len = (u8) strlen(rspnid->spn);
|
||||
|
||||
return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s);
|
||||
}
|
||||
|
@ -1270,8 +1270,8 @@ fc_rsnn_nn_build(struct fchs_s *fchs, void *pyld, u32 s_id,
|
|||
memset(rsnn_nn, 0, sizeof(struct fcgs_rsnn_nn_req_s));
|
||||
|
||||
rsnn_nn->node_name = node_name;
|
||||
rsnn_nn->snn_len = (u8) strlen((char *)name);
|
||||
strncpy((char *)rsnn_nn->snn, (char *)name, rsnn_nn->snn_len);
|
||||
strlcpy(rsnn_nn->snn, name, sizeof(rsnn_nn->snn));
|
||||
rsnn_nn->snn_len = (u8) strlen(rsnn_nn->snn);
|
||||
|
||||
return sizeof(struct fcgs_rsnn_nn_req_s) + sizeof(struct ct_hdr_s);
|
||||
}
|
||||
|
|
|
@ -831,23 +831,23 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
|
|||
bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
|
||||
|
||||
/* Model name/number */
|
||||
strncpy((char *)&port_cfg->sym_name, model,
|
||||
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
|
||||
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
strlcpy(port_cfg->sym_name.symname, model,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* Driver Version */
|
||||
strncat((char *)&port_cfg->sym_name, (char *)driver_info->version,
|
||||
BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
|
||||
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
strlcat(port_cfg->sym_name.symname, driver_info->version,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* Host machine name */
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
(char *)driver_info->host_machine_name,
|
||||
BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
|
||||
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
driver_info->host_machine_name,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/*
|
||||
* Host OS Info :
|
||||
|
@ -855,24 +855,24 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
|
|||
* OS name string and instead copy the entire OS info string (64 bytes).
|
||||
*/
|
||||
if (driver_info->host_os_patch[0] == '\0') {
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
(char *)driver_info->host_os_name,
|
||||
BFA_FCS_OS_STR_LEN);
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
driver_info->host_os_name,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
} else {
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
(char *)driver_info->host_os_name,
|
||||
BFA_FCS_PORT_SYMBNAME_OSINFO_SZ);
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
driver_info->host_os_name,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* Append host OS Patch Info */
|
||||
strncat((char *)&port_cfg->sym_name,
|
||||
(char *)driver_info->host_os_patch,
|
||||
BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ);
|
||||
strlcat(port_cfg->sym_name.symname,
|
||||
driver_info->host_os_patch,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
}
|
||||
|
||||
/* null terminate */
|
||||
|
@ -892,26 +892,26 @@ bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric)
|
|||
bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
|
||||
|
||||
/* Model name/number */
|
||||
strncpy((char *)&port_cfg->node_sym_name, model,
|
||||
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
|
||||
strncat((char *)&port_cfg->node_sym_name,
|
||||
strlcpy(port_cfg->node_sym_name.symname, model,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->node_sym_name.symname,
|
||||
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* Driver Version */
|
||||
strncat((char *)&port_cfg->node_sym_name, (char *)driver_info->version,
|
||||
BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
|
||||
strncat((char *)&port_cfg->node_sym_name,
|
||||
strlcat(port_cfg->node_sym_name.symname, (char *)driver_info->version,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->node_sym_name.symname,
|
||||
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* Host machine name */
|
||||
strncat((char *)&port_cfg->node_sym_name,
|
||||
(char *)driver_info->host_machine_name,
|
||||
BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
|
||||
strncat((char *)&port_cfg->node_sym_name,
|
||||
strlcat(port_cfg->node_sym_name.symname,
|
||||
driver_info->host_machine_name,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
strlcat(port_cfg->node_sym_name.symname,
|
||||
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
|
||||
/* null terminate */
|
||||
port_cfg->node_sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
|
||||
|
|
|
@ -2630,10 +2630,10 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
|
|||
bfa_ioc_get_adapter_fw_ver(&port->fcs->bfa->ioc,
|
||||
hba_attr->fw_version);
|
||||
|
||||
strncpy(hba_attr->driver_version, (char *)driver_info->version,
|
||||
strlcpy(hba_attr->driver_version, (char *)driver_info->version,
|
||||
sizeof(hba_attr->driver_version));
|
||||
|
||||
strncpy(hba_attr->os_name, driver_info->host_os_name,
|
||||
strlcpy(hba_attr->os_name, driver_info->host_os_name,
|
||||
sizeof(hba_attr->os_name));
|
||||
|
||||
/*
|
||||
|
@ -2641,23 +2641,23 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi,
|
|||
* to the os name along with a separator
|
||||
*/
|
||||
if (driver_info->host_os_patch[0] != '\0') {
|
||||
strncat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
|
||||
strncat(hba_attr->os_name, driver_info->host_os_patch,
|
||||
sizeof(driver_info->host_os_patch));
|
||||
strlcat(hba_attr->os_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
|
||||
sizeof(hba_attr->os_name));
|
||||
strlcat(hba_attr->os_name, driver_info->host_os_patch,
|
||||
sizeof(hba_attr->os_name));
|
||||
}
|
||||
|
||||
/* Retrieve the max frame size from the port attr */
|
||||
bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr);
|
||||
hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size;
|
||||
|
||||
strncpy(hba_attr->node_sym_name.symname,
|
||||
strlcpy(hba_attr->node_sym_name.symname,
|
||||
port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN);
|
||||
strcpy(hba_attr->vendor_info, "BROCADE");
|
||||
hba_attr->num_ports =
|
||||
cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc));
|
||||
hba_attr->fabric_name = port->fabric->lps->pr_nwwn;
|
||||
strncpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN);
|
||||
strlcpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2724,20 +2724,20 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi,
|
|||
/*
|
||||
* OS device Name
|
||||
*/
|
||||
strncpy(port_attr->os_device_name, (char *)driver_info->os_device_name,
|
||||
strlcpy(port_attr->os_device_name, driver_info->os_device_name,
|
||||
sizeof(port_attr->os_device_name));
|
||||
|
||||
/*
|
||||
* Host name
|
||||
*/
|
||||
strncpy(port_attr->host_name, (char *)driver_info->host_machine_name,
|
||||
strlcpy(port_attr->host_name, driver_info->host_machine_name,
|
||||
sizeof(port_attr->host_name));
|
||||
|
||||
port_attr->node_name = bfa_fcs_lport_get_nwwn(port);
|
||||
port_attr->port_name = bfa_fcs_lport_get_pwwn(port);
|
||||
|
||||
strncpy(port_attr->port_sym_name.symname,
|
||||
(char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN);
|
||||
strlcpy(port_attr->port_sym_name.symname,
|
||||
bfa_fcs_lport_get_psym_name(port).symname, BFA_SYMNAME_MAXLEN);
|
||||
bfa_fcs_lport_get_attr(port, &lport_attr);
|
||||
port_attr->port_type = cpu_to_be32(lport_attr.port_type);
|
||||
port_attr->scos = pport_attr.cos_supported;
|
||||
|
@ -3217,7 +3217,7 @@ bfa_fcs_lport_ms_gmal_response(void *fcsarg, struct bfa_fcxp_s *fcxp,
|
|||
rsp_str[gmal_entry->len-1] = 0;
|
||||
|
||||
/* copy IP Address to fabric */
|
||||
strncpy(bfa_fcs_lport_get_fabric_ipaddr(port),
|
||||
strlcpy(bfa_fcs_lport_get_fabric_ipaddr(port),
|
||||
gmal_entry->ip_addr,
|
||||
BFA_FCS_FABRIC_IPADDR_SZ);
|
||||
break;
|
||||
|
@ -4655,21 +4655,13 @@ bfa_fcs_lport_ns_send_rspn_id(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|||
* to that of the base port.
|
||||
*/
|
||||
|
||||
strncpy((char *)psymbl,
|
||||
(char *) &
|
||||
(bfa_fcs_lport_get_psym_name
|
||||
strlcpy(symbl,
|
||||
(char *)&(bfa_fcs_lport_get_psym_name
|
||||
(bfa_fcs_get_base_port(port->fcs))),
|
||||
strlen((char *) &
|
||||
bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port
|
||||
(port->fcs))));
|
||||
sizeof(symbl));
|
||||
|
||||
/* Ensure we have a null terminating string. */
|
||||
((char *)psymbl)[strlen((char *) &
|
||||
bfa_fcs_lport_get_psym_name(bfa_fcs_get_base_port
|
||||
(port->fcs)))] = 0;
|
||||
strncat((char *)psymbl,
|
||||
(char *) &(bfa_fcs_lport_get_psym_name(port)),
|
||||
strlen((char *) &bfa_fcs_lport_get_psym_name(port)));
|
||||
strlcat(symbl, (char *)&(bfa_fcs_lport_get_psym_name(port)),
|
||||
sizeof(symbl));
|
||||
} else {
|
||||
psymbl = (u8 *) &(bfa_fcs_lport_get_psym_name(port));
|
||||
}
|
||||
|
@ -5161,7 +5153,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|||
struct fchs_s fchs;
|
||||
struct bfa_fcxp_s *fcxp;
|
||||
u8 symbl[256];
|
||||
u8 *psymbl = &symbl[0];
|
||||
int len;
|
||||
|
||||
/* Avoid sending RSPN in the following states. */
|
||||
|
@ -5191,22 +5182,17 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced)
|
|||
* For Vports, we append the vport's port symbolic name
|
||||
* to that of the base port.
|
||||
*/
|
||||
strncpy((char *)psymbl, (char *)&(bfa_fcs_lport_get_psym_name
|
||||
strlcpy(symbl, (char *)&(bfa_fcs_lport_get_psym_name
|
||||
(bfa_fcs_get_base_port(port->fcs))),
|
||||
strlen((char *)&bfa_fcs_lport_get_psym_name(
|
||||
bfa_fcs_get_base_port(port->fcs))));
|
||||
sizeof(symbl));
|
||||
|
||||
/* Ensure we have a null terminating string. */
|
||||
((char *)psymbl)[strlen((char *)&bfa_fcs_lport_get_psym_name(
|
||||
bfa_fcs_get_base_port(port->fcs)))] = 0;
|
||||
|
||||
strncat((char *)psymbl,
|
||||
strlcat(symbl,
|
||||
(char *)&(bfa_fcs_lport_get_psym_name(port)),
|
||||
strlen((char *)&bfa_fcs_lport_get_psym_name(port)));
|
||||
sizeof(symbl));
|
||||
}
|
||||
|
||||
len = fc_rspnid_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
|
||||
bfa_fcs_lport_get_fcid(port), 0, psymbl);
|
||||
bfa_fcs_lport_get_fcid(port), 0, symbl);
|
||||
|
||||
bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE,
|
||||
FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
|
||||
|
|
|
@ -2802,7 +2802,7 @@ void
|
|||
bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer)
|
||||
{
|
||||
memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN);
|
||||
memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN);
|
||||
strlcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -365,8 +365,8 @@ bfa_plog_str(struct bfa_plog_s *plog, enum bfa_plog_mid mid,
|
|||
lp.eid = event;
|
||||
lp.log_type = BFA_PL_LOG_TYPE_STRING;
|
||||
lp.misc = misc;
|
||||
strncpy(lp.log_entry.string_log, log_str,
|
||||
BFA_PL_STRING_LOG_SZ - 1);
|
||||
strlcpy(lp.log_entry.string_log, log_str,
|
||||
BFA_PL_STRING_LOG_SZ);
|
||||
lp.log_entry.string_log[BFA_PL_STRING_LOG_SZ - 1] = '\0';
|
||||
bfa_plog_add(plog, &lp);
|
||||
}
|
||||
|
|
|
@ -987,20 +987,20 @@ bfad_start_ops(struct bfad_s *bfad) {
|
|||
|
||||
/* Fill the driver_info info to fcs*/
|
||||
memset(&driver_info, 0, sizeof(driver_info));
|
||||
strncpy(driver_info.version, BFAD_DRIVER_VERSION,
|
||||
sizeof(driver_info.version) - 1);
|
||||
strlcpy(driver_info.version, BFAD_DRIVER_VERSION,
|
||||
sizeof(driver_info.version));
|
||||
if (host_name)
|
||||
strncpy(driver_info.host_machine_name, host_name,
|
||||
sizeof(driver_info.host_machine_name) - 1);
|
||||
strlcpy(driver_info.host_machine_name, host_name,
|
||||
sizeof(driver_info.host_machine_name));
|
||||
if (os_name)
|
||||
strncpy(driver_info.host_os_name, os_name,
|
||||
sizeof(driver_info.host_os_name) - 1);
|
||||
strlcpy(driver_info.host_os_name, os_name,
|
||||
sizeof(driver_info.host_os_name));
|
||||
if (os_patch)
|
||||
strncpy(driver_info.host_os_patch, os_patch,
|
||||
sizeof(driver_info.host_os_patch) - 1);
|
||||
strlcpy(driver_info.host_os_patch, os_patch,
|
||||
sizeof(driver_info.host_os_patch));
|
||||
|
||||
strncpy(driver_info.os_device_name, bfad->pci_name,
|
||||
sizeof(driver_info.os_device_name) - 1);
|
||||
strlcpy(driver_info.os_device_name, bfad->pci_name,
|
||||
sizeof(driver_info.os_device_name));
|
||||
|
||||
/* FCS driver info init */
|
||||
spin_lock_irqsave(&bfad->bfad_lock, flags);
|
||||
|
|
|
@ -842,7 +842,7 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr,
|
|||
char symname[BFA_SYMNAME_MAXLEN];
|
||||
|
||||
bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr);
|
||||
strncpy(symname, port_attr.port_cfg.sym_name.symname,
|
||||
strlcpy(symname, port_attr.port_cfg.sym_name.symname,
|
||||
BFA_SYMNAME_MAXLEN);
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", symname);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *bfad, void *cmd)
|
|||
|
||||
/* fill in driver attr info */
|
||||
strcpy(iocmd->ioc_attr.driver_attr.driver, BFAD_DRIVER_NAME);
|
||||
strncpy(iocmd->ioc_attr.driver_attr.driver_ver,
|
||||
strlcpy(iocmd->ioc_attr.driver_attr.driver_ver,
|
||||
BFAD_DRIVER_VERSION, BFA_VERSION_LEN);
|
||||
strcpy(iocmd->ioc_attr.driver_attr.fw_ver,
|
||||
iocmd->ioc_attr.adapter_attr.fw_ver);
|
||||
|
@ -314,9 +314,9 @@ bfad_iocmd_port_get_attr(struct bfad_s *bfad, void *cmd)
|
|||
iocmd->attr.port_type = port_attr.port_type;
|
||||
iocmd->attr.loopback = port_attr.loopback;
|
||||
iocmd->attr.authfail = port_attr.authfail;
|
||||
strncpy(iocmd->attr.port_symname.symname,
|
||||
strlcpy(iocmd->attr.port_symname.symname,
|
||||
port_attr.port_cfg.sym_name.symname,
|
||||
sizeof(port_attr.port_cfg.sym_name.symname));
|
||||
sizeof(iocmd->attr.port_symname.symname));
|
||||
|
||||
iocmd->status = BFA_STATUS_OK;
|
||||
return 0;
|
||||
|
|
|
@ -238,14 +238,23 @@ csio_osname(uint8_t *buf, size_t buf_len)
|
|||
}
|
||||
|
||||
static inline void
|
||||
csio_append_attrib(uint8_t **ptr, uint16_t type, uint8_t *val, uint16_t len)
|
||||
csio_append_attrib(uint8_t **ptr, uint16_t type, void *val, size_t val_len)
|
||||
{
|
||||
uint16_t len;
|
||||
struct fc_fdmi_attr_entry *ae = (struct fc_fdmi_attr_entry *)*ptr;
|
||||
|
||||
if (WARN_ON(val_len > U16_MAX))
|
||||
return;
|
||||
|
||||
len = val_len;
|
||||
|
||||
ae->type = htons(type);
|
||||
len += 4; /* includes attribute type and length */
|
||||
len = (len + 3) & ~3; /* should be multiple of 4 bytes */
|
||||
ae->len = htons(len);
|
||||
memcpy(ae->value, val, len);
|
||||
memcpy(ae->value, val, val_len);
|
||||
if (len > val_len)
|
||||
memset(ae->value + val_len, 0, len - val_len);
|
||||
*ptr += len;
|
||||
}
|
||||
|
||||
|
@ -335,7 +344,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req)
|
|||
numattrs++;
|
||||
val = htonl(FC_PORTSPEED_1GBIT | FC_PORTSPEED_10GBIT);
|
||||
csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_SUPPORTEDSPEED,
|
||||
(uint8_t *)&val,
|
||||
&val,
|
||||
FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN);
|
||||
numattrs++;
|
||||
|
||||
|
@ -346,23 +355,22 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req)
|
|||
else
|
||||
val = htonl(CSIO_HBA_PORTSPEED_UNKNOWN);
|
||||
csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED,
|
||||
(uint8_t *)&val,
|
||||
FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN);
|
||||
&val, FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN);
|
||||
numattrs++;
|
||||
|
||||
mfs = ln->ln_sparm.csp.sp_bb_data;
|
||||
csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_MAXFRAMESIZE,
|
||||
(uint8_t *)&mfs, FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN);
|
||||
&mfs, sizeof(mfs));
|
||||
numattrs++;
|
||||
|
||||
strcpy(buf, "csiostor");
|
||||
csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_OSDEVICENAME, buf,
|
||||
(uint16_t)strlen(buf));
|
||||
strlen(buf));
|
||||
numattrs++;
|
||||
|
||||
if (!csio_hostname(buf, sizeof(buf))) {
|
||||
csio_append_attrib(&pld, FC_FDMI_PORT_ATTR_HOSTNAME,
|
||||
buf, (uint16_t)strlen(buf));
|
||||
buf, strlen(buf));
|
||||
numattrs++;
|
||||
}
|
||||
attrib_blk->numattrs = htonl(numattrs);
|
||||
|
@ -444,33 +452,32 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req)
|
|||
|
||||
strcpy(buf, "Chelsio Communications");
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MANUFACTURER, buf,
|
||||
(uint16_t)strlen(buf));
|
||||
strlen(buf));
|
||||
numattrs++;
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_SERIALNUMBER,
|
||||
hw->vpd.sn, (uint16_t)sizeof(hw->vpd.sn));
|
||||
hw->vpd.sn, sizeof(hw->vpd.sn));
|
||||
numattrs++;
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODEL, hw->vpd.id,
|
||||
(uint16_t)sizeof(hw->vpd.id));
|
||||
sizeof(hw->vpd.id));
|
||||
numattrs++;
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MODELDESCRIPTION,
|
||||
hw->model_desc, (uint16_t)strlen(hw->model_desc));
|
||||
hw->model_desc, strlen(hw->model_desc));
|
||||
numattrs++;
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_HARDWAREVERSION,
|
||||
hw->hw_ver, (uint16_t)sizeof(hw->hw_ver));
|
||||
hw->hw_ver, sizeof(hw->hw_ver));
|
||||
numattrs++;
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_FIRMWAREVERSION,
|
||||
hw->fwrev_str, (uint16_t)strlen(hw->fwrev_str));
|
||||
hw->fwrev_str, strlen(hw->fwrev_str));
|
||||
numattrs++;
|
||||
|
||||
if (!csio_osname(buf, sizeof(buf))) {
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_OSNAMEVERSION,
|
||||
buf, (uint16_t)strlen(buf));
|
||||
buf, strlen(buf));
|
||||
numattrs++;
|
||||
}
|
||||
|
||||
csio_append_attrib(&pld, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD,
|
||||
(uint8_t *)&maxpayload,
|
||||
FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN);
|
||||
&maxpayload, FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN);
|
||||
len = (uint32_t)(pld - (uint8_t *)cmd);
|
||||
numattrs++;
|
||||
attrib_blk->numattrs = htonl(numattrs);
|
||||
|
@ -1794,6 +1801,8 @@ csio_ln_mgmt_submit_req(struct csio_ioreq *io_req,
|
|||
struct csio_mgmtm *mgmtm = csio_hw_to_mgmtm(hw);
|
||||
int rv;
|
||||
|
||||
BUG_ON(pld_len > pld->len);
|
||||
|
||||
io_req->io_cbfn = io_cbfn; /* Upper layer callback handler */
|
||||
io_req->fw_handle = (uintptr_t) (io_req);
|
||||
io_req->eq_idx = mgmtm->eq_idx;
|
||||
|
|
|
@ -33,7 +33,6 @@ struct scsi_dev_info_list_table {
|
|||
};
|
||||
|
||||
|
||||
static const char spaces[] = " "; /* 16 of them */
|
||||
static unsigned scsi_default_dev_flags;
|
||||
static LIST_HEAD(scsi_dev_info_list);
|
||||
static char scsi_dev_flags[256];
|
||||
|
@ -291,20 +290,13 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,
|
|||
size_t from_length;
|
||||
|
||||
from_length = strlen(from);
|
||||
strncpy(to, from, min(to_length, from_length));
|
||||
if (from_length < to_length) {
|
||||
if (compatible) {
|
||||
/*
|
||||
* NUL terminate the string if it is short.
|
||||
*/
|
||||
to[from_length] = '\0';
|
||||
} else {
|
||||
/*
|
||||
* space pad the string if it is short.
|
||||
*/
|
||||
strncpy(&to[from_length], spaces,
|
||||
to_length - from_length);
|
||||
}
|
||||
/* this zero-pads the destination */
|
||||
strncpy(to, from, to_length);
|
||||
if (from_length < to_length && !compatible) {
|
||||
/*
|
||||
* space pad the string if it is short.
|
||||
*/
|
||||
memset(&to[from_length], ' ', to_length - from_length);
|
||||
}
|
||||
if (from_length > to_length)
|
||||
printk(KERN_WARNING "%s: %s string '%s' is too long\n",
|
||||
|
|
|
@ -700,7 +700,7 @@ repeat_fid2path:
|
|||
memmove(ptr + strlen(gf->gf_path) + 1, ptr,
|
||||
strlen(ori_gf->gf_path));
|
||||
|
||||
strncpy(ptr, gf->gf_path, strlen(gf->gf_path));
|
||||
strcpy(ptr, gf->gf_path);
|
||||
ptr += strlen(gf->gf_path);
|
||||
*ptr = '/';
|
||||
}
|
||||
|
|
|
@ -4165,12 +4165,6 @@ RTY_SEND_CMD:
|
|||
rtsx_trace(chip);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
|
||||
} else if (rsp_type == SD_RSP_TYPE_R0) {
|
||||
if ((ptr[3] & 0x1E) != 0x03) {
|
||||
rtsx_trace(chip);
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,17 +231,17 @@ static int mtk8250_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, data);
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
if (!pm_runtime_enabled(&pdev->dev)) {
|
||||
err = mtk8250_runtime_resume(&pdev->dev);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
err = mtk8250_runtime_resume(&pdev->dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
data->line = serial8250_register_8250_port(&uart);
|
||||
if (data->line < 0)
|
||||
return data->line;
|
||||
|
||||
pm_runtime_set_active(&pdev->dev);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -252,13 +252,11 @@ static int mtk8250_remove(struct platform_device *pdev)
|
|||
pm_runtime_get_sync(&pdev->dev);
|
||||
|
||||
serial8250_unregister_port(data->line);
|
||||
mtk8250_runtime_suspend(&pdev->dev);
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
pm_runtime_put_noidle(&pdev->dev);
|
||||
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
mtk8250_runtime_suspend(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void)
|
|||
#define kgdboc_restore_input()
|
||||
#endif /* ! CONFIG_KDB_KEYBOARD */
|
||||
|
||||
static int kgdboc_option_setup(char *opt)
|
||||
{
|
||||
if (!opt) {
|
||||
pr_err("kgdboc: config string not provided\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (strlen(opt) >= MAX_CONFIG_LEN) {
|
||||
printk(KERN_ERR "kgdboc: config string too long\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
strcpy(config, opt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__setup("kgdboc=", kgdboc_option_setup);
|
||||
|
||||
static void cleanup_kgdboc(void)
|
||||
{
|
||||
if (kgdb_unregister_nmi_console())
|
||||
|
@ -162,15 +144,13 @@ static int configure_kgdboc(void)
|
|||
{
|
||||
struct tty_driver *p;
|
||||
int tty_line = 0;
|
||||
int err;
|
||||
int err = -ENODEV;
|
||||
char *cptr = config;
|
||||
struct console *cons;
|
||||
|
||||
err = kgdboc_option_setup(config);
|
||||
if (err || !strlen(config) || isspace(config[0]))
|
||||
if (!strlen(config) || isspace(config[0]))
|
||||
goto noconfig;
|
||||
|
||||
err = -ENODEV;
|
||||
kgdboc_io_ops.is_console = 0;
|
||||
kgdb_tty_driver = NULL;
|
||||
|
||||
|
@ -252,7 +232,7 @@ static void kgdboc_put_char(u8 chr)
|
|||
|
||||
static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
|
||||
{
|
||||
int len = strlen(kmessage);
|
||||
size_t len = strlen(kmessage);
|
||||
|
||||
if (len >= MAX_CONFIG_LEN) {
|
||||
printk(KERN_ERR "kgdboc: config string too long\n");
|
||||
|
@ -274,7 +254,7 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
|
|||
|
||||
strcpy(config, kmessage);
|
||||
/* Chop out \n char as a result of echo */
|
||||
if (config[len - 1] == '\n')
|
||||
if (len && config[len - 1] == '\n')
|
||||
config[len - 1] = '\0';
|
||||
|
||||
if (configured == 1)
|
||||
|
@ -318,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = {
|
|||
};
|
||||
|
||||
#ifdef CONFIG_KGDB_SERIAL_CONSOLE
|
||||
static int kgdboc_option_setup(char *opt)
|
||||
{
|
||||
if (!opt) {
|
||||
pr_err("config string not provided\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (strlen(opt) >= MAX_CONFIG_LEN) {
|
||||
pr_err("config string too long\n");
|
||||
return -ENOSPC;
|
||||
}
|
||||
strcpy(config, opt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__setup("kgdboc=", kgdboc_option_setup);
|
||||
|
||||
|
||||
/* This is only available if kgdboc is a built in for early debugging */
|
||||
static int __init kgdboc_early_init(char *opt)
|
||||
{
|
||||
|
|
|
@ -2222,7 +2222,7 @@ static int usb_enumerate_device_otg(struct usb_device *udev)
|
|||
/* descriptor may appear anywhere in config */
|
||||
err = __usb_get_extra_descriptor(udev->rawdescriptors[0],
|
||||
le16_to_cpu(udev->config[0].desc.wTotalLength),
|
||||
USB_DT_OTG, (void **) &desc);
|
||||
USB_DT_OTG, (void **) &desc, sizeof(*desc));
|
||||
if (err || !(desc->bmAttributes & USB_OTG_HNP))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ static const struct usb_device_id usb_quirk_list[] = {
|
|||
/* Microsoft LifeCam-VX700 v2.0 */
|
||||
{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
|
||||
|
||||
/* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */
|
||||
{ USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME },
|
||||
|
||||
/* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */
|
||||
{ USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
|
||||
{ USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
|
||||
|
@ -185,6 +188,10 @@ static const struct usb_device_id usb_quirk_list[] = {
|
|||
/* Midiman M-Audio Keystation 88es */
|
||||
{ USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
|
||||
|
||||
/* SanDisk Ultra Fit and Ultra Flair */
|
||||
{ USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM },
|
||||
{ USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM },
|
||||
|
||||
/* M-Systems Flash Disk Pioneers */
|
||||
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
|
||||
|
||||
|
|
|
@ -726,14 +726,14 @@ EXPORT_SYMBOL(usb_get_xfer_ring_dma_addr);
|
|||
*/
|
||||
|
||||
int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
||||
unsigned char type, void **ptr)
|
||||
unsigned char type, void **ptr, size_t minsize)
|
||||
{
|
||||
struct usb_descriptor_header *header;
|
||||
|
||||
while (size >= sizeof(struct usb_descriptor_header)) {
|
||||
header = (struct usb_descriptor_header *)buffer;
|
||||
|
||||
if (header->bLength < 2) {
|
||||
if (header->bLength < 2 || header->bLength > size) {
|
||||
printk(KERN_ERR
|
||||
"%s: bogus descriptor, type %d length %d\n",
|
||||
usbcore_name,
|
||||
|
@ -742,7 +742,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (header->bDescriptorType == type) {
|
||||
if (header->bDescriptorType == type && header->bLength >= minsize) {
|
||||
*ptr = header;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -379,11 +379,10 @@ static void set_link_state_by_speed(struct dummy_hcd *dum_hcd)
|
|||
USB_PORT_STAT_CONNECTION) == 0)
|
||||
dum_hcd->port_status |=
|
||||
(USB_PORT_STAT_C_CONNECTION << 16);
|
||||
if ((dum_hcd->port_status &
|
||||
USB_PORT_STAT_ENABLE) == 1 &&
|
||||
(dum_hcd->port_status &
|
||||
USB_SS_PORT_LS_U0) == 1 &&
|
||||
dum_hcd->rh_state != DUMMY_RH_SUSPENDED)
|
||||
if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) &&
|
||||
(dum_hcd->port_status &
|
||||
USB_PORT_STAT_LINK_STATE) == USB_SS_PORT_LS_U0 &&
|
||||
dum_hcd->rh_state != DUMMY_RH_SUSPENDED)
|
||||
dum_hcd->active = 1;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -654,7 +654,7 @@ static int hwahc_security_create(struct hwahc *hwahc)
|
|||
top = itr + itr_size;
|
||||
result = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index],
|
||||
le16_to_cpu(usb_dev->actconfig->desc.wTotalLength),
|
||||
USB_DT_SECURITY, (void **) &secd);
|
||||
USB_DT_SECURITY, (void **) &secd, sizeof(*secd));
|
||||
if (result == -1) {
|
||||
dev_warn(dev, "BUG? WUSB host has no security descriptors\n");
|
||||
return 0;
|
||||
|
|
|
@ -4442,6 +4442,14 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci,
|
|||
{
|
||||
unsigned long long timeout_ns;
|
||||
|
||||
/* Prevent U1 if service interval is shorter than U1 exit latency */
|
||||
if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {
|
||||
if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) {
|
||||
dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n");
|
||||
return USB3_LPM_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
if (xhci->quirks & XHCI_INTEL_HOST)
|
||||
timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc);
|
||||
else
|
||||
|
@ -4498,6 +4506,14 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci,
|
|||
{
|
||||
unsigned long long timeout_ns;
|
||||
|
||||
/* Prevent U2 if service interval is shorter than U2 exit latency */
|
||||
if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {
|
||||
if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) {
|
||||
dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n");
|
||||
return USB3_LPM_DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
if (xhci->quirks & XHCI_INTEL_HOST)
|
||||
timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
|
||||
else
|
||||
|
|
|
@ -64,6 +64,7 @@ static const struct usb_device_id appledisplay_table[] = {
|
|||
{ APPLEDISPLAY_DEVICE(0x921c) },
|
||||
{ APPLEDISPLAY_DEVICE(0x921d) },
|
||||
{ APPLEDISPLAY_DEVICE(0x9222) },
|
||||
{ APPLEDISPLAY_DEVICE(0x9226) },
|
||||
{ APPLEDISPLAY_DEVICE(0x9236) },
|
||||
|
||||
/* Terminating entry */
|
||||
|
|
|
@ -38,4 +38,14 @@ UNUSUAL_DEV(0x0bda, 0x0159, 0x0000, 0x9999,
|
|||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
UNUSUAL_DEV(0x0bda, 0x0177, 0x0000, 0x9999,
|
||||
"Realtek",
|
||||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
UNUSUAL_DEV(0x0bda, 0x0184, 0x0000, 0x9999,
|
||||
"Realtek",
|
||||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */
|
||||
|
|
|
@ -445,9 +445,9 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root,
|
|||
int mirror_num = 0;
|
||||
int failed_mirror = 0;
|
||||
|
||||
clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
|
||||
io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;
|
||||
while (1) {
|
||||
clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
|
||||
ret = read_extent_buffer_pages(io_tree, eb, start,
|
||||
WAIT_COMPLETE,
|
||||
btree_get_extent, mirror_num);
|
||||
|
@ -459,14 +459,6 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root,
|
|||
ret = -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* This buffer's crc is fine, but its contents are corrupted, so
|
||||
* there is no reason to read the other copies, they won't be
|
||||
* any less wrong.
|
||||
*/
|
||||
if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags))
|
||||
break;
|
||||
|
||||
num_copies = btrfs_num_copies(root->fs_info,
|
||||
eb->start, eb->len);
|
||||
if (num_copies == 1)
|
||||
|
|
|
@ -2469,6 +2469,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group,
|
|||
struct rb_node *n;
|
||||
int count = 0;
|
||||
|
||||
spin_lock(&ctl->tree_lock);
|
||||
for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) {
|
||||
info = rb_entry(n, struct btrfs_free_space, offset_index);
|
||||
if (info->bytes >= bytes && !block_group->ro)
|
||||
|
@ -2478,6 +2479,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group,
|
|||
info->offset, info->bytes,
|
||||
(info->bitmap) ? "yes" : "no");
|
||||
}
|
||||
spin_unlock(&ctl->tree_lock);
|
||||
btrfs_info(block_group->fs_info, "block group has cluster?: %s",
|
||||
list_empty(&block_group->cluster_list) ? "no" : "yes");
|
||||
btrfs_info(block_group->fs_info,
|
||||
|
|
|
@ -2104,6 +2104,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
|
|||
vol = memdup_user((void __user *)arg, sizeof(*vol));
|
||||
if (IS_ERR(vol))
|
||||
return PTR_ERR(vol);
|
||||
vol->name[BTRFS_PATH_NAME_MAX] = '\0';
|
||||
|
||||
switch (cmd) {
|
||||
case BTRFS_IOC_SCAN_DEV:
|
||||
|
|
|
@ -1821,6 +1821,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
|
|||
return ret;
|
||||
}
|
||||
|
||||
btrfs_trans_release_metadata(trans, root);
|
||||
trans->block_rsv = NULL;
|
||||
|
||||
/* make a pass through all the delayed refs we have so far
|
||||
* any runnings procs may add more while we are here
|
||||
*/
|
||||
|
@ -1830,9 +1833,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
|
|||
return ret;
|
||||
}
|
||||
|
||||
btrfs_trans_release_metadata(trans, root);
|
||||
trans->block_rsv = NULL;
|
||||
|
||||
cur_trans = trans->transaction;
|
||||
|
||||
/*
|
||||
|
|
|
@ -163,7 +163,7 @@ cifs_bp_rename_retry:
|
|||
|
||||
cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath);
|
||||
memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1);
|
||||
full_path[dfsplen] = '\\';
|
||||
full_path[dfsplen] = dirsep;
|
||||
for (i = 0; i < pplen-1; i++)
|
||||
if (full_path[dfsplen+1+i] == '/')
|
||||
full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb);
|
||||
|
|
|
@ -1077,15 +1077,14 @@ killed:
|
|||
return -EAGAIN;
|
||||
}
|
||||
|
||||
char *get_task_comm(char *buf, struct task_struct *tsk)
|
||||
char *__get_task_comm(char *buf, size_t buf_size, struct task_struct *tsk)
|
||||
{
|
||||
/* buf must be at least sizeof(tsk->comm) in size */
|
||||
task_lock(tsk);
|
||||
strncpy(buf, tsk->comm, sizeof(tsk->comm));
|
||||
strncpy(buf, tsk->comm, buf_size);
|
||||
task_unlock(tsk);
|
||||
return buf;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(get_task_comm);
|
||||
EXPORT_SYMBOL_GPL(__get_task_comm);
|
||||
|
||||
/*
|
||||
* These functions flushes out all traces of the currently running executable
|
||||
|
|
|
@ -606,9 +606,9 @@ skip_replace:
|
|||
}
|
||||
|
||||
cleanup:
|
||||
brelse(bh);
|
||||
if (!(bh && header == HDR(bh)))
|
||||
kfree(header);
|
||||
brelse(bh);
|
||||
up_write(&EXT2_I(inode)->xattr_sem);
|
||||
|
||||
return error;
|
||||
|
|
|
@ -88,7 +88,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent,
|
|||
int slen = strlen(kn->name);
|
||||
|
||||
len -= slen;
|
||||
strncpy(s + len, kn->name, slen);
|
||||
memcpy(s + len, kn->name, slen);
|
||||
if (len)
|
||||
s[--len] = '/';
|
||||
|
||||
|
|
|
@ -3082,7 +3082,12 @@ static inline void set_task_comm(struct task_struct *tsk, const char *from)
|
|||
{
|
||||
__set_task_comm(tsk, from, false);
|
||||
}
|
||||
extern char *get_task_comm(char *to, struct task_struct *tsk);
|
||||
|
||||
extern char *__get_task_comm(char *to, size_t len, struct task_struct *tsk);
|
||||
#define get_task_comm(buf, tsk) ({ \
|
||||
BUILD_BUG_ON(sizeof(buf) != TASK_COMM_LEN); \
|
||||
__get_task_comm(buf, sizeof(buf), tsk); \
|
||||
})
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void scheduler_ipi(void);
|
||||
|
|
|
@ -336,11 +336,11 @@ struct usb_host_bos {
|
|||
};
|
||||
|
||||
int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
||||
unsigned char type, void **ptr);
|
||||
unsigned char type, void **ptr, size_t min);
|
||||
#define usb_get_extra_descriptor(ifpoint, type, ptr) \
|
||||
__usb_get_extra_descriptor((ifpoint)->extra, \
|
||||
(ifpoint)->extralen, \
|
||||
type, (void **)ptr)
|
||||
type, (void **)ptr, sizeof(**(ptr)))
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -251,11 +251,13 @@ static inline int snd_interval_empty(const struct snd_interval *i)
|
|||
static inline int snd_interval_single(const struct snd_interval *i)
|
||||
{
|
||||
return (i->min == i->max ||
|
||||
(i->min + 1 == i->max && i->openmax));
|
||||
(i->min + 1 == i->max && (i->openmin || i->openmax)));
|
||||
}
|
||||
|
||||
static inline int snd_interval_value(const struct snd_interval *i)
|
||||
{
|
||||
if (i->openmin && !i->openmax)
|
||||
return i->max;
|
||||
return i->min;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,13 +129,13 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab)
|
|||
}
|
||||
if (i >= ARRAY_SIZE(kdb_name_table)) {
|
||||
debug_kfree(kdb_name_table[0]);
|
||||
memcpy(kdb_name_table, kdb_name_table+1,
|
||||
memmove(kdb_name_table, kdb_name_table+1,
|
||||
sizeof(kdb_name_table[0]) *
|
||||
(ARRAY_SIZE(kdb_name_table)-1));
|
||||
} else {
|
||||
debug_kfree(knt1);
|
||||
knt1 = kdb_name_table[i];
|
||||
memcpy(kdb_name_table+i, kdb_name_table+i+1,
|
||||
memmove(kdb_name_table+i, kdb_name_table+i+1,
|
||||
sizeof(kdb_name_table[0]) *
|
||||
(ARRAY_SIZE(kdb_name_table)-i-1));
|
||||
}
|
||||
|
|
|
@ -606,7 +606,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
|
|||
BUG_ON((uprobe->offset & ~PAGE_MASK) +
|
||||
UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
|
||||
|
||||
smp_wmb(); /* pairs with rmb() in find_active_uprobe() */
|
||||
smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */
|
||||
set_bit(UPROBE_COPY_INSN, &uprobe->flags);
|
||||
|
||||
out:
|
||||
|
@ -1891,10 +1891,18 @@ static void handle_swbp(struct pt_regs *regs)
|
|||
* After we hit the bp, _unregister + _register can install the
|
||||
* new and not-yet-analyzed uprobe at the same address, restart.
|
||||
*/
|
||||
smp_rmb(); /* pairs with wmb() in install_breakpoint() */
|
||||
if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags)))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Pairs with the smp_wmb() in prepare_uprobe().
|
||||
*
|
||||
* Guarantees that if we see the UPROBE_COPY_INSN bit set, then
|
||||
* we must also see the stores to &uprobe->arch performed by the
|
||||
* prepare_uprobe() call.
|
||||
*/
|
||||
smp_rmb();
|
||||
|
||||
/* Tracing handlers use ->utask to communicate with fetch methods */
|
||||
if (!get_utask())
|
||||
goto out;
|
||||
|
|
|
@ -127,7 +127,7 @@ static void fill_kobj_path(struct kobject *kobj, char *path, int length)
|
|||
int cur = strlen(kobject_name(parent));
|
||||
/* back up enough to print this name with '/' */
|
||||
length -= cur;
|
||||
strncpy(path + length, kobject_name(parent), cur);
|
||||
memcpy(path + length, kobject_name(parent), cur);
|
||||
*(path + --length) = '/';
|
||||
}
|
||||
|
||||
|
|
|
@ -504,6 +504,7 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
|
|||
int nr_pages;
|
||||
int ret = 0;
|
||||
int lock = !!(newflags & VM_LOCKED);
|
||||
vm_flags_t old_flags = vma->vm_flags;
|
||||
|
||||
if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) ||
|
||||
is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm))
|
||||
|
@ -538,6 +539,8 @@ success:
|
|||
nr_pages = (end - start) >> PAGE_SHIFT;
|
||||
if (!lock)
|
||||
nr_pages = -nr_pages;
|
||||
else if (old_flags & VM_LOCKED)
|
||||
nr_pages = 0;
|
||||
mm->locked_vm += nr_pages;
|
||||
|
||||
/*
|
||||
|
|
|
@ -499,9 +499,13 @@ void truncate_inode_pages_final(struct address_space *mapping)
|
|||
*/
|
||||
spin_lock_irq(&mapping->tree_lock);
|
||||
spin_unlock_irq(&mapping->tree_lock);
|
||||
|
||||
truncate_inode_pages(mapping, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cleancache needs notification even if there are no pages or shadow
|
||||
* entries.
|
||||
*/
|
||||
truncate_inode_pages(mapping, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(truncate_inode_pages_final);
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ batadv_frag_merge_packets(struct hlist_head *chain)
|
|||
kfree(entry);
|
||||
|
||||
packet = (struct batadv_frag_packet *)skb_out->data;
|
||||
size = ntohs(packet->total_size);
|
||||
size = ntohs(packet->total_size) + hdr_size;
|
||||
|
||||
/* Make room for the rest of the fragments. */
|
||||
if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
|
||||
|
|
|
@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net,
|
|||
} else {
|
||||
if (strlen(ops->kind) > (IFNAMSIZ - 3))
|
||||
goto failed;
|
||||
strlcpy(name, ops->kind, IFNAMSIZ);
|
||||
strncat(name, "%d", 2);
|
||||
strcpy(name, ops->kind);
|
||||
strcat(name, "%d");
|
||||
}
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
|
|
@ -988,6 +988,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
|
|||
if (local->open_count == 0)
|
||||
ieee80211_clear_tx_pending(local);
|
||||
|
||||
sdata->vif.bss_conf.beacon_int = 0;
|
||||
|
||||
/*
|
||||
* If the interface goes down while suspended, presumably because
|
||||
* the device was unplugged and that happens before our resume,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue