From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Mateusz Polchlopek <mateusz.polchlopek@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
Gal Pressman <gal@nvidia.com>, Jianbo Liu <jianbol@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>,
Mark Bloch <mbloch@nvidia.com>,
Carolina Jubran <cjubran@nvidia.com>,
Dragos Tatulea <dtatulea@nvidia.com>
Subject: Re: [PATCH net-next 02/15] net/mlx5: Change parameters for PTP internal functions
Date: Wed, 5 Feb 2025 08:08:50 +0200 [thread overview]
Message-ID: <c6ab4404-bcc3-40c4-bf86-1fa9c5770202@gmail.com> (raw)
In-Reply-To: <fcac69dd-d579-4f8b-bd0d-30cb6c2455eb@intel.com>
On 04/02/2025 10:51, Mateusz Polchlopek wrote:
>
>
> On 2/3/2025 10:35 PM, Tariq Toukan wrote:
>> From: Jianbo Liu <jianbol@nvidia.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@nvidia.com>
>> Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
>> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.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.
>
This is an existing line of code.
Due to dependency, clock had to come before.
I wouldn't split 'timer' just for this reason. Readability is not hurt.
Let's keep it as is.
>> 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.
>
Thanks for your review.
next prev parent reply other threads:[~2025-02-05 6:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 21:35 [PATCH net-next 00/15] Support one PTP device per hardware clock Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 01/15] net/mlx5: Add helper functions for PTP callbacks Tariq Toukan
2025-02-04 8:43 ` Mateusz Polchlopek
2025-02-05 6:04 ` Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 02/15] net/mlx5: Change parameters for PTP internal functions Tariq Toukan
2025-02-04 8:51 ` Mateusz Polchlopek
2025-02-05 6:08 ` Tariq Toukan [this message]
2025-02-03 21:35 ` [PATCH net-next 03/15] net/mlx5: Add init and destruction functions for a single HW clock Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 04/15] net/mlx5: Add API to get mlx5_core_dev from mlx5_clock Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 05/15] net/mlx5: Change clock in mlx5_core_dev to mlx5_clock pointer Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 06/15] net/mlx5: Add devcom component for the clock shared by functions Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 07/15] net/mlx5: Move PPS notifier and out_work to clock_state Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 08/15] net/mlx5: Support one PTP device per hardware clock Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 09/15] net/mlx5: Generate PPS IN event on new function for shared clock Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 10/15] ethtool: Add support for 200Gbps per lane link modes Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 11/15] net/mlx5: " Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 12/15] net/mlx5e: Support FEC settings for 200G " Tariq Toukan
2025-02-03 21:35 ` [PATCH net-next 13/15] net/mlx5: Remove stray semicolon in LAG port selection table creation Tariq Toukan
2025-02-04 8:21 ` Kalesh Anakkur Purayil
2025-02-03 21:35 ` [PATCH net-next 14/15] net/mlx5e: Remove unused mlx5e_tc_flow_action struct Tariq Toukan
2025-02-04 8:22 ` Kalesh Anakkur Purayil
2025-02-03 21:35 ` [PATCH net-next 15/15] net/mlx5e: Avoid WARN_ON when configuring MQPRIO with HTB offload enabled Tariq Toukan
2025-02-04 8:21 ` Kalesh Anakkur Purayil
2025-02-05 6:14 ` [PATCH net-next 00/15] Support one PTP device per hardware clock Tariq Toukan
2025-02-06 9:09 ` Paolo Abeni
2025-02-06 9:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c6ab4404-bcc3-40c4-bf86-1fa9c5770202@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jianbol@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=mateusz.polchlopek@intel.com \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.