On 6/26/24 14:54, Sergey Temerkhanov wrote:
Use struct ice_adapter to hold shared PTP data and control PTP
related actions instead of auxbus. This allows significant code
simplification and faster access to the container fields used in
the PTP support code.

Move the PTP port list to the ice_adapter container to simplify
the code and avoid race conditions which could occur due to the
synchronous nature of the initialization/access and
certain memory saving can be achieved by moving PTP data into
the ice_adapter itself.

Reviewed-by: Przemek Kitszel <przemyslaw.kits...@intel.com>
Signed-off-by: Sergey Temerkhanov <sergey.temerkha...@intel.com>
---
  drivers/net/ethernet/intel/ice/ice_adapter.c |   6 ++
  drivers/net/ethernet/intel/ice/ice_adapter.h |  18 +++-
  drivers/net/ethernet/intel/ice/ice_ptp.c     | 101 ++++++++++++-------
  drivers/net/ethernet/intel/ice/ice_ptp.h     |   3 +
  drivers/net/ethernet/intel/ice/ice_ptp_hw.h  |   5 +
  5 files changed, 95 insertions(+), 38 deletions(-)


[...]

  /**
   * struct ice_adapter - PCI adapter resources shared across PFs
   * @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME
   *                        register of the PTP clock.
   * @refcount: Reference count. struct ice_pf objects hold the references.
   * @ctrl_pf: Control PF of the adapter
+ * @ports: Ports list
   */
  struct ice_adapter {
        /* For access to the GLTSYN_TIME register */
        spinlock_t ptp_gltsyn_time_lock;
-
        refcount_t refcount;

Michal has pointed out that @refcount is special in that it protecting
whole struct ice_adapter, so should be kept as the last (but as you see
it's problematic) or as the first :)

struct ice_pf *ctrl_pf;
+       struct ice_port_list ports;
  };

[...]

Reply via email to