Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
authorJakub Kicinski <kuba@kernel.org>
Fri, 10 Mar 2023 06:18:59 +0000 (22:18 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Mar 2023 06:22:11 +0000 (22:22 -0800)
Documentation/bpf/bpf_devel_QA.rst
  b7abcd9c656b ("bpf, doc: Link to submitting-patches.rst for general patch submission info")
  d56b0c461d19 ("bpf, docs: Fix link to netdev-FAQ target")
https://lore.kernel.org/all/20230307095812.236eb1be@canb.auug.org.au/

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1  2 
Documentation/bpf/bpf_devel_QA.rst
arch/mips/Kconfig
arch/riscv/net/bpf_jit_comp64.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/phy/smsc.c
io_uring/rsrc.c
kernel/bpf/btf.c
net/bpf/test_run.c
tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c

index 5f5f9ccc3862b4f9966581fe86fc078b6d4fbba1,b421d94dc9f216ab44e44f8eed0035c6e796df3f..7403f81c995cf9acd3a1234a18150dce6494e7cc
@@@ -7,8 -7,8 +7,8 @@@ workflows related to reporting bugs, su
  patches for stable kernels.
  
  For general information about submitting patches, please refer to
`Documentation/process/`_. This document only describes additional specifics
- related to BPF.
Documentation/process/submitting-patches.rst. This document only describes
additional specifics related to BPF.
  
  .. contents::
      :local:
@@@ -128,7 -128,7 +128,7 @@@ into the bpf-next tree will make their 
  net-next are both run by David S. Miller. From there, they will go
  into the kernel mainline tree run by Linus Torvalds. To read up on the
  process of net and net-next being merged into the mainline tree, see
 -the :ref:`netdev-FAQ`
 +the `netdev-FAQ`_.
  
  
  
@@@ -147,7 -147,7 +147,7 @@@ request):
  Q: How do I indicate which tree (bpf vs. bpf-next) my patch should be applied to?
  ---------------------------------------------------------------------------------
  
 -A: The process is the very same as described in the :ref:`netdev-FAQ`,
 +A: The process is the very same as described in the `netdev-FAQ`_,
  so please read up on it. The subject line must indicate whether the
  patch is a fix or rather "next-like" content in order to let the
  maintainers know whether it is targeted at bpf or bpf-next.
@@@ -206,7 -206,7 +206,7 @@@ ii) run extensive BPF test suite an
  Once the BPF pull request was accepted by David S. Miller, then
  the patches end up in net or net-next tree, respectively, and
  make their way from there further into mainline. Again, see the
 -:ref:`netdev-FAQ` for additional information e.g. on how often they are
 +`netdev-FAQ`_ for additional information e.g. on how often they are
  merged to mainline.
  
  Q: How long do I need to wait for feedback on my BPF patches?
@@@ -230,7 -230,7 +230,7 @@@ Q: Are patches applied to bpf-next whe
  -----------------------------------------------------------------
  A: For the time when the merge window is open, bpf-next will not be
  processed. This is roughly analogous to net-next patch processing,
 -so feel free to read up on the :ref:`netdev-FAQ` about further details.
 +so feel free to read up on the `netdev-FAQ`_ about further details.
  
  During those two weeks of merge window, we might ask you to resend
  your patch series once bpf-next is open again. Once Linus released
@@@ -394,7 -394,7 +394,7 @@@ netdev kernel mailing list in Cc and as
    netdev@vger.kernel.org
  
  The process in general is the same as on netdev itself, see also the
 -:ref:`netdev-FAQ`.
 +`netdev-FAQ`_.
  
  Q: Do you also backport to kernels not currently maintained as stable?
  ----------------------------------------------------------------------
@@@ -410,7 -410,7 +410,7 @@@ Q: The BPF patch I am about to submit n
  What should I do?
  
  A: The same rules apply as with netdev patch submissions in general, see
 -the :ref:`netdev-FAQ`.
 +the `netdev-FAQ`_.
  
  Never add "``Cc: stable@vger.kernel.org``" to the patch description, but
  ask the BPF maintainers to queue the patches instead. This can be done
@@@ -461,15 -461,15 +461,15 @@@ needed:
  
    $ sudo make run_tests
  
- See the kernels selftest `Documentation/dev-tools/kselftest.rst`_
document for further documentation.
+ See :doc:`kernel selftest documentation </dev-tools/kselftest>`
for details.
  
  To maximize the number of tests passing, the .config of the kernel
  under test should match the config file fragment in
  tools/testing/selftests/bpf as closely as possible.
  
  Finally to ensure support for latest BPF Type Format features -
- discussed in `Documentation/bpf/btf.rst`_ - pahole version 1.16
+ discussed in Documentation/bpf/btf.rst - pahole version 1.16
  is required for kernels built with CONFIG_DEBUG_INFO_BTF=y.
  pahole is delivered in the dwarves package or can be built
  from source at
@@@ -684,12 -684,8 +684,8 @@@ when
  
  
  .. Links
