1. 12 11月, 2020 1 次提交
  2. 11 11月, 2020 2 次提交
    • S
      lan743x: fix "BUG: invalid wait context" when setting rx mode · 2b52a4b6
      Sven Van Asbroeck 提交于
      In the net core, the struct net_device_ops -> ndo_set_rx_mode()
      callback is called with the dev->addr_list_lock spinlock held.
      
      However, this driver's ndo_set_rx_mode callback eventually calls
      lan743x_dp_write(), which acquires a mutex. Mutex acquisition
      may sleep, and this is not allowed when holding a spinlock.
      
      Fix by removing the dp_lock mutex entirely. Its purpose is to
      prevent concurrent accesses to the data port. No concurrent
      accesses are possible, because the dev->addr_list_lock
      spinlock in the core only lets through one thread at a time.
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201109203828.5115-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      2b52a4b6
    • S
      lan743x: correctly handle chips with internal PHY · 902a66e0
      Sven Van Asbroeck 提交于
      Commit 6f197fb6 ("lan743x: Added fixed link and RGMII support")
      assumes that chips with an internal PHY will never have a devicetree
      entry. This is incorrect: even for these chips, a devicetree entry
      can be useful e.g. to pass the mac address from bootloader to chip:
      
          &pcie {
                  status = "okay";
      
                  host@0 {
                          reg = <0 0 0 0 0>;
      
                          #address-cells = <3>;
                          #size-cells = <2>;
      
                          lan7430: ethernet@0 {
                                  /* LAN7430 with internal PHY */
                                  compatible = "microchip,lan743x";
                                  status = "okay";
                                  reg = <0 0 0 0 0>;
                                  /* filled in by bootloader */
                                  local-mac-address = [00 00 00 00 00 00];
                          };
                  };
          };
      
      If a devicetree entry is present, the driver will not attach the chip
      to its internal phy, and the chip will be non-operational.
      
      Fix by tweaking the phy connection algorithm:
      - first try to connect to a phy specified in the devicetree
        (could be 'real' phy, or just a 'fixed-link')
      - if that doesn't succeed, try to connect to an internal phy, even
        if the chip has a devnode
      
      Tested on a LAN7430 with internal PHY. I cannot test a device using
      fixed-link, as I do not have access to one.
      
      Fixes: 6f197fb6 ("lan743x: Added fixed link and RGMII support")
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201108171224.23829-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      902a66e0
  3. 08 11月, 2020 3 次提交
  4. 06 11月, 2020 8 次提交
  5. 05 11月, 2020 1 次提交
  6. 04 11月, 2020 2 次提交
  7. 03 11月, 2020 4 次提交
    • S
      powerpc/vnic: Extend "failover pending" window · 1d850493
      Sukadev Bhattiprolu 提交于
      Commit 5a18e1e0 introduced the 'failover_pending' state to track
      the "failover pending window" - where we wait for the partner to become
      ready (after a transport event) before actually attempting to failover.
      i.e window is between following two events:
      
              a. we get a transport event due to a FAILOVER
      
              b. later, we get CRQ_INITIALIZED indicating the partner is
                 ready  at which point we schedule a FAILOVER reset.
      
      and ->failover_pending is true during this window.
      
      If during this window, we attempt to open (or close) a device, we pretend
      that the operation succeded and let the FAILOVER reset path complete the
      operation.
      
      This is fine, except if the transport event ("a" above) occurs during the
      open and after open has already checked whether a failover is pending. If
      that happens, we fail the open, which can cause the boot scripts to leave
      the interface down requiring administrator to manually bring up the device.
      
      This fix "extends" the failover pending window till we are _actually_
      ready to perform the failover reset (i.e until after we get the RTNL
      lock). Since open() holds the RTNL lock, we can be sure that we either
      finish the open or if the open() fails due to the failover pending window,
      we can again pretend that open is done and let the failover complete it.
      
      We could try and block the open until failover is completed but a) that
      could still timeout the application and b) Existing code "pretends" that
      failover occurred "just after" open succeeded, so marks the open successful
      and lets the failover complete the open. So, mark the open successful even
      if the transport event occurs before we actually start the open.
      
      Fixes: 5a18e1e0 ("ibmvnic: Fix failover case for non-redundant configuration")
      Signed-off-by: NSukadev Bhattiprolu <sukadev@linux.ibm.com>
      Acked-by: NDany Madden <drt@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201030170711.1562994-1-sukadev@linux.ibm.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      1d850493
    • G
      net: ethernet: ti: cpsw: disable PTPv1 hw timestamping advertisement · 0a26ba06
      Grygorii Strashko 提交于
      The TI CPTS does not natively support PTPv1, only PTPv2. But, as it
      happens, the CPTS can provide HW timestamp for PTPv1 Sync messages, because
      CPTS HW parser looks for PTP messageType id in PTP message octet 0 which
      value is 0 for PTPv1. As result, CPTS HW can detect Sync messages for PTPv1
      and PTPv2 (Sync messageType = 0 for both), but it fails for any other PTPv1
      messages (Delay_req/resp) and will return PTP messageType id 0 for them.
      
      The commit e9523a5a ("net: ethernet: ti: cpsw: enable
      HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter") added PTPv1 hw timestamping
      advertisement by mistake, only to make Linux Kernel "timestamping" utility
      work, and this causes issues with only PTPv1 compatible HW/SW - Sync HW
      timestamped, but Delay_req/resp are not.
      
      Hence, fix it disabling PTPv1 hw timestamping advertisement, so only PTPv1
      compatible HW/SW can properly roll back to SW timestamping.
      
      Fixes: e9523a5a ("net: ethernet: ti: cpsw: enable HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter")
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Link: https://lore.kernel.org/r/20201029190910.30789-1-grygorii.strashko@ti.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      0a26ba06
    • C
      dpaa_eth: fix the RX headroom size alignment · 7834e494
      Camelia Groza 提交于
      The headroom reserved for received frames needs to be aligned to an
      RX specific value. There is currently a discrepancy between the values
      used in the Ethernet driver and the values passed to the FMan.
      Coincidentally, the resulting aligned values are identical.
      
      Fixes: 3c68b8ff ("dpaa_eth: FMan erratum A050385 workaround")
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7834e494
    • C
      dpaa_eth: update the buffer layout for non-A050385 erratum scenarios · acef159a
      Camelia Groza 提交于
      Impose a larger RX private data area only when the A050385 erratum is
      present on the hardware. A smaller buffer size is sufficient in all
      other scenarios. This enables a wider range of linear Jumbo frame
      sizes in non-erratum scenarios, instead of turning to multi
      buffer Scatter/Gather frames. The maximum linear frame size is
      increased by 128 bytes for non-erratum arm64 platforms.
      
      Cleanup the hardware annotations header defines in the process.
      
      Fixes: 3c68b8ff ("dpaa_eth: FMan erratum A050385 workaround")
      Signed-off-by: NCamelia Groza <camelia.groza@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      acef159a
  8. 01 11月, 2020 1 次提交
    • M
      cadence: force nonlinear buffers to be cloned · 403dc167
      Mark Deneen 提交于
      In my test setup, I had a SAMA5D27 device configured with ip forwarding, and
      second device with usb ethernet (r8152) sending ICMP packets.  If the packet
      was larger than about 220 bytes, the SAMA5 device would "oops" with the
      following trace:
      
      kernel BUG at net/core/skbuff.c:1863!
      Internal error: Oops - BUG: 0 [#1] ARM
      Modules linked in: xt_MASQUERADE ppp_async ppp_generic slhc iptable_nat xt_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 can_raw can bridge stp llc ipt_REJECT nf_reject_ipv4 sd_mod cdc_ether usbnet usb_storage r8152 scsi_mod mii o
      ption usb_wwan usbserial micrel macb at91_sama5d2_adc phylink gpio_sama5d2_piobu m_can_platform m_can industrialio_triggered_buffer kfifo_buf of_mdio can_dev fixed_phy sdhci_of_at91 sdhci_pltfm libphy sdhci mmc_core ohci_at91 ehci_atmel o
      hci_hcd iio_rescale industrialio sch_fq_codel spidev prox2_hal(O)
      CPU: 0 PID: 0 Comm: swapper Tainted: G           O      5.9.1-prox2+ #1
      Hardware name: Atmel SAMA5
      PC is at skb_put+0x3c/0x50
      LR is at macb_start_xmit+0x134/0xad0 [macb]
      pc : [<c05258cc>]    lr : [<bf0ea5b8>]    psr: 20070113
      sp : c0d01a60  ip : c07232c0  fp : c4250000
      r10: c0d03cc8  r9 : 00000000  r8 : c0d038c0
      r7 : 00000000  r6 : 00000008  r5 : c59b66c0  r4 : 0000002a
      r3 : 8f659eff  r2 : c59e9eea  r1 : 00000001  r0 : c59b66c0
      Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      Control: 10c53c7d  Table: 2640c059  DAC: 00000051
      Process swapper (pid: 0, stack limit = 0x75002d81)
      
      <snipped stack>
      
      [<c05258cc>] (skb_put) from [<bf0ea5b8>] (macb_start_xmit+0x134/0xad0 [macb])
      [<bf0ea5b8>] (macb_start_xmit [macb]) from [<c053e504>] (dev_hard_start_xmit+0x90/0x11c)
      [<c053e504>] (dev_hard_start_xmit) from [<c0571180>] (sch_direct_xmit+0x124/0x260)
      [<c0571180>] (sch_direct_xmit) from [<c053eae4>] (__dev_queue_xmit+0x4b0/0x6d0)
      [<c053eae4>] (__dev_queue_xmit) from [<c05a5650>] (ip_finish_output2+0x350/0x580)
      [<c05a5650>] (ip_finish_output2) from [<c05a7e24>] (ip_output+0xb4/0x13c)
      [<c05a7e24>] (ip_output) from [<c05a39d0>] (ip_forward+0x474/0x500)
      [<c05a39d0>] (ip_forward) from [<c05a13d8>] (ip_sublist_rcv_finish+0x3c/0x50)
      [<c05a13d8>] (ip_sublist_rcv_finish) from [<c05a19b8>] (ip_sublist_rcv+0x11c/0x188)
      [<c05a19b8>] (ip_sublist_rcv) from [<c05a2494>] (ip_list_rcv+0xf8/0x124)
      [<c05a2494>] (ip_list_rcv) from [<c05403c4>] (__netif_receive_skb_list_core+0x1a0/0x20c)
      [<c05403c4>] (__netif_receive_skb_list_core) from [<c05405c4>] (netif_receive_skb_list_internal+0x194/0x230)
      [<c05405c4>] (netif_receive_skb_list_internal) from [<c0540684>] (gro_normal_list.part.0+0x14/0x28)
      [<c0540684>] (gro_normal_list.part.0) from [<c0541280>] (napi_complete_done+0x16c/0x210)
      [<c0541280>] (napi_complete_done) from [<bf14c1c0>] (r8152_poll+0x684/0x708 [r8152])
      [<bf14c1c0>] (r8152_poll [r8152]) from [<c0541424>] (net_rx_action+0x100/0x328)
      [<c0541424>] (net_rx_action) from [<c01012ec>] (__do_softirq+0xec/0x274)
      [<c01012ec>] (__do_softirq) from [<c012d6d4>] (irq_exit+0xcc/0xd0)
      [<c012d6d4>] (irq_exit) from [<c0160960>] (__handle_domain_irq+0x58/0xa4)
      [<c0160960>] (__handle_domain_irq) from [<c0100b0c>] (__irq_svc+0x6c/0x90)
      Exception stack(0xc0d01ef0 to 0xc0d01f38)
      1ee0:                                     00000000 0000003d 0c31f383 c0d0fa00
      1f00: c0d2eb80 00000000 c0d2e630 4dad8c49 4da967b0 0000003d 0000003d 00000000
      1f20: fffffff5 c0d01f40 c04e0f88 c04e0f8c 30070013 ffffffff
      [<c0100b0c>] (__irq_svc) from [<c04e0f8c>] (cpuidle_enter_state+0x7c/0x378)
      [<c04e0f8c>] (cpuidle_enter_state) from [<c04e12c4>] (cpuidle_enter+0x28/0x38)
      [<c04e12c4>] (cpuidle_enter) from [<c014f710>] (do_idle+0x194/0x214)
      [<c014f710>] (do_idle) from [<c014fa50>] (cpu_startup_entry+0xc/0x14)
      [<c014fa50>] (cpu_startup_entry) from [<c0a00dc8>] (start_kernel+0x46c/0x4a0)
      Code: e580c054 8a000002 e1a00002 e8bd8070 (e7f001f2)
      ---[ end trace 146c8a334115490c ]---
      
      The solution was to force nonlinear buffers to be cloned.  This was previously
      reported by Klaus Doth (https://www.spinics.net/lists/netdev/msg556937.html)
      but never formally submitted as a patch.
      
      This is the third revision, hopefully the formatting is correct this time!
      Suggested-by: NKlaus Doth <krnl@doth.eu>
      Fixes: 653e92a9 ("net: macb: add support for padding and fcs computation")
      Signed-off-by: NMark Deneen <mdeneen@saucontech.com>
      Link: https://lore.kernel.org/r/20201030155814.622831-1-mdeneen@saucontech.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      403dc167
  9. 31 10月, 2020 5 次提交
    • G
      gve: Replace zero-length array with flexible-array member · 691f4077
      Gustavo A. R. Silva 提交于
      There is a regular need in the kernel to provide a way to declare having a
      dynamically sized set of trailing elements in a structure.  Kernel code
      should always use “flexible array members”[1] for these cases.  The
      older style of one-element or zero-length arrays should no longer be
      used[2].
      
      Refactor the code according to the use of a flexible-array member in
      struct gve_stats_report, instead of a zero-length array, and use the
      struct_size() helper to calculate the size for the resource allocation.
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arraysSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      691f4077
    • M
      net: stmmac: Fix channel lock initialization · 2b94f526
      Marek Szyprowski 提交于
      Commit 0366f7e0 ("net: stmmac: add ethtool support for get/set
      channels") refactored channel initialization, but during that operation,
      the spinlock initialization got lost. Fix this. This fixes the following
      lockdep warning:
      
      meson8b-dwmac ff3f0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
      INFO: trying to register non-static key.
      the code is fine but needs lockdep annotation.
      turning off the locking correctness validator.
      CPU: 1 PID: 331 Comm: kworker/1:2H Not tainted 5.9.0-rc3+ #1858
      Hardware name: Hardkernel ODROID-N2 (DT)
      Workqueue: kblockd blk_mq_run_work_fn
      Call trace:
       dump_backtrace+0x0/0x1d0
       show_stack+0x14/0x20
       dump_stack+0xe8/0x154
       register_lock_class+0x58c/0x590
       __lock_acquire+0x7c/0x1790
       lock_acquire+0xf4/0x440
       _raw_spin_lock_irqsave+0x80/0xb0
       stmmac_tx_timer+0x4c/0xb0 [stmmac]
       call_timer_fn+0xc4/0x3e8
       run_timer_softirq+0x2b8/0x6c0
       efi_header_end+0x114/0x5f8
       irq_exit+0x104/0x110
       __handle_domain_irq+0x60/0xb8
       gic_handle_irq+0x58/0xb0
       el1_irq+0xbc/0x180
       _raw_spin_unlock_irqrestore+0x48/0x90
       mmc_blk_rw_wait+0x70/0x160
       mmc_blk_mq_issue_rq+0x510/0x830
       mmc_mq_queue_rq+0x13c/0x278
       blk_mq_dispatch_rq_list+0x2a0/0x698
       __blk_mq_do_dispatch_sched+0x254/0x288
       __blk_mq_sched_dispatch_requests+0x190/0x1d8
       blk_mq_sched_dispatch_requests+0x34/0x70
       __blk_mq_run_hw_queue+0xcc/0x148
       blk_mq_run_work_fn+0x20/0x28
       process_one_work+0x2a8/0x718
       worker_thread+0x48/0x460
       kthread+0x134/0x160
       ret_from_fork+0x10/0x1c
      
      Fixes: 0366f7e0 ("net: stmmac: add ethtool support for get/set channels")
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Link: https://lore.kernel.org/r/20201029185011.4749-1-m.szyprowski@samsung.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      2b94f526
    • W
      stmmac: intel: Fix kernel panic on pci probe · 785ff20b
      Wong Vee Khee 提交于
      The commit "stmmac: intel: Adding ref clock 1us tic for LPI cntr"
      introduced a regression which leads to the kernel panic duing loading
      of the dwmac_intel module.
      
      Move the code block after pci resources is obtained.
      
      Fixes: b4c5f83a ("stmmac: intel: Adding ref clock 1us tic for LPI cntr")
      Cc: Voon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: NWong Vee Khee <vee.khee.wong@intel.com>
      Link: https://lore.kernel.org/r/20201029093228.1741-1-vee.khee.wong@intel.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      785ff20b
    • C
      gianfar: Account for Tx PTP timestamp in the skb headroom · d6a076d6
      Claudiu Manoil 提交于
      When PTP timestamping is enabled on Tx, the controller
      inserts the Tx timestamp at the beginning of the frame
      buffer, between SFD and the L2 frame header. This means
      that the skb provided by the stack is required to have
      enough headroom otherwise a new skb needs to be created
      by the driver to accommodate the timestamp inserted by h/w.
      Up until now the driver was relying on the second option,
      using skb_realloc_headroom() to create a new skb to accommodate
      PTP frames. Turns out that this method is not reliable, as
      reallocation of skbs for PTP frames along with the required
      overhead (skb_set_owner_w, consume_skb) is causing random
      crashes in subsequent skb_*() calls, when multiple concurrent
      TCP streams are run at the same time on the same device
      (as seen in James' report).
      Note that these crashes don't occur with a single TCP stream,
      nor with multiple concurrent UDP streams, but only when multiple
      TCP streams are run concurrently with the PTP packet flow
      (doing skb reallocation).
      This patch enforces the first method, by requesting enough
      headroom from the stack to accommodate PTP frames, and so avoiding
      skb_realloc_headroom() & co, and the crashes no longer occur.
      There's no reason not to set needed_headroom to a large enough
      value to accommodate PTP frames, so in this regard this patch
      is a fix.
      Reported-by: NJames Jurack <james.jurack@ametek.com>
      Fixes: bee9e58c ("gianfar:don't add FCB length to hard_header_len")
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20201020173605.1173-1-claudiu.manoil@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d6a076d6
    • C
      gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP · d145c903
      Claudiu Manoil 提交于
      When PTP timestamping is enabled on Tx, the controller
      inserts the Tx timestamp at the beginning of the frame
      buffer, between SFD and the L2 frame header.  This means
      that the skb provided by the stack is required to have
      enough headroom otherwise a new skb needs to be created
      by the driver to accommodate the timestamp inserted by h/w.
      Up until now the driver was relying on skb_realloc_headroom()
      to create new skbs to accommodate PTP frames.  Turns out that
      this method is not reliable in this context at least, as
      skb_realloc_headroom() for PTP frames can cause random crashes,
      mostly in subsequent skb_*() calls, when multiple concurrent
      TCP streams are run at the same time with the PTP flow
      on the same device (as seen in James' report).  I also noticed
      that when the system is loaded by sending multiple TCP streams,
      the driver receives cloned skbs in large numbers.
      skb_cow_head() instead proves to be stable in this scenario,
      and not only handles cloned skbs too but it's also more efficient
      and widely used in other drivers.
      The commit introducing skb_realloc_headroom in the driver
      goes back to 2009, commit 93c1285c
      ("gianfar: reallocate skb when headroom is not enough for fcb").
      For practical purposes I'm referencing a newer commit (from 2012)
      that brings the code to its current structure (and fixes the PTP
      case).
      
      Fixes: 9c4886e5 ("gianfar: Fix invalid TX frames returned on error queue when time stamping")
      Reported-by: NJames Jurack <james.jurack@ametek.com>
      Suggested-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20201029081057.8506-1-claudiu.manoil@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      d145c903
  10. 30 10月, 2020 4 次提交
  11. 28 10月, 2020 4 次提交
  12. 27 10月, 2020 5 次提交
    • Z
      net: hns3: Clear the CMDQ registers before unmapping BAR region · e3364c5f
      Zenghui Yu 提交于
      When unbinding the hns3 driver with the HNS3 VF, I got the following
      kernel panic:
      
      [  265.709989] Unable to handle kernel paging request at virtual address ffff800054627000
      [  265.717928] Mem abort info:
      [  265.720740]   ESR = 0x96000047
      [  265.723810]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  265.729126]   SET = 0, FnV = 0
      [  265.732195]   EA = 0, S1PTW = 0
      [  265.735351] Data abort info:
      [  265.738227]   ISV = 0, ISS = 0x00000047
      [  265.742071]   CM = 0, WnR = 1
      [  265.745055] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000009b54000
      [  265.751753] [ffff800054627000] pgd=0000202ffffff003, p4d=0000202ffffff003, pud=00002020020eb003, pmd=00000020a0dfc003, pte=0000000000000000
      [  265.764314] Internal error: Oops: 96000047 [#1] SMP
      [  265.830357] CPU: 61 PID: 20319 Comm: bash Not tainted 5.9.0+ #206
      [  265.836423] Hardware name: Huawei TaiShan 2280 V2/BC82AMDDA, BIOS 1.05 09/18/2019
      [  265.843873] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
      [  265.843890] pc : hclgevf_cmd_uninit+0xbc/0x300
      [  265.861988] lr : hclgevf_cmd_uninit+0xb0/0x300
      [  265.861992] sp : ffff80004c983b50
      [  265.881411] pmr_save: 000000e0
      [  265.884453] x29: ffff80004c983b50 x28: ffff20280bbce500
      [  265.889744] x27: 0000000000000000 x26: 0000000000000000
      [  265.895034] x25: ffff800011a1f000 x24: ffff800011a1fe90
      [  265.900325] x23: ffff0020ce9b00d8 x22: ffff0020ce9b0150
      [  265.905616] x21: ffff800010d70e90 x20: ffff800010d70e90
      [  265.910906] x19: ffff0020ce9b0080 x18: 0000000000000004
      [  265.916198] x17: 0000000000000000 x16: ffff800011ae32e8
      [  265.916201] x15: 0000000000000028 x14: 0000000000000002
      [  265.916204] x13: ffff800011ae32e8 x12: 0000000000012ad8
      [  265.946619] x11: ffff80004c983b50 x10: 0000000000000000
      [  265.951911] x9 : ffff8000115d0888 x8 : 0000000000000000
      [  265.951914] x7 : ffff800011890b20 x6 : c0000000ffff7fff
      [  265.951917] x5 : ffff80004c983930 x4 : 0000000000000001
      [  265.951919] x3 : ffffa027eec1b000 x2 : 2b78ccbbff369100
      [  265.964487] x1 : 0000000000000000 x0 : ffff800054627000
      [  265.964491] Call trace:
      [  265.964494]  hclgevf_cmd_uninit+0xbc/0x300
      [  265.964496]  hclgevf_uninit_ae_dev+0x9c/0xe8
      [  265.964501]  hnae3_unregister_ae_dev+0xb0/0x130
      [  265.964516]  hns3_remove+0x34/0x88 [hns3]
      [  266.009683]  pci_device_remove+0x48/0xf0
      [  266.009692]  device_release_driver_internal+0x114/0x1e8
      [  266.030058]  device_driver_detach+0x28/0x38
      [  266.034224]  unbind_store+0xd4/0x108
      [  266.037784]  drv_attr_store+0x40/0x58
      [  266.041435]  sysfs_kf_write+0x54/0x80
      [  266.045081]  kernfs_fop_write+0x12c/0x250
      [  266.049076]  vfs_write+0xc4/0x248
      [  266.052378]  ksys_write+0x74/0xf8
      [  266.055677]  __arm64_sys_write+0x24/0x30
      [  266.059584]  el0_svc_common.constprop.3+0x84/0x270
      [  266.064354]  do_el0_svc+0x34/0xa0
      [  266.067658]  el0_svc+0x38/0x40
      [  266.070700]  el0_sync_handler+0x8c/0xb0
      [  266.074519]  el0_sync+0x140/0x180
      
      It looks like the BAR memory region had already been unmapped before we
      start clearing CMDQ registers in it, which is pretty bad and the kernel
      happily kills itself because of a Current EL Data Abort (on arm64).
      
      Moving the CMDQ uninitialization a bit early fixes the issue for me.
      
      Fixes: 862d969a ("net: hns3: do VF's pci re-initialization while PF doing FLR")
      Signed-off-by: NZenghui Yu <yuzenghui@huawei.com>
      Link: https://lore.kernel.org/r/20201023051550.793-1-yuzenghui@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      e3364c5f
    • V
      bnxt_en: Send HWRM_FUNC_RESET fw command unconditionally. · 825741b0
      Vasundhara Volam 提交于
      In the AER or firmware reset flow, if we are in fatal error state or
      if pci_channel_offline() is true, we don't send any commands to the
      firmware because the commands will likely not reach the firmware and
      most commands don't matter much because the firmware is likely to be
      reset imminently.
      
      However, the HWRM_FUNC_RESET command is different and we should always
      attempt to send it.  In the AER flow for example, the .slot_reset()
      call will trigger this fw command and we need to try to send it to
      effect the proper reset.
      
      Fixes: b340dc68 ("bnxt_en: Avoid sending firmware messages when AER error is detected.")
      Reviewed-by: NEdwin Peer <edwin.peer@broadcom.com>
      Signed-off-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      825741b0
    • M
      bnxt_en: Check abort error state in bnxt_open_nic(). · a1301f08
      Michael Chan 提交于
      bnxt_open_nic() is called during configuration changes that require
      the NIC to be closed and then opened.  This call is protected by
      rtnl_lock.  Firmware reset can be happening at the same time.  Only
      critical portions of the entire firmware reset sequence are protected
      by the rtnl_lock.  It is possible that bnxt_open_nic() can be called
      when the firmware reset sequence is aborting.  In that case,
      bnxt_open_nic() needs to check if the ABORT_ERR flag is set and
      abort if it is.  The configuration change that resulted in the
      bnxt_open_nic() call will fail but the NIC will be brought to a
      consistent IF_DOWN state.
      
      Without this patch, if bnxt_open_nic() were to continue in this error
      state, it may crash like this:
      
      [ 1648.659736] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [ 1648.659768] IP: [<ffffffffc01e9b3a>] bnxt_alloc_mem+0x50a/0x1140 [bnxt_en]
      [ 1648.659796] PGD 101e1b3067 PUD 101e1b2067 PMD 0
      [ 1648.659813] Oops: 0000 [#1] SMP
      [ 1648.659825] Modules linked in: xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter sunrpc dell_smbios dell_wmi_descriptor dcdbas amd64_edac_mod edac_mce_amd kvm_amd kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper vfat cryptd fat pcspkr ipmi_ssif sg k10temp i2c_piix4 wmi ipmi_si ipmi_devintf ipmi_msghandler tpm_crb acpi_power_meter sch_fq_codel ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm ahci drm libahci megaraid_sas crct10dif_pclmul crct10dif_common
      [ 1648.660063]  tg3 libata crc32c_intel bnxt_en(OE) drm_panel_orientation_quirks devlink ptp pps_core dm_mirror dm_region_hash dm_log dm_mod fuse
      [ 1648.660105] CPU: 13 PID: 3867 Comm: ethtool Kdump: loaded Tainted: G           OE  ------------   3.10.0-1152.el7.x86_64 #1
      [ 1648.660911] Hardware name: Dell Inc. PowerEdge R7515/0R4CNN, BIOS 1.2.14 01/28/2020
      [ 1648.661662] task: ffff94e64cbc9080 ti: ffff94f55df1c000 task.ti: ffff94f55df1c000
      [ 1648.662409] RIP: 0010:[<ffffffffc01e9b3a>]  [<ffffffffc01e9b3a>] bnxt_alloc_mem+0x50a/0x1140 [bnxt_en]
      [ 1648.663171] RSP: 0018:ffff94f55df1fba8  EFLAGS: 00010202
      [ 1648.663927] RAX: 0000000000000000 RBX: ffff94e6827e0000 RCX: 0000000000000000
      [ 1648.664684] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff94e6827e08c0
      [ 1648.665433] RBP: ffff94f55df1fc20 R08: 00000000000001ff R09: 0000000000000008
      [ 1648.666184] R10: 0000000000000d53 R11: ffff94f55df1f7ce R12: ffff94e6827e08c0
      [ 1648.666940] R13: ffff94e6827e08c0 R14: ffff94e6827e08c0 R15: ffffffffb9115e40
      [ 1648.667695] FS:  00007f8aadba5740(0000) GS:ffff94f57eb40000(0000) knlGS:0000000000000000
      [ 1648.668447] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1648.669202] CR2: 0000000000000000 CR3: 0000001022772000 CR4: 0000000000340fe0
      [ 1648.669966] Call Trace:
      [ 1648.670730]  [<ffffffffc01f1d5d>] ? bnxt_need_reserve_rings+0x9d/0x170 [bnxt_en]
      [ 1648.671496]  [<ffffffffc01fa7ea>] __bnxt_open_nic+0x8a/0x9a0 [bnxt_en]
      [ 1648.672263]  [<ffffffffc01f7479>] ? bnxt_close_nic+0x59/0x1b0 [bnxt_en]
      [ 1648.673031]  [<ffffffffc01fb11b>] bnxt_open_nic+0x1b/0x50 [bnxt_en]
      [ 1648.673793]  [<ffffffffc020037c>] bnxt_set_ringparam+0x6c/0xa0 [bnxt_en]
      [ 1648.674550]  [<ffffffffb8a5f564>] dev_ethtool+0x1334/0x21a0
      [ 1648.675306]  [<ffffffffb8a719ff>] dev_ioctl+0x1ef/0x5f0
      [ 1648.676061]  [<ffffffffb8a324bd>] sock_do_ioctl+0x4d/0x60
      [ 1648.676810]  [<ffffffffb8a326bb>] sock_ioctl+0x1eb/0x2d0
      [ 1648.677548]  [<ffffffffb8663230>] do_vfs_ioctl+0x3a0/0x5b0
      [ 1648.678282]  [<ffffffffb8b8e678>] ? __do_page_fault+0x238/0x500
      [ 1648.679016]  [<ffffffffb86634e1>] SyS_ioctl+0xa1/0xc0
      [ 1648.679745]  [<ffffffffb8b93f92>] system_call_fastpath+0x25/0x2a
      [ 1648.680461] Code: 9e 60 01 00 00 0f 1f 40 00 45 8b 8e 48 01 00 00 31 c9 45 85 c9 0f 8e 73 01 00 00 66 0f 1f 44 00 00 49 8b 86 a8 00 00 00 48 63 d1 <48> 8b 14 d0 48 85 d2 0f 84 46 01 00 00 41 8b 86 44 01 00 00 c7
      [ 1648.681986] RIP  [<ffffffffc01e9b3a>] bnxt_alloc_mem+0x50a/0x1140 [bnxt_en]
      [ 1648.682724]  RSP <ffff94f55df1fba8>
      [ 1648.683451] CR2: 0000000000000000
      
      Fixes: ec5d31e3 ("bnxt_en: Handle firmware reset status during IF_UP.")
      Reviewed-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Reviewed-by: NPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      a1301f08
    • V
      bnxt_en: Re-write PCI BARs after PCI fatal error. · f75d9a0a
      Vasundhara Volam 提交于
      When a PCIe fatal error occurs, the internal latched BAR addresses
      in the chip get reset even though the BAR register values in config
      space are retained.
      
      pci_restore_state() will not rewrite the BAR addresses if the
      BAR address values are valid, causing the chip's internal BAR addresses
      to stay invalid.  So we need to zero the BAR registers during PCIe fatal
      error to force pci_restore_state() to restore the BAR addresses.  These
      write cycles to the BAR registers will cause the proper BAR addresses to
      latch internally.
      
      Fixes: 6316ea6d ("bnxt_en: Enable AER support.")
      Signed-off-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f75d9a0a
    • V
      bnxt_en: Invoke cancel_delayed_work_sync() for PFs also. · 631ce27a
      Vasundhara Volam 提交于
      As part of the commit b148bb23
      ("bnxt_en: Fix possible crash in bnxt_fw_reset_task()."),
      cancel_delayed_work_sync() is called only for VFs to fix a possible
      crash by cancelling any pending delayed work items. It was assumed
      by mistake that the flush_workqueue() call on the PF would flush
      delayed work items as well.
      
      As flush_workqueue() does not cancel the delayed workqueue, extend
      the fix for PFs. This fix will avoid the system crash, if there are
      any pending delayed work items in fw_reset_task() during driver's
      .remove() call.
      
      Unify the workqueue cleanup logic for both PF and VF by calling
      cancel_work_sync() and cancel_delayed_work_sync() directly in
      bnxt_remove_one().
      
      Fixes: b148bb23 ("bnxt_en: Fix possible crash in bnxt_fw_reset_task().")
      Reviewed-by: NPavan Chebbi <pavan.chebbi@broadcom.com>
      Reviewed-by: NAndy Gospodarek <gospo@broadcom.com>
      Signed-off-by: NVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      631ce27a