1. 17 Jun, 2024 1 commit
    • Alan Maguire's avatar
      libbpf: Add btf__distill_base() creating split BTF with distilled base BTF · 58e185a0
      Alan Maguire authored
      To support more robust split BTF, adding supplemental context for the
      base BTF type ids that split BTF refers to is required.  Without such
      references, a simple shuffling of base BTF type ids (without any other
      significant change) invalidates the split BTF.  Here the attempt is made
      to store additional context to make split BTF more robust.
      
      This context comes in the form of distilled base BTF providing minimal
      information (name and - in some cases - size) for base INTs, FLOATs,
      STRUCTs, UNIONs, ENUMs and ENUM64s along with modified split BTF that
      points at that base and contains any additional types needed (such as
      TYPEDEF, PTR and anonymous STRUCT/UNION declarations).  This
      information constitutes the minimal BTF representation needed to
      disambiguate or remove split BTF references to base BTF.  The rules
      are as follows:
      
      - INT, FLOAT, FWD are recorded in full.
      - if a named base BTF STRUCT or UNION is referred to from split BTF, it
        will be encoded as a zero-member sized STRUCT/UNION (preserving
        size for later relocation checks).  Only base BTF STRUCT/UNIONs
        that are either embedded in split BTF STRUCT/UNIONs or that have
        multiple STRUCT/UNION instances of the same name will _need_ size
        checks at relocation time, but as it is possible a different set of
        types will be duplicates in the later to-be-resolved base BTF,
        we preserve size information for all named STRUCT/UNIONs.
      - if an ENUM[64] is named, a ENUM forward representation (an ENUM
        with no values) of the same size is used.
      - in all other cases, the type is added to the new split BTF.
      
      Avoiding struct/union/enum/enum64 expansion is important to keep the
      distilled base BTF representation to a minimum size.
      
      When successful, new representations of the distilled base BTF and new
      split BTF that refers to it are returned.  Both need to be freed by the
      caller.
      
      So to take a simple example, with split BTF with a type referring
      to "struct sk_buff", we will generate distilled base BTF with a
      0-member STRUCT sk_buff of the appropriate size, and the split BTF
      will refer to it instead.
      
      Tools like pahole can utilize such split BTF to populate the .BTF
      section (split BTF) and an additional .BTF.base section.  Then
      when the split BTF is loaded, the distilled base BTF can be used
      to relocate split BTF to reference the current (and possibly changed)
      base BTF.
      
      So for example if "struct sk_buff" was id 502 when the split BTF was
      originally generated,  we can use the distilled base BTF to see that
      id 502 refers to a "struct sk_buff" and replace instances of id 502
      with the current (relocated) base BTF sk_buff type id.
      
      Distilled base BTF is small; when building a kernel with all modules
      using distilled base BTF as a test, overall module size grew by only
      5.3Mb total across ~2700 modules.
      Signed-off-by: default avatarAlan Maguire <alan.maguire@oracle.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Acked-by: default avatarEduard Zingerman <eddyz87@gmail.com>
      Link: https://lore.kernel.org/bpf/20240613095014.357981-2-alan.maguire@oracle.com
      58e185a0
  2. 14 Jun, 2024 4 commits
  3. 13 Jun, 2024 11 commits
  4. 12 Jun, 2024 13 commits
  5. 11 Jun, 2024 8 commits
    • Kenta Tada's avatar
      bpftool: Query only cgroup-related attach types · 98b303c9
      Kenta Tada authored
      When CONFIG_NETKIT=y,
      bpftool-cgroup shows error even if the cgroup's path is correct:
      
      $ bpftool cgroup tree /sys/fs/cgroup
      CgroupPath
      ID       AttachType      AttachFlags     Name
      Error: can't query bpf programs attached to /sys/fs/cgroup: No such device or address
      
      >From strace and kernel tracing, I found netkit returned ENXIO and this command failed.
      I think this AttachType(BPF_NETKIT_PRIMARY) is not relevant to cgroup.
      
      bpftool-cgroup should query just only cgroup-related attach types.
      
      v2->v3:
        - removed an unnecessary check
      
      v1->v2:
        - used an array of cgroup attach types
      Signed-off-by: default avatarKenta Tada <tadakentaso@gmail.com>
      Reviewed-by: default avatarQuentin Monnet <qmo@kernel.org>
      Link: https://lore.kernel.org/r/20240607111704.6716-1-tadakentaso@gmail.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      98b303c9
    • Jakub Kicinski's avatar
      Merge branch 'intel-wired-lan-driver-updates-2024-06-03' · bb678f01
      Jakub Kicinski authored
      Jacob Keller says:
      
      ====================
      Intel Wired LAN Driver Updates 2024-06-03
      
      This series includes miscellaneous improvements for the ice as well as a
      cleanup to the Makefiles for all Intel net drivers.
      
      Andy fixes all of the Intel net driver Makefiles to use the documented
      '*-y' syntax for specifying object files to link into kernel driver
      modules, rather than the '*-objs' syntax which works but is documented as
      reserved for user-space host programs.
      
      Jacob has a cleanup to refactor rounding logic in the ice driver into a
      common roundup_u64 helper function.
      
      Michal Schmidt replaces irq_set_affinity_hint() to use
      irq_update_affinity_hint() which behaves better with user-applied affinity
      settings.
      
      v2: https://lore.kernel.org/r/20240605-next-2024-06-03-intel-next-batch-v2-0-39c23963fa78@intel.com
      v1: https://lore.kernel.org/r/20240603-next-2024-06-03-intel-next-batch-v1-0-e0523b28f325@intel.com
      ====================
      
      Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-0-d1470cee3347@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bb678f01
    • Michal Schmidt's avatar
      ice: use irq_update_affinity_hint() · dee55767
      Michal Schmidt authored
      irq_set_affinity_hint() is deprecated. Use irq_update_affinity_hint()
      instead. This removes the side-effect of actually applying the affinity.
      
      The driver does not really need to worry about spreading its IRQs across
      CPUs. The core code already takes care of that.
      On the contrary, when the driver applies affinities by itself, it breaks
      the users' expectations:
       1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
          order to prevent IRQs from being moved to certain CPUs that run a
          real-time workload.
       2. ice reconfigures VSIs at runtime due to a MIB change
          (ice_dcb_process_lldp_set_mib_change). Reopening a VSI resets the
          affinity in ice_vsi_req_irq_msix().
       3. ice has no idea about irqbalance's config, so it may move an IRQ to
          a banned CPU. The real-time workload suffers unacceptable latency.
      
      I am not sure if updating the affinity hints is at all useful, because
      irqbalance ignores them since 2016 ([1]), but at least it's harmless.
      
      This ice change is similar to i40e commit d34c54d1 ("i40e: Use
      irq_update_affinity_hint()").
      
      [1] https://github.com/Irqbalance/irqbalance/commit/dcc411e7bfddSigned-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
      Reviewed-by: default avatarSunil Goutham <sgoutham@marvell.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-3-d1470cee3347@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dee55767
    • Jacob Keller's avatar
      ice: add and use roundup_u64 instead of open coding equivalent · 1d4ce389
      Jacob Keller authored
      In ice_ptp_cfg_clkout(), the ice driver needs to calculate the nearest next
      second of a current time value specified in nanoseconds. It implements this
      using div64_u64, because the time value is a u64. It could use div_u64
      since NSEC_PER_SEC is smaller than 32-bits.
      
      Ideally this would be implemented directly with roundup(), but that can't
      work on all platforms due to a division which requires using the specific
      macros and functions due to platform restrictions, and to ensure that the
      most appropriate and fast instructions are used.
      
      The kernel doesn't currently provide any 64-bit equivalents for doing
      roundup. Attempting to use roundup() on a 32-bit platform will result in a
      link failure due to not having a direct 64-bit division.
      
      The closest equivalent for this is DIV64_U64_ROUND_UP, which does a
      division always rounding up. However, this only computes the division, and
      forces use of the div64_u64 in cases where the divisor is a 32bit value and
      could make use of div_u64.
      
      Introduce DIV_U64_ROUND_UP based on div_u64, and then use it to implement
      roundup_u64 which takes a u64 input value and a u32 rounding value.
      
      The name roundup_u64 matches the naming scheme of div_u64, and future
      patches could implement roundup64_u64 if they need to round by a multiple
      that is greater than 32-bits.
      
      Replace the logic in ice_ptp.c which does this equivalent with the newly
      added roundup_u64.
      Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-2-d1470cee3347@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1d4ce389
    • Andy Shevchenko's avatar
      net: intel: Use *-y instead of *-objs in Makefile · a2fe35df
      Andy Shevchenko authored
      *-objs suffix is reserved rather for (user-space) host programs while
      usually *-y suffix is used for kernel drivers (although *-objs works
      for that purpose for now).
      
      Let's correct the old usages of *-objs in Makefiles.
      Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Reviewed-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-1-d1470cee3347@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a2fe35df
    • Jeff Johnson's avatar
      isdn: add missing MODULE_DESCRIPTION() macros · 2ebb87f4
      Jeff Johnson authored
      make allmodconfig && make W=1 C=1 reports:
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/hfcpci.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/hfcmulti.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/hfcsusb.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/avmfritz.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/speedfax.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/mISDNinfineon.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/w6692.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/netjet.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/mISDNipac.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/hardware/mISDN/mISDNisar.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/mISDN/mISDN_core.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/mISDN/mISDN_dsp.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/isdn/mISDN/l1oip.o
      
      Add the missing invocations of the MODULE_DESCRIPTION() macro.
      Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
      Link: https://lore.kernel.org/r/20240607-md-drivers-isdn-v1-1-81fb7001bc3a@quicinc.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2ebb87f4
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · b1156532
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2024-06-06
      
      We've added 54 non-merge commits during the last 10 day(s) which contain
      a total of 50 files changed, 1887 insertions(+), 527 deletions(-).
      
      The main changes are:
      
      1) Add a user space notification mechanism via epoll when a struct_ops
         object is getting detached/unregistered, from Kui-Feng Lee.
      
      2) Big batch of BPF selftest refactoring for sockmap and BPF congctl
         tests, from Geliang Tang.
      
      3) Add BTF field (type and string fields, right now) iterator support
         to libbpf instead of using existing callback-based approaches,
         from Andrii Nakryiko.
      
      4) Extend BPF selftests for the latter with a new btf_field_iter
         selftest, from Alan Maguire.
      
      5) Add new kfuncs for a generic, open-coded bits iterator,
         from Yafang Shao.
      
      6) Fix BPF selftests' kallsyms_find() helper under kernels configured
         with CONFIG_LTO_CLANG_THIN, from Yonghong Song.
      
      7) Remove a bunch of unused structs in BPF selftests,
         from David Alan Gilbert.
      
      8) Convert test_sockmap section names into names understood by libbpf
         so it can deduce program type and attach type, from Jakub Sitnicki.
      
      9) Extend libbpf with the ability to configure log verbosity
         via LIBBPF_LOG_LEVEL environment variable, from Mykyta Yatsenko.
      
      10) Fix BPF selftests with regards to bpf_cookie and find_vma flakiness
          in nested VMs, from Song Liu.
      
      11) Extend riscv32/64 JITs to introduce shift/add helpers to generate Zba
          optimization, from Xiao Wang.
      
      12) Enable BPF programs to declare arrays and struct fields with kptr,
          bpf_rb_root, and bpf_list_head, from Kui-Feng Lee.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (54 commits)
        selftests/bpf: Drop useless arguments of do_test in bpf_tcp_ca
        selftests/bpf: Use start_test in test_dctcp in bpf_tcp_ca
        selftests/bpf: Use start_test in test_dctcp_fallback in bpf_tcp_ca
        selftests/bpf: Add start_test helper in bpf_tcp_ca
        selftests/bpf: Use connect_to_fd_opts in do_test in bpf_tcp_ca
        libbpf: Auto-attach struct_ops BPF maps in BPF skeleton
        selftests/bpf: Add btf_field_iter selftests
        selftests/bpf: Fix send_signal test with nested CONFIG_PARAVIRT
        libbpf: Remove callback-based type/string BTF field visitor helpers
        bpftool: Use BTF field iterator in btfgen
        libbpf: Make use of BTF field iterator in BTF handling code
        libbpf: Make use of BTF field iterator in BPF linker code
        libbpf: Add BTF field iterator
        selftests/bpf: Ignore .llvm.<hash> suffix in kallsyms_find()
        selftests/bpf: Fix bpf_cookie and find_vma in nested VM
        selftests/bpf: Test global bpf_list_head arrays.
        selftests/bpf: Test global bpf_rb_root arrays and fields in nested struct types.
        selftests/bpf: Test kptr arrays and kptrs in nested struct fields.
        bpf: limit the number of levels of a nested struct type.
        bpf: look into the types of the fields of a struct type recursively.
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20240606223146.23020-1-daniel@iogearbox.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b1156532
    • Jakub Kicinski's avatar
      Merge tag 'wireless-next-2024-06-07' of... · 93d4e8bb
      Jakub Kicinski authored
      Merge tag 'wireless-next-2024-06-07' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
      
      Kalle Valo says:
      
      ====================
      wireless-next patches for v6.11
      
      The first "new features" pull request for v6.11 with changes both in
      stack and in drivers. Nothing out of ordinary, except that we have
      two conflicts this time:
      
      net/mac80211/cfg.c
        https://lore.kernel.org/all/20240531124415.05b25e7a@canb.auug.org.au
      
      drivers/net/wireless/microchip/wilc1000/netdev.c
        https://lore.kernel.org/all/20240603110023.23572803@canb.auug.org.au
      
      Major changes:
      
      cfg80211/mac80211
       * parse Transmit Power Envelope (TPE) data in mac80211 instead of in drivers
      
      wilc1000
       * read MAC address during probe to make it visible to user space
      
      iwlwifi
       * bump FW API to 91 for BZ/SC devices
       * report 64-bit radiotap timestamp
       * enable P2P low latency by default
       * handle Transmit Power Envelope (TPE) advertised by AP
       * start using guard()
      
      rtlwifi
       * RTL8192DU support
      
      ath12k
       * remove unsupported tx monitor handling
       * channel 2 in 6 GHz band support
       * Spatial Multiplexing Power Save (SMPS) in 6 GHz band support
       * multiple BSSID (MBSSID) and Enhanced Multi-BSSID Advertisements (EMA)
         support
       * dynamic VLAN support
       * add panic handler for resetting the firmware state
      
      ath10k
       * add qcom,no-msa-ready-indicator Device Tree property
       * LED support for various chipsets
      
      * tag 'wireless-next-2024-06-07' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (194 commits)
        wifi: ath12k: add hw_link_id in ath12k_pdev
        wifi: ath12k: add panic handler
        wifi: rtw89: chan: Use swap() in rtw89_swap_sub_entity()
        wifi: brcm80211: remove unused structs
        wifi: brcm80211: use sizeof(*pointer) instead of sizeof(type)
        wifi: ath12k: do not process consecutive RDDM event
        dt-bindings: net: wireless: ath11k: Drop "qcom,ipq8074-wcss-pil" from example
        wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup()
        wifi: rtlwifi: handle return value of usb init TX/RX
        wifi: rtlwifi: Enable the new rtl8192du driver
        wifi: rtlwifi: Add rtl8192du/sw.c
        wifi: rtlwifi: Constify rtl_hal_cfg.{ops,usb_interface_cfg} and rtl_priv.cfg
        wifi: rtlwifi: Add rtl8192du/dm.{c,h}
        wifi: rtlwifi: Add rtl8192du/fw.{c,h} and rtl8192du/led.{c,h}
        wifi: rtlwifi: Add rtl8192du/rf.{c,h}
        wifi: rtlwifi: Add rtl8192du/trx.{c,h}
        wifi: rtlwifi: Add rtl8192du/phy.{c,h}
        wifi: rtlwifi: Add rtl8192du/hw.{c,h}
        wifi: rtlwifi: Add new members to struct rtl_priv for RTL8192DU
        wifi: rtlwifi: Add rtl8192du/table.{c,h}
        ...
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      
      ====================
      
      Link: https://lore.kernel.org/r/20240607093517.41394C2BBFC@smtp.kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      93d4e8bb
  6. 10 Jun, 2024 3 commits
    • David S. Miller's avatar
      Merge branch 'fix-changing-dsa-conduit' · 2ba6d157
      David S. Miller authored
      Marek Behún says:
      
      ====================
      Fix changing DSA conduit
      
      This series fixes an issue in the DSA code related to host interface UC
      address installed into port FDB and port conduit address database when
      live-changing port conduit.
      
      The first patch refactores/deduplicates the installation/uninstallation
      of the interface's MAC address and the second patch fixes the issue.
      
      Cover letter for v1 and v2:
        https://patchwork.kernel.org/project/netdevbpf/cover/20240429163627.16031-1-kabel@kernel.org/
        https://patchwork.kernel.org/project/netdevbpf/cover/20240502122922.28139-1-kabel@kernel.org/
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2ba6d157
    • Marek Behún's avatar
      net: dsa: update the unicast MAC address when changing conduit · eef8e906
      Marek Behún authored
      When changing DSA user interface conduit while the user interface is up,
      DSA exhibits different behavior in comparison to when the interface is
      down. This different behavior concerns the primary unicast MAC address
      stored in the port standalone FDB and in the conduit device UC database.
      
      If we put a switch port down while changing the conduit with
        ip link set sw0p0 down
        ip link set sw0p0 type dsa conduit conduit1
        ip link set sw0p0 up
      we delete the address in dsa_user_close() and install the (possibly
      different) address in dsa_user_open().
      
      But when changing the conduit on the fly, the old address is not
      deleted and the new one is not installed.
      
      Since we explicitly want to support live-changing the conduit, uninstall
      the old address before calling dsa_port_assign_conduit() and install the
      (possibly different) new address after the call.
      
      Because conduit change might also trigger address change (the user
      interface is supposed to inherit the conduit interface MAC address if no
      address is defined in hardware (dp->mac is a zero address)), move the
      eth_hw_addr_inherit() call from dsa_user_change_conduit() to
      dsa_port_change_conduit(), just before installing the new address.
      
      Although this is in theory a flaw in DSA core, it needs not be
      backported, since there is currently no DSA driver that can be affected
      by this. The only DSA driver that supports changing conduit is felix,
      and, as explained by Vladimir Oltean [1]:
      
        There are 2 reasons why with felix the bug does not manifest itself.
      
        First is because both the 'ocelot' and the alternate 'ocelot-8021q'
        tagging protocols have the 'promisc_on_conduit = true' flag. So the
        unicast address doesn't have to be in the conduit's RX filter -
        neither the old or the new conduit.
      
        Second, dsa_user_host_uc_install() theoretically leaves behind host
        FDB entries installed towards the wrong (old) CPU port. But in
        felix_fdb_add(), we treat any FDB entry requested towards any CPU port
        as if it was a multicast FDB entry programmed towards _all_ CPU ports.
        For that reason, it is installed towards the port mask of the PGID_CPU
        port group ID:
      
      	if (dsa_port_is_cpu(dp))
      		port = PGID_CPU;
      
      Therefore no Fixes tag for this change.
      
      [1] https://lore.kernel.org/netdev/20240507201827.47suw4fwcjrbungy@skbuf/Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Tested-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eef8e906
    • Marek Behún's avatar
      net: dsa: deduplicate code adding / deleting the port address to fdb · 77f75412
      Marek Behún authored
      The sequence
        if (dsa_switch_supports_uc_filtering(ds))
          dsa_port_standalone_host_fdb_add(dp, addr, 0);
        if (!ether_addr_equal(addr, conduit->dev_addr))
          dev_uc_add(conduit, addr);
      is executed both in dsa_user_open() and dsa_user_set_mac_addr().
      
      Its reverse is executed both in dsa_user_close() and
      dsa_user_set_mac_addr().
      
      Refactor these sequences into new functions dsa_user_host_uc_install()
      and dsa_user_host_uc_uninstall().
      Signed-off-by: default avatarMarek Behún <kabel@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77f75412