Skip to content

Commit f1bb812

Browse files
committed
bnxt_en: Refactor bnxt_ptp_init()
JIRA: https://issues.redhat.com/browse/RHEL-54644 JIRA: https://issues.redhat.com/browse/RHEL-69499 commit 1e9614c Author: Michael Chan <michael.chan@broadcom.com> Date: Fri Nov 22 14:45:45 2024 -0800 bnxt_en: Refactor bnxt_ptp_init() Instead of passing the 2nd parameter phc_cfg to bnxt_ptp_init(). Store it in bp->ptp_cfg so that the caller doesn't need to know what the value should be. In the next patch, we'll need to call bnxt_ptp_init() in bnxt_resume() and this will make it easier. Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
1 parent 5f3ec12 commit f1bb812

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9053,7 +9053,6 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
90539053
struct hwrm_port_mac_ptp_qcfg_output *resp;
90549054
struct hwrm_port_mac_ptp_qcfg_input *req;
90559055
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
9056-
bool phc_cfg;
90579056
u8 flags;
90589057
int rc;
90599058

@@ -9100,8 +9099,9 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
91009099
rc = -ENODEV;
91019100
goto exit;
91029101
}
9103-
phc_cfg = (flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0;
9104-
rc = bnxt_ptp_init(bp, phc_cfg);
9102+
ptp->rtc_configured =
9103+
(flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0;
9104+
rc = bnxt_ptp_init(bp);
91059105
if (rc)
91069106
netdev_warn(bp->dev, "PTP initialization failed.\n");
91079107
exit:

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ static void bnxt_ptp_free(struct bnxt *bp)
10241024
}
10251025
}
10261026

1027-
int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
1027+
int bnxt_ptp_init(struct bnxt *bp)
10281028
{
10291029
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
10301030
int rc;
@@ -1047,7 +1047,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
10471047

10481048
if (BNXT_PTP_USE_RTC(bp)) {
10491049
bnxt_ptp_timecounter_init(bp, false);
1050-
rc = bnxt_ptp_init_rtc(bp, phc_cfg);
1050+
rc = bnxt_ptp_init_rtc(bp, ptp->rtc_configured);
10511051
if (rc)
10521052
goto out;
10531053
} else {

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ struct bnxt_ptp_cfg {
133133
BNXT_PTP_MSG_PDELAY_REQ | \
134134
BNXT_PTP_MSG_PDELAY_RESP)
135135
u8 tx_tstamp_en:1;
136+
u8 rtc_configured:1;
136137
int rx_filter;
137138
u32 tstamp_filters;
138139

@@ -180,6 +181,6 @@ void bnxt_tx_ts_cmp(struct bnxt *bp, struct bnxt_napi *bnapi,
180181
struct tx_ts_cmp *tscmp);
181182
void bnxt_ptp_rtc_timecounter_init(struct bnxt_ptp_cfg *ptp, u64 ns);
182183
int bnxt_ptp_init_rtc(struct bnxt *bp, bool phc_cfg);
183-
int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg);
184+
int bnxt_ptp_init(struct bnxt *bp);
184185
void bnxt_ptp_clear(struct bnxt *bp);
185186
#endif

0 commit comments

Comments
 (0)