1. Sep 18, 2023
  2. Sep 17, 2023
    • David S. Miller's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 685c6d5b
      David S. Miller authored
      Alexei Starovoitov says:
      
      ====================
      The following pull-request contains BPF updates for your *net-next* tree.
      
      We've added 73 non-merge commits during the last 9 day(s) which contain
      a total of 79 files changed, 5275 insertions(+), 600 deletions(-).
      
      The main changes are:
      
      1) Basic BTF validation in libbpf, from Andrii Nakryiko.
      
      2) bpf_assert(), bpf_throw(), exceptions in bpf progs, from Kumar Kartikeya Dwivedi.
      
      3) next_thread cleanups, from Oleg Nesterov.
      
      4) Add mcpu=v4 support to arm32, from Puranjay Mohan.
      
      5) Add support for __percpu pointers in bpf progs, from Yonghong Song.
      
      6) Fix bpf tailcall interaction with bpf trampoline, from Leon Hwang.
      
      7) Raise irq_work in bpf_mem_alloc while irqs are disabled to improve refill probabablity, from Hou Tao.
      
      Please consider pulling these changes from:
      
        git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
      
      
      
      Thanks a lot!
      
      Also thanks to reporters, reviewers and testers of commits in this pull-request:
      
      Alan Maguire, Andrey Konovalov, Dave Marchevsky, "Eric W. Biederman",
      Jiri Olsa, Maciej Fijalkowski, Quentin Monnet, Russell King (Oracle),
      Song Liu, Stanislav Fomichev, Yonghong Song
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      685c6d5b
    • David S. Miller's avatar
      Merge branch 'phy-stopping-race' · fbb49deb
      David S. Miller authored
      
      
      Russell King says:
      
      ====================
      net: phy: avoid race when erroring stopping PHY
      
      This series addresses a problem reported by Jijie Shao where the PHY
      state machine can race with phy_stop() leading to an incorrect state.
      
      The issue centres around phy_state_machine() dropping the phydev->lock
      mutex briefly, which allows phy_stop() to get in half-way through the
      state machine, and when the state machine resumes, it overwrites
      phydev->state with a value incompatible with a stopped PHY. This causes
      a subsequent phy_start() to issue a warning.
      
      We address this firstly by using versions of functions that do not take
      tne lock, moving them into the locked region. The only function that
      this can't be done with is phy_suspend() which needs to call into the
      driver without taking the lock.
      
      For phy_suspend(), we split the state machine into two parts - the
      initial part which runs under the phydev->lock, and the second part
      which runs without the lock.
      
      We finish off by using the split state machine in phy_stop() which
      removes another unnecessary unlock-lock sequence from phylib.
      
      Changes from RFC:
      - Added Jijie Shao's tested-by
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fbb49deb
    • Russell King (Oracle)'s avatar
      net: phy: convert phy_stop() to use split state machine · adcbb855
      Russell King (Oracle) authored
      
      
      Convert phy_stop() to use the new locked-section and unlocked-section
      parts of the PHY state machine.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      adcbb855
    • Russell King (Oracle)'s avatar
      net: phy: split locked and unlocked section of phy_state_machine() · 8635c066
      Russell King (Oracle) authored
      
      
      Split out the locked and unlocked sections of phy_state_machine() into
      two separate functions which can be called inside the phydev lock and
      outside the phydev lock as appropriate, thus allowing us to combine
      the locked regions in the caller of phy_state_machine() with the
      locked region inside phy_state_machine().
      
      This avoids unnecessarily dropping the phydev lock which may allow
      races to occur.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8635c066
    • Russell King (Oracle)'s avatar
      net: phy: move phy_state_machine() · c398ef41
      Russell King (Oracle) authored
      
      
      Move phy_state_machine() before phy_stop() to avoid subsequent patches
      introducing forward references.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c398ef41
    • Russell King (Oracle)'s avatar
      net: phy: move phy_suspend() to end of phy_state_machine() · 6e19b350
      Russell King (Oracle) authored
      
      
      Move the call to phy_suspend() to the end of phy_state_machine() after
      we release the lock so that we can combine the locked areas.
      phy_suspend() can not be called while holding phydev->lock as it has
      caused deadlocks in the past.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e19b350
    • Russell King (Oracle)'s avatar
      net: phy: move call to start aneg · ea5968cd
      Russell King (Oracle) authored
      
      
      Move the call to start auto-negotiation inside the lock in the PHYLIB
      state machine, calling the locked variant _phy_start_aneg(). This
      avoids unnecessarily releasing and re-acquiring the lock.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea5968cd
    • Russell King (Oracle)'s avatar
      net: phy: call phy_error_precise() while holding the lock · ef113a60
      Russell King (Oracle) authored
      
      
      Move the locking out of phy_error_precise() and to its only call site,
      merging with the locked region that has already been taken.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef113a60
    • Russell King (Oracle)'s avatar
      net: phy: always call phy_process_state_change() under lock · 8da77df6
      Russell King (Oracle) authored
      
      
      phy_stop() calls phy_process_state_change() while holding the phydev
      lock, so also arrange for phy_state_machine() to do the same, so that
      this function is called with consistent locking.
      
      Tested-by: default avatarJijie Shao <shaojijie@huawei.com>
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8da77df6
    • Oleksij Rempel's avatar
      net: dsa: microchip: Add partial ACL support for ksz9477 switches · 002841be
      Oleksij Rempel authored
      
      
      This patch adds partial Access Control List (ACL) support for the
      ksz9477 family of switches. ACLs enable filtering of incoming layer 2
      MAC, layer 3 IP, and layer 4 TCP/UDP packets on each port. They provide
      additional capabilities for filtering routed network protocols and can
      take precedence over other forwarding functions.
      
      ACLs can filter ingress traffic based on header fields such as
      source/destination MAC address, EtherType, IPv4 address, IPv4 protocol,
      UDP/TCP ports, and TCP flags. The ACL is an ordered list of up to 16
      access control rules programmed into the ACL Table. Each entry specifies
      a set of matching conditions and action rules for controlling packet
      forwarding and priority.
      
      The ACL also implements a count function, generating an interrupt
      instead of a forwarding action. It can be used as a watchdog timer or an
      event counter. The ACL consists of three parts: matching rules, action
      rules, and processing entries. Multiple match conditions can be either
      AND'ed or OR'ed together.
      
      This patch introduces support for a subset of the available ACL
      functionality, specifically layer 2 matching and prioritization of
      matched packets. For example:
      
      tc qdisc add dev lan2 clsact
      tc filter add dev lan2 ingress protocol 0x88f7 flower action skbedit prio 7
      
      tc qdisc add dev lan1 clsact
      tc filter add dev lan1 ingress protocol 0x88f7 flower action skbedit prio 7
      
      The hardware offloading implementation was benchmarked against a
      configuration without hardware offloading. This latter setup relied on a
      software-based Linux bridge. No noticeable differences were observed
      between the two configurations. Here is an example of software-based
      test:
      
      ip l s dev enu1u1 up
      ip l s dev enu1u2 up
      ip l s dev enu1u4 up
      ethtool -A enu1u1 autoneg off rx off tx off
      ethtool -A enu1u2 autoneg off rx off tx off
      ethtool -A enu1u4 autoneg off rx off tx off
      ip l a name br0 type bridge
      ip l s dev br0 up
      ip l s enu1u1 master br0
      ip l s enu1u2 master br0
      ip l s enu1u4 master br0
      
      tc qdisc add dev enu1u1 root handle 1:  ets strict 4 priomap 3 3 2 2 1 1 0 0
      tc qdisc add dev enu1u4 root handle 1:  ets strict 4 priomap 3 3 2 2 1 1 0 0
      tc qdisc add dev enu1u2 root handle 1:  ets strict 4 priomap 3 3 2 2 1 1 0 0
      
      tc qdisc add dev enu1u1 clsact
      tc filter add dev enu1u1 ingress protocol ipv4  flower action skbedit prio 7
      
      tc qdisc add dev enu1u4 clsact
      tc filter add dev enu1u4 ingress protocol ipv4  flower action skbedit prio 0
      
      On a system attached to the port enu1u2 I run two iperf3 server
      instances:
      iperf3 -s -p 5210 &
      iperf3 -s -p 5211 &
      
      On systems attached to enu1u4 and enu1u1 I run:
      iperf3 -u -c  172.17.0.1 -p 5210 -b100M  -l1472 -t100
      and
      iperf3 -u -c  172.17.0.1 -p 5211 -b100M  -l1472 -t100
      
      As a result, IP traffic on port enu1u1 will be prioritized and take
      precedence over IP traffic on port enu1u4
      
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      002841be
    • Oleksij Rempel's avatar
      net: dsa: microchip: Move *_port_setup code to dsa_switch_ops::port_setup() · 15299227
      Oleksij Rempel authored
      
      
      Right now, the *_port_setup code is in dsa_switch_ops::port_enable(),
      which is not the best place for it. This patch moves it to a more
      suitable place, dsa_switch_ops::port_setup(), to match the function's
      purpose and name.
      
      This patch is a preparation for coming ACL support patch.
      
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15299227
    • David S. Miller's avatar
      Merge branch 'devlink-instances-relationships' · e03f0dfb
      David S. Miller authored
      
      
      Jiri Pirko says:
      
      ====================
      expose devlink instances relationships
      
      From: Jiri Pirko <jiri@nvidia.com>
      
      Currently, the user can instantiate new SF using "devlink port add"
      command. That creates an E-switch representor devlink port.
      
      When user activates this SF, there is an auxiliary device created and
      probed for it which leads to SF devlink instance creation.
      
      There is 1:1 relationship between E-switch representor devlink port and
      the SF auxiliary device devlink instance.
      
      Also, for example in mlx5, one devlink instance is created for
      PCI device and one is created for an auxiliary device that represents
      the uplink port. The relation between these is invisible to the user.
      
      Patches #1-#3 and #5 are small preparations.
      
      Patch #4 adds netnsid attribute for nested devlink if that in a
      different namespace.
      
      Patch #5 is the main one in this set, introduces the relationship
      tracking infrastructure later on used to track SFs, linecards and
      devlink instance relationships with nested devlink instances.
      
      Expose the relation to the user by introducing new netlink attribute
      DEVLINK_PORT_FN_ATTR_DEVLINK which contains the devlink instance related
      to devlink port function. This is done by patch #8.
      Patch #9 implements this in mlx5 driver.
      
      Patch #10 converts the linecard nested devlink handling to the newly
      introduced rel infrastructure.
      
      Patch #11 benefits from the rel infra and introduces possiblitily to
      have relation between devlink instances.
      Patch #12 implements this in mlx5 driver.
      
      Examples:
      $ devlink dev
      pci/0000:08:00.0: nested_devlink auxiliary/mlx5_core.eth.0
      pci/0000:08:00.1: nested_devlink auxiliary/mlx5_core.eth.1
      auxiliary/mlx5_core.eth.1
      auxiliary/mlx5_core.eth.0
      
      $ devlink port add pci/0000:08:00.0 flavour pcisf pfnum 0 sfnum 106
      pci/0000:08:00.0/32768: type eth netdev eth4 flavour pcisf controller 0 pfnum 0 sfnum 106 splittable false
        function:
          hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
      $ devlink port function set pci/0000:08:00.0/32768 state active
      $ devlink port show pci/0000:08:00.0/32768
      pci/0000:08:00.0/32768: type eth netdev eth4 flavour pcisf controller 0 pfnum 0 sfnum 106 splittable false
        function:
          hw_addr 00:00:00:00:00:00 state active opstate attached roce enable nested_devlink auxiliary/mlx5_core.sf.2
      
      $ devlink port show pci/0000:08:00.0/32768
      pci/0000:08:00.0/32768: type eth netdev eth4 flavour pcisf controller 0 pfnum 0 sfnum 106 splittable false
        function:
          hw_addr 00:00:00:00:00:00 state active opstate attached roce enable nested_devlink auxiliary/mlx5_core.sf.2 nested_devlink_netns ns1
      ====================
      
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e03f0dfb
    • Jiri Pirko's avatar
      net/mlx5e: Set en auxiliary devlink instance as nested · 6c75258c
      Jiri Pirko authored
      
      
      Benefit from the previous commit introducing exposure of devlink
      instances relationship and set the nested instance for en auxiliary
      device.
      
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6c75258c
    • Jiri Pirko's avatar
      devlink: introduce possibility to expose info about nested devlinks · c5e1bf8a
      Jiri Pirko authored
      
      
      In mlx5, there is a devlink instance created for PCI device. Also, one
      separate devlink instance is created for auxiliary device that
      represents the netdev of uplink port. This relation is currently
      invisible to the devlink user.
      
      Benefit from the rel infrastructure and allow for nested devlink
      instance to set the relationship for the nested-in devlink instance.
      Note that there may be many nested instances, therefore use xarray to
      hold the list of rel_indexes for individual nested instances.
      
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5e1bf8a
    • Jiri Pirko's avatar
      devlink: convert linecard nested devlink to new rel infrastructure · 9473bc01
      Jiri Pirko authored
      
      
      Benefit from the newly introduced rel infrastructure, treat the linecard
      nested devlink instances in the same way as port function instances.
      Convert the code to use the rel infrastructure.
      
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9473bc01