1. 29 9月, 2020 1 次提交
  2. 27 8月, 2020 1 次提交
    • C
      rtw88: switch from 'pci_' to 'dma_' API · 24712ea9
      Christophe JAILLET 提交于
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below and has been
      hand modified to replace GFP_ with a correct flag.
      It has been compile tested.
      
      When memory is allocated in 'rtw_pci_init_tx_ring()' and
      'rtw_pci_init_rx_ring()' GFP_KERNEL can be used because both functions are
      called from a probe function and no spinlock is taken.
      
      The call chain is:
        rtw_pci_probe
          --> rtw_pci_setup_resource
            --> rtw_pci_init
              --> rtw_pci_init_trx_ring
                --> rtw_pci_init_tx_ring
                --> rtw_pci_init_rx_ring
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200820150643.148219-1-christophe.jaillet@wanadoo.fr
      24712ea9
  3. 15 7月, 2020 1 次提交
  4. 18 5月, 2020 5 次提交
  5. 13 5月, 2020 1 次提交
  6. 06 5月, 2020 1 次提交
  7. 23 4月, 2020 1 次提交
  8. 21 4月, 2020 1 次提交
  9. 14 4月, 2020 1 次提交
    • A
      rtw88: avoid unused function warnings · 7dc7c416
      Arnd Bergmann 提交于
      The rtw88 driver defines emtpy functions with multiple indirections
      but gets one of these wrong:
      
      drivers/net/wireless/realtek/rtw88/pci.c:1347:12: error: 'rtw_pci_resume' defined but not used [-Werror=unused-function]
       1347 | static int rtw_pci_resume(struct device *dev)
            |            ^~~~~~~~~~~~~~
      drivers/net/wireless/realtek/rtw88/pci.c:1342:12: error: 'rtw_pci_suspend' defined but not used [-Werror=unused-function]
       1342 | static int rtw_pci_suspend(struct device *dev)
      
      Better simplify it to rely on the conditional reference in
      SIMPLE_DEV_PM_OPS(), and mark the functions as __maybe_unused to avoid
      warning about it.
      
      I'm not sure if these are needed at all given that the functions
      don't do anything, but they were only recently added.
      
      Fixes: 44bc17f7 ("rtw88: support wowlan feature for 8822c")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20200408185413.218643-1-arnd@arndb.de
      7dc7c416
  10. 24 3月, 2020 4 次提交
  11. 13 2月, 2020 2 次提交
    • J
      rtw88: 8822[bc]: Make tables const, reduce data object size · d49f2c50
      Joe Perches 提交于
      Reduce the data size 2kb or 3kb by making tables const.
      Add const to pointer declarations to make compilation work too.
      
      (x86-64 defconfig)
      $ size drivers/net/wireless/realtek/rtw88/rtw8822?.o*
         text	   data	    bss	    dec	    hex	filename
        25054	    672	      8	  25734	   6486	drivers/net/wireless/realtek/rtw88/rtw8822b.o.new
        23870	   1872	      8	  25750	   6496	drivers/net/wireless/realtek/rtw88/rtw8822b.o.old
        53646	    828	      0	  54474	   d4ca	drivers/net/wireless/realtek/rtw88/rtw8822c.o.new
        52846	   1652	      0	  54498	   d4e2	drivers/net/wireless/realtek/rtw88/rtw8822c.o.old
      
      (x86-64 allyesconfig)
      $ size drivers/net/wireless/realtek/rtw88/rtw8822?.o*
         text	   data	    bss	    dec	    hex	filename
        45811	   6280	    128	  52219	   cbfb	drivers/net/wireless/realtek/rtw88/rtw8822b.o.new
        44211	   7880	    128	  52219	   cbfb	drivers/net/wireless/realtek/rtw88/rtw8822b.o.old
       100195	   8128	      0	 108323	  1a723	drivers/net/wireless/realtek/rtw88/rtw8822c.o.new
        98947	   9376	      0	 108323	  1a723	drivers/net/wireless/realtek/rtw88/rtw8822c.o.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Acked-by: NYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      d49f2c50
    • Y
      rtw88: pci: 8822c should set clock delay to zero · 2a422555
      Yan-Hsuan Chuang 提交于
      Since RTL8822CE has enabled reference clock auto calibration,
      there is no need to add any clock delay for covering the timing
      gap of the reference clock.
      Signed-off-by: NYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      2a422555
  12. 26 1月, 2020 5 次提交
  13. 20 11月, 2019 4 次提交
  14. 14 10月, 2019 1 次提交
  15. 02 10月, 2019 2 次提交
    • Y
      rtw88: add deep power save support · 27e117e4
      Yan-Hsuan Chuang 提交于
      Deep power save allows firmware/hardware to operate in a
      lower power state. And the deep power save mode depends on
      LPS mode. So, before entering deep PS, driver must first
      enter LPS mode.
      
      Under Deep PS, most of hardware functions are shutdown,
      driver will not be able to read/write registers and transfer
      data to the device. Hence TX path must be protected by each
      interface. Take PCI for example, DMA engine should be idle,
      and no nore activities on the PCI bus.
      
      If driver wants to operate on the device, such as register
      read/write, it must first acquire the mutex lock and wake
      up from Deep PS, otherwise the behavior is undefined.
      Signed-off-by: NYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      27e117e4
    • Y
      rtw88: pci: reset H2C queue indexes in a single write · 6f0b0d28
      Yan-Hsuan Chuang 提交于
      If the driver doesn't reset the host's and device's indexes
      in a single write, the indexes will become different in a
      short period. And it will confuse the DMA engine, make it
      start to process non-existed entries.
      
      Better to Write-1-to-reset the indexes, for the DMA engine
      to know that this is a reset of the H2C queue, not a kick
      off.
      Signed-off-by: NYan-Hsuan Chuang <yhchuang@realtek.com>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      6f0b0d28
  16. 21 9月, 2019 2 次提交
  17. 03 9月, 2019 2 次提交
  18. 06 8月, 2019 2 次提交
  19. 24 7月, 2019 2 次提交
    • J
      rtw88: pci: Use DMA sync instead of remapping in RX ISR · 29b68a92
      Jian-Hong Pan 提交于
      Since each skb in RX ring is reused instead of new allocation, we can
      treat the DMA in a more efficient way by DMA synchronization.
      Signed-off-by: NJian-Hong Pan <jian-hong@endlessm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      29b68a92
    • J
      rtw88: pci: Rearrange the memory usage for skb in RX ISR · ee6db78f
      Jian-Hong Pan 提交于
      Testing with RTL8822BE hardware, when available memory is low, we
      frequently see a kernel panic and system freeze.
      
      First, rtw_pci_rx_isr encounters a memory allocation failure (trimmed):
      
      rx routine starvation
      WARNING: CPU: 7 PID: 9871 at drivers/net/wireless/realtek/rtw88/pci.c:822 rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci]
      [ 2356.580313] RIP: 0010:rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci]
      
      Then we see a variety of different error conditions and kernel panics,
      such as this one (trimmed):
      
      rtw_pci 0000:02:00.0: pci bus timeout, check dma status
      skbuff: skb_over_panic: text:00000000091b6e66 len:415 put:415 head:00000000d2880c6f data:000000007a02b1ea tail:0x1df end:0xc0 dev:<NULL>
      ------------[ cut here ]------------
      kernel BUG at net/core/skbuff.c:105!
      invalid opcode: 0000 [#1] SMP NOPTI
      RIP: 0010:skb_panic+0x43/0x45
      
      When skb allocation fails and the "rx routine starvation" is hit, the
      function returns immediately without updating the RX ring. At this
      point, the RX ring may continue referencing an old skb which was already
      handed off to ieee80211_rx_irqsafe(). When it comes to be used again,
      bad things happen.
      
      This patch allocates a new, data-sized skb first in RX ISR. After
      copying the data in, we pass it to the upper layers. However, if skb
      allocation fails, we effectively drop the frame. In both cases, the
      original, full size ring skb is reused.
      
      In addition, to fixing the kernel crash, the RX routine should now
      generally behave better under low memory conditions.
      
      Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=204053Signed-off-by: NJian-Hong Pan <jian-hong@endlessm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      ee6db78f
  20. 28 5月, 2019 1 次提交