lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fcac69dd-d579-4f8b-bd0d-30cb6c2455eb@intel.com>
Date: Tue, 4 Feb 2025 09:51:53 +0100
From: Mateusz Polchlopek <mateusz.polchlopek@...el.com>
To: Tariq Toukan <tariqt@...dia.com>, "David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Eric
 Dumazet" <edumazet@...gle.com>, Andrew Lunn <andrew+netdev@...n.ch>
CC: <netdev@...r.kernel.org>, Saeed Mahameed <saeedm@...dia.com>, Gal Pressman
	<gal@...dia.com>, Jianbo Liu <jianbol@...dia.com>, Moshe Shemesh
	<moshe@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Mark Bloch
	<mbloch@...dia.com>, Carolina Jubran <cjubran@...dia.com>, Dragos Tatulea
	<dtatulea@...dia.com>
Subject: Re: [PATCH net-next 02/15] net/mlx5: Change parameters for PTP
 internal functions



On 2/3/2025 10:35 PM, Tariq Toukan wrote:
> From: Jianbo Liu <jianbol@...dia.com>
> 
> In later patch, the mlx5_clock will be allocated dynamically, its
> address can be obtained from mlx5_core_dev struct, but mdev can't be
> obtained from mlx5_clock because it can be shared by multiple
> interfaces. So change the parameter for such internal functions, only
> mdev is passed down from the callers.
> 
> Signed-off-by: Jianbo Liu <jianbol@...dia.com>
> Reviewed-by: Carolina Jubran <cjubran@...dia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
> Signed-off-by: Tariq Toukan <tariqt@...dia.com>
> ---
>   .../ethernet/mellanox/mlx5/core/lib/clock.c   | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> index eaf343756026..e7e4bdba02a3 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
> @@ -878,10 +878,8 @@ static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin,
>   				    mtpps_size, MLX5_REG_MTPPS, 0, 0);
>   }
>   
> -static int mlx5_get_pps_pin_mode(struct mlx5_clock *clock, u8 pin)
> +static int mlx5_get_pps_pin_mode(struct mlx5_core_dev *mdev, u8 pin)
>   {
> -	struct mlx5_core_dev *mdev = container_of(clock, struct mlx5_core_dev, clock);
> -
>   	u32 out[MLX5_ST_SZ_DW(mtpps_reg)] = {};
>   	u8 mode;
>   	int err;
> @@ -900,8 +898,9 @@ static int mlx5_get_pps_pin_mode(struct mlx5_clock *clock, u8 pin)
>   	return PTP_PF_NONE;
>   }
>   
> -static void mlx5_init_pin_config(struct mlx5_clock *clock)
> +static void mlx5_init_pin_config(struct mlx5_core_dev *mdev)
>   {
> +	struct mlx5_clock *clock = &mdev->clock;
>   	int i;
>   
>   	if (!clock->ptp_info.n_pins)
> @@ -922,7 +921,7 @@ static void mlx5_init_pin_config(struct mlx5_clock *clock)
>   			 sizeof(clock->ptp_info.pin_config[i].name),
>   			 "mlx5_pps%d", i);
>   		clock->ptp_info.pin_config[i].index = i;
> -		clock->ptp_info.pin_config[i].func = mlx5_get_pps_pin_mode(clock, i);
> +		clock->ptp_info.pin_config[i].func = mlx5_get_pps_pin_mode(mdev, i);
>   		clock->ptp_info.pin_config[i].chan = 0;
>   	}
>   }
> @@ -1041,10 +1040,10 @@ static void mlx5_timecounter_init(struct mlx5_core_dev *mdev)
>   			 ktime_to_ns(ktime_get_real()));
>   }
>   
> -static void mlx5_init_overflow_period(struct mlx5_clock *clock)
> +static void mlx5_init_overflow_period(struct mlx5_core_dev *mdev)
>   {
> -	struct mlx5_core_dev *mdev = container_of(clock, struct mlx5_core_dev, clock);
>   	struct mlx5_ib_clock_info *clock_info = mdev->clock_info;
> +	struct mlx5_clock *clock = &mdev->clock;
>   	struct mlx5_timer *timer = &clock->timer;

It seems that because of the refactor the RCT rule has been violated.
I think you have to split *timer into two lines.

>   	u64 overflow_cycles;
>   	u64 frac = 0;
> @@ -1135,7 +1134,7 @@ static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
>   
>   	mlx5_timecounter_init(mdev);
>   	mlx5_init_clock_info(mdev);
> -	mlx5_init_overflow_period(clock);
> +	mlx5_init_overflow_period(mdev);
>   
>   	if (mlx5_real_time_mode(mdev)) {
>   		struct timespec64 ts;
> @@ -1147,13 +1146,11 @@ static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev)
>   
>   static void mlx5_init_pps(struct mlx5_core_dev *mdev)
>   {
> -	struct mlx5_clock *clock = &mdev->clock;
> -
>   	if (!MLX5_PPS_CAP(mdev))
>   		return;
>   
>   	mlx5_get_pps_caps(mdev);
> -	mlx5_init_pin_config(clock);
> +	mlx5_init_pin_config(mdev);
>   }
>   
>   void mlx5_init_clock(struct mlx5_core_dev *mdev)

Overall if you fix that RCT issue then feel free to add my RB tag,
thanks.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