1. 04 Feb, 2023 19 commits
  2. 03 Feb, 2023 21 commits
    • David S. Miller's avatar
      Merge branch 'yt8531-support' · 8065c0e1
      David S. Miller authored
      Frank Sae says:
      
      ====================
      net: add dts for yt8521 and yt8531s, add driver for yt8531
      
      Add dts for yt8521 and yt8531s, add driver for yt8531.
       These patches have been verified on our AM335x platform (motherboard)
       which has one integrated yt8521 and one RGMII interface.
       It can connect to daughter boards like yt8531s or yt8531 board.
      
       v5:
       - change the compatible of yaml
       - change the maintainers of yaml from "frank sae" to "Frank Sae"
      
       v4:
       - change default tx delay from 150ps to 1950ps
       - add compatible for yaml
      
       v3:
       - change default rx delay from 1900ps to 1950ps
       - moved ytphy_rgmii_clk_delay_config_with_lock from yt8521's patch to yt8531's patch
       - removed unnecessary checks of phydev->attached_dev->dev_addr
      
       v2:
       - split BIT macro as one patch
       - split "dts for yt8521/yt8531s ... " patch as two patches
       - use standard rx-internal-delay-ps and tx-internal-delay-ps, removed motorcomm,sds-tx-amplitude
       - removed ytphy_parse_dt, ytphy_probe_helper and ytphy_config_init_helper
       - not store dts arg to yt8521_priv
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8065c0e1
    • Frank Sae's avatar
      net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy · 4ac94f72
      Frank Sae authored
      Add a driver for the motorcomm yt8531 gigabit ethernet phy. We have
       verified the driver on AM335x platform with yt8531 board. On the
       board, yt8531 gigabit ethernet phy works in utp mode, RGMII
       interface, supports 1000M/100M/10M speeds, and wol(magic package).
      Signed-off-by: default avatarFrank Sae <Frank.Sae@motor-comm.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ac94f72
    • Frank Sae's avatar
      net: phy: Add dts support for Motorcomm yt8531s gigabit ethernet phy · 36152f87
      Frank Sae authored
      Add dts support for Motorcomm yt8531s gigabit ethernet phy.
       Change yt8521_probe to support clk config of yt8531s. Becase
       yt8521_probe does the things which yt8531s is needed, so
       removed yt8531s function.
       This patch has been verified on AM335x platform with yt8531s board.
      Signed-off-by: default avatarFrank Sae <Frank.Sae@motor-comm.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      36152f87
    • Frank Sae's avatar
      net: phy: Add dts support for Motorcomm yt8521 gigabit ethernet phy · a6e68f0f
      Frank Sae authored
      Add dts support for Motorcomm yt8521 gigabit ethernet phy.
       Add ytphy_rgmii_clk_delay_config function to support dst config for
       the delay of rgmii clk. This funciont is common for yt8521, yt8531s
       and yt8531.
       This patch has been verified on AM335x platform.
      Signed-off-by: default avatarFrank Sae <Frank.Sae@motor-comm.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6e68f0f
    • Frank Sae's avatar
      net: phy: Add BIT macro for Motorcomm yt8521/yt8531 gigabit ethernet phy · 4869a146
      Frank Sae authored
      Add BIT macro for Motorcomm yt8521/yt8531 gigabit ethernet phy.
       This is a preparatory patch. Add BIT macro for 0xA012 reg, and
       supplement for 0xA001 and 0xA003 reg. These will be used to support dts.
      Signed-off-by: default avatarFrank Sae <Frank.Sae@motor-comm.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4869a146
    • Frank Sae's avatar
      dt-bindings: net: Add Motorcomm yt8xxx ethernet phy · cf08dfe8
      Frank Sae authored
      Add a YAML binding document for the Motorcomm yt8xxx Ethernet phy.
      Signed-off-by: default avatarFrank Sae <Frank.Sae@motor-comm.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf08dfe8
    • David S. Miller's avatar
      Merge branch 'act_ct-UDP-NEW' · 18390581
      David S. Miller authored
      Vlad Buslov says:
      
      ====================
      net: Allow offloading of UDP NEW connections via act_ct
      
      Currently only bidirectional established connections can be offloaded
      via act_ct. Such approach allows to hardcode a lot of assumptions into
      act_ct, flow_table and flow_offload intermediate layer codes. In order
      to enabled offloading of unidirectional UDP NEW connections start with
      incrementally changing the following assumptions:
      
      - Drivers assume that only established connections are offloaded and
        don't support updating existing connections. Extract ctinfo from meta
        action cookie and refuse offloading of new connections in the drivers.
      
      - Fix flow_table offload fixup algorithm to calculate flow timeout
        according to current connection state instead of hardcoded
        "established" value.
      
      - Add new flow_table flow flag that designates bidirectional connections
        instead of assuming it and hardcoding hardware offload of every flow
        in both directions.
      
      - Add new flow_table flow flag that designates connections that are
        offloaded to hardware as "established" instead of assuming it. This
        allows some optimizations in act_ct and prevents spamming the
        flow_table workqueue with redundant tasks.
      
      With all the necessary infrastructure in place modify act_ct to offload
      UDP NEW as unidirectional connection. Pass reply direction traffic to CT
      and promote connection to bidirectional when UDP connection state
      changes to "assured". Rely on refresh mechanism to propagate connection
      state change to supporting drivers.
      
      Note that early drop algorithm that is designed to free up some space in
      connection tracking table when it becomes full (by randomly deleting up
      to 5% of non-established connections) currently ignores connections
      marked as "offloaded". Now, with UDP NEW connections becoming
      "offloaded" it could allow malicious user to perform DoS attack by
      filling the table with non-droppable UDP NEW connections by sending just
      one packet in single direction. To prevent such scenario change early
      drop algorithm to also consider "offloaded" connections for deletion.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18390581
    • Vlad Buslov's avatar
      netfilter: nf_conntrack: allow early drop of offloaded UDP conns · df25455e
      Vlad Buslov authored
      Both synchronous early drop algorithm and asynchronous gc worker completely
      ignore connections with IPS_OFFLOAD_BIT status bit set. With new
      functionality that enabled UDP NEW connection offload in action CT
      malicious user can flood the conntrack table with offloaded UDP connections
      by just sending a single packet per 5tuple because such connections can no
      longer be deleted by early drop algorithm.
      
      To mitigate the issue allow both early drop and gc to consider offloaded
      UDP connections for deletion.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      df25455e
    • Vlad Buslov's avatar
      net/sched: act_ct: offload UDP NEW connections · 6a9bad00
      Vlad Buslov authored
      Modify the offload algorithm of UDP connections to the following:
      
      - Offload NEW connection as unidirectional.
      
      - When connection state changes to ESTABLISHED also update the hardware
      flow. However, in order to prevent act_ct from spamming offload add wq for
      every packet coming in reply direction in this state verify whether
      connection has already been updated to ESTABLISHED in the drivers. If that
      it the case, then skip flow_table and let conntrack handle such packets
      which will also allow conntrack to potentially promote the connection to
      ASSURED.
      
      - When connection state changes to ASSURED set the flow_table flow
      NF_FLOW_HW_BIDIRECTIONAL flag which will cause refresh mechanism to offload
      the reply direction.
      
      All other protocols have their offload algorithm preserved and are always
      offloaded as bidirectional.
      
      Note that this change tries to minimize the load on flow_table add
      workqueue. First, it tracks the last ctinfo that was offloaded by using new
      flow 'NF_FLOW_HW_ESTABLISHED' flag and doesn't schedule the refresh for
      reply direction packets when the offloads have already been updated with
      current ctinfo. Second, when 'add' task executes on workqueue it always
      update the offload with current flow state (by checking 'bidirectional'
      flow flag and obtaining actual ctinfo/cookie through meta action instead of
      caching any of these from the moment of scheduling the 'add' work)
      preventing the need from scheduling more updates if state changed
      concurrently while the 'add' work was pending on workqueue.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6a9bad00
    • Vlad Buslov's avatar
      net/sched: act_ct: set ctinfo in meta action depending on ct state · d5774cb6
      Vlad Buslov authored
      Currently tcf_ct_flow_table_fill_actions() function assumes that only
      established connections can be offloaded and always sets ctinfo to either
      IP_CT_ESTABLISHED or IP_CT_ESTABLISHED_REPLY strictly based on direction
      without checking actual connection state. To enable UDP NEW connection
      offload set the ctinfo, metadata cookie and NF_FLOW_HW_ESTABLISHED
      flow_offload flags bit based on ct->status value.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5774cb6
    • Vlad Buslov's avatar
      netfilter: flowtable: cache info of last offload · 1a441a9b
      Vlad Buslov authored
      Modify flow table offload to cache the last ct info status that was passed
      to the driver offload callbacks by extending enum nf_flow_flags with new
      "NF_FLOW_HW_ESTABLISHED" flag. Set the flag if ctinfo was 'established'
      during last act_ct meta actions fill call. This infrastructure change is
      necessary to optimize promoting of UDP connections from 'new' to
      'established' in following patches in this series.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a441a9b
    • Vlad Buslov's avatar
      netfilter: flowtable: allow unidirectional rules · 8f84780b
      Vlad Buslov authored
      Modify flow table offload to support unidirectional connections by
      extending enum nf_flow_flags with new "NF_FLOW_HW_BIDIRECTIONAL" flag. Only
      offload reply direction when the flag is set. This infrastructure change is
      necessary to support offloading UDP NEW connections in original direction
      in following patches in series.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f84780b
    • Vlad Buslov's avatar
      netfilter: flowtable: fixup UDP timeout depending on ct state · 0eb5acb1
      Vlad Buslov authored
      Currently flow_offload_fixup_ct() function assumes that only replied UDP
      connections can be offloaded and hardcodes UDP_CT_REPLIED timeout value. To
      enable UDP NEW connection offload in following patches extract the actual
      connections state from ct->status and set the timeout according to it.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0eb5acb1
    • Vlad Buslov's avatar
      net: flow_offload: provision conntrack info in ct_metadata · 29744a10
      Vlad Buslov authored
      In order to offload connections in other states besides "established" the
      driver offload callbacks need to have access to connection conntrack info.
      Flow offload intermediate representation data structure already contains
      that data encoded in 'cookie' field, so just reuse it in the drivers.
      
      Reject offloading IP_CT_NEW connections for now by returning an error in
      relevant driver callbacks based on value of ctinfo. Support for offloading
      such connections will need to be added to the drivers afterwards.
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29744a10
    • Horatiu Vultur's avatar
      net: lan966x: Add VCAP debugFS support · 94281484
      Horatiu Vultur authored
      Enable debugfs for vcap for lan966x. This will allow to print all the
      entries in the VCAP and also the port information regarding which keys
      are configured.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      94281484
    • David S. Miller's avatar
      Merge branch 'rswitch-SERDES-PHY-init' · 64e09d04
      David S. Miller authored
      Yoshihiro Shimoda says:
      
      ====================
      net: renesas: rswitch: Modify initialization for SERDES and PHY
      
      - My platform has the 88x2110.
      - The MACTYPE setting of strap pin on the platform is SXGMII.
      - However, we realized that the SoC cannot communicate the PHY with SXGMII
        because of mismatching hardware specification.
      - We have a lot of boards which mismatch the MACTYPE setting.
      
      So, I would like to change the MACTYPE as SGMII by software for the platform.
      
      The patch [1/5] sets phydev->host_interfaces by phylink for Marvell PHY
      driver (marvell10g) to initialize the MACTYPE.
      
      - The patch [1/5] siplifies the rswitch driver.
      - The patch [2/5] converts to phy_device from phylink.
      - The patch [3/5] sets phydev->host_interfaces from this driver without
        any new functions of phylib.
      - The patch [4/5] adds phy_power_on() calling to initialize the Ethernet
        SERDES PHY driver (r8a779f0-eth-serdes) for each channel.
      - The patch [5/5] adds "max-speed" handling.
      
      Changes from v4:
      https://lore.kernel.org/all/20230127142621.1761278-1-yoshihiro.shimoda.uh@renesas.com/
       - No modification of phylink API.
       - Convert to phylib instead of phylink.
       - Add "max-speed" handling.
      
      Changes from v3:
      https://lore.kernel.org/all/20230127014812.1656340-1-yoshihiro.shimoda.uh@renesas.com/
       - Keep a pointer of "port" and more simplify the code.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      64e09d04
    • Yoshihiro Shimoda's avatar
      net: renesas: rswitch: Add "max-speed" handling · 04c77d91
      Yoshihiro Shimoda authored
      The previous code set the speed by the interface mode of PHY.
      Also this hardware has a restriction which cannot change the speed
      at runtime. To use other speed, add "max-speed" handling to set
      each port's speed if needed.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04c77d91
    • Yoshihiro Shimoda's avatar
      net: renesas: rswitch: Add phy_power_{on,off}() calling · 5cb63092
      Yoshihiro Shimoda authored
      Some Ethernet PHYs (like marvell10g) will decide the host interface
      mode by the media-side speed. So, the rswitch driver needs to
      initialize one of the Ethernet SERDES (r8a779f0-eth-serdes) ports
      after linked the Ethernet PHY up. The r8a779f0-eth-serdes driver has
      .init() for initializing all ports and .power_on() for initializing
      each port. So, add phy_power_{on,off} calling for it.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5cb63092
    • Yoshihiro Shimoda's avatar
      net: renesas: rswitch: Add host_interfaces setting · 0df024d0
      Yoshihiro Shimoda authored
      Set phydev->host_interfaces before calling of_phy_connect() to
      configure the PHY with the information of host_interfaces.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0df024d0
    • Yoshihiro Shimoda's avatar
      net: renesas: rswitch: Convert to phy_device · c16a5033
      Yoshihiro Shimoda authored
      Intended to set phy_device->host_interfaces by phylink in the future.
      But there is difficult to implement phylink properly, especially
      supporting the in-band mode on this driver because extra initialization
      is needed after linked the ethernet PHY up. So, convert to phy_device
      from phylink.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c16a5033
    • Yoshihiro Shimoda's avatar
      net: renesas: rswitch: Simplify struct phy * handling · b46f1e57
      Yoshihiro Shimoda authored
      Simplify struct phy *serdes handling by keeping the valiable in
      the struct rswitch_device.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b46f1e57