1. 04 Feb, 2023 27 commits
  2. 03 Feb, 2023 13 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