- .. _Documentation/process/: https://www.kernel.org/doc/html/latest/process/
 -.. _netdev-FAQ: Documentation/process/maintainer-netdev.rst
 +.. _netdev-FAQ: https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
  .. _selftests:
     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/bpf/
- .. _Documentation/dev-tools/kselftest.rst:
-    https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html
- .. _Documentation/bpf/btf.rst: btf.rst
  
  Happy BPF hacking!
diff --combined arch/mips/Kconfig
index 5ea07c833c5be9296b7a93958887e62b09fc2642,e2f3ca73f40d6542fc711cba3d502a06f284ad23..459dc6023cf857a16ef184f48debd10f07d0c200
@@@ -63,7 -63,10 +63,7 @@@ config MIP
        select HAVE_DEBUG_STACKOVERFLOW
        select HAVE_DMA_CONTIGUOUS
        select HAVE_DYNAMIC_FTRACE
 -      select HAVE_EBPF_JIT if !CPU_MICROMIPS && \
 -                              !CPU_DADDI_WORKAROUNDS && \
 -                              !CPU_R4000_WORKAROUNDS && \
 -                              !CPU_R4400_WORKAROUNDS
 +      select HAVE_EBPF_JIT if !CPU_MICROMIPS
        select HAVE_EXIT_THREAD
        select HAVE_FAST_GUP
        select HAVE_FTRACE_MCOUNT_RECORD
@@@ -607,7 -610,6 +607,6 @@@ config RALIN
        select DMA_NONCOHERENT
        select IRQ_MIPS_CPU
        select USE_OF
-       select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@@ -1077,11 -1079,6 +1076,6 @@@ config FW_CF
  config ARCH_SUPPORTS_UPROBES
        bool
  
- config DMA_PERDEV_COHERENT
-       bool
-       select ARCH_HAS_SETUP_DMA_OPS
-       select DMA_NONCOHERENT
  config DMA_NONCOHERENT
        bool
        #
@@@ -3203,6 -3200,10 +3197,10 @@@ config CC_HAS_MNO_BRANCH_LIKEL
        def_bool y
        depends on $(cc-option,-mno-branch-likely)
  
+ # https://github.com/llvm/llvm-project/issues/61045
+ config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH
+       def_bool y if CC_IS_CLANG
  menu "Power management options"
  
  config ARCH_HIBERNATION_POSSIBLE
index a9270366dc5772cad60ee05e8d5ebdc5773f7b5c,acdc3f040195e011634805de7027de18da05a180..c648864c8cd1ac1b79120f9dc966d783ff496e6f
@@@ -10,6 -10,7 +10,7 @@@
  #include <linux/filter.h>
  #include <linux/memory.h>
  #include <linux/stop_machine.h>
+ #include <asm/patch.h>
  #include "bpf_jit.h"
  
  #define RV_REG_TCC RV_REG_A6
