From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jijie Shao <shaojijie@huawei.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Cc: shenjian15@huawei.com, wangpeiyang1@huawei.com,
liuyonglong@huawei.com, chenhao418@huawei.com,
jonathan.cameron@huawei.com,
shameerali.kolothum.thodi@huawei.com, salil.mehta@huawei.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 4/4] net: hns3: defer calling ptp_clock_register()
Date: Thu, 1 May 2025 00:28:33 +0100 [thread overview]
Message-ID: <88d7863d-bf2f-4e32-b480-ae8d62df4818@linux.dev> (raw)
In-Reply-To: <20250430093052.2400464-5-shaojijie@huawei.com>
On 30/04/2025 10:30, Jijie Shao wrote:
> From: Jian Shen <shenjian15@huawei.com>
>
> Currently the ptp_clock_register() is called before relative
> ptp resource ready. It may cause unexpected result when upper
> layer called the ptp API during the timewindow. Fix it by
> moving the ptp_clock_register() to the function end.
>
> Fixes: 0bf5eb788512 ("net: hns3: add support for PTP")
> Signed-off-by: Jian Shen <shenjian15@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> .../net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c
> index 59cc9221185f..ec581d4b696f 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c
> @@ -440,6 +440,13 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
> ptp->info.settime64 = hclge_ptp_settime;
>
> ptp->info.n_alarm = 0;
> +
> + spin_lock_init(&ptp->lock);
> + ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
> + ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
> + ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
> + hdev->ptp = ptp;
> +
> ptp->clock = ptp_clock_register(&ptp->info, &hdev->pdev->dev);
> if (IS_ERR(ptp->clock)) {
> dev_err(&hdev->pdev->dev,
> @@ -451,12 +458,6 @@ static int hclge_ptp_create_clock(struct hclge_dev *hdev)
> return -ENODEV;
> }
>
> - spin_lock_init(&ptp->lock);
> - ptp->io_base = hdev->hw.hw.io_base + HCLGE_PTP_REG_OFFSET;
> - ptp->ts_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
> - ptp->ts_cfg.tx_type = HWTSTAMP_TX_OFF;
> - hdev->ptp = ptp;
> -
> return 0;
> }
>
LGTM,
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
next prev parent reply other threads:[~2025-04-30 23:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 9:30 [PATCH net 0/4] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2025-04-30 9:30 ` [PATCH net 1/4] net: hns3: store rx VLAN tag offload state for VF Jijie Shao
2025-04-30 9:30 ` [PATCH net 2/4] net: hns3: fix an interrupt residual problem Jijie Shao
2025-04-30 9:30 ` [PATCH net 3/4] net: hns3: fixed debugfs tm_qset size Jijie Shao
2025-04-30 9:30 ` [PATCH net 4/4] net: hns3: defer calling ptp_clock_register() Jijie Shao
2025-04-30 23:28 ` Vadim Fedorenko [this message]
2025-05-01 14:30 ` [PATCH net 0/4] There are some bugfix for the HNS3 ethernet driver 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=88d7863d-bf2f-4e32-b480-ae8d62df4818@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=wangpeiyang1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).