1. May 16, 2023
  2. May 15, 2023
  3. May 14, 2023
  4. May 13, 2023
    • David S. Miller's avatar
      Merge branch 'broadcom-phy-wol' · 7eef636e
      David S. Miller authored
      
      
      Florian Fainelli says:
      
      ====================
      Support for Wake-on-LAN for Broadcom PHYs
      
      This patch series adds support for Wake-on-LAN to the Broadcom PHY
      driver. Specifically the BCM54210E/B50212E are capable of supporting
      Wake-on-LAN using an external pin typically wired up to a system's GPIO.
      
      These PHY operate a programmable Ethernet MAC destination address
      comparator which will fire up an interrupt whenever a match is received.
      Because of that, it was necessary to introduce patch #1 which allows the
      PHY driver's ->suspend() routine to be called unconditionally. This is
      necessary in our case because we need a hook point into the device
      suspend/resume flow to enable the wake-up interrupt as late as possible.
      
      Patch #2 adds support for the Broadcom PHY library and driver for
      Wake-on-LAN proper with the WAKE_UCAST, WAKE_MCAST, WAKE_BCAST,
      WAKE_MAGIC and WAKE_MAGICSECURE. Note that WAKE_FILTER is supportable,
      however this will require further discussions and be submitted as a RFC
      series later on.
      
      Patch #3 updates the GENET driver to defer to the PHY for Wake-on-LAN if
      the PHY supports it, thus allowing the MAC to be powered down to
      conserve power.
      
      Changes in v3:
      
      - collected Reviewed-by tags
      - explicitly use return 0 in bcm54xx_phy_probe() (Paolo)
      
      Changes in v2:
      
      - introduce PHY_ALWAYS_CALL_SUSPEND and only have the Broadcom PHY
        driver set this flag to minimize changes to the suspend flow to only
        drivers that need it
      
      - corrected possibly uninitialized variable in bcm54xx_set_wakeup_irq
        (Simon)
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7eef636e
    • Florian Fainelli's avatar
      net: bcmgenet: Add support for PHY-based Wake-on-LAN · 7e400ff3
      Florian Fainelli authored
      
      
      If available, interrogate the PHY to find out whether we can use it for
      Wake-on-LAN. This can be a more power efficient way of implementing
      that feature, especially when the MAC is powered off in low power
      states.
      
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e400ff3
    • Florian Fainelli's avatar
      net: phy: broadcom: Add support for Wake-on-LAN · 8baddaa9
      Florian Fainelli authored
      
      
      Add support for WAKE_UCAST, WAKE_MCAST, WAKE_BCAST, WAKE_MAGIC and
      WAKE_MAGICSECURE. This is only supported with the BCM54210E and
      compatible Ethernet PHYs. Using the in-band interrupt or an out of band
      GPIO interrupts are supported.
      
      Broadcom PHYs will generate a Wake-on-LAN level low interrupt on LED4 as
      soon as one of the supported patterns is being matched. That includes
      generating such an interrupt even if the PHY is operated during normal
      modes. If WAKE_UCAST is selected, this could lead to the LED4 interrupt
      firing up for every packet being received which is absolutely
      undesirable from a performance point of view.
      
      Because the Wake-on-LAN configuration can be set long before the system
      is actually put to sleep, we cannot have an interrupt service routine to
      clear on read the interrupt status register and ensure that new packet
      matches will be detected.
      
      It is desirable to enable the Wake-on-LAN interrupt as late as possible
      during the system suspend process such that we limit the number of
      interrupts to be handled by the system, but also conversely feed into
      the Linux's system suspend way of dealing with interrupts in and around
      the points of no return.
      
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8baddaa9
    • Florian Fainelli's avatar
      net: phy: Allow drivers to always call into ->suspend() · a7e34480
      Florian Fainelli authored
      
      
      A few PHY drivers are currently attempting to not suspend the PHY when
      Wake-on-LAN is enabled, however that code is not currently executing at
      all due to an early check in phy_suspend().
      
      This prevents PHY drivers from making an appropriate decisions and put
      the hardware into a low power state if desired.
      
      In order to allow the PHY drivers to opt into getting their ->suspend
      routine to be called, add a PHY_ALWAYS_CALL_SUSPEND bit which can be
      set. A boolean that tracks whether the PHY or the attached MAC has
      Wake-on-LAN enabled is also provided for convenience.
      
      If phydev::wol_enabled then the PHY shall not prevent its own
      Wake-on-LAN detection logic from working and shall not prevent the
      Ethernet MAC from receiving packets for matching.
      
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7e34480
  5. May 12, 2023
    • David S. Miller's avatar
      Merge branch 'sfc-decap' · ba79e9a7
      David S. Miller authored
      
      
      Edward Cree says:
      
      ====================
      sfc: more flexible encap matches on TC decap rules
      
      This series extends the TC offload support on EF100 to support optionally
       matching on the IP ToS and UDP source port of the outer header in rules
       performing tunnel decapsulation.  Both of these fields allow masked
       matches if the underlying hardware supports it (current EF100 hardware
       supports masking on ToS, but only exact-match on source port).
      Given that the source port is typically populated from a hash of inner
       header entropy, it's not clear whether filtering on it is useful, but
       since we can support it we may as well expose the capability.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ba79e9a7
    • Edward Cree's avatar
      sfc: support TC decap rules matching on enc_src_port · b6583d5e
      Edward Cree authored
      
      
      Allow efx_tc_encap_match entries to include a udp_sport and a
       udp_sport_mask.  As with enc_ip_tos, use pseudos to enforce that all
       encap matches within a given <src_ip,dst_ip,udp_dport> tuple have
       the same udp_sport_mask.
      Note that since we use a single layer of pseudos for both fields, two
       matches that differ in (say) udp_sport value aren't permitted to have
       different ip_tos_mask, even though this would technically be safe.
      Current userland TC does not support setting enc_src_port; this patch
       was tested with an iproute2 patched to support it.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6583d5e
    • Edward Cree's avatar
      sfc: support TC decap rules matching on enc_ip_tos · 3c9561c0
      Edward Cree authored
      
      
      Allow efx_tc_encap_match entries to include an ip_tos and ip_tos_mask.
      To avoid partially-overlapping Outer Rules (which can lead to undefined
       behaviour in the hardware), store extra "pseudo" entries in our
       encap_match hashtable, which are used to enforce that all Outer Rule
       entries within a given <src_ip,dst_ip,udp_dport> tuple (or IPv6
       equivalent) have the same ip_tos_mask.
      The "direct" encap_match entry takes a reference on the "pseudo",
       allowing it to be destroyed when all "direct" entries using it are
       removed.
      efx_tc_em_pseudo_type is an enum rather than just a bool because in
       future an additional pseudo-type will be added to support Conntrack
       offload.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c9561c0
    • Edward Cree's avatar
      sfc: populate enc_ip_tos matches in MAE outer rules · 56beb35d
      Edward Cree authored
      
      
      Currently tc.c will block them before they get here, but following
       patch will change that.
      Use the extack message from efx_mae_check_encap_match_caps() instead
       of writing a new one, since there's now more being fed in than just
       an IP version.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56beb35d
    • Edward Cree's avatar
      sfc: release encap match in efx_tc_flow_free() · 28fa3ac4
      Edward Cree authored
      When force-freeing leftover entries from our match_action_ht, call
       efx_tc_delete_rule(), which releases all the rule's resources, rather
       than open-coding it.  The open-coded version was missing a call to
       release the rule's encap match (if any).
      It probably doesn't matter as everything's being torn down anyway, but
       it's cleaner this way and prevents further error messages potentially
       being logged by efx_tc_encap_match_free() later on.
      Move efx_tc_flow_free() further down the file to avoid introducing a
       forward declaration of efx_tc_delete_rule().
      
      Fixes: 17654d84
      
       ("sfc: add offloading of 'foreign' TC (decap) rules")
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28fa3ac4
    • wuych's avatar
      net: liquidio: lio_main: Remove unnecessary (void*) conversions · d3616dc7
      wuych authored
      
      
      Pointer variables of void * type do not require type cast.
      
      Signed-off-by: default avatarwuych <yunchuan@nfschina.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d3616dc7
    • Alexander Mikhalitsyn's avatar
      sctp: add bpf_bypass_getsockopt proto callback · 2598619e
      Alexander Mikhalitsyn authored
      Implement ->bpf_bypass_getsockopt proto callback and filter out
      SCTP_SOCKOPT_PEELOFF, SCTP_SOCKOPT_PEELOFF_FLAGS and SCTP_SOCKOPT_CONNECTX3
      socket options from running eBPF hook on them.
      
      SCTP_SOCKOPT_PEELOFF and SCTP_SOCKOPT_PEELOFF_FLAGS options do fd_install(),
      and if BPF_CGROUP_RUN_PROG_GETSOCKOPT hook returns an error after success of
      the original handler sctp_getsockopt(...), userspace will receive an error
      from getsockopt syscall and will be not aware that fd was successfully
      installed into a fdtable.
      
      As pointed by Marcelo Ricardo Leitner it seems reasonable to skip
      bpf getsockopt hook for SCTP_SOCKOPT_CONNECTX3 sockopt too.
      Because internaly, it triggers connect() and if error is masked
      then userspace will be confused.
      
      This patch was born as a result of discussion around a new SCM_PIDFD interface:
      https://lore.kernel.org/all/20230413133355.350571-3-aleksandr.mikhalitsyn@canonical.com/
      
      Fixes: 0d01da6a
      
       ("bpf: implement getsockopt and setsockopt hooks")
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Cc: Xin Long <lucien.xin@gmail.com>
      Cc: linux-sctp@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Suggested-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2598619e