Skip to content
  1. Mar 28, 2024
  2. Mar 27, 2024
  3. Mar 26, 2024
    • Paolo Abeni's avatar
      Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver' · c1fd3a94
      Paolo Abeni authored
      Jijie Shao says:
      
      ====================
      There are some bugfix for the HNS3 ethernet driver
      ====================
      
      Link: https://lore.kernel.org/r/20240325124311.1866197-1-shaojijie@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c1fd3a94
    • Jian Shen's avatar
      net: hns3: mark unexcuted loopback test result as UNEXECUTED · 5bd088d6
      Jian Shen authored
      Currently, loopback test may be skipped when resetting, but the test
      result will still show as 'PASS', because the driver doesn't set
      ETH_TEST_FL_FAILED flag. Fix it by setting the flag and
      initializating the value to UNEXECUTED.
      
      Fixes: 4c8dab1c
      
       ("net: hns3: reconstruct function hns3_self_test")
      Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
      Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
      Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      5bd088d6
    • Yonglong Liu's avatar
      net: hns3: fix kernel crash when devlink reload during pf initialization · 93305b77
      Yonglong Liu authored
      The devlink reload process will access the hardware resources,
      but the register operation is done before the hardware is initialized.
      So, processing the devlink reload during initialization may lead to kernel
      crash. This patch fixes this by taking devl_lock during initialization.
      
      Fixes: b741269b
      
       ("net: hns3: add support for registering devlink for PF")
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      93305b77
    • Jie Wang's avatar
      net: hns3: fix index limit to support all queue stats · 47e39d21
      Jie Wang authored
      Currently, hns hardware supports more than 512 queues and the index limit
      in hclge_comm_tqps_update_stats is wrong. So this patch removes it.
      
      Fixes: 287db5c4
      
       ("net: hns3: create new set of common tqp stats APIs for PF and VF reuse")
      Signed-off-by: default avatarJie Wang <wangjie125@huawei.com>
      Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
      Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      47e39d21
    • Paolo Abeni's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 37ccdf7f
      Paolo Abeni authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2024-03-25
      
      The following pull-request contains BPF updates for your *net* tree.
      
      We've added 17 non-merge commits during the last 12 day(s) which contain
      a total of 19 files changed, 184 insertions(+), 61 deletions(-).
      
      The main changes are:
      
      1) Fix an arm64 BPF JIT bug in BPF_LDX_MEMSX implementation's offset handling
         found via test_bpf module, from Puranjay Mohan.
      
      2) Various fixups to the BPF arena code in particular in the BPF verifier and
         around BPF selftests to match latest corresponding LLVM implementation,
         from Puranjay Mohan and Alexei Starovoitov.
      
      3) Fix xsk to not assume that metadata is always requested in TX completion,
         from Stanislav Fomichev.
      
      4) Fix riscv BPF JIT's kfunc parameter incompatibility between BPF and the riscv
         ABI which requires sign-extension on int/uint, from Pu Lehui.
      
      5) Fix s390x BPF JIT's bpf_plt pointer arithmetic which triggered a crash when
         testing struct_ops, from Ilya Leoshkevich.
      
      6) Fix libbpf's arena mmap handling which had incorrect u64-to-pointer cast on
         32-bit architectures, from Andrii Nakryiko.
      
      7) Fix libbpf to define MFD_CLOEXEC when not available, from Arnaldo Carvalho de Melo.
      
      8) Fix arm64 BPF JIT implementation for 32bit unconditional bswap which
         resulted in an incorrect swap as indicated by test_bpf, from Artem Savkov.
      
      9) Fix BPF man page build script to use silent mode, from Hangbin Liu.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        riscv, bpf: Fix kfunc parameters incompatibility between bpf and riscv abi
        bpf: verifier: reject addr_space_cast insn without arena
        selftests/bpf: verifier_arena: fix mmap address for arm64
        bpf: verifier: fix addr_space_cast from as(1) to as(0)
        libbpf: Define MFD_CLOEXEC if not available
        arm64: bpf: fix 32bit unconditional bswap
        bpf, arm64: fix bug in BPF_LDX_MEMSX
        libbpf: fix u64-to-pointer cast on 32-bit arches
        s390/bpf: Fix bpf_plt pointer arithmetic
        xsk: Don't assume metadata is always requested in TX completion
        selftests/bpf: Add arena test case for 4Gbyte corner case
        selftests/bpf: Remove hard coded PAGE_SIZE macro.
        libbpf, selftests/bpf: Adjust libbpf, bpftool, selftests to match LLVM
        bpf: Clarify bpf_arena comments.
        MAINTAINERS: Update email address for Quentin Monnet
        scripts/bpf_doc: Use silent mode when exec make cmd
        bpf: Temporarily disable atomic operations in BPF arena
      ====================
      
      Link: https://lore.kernel.org/r/20240325213520.26688-1-daniel@iogearbox.net
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      37ccdf7f
    • Ido Schimmel's avatar
      selftests: vxlan_mdb: Fix failures with old libnet · f1425529
      Ido Schimmel authored
      Locally generated IP multicast packets (such as the ones used in the
      test) do not perform routing and simply egress the bound device.
      
      However, as explained in commit 8bcfb4ae ("selftests: forwarding:
      Fix failing tests with old libnet"), old versions of libnet (used by
      mausezahn) do not use the "SO_BINDTODEVICE" socket option. Specifically,
      the library started using the option for IPv6 sockets in version 1.1.6
      and for IPv4 sockets in version 1.2. This explains why on Ubuntu - which
      uses version 1.1.6 - the IPv4 overlay tests are failing whereas the IPv6
      ones are passing.
      
      Fix by specifying the source and destination MAC of the packets which
      will cause mausezahn to use a packet socket instead of an IP socket.
      
      Fixes: 62199e3f
      
       ("selftests: net: Add VXLAN MDB test")
      Reported-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Closes: https://lore.kernel.org/netdev/5bb50349-196d-4892-8ed2-f37543aa863f@alu.unizg.hr/
      
      
      Tested-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/20240325075030.2379513-1-idosch@nvidia.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      f1425529
    • Sergey Shtylyov's avatar
      MAINTAINERS: split Renesas Ethernet drivers entry · 8c05813d
      Sergey Shtylyov authored
      
      
      Since the Renesas Ethernet Switch driver was added by Yoshihiro Shimoda,
      I started receiving the patches to review for it -- which I was unable to
      do, as I don't know this hardware and don't even have the manuals for it.
      Fortunately, Shimoda-san has volunteered to be a reviewer for this new
      driver, thus let's now split the single entry into 3 per-driver entries,
      each with its own reviewer...
      
      Signed-off-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Acked-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Link: https://lore.kernel.org/r/de0ccc1d-6fc0-583f-4f80-f70e6461d62d@omp.ru
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      8c05813d
    • Arınç ÜNAL's avatar
      net: dsa: mt7530: fix improper frames on all 25MHz and 40MHz XTAL MT7530 · 5f563c31
      Arınç ÜNAL authored
      The MT7530 switch after reset initialises with a core clock frequency that
      works with a 25MHz XTAL connected to it. For 40MHz XTAL, the core clock
      frequency must be set to 500MHz.
      
      The mt7530_pll_setup() function is responsible of setting the core clock
      frequency. Currently, it runs on MT7530 with 25MHz and 40MHz XTAL. This
      causes MT7530 switch with 25MHz XTAL to egress and ingress frames
      improperly.
      
      Introduce a check to run it only on MT7530 with 40MHz XTAL.
      
      The core clock frequency is set by writing to a switch PHY's register.
      Access to the PHY's register is done via the MDIO bus the switch is also
      on. Therefore, it works only when the switch makes switch PHYs listen on
      the MDIO bus the switch is on. This is controlled either by the state of
      the ESW_P1_LED_1 pin after reset deassertion or modifying bit 5 of the
      modifiable trap register.
      
      When ESW_P1_LED_1 is pulled high, PHY indirect access is used. That means
      accessing PHY registers via the PHY indirect access control register of the
      switch.
      
      When ESW_P1_LED_1 is pulled low, PHY direct access is used. That means
      accessing PHY registers via the MDIO bus the switch is on.
      
      For MT7530 switch with 40MHz XTAL on a board with ESW_P1_LED_1 pulled high,
      the core clock frequency won't be set to 500MHz, causing the switch to
      egress and ingress frames improperly.
      
      Run mt7530_pll_setup() after PHY direct access is set on the modifiable
      trap register.
      
      With these two changes, all MT7530 switches with 25MHz and 40MHz, and
      P1_LED_1 pulled high or low, will egress and ingress frames properly.
      
      Link: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/4a5dd143f2172ec97a2872fa29c7c4cd520f45b5/linux-mt/drivers/net/ethernet/mediatek/gsw_mt7623.c#L1039
      Fixes: b8f126a8
      
       ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
      Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Link: https://lore.kernel.org/r/20240320-for-net-mt7530-fix-25mhz-xtal-with-direct-phy-access-v1-1-d92f605f1160@arinc9.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      5f563c31
    • Bjørn Mork's avatar
      net: wwan: t7xx: Split 64bit accesses to fix alignment issues · 7d5a7dd5
      Bjørn Mork authored
      Some of the registers are aligned on a 32bit boundary, causing
      alignment faults on 64bit platforms.
      
       Unable to handle kernel paging request at virtual address ffffffc084a1d004
       Mem abort info:
       ESR = 0x0000000096000061
       EC = 0x25: DABT (current EL), IL = 32 bits
       SET = 0, FnV = 0
       EA = 0, S1PTW = 0
       FSC = 0x21: alignment fault
       Data abort info:
       ISV = 0, ISS = 0x00000061, ISS2 = 0x00000000
       CM = 0, WnR = 1, TnD = 0, TagAccess = 0
       GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
       swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000046ad6000
       [ffffffc084a1d004] pgd=100000013ffff003, p4d=100000013ffff003, pud=100000013ffff003, pmd=0068000020a00711
       Internal error: Oops: 0000000096000061 [#1] SMP
       Modules linked in: mtk_t7xx(+) qcserial pppoe ppp_async option nft_fib_inet nf_flow_table_inet mt7921u(O) mt7921s(O) mt7921e(O) mt7921_common(O) iwlmvm(O) iwldvm(O) usb_wwan rndis_host qmi_wwan pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mt7996e(O) mt792x_usb(O) mt792x_lib(O) mt7915e(O) mt76_usb(O) mt76_sdio(O) mt76_connac_lib(O) mt76(O) mac80211(O) iwlwifi(O) huawei_cdc_ncm cfg80211(O) cdc_ncm cdc_ether wwan usbserial usbnet slhc sfp rtc_pcf8563 nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 mt6577_auxadc mdio_i2c libcrc32c compat(O) cdc_wdm cdc_acm at24 crypto_safexcel pwm_fan i2c_gpio i2c_smbus industrialio i2c_algo_bit i2c_mux_reg i2c_mux_pca954x i2c_mux_pca9541 i2c_mux_gpio i2c_mux dummy oid_registry tun sha512_arm64 sha1_ce sha1_generic seqiv
       md5 geniv des_generic libdes cbc authencesn authenc leds_gpio xhci_plat_hcd xhci_pci xhci_mtk_hcd xhci_hcd nvme nvme_core gpio_button_hotplug(O) dm_mirror dm_region_hash dm_log dm_crypt dm_mod dax usbcore usb_common ptp aquantia pps_core mii tpm encrypted_keys trusted
       CPU: 3 PID: 5266 Comm: kworker/u9:1 Tainted: G O 6.6.22 #0
       Hardware name: Bananapi BPI-R4 (DT)
       Workqueue: md_hk_wq t7xx_fsm_uninit [mtk_t7xx]
       pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
       pc : t7xx_cldma_hw_set_start_addr+0x1c/0x3c [mtk_t7xx]
       lr : t7xx_cldma_start+0xac/0x13c [mtk_t7xx]
       sp : ffffffc085d63d30
       x29: ffffffc085d63d30 x28: 0000000000000000 x27: 0000000000000000
       x26: 0000000000000000 x25: ffffff80c804f2c0 x24: ffffff80ca196c05
       x23: 0000000000000000 x22: ffffff80c814b9b8 x21: ffffff80c814b128
       x20: 0000000000000001 x19: ffffff80c814b080 x18: 0000000000000014
       x17: 0000000055c9806b x16: 000000007c5296d0 x15: 000000000f6bca68
       x14: 00000000dbdbdce4 x13: 000000001aeaf72a x12: 0000000000000001
       x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
       x8 : ffffff80ca1ef6b4 x7 : ffffff80c814b818 x6 : 0000000000000018
       x5 : 0000000000000870 x4 : 0000000000000000 x3 : 0000000000000000
       x2 : 000000010a947000 x1 : ffffffc084a1d004 x0 : ffffffc084a1d004
       Call trace:
       t7xx_cldma_hw_set_start_addr+0x1c/0x3c [mtk_t7xx]
       t7xx_fsm_uninit+0x578/0x5ec [mtk_t7xx]
       process_one_work+0x154/0x2a0
       worker_thread+0x2ac/0x488
       kthread+0xe0/0xec
       ret_from_fork+0x10/0x20
       Code: f9400800 91001000 8b214001 d50332bf (f9000022)
       ---[ end trace 0000000000000000 ]---
      
      The inclusion of io-64-nonatomic-lo-hi.h indicates that all 64bit
      accesses can be replaced by pairs of nonatomic 32bit access.  Fix
      alignment by forcing all accesses to be 32bit on 64bit platforms.
      
      Link: https://forum.openwrt.org/t/fibocom-fm350-gl-support/142682/72
      Fixes: 39d43904
      
       ("net: wwan: t7xx: Add control DMA interface")
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Reviewed-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Tested-by: default avatarLiviu Dudau <liviu@dudau.co.uk>
      Link: https://lore.kernel.org/r/20240322144000.1683822-1-bjorn@mork.no
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7d5a7dd5
    • Eric Dumazet's avatar
      tcp: properly terminate timers for kernel sockets · 151c9c72
      Eric Dumazet authored
      We had various syzbot reports about tcp timers firing after
      the corresponding netns has been dismantled.
      
      Fortunately Josef Bacik could trigger the issue more often,
      and could test a patch I wrote two years ago.
      
      When TCP sockets are closed, we call inet_csk_clear_xmit_timers()
      to 'stop' the timers.
      
      inet_csk_clear_xmit_timers() can be called from any context,
      including when socket lock is held.
      This is the reason it uses sk_stop_timer(), aka del_timer().
      This means that ongoing timers might finish much later.
      
      For user sockets, this is fine because each running timer
      holds a reference on the socket, and the user socket holds
      a reference on the netns.
      
      For kernel sockets, we risk that the netns is freed before
      timer can complete, because kernel sockets do not hold
      reference on the netns.
      
      This patch adds inet_csk_clear_xmit_timers_sync() function
      that using sk_stop_timer_sync() to make sure all timers
      are terminated before the kernel socket is released.
      Modules using kernel sockets close them in their netns exit()
      handler.
      
      Also add sock_not_owned_by_me() helper to get LOCKDEP
      support : inet_csk_clear_xmit_timers_sync() must not be called
      while socket lock is held.
      
      It is very possible we can revert in the future commit
      3a58f13a
      
       ("net: rds: acquire refcount on TCP sockets")
      which attempted to solve the issue in rds only.
      (net/smc/af_smc.c and net/mptcp/subflow.c have similar code)
      
      We probably can remove the check_net() tests from
      tcp_out_of_resources() and __tcp_close() in the future.
      
      Reported-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Closes: https://lore.kernel.org/netdev/20240314210740.GA2823176@perftesting/
      Fixes: 26abe143 ("net: Modify sk_alloc to not reference count the netns of kernel sockets.")
      Fixes: 8a681736 ("net: sk_clone_lock() should only do get_net() if the parent is not a kernel socket")
      Link: https://lore.kernel.org/bpf/CANn89i+484ffqb93aQm1N-tjxxvb3WDKX0EbD7318RwRgsatjw@mail.gmail.com/
      
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Tested-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Link: https://lore.kernel.org/r/20240322135732.1535772-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      151c9c72
    • Ravi Gunasekaran's avatar
      net: hsr: hsr_slave: Fix the promiscuous mode in offload mode · b11c8173
      Ravi Gunasekaran authored
      commit e748d0fd ("net: hsr: Disable promiscuous mode in
      offload mode") disables promiscuous mode of slave devices
      while creating an HSR interface. But while deleting the
      HSR interface, it does not take care of it. It decreases the
      promiscuous mode count, which eventually enables promiscuous
      mode on the slave devices when creating HSR interface again.
      
      Fix this by not decrementing the promiscuous mode count while
      deleting the HSR interface when offload is enabled.
      
      Fixes: e748d0fd
      
       ("net: hsr: Disable promiscuous mode in offload mode")
      Signed-off-by: default avatarRavi Gunasekaran <r-gunasekaran@ti.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20240322100447.27615-1-r-gunasekaran@ti.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b11c8173
    • Claus Hansen Ries's avatar
      net: ll_temac: platform_get_resource replaced by wrong function · 3a38a829
      Claus Hansen Ries authored
      The function platform_get_resource was replaced with
      devm_platform_ioremap_resource_byname and is called using 0 as name.
      
      This eventually ends up in platform_get_resource_byname in the call
      stack, where it causes a null pointer in strcmp.
      
      	if (type == resource_type(r) && !strcmp(r->name, name))
      
      It should have been replaced with devm_platform_ioremap_resource.
      
      Fixes: bd69058f
      
       ("net: ll_temac: Use devm_platform_ioremap_resource_byname()")
      Signed-off-by: default avatarClaus Hansen Ries <chr@terma.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/cca18f9c630a41c18487729770b492bb@terma.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3a38a829
    • Alexandra Winter's avatar
      s390/qeth: handle deferred cc1 · afb373ff
      Alexandra Winter authored
      The IO subsystem expects a driver to retry a ccw_device_start, when the
      subsequent interrupt response block (irb) contains a deferred
      condition code 1.
      
      Symptoms before this commit:
      On the read channel we always trigger the next read anyhow, so no
      different behaviour here.
      On the write channel we may experience timeout errors, because the
      expected reply will never be received without the retry.
      Other callers of qeth_send_control_data() may wrongly assume that the ccw
      was successful, which may cause problems later.
      
      Note that since
      commit 2297791c ("s390/cio: dont unregister subchannel from child-drivers")
      and
      commit 5ef1dc40 ("s390/cio: fix invalid -EBUSY on ccw_device_start")
      deferred CC1s are much more likely to occur. See the commit message of the
      latter for more background information.
      
      Fixes: 2297791c
      
       ("s390/cio: dont unregister subchannel from child-drivers")
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Co-developed-by: default avatarThorsten Winkler <twinkler@linux.ibm.com>
      Signed-off-by: default avatarThorsten Winkler <twinkler@linux.ibm.com>
      Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240321115337.3564694-1-wintera@linux.ibm.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      afb373ff
    • Prasad Pandit's avatar
      dpll: indent DPLL option type by a tab · cc269926
      Prasad Pandit authored
      Indent config option type by a tab. It helps Kconfig parsers
      to read file without error.
      
      Fixes: 9431063a
      
       ("dpll: core: Add DPLL framework base functions")
      Signed-off-by: default avatarPrasad Pandit <pjp@fedoraproject.org>
      Reviewed-by: default avatarVadim Fedorenko <vadim.fedorenko@linux.dev>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20240322114819.1801795-1-ppandit@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cc269926
    • Pu Lehui's avatar
      riscv, bpf: Fix kfunc parameters incompatibility between bpf and riscv abi · 443574b0
      Pu Lehui authored
      We encountered a failing case when running selftest in no_alu32 mode:
      
      The failure case is `kfunc_call/kfunc_call_test4` and its source code is
      like bellow:
      ```
      long bpf_kfunc_call_test4(signed char a, short b, int c, long d) __ksym;
      int kfunc_call_test4(struct __sk_buff *skb)
      {
      	...
      	tmp = bpf_kfunc_call_test4(-3, -30, -200, -1000);
      	...
      }
      ```
      
      And its corresponding asm code is:
      ```
      0: r1 = -3
      1: r2 = -30
      2: r3 = 0xffffff38 # opcode: 18 03 00 00 38 ff ff ff 00 00 00 00 00 00 00 00
      4: r4 = -1000
      5: call bpf_kfunc_call_test4
      ```
      
      insn 2 is parsed to ld_imm64 insn to emit 0x00000000ffffff38 imm, and
      converted to int type and then send to bpf_kfunc_call_test4. But since
      it is zero-extended in the bpf calling convention, riscv jit will
      directly treat it as an unsigned 32-bit int value, and then fails with
      the message "actual 4294966063 != expected -1234".
      
      The reason is the incompatibility between bpf and riscv abi, that is,
      bpf will do zero-extension on uint, but riscv64 requires sign-extension
      on int or uint. We can solve this problem by sign extending the 32-bit
      parameters in kfunc.
      
      The issue is related to [0], and thanks to Yonghong and Alexei.
      
      Link: https://github.com/llvm/llvm-project/pull/84874 [0]
      Fixes: d40c3847
      
       ("riscv, bpf: Add kfunc support for RV64")
      Signed-off-by: default avatarPu Lehui <pulehui@huawei.com>
      Tested-by: default avatarPuranjay Mohan <puranjay12@gmail.com>
      Reviewed-by: default avatarPuranjay Mohan <puranjay12@gmail.com>
      Link: https://lore.kernel.org/r/20240324103306.2202954-1-pulehui@huaweicloud.com
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      443574b0
    • Kurt Kanzenbach's avatar
      igc: Remove stale comment about Tx timestamping · 47ce2956
      Kurt Kanzenbach authored
      The initial igc Tx timestamping implementation used only one register for
      retrieving Tx timestamps. Commit 3ed247e7 ("igc: Add support for
      multiple in-flight TX timestamps") added support for utilizing all four of
      them e.g., for multiple domain support. Remove the stale comment/FIXME.
      
      Fixes: 3ed247e7
      
       ("igc: Add support for multiple in-flight TX timestamps")
      Signed-off-by: default avatarKurt Kanzenbach <kurt@linutronix.de>
      Acked-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: default avatarNaama Meir <naamax.meir@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      47ce2956
    • Przemek Kitszel's avatar
      ixgbe: avoid sleeping allocation in ixgbe_ipsec_vf_add_sa() · aec806fb
      Przemek Kitszel authored
      Change kzalloc() flags used in ixgbe_ipsec_vf_add_sa() to GFP_ATOMIC, to
      avoid sleeping in IRQ context.
      
      Dan Carpenter, with the help of Smatch, has found following issue:
      The patch eda0333a: "ixgbe: add VF IPsec management" from Aug 13,
      2018 (linux-next), leads to the following Smatch static checker
      warning: drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c:917 ixgbe_ipsec_vf_add_sa()
      	warn: sleeping in IRQ context
      
      The call tree that Smatch is worried about is:
      ixgbe_msix_other() <- IRQ handler
      -> ixgbe_msg_task()
         -> ixgbe_rcv_msg_from_vf()
            -> ixgbe_ipsec_vf_add_sa()
      
      Fixes: eda0333a
      
       ("ixgbe: add VF IPsec management")
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Link: https://lore.kernel.org/intel-wired-lan/db31a0b0-4d9f-4e6b-aed8-88266eb5665c@moroto.mountain
      
      
      Reviewed-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
      Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      aec806fb
    • Jesse Brandeburg's avatar
      ice: fix memory corruption bug with suspend and rebuild · 1cb7fdb1
      Jesse Brandeburg authored
      The ice driver would previously panic after suspend. This is caused
      from the driver *only* calling the ice_vsi_free_q_vectors() function by
      itself, when it is suspending. Since commit b3e7b3a6 ("ice: prevent
      NULL pointer deref during reload") the driver has zeroed out
      num_q_vectors, and only restored it in ice_vsi_cfg_def().
      
      This further causes the ice_rebuild() function to allocate a zero length
      buffer, after which num_q_vectors is updated, and then the new value of
      num_q_vectors is used to index into the zero length buffer, which
      corrupts memory.
      
      The fix entails making sure all the code referencing num_q_vectors only
      does so after it has been reset via ice_vsi_cfg_def().
      
      I didn't perform a full bisect, but I was able to test against 6.1.77
      kernel and that ice driver works fine for suspend/resume with no panic,
      so sometime since then, this problem was introduced.
      
      Also clean up an un-needed init of a local variable in the function
      being modified.
      
      PANIC from 6.8.0-rc1:
      
      [1026674.915596] PM: suspend exit
      [1026675.664697] ice 0000:17:00.1: PTP reset successful
      [1026675.664707] ice 0000:17:00.1: 2755 msecs passed between update to cached PHC time
      [1026675.667660] ice 0000:b1:00.0: PTP reset successful
      [1026675.675944] ice 0000:b1:00.0: 2832 msecs passed between update to cached PHC time
      [1026677.137733] ixgbe 0000:31:00.0 ens787: NIC Link is Up 1 Gbps, Flow Control: None
      [1026677.190201] BUG: kernel NULL pointer dereference, address: 0000000000000010
      [1026677.192753] ice 0000:17:00.0: PTP reset successful
      [1026677.192764] ice 0000:17:00.0: 4548 msecs passed between update to cached PHC time
      [1026677.197928] #PF: supervisor read access in kernel mode
      [1026677.197933] #PF: error_code(0x0000) - not-present page
      [1026677.197937] PGD 1557a7067 P4D 0
      [1026677.212133] ice 0000:b1:00.1: PTP reset successful
      [1026677.212143] ice 0000:b1:00.1: 4344 msecs passed between update to cached PHC time
      [1026677.212575]
      [1026677.243142] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [1026677.247918] CPU: 23 PID: 42790 Comm: kworker/23:0 Kdump: loaded Tainted: G        W          6.8.0-rc1+ #1
      [1026677.257989] Hardware name: Intel Corporation M50CYP2SBSTD/M50CYP2SBSTD, BIOS SE5C620.86B.01.01.0005.2202160810 02/16/2022
      [1026677.269367] Workqueue: ice ice_service_task [ice]
      [1026677.274592] RIP: 0010:ice_vsi_rebuild_set_coalesce+0x130/0x1e0 [ice]
      [1026677.281421] Code: 0f 84 3a ff ff ff 41 0f b7 74 ec 02 66 89 b0 22 02 00 00 81 e6 ff 1f 00 00 e8 ec fd ff ff e9 35 ff ff ff 48 8b 43 30 49 63 ed <41> 0f b7 34 24 41 83 c5 01 48 8b 3c e8 66 89 b7 aa 02 00 00 81 e6
      [1026677.300877] RSP: 0018:ff3be62a6399bcc0 EFLAGS: 00010202
      [1026677.306556] RAX: ff28691e28980828 RBX: ff28691e41099828 RCX: 0000000000188000
      [1026677.314148] RDX: 0000000000000000 RSI: 0000000000000010 RDI: ff28691e41099828
      [1026677.321730] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      [1026677.329311] R10: 0000000000000007 R11: ffffffffffffffc0 R12: 0000000000000010
      [1026677.336896] R13: 0000000000000000 R14: 0000000000000000 R15: ff28691e0eaa81a0
      [1026677.344472] FS:  0000000000000000(0000) GS:ff28693cbffc0000(0000) knlGS:0000000000000000
      [1026677.353000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [1026677.359195] CR2: 0000000000000010 CR3: 0000000128df4001 CR4: 0000000000771ef0
      [1026677.366779] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [1026677.374369] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [1026677.381952] PKRU: 55555554
      [1026677.385116] Call Trace:
      [1026677.388023]  <TASK>
      [1026677.390589]  ? __die+0x20/0x70
      [1026677.394105]  ? page_fault_oops+0x82/0x160
      [1026677.398576]  ? do_user_addr_fault+0x65/0x6a0
      [1026677.403307]  ? exc_page_fault+0x6a/0x150
      [1026677.407694]  ? asm_exc_page_fault+0x22/0x30
      [1026677.412349]  ? ice_vsi_rebuild_set_coalesce+0x130/0x1e0 [ice]
      [1026677.418614]  ice_vsi_rebuild+0x34b/0x3c0 [ice]
      [1026677.423583]  ice_vsi_rebuild_by_type+0x76/0x180 [ice]
      [1026677.429147]  ice_rebuild+0x18b/0x520 [ice]
      [1026677.433746]  ? delay_tsc+0x8f/0xc0
      [1026677.437630]  ice_do_reset+0xa3/0x190 [ice]
      [1026677.442231]  ice_service_task+0x26/0x440 [ice]
      [1026677.447180]  process_one_work+0x174/0x340
      [1026677.451669]  worker_thread+0x27e/0x390
      [1026677.455890]  ? __pfx_worker_thread+0x10/0x10
      [1026677.460627]  kthread+0xee/0x120
      [1026677.464235]  ? __pfx_kthread+0x10/0x10
      [1026677.468445]  ret_from_fork+0x2d/0x50
      [1026677.472476]  ? __pfx_kthread+0x10/0x10
      [1026677.476671]  ret_from_fork_asm+0x1b/0x30
      [1026677.481050]  </TASK>
      
      Fixes: b3e7b3a6
      
       ("ice: prevent NULL pointer deref during reload")
      Reported-by: default avatarRobert Elliott <elliott@hpe.com>
      Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      1cb7fdb1
    • Steven Zou's avatar
      ice: Refactor FW data type and fix bitmap casting issue · 817b1896
      Steven Zou authored
      According to the datasheet, the recipe association data is an 8-byte
      little-endian value. It is described as 'Bitmap of the recipe indexes
      associated with this profile', it is from 24 to 31 byte area in FW.
      Therefore, it is defined to '__le64 recipe_assoc' in struct
      ice_aqc_recipe_to_profile. And then fix the bitmap casting issue, as we
      must never ever use castings for bitmap type.
      
      Fixes: 1e0f9881
      
       ("ice: Flesh out implementation of support for SRIOV on bonded interface")
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarAndrii Staikov <andrii.staikov@intel.com>
      Reviewed-by: default avatarJan Sokolowski <jan.sokolowski@intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarSteven Zou <steven.zou@intel.com>
      Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      817b1896
  4. Mar 25, 2024
  5. Mar 23, 2024