1. 31 3月, 2020 2 次提交
    • H
      net: hns3: fix for fraglist SKB headlen not handling correctly · 74ef402e
      Huazhong Tan 提交于
      When the fraglist SKB headlen is larger than zero, current code
      still handle the fraglist SKB linear data as frag data, which may
      cause TX error.
      
      This patch adds a new DESC_TYPE_FRAGLIST_SKB type to handle the
      mapping and unmapping of the fraglist SKB linear data buffer.
      
      Fixes: 8ae10cfb ("net: hns3: support tx-scatter-gather-fraglist feature")
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      74ef402e
    • Y
      net: hns3: drop the WQ_MEM_RECLAIM flag when allocating WQ · 16deaef2
      Yunsheng Lin 提交于
      The WQ in hns3 driver is allocated with WQ_MEM_RECLAIM flag
      in order to guarantee forward progress, which may cause hns3'
      WQ_MEM_RECLAIM WQ flushing infiniband' !WQ_MEM_RECLAIM WQ
      warning:
      
      [11246.200168] hns3 0000:bd:00.1: Reset done, hclge driver initialization finished.
      [11246.209979] hns3 0000:bd:00.1 eth7: net open
      [11246.227608] ------------[ cut here ]------------
      [11246.237370] workqueue: WQ_MEM_RECLAIM hclge:hclge_service_task [hclge] is flushing !WQ_MEM_RECLAIM infiniband:0x0
      [11246.237391] WARNING: CPU: 50 PID: 2279 at ./kernel/workqueue.c:2605 check_flush_dependency+0xcc/0x140
      [11246.260412] Modules linked in: hclgevf hns_roce_hw_v2 rdma_test(O) hns3 xt_CHECKSUM iptable_mangle xt_conntrack ipt_REJECT nf_reject_ipv4 ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bpfilter vfio_iommu_type1 vfio_pci vfio_virqfd vfio ib_isert iscsi_target_mod ib_ipoib ib_umad rpcrdma ib_iser libiscsi scsi_transport_iscsi aes_ce_blk crypto_simd cryptd aes_ce_cipher sunrpc nls_iso8859_1 crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce joydev input_leds hid_generic usbkbd usbmouse sbsa_gwdt usbhid usb_storage hid ses hclge hisi_zip hisi_hpre hisi_sec2 hnae3 hisi_qm ahci hisi_trng_v2 evbug uacce rng_core gpio_dwapb autofs4 hisi_sas_v3_hw megaraid_sas hisi_sas_main libsas scsi_transport_sas [last unloaded: hns_roce_hw_v2]
      [11246.325742] CPU: 50 PID: 2279 Comm: kworker/50:0 Kdump: loaded Tainted: G           O      5.4.0-rc4+ #1
      [11246.335181] Hardware name: Huawei TaiShan 200 (Model 2280)/BC82AMDD, BIOS 2280-V2 CS V3.B140.01 12/18/2019
      [11246.344802] Workqueue: hclge hclge_service_task [hclge]
      [11246.350007] pstate: 60c00009 (nZCv daif +PAN +UAO)
      [11246.354779] pc : check_flush_dependency+0xcc/0x140
      [11246.359549] lr : check_flush_dependency+0xcc/0x140
      [11246.364317] sp : ffff800268a73990
      [11246.367618] x29: ffff800268a73990 x28: 0000000000000001
      [11246.372907] x27: ffffcbe4f5868000 x26: ffffcbe4f5541000
      [11246.378196] x25: 00000000000000b8 x24: ffff002fdd0ff868
      [11246.383483] x23: ffff002fdd0ff800 x22: ffff2027401ba600
      [11246.388770] x21: 0000000000000000 x20: ffff002fdd0ff800
      [11246.394059] x19: ffff202719293b00 x18: ffffcbe4f5541948
      [11246.399347] x17: 000000006f8ad8dd x16: 0000000000000002
      [11246.404634] x15: ffff8002e8a734f7 x14: 6c66207369205d65
      [11246.409922] x13: 676c63685b206b73 x12: 61745f6563697672
      [11246.415208] x11: 65735f65676c6368 x10: 3a65676c6368204d
      [11246.420494] x9 : 49414c4345525f4d x8 : 6e6162696e69666e
      [11246.425782] x7 : 69204d49414c4345 x6 : ffffcbe4f5765145
      [11246.431068] x5 : 0000000000000000 x4 : 0000000000000000
      [11246.436355] x3 : 0000000000000030 x2 : 00000000ffffffff
      [11246.441642] x1 : 3349eb1ac5310100 x0 : 0000000000000000
      [11246.446928] Call trace:
      [11246.449363]  check_flush_dependency+0xcc/0x140
      [11246.453785]  flush_workqueue+0x110/0x410
      [11246.457691]  ib_cache_cleanup_one+0x54/0x468
      [11246.461943]  __ib_unregister_device+0x70/0xa8
      [11246.466279]  ib_unregister_device+0x2c/0x40
      [11246.470455]  hns_roce_exit+0x34/0x198 [hns_roce_hw_v2]
      [11246.475571]  __hns_roce_hw_v2_uninit_instance.isra.56+0x3c/0x58 [hns_roce_hw_v2]
      [11246.482934]  hns_roce_hw_v2_reset_notify+0xd8/0x210 [hns_roce_hw_v2]
      [11246.489261]  hclge_notify_roce_client+0x84/0xe0 [hclge]
      [11246.494464]  hclge_reset_rebuild+0x60/0x730 [hclge]
      [11246.499320]  hclge_reset_service_task+0x400/0x5a0 [hclge]
      [11246.504695]  hclge_service_task+0x54/0x698 [hclge]
      [11246.509464]  process_one_work+0x15c/0x458
      [11246.513454]  worker_thread+0x144/0x520
      [11246.517186]  kthread+0xfc/0x128
      [11246.520314]  ret_from_fork+0x10/0x18
      [11246.523873] ---[ end trace eb980723699c2585 ]---
      [11246.528710] hns3 0000:bd:00.2: Func clear success after reset.
      [11246.528747] hns3 0000:bd:00.0: Func clear success after reset.
      [11246.907710] hns3 0000:bd:00.1 eth7: link up
      
      According to [1] and [2]:
      
      There seems to be no specific guidance about how to handling the
      forward progress guarantee of network device's WQ yet, and other
      network device's WQ seem to be marked with WQ_MEM_RECLAIM without
      a clear reason.
      
      So this patch removes the WQ_MEM_RECLAIM flag when allocating WQ
      to aviod the above warning.
      
      1. https://www.spinics.net/lists/netdev/msg631646.html
      2. https://www.spinics.net/lists/netdev/msg632097.html
      
      Fixes: 0ea68902 ("net: hns3: allocate WQ with WQ_MEM_RECLAIM flag")
      Signed-off-by: NYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16deaef2
  2. 28 3月, 2020 1 次提交
  3. 27 3月, 2020 3 次提交
    • M
      net: ks8851-ml: Fix IO operations, again · 8262e6f9
      Marek Vasut 提交于
      This patch reverts 58292104 ("net: ks8851-ml: Fix 16-bit IO operation")
      and edacb098 ("net: ks8851-ml: Fix 16-bit data access"), because it
      turns out these were only necessary due to buggy hardware. This patch adds
      a check for such a buggy hardware to prevent any such mistakes again.
      
      While working further on the KS8851 driver, it came to light that the
      KS8851-16MLL is capable of switching bus endianness by a hardware strap,
      EESK pin. If this strap is incorrect, the IO accesses require such endian
      swapping as is being reverted by this patch. Such swapping also impacts
      the performance significantly.
      
      Hence, in addition to removing it, detect that the hardware is broken,
      report to user, and fail to bind with such hardware.
      
      Fixes: 58292104 ("net: ks8851-ml: Fix 16-bit IO operation")
      Fixes: edacb098 ("net: ks8851-ml: Fix 16-bit data access")
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Petr Stetiar <ynezz@true.cz>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8262e6f9
    • I
      mlxsw: spectrum_mr: Fix list iteration in error path · f6bf1baf
      Ido Schimmel 提交于
      list_for_each_entry_from_reverse() iterates backwards over the list from
      the current position, but in the error path we should start from the
      previous position.
      
      Fix this by using list_for_each_entry_continue_reverse() instead.
      
      This suppresses the following error from coccinelle:
      
      drivers/net/ethernet/mellanox/mlxsw//spectrum_mr.c:655:34-38: ERROR:
      invalid reference to the index variable of the iterator on line 636
      
      Fixes: c011ec1b ("mlxsw: spectrum: Add the multicast routing offloading logic")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f6bf1baf
    • X
      qlcnic: Fix bad kzalloc null test · bcaeb886
      Xu Wang 提交于
      In qlcnic_83xx_get_reset_instruction_template, the variable
      of null test is bad, so correct it.
      Signed-off-by: NXu Wang <vulab@iscas.ac.cn>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bcaeb886
  4. 26 3月, 2020 1 次提交
    • G
      net: ena: Add PCI shutdown handler to allow safe kexec · 428c4913
      Guilherme G. Piccoli 提交于
      Currently ENA only provides the PCI remove() handler, used during rmmod
      for example. This is not called on shutdown/kexec path; we are potentially
      creating a failure scenario on kexec:
      
      (a) Kexec is triggered, no shutdown() / remove() handler is called for ENA;
      instead pci_device_shutdown() clears the master bit of the PCI device,
      stopping all DMA transactions;
      
      (b) Kexec reboot happens and the device gets enabled again, likely having
      its FW with that DMA transaction buffered; then it may trigger the (now
      invalid) memory operation in the new kernel, corrupting kernel memory area.
      
      This patch aims to prevent this, by implementing a shutdown() handler
      quite similar to the remove() one - the difference being the handling
      of the netdev, which is unregistered on remove(), but following the
      convention observed in other drivers, it's only detached on shutdown().
      
      This prevents an odd issue in AWS Nitro instances, in which after the 2nd
      kexec the next one will fail with an initrd corruption, caused by a wild
      DMA write to invalid kernel memory. The lspci output for the adapter
      present in my instance is:
      
      00:05.0 Ethernet controller [0200]: Amazon.com, Inc. Elastic Network
      Adapter (ENA) [1d0f:ec20]
      Suggested-by: NGavin Shan <gshan@redhat.com>
      Signed-off-by: NGuilherme G. Piccoli <gpiccoli@canonical.com>
      Acked-by: NSameeh Jubran <sameehj@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      428c4913
  5. 25 3月, 2020 7 次提交
  6. 24 3月, 2020 5 次提交
  7. 22 3月, 2020 8 次提交
  8. 20 3月, 2020 3 次提交
    • R
      cxgb4: fix Txq restart check during backpressure · f1f20a86
      Rahul Lakkireddy 提交于
      Driver reclaims descriptors in much smaller batches, even if hardware
      indicates more to reclaim, during backpressure. So, fix the check to
      restart the Txq during backpressure, by looking at how many
      descriptors hardware had indicated to reclaim, and not on how many
      descriptors that driver had actually reclaimed. Once the Txq is
      restarted, driver will reclaim even more descriptors when Tx path
      is entered again.
      
      Fixes: d429005f ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
      Signed-off-by: NRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1f20a86
    • R
      cxgb4: fix throughput drop during Tx backpressure · 7affd808
      Rahul Lakkireddy 提交于
      commit 7c3bebc3 ("cxgb4: request the TX CIDX updates to status page")
      reverted back to getting Tx CIDX updates via DMA, instead of interrupts,
      introduced by commit d429005f ("cxgb4/cxgb4vf: Add support for SGE
      doorbell queue timer")
      
      However, it missed reverting back several code changes where Tx CIDX
      updates are not explicitly requested during backpressure when using
      interrupt mode. These missed changes cause slow recovery during
      backpressure because the corresponding interrupt no longer comes and
      hence results in Tx throughput drop.
      
      So, revert back these missed code changes, as well, which will allow
      explicitly requesting Tx CIDX updates when backpressure happens.
      This enables the corresponding interrupt with Tx CIDX update message
      to get generated and hence speed up recovery and restore back
      throughput.
      
      Fixes: 7c3bebc3 ("cxgb4: request the TX CIDX updates to status page")
      Fixes: d429005f ("cxgb4/cxgb4vf: Add support for SGE doorbell queue timer")
      Signed-off-by: NRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7affd808
    • I
      mlxsw: pci: Only issue reset when system is ready · 6002059d
      Ido Schimmel 提交于
      During initialization the driver issues a software reset command and
      then waits for the system status to change back to "ready" state.
      
      However, before issuing the reset command the driver does not check that
      the system is actually in "ready" state. On Spectrum-{1,2} systems this
      was always the case as the hardware initialization time is very short.
      On Spectrum-3 systems this is no longer the case. This results in the
      software reset command timing-out and the driver failing to load:
      
      [ 6.347591] mlxsw_spectrum3 0000:06:00.0: Cmd exec timed-out (opcode=40(ACCESS_REG),opcode_mod=0,in_mod=0)
      [ 6.358382] mlxsw_spectrum3 0000:06:00.0: Reg cmd access failed (reg_id=9023(mrsr),type=write)
      [ 6.368028] mlxsw_spectrum3 0000:06:00.0: cannot register bus device
      [ 6.375274] mlxsw_spectrum3: probe of 0000:06:00.0 failed with error -110
      
      Fix this by waiting for the system to become ready both before issuing
      the reset command and afterwards. In case of failure, print the last
      system status to aid in debugging.
      
      Fixes: da382875 ("mlxsw: spectrum: Extend to support Spectrum-3 ASIC")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6002059d
  9. 18 3月, 2020 8 次提交
    • A
      net: ena: fix continuous keep-alive resets · dfdde134
      Arthur Kiyanovski 提交于
      last_keep_alive_jiffies is updated in probe and when a keep-alive
      event is received.  In case the driver times-out on a keep-alive event,
      it has high chances of continuously timing-out on keep-alive events.
      This is because when the driver recovers from the keep-alive-timeout reset
      the value of last_keep_alive_jiffies is very old, and if a keep-alive
      event is not received before the next timer expires, the value of
      last_keep_alive_jiffies will cause another keep-alive-timeout reset
      and so forth in a loop.
      
      Solution:
      Update last_keep_alive_jiffies whenever the device is restored after
      reset.
      
      Fixes: 1738cd3e ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: NNoam Dagan <ndagan@amazon.com>
      Signed-off-by: NArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dfdde134
    • A
      net: ena: avoid memory access violation by validating req_id properly · 30623e1e
      Arthur Kiyanovski 提交于
      Rx req_id is an index in struct ena_eth_io_rx_cdesc_base.
      The driver should validate that the Rx req_id it received from
      the device is in range [0, ring_size -1].  Failure to do so could
      yield to potential memory access violoation.
      The validation was mistakenly done when refilling
      the Rx submission queue and not in Rx completion queue.
      
      Fixes: ad974bae ("net: ena: add support for out of order rx buffers refill")
      Signed-off-by: NNoam Dagan <ndagan@amazon.com>
      Signed-off-by: NArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      30623e1e
    • A
      net: ena: fix request of incorrect number of IRQ vectors · e02ae6ed
      Arthur Kiyanovski 提交于
      Bug:
      In short the main issue is caused by the fact that the number of queues
      is changed using ethtool after ena_probe() has been called and before
      ena_up() was executed. Here is the full scenario in detail:
      
      * ena_probe() is called when the driver is loaded, the driver is not up
        yet at the end of ena_probe().
      * The number of queues is changed -> io_queue_count is changed as well -
        ena_up() is not called since the "dev_was_up" boolean in
        ena_update_queue_count() is false.
      * ena_up() is called by the kernel (it's called asynchronously some
        time after ena_probe()). ena_setup_io_intr() is called by ena_up() and
        it uses io_queue_count to get the suitable irq lines for each msix
        vector. The function ena_request_io_irq() is called right after that
        and it uses msix_vecs - This value only changes during ena_probe() and
        ena_restore() - to request the irq vectors. This results in "Failed to
        request I/O IRQ" error for i > io_queue_count.
      
      Numeric example:
      * After ena_probe() io_queue_count = 8, msix_vecs = 9.
      * The number of queues changes to 4 -> io_queue_count = 4, msix_vecs = 9.
      * ena_up() is executed for the first time:
        ** ena_setup_io_intr() inits the vectors only up to io_queue_count.
        ** ena_request_io_irq() calls request_irq() and fails for i = 5.
      
      How to reproduce:
      simply run the following commands:
          sudo rmmod ena && sudo insmod ena.ko;
          sudo ethtool -L eth1 combined 3;
      
      Fix:
      Use ENA_MAX_MSIX_VEC(adapter->num_io_queues + adapter->xdp_num_queues)
      instead of adapter->msix_vecs. We need to take XDP queues into
      consideration as they need to have msix vectors assigned to them as well.
      Note that the XDP cannot be attached before the driver is up and running
      but in XDP mode the issue might occur when the number of queues changes
      right after a reset trigger.
      The ENA_MAX_MSIX_VEC simply adds one to the argument since the first msix
      vector is reserved for management queue.
      
      Fixes: 1738cd3e ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: NSameeh Jubran <sameehj@amazon.com>
      Signed-off-by: NArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e02ae6ed
    • A
      net: ena: fix incorrect setting of the number of msix vectors · ce1f3521
      Arthur Kiyanovski 提交于
      Overview:
      We don't frequently change the msix vectors throughout the life cycle of
      the driver. We do so in two functions: ena_probe() and ena_restore().
      ena_probe() is only called when the driver is loaded. ena_restore() on the
      other hand is called during device reset / resume operations.
      
      We use num_io_queues for calculating and allocating the number of msix
      vectors. At ena_probe() this value is equal to max_num_io_queues and thus
      this is not an issue, however ena_restore() might be called after the
      number of io queues has changed.
      
      A possible bug scenario is as follows:
      
      * Change number of queues from 8 to 4.
        (num_io_queues = 4, max_num_io_queues = 8, msix_vecs = 9,)
      * Trigger reset occurs -> ena_restore is called.
        (num_io_queues = 4, max_num_io_queues =8 , msix_vecs = 5)
      * Change number of queues from 4 to 6.
        (num_io_queues = 6, max_num_io_queues = 8, msix_vecs = 5)
      * The driver will reset due to failure of check_for_rx_interrupt_queue()
      
      Fix:
      This can be easily fixed by always using max_num_io_queues to init the
      msix_vecs, since this number won't change as opposed to num_io_queues.
      
      Fixes: 4d192660 ("net: ena: multiple queue creation related cleanups")
      Signed-off-by: NSameeh Jubran <sameehj@amazon.com>
      Signed-off-by: NArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce1f3521
    • D
      net: bcmgenet: keep MAC in reset until PHY is up · 88f6c8bf
      Doug Berger 提交于
      As noted in commit 28c2d1a7 ("net: bcmgenet: enable loopback
      during UniMAC sw_reset") the UniMAC must be clocked at least 5
      cycles while the sw_reset is asserted to ensure a clean reset.
      
      That commit enabled local loopback to provide an Rx clock from the
      GENET sourced Tx clk. However, when connected in MII mode the Tx
      clk is sourced by the PHY so if an EPHY is not supplying clocks
      (e.g. when the link is down) the UniMAC does not receive the
      necessary clocks.
      
      This commit extends the sw_reset window until the PHY reports that
      the link is up thereby ensuring that the clocks are being provided
      to the MAC to produce a clean reset.
      
      One consequence is that if the system attempts to enter a Wake on
      LAN suspend state when the PHY link has not been active the MAC
      may not have had a chance to initialize cleanly. In this case, we
      remove the sw_reset and enable the WoL reception path as normal
      with the hope that the PHY will provide the necessary clocks to
      drive the WoL blocks if the link becomes active after the system
      has entered suspend.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88f6c8bf
    • D
      Revert "net: bcmgenet: use RGMII loopback for MAC reset" · 612eb1c3
      Doug Berger 提交于
      This reverts commit 3a55402c.
      
      This is not a good solution when connecting to an external switch
      that may not support the isolation of the TXC signal resulting in
      output driver contention on the pin.
      
      A different solution is necessary.
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      612eb1c3
    • C
      net: mvmdio: avoid error message for optional IRQ · fa2632f7
      Chris Packham 提交于
      Per the dt-binding the interrupt is optional so use
      platform_get_irq_optional() instead of platform_get_irq(). Since
      commit 7723f4c5 ("driver core: platform: Add an error message to
      platform_get_irq*()") platform_get_irq() produces an error message
      
        orion-mdio f1072004.mdio: IRQ index 0 not found
      
      which is perfectly normal if one hasn't specified the optional property
      in the device tree.
      Signed-off-by: NChris Packham <chris.packham@alliedtelesis.co.nz>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa2632f7
    • C
      Revert "net: mvmdio: avoid error message for optional IRQ" · 028fd76b
      Chris Packham 提交于
      This reverts commit e1f550dc.
      platform_get_irq_optional() will still return -ENXIO when no interrupt
      is provided so the additional error handling caused the driver prone to
      fail when no interrupt was specified. Revert the change so we can apply
      the correct minimal fix.
      Signed-off-by: NChris Packham <chris.packham@alliedtelesis.co.nz>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      028fd76b
  10. 17 3月, 2020 2 次提交