1. 25 Aug, 2020 28 commits
    • Miaohe Lin's avatar
      net: Use helper macro RT_TOS() in __icmp_send() · 373c15c2
      Miaohe Lin authored
      Use helper macro RT_TOS() to get tos in __icmp_send().
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      373c15c2
    • Miaohe Lin's avatar
      net: Avoid access icmp_err_convert when icmp code is ICMP_FRAG_NEEDED · 75511449
      Miaohe Lin authored
      There is no need to fetch errno and fatal info from icmp_err_convert when
      icmp code is ICMP_FRAG_NEEDED.
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      75511449
    • David S. Miller's avatar
      Merge branch 'qed-introduce-devlink-health-support' · 0caeba3d
      David S. Miller authored
      Igor Russkikh says:
      
      ====================
      qed: introduce devlink health support
      
      This is a followup implementation after series
      
      https://patchwork.ozlabs.org/project/netdev/cover/20200514095727.1361-1-irusskikh@marvell.com/
      
      This is an implementation of devlink health infrastructure.
      
      With this we are now able to report HW errors to devlink, and it'll take
      its own actions depending on user configuration to capture and store the
      dump at the bad moment, and to request the driver to recover the device.
      
      So far we do not differentiate global device failures or specific PCI
      function failures. This means that some errors specific to one physical
      function will affect an entire device. This is not yet fully designed
      and verified, will followup in future.
      
      Solution was verified with artificial HW errors generated, existing
      tools for dump analysis could be used.
      
      v7: comments from Jesse and Jakub
       - p2: extra edev check
       - p9: removed extra indents
      v6: patch 4: changing serial to board.serial and fw to fw.app
      v5: improved patch 4 description
      v4:
       - commit message and other fixes after Jiri's comments
       - removed one patch (will send to net)
      v3: fix uninit var usage in patch 11
      v2: fix #include issue from kbuild test robot.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0caeba3d
    • Igor Russkikh's avatar
      qede: make driver reliable on unload after failures · adc100d0
      Igor Russkikh authored
      In case recovery was not successful, netdev still should be
      present. But we should clear cdev if something bad happens
      on recovery.
      
      We also check cdev for null on dev close. That could be a case
      if recovery was not successful.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      adc100d0
    • Igor Russkikh's avatar
      qed: align adjacent indent · c5c642c5
      Igor Russkikh authored
      Remove extra indent on some of adjacent declarations.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5c642c5
    • Igor Russkikh's avatar
      qed: implement devlink dump · 27fed787
      Igor Russkikh authored
      Gather and push out full device dump to devlink.
      Device dump is the same as with `ethtool -d`, but now its generated
      exactly at the moment bad thing happens.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27fed787
    • Igor Russkikh's avatar
      qed*: make use of devlink recovery infrastructure · b228cb16
      Igor Russkikh authored
      Remove forcible recovery trigger and put it as a normal devlink
      callback.
      
      This allows user to enable/disable it via
      
          devlink health set pci/0000:03:00.0 reporter fw_fatal auto_recover false
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b228cb16
    • Igor Russkikh's avatar
      qed: use devlink logic to report errors · 4f5a8db2
      Igor Russkikh authored
      Use devlink_health_report to push error indications.
      We implement this in qede via callback function to make it possible
      to reuse the same for other drivers sitting on top of qed in future.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4f5a8db2
    • Igor Russkikh's avatar
      qed: health reporter init deinit seq · 9524067b
      Igor Russkikh authored
      Here we declare health reporter ops (empty for now)
      and register these in qed probe and remove callbacks.
      
      This way we get devlink attached to all kind of qed* PCI
      device entities: networking or storage offload entity.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9524067b
    • Igor Russkikh's avatar
      qed: implement devlink info request · 53916a67
      Igor Russkikh authored
      Here we return existing fw & mfw versions, we also fetch device's
      serial number:
      
      ~$ sudo ~/iproute2/devlink/devlink  dev info
      pci/0000:01:00.1:
        driver qed
        board.serial_number REE1915E44552
        versions:
            running:
              fw.app 8.42.2.0
            stored:
              fw.mgmt 8.52.10.0
      
      MFW and FW are different firmwares on device.
      Management is a firmware responsible for link configuration and
      various control plane features. Its permanent and resides in NVM.
      
      Running FW (or fastpath FW) is an embedded microprogram implementing
      all the packet processing, offloads, etc. This FW is being loaded
      on each start by the driver from FW binary blob.
      
      The base device specific structure (qed_dev_info) was not directly
      available to the base driver before. Thus, here we create and store
      a private copy of this structure in qed_dev root object to
      access the data.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      53916a67
    • Igor Russkikh's avatar
      qed: fix kconfig help entries · b75d05b2
      Igor Russkikh authored
      This patch replaces stubs in kconfig help entries with an actual description.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b75d05b2
    • Igor Russkikh's avatar
      qed/qede: make devlink survive recovery · 755f982b
      Igor Russkikh authored
      Devlink instance lifecycle was linked to qed_dev object,
      that caused devlink to be recreated on each recovery.
      
      Changing it by making higher level driver (qede) responsible for its
      life. This way devlink now survives recoveries.
      
      qede now stores devlink structure pointer as a part of its device
      object, devlink private data contains a linkage structure,
      qed_devlink.
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      755f982b
    • Igor Russkikh's avatar
      qed: move out devlink logic into a new file · 52306dee
      Igor Russkikh authored
      We are extending devlink infrastructure, thus move the existing
      stuff into a new file qed_devlink.c
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarAlexander Lobakin <alobakin@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52306dee
    • Christophe JAILLET's avatar
      chelsio: switch from 'pci_' to 'dma_' API · 9ab90179
      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 'free_rx_resources()' and
      'alloc_tx_resources()' (sge.c) GFP_KERNEL can be used because it is
      already used in these functions.
      
      Moreover, they can only be called from a .ndo_open	function. So it is
      guarded by the 'rtnl_lock()', which is a mutex.
      
      While at it, a pr_err message in 'init_one()' has been updated accordingly
      (s/consistent/coherent).
      
      @@
      @@
      -    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>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ab90179
    • David S. Miller's avatar
      Merge branch 'mlxsw-Misc-updates' · f6d89dc5
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Misc updates
      
      This patch set includes various updates for mlxsw.
      
      Patches #1-#4 adjust the default burst size of packet trap policers to
      conform to Spectrum-{2,3} requirements. The corresponding selftest is
      also adjusted so that it could reliably pass on these platforms.
      
      Patch #5 adjusts a selftest so that it could pass with both old and new
      versions of mausezahn.
      
      Patch #6 significantly reduces the runtime of tc-police scale test by
      changing the preference and masks of the used tc filters.
      
      Patch #7 prevents the driver from trying to set invalid ethtool link
      modes.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6d89dc5
    • Danielle Ratson's avatar
      mlxsw: spectrum_ethtool: Remove internal speeds from PTYS register · 5bf01b57
      Danielle Ratson authored
      The PTYS register is used to report and configure the port type and
      speed. Currently, internal bits in the register are used the same way
      other bits are used.
      
      Using the internal bits can cause bad parameter firmware errors. For
      example, trying to write to internal bit 25 returns:
      
      EMAD reg access failed (tid=53e2bffa00004310,reg_id=5004(ptys),type=write,status=7(bad parameter))
      
      Remove the internal bits from the PTYS register, so that it is no longer
      possible to pass them to firmware.
      Signed-off-by: default avatarDanielle Ratson <danieller@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5bf01b57
    • Ido Schimmel's avatar
      selftests: mlxsw: Reduce runtime of tc-police scale test · ffff9c9c
      Ido Schimmel authored
      Currently, the test takes about 626 seconds to complete because of an
      inefficient use of the device's TCAM. Reduce the runtime to 202 seconds
      by inserting all the flower filters with the same preference and mask,
      but with a different key.
      
      In particular, this reduces the deletion of the qdisc (which triggers
      the deletion of all the filters) from 66 seconds to 0.2 seconds. This
      prevents various netlink requests from user space applications (e.g.,
      systemd-networkd) from timing-out because RTNL is not held for too long
      anymore.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffff9c9c
    • Danielle Ratson's avatar
      selftests: forwarding: Fix mausezahn delay parameter in mirror_test() · 24f54c52
      Danielle Ratson authored
      Currently, mausezahn delay parameter in mirror_test() is specified with
      'ms' units.
      
      mausezahn versions before 0.6.5 interpret 'ms' as seconds and therefore
      the tests that use mirror_test() take a very long time to complete.
      
      Resolve this by specifying 'msec' units.
      Signed-off-by: default avatarDanielle Ratson <danieller@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24f54c52
    • Ido Schimmel's avatar
      selftests: mlxsw: Increase burst size for burst test · b36cca02
      Ido Schimmel authored
      The current combination of rate and burst size does not adhere to
      Spectrum-{2,3} limitation which states that the minimum burst size
      should be 40% of the rate.
      
      Increase the burst size in order to honor above mentioned limitation and
      avoid intermittent failures of this test case on Spectrum-{2,3}.
      
      Remove the first sub-test case as the variation in number of received
      packets is simply too large to reliably test it.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b36cca02
    • Ido Schimmel's avatar
      selftests: mlxsw: Increase burst size for rate test · 8e0d8ce4
      Ido Schimmel authored
      The current combination of rate and burst size does not adhere to
      Spectrum-{2,3} limitation which states that the minimum burst size
      should be 40% of the rate.
      
      Increase the burst size in order to honor above mentioned limitation and
      avoid intermittent failures of this test case on Spectrum-{2,3}.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8e0d8ce4
    • Ido Schimmel's avatar
      selftests: mlxsw: Decrease required rate accuracy · f033ad8d
      Ido Schimmel authored
      On Spectrum-{2,3} the required accuracy is +/-10%.
      
      Align the test to this requirement so that it can reliably pass on these
      platforms.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f033ad8d
    • Ido Schimmel's avatar
      mlxsw: spectrum_trap: Adjust default policer burst size for Spectrum-{2, 3} · 7ee0db9d
      Ido Schimmel authored
      On the Spectrum-{2,3} ASICs the minimum burst size of the packet trap
      policers needs to be 40% of the configured rate. Otherwise, intermittent
      drops are observed even when the incoming packet rate is slightly lower
      than the configured policer rate.
      
      Adjust the burst size of the registered packet trap policers so that
      they do not violate above mentioned limitation.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7ee0db9d
    • Christophe JAILLET's avatar
      net: atheros: switch from 'pci_' to 'dma_' API · 85eb5bc3
      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 'atl1e_setup_ring_resources()' (atl1e_main.c),
      'atl1_setup_ring_resources()' (atl1.c) and 'atl2_setup_ring_resources()'
      (atl2.c) GFP_KERNEL can be used because it can be called from a .ndo_open.
      
      'atl1_setup_ring_resources()' (atl1.c) can also be called from a
      '.set_ringparam' (see struct ethtool_ops) where sleep is also allowed.
      
      Both cases are protected by 'rtnl_lock()' which is a mutex. So these
      function can sleep.
      
      @@
      @@
      -    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>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85eb5bc3
    • Christophe JAILLET's avatar
      starfire: switch from 'pci_' to 'dma_' API · 5d63ccea
      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 'netdev_open()', GFP_ATOMIC must be used
      because it can be called from a .ndo_tx_timeout function.
      So this function can be called with the 'netif_tx_lock' acquired.
      The call chain is:
        --> tx_timeout                 (.ndo_tx_timeout function)
          --> netdev_open
      
      @@
      @@
      -    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>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5d63ccea
    • Christophe JAILLET's avatar
      typhoon: switch from 'pci_' to 'dma_' API · c8acc09c
      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 'typhoon_init_one()' GFP_KERNEL can be used
      because it is a probe function and no lock is acquired.
      
      When memory is allocated in 'typhoon_download_firmware()', GFP_ATOMIC
      must be used because it can be called from a .ndo_tx_timeout function.
      So this function can be called with the 'netif_tx_lock' acquired.
      The call chain is:
        --> typhoon_tx_timeout                 (.ndo_tx_timeout function)
          --> typhoon_start_runtime
            --> typhoon_download_firmware
      
      While at is, update some comments accordingly.
      
      @@
      @@
      -    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>
      Reviewed-by: default avatarDavid Dillow <dave@thedillows.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c8acc09c
    • Randy Dunlap's avatar
      net: dccp: delete repeated words · 54633527
      Randy Dunlap authored
      Drop duplicated words in /net/dccp/.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Gerrit Renker <gerrit@erg.abdn.ac.uk>
      Cc: dccp@vger.kernel.org
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      54633527
    • Randy Dunlap's avatar
      net: netlink: delete repeated words · 85405918
      Randy Dunlap authored
      Drop duplicated words in net/netlink/.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85405918
    • Randy Dunlap's avatar
      net: ipv4: delete repeated words · 2bdcc73c
      Randy Dunlap authored
      Drop duplicate words in comments in net/ipv4/.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2bdcc73c
  2. 24 Aug, 2020 12 commits