1. 12 Feb, 2024 16 commits
    • David S. Miller's avatar
      Merge branch 'ipv6-expired-routes' · f7ab791d
      David S. Miller authored
      Kui-Feng Lee says:
      
      ====================
      Remove expired routes with a separated list of routes.
      
      This patchset is resent due to previous reverting. [1]
      
      FIB6 GC walks trees of fib6_tables to remove expired routes. Walking a tree
      can be expensive if the number of routes in a table is big, even if most of
      them are permanent. Checking routes in a separated list of routes having
      expiration will avoid this potential issue.
      
      Background
      ==========
      
      The size of a Linux IPv6 routing table can become a big problem if not
      managed appropriately.  Now, Linux has a garbage collector to remove
      expired routes periodically.  However, this may lead to a situation in
      which the routing path is blocked for a long period due to an
      excessive number of routes.
      
      For example, years ago, there is a commit c7bb4b89 ("ipv6: tcp:
      drop silly ICMPv6 packet too big messages").  The root cause is that
      malicious ICMPv6 packets were sent back for every small packet sent to
      them. These packets add routes with an expiration time that prompts
      the GC to periodically check all routes in the tables, including
      permanent ones.
      
      Why Route Expires
      =================
      
      Users can add IPv6 routes with an expiration time manually. However,
      the Neighbor Discovery protocol may also generate routes that can
      expire.  For example, Router Advertisement (RA) messages may create a
      default route with an expiration time. [RFC 4861] For IPv4, it is not
      possible to set an expiration time for a route, and there is no RA, so
      there is no need to worry about such issues.
      
      Create Routes with Expires
      ==========================
      
      You can create routes with expires with the  command.
      
      For example,
      
          ip -6 route add 2001:b000:591::3 via fe80::5054:ff:fe12:3457 \
              dev enp0s3 expires 30
      
      The route that has been generated will be deleted automatically in 30
      seconds.
      
      GC of FIB6
      ==========
      
      The function called fib6_run_gc() is responsible for performing
      garbage collection (GC) for the Linux IPv6 stack. It checks for the
      expiration of every route by traversing the trees of routing
      tables. The time taken to traverse a routing table increases with its
      size. Holding the routing table lock during traversal is particularly
      undesirable. Therefore, it is preferable to keep the lock for the
      shortest possible duration.
      
      Solution
      ========
      
      The cause of the issue is keeping the routing table locked during the
      traversal of large trees. To solve this problem, we can create a separate
      list of routes that have expiration. This will prevent GC from checking
      permanent routes.
      
      Result
      ======
      
      We conducted a test to measure the execution times of fib6_gc_timer_cb()
      and observed that it enhances the GC of FIB6. During the test, we added
      permanent routes with the following numbers: 1000, 3000, 6000, and
      9000. Additionally, we added a route with an expiration time.
      
      Here are the average execution times for the kernel without the patch.
       - 120020 ns with 1000 permanent routes
       - 308920 ns with 3000 ...
       - 581470 ns with 6000 ...
       - 855310 ns with 9000 ...
      
      The kernel with the patch consistently takes around 14000 ns to execute,
      regardless of the number of permanent routes that are installed.
      
      Majro changes from v5:
      
       - Force syncrhonize GC before query expired routes with
         "sysctl -wq net.ipv6.route.flush=1".
      
      Major changes from v4:
      
       - Fix the comment of fib6_add_gc_list().
      
      Major changes from v3:
      
       - Move the checks of f6i->fib6_node to fib6_add_gc_list().
      
       - Make spin_lock_bh() and spin_unlock_bh() stands out.
      
       - Explain the reason of the changes in the commit message of the
         patch 4.
      
      Major changes from v2:
      
       - Refactory the boilerplate checks in the test case.
      
         - check_rt_num() and check_rt_num_clean()
      
      Major changes from v1:
      
       - Reduce the numbers of routes (5) in the test cases to work with
         slow environments. Due to the failure on patchwork.
      
       - Remove systemd related commands in the test case.
      
      Major changes from the previous patchset [2]:
      
       - Split helpers.
      
         - fib6_set_expires() -> fib6_set_expires() and fib6_add_gc_list().
      
         - fib6_clean_expires() -> fib6_clean_expires() and
           fib6_remove_gc_list().
      
       - Fix rt6_add_dflt_router() to avoid racing of setting expires.
      
       - Remove unnecessary calling to fib6_clean_expires() in
         ip6_route_info_create().
      
       - Add test cases of toggling routes between permanent and temporary
         and handling routes from RA messages.
      
         - Clean up routes by deleting the existing device and adding a new
           one.
      
       - Fix a potential issue in modify_prefix_route().
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7ab791d
    • Kui-Feng Lee's avatar
      selftests/net: Adding test cases of replacing routes and route advertisements. · 3407df8d
      Kui-Feng Lee authored
      Add tests of changing permanent routes to temporary routes and the reversed
      case to make sure GC working correctly in these cases.  Add tests for the
      temporary routes from RA.
      
      The existing device will be deleted between tests to remove all routes
      associated with it, so that the earlier tests don't mess up the later ones.
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Tested-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarKui-Feng Lee <thinker.li@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3407df8d
    • Kui-Feng Lee's avatar
      net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set. · 768e06a8
      Kui-Feng Lee authored
      Make the decision to set or clean the expires of a route based on the
      RTF_EXPIRES flag, rather than the value of the "expires" argument.
      
      This patch doesn't make difference logically, but make inet6_addr_modify()
      and modify_prefix_route() consistent.
      
      The function inet6_addr_modify() is the only caller of
      modify_prefix_route(), and it passes the RTF_EXPIRES flag and an expiration
      value. The RTF_EXPIRES flag is turned on or off based on the value of
      valid_lft. The RTF_EXPIRES flag is turned on if valid_lft is a finite value
      (not infinite, not 0xffffffff). Even if valid_lft is 0, the RTF_EXPIRES
      flag remains on. The expiration value being passed is equal to the
      valid_lft value if the flag is on. However, if the valid_lft value is
      infinite, the expiration value becomes 0 and the RTF_EXPIRES flag is turned
      off. Despite this, modify_prefix_route() decides to set the expiration
      value if the received expiration value is not zero. This mixing of infinite
      and zero cases creates an inconsistency.
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarKui-Feng Lee <thinker.li@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      768e06a8
    • Kui-Feng Lee's avatar
      net/ipv6: Remove expired routes with a separated list of routes. · 5eb902b8
      Kui-Feng Lee authored
      FIB6 GC walks trees of fib6_tables to remove expired routes. Walking a tree
      can be expensive if the number of routes in a table is big, even if most of
      them are permanent. Checking routes in a separated list of routes having
      expiration will avoid this potential issue.
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarKui-Feng Lee <thinker.li@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5eb902b8
    • Kui-Feng Lee's avatar
      net/ipv6: Remove unnecessary clean. · 60df43d3
      Kui-Feng Lee authored
      The route here is newly created. It is unnecessary to call
      fib6_clean_expires() on it.
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarKui-Feng Lee <thinker.li@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      60df43d3
    • Kui-Feng Lee's avatar
      net/ipv6: set expires in rt6_add_dflt_router(). · 129e406e
      Kui-Feng Lee authored
      Pass the duration of a lifetime (in seconds) to the function
      rt6_add_dflt_router() so that it can properly set the expiration time.
      
      The function ndisc_router_discovery() is the only one that calls
      rt6_add_dflt_router(), and it will later set the expiration time for the
      route created by rt6_add_dflt_router(). However, there is a gap of time
      between calling rt6_add_dflt_router() and setting the expiration time in
      ndisc_router_discovery(). During this period, there is a possibility that a
      new route may be removed from the routing table. By setting the correct
      expiration time in rt6_add_dflt_router(), we can prevent this from
      happening. The reason for setting RTF_EXPIRES in rt6_add_dflt_router() is
      to start the Garbage Collection (GC) timer, as it only activates when a
      route with RTF_EXPIRES is added to a table.
      Suggested-by: default avatarDavid Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarKui-Feng Lee <thinker.li@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      129e406e
    • Paolo Abeni's avatar
      selftests: net: ignore timing errors in txtimestamp if KSFT_MACHINE_SLOW · 9c52994e
      Paolo Abeni authored
      This test is time sensitive. It may fail on virtual machines and for
      debug builds.
      
      Similar to commit c41dfb0d ("selftests/net: ignore timing errors in
      so_txtime if KSFT_MACHINE_SLOW"), optionally suppress failure for timing
      errors (only).
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c52994e
    • David S. Miller's avatar
      Merge branch 'octeon_ep_vf' · 4ec1d5fd
      David S. Miller authored
      Shinas Rasheed says:
      
      ====================
      add octeon_ep_vf driver
      
      This driver implements networking functionality of Marvell's Octeon
      PCI Endpoint NIC VF.
      
      This driver support following devices:
       * Network controller: Cavium, Inc. Device b203
       * Network controller: Cavium, Inc. Device b403
       * Network controller: Cavium, Inc. Device b103
       * Network controller: Cavium, Inc. Device b903
       * Network controller: Cavium, Inc. Device ba03
       * Network controller: Cavium, Inc. Device bc03
       * Network controller: Cavium, Inc. Device bd03
      
      Changes:
      V7:
        - Separated octep_vf_get_if_stats from octep_vf_main.h to later patch
          in [1/8]
        - Moved introducing ndo_ops from [3/8] to [5/8]
      
      V6: https://lore.kernel.org/all/20240207065207.3092004-1-srasheed@marvell.com/
        - Removed reuse of netif_tx_stop_all_queues, called implicitly in
          netif_tx_disable, when stopping netdev
        - Corrected error jump labels to have proper action-specific names in
          probe function
        - Removed singlethreaded workqueue implementation, since only tx
          timeout task is run. Run the same in the system workqueue
        - netdev_hold when tx_timeout happens to protect against free_netdev
          if race occurs between rmmod and a tx timeout. netdev_put the
          reference when timeout task ends to progress freeing netdev
      
      V5: https://lore.kernel.org/all/20240129050254.3047778-1-srasheed@marvell.com/
        - Changed unchecked return types to void and removed unnecessary
          initializations in [2/8] patch.
      
      V4: https://lore.kernel.org/all/20240108124213.2966536-1-srasheed@marvell.com/
        - Moved some stats from ethtool and added more to ndo_get_stats64
        - Replaced code in IQ full check function to use helper from
          net/netdev_queues.h
        - Refactored code so that NETDEV_TX_BUSY is avoided
      
      V3: https://lore.kernel.org/all/20240105203823.2953604-1-srasheed@marvell.com/
        - Removed UINT64_MAX, which is unused
        - Replaced masks and ULL declarations with GENMASK_ULL(), ULL() and
          other linux/bits.h macros, corrected declarations to conform to xmas tree format in patch [2/8]
        - Moved vfree and vzalloc null pointer casting corrections to patch
          [3/8], and corrected return values to follow standard kernel error codes in same
         - Set static budget of 64 for tx completion processing in NAPI
        - Replaces napi_complete and build_skb APIs to napi_complete_done and
          napi_build_skb APIs respectively
        - Replaced code with helper from net/netdev_queues.h to wake queues in TX completion
          processing
        - Removed duplicate reporting of TX/RX packets/bytes, which is already
          done during ndo_get_stats64
      
      V2: https://lore.kernel.org/all/20231223134000.2906144-1-srasheed@marvell.com/
        - Removed linux/version.h header file from inclusion in
          octep_vf_main.c
        - Corrected Makefile entry to include building octep_vf_mbox.c in
          [6/8] patch.
        - Removed redundant vzalloc pointer cast and vfree pointer check in
          [6/8] patch.
      
      V1: https://lore.kernel.org/all/20231221092844.2885872-1-srasheed@marvell.com/
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ec1d5fd
    • Shinas Rasheed's avatar
      octeon_ep_vf: update MAINTAINERS · 90cabae2
      Shinas Rasheed authored
      add MAINTAINERS for octeon_ep_vf driver.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      90cabae2
    • Shinas Rasheed's avatar
      octeon_ep_vf: add ethtool support · c9288159
      Shinas Rasheed authored
      Add support for the following ethtool commands:
      
      ethtool -i|--driver devname
      ethtool devname
      ethtool -S|--statistics devname
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9288159
    • Shinas Rasheed's avatar
      octeon_ep_vf: add Tx/Rx processing and interrupt support · 1cd3b407
      Shinas Rasheed authored
      Add support to enable MSI-x and register interrupts.
      Add support to process Tx and Rx traffic. Includes processing
      Tx completions and Rx refill.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1cd3b407
    • Shinas Rasheed's avatar
      octeon_ep_vf: add support for ndo ops · c3fad23c
      Shinas Rasheed authored
      Add support for ndo ops to set MAC address, change MTU, get stats.
      Add control path support to set MAC address, change MTU, get stats,
      set speed, get and set link mode.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c3fad23c
    • Shinas Rasheed's avatar
      octeon_ep_vf: add Tx/Rx ring resource setup and cleanup · ca6ecb0d
      Shinas Rasheed authored
      Implement Tx/Rx ring resource allocation and cleanup.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca6ecb0d
    • Shinas Rasheed's avatar
      octeon_ep_vf: add VF-PF mailbox communication. · c5cb944d
      Shinas Rasheed authored
      Implement VF-PF mailbox to send all control commands from VF to PF
      and receive responses and notifications from PF to VF.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5cb944d
    • Shinas Rasheed's avatar
      octeon_ep_vf: add hardware configuration APIs · 2c0c32c7
      Shinas Rasheed authored
      Implement hardware resource init and shutdown helper APIs, like
      hardware Tx/Rx queue init/enable/disable/reset.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c0c32c7
    • Shinas Rasheed's avatar
      octeon_ep_vf: Add driver framework and device initialization · cb7dd712
      Shinas Rasheed authored
      Add driver framework and device setup and initialization for Octeon
      PCI Endpoint NIC VF.
      
      Add implementation to load module, initialize, register network device,
      cleanup and unload module.
      Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cb7dd712
  2. 10 Feb, 2024 11 commits
    • David S. Miller's avatar
      Merge branch 'phy-package' · 970cb1ce
      David S. Miller authored
      Christian Marangi says:
      
      ====================
      net: phy: Introduce PHY Package concept
      
      Idea of this big series is to introduce the concept of PHY package in DT
      and give PHY drivers a way to derive the base address from DT.
      
      The concept of PHY package is nothing new and is already a thing in the
      kernel with the API phy_package_join/leave/read/write.
      
      What is currently lacking is describing this in DT and better reference
      a base address to calculate offset from.
      
      In the scenario of a PHY package where multiple address are used and
      there isn't a way to get the base address of the PHY package from some
      regs, getting the information from DT is the only way.
      
      A possible example to this problem is this:
      
              ethernet-phy-package@0 {
                  compatible = "qcom,qca8075-package";
                  #address-cells = <1>;
                  #size-cells = <0>;
      
                  reg = <0>;
                  qcom,package-mode = "qsgmii";
      
                  ethernet-phy@1 {
                    reg = <1>;
                  };
      
                  phy4: ethernet-phy@4 {
                    reg = <4>;
                  };
              };
      
      The mdio parse functions are changed to address for this additional
      special node, the function is changed to simply detect this node and
      search also in this. (we match the node name to be "ethernet-phy-package")
      
      PHY driver can then use introduced helper of_phy_package_join to join the
      PHY to the PHY package and derive the base address from DT.
      
      Changes v7:
      - Rebase on top of net-next
      - Add Reviewed-by tag for DT patch
      - Change tx-driver-strength to tx-drive-strength
      - Drop driver reference in DT
      Changes v6:
      - Back to absolute PHY implementation
      - Correctly drop refcount for node on error condition and on PHY leave
      - Drop DT include patch in favor for 3 boolean vendor property
      - Fix Documentation problem for compatible and missing type and
        description
      - Drop redundand gpio-controller dependency and description
      - Skip scanphy with invalid PHY Package node and make reg mandatory
      - Rework fiber read status to use more generic function
      - Split qca808x LED generalization patch to permit easier review
      - Correctly return -EINVAL with wrong data passed to vendor property
      - Drop removing LED ops for qca807x PHY driver with gpio-controller
      Changes v5:
      - Rebase on top of net-next
      - Change implementation to base addr + offset in subnode
      - Adapt to all the changes and cleanup done to at803x
      Changes v4:
      - Rework DT implementation
      - Drop of autojoin support and rework to simple helper
      - Rework PHY driver to the new implementation
      - Add compatible for qca807x package
      - Further cleanup patches
      Changes v3:
      - Add back compatible implementation
      - Detach patch that can be handled separately (phy_package_mmd,
        phy_package extended)
      - Rework code to new simplified implementation with base addr + offset
      - Improve documentation with additional info and description
      Changes v2:
      - Drop compatible "ethernet-phy-package", use node name prefix matching
        instead
      - Improve DT example
      - Add reg for ethernet-phy-package
      - Drop phy-mode for ethernet-phy-package
      - Drop patch for generalization of phy-mode
      - Drop global-phy property (handle internally to the PHY driver)
      - Rework OF phy package code and PHY driver to handle base address
      - Fix missing of_node_put
      - Add some missing docs for added variables in struct
      - Move some define from dt-bindings include to PHY driver
      - Handle qsgmii validation in PHY driver
      - Fix wrong include for gpiolib
      - Drop reduntant version.h include
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      970cb1ce
    • Christian Marangi's avatar
      net: phy: qca807x: add support for configurable LED · f508a226
      Christian Marangi authored
      QCA8072/5 have up to 2 LEDs attached for PHY.
      
      LEDs can be configured to be ON/hw blink or be set to HW control.
      
      Hw blink mode is set to blink at 4Hz or 250ms.
      
      PHY can support both copper (TP) or fiber (FIBRE) kind and supports
      different HW control modes based on the port type.
      
      HW control modes supported for netdev trigger for copper ports are:
      - LINK_10
      - LINK_100
      - LINK_1000
      - TX
      - RX
      - FULL_DUPLEX
      - HALF_DUPLEX
      
      HW control modes supported for netdev trigger for fiber ports are:
      - LINK_100
      - LINK_1000
      - TX
      - RX
      - FULL_DUPLEX
      - HALF_DUPLEX
      
      LED support conflicts with GPIO controller feature and must be disabled
      if gpio-controller is used for the PHY.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f508a226
    • Christian Marangi's avatar
      net: phy: qcom: generalize some qca808x LED functions · 47b930d0
      Christian Marangi authored
      Generalize some qca808x LED functions in preparation for qca807x LED
      support.
      
      The LED implementation of qca808x and qca807x is the same but qca807x
      supports also Fiber port and have different hw control bits for Fiber
      port. To limit code duplication introduce micro functions that takes reg
      instead of LED index to tweak all the supported LED modes.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47b930d0
    • Christian Marangi's avatar
      net: phy: qcom: move common qca808x LED define to shared header · ee9d9807
      Christian Marangi authored
      The LED implementation of qca808x and qca807x is the same but qca807x
      supports also Fiber port and have different hw control bits for Fiber
      port.
      
      In preparation for qca807x introduction, move all the common define to
      shared header.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee9d9807
    • Robert Marko's avatar
      net: phy: qcom: add support for QCA807x PHY Family · d1cb613e
      Robert Marko authored
      This adds driver for the Qualcomm QCA8072 and QCA8075 PHY-s.
      
      They are 2 or 5 port IEEE 802.3 clause 22 compliant 10BASE-Te,
      100BASE-TX and 1000BASE-T PHY-s.
      
      They feature 2 SerDes, one for PSGMII or QSGMII connection with
      MAC, while second one is SGMII for connection to MAC or fiber.
      
      Both models have a combo port that supports 1000BASE-X and
      100BASE-FX fiber.
      
      PHY package can be configured in 3 mode following this table:
      
                    First Serdes mode       Second Serdes mode
      Option 1      PSGMII for copper       Disabled
                    ports 0-4
      Option 2      PSGMII for copper       1000BASE-X / 100BASE-FX
                    ports 0-4
      Option 3      QSGMII for copper       SGMII for
                    ports 0-3               copper port 4
      
      Each PHY inside of QCA807x series has 4 digitally controlled
      output only pins that natively drive LED-s.
      But some vendors used these to driver generic LED-s controlled
      by userspace, so lets enable registering each PHY as GPIO
      controller and add driver for it.
      
      These are commonly used in Qualcomm IPQ40xx, IPQ60xx and IPQ807x
      boards.
      Co-developed-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarRobert Marko <robert.marko@sartura.hr>
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1cb613e
    • Christian Marangi's avatar
      net: phy: provide whether link has changed in c37_read_status · 9b1d5e05
      Christian Marangi authored
      Some PHY driver might require additional regs call after
      genphy_c37_read_status() is called.
      
      Expand genphy_c37_read_status to provide a bool wheather the link has
      changed or not to permit PHY driver to skip additional regs call if
      nothing has changed.
      
      Every user of genphy_c37_read_status() is updated with the new
      additional bool.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b1d5e05
    • Christian Marangi's avatar
      dt-bindings: net: Document Qcom QCA807x PHY package · dd87eaa1
      Christian Marangi authored
      Document Qcom QCA807x PHY package.
      
      Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5
      IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and
      1000BASE-T PHY-s.
      
      Document the required property to make the PHY package correctly
      configure and work.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dd87eaa1
    • Christian Marangi's avatar
      net: phy: qcom: move more function to shared library · 737eb75a
      Christian Marangi authored
      Move more function to shared library in preparation for introduction of
      new PHY Family qca807x that will make use of both functions from at803x
      and qca808x as it's a transition PHY with some implementation of at803x
      and some from the new qca808x.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      737eb75a
    • Christian Marangi's avatar
      net: phy: add devm/of_phy_package_join helper · 471e8fd3
      Christian Marangi authored
      Add devm/of_phy_package_join helper to join PHYs in a PHY package. These
      are variant of the manual phy_package_join with the difference that
      these will use DT nodes to derive the base_addr instead of manually
      passing an hardcoded value.
      
      An additional value is added in phy_package_shared, "np" to reference
      the PHY package node pointer in specific PHY driver probe_once and
      config_init_once functions to make use of additional specific properties
      defined in the PHY package node in DT.
      
      The np value is filled only with of_phy_package_join if a valid PHY
      package node is found. A valid PHY package node must have the node name
      set to "ethernet-phy-package".
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      471e8fd3
    • Christian Marangi's avatar
      net: phy: add support for scanning PHY in PHY packages nodes · 385ef48f
      Christian Marangi authored
      Add support for scanning PHY in PHY package nodes. PHY packages nodes
      are just container for actual PHY on the MDIO bus.
      
      Their PHY address defined in the PHY package node are absolute and
      reflect the address on the MDIO bus.
      
      mdio_bus.c and of_mdio.c is updated to now support and parse also
      PHY package subnode by checking if the node name match
      "ethernet-phy-package".
      
      As PHY package reg is mandatory and each PHY in the PHY package must
      have a reg, every invalid PHY Package node is ignored and will be
      skipped by the autoscan fallback.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      385ef48f
    • Christian Marangi's avatar
      dt-bindings: net: document ethernet PHY package nodes · 8453c88c
      Christian Marangi authored
      Document ethernet PHY package nodes used to describe PHY shipped in
      bundle of 2-5 PHY. The special node describe a container of PHY that
      share common properties. This is a generic schema and PHY package
      should create specialized version with the required additional shared
      properties.
      
      Example are PHY packages that have some regs only in one PHY of the
      package and will affect every other PHY in the package, for example
      related to PHY interface mode calibration or global PHY mode selection.
      
      The PHY package node MUST declare the base address used by the PHY driver
      for global configuration by calculating the offsets of the global PHY
      based on the base address of the PHY package.
      
      Each reg of the PHYs defined in the PHY package node is absolute and
      describe the real address of the Ethernet PHY on the bus.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8453c88c
  3. 09 Feb, 2024 13 commits