@@@ -1751,8 -1752,3 +1752,8 @@@ void bpf_jit_build_epilogue(struct rv_j
  {
        __build_epilogue(false, ctx);
  }
 +
 +bool bpf_jit_supports_kfunc_call(void)
 +{
 +      return true;
 +}
index 7245fee13ad0566de78923fe4b1c8f0163505076,808236dc898b8d15fe41dc7f508fe40e87a13000..dceaecab660558c60f6b6dd169b877b17dee09c2
@@@ -48,6 -48,7 +48,6 @@@
  #include <linux/prefetch.h>
  #include <linux/cache.h>
  #include <linux/log2.h>
 -#include <linux/aer.h>
  #include <linux/bitmap.h>
  #include <linux/cpu_rmap.h>
  #include <linux/cpumask.h>
@@@ -3144,7 -3145,7 +3144,7 @@@ static int bnxt_alloc_ring(struct bnxt 
  
  static void bnxt_free_tpa_info(struct bnxt *bp)
  {
-       int i;
+       int i, j;
  
        for (i = 0; i < bp->rx_nr_rings; i++) {
                struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i];
                kfree(rxr->rx_tpa_idx_map);
                rxr->rx_tpa_idx_map = NULL;
                if (rxr->rx_tpa) {
-                       kfree(rxr->rx_tpa[0].agg_arr);
-                       rxr->rx_tpa[0].agg_arr = NULL;
+                       for (j = 0; j < bp->max_tpa; j++) {
+                               kfree(rxr->rx_tpa[j].agg_arr);
+                               rxr->rx_tpa[j].agg_arr = NULL;
+                       }
                }
                kfree(rxr->rx_tpa);
                rxr->rx_tpa = NULL;
  
  static int bnxt_alloc_tpa_info(struct bnxt *bp)
  {
-       int i, j, total_aggs = 0;
+       int i, j;
  
        bp->max_tpa = MAX_TPA;
        if (bp->flags & BNXT_FLAG_CHIP_P5) {
                if (!bp->max_tpa_v2)
                        return 0;
                bp->max_tpa = max_t(u16, bp->max_tpa_v2, MAX_TPA_P5);
-               total_aggs = bp->max_tpa * MAX_SKB_FRAGS;
        }
  
        for (i = 0; i < bp->rx_nr_rings; i++) {
  
                if (!(bp->flags & BNXT_FLAG_CHIP_P5))
                        continue;
-               agg = kcalloc(total_aggs, sizeof(*agg), GFP_KERNEL);
-               rxr->rx_tpa[0].agg_arr = agg;
-               if (!agg)
-                       return -ENOMEM;
-               for (j = 1; j < bp->max_tpa; j++)
-                       rxr->rx_tpa[j].agg_arr = agg + j * MAX_SKB_FRAGS;
+               for (j = 0; j < bp->max_tpa; j++) {
+                       agg = kcalloc(MAX_SKB_FRAGS, sizeof(*agg), GFP_KERNEL);
+                       if (!agg)
+                               return -ENOMEM;
+                       rxr->rx_tpa[j].agg_arr = agg;
+               }
                rxr->rx_tpa_idx_map = kzalloc(sizeof(*rxr->rx_tpa_idx_map),
                                              GFP_KERNEL);
                if (!rxr->rx_tpa_idx_map)
@@@ -12705,6 -12707,8 +12706,6 @@@ static int bnxt_init_board(struct pci_d
                goto init_err_release;
        }
  
 -      pci_enable_pcie_error_reporting(pdev);
 -
        INIT_WORK(&bp->sp_task, bnxt_sp_task);
        INIT_DELAYED_WORK(&bp->fw_reset_task, bnxt_fw_reset_task);
  
@@@ -13184,6 -13188,7 +13185,6 @@@ static void bnxt_remove_one(struct pci_
        bnxt_rdma_aux_device_uninit(bp);
  
        bnxt_ptp_clear(bp);
 -      pci_disable_pcie_error_reporting(pdev);
        unregister_netdev(dev);
        clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
        /* Flush any pending tasks */
        bnxt_free_hwrm_resources(bp);
        bnxt_ethtool_free(bp);
        bnxt_dcb_free(bp);
-       kfree(bp->edev);
-       bp->edev = NULL;
        kfree(bp->ptp_cfg);
        bp->ptp_cfg = NULL;
        kfree(bp->fw_health);
index b22cd160554ee3c96eb9227e5ff16d67ec200f22,3cb43623d3dbe9d2677bee3fd067c4ced5c07585..52aa71f0c499dd0a87950d719acc6d8c1e333b1b
@@@ -374,6 -374,17 +374,6 @@@ static int mt7621_gmac0_rgmii_adjust(st
  {
        u32 val;
  
 -      /* Check DDR memory type.
 -       * Currently TRGMII mode with DDR2 memory is not supported.
 -       */
 -      regmap_read(eth->ethsys, ETHSYS_SYSCFG, &val);
 -      if (interface == PHY_INTERFACE_MODE_TRGMII &&
 -          val & SYSCFG_DRAM_TYPE_DDR2) {
 -              dev_err(eth->dev,
 -                      "TRGMII mode with DDR2 memory is not supported!\n");
 -              return -EOPNOTSUPP;
 -      }
 -
        val = (interface == PHY_INTERFACE_MODE_TRGMII) ?
                ETHSYS_TRGMII_MT7621_DDR_PLL : 0;
  
  static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth,
                                   phy_interface_t interface, int speed)
  {
 -      u32 val;
 +      unsigned long rate;
 +      u32 tck, rck, intf;
        int ret;
  
        if (interface == PHY_INTERFACE_MODE_TRGMII) {
                mtk_w32(eth, TRGMII_MODE, INTF_MODE);
 -              val = 500000000;
 -              ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val);
 +              ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], 500000000);
                if (ret)
                        dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret);
                return;
        }
  
 -      val = (speed == SPEED_1000) ?
 -              INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100;
 -      mtk_w32(eth, val, INTF_MODE);
 +      if (speed == SPEED_1000) {
 +              intf = INTF_MODE_RGMII_1000;
 +              rate = 250000000;
 +              rck = RCK_CTRL_RGMII_1000;
 +              tck = TCK_CTRL_RGMII_1000;
 +      } else {
 +              intf = INTF_MODE_RGMII_10_100;
 +              rate = 500000000;
 +              rck = RCK_CTRL_RGMII_10_100;
 +              tck = TCK_CTRL_RGMII_10_100;
 +      }
 +
 +      mtk_w32(eth, intf, INTF_MODE);
  
        regmap_update_bits(eth->ethsys, ETHSYS_CLKCFG0,
                           ETHSYS_TRGMII_CLK_SEL362_5,
                           ETHSYS_TRGMII_CLK_SEL362_5);
  
 -      val = (speed == SPEED_1000) ? 250000000 : 500000000;
 -      ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val);
 +      ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], rate);
        if (ret)
                dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret);
  
 -      val = (speed == SPEED_1000) ?
 -              RCK_CTRL_RGMII_1000 : RCK_CTRL_RGMII_10_100;
 -      mtk_w32(eth, val, TRGMII_RCK_CTRL);
 -
 -      val = (speed == SPEED_1000) ?
 -              TCK_CTRL_RGMII_1000 : TCK_CTRL_RGMII_10_100;
 -      mtk_w32(eth, val, TRGMII_TCK_CTRL);
 +      mtk_w32(eth, rck, TRGMII_RCK_CTRL);
 +      mtk_w32(eth, tck, TRGMII_TCK_CTRL);
  }
  
  static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config,
