1. 19 Feb, 2019 25 commits
  2. 18 Feb, 2019 15 commits
    • Felix Fietkau's avatar
      mt76: mt76x2: simplify per-chain signal strength handling · 9f688473
      Felix Fietkau authored
      There is no need to use a for loop here, supported chips can only support
      up to 2 chains.
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      9f688473
    • Felix Fietkau's avatar
      mt76: fix resetting software IV flag on key delete · f2f6a47b
      Felix Fietkau authored
      It needs to be unset instead of set
      
      Fixes: 23405236 ("mt76: fix transmission of encrypted management frames")
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      f2f6a47b
    • Felix Fietkau's avatar
      mt76: fix corrupted software generated tx CCMP PN · 906d2d3f
      Felix Fietkau authored
      Since ccmp_pn is u8 *, the second half needs to start at array index 4
      instead of 0. Fixes a connection stall after a certain amount of traffic
      
      Fixes: 23405236 ("mt76: fix transmission of encrypted management frames")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      906d2d3f
    • Felix Fietkau's avatar
      mt76: fix tx status timeout processing · b231cd7f
      Felix Fietkau authored
      Remove bogus check for MT_PACKET_ID_NO_ACK in mt76_tx_status_skb_get, which
      is already handled in callers and turns timeout calls into no-ops
      Do not clean up pending status items on reordering of tx status information
      if the timeout is not reached yet
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      b231cd7f
    • Ben Hutchings's avatar
      mt76: Use the correct hweight8() function · d0ff23c1
      Ben Hutchings authored
      mt76_init_stream_cap() and mt76_get_txpower() call __sw_hweight8()
      directly, but that's only defined if CONFIG_GENERIC_HWEIGHT is
      enabled.  The function that works on all architectures is hweight8().
      
      Fixes: 551e1ef4 ("mt76: add mt76_init_stream_cap routine")
      Fixes: 9313faac ("mt76: move mt76x02_get_txpower to mt76 core")
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      d0ff23c1
    • Stanislaw Gruszka's avatar
      mt76x02u: remove bogus check and comment padding · 3eeb7c06
      Stanislaw Gruszka authored
      In mt76x02u_skb_dma_info() pad is always non-zero. Patch removes
      bogus check and add comments to the function.
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      3eeb7c06
    • Lorenzo Bianconi's avatar
      mt76: usb: use dev_err_ratelimited instead of dev_err in mt76u_complete_rx · 4bfff1ec
      Lorenzo Bianconi authored
      During device removal the driver can report multiple error messages.
      Use dev_err_ratelimited instead of dev_err to display urb errors
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      4bfff1ec
    • Lorenzo Bianconi's avatar
      mt76: usb: introduce disable_usb_sg parameter · c2908a0d
      Lorenzo Bianconi authored
      Add disable_usb_sg module parameter to disable scatter-gather on demand
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      c2908a0d
    • Lorenzo Bianconi's avatar
      mt76: usb: use a linear buffer for tx/rx datapath if sg is not supported · f7522949
      Lorenzo Bianconi authored
      Use linear fragment and not a single usb scatter-gather buffer in mt76u
      {tx,rx} datapath if the usb controller has sg data length constraints
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      f7522949
    • Lorenzo Bianconi's avatar
      mt76: usb: do not use sg buffers for mcu messages · d704d16f
      Lorenzo Bianconi authored
      Do not use scatter-gather buffers for mcu commands.
      Introduce mt76u_buf_alloc and mt76u_buf_alloc_sg routines.
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      d704d16f
    • Lorenzo Bianconi's avatar
      mt76: usb: move mt76u_check_sg in usb.c · 63a7de5d
      Lorenzo Bianconi authored
      Move mt76u_check_sg routine in usb.c and introduce sg_en variable
      in mt76_usb in order to check if scatter-gather is supported by
      mt76u layer
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      63a7de5d
    • Lorenzo Bianconi's avatar
      mt76: usb: do not run mt76u_queues_deinit twice · b3098121
      Lorenzo Bianconi authored
      Do not call mt76u_queues_deinit routine in mt76u_alloc_queues error path
      since it will be run in mt76x0u_register_device or
      mt76x2u_register_device error path. Current implementation triggers the
      following kernel warning:
      
      [   67.005516] WARNING: CPU: 2 PID: 761 at lib/refcount.c:187 refcount_sub_and_test_checked+0xa4/0xb8
      [   67.019513] refcount_t: underflow; use-after-free.
      [   67.099872] Hardware name: BCM2835
      [   67.106268] Backtrace:
      [   67.111584] [<8010c91c>] (dump_backtrace) from [<8010cc00>] (show_stack+0x20/0x24)
      [   67.124974]  r6:60000013 r5:ffffffff r4:00000000 r3:a50bade6
      [   67.132226] [<8010cbe0>] (show_stack) from [<807ca5f4>] (dump_stack+0xc8/0x114)
      [   67.141225] [<807ca52c>] (dump_stack) from [<8011e65c>] (__warn+0xf4/0x120)
      [   67.149849]  r9:000000bb r8:804d0138 r7:00000009 r6:8099dc84 r5:00000000 r4:b66c7b58
      [   67.160767] [<8011e568>] (__warn) from [<8011e6d0>] (warn_slowpath_fmt+0x48/0x50)
      [   67.171436]  r9:7f65e128 r8:80d1419c r7:80c0bac4 r6:b97b3044 r5:b7368e00 r4:00000000
      [   67.182433] [<8011e68c>] (warn_slowpath_fmt) from [<804d0138>] (refcount_sub_and_test_checked+0xa4/0xb8)
      [   67.195221]  r3:80c91c25 r2:8099dc94
      [   67.200370]  r4:00000000
      [   67.204397] [<804d0094>] (refcount_sub_and_test_checked) from [<804d0164>] (refcount_dec_and_test_checked+0x18/0x1c)
      [   67.218046]  r4:b7368e00 r3:00000001
      [   67.223125] [<804d014c>] (refcount_dec_and_test_checked) from [<805db49c>] (usb_free_urb+0x20/0x4c)
      [   67.235358] [<805db47c>] (usb_free_urb) from [<7f639804>] (mt76u_buf_free+0x98/0xac [mt76_usb])
      [   67.247302]  r4:00000001 r3:00000001
      [   67.252468] [<7f63976c>] (mt76u_buf_free [mt76_usb]) from [<7f639ef8>] (mt76u_queues_deinit+0x44/0x100 [mt76_usb])
      [   67.266102]  r8:b8fe8600 r7:b5dac480 r6:b5dace20 r5:00000001 r4:00000000 r3:00000080
      [   67.277132] [<7f639eb4>] (mt76u_queues_deinit [mt76_usb]) from [<7f65c040>] (mt76x0u_cleanup+0x40/0x4c [mt76x0u])
      [   67.290737]  r7:b5dac480 r6:b8fe8600 r5:ffffffea r4:b5dace20
      [   67.298069] [<7f65c000>] (mt76x0u_cleanup [mt76x0u]) from [<7f65c564>] (mt76x0u_probe+0x1f0/0x354 [mt76x0u])
      [   67.311174]  r4:b5dace20 r3:00000000
      [   67.316312] [<7f65c374>] (mt76x0u_probe [mt76x0u]) from [<805e0b6c>] (usb_probe_interface+0x104/0x240)
      [   67.328915]  r7:00000000 r6:7f65e034 r5:b6634800 r4:b8fe8620
      [   67.336276] [<805e0a68>] (usb_probe_interface) from [<8056a8bc>] (really_probe+0x224/0x2f8)
      [   67.347965]  r10:b65f0a00 r9:00000019 r8:7f65e034 r7:80d3e124 r6:00000000 r5:80d3e120
      [   67.359175]  r4:b8fe8620 r3:805e0a68
      [   67.364384] [<8056a698>] (really_probe) from [<8056ab60>] (driver_probe_device+0x6c/0x180)
      [   67.375974]  r10:b65f0a00 r9:7f65e2c0 r8:b8fe8620 r7:00000000 r6:7f65e034 r5:7f65e034
      [   67.387170]  r4:b8fe8620 r3:00000000
      [   67.392378] [<8056aaf4>] (driver_probe_device) from [<8056ad54>] (__driver_attach+0xe0/0xe4)
      [   67.404097]  r9:7f65e2c0 r8:7f65d22c r7:00000000 r6:b8fe8654 r5:7f65e034 r4:b8fe8620
      [   67.415122] [<8056ac74>] (__driver_attach) from [<8056880c>] (bus_for_each_dev+0x68/0xa0)
      [   67.426628]  r6:8056ac74 r5:7f65e034 r4:00000000 r3:00000027
      [   67.434017] [<805687a4>] (bus_for_each_dev) from [<8056a1cc>] (driver_attach+0x28/0x30)
      [   67.445394]  r6:80c6ddc8 r5:b7368f80 r4:7f65e034
      [   67.451703] [<8056a1a4>] (driver_attach) from [<80569c24>] (bus_add_driver+0x194/0x21c)
      [   67.463081] [<80569a90>] (bus_add_driver) from [<8056b504>] (driver_register+0x8c/0x124)
      [   67.474560]  r7:80c6ddc8 r6:7f65e034 r5:00000000 r4:7f65e034
      [   67.481964] [<8056b478>] (driver_register) from [<805df510>] (usb_register_driver+0x74/0x140)
      [   67.493901]  r5:00000000 r4:7f65e000
      [   67.499131] [<805df49c>] (usb_register_driver) from [<7f661024>] (mt76x0_driver_init+0x24/0x1000 [mt76x0u])
      [   67.512258]  r9:00000001 r8:7f65e308 r7:00000000 r6:80c08d48 r5:7f661000 r4:7f65e2c0
      [   67.523404] [<7f661000>] (mt76x0_driver_init [mt76x0u]) from [<80102f6c>] (do_one_initcall+0x4c/0x210)
      [   67.536142] [<80102f20>] (do_one_initcall) from [<801ae63c>] (do_init_module+0x6c/0x21c)
      [   67.547639]  r8:7f65e308 r7:80c08d48 r6:b65f0ac0 r5:7f65e2c0 r4:7f65e2c0
      [   67.556129] [<801ae5d0>] (do_init_module) from [<801ad68c>] (load_module+0x1d10/0x2304)
      
      Fixes: b40b15e1 ("mt76: add usb support to mt76 layer")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      b3098121
    • Lorenzo Bianconi's avatar
      mt76: usb: fix possible memory leak in mt76u_buf_free · cb83585e
      Lorenzo Bianconi authored
      Move q->ndesc initialization before the for loop in mt76u_alloc_rx
      since otherwise allocated urbs will not be freed in mt76u_buf_free
      Double-check scatterlist pointer in mt76u_buf_free
      
      Fixes: b40b15e1 ("mt76: add usb support to mt76 layer")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      cb83585e
    • Lorenzo Bianconi's avatar
      mt76: usb: fix possible NULL pointer dereference in mt76u_mcu_deinit · bdba48d5
      Lorenzo Bianconi authored
      Fix possible NULL pointer dereference in mt76u_mcu_deinit routine that
      can occur if initialization path fails before calling mt76u_mcu_init_rx
      
      Fixes: ee676cd5 ("mt76: add driver code for MT76x2u based devices")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      bdba48d5
    • Stanislaw Gruszka's avatar
      mt76x02u: use usb_bulk_msg to upload firmware · 5de4db8f
      Stanislaw Gruszka authored
      We don't need to send firmware data asynchronously, much simpler is just
      use synchronous usb_bulk_msg().
      Tested-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      5de4db8f