1. 22 5月, 2021 8 次提交
  2. 21 5月, 2021 7 次提交
    • D
      Merge branch 'stmmac-fixes' · 5cb4a593
      David S. Miller 提交于
      Joakim Zhang says:
      
      ====================
      net: fixes for stmmac
      
      Two clock fixes for stmmac driver.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5cb4a593
    • J
      net: stmmac: fix system hang if change mac address after interface ifdown · 4691ffb1
      Joakim Zhang 提交于
      Fix system hang with below sequences:
      ~# ifconfig ethx down
      ~# ifconfig ethx hw ether xx:xx:xx:xx:xx:xx
      
      After ethx down, stmmac all clocks gated off and then register access causes
      system hang.
      
      Fixes: 5ec55823 ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4691ffb1
    • J
      net: stmmac: correct clocks enabled in stmmac_vlan_rx_kill_vid() · b3dcb312
      Joakim Zhang 提交于
      This should be a mistake to fix conflicts when removing RFC tag to
      repost the patch.
      
      Fixes: 5ec55823 ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b3dcb312
    • Z
      net/qla3xxx: fix schedule while atomic in ql_sem_spinlock · 13a6f315
      Zheyu Ma 提交于
      When calling the 'ql_sem_spinlock', the driver has already acquired the
      spin lock, so the driver should not call 'ssleep' in atomic context.
      
      This bug can be fixed by using 'mdelay' instead of 'ssleep'.
      
      The KASAN's log reveals it:
      
      [    3.238124 ] BUG: scheduling while atomic: swapper/0/1/0x00000002
      [    3.238748 ] 2 locks held by swapper/0/1:
      [    3.239151 ]  #0: ffff88810177b240 (&dev->mutex){....}-{3:3}, at:
      __device_driver_lock+0x41/0x60
      [    3.240026 ]  #1: ffff888107c60e28 (&qdev->hw_lock){....}-{2:2}, at:
      ql3xxx_probe+0x2aa/0xea0
      [    3.240873 ] Modules linked in:
      [    3.241187 ] irq event stamp: 460854
      [    3.241541 ] hardirqs last  enabled at (460853): [<ffffffff843051bf>]
      _raw_spin_unlock_irqrestore+0x4f/0x70
      [    3.242245 ] hardirqs last disabled at (460854): [<ffffffff843058ca>]
      _raw_spin_lock_irqsave+0x2a/0x70
      [    3.242245 ] softirqs last  enabled at (446076): [<ffffffff846002e4>]
      __do_softirq+0x2e4/0x4b1
      [    3.242245 ] softirqs last disabled at (446069): [<ffffffff811ba5e0>]
      irq_exit_rcu+0x100/0x110
      [    3.242245 ] Preemption disabled at:
      [    3.242245 ] [<ffffffff828ca5ba>] ql3xxx_probe+0x2aa/0xea0
      [    3.242245 ] Kernel panic - not syncing: scheduling while atomic
      [    3.242245 ] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
      5.13.0-rc1-00145
      -gee7dc339169-dirty #16
      [    3.242245 ] Call Trace:
      [    3.242245 ]  dump_stack+0xba/0xf5
      [    3.242245 ]  ? ql3xxx_probe+0x1f0/0xea0
      [    3.242245 ]  panic+0x15a/0x3f2
      [    3.242245 ]  ? vprintk+0x76/0x150
      [    3.242245 ]  ? ql3xxx_probe+0x2aa/0xea0
      [    3.242245 ]  __schedule_bug+0xae/0xe0
      [    3.242245 ]  __schedule+0x72e/0xa00
      [    3.242245 ]  schedule+0x43/0xf0
      [    3.242245 ]  schedule_timeout+0x28b/0x500
      [    3.242245 ]  ? del_timer_sync+0xf0/0xf0
      [    3.242245 ]  ? msleep+0x2f/0x70
      [    3.242245 ]  msleep+0x59/0x70
      [    3.242245 ]  ql3xxx_probe+0x307/0xea0
      [    3.242245 ]  ? _raw_spin_unlock_irqrestore+0x3a/0x70
      [    3.242245 ]  ? pci_device_remove+0x110/0x110
      [    3.242245 ]  local_pci_probe+0x45/0xa0
      [    3.242245 ]  pci_device_probe+0x12b/0x1d0
      [    3.242245 ]  really_probe+0x2a9/0x610
      [    3.242245 ]  driver_probe_device+0x90/0x1d0
      [    3.242245 ]  ? mutex_lock_nested+0x1b/0x20
      [    3.242245 ]  device_driver_attach+0x68/0x70
      [    3.242245 ]  __driver_attach+0x124/0x1b0
      [    3.242245 ]  ? device_driver_attach+0x70/0x70
      [    3.242245 ]  bus_for_each_dev+0xbb/0x110
      [    3.242245 ]  ? rdinit_setup+0x45/0x45
      [    3.242245 ]  driver_attach+0x27/0x30
      [    3.242245 ]  bus_add_driver+0x1eb/0x2a0
      [    3.242245 ]  driver_register+0xa9/0x180
      [    3.242245 ]  __pci_register_driver+0x82/0x90
      [    3.242245 ]  ? yellowfin_init+0x25/0x25
      [    3.242245 ]  ql3xxx_driver_init+0x23/0x25
      [    3.242245 ]  do_one_initcall+0x7f/0x3d0
      [    3.242245 ]  ? rdinit_setup+0x45/0x45
      [    3.242245 ]  ? rcu_read_lock_sched_held+0x4f/0x80
      [    3.242245 ]  kernel_init_freeable+0x2aa/0x301
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  kernel_init+0x18/0x190
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  ? rest_init+0x2c0/0x2c0
      [    3.242245 ]  ret_from_fork+0x1f/0x30
      [    3.242245 ] Dumping ftrace buffer:
      [    3.242245 ]    (ftrace buffer empty)
      [    3.242245 ] Kernel Offset: disabled
      [    3.242245 ] Rebooting in 1 seconds.
      Reported-by: NZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: NZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13a6f315
    • A
      net: encx24j600: fix kernel-doc syntax in file headers · 503c599a
      Aditya Srivastava 提交于
      The opening comment mark '/**' is used for highlighting the beginning of
      kernel-doc comments.
      The header for drivers/net/ethernet/microchip/encx24j600 files follows
      this syntax, but the content inside does not comply with kernel-doc.
      
      This line was probably not meant for kernel-doc parsing, but is parsed
      due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
      causes unexpected warning from kernel-doc.
      For e.g., running scripts/kernel-doc -none
      drivers/net/ethernet/microchip/encx24j600_hw.h emits:
      warning: expecting prototype for h(). Prototype was for _ENCX24J600_HW_H() instead
      
      Provide a simple fix by replacing such occurrences with general comment
      format, i.e. '/*', to prevent kernel-doc from parsing it.
      Signed-off-by: NAditya Srivastava <yashsri421@gmail.com>
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      503c599a
    • J
      ixgbe: fix large MTU request from VF · 63e39d29
      Jesse Brandeburg 提交于
      Check that the MTU value requested by the VF is in the supported
      range of MTUs before attempting to set the VF large packet enable,
      otherwise reject the request. This also avoids unnecessary
      register updates in the case of the 82599 controller.
      
      Fixes: 872844dd ("ixgbe: Enable jumbo frames support w/ SR-IOV")
      Co-developed-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Co-developed-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Signed-off-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63e39d29
    • D
      selftests: Add .gitignore for nci test suite · 8570e75a
      David Matlack 提交于
      Building the nci test suite produces a binary, nci_dev, that git then
      tries to track. Add a .gitignore file to tell git to ignore this binary.
      Signed-off-by: NDavid Matlack <dmatlack@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8570e75a
  3. 20 5月, 2021 5 次提交
  4. 19 5月, 2021 20 次提交
    • J
      mlx5e: add add missing BH locking around napi_schdule() · e63052a5
      Jakub Kicinski 提交于
      It's not correct to call napi_schedule() in pure process
      context. Because we use __raise_softirq_irqoff() we require
      callers to be in a context which will eventually lead to
      softirq handling (hardirq, bh disabled, etc.).
      
      With code as is users will see:
      
       NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
      
      Fixes: a8dd7ac1 ("net/mlx5e: Generalize RQ activation")
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      e63052a5
    • A
      net/mlx5: Set term table as an unmanaged flow table · 6ff51ab8
      Ariel Levkovich 提交于
      Termination tables are restricted to have the default miss action and
      cannot be set to forward to another table in case of a miss.
      If the fs prio of the termination table is not the last one in the
      list, fs_core will attempt to attach it to another table.
      
      Set the unmanaged ft flag when creating the termination table ft
      and select the tc offload prio for it to prevent fs_core from selecting
      the forwarding to next ft miss action and use the default one.
      
      In addition, set the flow that forwards to the termination table to
      ignore ft level restrictions since the ft level is not set by fs_core
      for unamanged fts.
      
      Fixes: 249ccc3c ("net/mlx5e: Add support for offloading traffic from uplink to uplink")
      Signed-off-by: NAriel Levkovich <lariel@nvidia.com>
      6ff51ab8
    • L
      net/mlx5: Don't overwrite HCA capabilities when setting MSI-X count · 75e8564e
      Leon Romanovsky 提交于
      During driver probe of device that has dynamic MSI-X feature enabled,
      the following error is printed in some FW flavour (not released yet).
      
       mlx5_core 0000:06:00.0: firmware version: 4.7.4387
       mlx5_core 0000:06:00.0: 126.016 Gb/s available PCIe bandwidth (8.0 GT/s PCIe x16 link)
       mlx5_core 0000:06:00.0: mlx5_cmd_check:777:(pid 70599): SET_HCA_CAP(0x109) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x0)
       mlx5_core 0000:06:00.0: set_hca_cap:622:(pid 70599): handle_hca_cap failed
       mlx5_core 0000:06:00.0: mlx5_function_setup:1045:(pid 70599): set_hca_cap failed
       mlx5_core 0000:06:00.0: probe_one:1465:(pid 70599): mlx5_init_one failed with error code -22
       mlx5_core: probe of 0000:06:00.0 failed with error -22
      
      In order to make the setting capability of MSI-X future proof, let's
      query the current capabilities first.
      
      Fixes: 604774ad ("net/mlx5: Dynamically assign MSI-X vectors count")
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      75e8564e
    • E
      {net,vdpa}/mlx5: Configure interface MAC into mpfs L2 table · 7c9f131f
      Eli Cohen 提交于
      net/mlx5: Expose MPFS configuration API
      
      MPFS is the multi physical function switch that bridges traffic between
      the physical port and any physical functions associated with it. The
      driver is required to add or remove MAC entries to properly forward
      incoming traffic to the correct physical function.
      
      We export the API to control MPFS so that other drivers, such as
      mlx5_vdpa are able to add MAC addresses of their network interfaces.
      
      The MAC address of the vdpa interface must be configured into the MPFS L2
      address. Failing to do so could cause, in some NIC configurations, failure
      to forward packets to the vdpa network device instance.
      
      Fix this by adding calls to update the MPFS table.
      
      CC: <mst@redhat.com>
      CC: <jasowang@redhat.com>
      CC: <virtualization@lists.linux-foundation.org>
      Fixes: 1a86b377 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
      Signed-off-by: NEli Cohen <elic@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      7c9f131f
    • A
      net/mlx5e: Fix error path of updating netdev queues · 5e7923ac
      Aya Levin 提交于
      Avoid division by zero in the error flow. In the driver TC number can be
      either 1 or 8. When TC count is set to 1, driver zero netdev->num_tc.
      Hence, need to convert it back from 0 to 1 in the error flow.
      
      Fixes: fa374877 ("net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues")
      Signed-off-by: NAya Levin <ayal@nvidia.com>
      Reviewed-by: NMaxim Mikityanskiy <maximmi@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      5e7923ac
    • V
      net/mlx5e: Reject mirroring on source port change encap rules · 7d1a3d08
      Vlad Buslov 提交于
      Rules with MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE dest flag are
      translated to destination FT in eswitch. Currently it is not possible to
      mirror such rules because firmware doesn't support mixing FT and Vport
      destinations in single rule when one of them adds encapsulation. Since the
      only use case for MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE destination is
      support for tunnel endpoints on VF and trying to offload such rule with
      mirror action causes either crash in fs_core or firmware error with
      syndrome 0xff6a1d, reject all such rules in mlx5 TC layer.
      
      Fixes: 10742efc ("net/mlx5e: VF tunnel TX traffic offloading")
      Signed-off-by: NVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: NRoi Dayan <roid@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      7d1a3d08
    • D
      net/mlx5e: Fix multipath lag activation · 97817fcc
      Dima Chumak 提交于
      When handling FIB_EVENT_ENTRY_REPLACE event for a new multipath route,
      lag activation can be missed if a stale (struct lag_mp)->mfi pointer
      exists, which was associated with an older multipath route that had been
      removed.
      
      Normally, when a route is removed, it triggers mlx5_lag_fib_event(),
      which handles FIB_EVENT_ENTRY_DEL and clears mfi pointer. But, if
      mlx5_lag_check_prereq() condition isn't met, for example when eswitch is
      in legacy mode, the fib event is skipped and mfi pointer becomes stale.
      
      Fix by resetting mfi pointer to NULL every time mlx5_lag_mp_init() is
      called.
      
      Fixes: 544fe7c2 ("net/mlx5e: Activate HW multipath and handle port affinity based on FIB events")
      Signed-off-by: NDima Chumak <dchumak@nvidia.com>
      Reviewed-by: NRoi Dayan <roid@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      97817fcc
    • S
      net/mlx5e: reset XPS on error flow if netdev isn't registered yet · 77ecd10d
      Saeed Mahameed 提交于
      mlx5e_attach_netdev can be called prior to registering the netdevice:
      Example stack:
      
      ipoib_new_child_link ->
      ipoib_intf_init->
      rdma_init_netdev->
      mlx5_rdma_setup_rn->
      
      mlx5e_attach_netdev->
      mlx5e_num_channels_changed ->
      mlx5e_set_default_xps_cpumasks ->
      netif_set_xps_queue ->
      __netif_set_xps_queue -> kmalloc
      
      If any later stage fails at any point after mlx5e_num_channels_changed()
      returns, XPS allocated maps will never be freed as they
      are only freed during netdev unregistration, which will never happen for
      yet to be registered netdevs.
      
      Fixes: 3909a12e ("net/mlx5e: Fix configuration of XPS cpumasks and netdev queues in corner cases")
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: NAya Levin <ayal@nvidia.com>
      Reviewed-by: NTariq Toukan <tariqt@nvidia.com>
      77ecd10d
    • R
      net/mlx5e: Make sure fib dev exists in fib event · eb96cc15
      Roi Dayan 提交于
      For unreachable route entry the fib dev does not exists.
      
      Fixes: 8914add2 ("net/mlx5e: Handle FIB events to update tunnel endpoint device")
      Reported-by: NDennis Afanasev <dennis.afanasev@stateless.net>
      Signed-off-by: NRoi Dayan <roid@nvidia.com>
      Reviewed-by: NMaor Dickman <maord@nvidia.com>
      Reviewed-by: NVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      eb96cc15
    • R
      net/mlx5e: Fix null deref accessing lag dev · 83026d83
      Roi Dayan 提交于
      It could be the lag dev is null so stop processing the event.
      In bond_enslave() the active/backup slave being set before setting the
      upper dev so first event is without an upper dev.
      After setting the upper dev with bond_master_upper_dev_link() there is
      a second event and in that event we have an upper dev.
      
      Fixes: 7e51891a ("net/mlx5e: Use netdev events to set/del egress acl forward-to-vport rule")
      Signed-off-by: NRoi Dayan <roid@nvidia.com>
      Reviewed-by: NMaor Dickman <maord@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      83026d83
    • D
      net/mlx5e: Fix nullptr in mlx5e_tc_add_fdb_flow() · fe7738eb
      Dima Chumak 提交于
      The result of __dev_get_by_index() is not checked for NULL, which then
      passed to mlx5e_attach_encap() and gets dereferenced.
      
      Also, in case of a successful lookup, the net_device reference count is
      not incremented, which may result in net_device pointer becoming invalid
      at any time during mlx5e_attach_encap() execution.
      
      Fix by using dev_get_by_index(), which does proper reference counting on
      the net_device pointer. Also, handle nullptr return value when mirred
      device is not found.
      
      It's safe to call dev_put() on the mirred net_device pointer, right
      after mlx5e_attach_encap() call, because it's not being saved/copied
      down the call chain.
      
      Fixes: 3c37745e ("net/mlx5e: Properly deal with encap flows add/del under neigh update")
      Addresses-Coverity: ("Dereference null return value")
      Signed-off-by: NDima Chumak <dchumak@nvidia.com>
      Reviewed-by: NVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      fe7738eb
    • P
      net/mlx5: SF, Fix show state inactive when its inactivated · 82041634
      Parav Pandit 提交于
      When a SF is inactivated and when it is in a TEARDOWN_REQUEST
      state, driver still returns its state as active. This is incorrect.
      Fix it by treating TEARDOWN_REQEUST as inactive state. When a SF
      is still attached to the driver, on user request to reactivate EINVAL
      error is returned. Inform user about it with better code EBUSY and
      informative error message.
      
      Fixes: 6a327321 ("net/mlx5: SF, Port function state change support")
      Signed-off-by: NParav Pandit <parav@nvidia.com>
      Reviewed-by: NVu Pham <vuhuong@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      82041634
    • R
      net/mlx5: Fix err prints and return when creating termination table · fca08661
      Roi Dayan 提交于
      Fix print to print correct error code and not using IS_ERR() which
      will just result in always printing 1.
      Also return real err instead of always -EOPNOTSUPP.
      
      Fixes: 10caabda ("net/mlx5e: Use termination table for VLAN push actions")
      Signed-off-by: NRoi Dayan <roid@nvidia.com>
      Reviewed-by: NMaor Dickman <maord@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      fca08661
    • J
      net/mlx5: Set reformat action when needed for termination rules · 442b3d7b
      Jianbo Liu 提交于
      For remote mirroring, after the tunnel packets are received, they are
      decapsulated and sent to representor, then re-encapsulated and sent
      out over another tunnel. So reformat action is set only when the
      destination is required to do encapsulation.
      
      Fixes: 249ccc3c ("net/mlx5e: Add support for offloading traffic from uplink to uplink")
      Signed-off-by: NJianbo Liu <jianbol@nvidia.com>
      Reviewed-by: NAriel Levkovich <lariel@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      442b3d7b
    • D
      net/mlx5e: Fix nullptr in add_vlan_push_action() · dca59f4a
      Dima Chumak 提交于
      The result of dev_get_by_index_rcu() is not checked for NULL and then
      gets dereferenced immediately.
      
      Also, the RCU lock must be held by the caller of dev_get_by_index_rcu(),
      which isn't satisfied by the call stack.
      
      Fix by handling nullptr return value when iflink device is not found.
      Add RCU locking around dev_get_by_index_rcu() to avoid possible adverse
      effects while iterating over the net_device's hlist.
      
      It is safe not to increment reference count of the net_device pointer in
      case of a successful lookup, because it's already handled by VLAN code
      during VLAN device registration (see register_vlan_dev and
      netdev_upper_dev_link).
      
      Fixes: 278748a9 ("net/mlx5e: Offload TC e-switch rules with egress VLAN device")
      Addresses-Coverity: ("Dereference null return value")
      Signed-off-by: NDima Chumak <dchumak@nvidia.com>
      Reviewed-by: NVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      dca59f4a
    • M
      {net, RDMA}/mlx5: Fix override of log_max_qp by other device · 3410fbcd
      Maor Gottlieb 提交于
      mlx5_core_dev holds pointer to static profile, hence when the
      log_max_qp of the profile is override by some device, then it
      effect all other mlx5 devices that share the same profile.
      Fix it by having a profile instance for every mlx5 device.
      
      Fixes: 883371c4 ("net/mlx5: Check FW limitations on log_max_qp before setting it")
      Signed-off-by: NMaor Gottlieb <maorg@nvidia.com>
      Reviewed-by: NMark Bloch <mbloch@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      3410fbcd
    • D
      Merge branch 'hns3-fixes' · c9fd37a9
      David S. Miller 提交于
      Huazhong Tan says:
      
      ====================
      net: hns3: fixes for -net
      
      This series includes some bugfixes for the HNS3 ethernet driver.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c9fd37a9
    • Y
      net: hns3: check the return of skb_checksum_help() · 9bb5a495
      Yunsheng Lin 提交于
      Currently skb_checksum_help()'s return is ignored, but it may
      return error when it fails to allocate memory when linearizing.
      
      So adds checking for the return of skb_checksum_help().
      
      Fixes: 76ad4f0e("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
      Fixes: 3db084d2("net: hns3: Fix for vxlan tx checksum bug")
      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>
      9bb5a495
    • H
      net: hns3: fix user's coalesce configuration lost issue · 73a13d8d
      Huazhong Tan 提交于
      Currently, when adaptive is on, the user's coalesce configuration
      may be overwritten by the dynamic one. The reason is that user's
      configurations are saved in struct hns3_enet_tqp_vector whose
      value maybe changed by the dynamic algorithm. To fix it, use
      struct hns3_nic_priv instead of struct hns3_enet_tqp_vector to
      save and get the user's configuration.
      
      BTW, operations of storing and restoring coalesce info in the reset
      process are unnecessary now, so remove them as well.
      
      Fixes: 434776a5 ("net: hns3: add ethtool_ops.set_coalesce support to PF")
      Fixes: 7e96adc4 ("net: hns3: add ethtool_ops.get_coalesce support to PF")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      73a13d8d
    • J
      net: hns3: put off calling register_netdev() until client initialize complete · a289a7e5
      Jian Shen 提交于
      Currently, the netdevice is registered before client initializing
      complete. So there is a timewindow between netdevice available
      and usable. In this case, if user try to change the channel number
      or ring param, it may cause the hns3_set_rx_cpu_rmap() being called
      twice, and report bug.
      
      [47199.416502] hns3 0000:35:00.0 eth1: set channels: tqp_num=1, rxfh=0
      [47199.430340] hns3 0000:35:00.0 eth1: already uninitialized
      [47199.438554] hns3 0000:35:00.0: rss changes from 4 to 1
      [47199.511854] hns3 0000:35:00.0: Channels changed, rss_size from 4 to 1, tqps from 4 to 1
      [47200.163524] ------------[ cut here ]------------
      [47200.171674] kernel BUG at lib/cpu_rmap.c:142!
      [47200.177847] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      [47200.185259] Modules linked in: hclge(+) hns3(-) hns3_cae(O) hns_roce_hw_v2 hnae3 vfio_iommu_type1 vfio_pci vfio_virqfd vfio pv680_mii(O) [last unloaded: hclge]
      [47200.205912] CPU: 1 PID: 8260 Comm: ethtool Tainted: G           O      5.11.0-rc3+ #1
      [47200.215601] Hardware name:  , xxxxxx 02/04/2021
      [47200.223052] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
      [47200.230188] pc : cpu_rmap_add+0x38/0x40
      [47200.237472] lr : irq_cpu_rmap_add+0x84/0x140
      [47200.243291] sp : ffff800010e93a30
      [47200.247295] x29: ffff800010e93a30 x28: ffff082100584880
      [47200.254155] x27: 0000000000000000 x26: 0000000000000000
      [47200.260712] x25: 0000000000000000 x24: 0000000000000004
      [47200.267241] x23: ffff08209ba03000 x22: ffff08209ba038c0
      [47200.273789] x21: 000000000000003f x20: ffff0820e2bc1680
      [47200.280400] x19: ffff0820c970ec80 x18: 00000000000000c0
      [47200.286944] x17: 0000000000000000 x16: ffffb43debe4a0d0
      [47200.293456] x15: fffffc2082990600 x14: dead000000000122
      [47200.300059] x13: ffffffffffffffff x12: 000000000000003e
      [47200.306606] x11: ffff0820815b8080 x10: ffff53e411988000
      [47200.313171] x9 : 0000000000000000 x8 : ffff0820e2bc1700
      [47200.319682] x7 : 0000000000000000 x6 : 000000000000003f
      [47200.326170] x5 : 0000000000000040 x4 : ffff800010e93a20
      [47200.332656] x3 : 0000000000000004 x2 : ffff0820c970ec80
      [47200.339168] x1 : ffff0820e2bc1680 x0 : 0000000000000004
      [47200.346058] Call trace:
      [47200.349324]  cpu_rmap_add+0x38/0x40
      [47200.354300]  hns3_set_rx_cpu_rmap+0x6c/0xe0 [hns3]
      [47200.362294]  hns3_reset_notify_init_enet+0x1cc/0x340 [hns3]
      [47200.370049]  hns3_change_channels+0x40/0xb0 [hns3]
      [47200.376770]  hns3_set_channels+0x12c/0x2a0 [hns3]
      [47200.383353]  ethtool_set_channels+0x140/0x250
      [47200.389772]  dev_ethtool+0x714/0x23d0
      [47200.394440]  dev_ioctl+0x4cc/0x640
      [47200.399277]  sock_do_ioctl+0x100/0x2a0
      [47200.404574]  sock_ioctl+0x28c/0x470
      [47200.409079]  __arm64_sys_ioctl+0xb4/0x100
      [47200.415217]  el0_svc_common.constprop.0+0x84/0x210
      [47200.422088]  do_el0_svc+0x28/0x34
      [47200.426387]  el0_svc+0x28/0x70
      [47200.431308]  el0_sync_handler+0x1a4/0x1b0
      [47200.436477]  el0_sync+0x174/0x180
      [47200.441562] Code: 11000405 79000c45 f8247861 d65f03c0 (d4210000)
      [47200.448869] ---[ end trace a01efe4ce42e5f34 ]---
      
      The process is like below:
      excuting hns3_client_init
      |
      register_netdev()
      |                           hns3_set_channels()
      |                           |
      hns3_set_rx_cpu_rmap()      hns3_reset_notify_uninit_enet()
      |                               |
      |                            quit without calling function
      |                            hns3_free_rx_cpu_rmap for flag
      |                            HNS3_NIC_STATE_INITED is unset.
      |                           |
      |                           hns3_reset_notify_init_enet()
      |                               |
      set HNS3_NIC_STATE_INITED    call hns3_set_rx_cpu_rmap()-- crash
      
      Fix it by calling register_netdev() at the end of function
      hns3_client_init().
      
      Fixes: 08a10068 ("net: hns3: re-organize vector handle")
      Signed-off-by: NJian Shen <shenjian15@huawei.com>
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a289a7e5