@@@ -458,11 -465,19 +458,11 @@@ static void mtk_mac_config(struct phyli
                /* Setup soc pin functions */
                switch (state->interface) {
                case PHY_INTERFACE_MODE_TRGMII:
 -                      if (mac->id)
 -                              goto err_phy;
 -                      if (!MTK_HAS_CAPS(mac->hw->soc->caps,
 -                                        MTK_GMAC1_TRGMII))
 -                              goto err_phy;
 -                      fallthrough;
                case PHY_INTERFACE_MODE_RGMII_TXID:
                case PHY_INTERFACE_MODE_RGMII_RXID:
                case PHY_INTERFACE_MODE_RGMII_ID:
                case PHY_INTERFACE_MODE_RGMII:
                case PHY_INTERFACE_MODE_MII:
 -              case PHY_INTERFACE_MODE_REVMII:
 -              case PHY_INTERFACE_MODE_RMII:
                        if (MTK_HAS_CAPS(eth->soc->caps, MTK_RGMII)) {
                                err = mtk_gmac_rgmii_path_setup(eth, mac->id);
                                if (err)
                case PHY_INTERFACE_MODE_1000BASEX:
                case PHY_INTERFACE_MODE_2500BASEX:
                case PHY_INTERFACE_MODE_SGMII:
 -                      if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) {
 -                              err = mtk_gmac_sgmii_path_setup(eth, mac->id);
 -                              if (err)
 -                                      goto init_err;
 -                      }
 +                      err = mtk_gmac_sgmii_path_setup(eth, mac->id);
 +                      if (err)
 +                              goto init_err;
                        break;
                case PHY_INTERFACE_MODE_GMII:
                        if (MTK_HAS_CAPS(eth->soc->caps, MTK_GEPHY)) {
                        }
                }
  
 -              ge_mode = 0;
                switch (state->interface) {
                case PHY_INTERFACE_MODE_MII:
                case PHY_INTERFACE_MODE_GMII:
                        ge_mode = 1;
                        break;
 -              case PHY_INTERFACE_MODE_REVMII:
 -                      ge_mode = 2;
 -                      break;
 -              case PHY_INTERFACE_MODE_RMII:
 -                      if (mac->id)
 -                              goto err_phy;
 -                      ge_mode = 3;
 -                      break;
                default:
 +                      ge_mode = 0;
                        break;
                }
  
@@@ -591,7 -616,8 +591,8 @@@ static int mtk_mac_finish(struct phylin
        mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
        mcr_new = mcr_cur;
        mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE |
-                  MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK;
+                  MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK |
+                  MAC_MCR_RX_FIFO_CLR_DIS;
  
        /* Only update control register when needed! */
        if (mcr_new != mcr_cur)
@@@ -4304,7 -4330,6 +4305,7 @@@ static int mtk_add_mac(struct mtk_eth *
        struct mtk_mac *mac;
        int id, err;
        int txqs = 1;
 +      u32 val;
  
        if (!_id) {
                dev_err(eth->dev, "missing mac id\n");
                __set_bit(PHY_INTERFACE_MODE_TRGMII,
                          mac->phylink_config.supported_interfaces);
  
 +      /* TRGMII is not permitted on MT7621 if using DDR2 */
 +      if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_GMAC1_TRGMII) &&
 +          MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII_MT7621_CLK)) {
 +              regmap_read(eth->ethsys, ETHSYS_SYSCFG, &val);
 +              if (val & SYSCFG_DRAM_TYPE_DDR2)
 +                      __clear_bit(PHY_INTERFACE_MODE_TRGMII,
 +                                  mac->phylink_config.supported_interfaces);
 +      }
 +
        if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_SGMII)) {
                __set_bit(PHY_INTERFACE_MODE_SGMII,
                          mac->phylink_config.supported_interfaces);
diff --combined drivers/net/phy/smsc.c
index af89f3ef1c4fe479a00ec81237d9881fc0ee87dc,00d9eff91dcfaf34c4fae700e6d7dbcbc97f22cd..feb6ac3939ac4f54459ac0d924f2acd215de8928
@@@ -44,7 -44,6 +44,6 @@@ static struct smsc_hw_stat smsc_hw_stat
  };
  
  struct smsc_phy_priv {
-       u16 intmask;
        bool energy_enable;
  };
  
