1. 16 Jan, 2021 4 commits
    • Christophe JAILLET's avatar
      netxen_nic: switch from 'pci_' to 'dma_' API · 297af515
      Christophe JAILLET authored
      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 'netxen_get_minidump_template()' GFP_KERNEL can
      be used because its only caller, ' netxen_setup_minidump(()' already uses
      it and no lock is acquired in the between.
      
      When memory is allocated in other function in 'netxen_nic_ctx.c' GFP_KERNEL
      can be used because the call chain already uses GFP_KERNEL and no lock is
      taken in the between.
      The call chain is:
        netxen_nic_attach()
          --> netxen_alloc_sw_resources()          : already uses GFP_KERNEL
          --> netxen_alloc_hw_resources()
            --> nx_fw_cmd_create_rx_ctx()
            --> nx_fw_cmd_create_tx_ctx()
      
      When memory is allocated in 'netxen_init_dummy_dma()' GFP_KERNEL can be
      used because its only call chain already uses it and no lock is acquired in
      the between.
      The call chain is:
        --> netxen_start_firmware
          --> netxen_request_firmware()
            --> request_firmware()
              --> _request_firmware(()
                --> fw_get_filesystem_firmware()
                  --> __getname()                  : already uses GFP_KERNEL
          --> netxen_init_dummy_dma()
      
      @@
      @@
      -    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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/20210113202519.487672-1-christophe.jaillet@wanadoo.frSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      297af515
    • Jakub Kicinski's avatar
      Merge branch 'net-dsa-mv88e6xxx-lag-fixes' · 7c140b05
      Jakub Kicinski authored
      Tobias Waldekranz says:
      
      ====================
      net: dsa: mv88e6xxx: LAG fixes
      
      The kernel test robot kindly pointed out that Global 2 support in
      mv88e6xxx is optional.
      
      This also made me realize that we should verify that the hardware
      actually supports LAG offloading before trying to configure it.
      ====================
      
      Link: https://lore.kernel.org/r/20210115125259.22542-1-tobias@waldekranz.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7c140b05
    • Tobias Waldekranz's avatar
      net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware · b80dc51b
      Tobias Waldekranz authored
      There are chips that do have Global 2 registers, and therefore trunk
      mapping/mask tables are not available. Refuse the offload as early as
      possible on those devices.
      
      Fixes: 57e661aa ("net: dsa: mv88e6xxx: Link aggregation support")
      Signed-off-by: default avatarTobias Waldekranz <tobias@waldekranz.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b80dc51b
    • Tobias Waldekranz's avatar
      net: dsa: mv88e6xxx: Provide dummy implementations for trunk setters · d38001d3
      Tobias Waldekranz authored
      Support for Global 2 registers is build-time optional. In the case
      where it was not enabled the build would fail as no "dummy"
      implementation of these functions was available.
      
      Fixes: 57e661aa ("net: dsa: mv88e6xxx: Link aggregation support")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Tested-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarTobias Waldekranz <tobias@waldekranz.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d38001d3
  2. 15 Jan, 2021 36 commits