1. 28 May, 2020 17 commits
    • YueHaibing's avatar
      mt76: mt7615: Use kmemdup in mt7615_queue_key_update() · 194a1508
      YueHaibing authored
      Use kmemdup rather than duplicating its implementation
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      194a1508
    • Felix Fietkau's avatar
      mt76: only iterate over initialized rx queues · f473b42a
      Felix Fietkau authored
      Fixes the following reported crash:
      
      [    2.361127] BUG: spinlock bad magic on CPU#0, modprobe/456
      [    2.361583]  lock: 0xffffa1287525b3b8, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
      [    2.362250] CPU: 0 PID: 456 Comm: modprobe Not tainted 4.14.177 #5
      [    2.362751] Hardware name: HP Meep/Meep, BIOS Google_Meep.11297.75.0 06/17/2019
      [    2.363343] Call Trace:
      [    2.363552]  dump_stack+0x97/0xdb
      [    2.363826]  ? spin_bug+0xa6/0xb3
      [    2.364096]  do_raw_spin_lock+0x6a/0x9a
      [    2.364417]  mt76_dma_rx_fill+0x44/0x1de [mt76]
      [    2.364787]  ? mt76_dma_kick_queue+0x18/0x18 [mt76]
      [    2.365184]  mt76_dma_init+0x53/0x85 [mt76]
      [    2.365532]  mt7615_dma_init+0x3d7/0x546 [mt7615e]
      [    2.365928]  mt7615_register_device+0xe6/0x1a0 [mt7615e]
      [    2.366364]  mt7615_mmio_probe+0x14b/0x171 [mt7615e]
      [    2.366771]  mt7615_pci_probe+0x118/0x13b [mt7615e]
      [    2.367169]  pci_device_probe+0xaf/0x13d
      [    2.367491]  driver_probe_device+0x284/0x2ca
      [    2.367840]  __driver_attach+0x7a/0x9e
      [    2.368146]  ? driver_attach+0x1f/0x1f
      [    2.368451]  bus_for_each_dev+0xa0/0xdb
      [    2.368765]  bus_add_driver+0x132/0x204
      [    2.369078]  driver_register+0x8e/0xcd
      [    2.369384]  do_one_initcall+0x160/0x257
      [    2.369706]  ? 0xffffffffc0240000
      [    2.369980]  do_init_module+0x60/0x1bb
      [    2.370286]  load_module+0x18c2/0x1a2b
      [    2.370596]  ? kernel_read_file+0x141/0x1b9
      [    2.370937]  ? kernel_read_file_from_fd+0x46/0x71
      [    2.371320]  SyS_finit_module+0xcc/0xf0
      [    2.371636]  do_syscall_64+0x6b/0xf7
      [    2.371930]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      [    2.372344] RIP: 0033:0x7da218ae4199
      [    2.372637] RSP: 002b:00007fffd0608398 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      [    2.373252] RAX: ffffffffffffffda RBX: 00005a705449df90 RCX: 00007da218ae4199
      [    2.373833] RDX: 0000000000000000 RSI: 00005a7052e73bd8 RDI: 0000000000000006
      [    2.374411] RBP: 00007fffd06083e0 R08: 0000000000000000 R09: 00005a705449d540
      [    2.374989] R10: 0000000000000006 R11: 0000000000000246 R12: 0000000000000000
      [    2.375569] R13: 00005a705449def0 R14: 00005a7052e73bd8 R15: 0000000000000000
      Reported-by: default avatarSean Wang <sean.wang@mediatek.com>
      Fixes: d3377b78 ("mt76: add HE phy modes and hardware queue")
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      f473b42a
    • DENG Qingfang's avatar
      mt76: mt7615: add support for MT7611N · e47f2245
      DENG Qingfang authored
      MT7611N is basically the same as MT7615N, except it only supports 5GHz
      It is used by some TP-Link and Mercury wireless routers
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      e47f2245
    • Felix Fietkau's avatar
      mt76: fix wcid allocation issues · 5e616ad2
      Felix Fietkau authored
      mt76 core uses ffs() to find the next free bit. This works well for 32 bit
      architectures where BITS_PER_LONG is 32. ffs only checks 32 bit values, so
      allocation fails on 64 bit architectures.
      Additionally, the wcid mask array was too small in cases where the array
      was not a multiple of BITS_PER_LONG.
      Fix this by making the wcid mask array u32 instead and use DIV_ROUND_UP
      for the size, just in case we ever bump it to a value that's not a multiple
      of 32.
      Reported-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      5e616ad2
    • Lorenzo Bianconi's avatar
      mt76: mt7915: fix possible NULL pointer dereference in mt7915_register_ext_phy · ec2bb3a5
      Lorenzo Bianconi authored
      Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
      data structure is allocated by mt76_alloc_phy routine
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      ec2bb3a5
    • Sean Wang's avatar
      mt76: mt7615: fix hw_scan with ssid_type for specified SSID only · eca02655
      Sean Wang authored
      Fix hw_scan with ssid_type for specified SSID only
      
      The definition for ssid_type in current firmware is that
      ssid_type BIT(2) set actually for specified SSID + wildcard SSID.
      ssid_type BIT(2) and ssid_type_ext BIT(0) both set actually for
      specified SSID only;
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      eca02655
    • Colin Ian King's avatar
      mt76: mt7915: fix a handful of spelling mistakes · 6f4bd852
      Colin Ian King authored
      There are some spelling mistakes in some literal strings. Fix these.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      6f4bd852
    • Lorenzo Bianconi's avatar
      mt76: mt7615: switch to per-vif power_save support · a5e0aa78
      Lorenzo Bianconi authored
      switch to per-vif ps support since mt7615 offload firmware can handle it
      properly. This patch allows enabling/disabling power-save support on p2p
      interface
      Tested-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      a5e0aa78
    • Ryder Lee's avatar
      mt76: mt7915: fix some sparse warnings · b62db09a
      Ryder Lee authored
      drivers/net/wireless/mediatek/mt76/mt7915/main.c:694:1: sparse:
      sparse: context imbalance in 'mt7915_sta_rc_update' - wrong count at exit
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:303:43: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:304:43: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:305:43: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:319:35: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:327:35: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:345:41: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:355:33: sparse: sparse: cast to restricted __le32
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse: sparse: invalid assignment: |=
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse:    left side has type unsigned int
      drivers/net/wireless/mediatek/mt76/mt7915/mac.c:451:21: sparse:    right side has type restricted __le32
      
      Fixes: e57b7901 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      b62db09a
    • Felix Fietkau's avatar
      mt76: fix per-driver wcid range checks after wcid array size bump · 238f5d6f
      Felix Fietkau authored
      All drivers before MT7915 have a limit of 128 WCID entries. Stop relying
      on ARRAY_SIZE(dev->mt76.wcid), since it no longer reflects that limit.
      
      Fixes: 49e649c3 ("mt76: adjust wcid size to support new 802.11ax generation")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      238f5d6f
    • Ryder Lee's avatar
      mt76: mt7915: fix decoded radiotap HE flags · ae4027a7
      Ryder Lee authored
      Move assignment of .data1 and .data2 to a single place and fix overwriting
      of values from the template
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      ae4027a7
    • Lorenzo Bianconi's avatar
      mt76: mt7615: fix NULL pointer deref in mt7615_register_ext_phy · 4c04f25d
      Lorenzo Bianconi authored
      Fix following NULL pointer dereference in mt7615_register_ext_phy routine
      
      [   27.648860] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000060
      [   27.657697] Mem abort info:
      [   27.660495]   ESR = 0x96000046
      [   27.663549]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   27.668857]   SET = 0, FnV = 0
      [   27.671910]   EA = 0, S1PTW = 0
      [   27.675040] Data abort info:
      [   27.677918]   ISV = 0, ISS = 0x00000046
      [   27.681751]   CM = 0, WnR = 1
      [   27.684717] user pgtable: 4k pages, 39-bit VAs, pgdp=000000007d8cc000
      [   27.691156] [0000000000000060] pgd=000000007d281003, pud=000000007d281003, pmd=0000000000000000
      [   27.699857] Internal error: Oops: 96000046 [#1] SMP
      [   27.774939] CPU: 1 PID: 701 Comm: ash Not tainted 5.4.41 #0
      [   27.780500] Hardware name: Bananapi BPI-R64 (DT)
      [   27.785108] pstate: 60000005 (nZCv daif -PAN -UAO)
      [   27.789897] pc : mt7615_register_ext_phy+0x60/0x2c8 [mt7615_common]
      [   27.796156] lr : mt7615_init_debugfs+0x99c/0x18e0 [mt7615_common]
      [   27.802237] sp : ffffffc0115dbcb0
      [   27.805541] x29: ffffffc0115dbcb0 x28: ffffff803e309600
      [   27.810843] x27: 0000000000000000 x26: 0000000000000000
      [   27.816144] x25: ffffff803d936928 x24: ffffff803d936950
      [   27.821447] x23: 0000000000000000 x22: 0000000fffffffe0
      [   27.826749] x21: 0000000000000002 x20: ffffff8001e82620
      [   27.832050] x19: 0000000000000000 x18: 0000000000000000
      [   27.837352] x17: 0000000000000000 x16: 0000000000000000
      [   27.842653] x15: 0000000000000000 x14: 0000000000000000
      [   27.847955] x13: 0000000000000000 x12: 0000000000000000
      [   27.853256] x11: 0000000000000000 x10: 0000000000000040
      [   27.858558] x9 : ffffffc0112b3eb0 x8 : ffffffc0112b3ea8
      [   27.863859] x7 : ffffff803e400048 x6 : 0000000000000000
      [   27.869161] x5 : ffffff803e400000 x4 : 0000000000000000
      [   27.874462] x3 : 0000000000000001 x2 : 0000000000007615
      [   27.879764] x1 : 0000000000000068 x0 : ffffffc0088ccc58
      [   27.885066] Call trace:
      [   27.887505]  mt7615_register_ext_phy+0x60/0x2c8 [mt7615_common]
      [   27.893416]  mt7615_init_debugfs+0x99c/0x18e0 [mt7615_common]
      [   27.899156]  simple_attr_write+0xf0/0x178
      [   27.903158]  debugfs_attr_write+0x4c/0x70
      [   27.907159]  full_proxy_write+0x60/0x90
      [   27.910987]  __vfs_write+0x18/0x40
      [   27.914379]  vfs_write+0xb0/0x1b8
      [   27.917685]  ksys_write+0x4c/0xc8
      [   27.920989]  __arm64_sys_write+0x18/0x20
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      4c04f25d
    • Ryder Lee's avatar
      mt76: mt7915: fix sparse warnings: incorrect type initializer · 19e29c69
      Ryder Lee authored
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:2317:31: sparse: sparse:
      incorrect type in initializer (different base types)
      
      Fixes: 5517f78b ("mt76: mt7915: enable firmware module debug support")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      19e29c69
    • Ryder Lee's avatar
      mt76: mt7915: fix some sparse warnings · f9a5c056
      Ryder Lee authored
      This fixes the following sparse warning:
      
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse: sparse: mixing different enum types:
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt7915_txq_id
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:253:16: sparse:    unsigned int enum mt76_txq_id
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse: sparse: incorrect type in argument 2 (different address spaces)
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    expected unsigned char const [usertype] *ies
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:758:63: sparse:    got unsigned char const [noderef] <asn:4> *
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: incorrect type in argument 1 (different base types)
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    expected unsigned int w
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse:    got restricted __le32 [usertype] supp_ht_mcs
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1390:23: sparse: sparse: restricted __le32 degrades to integer
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1429:60: sparse: sparse: bad assignment (>>=) to restricted __le16
      drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1773:16: sparse: sparse: restricted __le32 degrades to integer
      
      Fixes: 6094f86f ("mt76: mt7915: add HE bss_conf support for interfaces")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      f9a5c056
    • Ryder Lee's avatar
      mt76: mt7915: add spatial reuse support · 06acdd38
      Ryder Lee authored
      Enable or disable OBSS PD when the bss config changes or we
      assoc to an AP that broadcasts the IE.
      
      With this patch, we can get ~20% gain in OBSS OTA environment.
      Tested-by: default avatarEvelyn Tsai <evelyn.tsai@mediatek.com>
      Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      06acdd38
    • Lorenzo Bianconi's avatar
      mt76: mt76x02: remove check in mt76x02_mcu_msg_send · 802b836a
      Lorenzo Bianconi authored
      mt76x02_mcu_msg_send is run just by mmio code so get rid of
      mt76_is_mmio() check
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      802b836a
    • Lorenzo Bianconi's avatar
      mt76: mt7615: introduce remain_on_channel support · 7307f296
      Lorenzo Bianconi authored
      Introduce remain_on_channel support to mt7615 driver if the device is
      running offload firmware
      Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      7307f296
  2. 27 May, 2020 23 commits