@@@ -57,7 -56,6 +56,6 @@@ static int smsc_phy_ack_interrupt(struc
  
  static int smsc_phy_config_intr(struct phy_device *phydev)
  {
-       struct smsc_phy_priv *priv = phydev->priv;
        int rc;
  
        if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
                if (rc)
                        return rc;
  
-               priv->intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6;
-               if (priv->energy_enable)
-                       priv->intmask |= MII_LAN83C185_ISF_INT7;
-               rc = phy_write(phydev, MII_LAN83C185_IM, priv->intmask);
+               rc = phy_write(phydev, MII_LAN83C185_IM,
+                              MII_LAN83C185_ISF_INT_PHYLIB_EVENTS);
        } else {
-               priv->intmask = 0;
                rc = phy_write(phydev, MII_LAN83C185_IM, 0);
                if (rc)
                        return rc;
@@@ -85,7 -78,6 +78,6 @@@
  
  static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
  {
-       struct smsc_phy_priv *priv = phydev->priv;
        int irq_status;
  
        irq_status = phy_read(phydev, MII_LAN83C185_ISF);
@@@ -96,7 -88,7 +88,7 @@@
                return IRQ_NONE;
        }
  
-       if (!(irq_status & priv->intmask))
+       if (!(irq_status & MII_LAN83C185_ISF_INT_PHYLIB_EVENTS))
                return IRQ_NONE;
  
        phy_trigger_machine(phydev);
@@@ -178,15 -170,18 +170,15 @@@ static int lan87xx_config_aneg(struct p
  
  static int lan95xx_config_aneg_ext(struct phy_device *phydev)
  {
 -      int rc;
 -
 -      if (phydev->phy_id != 0x0007c0f0) /* not (LAN9500A or LAN9505A) */
 -              return lan87xx_config_aneg(phydev);
 +      if (phydev->phy_id == 0x0007c0f0) { /* LAN9500A or LAN9505A */
 +              /* Extend Manual AutoMDIX timer */
 +              int rc = phy_set_bits(phydev, PHY_EDPD_CONFIG,
 +                                    PHY_EDPD_CONFIG_EXT_CROSSOVER_);
  
 -      /* Extend Manual AutoMDIX timer */
 -      rc = phy_read(phydev, PHY_EDPD_CONFIG);
 -      if (rc < 0)
 -              return rc;
 +              if (rc < 0)
 +                      return rc;
 +      }
  
 -      rc |= PHY_EDPD_CONFIG_EXT_CROSSOVER_;
 -      phy_write(phydev, PHY_EDPD_CONFIG, rc);
        return lan87xx_config_aneg(phydev);
  }
  
diff --combined io_uring/rsrc.c
index 27ceda3b50cf4e677cde5e2417a80adad66e162f,056f40946ff68ff8d2d72781c5bdc9e3e303cea4..2e0a14e87187ff401b60fb094e9e603502f3437f
@@@ -867,7 -867,8 +867,7 @@@ int __io_scm_file_account(struct io_rin
  
                UNIXCB(skb).fp = fpl;
                skb->sk = sk;
 -              skb->scm_io_uring = 1;
 -              skb->destructor = unix_destruct_scm;
 +              skb->destructor = io_uring_destruct_scm;
                refcount_add(skb->truesize, &sk->sk_wmem_alloc);
        }
  
@@@ -1161,14 -1162,17 +1161,17 @@@ struct page **io_pin_pages(unsigned lon
        pret = pin_user_pages(ubuf, nr_pages, FOLL_WRITE | FOLL_LONGTERM,
                              pages, vmas);
        if (pret == nr_pages) {
+               struct file *file = vmas[0]->vm_file;
                /* don't support file backed memory */
                for (i = 0; i < nr_pages; i++) {
-                       struct vm_area_struct *vma = vmas[i];
-                       if (vma_is_shmem(vma))
+                       if (vmas[i]->vm_file != file) {
+                               ret = -EINVAL;
+                               break;
+                       }
+                       if (!file)
                                continue;
-                       if (vma->vm_file &&
-                           !is_file_hugepages(vma->vm_file)) {
+                       if (!vma_is_shmem(vmas[i]) && !is_file_hugepages(file)) {
                                ret = -EOPNOTSUPP;
                                break;
                        }
@@@ -1206,6 -1210,7 +1209,7 @@@ static int io_sqe_buffer_register(struc
        unsigned long off;
        size_t size;
        int ret, nr_pages, i;
+       struct folio *folio = NULL;
  
        *pimu = ctx->dummy_ubuf;
        if (!iov->iov_base)
                goto done;
        }
  
+       /* If it's a huge page, try to coalesce them into a single bvec entry */
+       if (nr_pages > 1) {
+               folio = page_folio(pages[0]);
+               for (i = 1; i < nr_pages; i++) {
+                       if (page_folio(pages[i]) != folio) {
+                               folio = NULL;
+                               break;
+                       }
+               }
+               if (folio) {
+                       folio_put_refs(folio, nr_pages - 1);
+                       nr_pages = 1;
+               }
+       }
        imu = kvmalloc(struct_size(imu, bvec, nr_pages), GFP_KERNEL);
        if (!imu)
                goto done;
  
        off = (unsigned long) iov->iov_base & ~PAGE_MASK;
        size = iov->iov_len;
+       /* store original address for later verification */
+       imu->ubuf = (unsigned long) iov->iov_base;
+       imu->ubuf_end = imu->ubuf + iov->iov_len;
+       imu->nr_bvecs = nr_pages;
+       *pimu = imu;
+       ret = 0;
+       if (folio) {
+               bvec_set_page(&imu->bvec[0], pages[0], size, off);
+               goto done;
+       }
        for (i = 0; i < nr_pages; i++) {
                size_t vec_len;
  
                off = 0;
                size -= vec_len;
        }
-       /* store original address for later verification */
-       imu->ubuf = (unsigned long) iov->iov_base;
-       imu->ubuf_end = imu->ubuf + iov->iov_len;
-       imu->nr_bvecs = nr_pages;
-       *pimu = imu;
-       ret = 0;
  done:
        if (ret)
                kvfree(imu);
@@@ -1334,7 -1359,7 +1358,7 @@@ int io_import_fixed(int ddir, struct io
                return -EFAULT;
  
        /*
-        * May not be a start of buffer, set size appropriately
+        * Might not be a start of buffer, set size appropriately
         * and advance us to the beginning.
         */
        offset = buf_addr - imu->ubuf;
                const struct bio_vec *bvec = imu->bvec;
  
                if (offset <= bvec->bv_len) {
-                       iov_iter_advance(iter, offset);
+                       /*
+                        * Note, huge pages buffers consists of one large
+                        * bvec entry and should always go this way. The other
+                        * branch doesn't expect non PAGE_SIZE'd chunks.
+                        */
+                       iter->bvec = bvec;
+                       iter->nr_segs = bvec->bv_len;
+                       iter->count -= offset;
+                       iter->iov_offset = offset;
                } else {
                        unsigned long seg_skip;
  
diff --combined kernel/bpf/btf.c
index a8cb09e5973b777e8f2de427180a4d2db9c5e28e,73780748404c29bfd6b4d2284b2aff615093497f..1853beaed4beecfd49ea1bf5aa56ba6f013c7c74
@@@ -207,11 -207,6 +207,11 @@@ enum btf_kfunc_hook 
        BTF_KFUNC_HOOK_TRACING,
        BTF_KFUNC_HOOK_SYSCALL,
        BTF_KFUNC_HOOK_FMODRET,
 +      BTF_KFUNC_HOOK_CGROUP_SKB,
 +      BTF_KFUNC_HOOK_SCHED_ACT,
 +      BTF_KFUNC_HOOK_SK_SKB,
 +      BTF_KFUNC_HOOK_SOCKET_FILTER,
 +      BTF_KFUNC_HOOK_LWT,
        BTF_KFUNC_HOOK_MAX,
  };
  
@@@ -3288,9 -3283,9 +3288,9 @@@ static int btf_find_kptr(const struct b
        /* Reject extra tags */
        if (btf_type_is_type_tag(btf_type_by_id(btf, t->type)))
                return -EINVAL;
 -      if (!strcmp("kptr", __btf_name_by_offset(btf, t->name_off)))
 +      if (!strcmp("kptr_untrusted", __btf_name_by_offset(btf, t->name_off)))
                type = BPF_KPTR_UNREF;
 -      else if (!strcmp("kptr_ref", __btf_name_by_offset(btf, t->name_off)))
 +      else if (!strcmp("kptr", __btf_name_by_offset(btf, t->name_off)))
                type = BPF_KPTR_REF;
        else
                return -EINVAL;
@@@ -4574,6 -4569,7 +4574,7 @@@ static int btf_datasec_resolve(struct b
        struct btf *btf = env->btf;
        u16 i;
  
+       env->resolve_mode = RESOLVE_TBD;
        for_each_vsi_from(i, v->next_member, v->t, vsi) {
                u32 var_type_id = vsi->type, type_id, type_size = 0;
                const struct btf_type *var_type = btf_type_by_id(env->btf,
@@@ -5688,10 -5684,6 +5689,10 @@@ again
         * int socket_filter_bpf_prog(struct __sk_buff *skb)
         * { // no fields of skb are ever used }
         */
 +      if (strcmp(ctx_tname, "__sk_buff") == 0 && strcmp(tname, "sk_buff") == 0)
 +              return ctx_type;
 +      if (strcmp(ctx_tname, "xdp_md") == 0 && strcmp(tname, "xdp_buff") == 0)
 +              return ctx_type;
        if (strcmp(ctx_tname, tname)) {
                /* bpf_user_pt_regs_t is a typedef, so resolve it to
                 * underlying struct and check name again
@@@ -6163,7 -6155,6 +6164,7 @@@ static int btf_struct_walk(struct bpf_v
        const char *tname, *mname, *tag_value;
        u32 vlen, elem_id, mid;
  
 +      *flag = 0;
  again:
        tname = __btf_name_by_offset(btf, t->name_off);
        if (!btf_type_is_struct(t)) {
@@@ -6330,15 -6321,6 +6331,15 @@@ error
                 * of this field or inside of this struct
                 */
                if (btf_type_is_struct(mtype)) {
 +                      if (BTF_INFO_KIND(mtype->info) == BTF_KIND_UNION &&
 +                          btf_type_vlen(mtype) != 1)
 +                              /*
 +                               * walking unions yields untrusted pointers
 +                               * with exception of __bpf_md_ptr and other
 +                               * unions with a single member
 +                               */
 +                              *flag |= PTR_UNTRUSTED;
 +
                        /* our field must be inside that union or struct */
                        t = mtype;
  
                        stype = btf_type_skip_modifiers(btf, mtype->type, &id);
                        if (btf_type_is_struct(stype)) {
                                *next_btf_id = id;
 -                              *flag = tmp_flag;
 +                              *flag |= tmp_flag;
                                return WALK_PTR;
                        }
                }
@@@ -7723,19 -7705,6 +7724,19 @@@ static int bpf_prog_type_to_kfunc_hook(
                return BTF_KFUNC_HOOK_TRACING;
        case BPF_PROG_TYPE_SYSCALL:
                return BTF_KFUNC_HOOK_SYSCALL;
 +      case BPF_PROG_TYPE_CGROUP_SKB:
 +              return BTF_KFUNC_HOOK_CGROUP_SKB;
 +      case BPF_PROG_TYPE_SCHED_ACT:
 +              return BTF_KFUNC_HOOK_SCHED_ACT;
 +      case BPF_PROG_TYPE_SK_SKB:
 +              return BTF_KFUNC_HOOK_SK_SKB;
 +      case BPF_PROG_TYPE_SOCKET_FILTER:
 +              return BTF_KFUNC_HOOK_SOCKET_FILTER;
 +      case BPF_PROG_TYPE_LWT_OUT:
 +      case BPF_PROG_TYPE_LWT_IN:
 +      case BPF_PROG_TYPE_LWT_XMIT:
 +      case BPF_PROG_TYPE_LWT_SEG6LOCAL:
 +              return BTF_KFUNC_HOOK_LWT;
        default:
                return BTF_KFUNC_HOOK_MAX;
        }
@@@ -8367,7 -8336,7 +8368,7 @@@ out
  
  bool btf_nested_type_is_trusted(struct bpf_verifier_log *log,
                                const struct bpf_reg_state *reg,
 -                              int off)
 +                              int off, const char *suffix)
  {
        struct btf *btf = reg->btf;
        const struct btf_type *walk_type, *safe_type;
  
        tname = btf_name_by_offset(btf, walk_type->name_off);
  
 -      ret = snprintf(safe_tname, sizeof(safe_tname), "%s__safe_fields", tname);
 +      ret = snprintf(safe_tname, sizeof(safe_tname), "%s%s", tname, suffix);
        if (ret < 0)
                return false;
  
diff --combined net/bpf/test_run.c
index 6a8b33a103a40bed2a79ee60cc905cc45828f42c,f81b24320a36e139f71689075e87d2413cd54a89..d350f31c7a3df2c1b7a656cced8f377c87380307
@@@ -97,8 -97,11 +97,11 @@@ reset
  struct xdp_page_head {
        struct xdp_buff orig_ctx;
        struct xdp_buff ctx;
-       struct xdp_frame frm;
-       u8 data[];
+       union {
+               /* ::data_hard_start starts here */
+               DECLARE_FLEX_ARRAY(struct xdp_frame, frame);
+               DECLARE_FLEX_ARRAY(u8, data);
+       };
  };
  
  struct xdp_test_data {
        u32 frame_cnt;
  };
  
+ /* tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c:%MAX_PKT_SIZE
+  * must be updated accordingly this gets changed, otherwise BPF selftests
+  * will fail.
+  */
  #define TEST_XDP_FRAME_SIZE (PAGE_SIZE - sizeof(struct xdp_page_head))
  #define TEST_XDP_MAX_BATCH 256
  
@@@ -132,8 -139,8 +139,8 @@@ static void xdp_test_run_init_page(stru
        headroom -= meta_len;
  
        new_ctx = &head->ctx;
-       frm = &head->frm;
-       data = &head->data;
+       frm = head->frame;
+       data = head->data;
        memcpy(data + headroom, orig_ctx->data_meta, frm_len);
  
        xdp_init_buff(new_ctx, TEST_XDP_FRAME_SIZE, &xdp->rxq);
@@@ -223,7 -230,7 +230,7 @@@ static void reset_ctx(struct xdp_page_h
        head->ctx.data = head->orig_ctx.data;
        head->ctx.data_meta = head->orig_ctx.data_meta;
        head->ctx.data_end = head->orig_ctx.data_end;
-       xdp_update_frame_from_buff(&head->ctx, &head->frm);
+       xdp_update_frame_from_buff(&head->ctx, head->frame);
  }
  
  static int xdp_recv_frames(struct xdp_frame **frames, int nframes,
@@@ -285,7 -292,7 +292,7 @@@ static int xdp_test_run_batch(struct xd
                head = phys_to_virt(page_to_phys(page));
                reset_ctx(head);
                ctx = &head->ctx;
-               frm = &head->frm;
+               frm = head->frame;
                xdp->frame_cnt++;
  
                act = bpf_prog_run_xdp(prog, ctx);
@@@ -737,7 -744,6 +744,7 @@@ __bpf_kfunc void bpf_kfunc_call_test_me
  
  __bpf_kfunc void bpf_kfunc_call_test_ref(struct prog_test_ref_kfunc *p)
  {
 +      /* p != NULL, but p->cnt could be 0 */
  }
  
  __bpf_kfunc void bpf_kfunc_call_test_destructive(void)
@@@ -785,7 -791,7 +792,7 @@@ BTF_ID_FLAGS(func, bpf_kfunc_call_test_
  BTF_ID_FLAGS(func, bpf_kfunc_call_test_mem_len_pass1)
  BTF_ID_FLAGS(func, bpf_kfunc_call_test_mem_len_fail1)
  BTF_ID_FLAGS(func, bpf_kfunc_call_test_mem_len_fail2)
 -BTF_ID_FLAGS(func, bpf_kfunc_call_test_ref, KF_TRUSTED_ARGS)
 +BTF_ID_FLAGS(func, bpf_kfunc_call_test_ref, KF_TRUSTED_ARGS | KF_RCU)
  BTF_ID_FLAGS(func, bpf_kfunc_call_test_destructive, KF_DESTRUCTIVE)
  BTF_ID_FLAGS(func, bpf_kfunc_call_test_static_unused_arg)
  BTF_SET8_END(test_sk_check_kfunc_ids)
index 856cbc29e6a1d2b82dc6ca9f07312c4cfa1f6a9f,7271a18ab3e22d0d637ef0e00518a9afdee6539c..662b6c6c5ed7864a754f31fab1efeb8269c79734
  #include <uapi/linux/netdev.h>
  #include "test_xdp_do_redirect.skel.h"
  
 -#define SYS(fmt, ...)                                         \
 -      ({                                                      \
 -              char cmd[1024];                                 \
 -              snprintf(cmd, sizeof(cmd), fmt, ##__VA_ARGS__); \
 -              if (!ASSERT_OK(system(cmd), cmd))               \
 -                      goto out;                               \
 -      })
 -
  struct udp_packet {
        struct ethhdr eth;
        struct ipv6hdr iph;
@@@ -57,12 -65,13 +57,13 @@@ static int attach_tc_prog(struct bpf_tc
  }
  
  /* The maximum permissible size is: PAGE_SIZE - sizeof(struct xdp_page_head) -
-  * sizeof(struct skb_shared_info) - XDP_PACKET_HEADROOM = 3368 bytes
+  * SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - XDP_PACKET_HEADROOM =
+  * 3408 bytes for 64-byte cacheline and 3216 for 256-byte one.
   */
  #if defined(__s390x__)
- #define MAX_PKT_SIZE 3176
+ #define MAX_PKT_SIZE 3216
  #else
- #define MAX_PKT_SIZE 3368
+ #define MAX_PKT_SIZE 3408
  #endif
  static void test_max_pkt_size(int fd)
  {
@@@ -118,19 -127,19 +119,19 @@@ void test_xdp_do_redirect(void
         * iface and NUM_PKTS-2 in the TC hook. We match the packets on the UDP
         * payload.
         */
 -      SYS("ip netns add testns");
 +      SYS(out, "ip netns add testns");
        nstoken = open_netns("testns");
        if (!ASSERT_OK_PTR(nstoken, "setns"))
                goto out;
  
 -      SYS("ip link add veth_src type veth peer name veth_dst");
 -      SYS("ip link set dev veth_src address 00:11:22:33:44:55");
 -      SYS("ip link set dev veth_dst address 66:77:88:99:aa:bb");
 -      SYS("ip link set dev veth_src up");
 -      SYS("ip link set dev veth_dst up");
 -      SYS("ip addr add dev veth_src fc00::1/64");
 -      SYS("ip addr add dev veth_dst fc00::2/64");
 -      SYS("ip neigh add fc00::2 dev veth_src lladdr 66:77:88:99:aa:bb");
 +      SYS(out, "ip link add veth_src type veth peer name veth_dst");
 +      SYS(out, "ip link set dev veth_src address 00:11:22:33:44:55");
 +      SYS(out, "ip link set dev veth_dst address 66:77:88:99:aa:bb");
 +      SYS(out, "ip link set dev veth_src up");
 +      SYS(out, "ip link set dev veth_dst up");
 +      SYS(out, "ip addr add dev veth_src fc00::1/64");
 +      SYS(out, "ip addr add dev veth_dst fc00::2/64");
 +      SYS(out, "ip neigh add fc00::2 dev veth_src lladdr 66:77:88:99:aa:bb");
  
        /* We enable forwarding in the test namespace because that will cause
         * the packets that go through the kernel stack (with XDP_PASS) to be
         * code didn't have this, so we keep the test behaviour to make sure the
         * bug doesn't resurface.
         */
 -      SYS("sysctl -qw net.ipv6.conf.all.forwarding=1");
 +      SYS(out, "sysctl -qw net.ipv6.conf.all.forwarding=1");
  
        ifindex_src = if_nametoindex("veth_src");
        ifindex_dst = if_nametoindex("veth_dst");
@@@ -217,6 -226,6 +218,6 @@@ out_tc
  out:
        if (nstoken)
                close_netns(nstoken);
 -      system("ip netns del testns");
 +      SYS_NOFAIL("ip netns del testns");
        test_xdp_do_redirect__destroy(skel);
  }