Skip to content
Snippets Groups Projects
  1. Jan 05, 2022
  2. Jan 04, 2022
  3. Jan 02, 2022
    • Markus Koch's avatar
      net/fsl: Remove leftover definition in xgmac_mdio · 1ef5e1d0
      Markus Koch authored
      
      commit 26eee021 ("net/fsl: fix a bug in xgmac_mdio") fixed a bug in
      the QorIQ mdio driver but left the (now unused) incorrect bit definition
      for MDIO_DATA_BSY in the code. This commit removes it.
      
      Signed-off-by: default avatarMarkus Koch <markus@notsyncing.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ef5e1d0
    • Thomas Toye's avatar
      rndis_host: support Hytera digital radios · 29262e1f
      Thomas Toye authored
      Hytera makes a range of digital (DMR) radios. These radios can be
      programmed to a allow a computer to control them over Ethernet over USB,
      either using NCM or RNDIS.
      
      This commit adds support for RNDIS for Hytera radios. I tested with a
      Hytera PD785 and a Hytera MD785G. When these radios are programmed to
      set up a Radio to PC Network using RNDIS, an USB interface will be added
      with class 2 (Communications), subclass 2 (Abstract Modem Control) and
      an interface protocol of 255 ("vendor specific" - lsusb even hints "MSFT
      RNDIS?").
      
      This patch is similar to the solution of this StackOverflow user, but
      that only works for the Hytera MD785:
      https://stackoverflow.com/a/53550858
      
      
      
      To use the "Radio to PC Network" functionality of Hytera DMR radios, the
      radios need to be programmed correctly in CPS (Hytera's Customer
      Programming Software). "Forward to PC" should be checked in "Network"
      (under "General Setting" in "Conventional") and the "USB Network
      Communication Protocol" should be set to RNDIS.
      
      Signed-off-by: default avatarThomas Toye <thomas@toye.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29262e1f
    • Arthur Kiyanovski's avatar
      net: ena: Fix error handling when calculating max IO queues number · 5055dc03
      Arthur Kiyanovski authored
      
      The role of ena_calc_max_io_queue_num() is to return the number
      of queues supported by the device, which means the return value
      should be >=0.
      
      The function that calls ena_calc_max_io_queue_num(), checks
      the return value. If it is 0, it means the device reported
      it supports 0 IO queues. This case is considered an error
      and is handled by the calling function accordingly.
      
      However the current implementation of ena_calc_max_io_queue_num()
      is wrong, since when it detects the device supports 0 IO queues,
      it returns -EFAULT.
      
      In such a case the calling function doesn't detect the error,
      and therefore doesn't handle it.
      
      This commit changes ena_calc_max_io_queue_num() to return 0
      in case the device reported it supports 0 queues, allowing the
      calling function to properly handle the error case.
      
      Fixes: 736ce3f4 ("net: ena: make ethtool -l show correct max number of queues")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5055dc03
    • Arthur Kiyanovski's avatar
      net: ena: Fix wrong rx request id by resetting device · cb3d4f98
      Arthur Kiyanovski authored
      
      A wrong request id received from the device is a sign that
      something is wrong with it, therefore trigger a device reset.
      
      Also add some debug info to the "Page is NULL" print to make
      it easier to debug.
      
      Fixes: 1738cd3e ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cb3d4f98
    • Arthur Kiyanovski's avatar
      net: ena: Fix undefined state when tx request id is out of bounds · c255a34e
      Arthur Kiyanovski authored
      
      ena_com_tx_comp_req_id_get() checks the req_id of a received completion,
      and if it is out of bounds returns -EINVAL. This is a sign that
      something is wrong with the device and it needs to be reset.
      
      The current code does not reset the device in this case, which leaves
      the driver in an undefined state, where this completion is not properly
      handled.
      
      This commit adds a call to handle_invalid_req_id() in ena_clean_tx_irq()
      and ena_clean_xdp_irq() which resets the device to fix the issue.
      
      This commit also removes unnecessary request id checks from
      validate_tx_req_id() and validate_xdp_req_id(). This check is unneeded
      because it was already performed in ena_com_tx_comp_req_id_get(), which
      is called right before these functions.
      
      Fixes: 548c4940 ("net: ena: Implement XDP_TX action")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c255a34e
  4. Dec 30, 2021
  5. Dec 29, 2021
    • Gal Pressman's avatar
      net/mlx5e: Fix wrong features assignment in case of error · 992d8a4e
      Gal Pressman authored
      
      In case of an error in mlx5e_set_features(), 'netdev->features' must be
      updated with the correct state of the device to indicate which features
      were updated successfully.
      To do that we maintain a copy of 'netdev->features' and update it after
      successful feature changes, so we can assign it to back to
      'netdev->features' if needed.
      
      However, since not all netdev features are handled by the driver (e.g.
      GRO/TSO/etc), some features may not be updated correctly in case of an
      error updating another feature.
      
      For example, while requesting to disable TSO (feature which is not
      handled by the driver) and enable HW-GRO, if an error occurs during
      HW-GRO enable, 'oper_features' will be assigned with 'netdev->features'
      and HW-GRO turned off. TSO will remain enabled in such case, which is a
      bug.
      
      To solve that, instead of using 'netdev->features' as the baseline of
      'oper_features' and changing it on set feature success, use 'features'
      instead and update it in case of errors.
      
      Fixes: 75b81ce7 ("net/mlx5e: Don't override netdev features field unless in error flow")
      Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      992d8a4e
    • Roi Dayan's avatar
      net/mlx5e: TC, Fix memory leak with rules with internal port · 077cdda7
      Roi Dayan authored
      
      Fix a memory leak with decap rule with internal port as destination
      device. The driver allocates a modify hdr action but doesn't set
      the flow attr modify hdr action which results in skipping releasing
      the modify hdr action when releasing the flow.
      
      backtrace:
          [<000000005f8c651c>] krealloc+0x83/0xd0
          [<000000009f59b143>] alloc_mod_hdr_actions+0x156/0x310 [mlx5_core]
          [<000000002257f342>] mlx5e_tc_match_to_reg_set_and_get_id+0x12a/0x360 [mlx5_core]
          [<00000000b44ea75a>] mlx5e_tc_add_fdb_flow+0x962/0x1470 [mlx5_core]
          [<0000000003e384a0>] __mlx5e_add_fdb_flow+0x54c/0xb90 [mlx5_core]
          [<00000000ed8b22b6>] mlx5e_configure_flower+0xe45/0x4af0 [mlx5_core]
          [<00000000024f4ab5>] mlx5e_rep_indr_offload.isra.0+0xfe/0x1b0 [mlx5_core]
          [<000000006c3bb494>] mlx5e_rep_indr_setup_tc_cb+0x90/0x130 [mlx5_core]
          [<00000000d3dac2ea>] tc_setup_cb_add+0x1d2/0x420
      
      Fixes: b16eb3c8 ("net/mlx5: Support internal port as decap route device")
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      077cdda7
    • Christophe JAILLET's avatar
      ionic: Initialize the 'lif->dbid_inuse' bitmap · 140c7bc7
      Christophe JAILLET authored
      
      When allocated, this bitmap is not initialized. Only the first bit is set a
      few lines below.
      
      Use bitmap_zalloc() to make sure that it is cleared before being used.
      
      Fixes: 6461b446 ("ionic: Add interrupts and doorbells")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Link: https://lore.kernel.org/r/6a478eae0b5e6c63774e1f0ddb1a3f8c38fa8ade.1640527506.git.christophe.jaillet@wanadoo.fr
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      140c7bc7
  6. Dec 28, 2021
  7. Dec 27, 2021
    • Matthias-Christian Ott's avatar
      net: usb: pegasus: Do not drop long Ethernet frames · ca506fca
      Matthias-Christian Ott authored
      
      The D-Link DSB-650TX (2001:4002) is unable to receive Ethernet frames
      that are longer than 1518 octets, for example, Ethernet frames that
      contain 802.1Q VLAN tags.
      
      The frames are sent to the pegasus driver via USB but the driver
      discards them because they have the Long_pkt field set to 1 in the
      received status report. The function read_bulk_callback of the pegasus
      driver treats such received "packets" (in the terminology of the
      hardware) as errors but the field simply does just indicate that the
      Ethernet frame (MAC destination to FCS) is longer than 1518 octets.
      
      It seems that in the 1990s there was a distinction between
      "giant" (> 1518) and "runt" (< 64) frames and the hardware includes
      flags to indicate this distinction. It seems that the purpose of the
      distinction "giant" frames was to not allow infinitely long frames due
      to transmission errors and to allow hardware to have an upper limit of
      the frame size. However, the hardware already has such limit with its
      2048 octet receive buffer and, therefore, Long_pkt is merely a
      convention and should not be treated as a receive error.
      
      Actually, the hardware is even able to receive Ethernet frames with 2048
      octets which exceeds the claimed limit frame size limit of the driver of
      1536 octets (PEGASUS_MTU).
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarMatthias-Christian Ott <ott@mirix.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca506fca
    • Zekun Shen's avatar
      atlantic: Fix buff_ring OOB in aq_ring_rx_clean · 5f501532
      Zekun Shen authored
      
      The function obtain the next buffer without boundary check.
      We should return with I/O error code.
      
      The bug is found by fuzzing and the crash report is attached.
      It is an OOB bug although reported as use-after-free.
      
      [    4.804724] BUG: KASAN: use-after-free in aq_ring_rx_clean+0x1e88/0x2730 [atlantic]
      [    4.805661] Read of size 4 at addr ffff888034fe93a8 by task ksoftirqd/0/9
      [    4.806505]
      [    4.806703] CPU: 0 PID: 9 Comm: ksoftirqd/0 Tainted: G        W         5.6.0 #34
      [    4.809030] Call Trace:
      [    4.809343]  dump_stack+0x76/0xa0
      [    4.809755]  print_address_description.constprop.0+0x16/0x200
      [    4.810455]  ? aq_ring_rx_clean+0x1e88/0x2730 [atlantic]
      [    4.811234]  ? aq_ring_rx_clean+0x1e88/0x2730 [atlantic]
      [    4.813183]  __kasan_report.cold+0x37/0x7c
      [    4.813715]  ? aq_ring_rx_clean+0x1e88/0x2730 [atlantic]
      [    4.814393]  kasan_report+0xe/0x20
      [    4.814837]  aq_ring_rx_clean+0x1e88/0x2730 [atlantic]
      [    4.815499]  ? hw_atl_b0_hw_ring_rx_receive+0x9a5/0xb90 [atlantic]
      [    4.816290]  aq_vec_poll+0x179/0x5d0 [atlantic]
      [    4.816870]  ? _GLOBAL__sub_I_65535_1_aq_pci_func_init+0x20/0x20 [atlantic]
      [    4.817746]  ? __next_timer_interrupt+0xba/0xf0
      [    4.818322]  net_rx_action+0x363/0xbd0
      [    4.818803]  ? call_timer_fn+0x240/0x240
      [    4.819302]  ? __switch_to_asm+0x40/0x70
      [    4.819809]  ? napi_busy_loop+0x520/0x520
      [    4.820324]  __do_softirq+0x18c/0x634
      [    4.820797]  ? takeover_tasklets+0x5f0/0x5f0
      [    4.821343]  run_ksoftirqd+0x15/0x20
      [    4.821804]  smpboot_thread_fn+0x2f1/0x6b0
      [    4.822331]  ? smpboot_unregister_percpu_thread+0x160/0x160
      [    4.823041]  ? __kthread_parkme+0x80/0x100
      [    4.823571]  ? smpboot_unregister_percpu_thread+0x160/0x160
      [    4.824301]  kthread+0x2b5/0x3b0
      [    4.824723]  ? kthread_create_on_node+0xd0/0xd0
      [    4.825304]  ret_from_fork+0x35/0x40
      
      Signed-off-by: default avatarZekun Shen <bruceshenzk@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f501532
  8. Dec 24, 2021
  9. Dec 23, 2021
    • Nobuhiro Iwamatsu's avatar
      net: stmmac: dwmac-visconti: Fix value of ETHER_CLK_SEL_FREQ_SEL_2P5M · 391e5975
      Nobuhiro Iwamatsu authored
      
      ETHER_CLK_SEL_FREQ_SEL_2P5M is not 0 bit of the register. This is a
      value, which is 0. Fix from BIT(0) to 0.
      
      Reported-by: default avatarYuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
      Fixes: b38dd98f ("net: stmmac: Add Toshiba Visconti SoCs glue driver")
      Signed-off-by: default avatarNobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
      Link: https://lore.kernel.org/r/20211223073633.101306-1-nobuhiro1.iwamatsu@toshiba.co.jp
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      391e5975
    • Hayes Wang's avatar
      r8152: sync ocp base · b24edca3
      Hayes Wang authored
      
      There are some chances that the actual base of hardware is different
      from the value recorded by driver, so we have to reset the variable
      of ocp_base to sync it.
      
      Set ocp_base to -1. Then, it would be updated and the new base would be
      set to the hardware next time.
      
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b24edca3
    • Hayes Wang's avatar
      r8152: fix the force speed doesn't work for RTL8156 · 45bf944e
      Hayes Wang authored
      
      It needs to set mdio force mode. Otherwise, link off always occurs when
      setting force speed.
      
      Fixes: 195aae32 ("r8152: support new chips")
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      45bf944e
    • Xiaoliang Yang's avatar
      net: stmmac: ptp: fix potentially overflowing expression · eccffcf4
      Xiaoliang Yang authored
      
      Convert the u32 variable to type u64 in a context where expression of
      type u64 is required to avoid potential overflow.
      
      Fixes: e9e37200 ("net: stmmac: ptp: update tas basetime after ptp adjust")
      Signed-off-by: default avatarXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Link: https://lore.kernel.org/r/20211223073928.37371-1-xiaoliang.yang_1@nxp.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eccffcf4
    • Paolo Abeni's avatar
      veth: ensure skb entering GRO are not cloned. · 9695b7de
      Paolo Abeni authored
      
      After commit d3256efd ("veth: allow enabling NAPI even without XDP"),
      if GRO is enabled on a veth device and TSO is disabled on the peer
      device, TCP skbs will go through the NAPI callback. If there is no XDP
      program attached, the veth code does not perform any share check, and
      shared/cloned skbs could enter the GRO engine.
      
      Ignat reported a BUG triggered later-on due to the above condition:
      
      [   53.970529][    C1] kernel BUG at net/core/skbuff.c:3574!
      [   53.981755][    C1] invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
      [   53.982634][    C1] CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc5+ #25
      [   53.982634][    C1] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      [   53.982634][    C1] RIP: 0010:skb_shift+0x13ef/0x23b0
      [   53.982634][    C1] Code: ea 03 0f b6 04 02 48 89 fa 83 e2 07 38 d0
      7f 08 84 c0 0f 85 41 0c 00 00 41 80 7f 02 00 4d 8d b5 d0 00 00 00 0f
      85 74 f5 ff ff <0f> 0b 4d 8d 77 20 be 04 00 00 00 4c 89 44 24 78 4c 89
      f7 4c 89 8c
      [   53.982634][    C1] RSP: 0018:ffff8881008f7008 EFLAGS: 00010246
      [   53.982634][    C1] RAX: 0000000000000000 RBX: ffff8881180b4c80 RCX: 0000000000000000
      [   53.982634][    C1] RDX: 0000000000000002 RSI: ffff8881180b4d3c RDI: ffff88810bc9cac2
      [   53.982634][    C1] RBP: ffff8881008f70b8 R08: ffff8881180b4cf4 R09: ffff8881180b4cf0
      [   53.982634][    C1] R10: ffffed1022999e5c R11: 0000000000000002 R12: 0000000000000590
      [   53.982634][    C1] R13: ffff88810f940c80 R14: ffff88810f940d50 R15: ffff88810bc9cac0
      [   53.982634][    C1] FS:  0000000000000000(0000) GS:ffff888235880000(0000) knlGS:0000000000000000
      [   53.982634][    C1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   53.982634][    C1] CR2: 00007ff5f9b86680 CR3: 0000000108ce8004 CR4: 0000000000170ee0
      [   53.982634][    C1] Call Trace:
      [   53.982634][    C1]  <TASK>
      [   53.982634][    C1]  tcp_sacktag_walk+0xaba/0x18e0
      [   53.982634][    C1]  tcp_sacktag_write_queue+0xe7b/0x3460
      [   53.982634][    C1]  tcp_ack+0x2666/0x54b0
      [   53.982634][    C1]  tcp_rcv_established+0x4d9/0x20f0
      [   53.982634][    C1]  tcp_v4_do_rcv+0x551/0x810
      [   53.982634][    C1]  tcp_v4_rcv+0x22ed/0x2ed0
      [   53.982634][    C1]  ip_protocol_deliver_rcu+0x96/0xaf0
      [   53.982634][    C1]  ip_local_deliver_finish+0x1e0/0x2f0
      [   53.982634][    C1]  ip_sublist_rcv_finish+0x211/0x440
      [   53.982634][    C1]  ip_list_rcv_finish.constprop.0+0x424/0x660
      [   53.982634][    C1]  ip_list_rcv+0x2c8/0x410
      [   53.982634][    C1]  __netif_receive_skb_list_core+0x65c/0x910
      [   53.982634][    C1]  netif_receive_skb_list_internal+0x5f9/0xcb0
      [   53.982634][    C1]  napi_complete_done+0x188/0x6e0
      [   53.982634][    C1]  gro_cell_poll+0x10c/0x1d0
      [   53.982634][    C1]  __napi_poll+0xa1/0x530
      [   53.982634][    C1]  net_rx_action+0x567/0x1270
      [   53.982634][    C1]  __do_softirq+0x28a/0x9ba
      [   53.982634][    C1]  run_ksoftirqd+0x32/0x60
      [   53.982634][    C1]  smpboot_thread_fn+0x559/0x8c0
      [   53.982634][    C1]  kthread+0x3b9/0x490
      [   53.982634][    C1]  ret_from_fork+0x22/0x30
      [   53.982634][    C1]  </TASK>
      
      Address the issue by skipping the GRO stage for shared or cloned skbs.
      To reduce the chance of OoO, try to unclone the skbs before giving up.
      
      v1 -> v2:
       - use avoid skb_copy and fallback to netif_receive_skb  - Eric
      
      Reported-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Fixes: d3256efd ("veth: allow enabling NAPI even without XDP")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Tested-by: default avatarIgnat Korchagin <ignat@cloudflare.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/b5f61c5602aab01bac8d711d8d1bfab0a4817db7.1640197544.git.pabeni@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9695b7de
    • Christophe JAILLET's avatar
      net/mlx5: Fix some error handling paths in 'mlx5e_tc_add_fdb_flow()' · 4390c6ed
      Christophe JAILLET authored
      
      All the error handling paths of 'mlx5e_tc_add_fdb_flow()' end to 'err_out'
      where 'flow_flag_set(flow, FAILED);' is called.
      
      All but the new error handling paths added by the commits given in the
      Fixes tag below.
      
      Fix these error handling paths and branch to 'err_out'.
      
      Fixes: 166f431e ("net/mlx5e: Add indirect tc offload of ovs internal port")
      Fixes: b16eb3c8 ("net/mlx5: Support internal port as decap route device")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      (cherry picked from commit 31108d14)
      4390c6ed
    • Chris Mi's avatar
      net/mlx5e: Delete forward rule for ct or sample action · 2820110d
      Chris Mi authored
      
      When there is ct or sample action, the ct or sample rule will be deleted
      and return. But if there is an extra mirror action, the forward rule can't
      be deleted because of the return.
      
      Fix it by removing the return.
      
      Fixes: 69e2916e ("net/mlx5: CT: Add support for mirroring")
      Fixes: f94d6389 ("net/mlx5e: TC, Add support to offload sample action")
      Signed-off-by: default avatarChris Mi <cmi@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      2820110d
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix ICOSQ recovery flow for XSK · 19c4aba2
      Maxim Mikityanskiy authored
      
      There are two ICOSQs per channel: one is needed for RX, and the other
      for async operations (XSK TX, kTLS offload). Currently, the recovery
      flow for both is the same, and async ICOSQ is mistakenly treated like
      the regular ICOSQ.
      
      This patch prevents running the regular ICOSQ recovery on async ICOSQ.
      The purpose of async ICOSQ is to handle XSK wakeup requests and post
      kTLS offload RX parameters, it has nothing to do with RQ and XSKRQ UMRs,
      so the regular recovery sequence is not applicable here.
      
      Fixes: be5323c8 ("net/mlx5e: Report and recover from CQE error on ICOSQ")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarAya Levin <ayal@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      19c4aba2
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix interoperability between XSK and ICOSQ recovery flow · 17958d7c
      Maxim Mikityanskiy authored
      
      Both regular RQ and XSKRQ use the same ICOSQ for UMRs. When doing
      recovery for the ICOSQ, don't forget to deactivate XSKRQ.
      
      XSK can be opened and closed while channels are active, so a new mutex
      prevents the ICOSQ recovery from running at the same time. The ICOSQ
      recovery deactivates and reactivates XSKRQ, so any parallel change in
      XSK state would break consistency. As the regular RQ is running, it's
      not enough to just flush the recovery work, because it can be
      rescheduled.
      
      Fixes: be5323c8 ("net/mlx5e: Report and recover from CQE error on ICOSQ")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      17958d7c
    • Gal Pressman's avatar
      net/mlx5e: Fix skb memory leak when TC classifier action offloads are disabled · a0cb9096
      Gal Pressman authored
      
      When TC classifier action offloads are disabled (CONFIG_MLX5_CLS_ACT in
      Kconfig), the mlx5e_rep_tc_receive() function which is responsible for
      passing the skb to the stack (or freeing it) is defined as a nop, and
      results in leaking the skb memory. Replace the nop with a call to
      napi_gro_receive() to resolve the leak.
      
      Fixes: 28e7606f ("net/mlx5e: Refactor rx handler of represetor device")
      Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
      Reviewed-by: default avatarAriel Levkovich <lariel@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      a0cb9096
    • Amir Tzin's avatar
      net/mlx5e: Wrap the tx reporter dump callback to extract the sq · 918fc385
      Amir Tzin authored
      
      Function mlx5e_tx_reporter_dump_sq() casts its void * argument to struct
      mlx5e_txqsq *, but in TX-timeout-recovery flow the argument is actually
      of type struct mlx5e_tx_timeout_ctx *.
      
       mlx5_core 0000:08:00.1 enp8s0f1: TX timeout detected
       mlx5_core 0000:08:00.1 enp8s0f1: TX timeout on queue: 1, SQ: 0x11ec, CQ: 0x146d, SQ Cons: 0x0 SQ Prod: 0x1, usecs since last trans: 21565000
       BUG: stack guard page was hit at 0000000093f1a2de (stack is 00000000b66ea0dc..000000004d932dae)
       kernel stack overflow (page fault): 0000 [#1] SMP NOPTI
       CPU: 5 PID: 95 Comm: kworker/u20:1 Tainted: G W OE 5.13.0_mlnx #1
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
       Workqueue: mlx5e mlx5e_tx_timeout_work [mlx5_core]
       RIP: 0010:mlx5e_tx_reporter_dump_sq+0xd3/0x180
       [mlx5_core]
       Call Trace:
       mlx5e_tx_reporter_dump+0x43/0x1c0 [mlx5_core]
       devlink_health_do_dump.part.91+0x71/0xd0
       devlink_health_report+0x157/0x1b0
       mlx5e_reporter_tx_timeout+0xb9/0xf0 [mlx5_core]
       ? mlx5e_tx_reporter_err_cqe_recover+0x1d0/0x1d0
       [mlx5_core]
       ? mlx5e_health_queue_dump+0xd0/0xd0 [mlx5_core]
       ? update_load_avg+0x19b/0x550
       ? set_next_entity+0x72/0x80
       ? pick_next_task_fair+0x227/0x340
       ? finish_task_switch+0xa2/0x280
         mlx5e_tx_timeout_work+0x83/0xb0 [mlx5_core]
         process_one_work+0x1de/0x3a0
         worker_thread+0x2d/0x3c0
       ? process_one_work+0x3a0/0x3a0
         kthread+0x115/0x130
       ? kthread_park+0x90/0x90
         ret_from_fork+0x1f/0x30
       --[ end trace 51ccabea504edaff ]---
       RIP: 0010:mlx5e_tx_reporter_dump_sq+0xd3/0x180
       PKRU: 55555554
       Kernel panic - not syncing: Fatal exception
       Kernel Offset: disabled
       end Kernel panic - not syncing: Fatal exception
      
      To fix this bug add a wrapper for mlx5e_tx_reporter_dump_sq() which
      extracts the sq from struct mlx5e_tx_timeout_ctx and set it as the
      TX-timeout-recovery flow dump callback.
      
      Fixes: 5f29458b ("net/mlx5e: Support dump callback in TX reporter")
      Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
      Signed-off-by: default avatarAmir Tzin <amirtz@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      918fc385
    • Chris Mi's avatar
      net/mlx5: Fix tc max supported prio for nic mode · d671e109
      Chris Mi authored
      
      Only prio 1 is supported if firmware doesn't support ignore flow
      level for nic mode. The offending commit removed the check wrongly.
      Add it back.
      
      Fixes: 9a99c8f1 ("net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported")
      Signed-off-by: default avatarChris Mi <cmi@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      d671e109
    • Moshe Shemesh's avatar
      net/mlx5: Fix SF health recovery flow · 33de865f
      Moshe Shemesh authored
      
      SF do not directly control the PCI device. During recovery flow SF
      should not be allowed to do pci disable or pci reset, its PF will do it.
      
      It fixes the following kernel trace:
      mlx5_core.sf mlx5_core.sf.25: mlx5_health_try_recover:387:(pid 40948): starting health recovery flow
      mlx5_core 0000:03:00.0: mlx5_pci_slot_reset was called
      mlx5_core 0000:03:00.0: wait vital counter value 0xab175 after 1 iterations
      mlx5_core.sf mlx5_core.sf.25: firmware version: 24.32.532
      mlx5_core.sf mlx5_core.sf.23: mlx5_health_try_recover:387:(pid 40946): starting health recovery flow
      mlx5_core 0000:03:00.0: mlx5_pci_slot_reset was called
      mlx5_core 0000:03:00.0: wait vital counter value 0xab193 after 1 iterations
      mlx5_core.sf mlx5_core.sf.23: firmware version: 24.32.532
      mlx5_core.sf mlx5_core.sf.25: mlx5_cmd_check:813:(pid 40948): ENABLE_HCA(0x104) op_mod(0x0) failed,
      status bad resource state(0x9), syndrome (0x658908)
      mlx5_core.sf mlx5_core.sf.25: mlx5_function_setup:1292:(pid 40948): enable hca failed
      mlx5_core.sf mlx5_core.sf.25: mlx5_health_try_recover:389:(pid 40948): health recovery failed
      
      Fixes: 1958fc2f ("net/mlx5: SF, Add auxiliary device driver")
      Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      33de865f
    • Shay Drory's avatar
      net/mlx5: Fix error print in case of IRQ request failed · aa968f92
      Shay Drory authored
      
      In case IRQ layer failed to find or to request irq, the driver is
      printing the first cpu of the provided affinity as part of the error
      print. Empty affinity is a valid input for the IRQ layer, and it is
      an error to call cpumask_first() on empty affinity.
      
      Remove the first cpu print from the error message.
      
      Fixes: c36326d3 ("net/mlx5: Round-Robin EQs over IRQs")
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      aa968f92
    • Shay Drory's avatar
      net/mlx5: Use first online CPU instead of hard coded CPU · 26a7993c
      Shay Drory authored
      
      Hard coded CPU (0 in our case) might be offline. Hence, use the first
      online CPU instead.
      
      Fixes: f891b7cd ("net/mlx5: Enable single IRQ for PCI Function")
      Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      26a7993c
Loading