This project is mirrored from https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git. Pull mirroring updated .
  1. 26 Jun, 2021 16 commits
    • Kai-Heng Feng's avatar
      Bluetooth: Shutdown controller after workqueues are flushed or cancelled · 0ea9fd00
      Kai-Heng Feng authored
      
      
      Rfkill block and unblock Intel USB Bluetooth [8087:0026] may make it
      stops working:
      [  509.691509] Bluetooth: hci0: HCI reset during shutdown failed
      [  514.897584] Bluetooth: hci0: MSFT filter_enable is already on
      [  530.044751] usb 3-10: reset full-speed USB device number 5 using xhci_hcd
      [  545.660350] usb 3-10: device descriptor read/64, error -110
      [  561.283530] usb 3-10: device descriptor read/64, error -110
      [  561.519682] usb 3-10: reset full-speed USB device number 5 using xhci_hcd
      [  566.686650] Bluetooth: hci0: unexpected event for opcode 0x0500
      [  568.752452] Bluetooth: hci0: urb 0000000096cd309b failed to resubmit (113)
      [  578.797955] Bluetooth: hci0: Failed to read MSFT supported features (-110)
      [  586.286565] Bluetooth: hci0: urb 00000000c522f633 failed to resubmit (113)
      [  596.215302] Bluetooth: hci0: Failed to read MSFT supported features (-110)
      
      Or kernel panics because other workqueues already freed skb:
      [ 2048.663763] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [ 2048.663775] #PF: supervisor read access in kernel mode
      [ 2048.663779] #PF: error_code(0x0000) - not-present page
      [ 2048.663782] PGD 0 P4D 0
      [ 2048.663787] Oops: 0000 [#1] SMP NOPTI
      [ 2048.663793] CPU: 3 PID: 4491 Comm: rfkill Tainted: G        W         5.13.0-rc1-next-20210510+ #20
      [ 2048.663799] Hardware name: HP HP EliteBook 850 G8 Notebook PC/8846, BIOS T76 Ver. 01.01.04 12/02/2020
      [ 2048.663801] RIP: 0010:__skb_ext_put+0x6/0x50
      [ 2048.663814] Code: 8b 1b 48 85 db 75 db 5b 41 5c 5d c3 be 01 00 00 00 e8 de 13 c0 ff eb e7 be 02 00 00 00 e8 d2 13 c0 ff eb db 0f 1f 44 00 00 55 <8b> 07 48 89 e5 83 f8 01 74 14 b8 ff ff ff ff f0 0f c1
      07 83 f8 01
      [ 2048.663819] RSP: 0018:ffffc1d105b6fd80 EFLAGS: 00010286
      [ 2048.663824] RAX: 0000000000000000 RBX: ffff9d9ac5649000 RCX: 0000000000000000
      [ 2048.663827] RDX: ffffffffc0d1daf6 RSI: 0000000000000206 RDI: 0000000000000000
      [ 2048.663830] RBP: ffffc1d105b6fd98 R08: 0000000000000001 R09: ffff9d9ace8ceac0
      [ 2048.663834] R10: ffff9d9ace8ceac0 R11: 0000000000000001 R12: ffff9d9ac5649000
      [ 2048.663838] R13: 0000000000000000 R14: 00007ffe0354d650 R15: 0000000000000000
      [ 2048.663843] FS:  00007fe02ab19740(0000) GS:ffff9d9e5f8c0000(0000) knlGS:0000000000000000
      [ 2048.663849] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 2048.663853] CR2: 0000000000000000 CR3: 0000000111a52004 CR4: 0000000000770ee0
      [ 2048.663856] PKRU: 55555554
      [ 2048.663859] Call Trace:
      [ 2048.663865]  ? skb_release_head_state+0x5e/0x80
      [ 2048.663873]  kfree_skb+0x2f/0xb0
      [ 2048.663881]  btusb_shutdown_intel_new+0x36/0x60 [btusb]
      [ 2048.663905]  hci_dev_do_close+0x48c/0x5e0 [bluetooth]
      [ 2048.663954]  ? __cond_resched+0x1a/0x50
      [ 2048.663962]  hci_rfkill_set_block+0x56/0xa0 [bluetooth]
      [ 2048.664007]  rfkill_set_block+0x98/0x170
      [ 2048.664016]  rfkill_fop_write+0x136/0x1e0
      [ 2048.664022]  vfs_write+0xc7/0x260
      [ 2048.664030]  ksys_write+0xb1/0xe0
      [ 2048.664035]  ? exit_to_user_mode_prepare+0x37/0x1c0
      [ 2048.664042]  __x64_sys_write+0x1a/0x20
      [ 2048.664048]  do_syscall_64+0x40/0xb0
      [ 2048.664055]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [ 2048.664060] RIP: 0033:0x7fe02ac23c27
      [ 2048.664066] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
      [ 2048.664070] RSP: 002b:00007ffe0354d638 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [ 2048.664075] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe02ac23c27
      [ 2048.664078] RDX: 0000000000000008 RSI: 00007ffe0354d650 RDI: 0000000000000003
      [ 2048.664081] RBP: 0000000000000000 R08: 0000559b05998440 R09: 0000559b05998440
      [ 2048.664084] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
      [ 2048.664086] R13: 0000000000000000 R14: ffffffff00000000 R15: 00000000ffffffff
      
      So move the shutdown callback to a place where workqueues are either
      flushed or cancelled to resolve the issue.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      0ea9fd00
    • Mikhail Rudenko's avatar
      Bluetooth: btbcm: Add entry for BCM43430B0 UART Bluetooth · 27f4d1f2
      Mikhail Rudenko authored
      
      
      This patch adds the device ID for the BCM43430B0 module, found e.g. in
      certain revisions of AMPAK AP6212 chip. The required firmware file is
      named 'BCM43430B0.hcd'.
      Signed-off-by: default avatarMikhail Rudenko <mike.rudenko@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      27f4d1f2
    • Connor Abbott's avatar
      Bluetooth: btqca: Don't modify firmware contents in-place · b43ca511
      Connor Abbott authored
      struct firmware::data is marked const, and when the firmware is
      compressed with xz (default at least with Fedora) it's mapped read-only
      which results in a crash:
      
      BUG: unable to handle page fault for address: ffffae57c0ca5047
      PGD 100000067 P4D 100000067 PUD 1001ce067 PMD 10165a067 PTE 8000000112bba161
      Oops: 0003 [#1] SMP NOPTI
      CPU: 3 PID: 204 Comm: kworker/u17:0 Not tainted 5.12.1-test+ #1
      Hardware name: Dell Inc. XPS 13 9310/0F7M4C, BIOS 1.2.5 12/10/2020
      Workqueue: hci0 hci_power_on [bluetooth]
      RIP: 0010:qca_download_firmware+0x27c/0x4e0 [btqca]
      Code: 1b 75 04 80 48 0c 01 0f b7 c6 8d 54 02 0c 41 39 d7 0f 8e 62 fe ff ff 48 63 c2 4c 01 e8 0f b7 38 0f b7 70 02 66 83 ff 11 75 d3 <80> 48 0c 80 41 83 fc 03 7e 6e 88 58 0d eb ce 41 0f b6 45 0e 48 8b
      RSP: 0018:ffffae57c08dfc68 EFLAGS: 00010246
      RAX: ffffae57c0ca503b RBX: 000000000000000e RCX: 0000000000000000
      RDX: 0000000000000037 RSI: 0000000000000006 RDI: 0000000000000011
      RBP: ffff978d9949e000 R08: ffff978d84ed7540 R09: ffffae57c0ca5000
      R10: 000000000010cd00 R11: 0000000000000001 R12: 0000000000000005
      R13: ffffae57c0ca5004 R14: ffff978d98ca8680 R15: 00000000000016a9
      FS:  0000000000000000(0000) GS:ffff9794ef6c0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffae57c0ca5047 CR3: 0000000113d5a004 CR4: 0000000000770ee0
      PKRU: 55555554
      Call Trace:
       qca_uart_setup+0x2cb/0x1390 [btqca]
       ? qca_read_soc_version+0x136/0x220 [btqca]
       qca_setup+0x288/0xab0 [hci_uart]
       hci_dev_do_open+0x1f3/0x780 [bluetooth]
       ? try_to_wake_up+0x1c1/0x4f0
       hci_power_on+0x3f/0x200 [bluetooth]
       process_one_work+0x1ec/0x380
       worker_thread+0x53/0x3e0
       ? process_one_work+0x380/0x380
       kthread+0x11b/0x140
       ? kthread_associate_blkcg+0xa0/0xa0
       ret_from_fork+0x1f/0x30
      Modules linked in: llc ip_set nf_tables nfnetlink snd_soc_skl_hda_dsp(+) ip6table_filter snd_soc_hdac_hdmi ip6_tables qrtr_mhi iptable_filter snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic s>
       dell_wmi_sysman(+) dell_smbios snd dcdbas mhi vfat videobuf2_vmalloc i2c_i801 videobuf2_memops videobuf2_v4l2 dell_wmi_descriptor fat wmi_bmof soundcore i2c_smbus videobuf2_common libarc4 mei_me mei hid_se>
       i2c_hid_acpi i2c_hid video pinctrl_tigerlake fuse
      CR2: ffffae57c0ca5047
      
      This also seems to fix a failure to suspend due to the firmware
      download on bootup getting interrupted by the crash:
      
      Bluetooth: hci0: SSR or FW download time out
      PM: dpm_run_callback(): acpi_subsys_suspend+0x0/0x60 returns -110
      PM: Device serial0-0 failed to suspend: error -110
      PM: Some devices failed to suspend, or early wake event detected
      
      Fixes: 83e81961
      
       ("Bluetooth: btqca: Introduce generic QCA ROME support")
      Cc: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarConnor Abbott <cwabbott0@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b43ca511
    • Kiran K's avatar
      Bluetooth: Fix alt settings for incoming SCO with transparent coding format · 06d213d8
      Kiran K authored
      
      
      For incoming SCO connection with transparent coding format, alt setting
      of CVSD is getting applied instead of Transparent.
      
      Before fix:
      < HCI Command: Accept Synchron.. (0x01|0x0029) plen 21  #2196 [hci0] 321.342548
              Address: 1C:CC:D6:E2:EA:80 (Xiaomi Communications Co Ltd)
              Transmit bandwidth: 8000
              Receive bandwidth: 8000
              Max latency: 13
              Setting: 0x0003
                Input Coding: Linear
                Input Data Format: 1's complement
                Input Sample Size: 8-bit
                # of bits padding at MSB: 0
                Air Coding Format: Transparent Data
              Retransmission effort: Optimize for link quality (0x02)
              Packet type: 0x003f
                HV1 may be used
                HV2 may be used
                HV3 may be used
                EV3 may be used
                EV4 may be used
                EV5 may be used
      > HCI Event: Command Status (0x0f) plen 4               #2197 [hci0] 321.343585
            Accept Synchronous Connection Request (0x01|0x0029) ncmd 1
              Status: Success (0x00)
      > HCI Event: Synchronous Connect Comp.. (0x2c) plen 17  #2198 [hci0] 321.351666
              Status: Success (0x00)
              Handle: 257
              Address: 1C:CC:D6:E2:EA:80 (Xiaomi Communications Co Ltd)
              Link type: eSCO (0x02)
              Transmission interval: 0x0c
              Retransmission window: 0x04
              RX packet length: 60
              TX packet length: 60
              Air mode: Transparent (0x03)
      ........
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2336 [hci0] 321.383655
      < SCO Data TX: Handle 257 flags 0x00 dlen 60            #2337 [hci0] 321.389558
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2338 [hci0] 321.393615
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2339 [hci0] 321.393618
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2340 [hci0] 321.393618
      < SCO Data TX: Handle 257 flags 0x00 dlen 60            #2341 [hci0] 321.397070
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2342 [hci0] 321.403622
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2343 [hci0] 321.403625
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2344 [hci0] 321.403625
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2345 [hci0] 321.403625
      < SCO Data TX: Handle 257 flags 0x00 dlen 60            #2346 [hci0] 321.404569
      < SCO Data TX: Handle 257 flags 0x00 dlen 60            #2347 [hci0] 321.412091
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2348 [hci0] 321.413626
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2349 [hci0] 321.413630
      > SCO Data RX: Handle 257 flags 0x00 dlen 48            #2350 [hci0] 321.413630
      < SCO Data TX: Handle 257 flags 0x00 dlen 60            #2351 [hci0] 321.419674
      
      After fix:
      
      < HCI Command: Accept Synchronou.. (0x01|0x0029) plen 21  #309 [hci0] 49.439693
              Address: 1C:CC:D6:E2:EA:80 (Xiaomi Communications Co Ltd)
              Transmit bandwidth: 8000
              Receive bandwidth: 8000
              Max latency: 13
              Setting: 0x0003
                Input Coding: Linear
                Input Data Format: 1's complement
                Input Sample Size: 8-bit
                # of bits padding at MSB: 0
                Air Coding Format: Transparent Data
              Retransmission effort: Optimize for link quality (0x02)
              Packet type: 0x003f
                HV1 may be used
                HV2 may be used
                HV3 may be used
                EV3 may be used
                EV4 may be used
                EV5 may be used
      > HCI Event: Command Status (0x0f) plen 4                 #310 [hci0] 49.440308
            Accept Synchronous Connection Request (0x01|0x0029) ncmd 1
              Status: Success (0x00)
      > HCI Event: Synchronous Connect Complete (0x2c) plen 17  #311 [hci0] 49.449308
              Status: Success (0x00)
              Handle: 257
              Address: 1C:CC:D6:E2:EA:80 (Xiaomi Communications Co Ltd)
              Link type: eSCO (0x02)
              Transmission interval: 0x0c
              Retransmission window: 0x04
              RX packet length: 60
              TX packet length: 60
              Air mode: Transparent (0x03)
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #312 [hci0] 49.450421
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #313 [hci0] 49.457927
      > HCI Event: Max Slots Change (0x1b) plen 3               #314 [hci0] 49.460345
              Handle: 256
              Max slots: 5
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #315 [hci0] 49.465453
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #316 [hci0] 49.470502
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #317 [hci0] 49.470519
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #318 [hci0] 49.472996
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #319 [hci0] 49.480412
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #320 [hci0] 49.480492
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #321 [hci0] 49.487989
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #322 [hci0] 49.490303
      < SCO Data TX: Handle 257 flags 0x00 dlen 60              #323 [hci0] 49.495496
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #324 [hci0] 49.500304
      > SCO Data RX: Handle 257 flags 0x00 dlen 60              #325 [hci0] 49.500311
      Signed-off-by: default avatarKiran K <kiran.k@intel.com>
      Signed-off-by: default avatarLokendra Singh <lokendra.singh@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      06d213d8
    • Jiapeng Chong's avatar
      Bluetooth: 6lowpan: remove unused function · b0e56db7
      Jiapeng Chong authored
      
      
      Fix the following clang warning:
      
      net/bluetooth/6lowpan.c:913:20: warning: unused function 'bdaddr_type'
      [-Wunused-function].
      
      net/bluetooth/6lowpan.c:106:35: warning: unused function
      'peer_lookup_ba' [-Wunused-function].
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b0e56db7
    • Manish Mandlik's avatar
      Bluetooth: Add ncmd=0 recovery handling · de75cd0d
      Manish Mandlik authored
      
      
      During command status or command complete event, the controller may set
      ncmd=0 indicating that it is not accepting any more commands. In such a
      case, host holds off sending any more commands to the controller. If the
      controller doesn't recover from such condition, host will wait forever,
      until the user decides that the Bluetooth is broken and may power cycles
      the Bluetooth.
      
      This patch triggers the hardware error to reset the controller and
      driver when it gets into such state as there is no other wat out.
      Reviewed-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: default avatarManish Mandlik <mmandlik@google.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      de75cd0d
    • Pavel Skripkin's avatar
      Bluetooth: hci_qca: fix potential GPF · 59f90f13
      Pavel Skripkin authored
      In qca_power_shutdown() qcadev local variable is
      initialized by hu->serdev.dev private data, but
      hu->serdev can be NULL and there is a check for it.
      
      Since, qcadev is not used before
      
      	if (!hu->serdev)
      		return;
      
      we can move its initialization after this "if" to
      prevent GPF.
      
      Fixes: 5559904c
      
       ("Bluetooth: hci_qca: Add QCA Rome power off support to the qca_power_shutdown()")
      Cc: stable@vger.kernel.org # v5.6+
      Cc: Rocky Liao <rjliao@codeaurora.org>
      Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      59f90f13
    • Yu Liu's avatar
      Bluetooth: Fix the HCI to MGMT status conversion table · 4ef36a52
      Yu Liu authored
      
      
      0x2B, 0x31 and 0x33 are reserved for future use but were not present in
      the HCI to MGMT conversion table, this caused the conversion to be
      incorrect for the HCI status code greater than 0x2A.
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Signed-off-by: default avatarYu Liu <yudiliu@google.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      4ef36a52
    • Thadeu Lima de Souza Cascardo's avatar
      Bluetooth: cmtp: fix file refcount when cmtp_attach_device fails · 3cfdf8fc
      Thadeu Lima de Souza Cascardo authored
      
      
      When cmtp_attach_device fails, cmtp_add_connection returns the error value
      which leads to the caller to doing fput through sockfd_put. But
      cmtp_session kthread, which is stopped in this path will also call fput,
      leading to a potential refcount underflow or a use-after-free.
      
      Add a refcount before we signal the kthread to stop. The kthread will try
      to grab the cmtp_session_sem mutex before doing the fput, which is held
      when get_file is called, so there should be no races there.
      
      Reported-by: Ryota Shiga
      Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      3cfdf8fc
    • Muhammad Usama Anjum's avatar
      Bluetooth: btusb: fix memory leak · 44e936d7
      Muhammad Usama Anjum authored
      
      
      If btusb_mtk_submit_wmt_recv_urb returns error, wc should be freed and
      then error should be returned to prevent memory leak.
      
      Addresses-Coverity: ("Prevent memory leak")
      Fixes: 4cbb375e997d ("Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip.")
      Signed-off-by: default avatarMuhammad Usama Anjum <musamaanjum@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      44e936d7
    • mark-yw.chen's avatar
      Bluetooth: btusb: Add support for Lite-On Mediatek Chip · 393dc5d1
      mark-yw.chen authored
      
      
      Add support for Lite-On Mediatek Chip (MT7921)
      Lite On VID = 04CA.
      
      * /sys/kernel/debug/usb/devices
      T:  Bus=01 Lev=03 Prnt=04 Port=01 Cnt=02 Dev#=  8 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04ca ProdID=3802 Rev= 1.00
      S:  Manufacturer=MediaTek Inc.
      S:  Product=Wireless_Device
      S:  SerialNumber=000000000
      C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
      A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
      I:  If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
      E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
      E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
      Signed-off-by: default avatarmark-yw.chen <mark-yw.chen@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      393dc5d1
    • mark-yw.chen's avatar
      Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip. · 8454ed9f
      mark-yw.chen authored
      
      
      This patch reduce in-token during download patch procedure.
      Don't submit urb for polling event before sending hci command.
      Signed-off-by: default avatarmark-yw.chen <mark-yw.chen@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      8454ed9f
    • Colin Ian King's avatar
      Bluetooth: virtio_bt: add missing null pointer check on alloc_skb call return · 1cb027f2
      Colin Ian King authored
      The call to alloc_skb with the GFP_KERNEL flag can return a null sk_buff
      pointer, so add a null check to avoid any null pointer deference issues.
      
      Addresses-Coverity: ("Dereference null return value")
      Fixes: afd2daa2
      
       ("Bluetooth: Add support for virtio transport driver")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      1cb027f2
    • Yu Liu's avatar
      Bluetooth: Return whether a connection is outbound · 1c6ed31b
      Yu Liu authored
      
      
      When an MGMT_EV_DEVICE_CONNECTED event is reported back to the user
      space we will set the flags to tell if the established connection is
      outbound or not. This is useful for the user space to log better metrics
      and error messages.
      Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
      Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
      Signed-off-by: default avatarYu Liu <yudiliu@google.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      1c6ed31b
    • Qiheng Lin's avatar
      Bluetooth: use flexible-array member instead of zero-length array · 07d85dbe
      Qiheng Lin authored
      
      
      Fix the following coccicheck warning:
      
      net/bluetooth/msft.c:37:6-13: WARNING use flexible-array member instead
      net/bluetooth/msft.c:42:6-10: WARNING use flexible-array member instead
      net/bluetooth/msft.c:52:6-10: WARNING use flexible-array member instead
      Signed-off-by: default avatarQiheng Lin <linqiheng@huawei.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      07d85dbe
    • Kai Ye's avatar
      Bluetooth: 6lowpan: delete unneeded variable initialization · c469c9c9
      Kai Ye authored
      
      
      Delete unneeded variable initialization.
      Signed-off-by: default avatarKai Ye <yekai13@huawei.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      c469c9c9
  2. 25 Jun, 2021 10 commits
    • David S. Miller's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue · ff8744b5
      David S. Miller authored
      
      
      Tony Nguyen says:
      
      ====================
      100GbE Intel Wired LAN Driver Updates 2021-06-25
      
      This series contains updates to ice driver only.
      
      Jesse adds support for tracepoints to aide in debugging.
      
      Maciej adds support for PTP auxiliary pin support.
      
      Victor removes the VSI info from the old aggregator when moving the VSI
      to another aggregator.
      
      Tony removes an unnecessary VSI assignment.
      
      Christophe Jaillet fixes a memory leak for failed allocation in
      ice_pf_dcb_cfg().
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff8744b5
    • Guvenc Gulce's avatar
      net/smc: Ensure correct state of the socket in send path · 17081633
      Guvenc Gulce authored
      When smc_sendmsg() is called before the SMC socket initialization has
      completed, smc_tx_sendmsg() will access un-initialized fields of the
      SMC socket which results in a null-pointer dereference.
      Fix this by checking the socket state first in smc_tx_sendmsg().
      
      Fixes: e0e4b8fa
      
       ("net/smc: Add SMC statistics support")
      Reported-by: syzbot+5dda108b672b54141857@syzkaller.appspotmail.com
      Reviewed-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      17081633
    • David S. Miller's avatar
      Merge tag 'wireless-drivers-next-2021-06-25' of... · 4e3db44a
      David S. Miller authored
      Merge tag 'wireless-drivers-next-2021-06-25' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for v5.14
      
      Second, and most likely the last, set of patches for v5.14. mt76 and
      iwlwifi have most patches in this round, but rtw88 also has some new
      features. Nothing special really standing out.
      
      mt76
      
      * mt7915 MSI support
      
      * disable ASPM on mt7915
      
      * mt7915 tx status reporting
      
      * mt7921 decap offload
      
      rtw88
      
      * beacon filter support
      
      * path diversity support
      
      * firmware crash information via devcoredump
      
      * quirks for disabling pci capabilities
      
      mt7601u
      
      * add USB ID for a XiaoDu WiFi Dongle
      
      ath11k
      
      * enable support for QCN9074 PCI devices
      
      brcmfmac
      
      * support parse country code map from DeviceTree
      
      iwlwifi
      
      * support for new hardware
      
      * support for BIOS control of 11ax enablement in Russia
      
      * support UNII4 band enablement from BIOS
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e3db44a
    • Marcin Wojtas's avatar
      net: mdiobus: withdraw fwnode_mdbiobus_register · ac53c264
      Marcin Wojtas authored
      The newly implemented fwnode_mdbiobus_register turned out to be
      problematic - in case the fwnode_/of_/acpi_mdio are built as
      modules, a dependency cycle can be observed during the depmod phase of
      modules_install, eg.:
      
      depmod: ERROR: Cycle detected: fwnode_mdio -> of_mdio -> fwnode_mdio
      depmod: ERROR: Found 2 modules in dependency cycles!
      
      OR:
      
      depmod: ERROR: Cycle detected: acpi_mdio -> fwnode_mdio -> acpi_mdio
      depmod: ERROR: Found 2 modules in dependency cycles!
      
      A possible solution could be to rework fwnode_mdiobus_register,
      so that to merge the contents of acpi_mdiobus_register and
      of_mdiobus_register. However feasible, such change would
      be very intrusive and affect huge amount of the of_mdiobus_register
      users.
      
      Since there are currently 2 users of ACPI and MDIO
      (xgmac_mdio and mvmdio), withdraw the fwnode_mdbiobus_register
      and roll back to a simple 'if' condition in affected drivers.
      
      Fixes: 62a6ef6a
      
       ("net: mdiobus: Introduce fwnode_mdbiobus_register()")
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ac53c264
    • Christophe JAILLET's avatar
      ice: Fix a memory leak in an error handling path in 'ice_pf_dcb_cfg()' · b81c191c
      Christophe JAILLET authored
      If this 'kzalloc()' fails we must free some resources as in all the other
      error handling paths of this function.
      
      Fixes: 348048e7
      
       ("ice: Implement iidc operations")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      b81c191c
    • Tony Nguyen's avatar
      ice: remove unnecessary VSI assignment · 70fa0a07
      Tony Nguyen authored
      
      
      ice_get_vf_vsi() is being called twice for the same VSI. Remove the
      unnecessary call/assignment.
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      70fa0a07
    • Victor Raj's avatar
      ice: remove the VSI info from previous agg · 37c59206
      Victor Raj authored
      
      
      Remove the VSI info from previous aggregator after moving the VSI to a
      new aggregator.
      Signed-off-by: default avatarVictor Raj <victor.raj@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      37c59206
    • Maciej Machnikowski's avatar
      ice: add support for auxiliary input/output pins · 172db5f9
      Maciej Machnikowski authored
      
      
      The E810 device supports programmable pins for enabling both input and
      output events related to the PTP hardware clock. This includes both
      output signals with programmable period, as well as timestamping of
      events on input pins.
      
      Add support for enabling these using the CONFIG_PTP_1588_CLOCK
      interface.
      
      This allows programming the software defined pins to take advantage of
      the hardware clock features.
      Signed-off-by: default avatarMaciej Machnikowski <maciej.machnikowski@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      172db5f9
    • David Thompson's avatar
      Add Mellanox BlueField Gigabit Ethernet driver · f92e1869
      David Thompson authored
      
      
      This patch adds build and driver logic for the "mlxbf_gige"
      Ethernet driver from Mellanox Technologies. The second
      generation BlueField SoC from Mellanox supports an
      out-of-band GigaBit Ethernet management port to the Arm
      subsystem.  This driver supports TCP/IP network connectivity
      for that port, and provides back-end routines to handle
      basic ethtool requests.
      
      The driver interfaces to the Gigabit Ethernet block of
      BlueField SoC via MMIO accesses to registers, which contain
      control information or pointers describing transmit and
      receive resources.  There is a single transmit queue, and
      the port supports transmit ring sizes of 4 to 256 entries.
      There is a single receive queue, and the port supports
      receive ring sizes of 32 to 32K entries. The transmit and
      receive rings are allocated from DMA coherent memory. There
      is a 16-bit producer and consumer index per ring to denote
      software ownership and hardware ownership, respectively.
      
      The main driver logic such as probe(), remove(), and netdev
      ops are in "mlxbf_gige_main.c".  Logic in "mlxbf_gige_rx.c"
      and "mlxbf_gige_tx.c" handles the packet processing for
      receive and transmit respectively.
      
      The logic in "mlxbf_gige_ethtool.c" supports the handling
      of some basic ethtool requests: get driver info, get ring
      parameters, get registers, and get statistics.
      
      The logic in "mlxbf_gige_mdio.c" is the driver controlling
      the Mellanox BlueField hardware that interacts with a PHY
      device via MDIO/MDC pins.  This driver does the following:
        - At driver probe time, it configures several BlueField MDIO
          parameters such as sample rate, full drive, voltage and MDC
        - It defines functions to read and write MDIO registers and
          registers the MDIO bus.
        - It defines the phy interrupt handler reporting a
          link up/down status change
        - This driver's probe is invoked from the main driver logic
          while the phy interrupt handler is registered in ndo_open.
      
      Driver limitations
        - Only supports 1Gbps speed
        - Only supports GMII protocol
        - Supports maximum packet size of 2KB
        - Does not support scatter-gather buffering
      
      Testing
        - Successful build of kernel for ARM64, ARM32, X86_64
        - Tested ARM64 build on FastModels & Palladium
        - Tested ARM64 build on several Mellanox boards that are built with
          the BlueField-2 SoC.  The testing includes coverage in the areas
          of networking (e.g. ping, iperf, ifconfig, route), file transfers
          (e.g. SCP), and various ethtool options relevant to this driver.
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Signed-off-by: default avatarAsmaa Mnebhi <asmaa@nvidia.com>
      Reviewed-by: default avatarLiming Sun <limings@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f92e1869
    • Jesse Brandeburg's avatar
      ice: add tracepoints · 3089cf6d
      Jesse Brandeburg authored
      
      
      This patch is modeled after one by Scott Peterson for i40e.
      
      Add tracepoints to the driver, via a new file ice_trace.h and some new
      trace calls added in interesting places in the driver. Add some tracing
      for DIMLIB to help debug interrupt moderation problems.
      
      Performance should not be affected, and this can be very useful
      for debugging and adding new trace events to paths in the future.
      
      Note eBPF programs can attach to these events, as well as perf
      can count them since we're attaching to the events subsystem
      in the kernel.
      Co-developed-by: default avatarBen Shelton <benjamin.h.shelton@intel.com>
      Signed-off-by: default avatarBen Shelton <benjamin.h.shelton@intel.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      3089cf6d
  3. 24 Jun, 2021 14 commits
    • Jian-Hong Pan's avatar
      net: bcmgenet: Add mdio-bcm-unimac soft dependency · 19938baf
      Jian-Hong Pan authored
      The Broadcom UniMAC MDIO bus from mdio-bcm-unimac module comes too late.
      So, GENET cannot find the ethernet PHY on UniMAC MDIO bus. This leads
      GENET fail to attach the PHY as following log:
      
      bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
      ...
      could not attach to PHY
      bcmgenet fd580000.ethernet eth0: failed to connect to PHY
      uart-pl011 fe201000.serial: no DMA platform data
      libphy: bcmgenet MII bus: probed
      ...
      unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
      
      It is not just coming too late, there is also no way for the module
      loader to figure out the dependency between GENET and its MDIO bus
      driver unless we provide this MODULE_SOFTDEP hint.
      
      This patch adds the soft dependency to load mdio-bcm-unimac module
      before genet module to fix this issue.
      
      Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=213485
      Fixes: 9a4e7969
      
       ("net: bcmgenet: utilize generic Broadcom UniMAC MDIO controller driver")
      Signed-off-by: default avatarJian-Hong Pan <jhp@endlessos.org>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19938baf
    • zhang kai's avatar
      ipv6: delete useless dst check in ip6_dst_lookup_tail · c305b9e6
      zhang kai authored
      
      
      parameter dst always points to null.
      Signed-off-by: default avatarzhang kai <zhangkaiheb@126.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c305b9e6
    • Ido Schimmel's avatar
      mlxsw: core_env: Avoid unnecessary memcpy()s · 911bd1b1
      Ido Schimmel authored
      
      
      Simply get a pointer to the data in the register payload instead of
      copying it to a temporary buffer.
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      911bd1b1
    • Bailey Forrest's avatar
      gve: Fix warnings reported for DQO patchset · e8192476
      Bailey Forrest authored
      https://patchwork.kernel.org/project/netdevbpf/list/?series=506637&state=*
      
      - Remove unused variable
      - Use correct integer type for string formatting.
      - Remove `inline` in C files
      
      Fixes: 9c1a59a2 ("gve: DQO: Add ring allocation and initialization")
      Fixes: a57e5de4
      
       ("gve: DQO: Add TX path")
      Signed-off-by: default avatarBailey Forrest <bcf@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8192476
    • David S. Miller's avatar
      Merge branch 'sctp-pmtud-convergence' · 1ed1fe24
      David S. Miller authored
      
      
      Xin Long says:
      
      ====================
      sctp: make the PLPMTUD probe more effective and efficient
      
      As David Laight noticed, it currently takes quite some time to find
      the optimal pmtu in the Search state, and also lacks the black hole
      detection in the Search Complete state. This patchset is to address
      them to mke the PLPMTUD probe more effective and efficient.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ed1fe24
    • Xin Long's avatar
      sctp: send the next probe immediately once the last one is acked · fea1d5b1
      Xin Long authored
      
      
      These is no need to wait for 'interval' period for the next probe
      if the last probe is already acked in search state. The 'interval'
      period waiting should be only for probe failure timeout and the
      current pmtu check when it's in search complete state.
      
      This change will shorten the probe time a lot in search state, and
      also fix the document accordingly.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fea1d5b1
    • Xin Long's avatar
      sctp: do black hole detection in search complete state · 0dac127c
      Xin Long authored
      
      
      Currently the PLPMUTD probe will stop for a long period (interval * 30)
      after it enters search complete state. If there's a pmtu change on the
      route path, it takes a long time to be aware if the ICMP TooBig packet
      is lost or filtered.
      
      As it says in rfc8899#section-4.3:
      
        "A DPLPMTUD method MUST NOT rely solely on this method."
        (ICMP PTB message).
      
      This patch is to enable the other method for search complete state:
      
        "A PL can use the DPLPMTUD probing mechanism to periodically
         generate probe packets of the size of the current PLPMTU."
      
      With this patch, the probe will continue with the current pmtu every
      'interval' until the PMTU_RAISE_TIMER 'timeout', which we implement
      by adding raise_count to raise the probe size when it counts to 30
      and removing the SCTP_PL_COMPLETE check for PMTU_RAISE_TIMER.
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dac127c
    • David S. Miller's avatar
      Merge branch 'sja1110-doc' · 98ebad48
      David S. Miller authored
      
      
      Vladimir Oltean says:
      
      ====================
      Document the NXP SJA1110 switch as supported
      
      Now that most of the basic work for SJA1110 support has been done in the
      sja1105 DSA driver, let's add the missing documentation bits to make it
      clear that the driver can be used.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      98ebad48
    • Vladimir Oltean's avatar
      net: dsa: sja1105: document the SJA1110 in the Kconfig · 75e99470
      Vladimir Oltean authored
      
      
      Mention support for the SJA1110 in menuconfig.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75e99470
    • Vladimir Oltean's avatar
      Documentation: net: dsa: add details about SJA1110 · 44531076
      Vladimir Oltean authored
      
      
      Denote that the new switch generation is supported, detail its pin
      strapping options (with differences compared to SJA1105) and explain how
      MDIO access to the internal 100base-T1 and 100base-TX PHYs is performed.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44531076
    • David S. Miller's avatar
      Merge branch 'gve-dqo' · 89bddde3
      David S. Miller authored
      
      
      Bailey Forrest says:
      
      ====================
      gve: Introduce DQO descriptor format
      
      DQO is the descriptor format for our next generation virtual NIC. The existing
      descriptor format will be referred to as "GQI" in the patch set.
      
      One major change with DQO is it uses dual descriptor rings for both TX and RX
      queues.
      
      The TX path uses a TX queue to send descriptors to HW, and receives packet
      completion events on a TX completion queue.
      
      The RX path posts buffers to HW using an RX buffer queue and receives incoming
      packets on an RX queue.
      
      One important note is that DQO descriptors and doorbells are little endian. We
      continue to use the existing big endian control plane infrastructure.
      
      The general format of the patch series is:
      - Refactor existing code/data structures to be shared by DQO
      - Expand admin queues to support DQO device setup
      - Expand data structures and device setup to support DQO
      - Add logic to setup DQO queues
      - Implement datapath
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89bddde3
    • Bailey Forrest's avatar
      gve: DQO: Add RX path · 9b8dd5e5
      Bailey Forrest authored
      
      
      The RX queue has an array of `gve_rx_buf_state_dqo` objects. All
      allocated pages have an associated buf_state object. When a buffer is
      posted on the RX buffer queue, the buffer ID will be the buf_state's
      index into the RX queue's array.
      
      On packet reception, the RX queue will have one descriptor for each
      buffer associated with a received packet. Each RX descriptor will have
      a buffer_id that was posted on the buffer queue.
      
      Notable mentions:
      
      - We use a default buffer size of 2048 bytes. Based on page size, we
        may post separate sections of a single page as separate buffers.
      
      - The driver holds an extra reference on pages passed up the receive
        path with an skb and keeps these pages on a list. When posting new
        buffers to the NIC, we check if any of these pages has only our
        reference, or another buffer sized segment of the page has no
        references. If so, it is free to reuse. This page recycling approach
        is a common netdev optimization that reduces page alloc/free calls.
      
      - Pages in the free list have a page_count bias in order to avoid an
        atomic increment of pagecount every time we attempt to reuse a page.
        # references = page_count() - bias
      
      - In order to track when a page is safe to reuse, we keep track of the
        last offset which had a single SKB reference. When this occurs, it
        implies that every single other offset is reusable. Otherwise, we
        don't know if offsets can be safely reused.
      
      - We maintain two free lists of pages. List #1 (recycled_buf_states)
        contains pages we know can be reused right away. List #2
        (used_buf_states) contains pages which cannot be used right away. We
        only attempt to get pages from list #2 when list #1 is empty. We only
        attempt to use a small fixed number pages from list #2 before giving
        up and allocating a new page. Both lists are FIFOs in hope that by the
        time we attempt to reuse a page, the references were dropped.
      Signed-off-by: default avatarBailey Forrest <bcf@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarCatherine Sullivan <csully@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b8dd5e5
    • Bailey Forrest's avatar
      gve: DQO: Add TX path · a57e5de4
      Bailey Forrest authored
      
      
      TX SKBs will have their buffers DMA mapped with the device. Each buffer
      will have at least one TX descriptor associated. Each SKB will also have
      a metadata descriptor.
      
      Each TX queue maintains an array of `gve_tx_pending_packet_dqo` objects.
      Every TX SKB will have an associated pending_packet object. A TX SKB's
      descriptors will use its pending_packet's index as the completion tag,
      which will be returned on the TX completion queue.
      
      The device implements a "flow-miss model". Most packets will simply
      receive a packet completion. The flow-miss system may choose to process
      a packet based on its contents. A TX packet which experiences a flow
      miss would receive a miss completion followed by a later reinjection
      completion. The miss-completion is received when the packet starts to be
      processed by the flow-miss system and the reinjection completion is
      received when the flow-miss system completes processing the packet and
      sends it on the wire.
      
      Notable mentions:
      
      - Buffers may be freed after receiving the miss-completion, but in order
        to avoid packet reordering, we do not complete the SKB until receiving
        the reinjection completion.
      
      - The driver must robustly handle the unlikely scenario where a miss
        completion does not have an associated reinjection completion. This is
        accomplished by maintaining a list of packets which have a pending
        reinjection completion. After a short timeout (5 seconds), the
        SKB and buffers are released and the pending_packet is moved to a
        second list which has a longer timeout (60 seconds), where the
        pending_packet will not be reused. When the longer timeout elapses,
        the driver may assume the reinjection completion would never be
        received and the pending_packet may be reused.
      
      - Completion handling is triggered by an interrupt and is done in the
        NAPI poll function. Because the TX path and completion exist in
        different threading contexts they maintain their own lists for free
        pending_packet objects. The TX path uses a lock-free approach to steal
        the list from the completion path.
      
      - Both the TSO context and general context descriptors have metadata
        bytes. The device requires that if multiple descriptors contain the
        same field, each descriptor must have the same value set for that
        field.
      Signed-off-by: default avatarBailey Forrest <bcf@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarCatherine Sullivan <csully@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a57e5de4
    • Bailey Forrest's avatar
      gve: DQO: Configure interrupts on device up · 0dcc144a
      Bailey Forrest authored
      
      
      When interrupts are first enabled, we also set the ratelimits, which
      will be static for the entire usage of the device.
      Signed-off-by: default avatarBailey Forrest <bcf@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarCatherine Sullivan <csully@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dcc144a