On Tue, Jun 18, 2024 at 3:59 PM Sergey Temerkhanov
<sergey.temerkha...@intel.com> 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>
[...]
>  /**
>   * 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
>   */
>  struct ice_adapter {
>         /* For access to the GLTSYN_TIME register */
>         spinlock_t ptp_gltsyn_time_lock;
> -
>         refcount_t refcount;
> +
> +       struct ice_pf *ctrl_pf;
> +       struct ice_port_list ports;
>  };

A minor nitpick about grouping of the members in this structure:
"refcount" is special. It tracks the lifetime of the ice_adapter
structure itself and it is accessed only from ice_adapter.c. The other
members are the useful payload. So I would suggest keeping "refcount"
as either the last or the first struct member.

Michal

Reply via email to