1. 01 5月, 2023 1 次提交
    • H
      r8152: fix flow control issue of RTL8156A · 8ceda6d5
      Hayes Wang 提交于
      The feature of flow control becomes abnormal, if the device sends a
      pause frame and the tx/rx is disabled before sending a release frame. It
      causes the lost of packets.
      
      Set PLA_RX_FIFO_FULL and PLA_RX_FIFO_EMPTY to zeros before disabling the
      tx/rx. And, toggle FC_PATCH_TASK before enabling tx/rx to reset the flow
      control patch and timer. Then, the hardware could clear the state and
      the flow control becomes normal after enabling tx/rx.
      
      Besides, remove inline for fc_pause_on_auto() and fc_pause_off_auto().
      
      Fixes: 195aae32 ("r8152: support new chips")
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8ceda6d5
  2. 08 4月, 2023 1 次提交
    • D
      r8152: Add __GFP_NOWARN to big allocations · 5cc33f13
      Douglas Anderson 提交于
      When memory is a little tight on my system, it's pretty easy to see
      warnings that look like this.
      
        ksoftirqd/0: page allocation failure: order:3, mode:0x40a20(GFP_ATOMIC|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
        ...
        Call trace:
         dump_backtrace+0x0/0x1e8
         show_stack+0x20/0x2c
         dump_stack_lvl+0x60/0x78
         dump_stack+0x18/0x38
         warn_alloc+0x104/0x174
         __alloc_pages+0x588/0x67c
         alloc_rx_agg+0xa0/0x190 [r8152 ...]
         r8152_poll+0x270/0x760 [r8152 ...]
         __napi_poll+0x44/0x1ec
         net_rx_action+0x100/0x300
         __do_softirq+0xec/0x38c
         run_ksoftirqd+0x38/0xec
         smpboot_thread_fn+0xb8/0x248
         kthread+0x134/0x154
         ret_from_fork+0x10/0x20
      
      On a fragmented system it's normal that order 3 allocations will
      sometimes fail, especially atomic ones. The driver handles these
      failures fine and the WARN just creates spam in the logs for this
      case. The __GFP_NOWARN flag is exactly for this situation, so add it
      to the allocation.
      
      NOTE: my testing is on a 5.15 system, but there should be no reason
      that this would be fundamentally different on a mainline kernel.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Acked-by: NHayes Wang <hayeswang@realtek.com>
      Link: https://lore.kernel.org/r/20230406171411.1.I84dbef45786af440fd269b71e9436a96a8e7a152@changeidSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      5cc33f13
  3. 23 3月, 2023 1 次提交
  4. 20 3月, 2023 2 次提交
  5. 18 3月, 2023 1 次提交
  6. 17 3月, 2023 1 次提交
  7. 15 3月, 2023 1 次提交
  8. 07 3月, 2023 2 次提交
  9. 03 3月, 2023 1 次提交
  10. 13 2月, 2023 1 次提交
  11. 06 2月, 2023 2 次提交
    • A
      net: USB: Fix wrong-direction WARNING in plusb.c · 93fd5659
      Alan Stern 提交于
      The syzbot fuzzer detected a bug in the plusb network driver: A
      zero-length control-OUT transfer was treated as a read instead of a
      write.  In modern kernels this error provokes a WARNING:
      
      usb 1-1: BOGUS control dir, pipe 80000280 doesn't match bRequestType c0
      WARNING: CPU: 0 PID: 4645 at drivers/usb/core/urb.c:411
      usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      Modules linked in:
      CPU: 1 PID: 4645 Comm: dhcpcd Not tainted
      6.2.0-rc6-syzkaller-00050-g9f266cca #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
      01/12/2023
      RIP: 0010:usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      ...
      Call Trace:
       <TASK>
       usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
       usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
       usb_control_msg+0x320/0x4a0 drivers/usb/core/message.c:153
       __usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
       usbnet_read_cmd+0x96/0xf0 drivers/net/usb/usbnet.c:2068
       pl_vendor_req drivers/net/usb/plusb.c:60 [inline]
       pl_set_QuickLink_features drivers/net/usb/plusb.c:75 [inline]
       pl_reset+0x2f/0xf0 drivers/net/usb/plusb.c:85
       usbnet_open+0xcc/0x5d0 drivers/net/usb/usbnet.c:889
       __dev_open+0x297/0x4d0 net/core/dev.c:1417
       __dev_change_flags+0x587/0x750 net/core/dev.c:8530
       dev_change_flags+0x97/0x170 net/core/dev.c:8602
       devinet_ioctl+0x15a2/0x1d70 net/ipv4/devinet.c:1147
       inet_ioctl+0x33f/0x380 net/ipv4/af_inet.c:979
       sock_do_ioctl+0xcc/0x230 net/socket.c:1169
       sock_ioctl+0x1f8/0x680 net/socket.c:1286
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The fix is to call usbnet_write_cmd() instead of usbnet_read_cmd() and
      remove the USB_DIR_IN flag.
      
      Reported-and-tested-by: syzbot+2a0e7abd24f1eb90ce25@syzkaller.appspotmail.com
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Fixes: 090ffa9d ("[PATCH] USB: usbnet (9/9) module for pl2301/2302 cables")
      CC: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/00000000000052099f05f3b3e298@google.com/
      Link: https://lore.kernel.org/r/Y91hOew3nW56Ki4O@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93fd5659
    • A
      net: USB: Fix wrong-direction WARNING in plusb.c · 811d5811
      Alan Stern 提交于
      The syzbot fuzzer detected a bug in the plusb network driver: A
      zero-length control-OUT transfer was treated as a read instead of a
      write.  In modern kernels this error provokes a WARNING:
      
      usb 1-1: BOGUS control dir, pipe 80000280 doesn't match bRequestType c0
      WARNING: CPU: 0 PID: 4645 at drivers/usb/core/urb.c:411
      usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      Modules linked in:
      CPU: 1 PID: 4645 Comm: dhcpcd Not tainted
      6.2.0-rc6-syzkaller-00050-g9f266cca #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
      01/12/2023
      RIP: 0010:usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
      ...
      Call Trace:
       <TASK>
       usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
       usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
       usb_control_msg+0x320/0x4a0 drivers/usb/core/message.c:153
       __usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
       usbnet_read_cmd+0x96/0xf0 drivers/net/usb/usbnet.c:2068
       pl_vendor_req drivers/net/usb/plusb.c:60 [inline]
       pl_set_QuickLink_features drivers/net/usb/plusb.c:75 [inline]
       pl_reset+0x2f/0xf0 drivers/net/usb/plusb.c:85
       usbnet_open+0xcc/0x5d0 drivers/net/usb/usbnet.c:889
       __dev_open+0x297/0x4d0 net/core/dev.c:1417
       __dev_change_flags+0x587/0x750 net/core/dev.c:8530
       dev_change_flags+0x97/0x170 net/core/dev.c:8602
       devinet_ioctl+0x15a2/0x1d70 net/ipv4/devinet.c:1147
       inet_ioctl+0x33f/0x380 net/ipv4/af_inet.c:979
       sock_do_ioctl+0xcc/0x230 net/socket.c:1169
       sock_ioctl+0x1f8/0x680 net/socket.c:1286
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The fix is to call usbnet_write_cmd() instead of usbnet_read_cmd() and
      remove the USB_DIR_IN flag.
      
      Reported-and-tested-by: syzbot+2a0e7abd24f1eb90ce25@syzkaller.appspotmail.com
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Fixes: 090ffa9d ("[PATCH] USB: usbnet (9/9) module for pl2301/2302 cables")
      CC: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/00000000000052099f05f3b3e298@google.com/Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      811d5811
  12. 21 1月, 2023 2 次提交
  13. 18 1月, 2023 1 次提交
  14. 17 1月, 2023 1 次提交
  15. 12 1月, 2023 1 次提交
  16. 09 1月, 2023 3 次提交
    • B
      cdc_ether: no need to blacklist any r8152 devices · 69649ef8
      Bjørn Mork 提交于
      The r8152 driver does not need this anymore.
      
      Dropping blacklist entries adds optional support for these
      devices in ECM mode.
      
      The 8153 devices are handled by the r8153_ecm driver when
      in ECM mode, and must still be blacklisted here.
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69649ef8
    • B
      r8152: add USB device driver for config selection · ec51fbd1
      Bjørn Mork 提交于
      Subclassing the generic USB device driver to override the
      default configuration selection regardless of matching interface
      drivers.
      
      The r815x family devices expose a vendor specific function which
      the r8152 interface driver wants to handle.  This is the preferred
      device mode. Additionally one or more USB class functions are
      usually supported for hosts lacking a vendor specific driver. The
      choice is USB configuration based, with one alternate function per
      configuration.
      
      Example device with both NCM and ECM alternate cfgs:
      
      T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  3
      P:  Vendor=0bda ProdID=8156 Rev=31.00
      S:  Manufacturer=Realtek
      S:  Product=USB 10/100/1G/2.5G LAN
      S:  SerialNumber=001000001
      C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=256mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=00 Driver=r8152
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=83(I) Atr=03(Int.) MxPS=   2 Ivl=128ms
      C:  #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=256mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=
      E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      C:  #Ifs= 2 Cfg#= 3 Atr=a0 MxPwr=256mA
      I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=
      E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      A problem with this is that Linux will prefer class functions over
      vendor specific functions. Using the above example, Linux defaults
      to cfg #2, running the device in a sub-optimal NCM mode.
      
      Previously we've attempted to work around the problem by
      blacklisting the devices in the ECM class driver "cdc_ether", and
      matching on the ECM class function in the vendor specific interface
      driver. The latter has been used to switch back to the vendor
      specific configuration when the driver is probed for a class
      function.
      
      This workaround has several issues;
      - class driver blacklists is additional maintanence cruft in an
        unrelated driver
      - class driver blacklists prevents users from optionally running
        the devices in class mode
      - each device needs double match entries in the vendor driver
      - the initial probing as a class function slows down device
        discovery
      
      Now these issues have become even worse with the introduction of
      firmware supporting both NCM and ECM, where NCM ends up as the
      default mode in Linux. To use the same workaround, we now have
      to blacklist the devices in to two different class drivers and
      add yet another match entry to the vendor specific driver.
      
      This patch implements an alternative workaround strategy -
      independent of the interface drivers.  It avoids adding a
      blacklist to the cdc_ncm driver and will let us remove the
      existing blacklist from the cdc_ether driver.
      
      As an additional bonus, removing the blacklists allow users to
      select one of the other device modes if wanted.
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ec51fbd1
    • L
      usbnet: optimize usbnet_bh() to reduce CPU load · fb59bf28
      Leesoo Ahn 提交于
      The current source pushes skb into dev-done queue by calling
      skb_dequeue_tail() and then pop it by skb_dequeue() to branch to
      rx_cleanup state for freeing urb/skb in usbnet_bh(). It takes extra CPU
      load, 2.21% (skb_queue_tail) as follows,
      
      -   11.58%     0.26%  swapper          [k] usbnet_bh
         - 11.32% usbnet_bh
            - 6.43% skb_dequeue
                 6.34% _raw_spin_unlock_irqrestore
            - 2.21% skb_queue_tail
                 2.19% _raw_spin_unlock_irqrestore
            - 1.68% consume_skb
               - 0.97% kfree_skbmem
                    0.80% kmem_cache_free
                 0.53% skb_release_data
      
      To reduce the extra CPU load use return values to call helper function
      usb_free_skb() to free the resources instead of calling skb_queue_tail()
      and skb_dequeue() for push and pop respectively.
      
      -    7.87%     0.25%  swapper          [k] usbnet_bh
         - 7.62% usbnet_bh
            - 4.81% skb_dequeue
                 4.74% _raw_spin_unlock_irqrestore
            - 1.75% consume_skb
               - 0.98% kfree_skbmem
                    0.78% kmem_cache_free
                 0.58% skb_release_data
              0.53% smsc95xx_rx_fixup
      Signed-off-by: NLeesoo Ahn <lsahn@ooseel.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fb59bf28
  17. 06 1月, 2023 1 次提交
  18. 03 1月, 2023 1 次提交
  19. 26 12月, 2022 1 次提交
    • S
      treewide: Convert del_timer*() to timer_shutdown*() · 292a089d
      Steven Rostedt (Google) 提交于
      Due to several bugs caused by timers being re-armed after they are
      shutdown and just before they are freed, a new state of timers was added
      called "shutdown".  After a timer is set to this state, then it can no
      longer be re-armed.
      
      The following script was run to find all the trivial locations where
      del_timer() or del_timer_sync() is called in the same function that the
      object holding the timer is freed.  It also ignores any locations where
      the timer->function is modified between the del_timer*() and the free(),
      as that is not considered a "trivial" case.
      
      This was created by using a coccinelle script and the following
      commands:
      
          $ cat timer.cocci
          @@
          expression ptr, slab;
          identifier timer, rfield;
          @@
          (
          -       del_timer(&ptr->timer);
          +       timer_shutdown(&ptr->timer);
          |
          -       del_timer_sync(&ptr->timer);
          +       timer_shutdown_sync(&ptr->timer);
          )
            ... when strict
                when != ptr->timer
          (
                  kfree_rcu(ptr, rfield);
          |
                  kmem_cache_free(slab, ptr);
          |
                  kfree(ptr);
          )
      
          $ spatch timer.cocci . > /tmp/t.patch
          $ patch -p1 < /tmp/t.patch
      
      Link: https://lore.kernel.org/lkml/20221123201306.823305113@linutronix.de/Signed-off-by: NSteven Rostedt (Google) <rostedt@goodmis.org>
      Acked-by: Pavel Machek <pavel@ucw.cz> [ LED ]
      Acked-by: Kalle Valo <kvalo@kernel.org> [ wireless ]
      Acked-by: Paolo Abeni <pabeni@redhat.com> [ networking ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      292a089d
  20. 08 12月, 2022 1 次提交
  21. 29 11月, 2022 1 次提交
  22. 23 11月, 2022 2 次提交
  23. 17 11月, 2022 2 次提交
  24. 08 11月, 2022 1 次提交
  25. 04 11月, 2022 1 次提交
  26. 31 10月, 2022 1 次提交
  27. 04 10月, 2022 1 次提交
  28. 29 9月, 2022 1 次提交
  29. 27 9月, 2022 2 次提交
  30. 06 9月, 2022 1 次提交
    • J
      net: usb: qmi_wwan: add Quectel RM520N · e1091e22
      jerry.meng 提交于
      add support for Quectel RM520N which is based on Qualcomm SDX62 chip.
      
      0x0801: DIAG + NMEA + AT + MODEM + RMNET
      
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 10 Spd=480  MxCh= 0
      D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=0801 Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=RM520N-GL
      S:  SerialNumber=384af524
      C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      Signed-off-by: Njerry.meng <jerry-meng@foxmail.com>
      Acked-by: NBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/tencent_E50CA8A206904897C2D20DDAE90731183C05@qq.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      e1091e22
  31. 03 9月, 2022 1 次提交