Skip to content

Commit 1c85f39

Browse files
solbjorndavem330
authored andcommitted
net: qede: fix PTP initialization on recovery
Currently PTP cyclecounter and timecounter are initialized only on the first probing and are cleaned up during removal. This means that PTP becomes non-functional after device recovery. Fix this by unconditional PTP initialization on probing and clearing Tx pending bit on exiting. Fixes: ccc67ef ("qede: Error recovery process") Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d434d02 commit 1c85f39

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

drivers/net/ethernet/qlogic/qede/qede_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
12291229

12301230
/* PTP not supported on VFs */
12311231
if (!is_vf)
1232-
qede_ptp_enable(edev, (mode == QEDE_PROBE_NORMAL));
1232+
qede_ptp_enable(edev);
12331233

12341234
edev->ops->register_ops(cdev, &qede_ll_ops, edev);
12351235

drivers/net/ethernet/qlogic/qede/qede_ptp.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ void qede_ptp_disable(struct qede_dev *edev)
412412
if (ptp->tx_skb) {
413413
dev_kfree_skb_any(ptp->tx_skb);
414414
ptp->tx_skb = NULL;
415+
clear_bit_unlock(QEDE_FLAGS_PTP_TX_IN_PRORGESS, &edev->flags);
415416
}
416417

417418
/* Disable PTP in HW */
@@ -423,7 +424,7 @@ void qede_ptp_disable(struct qede_dev *edev)
423424
edev->ptp = NULL;
424425
}
425426

426-
static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
427+
static int qede_ptp_init(struct qede_dev *edev)
427428
{
428429
struct qede_ptp *ptp;
429430
int rc;
@@ -444,25 +445,19 @@ static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
444445
/* Init work queue for Tx timestamping */
445446
INIT_WORK(&ptp->work, qede_ptp_task);
446447

447-
/* Init cyclecounter and timecounter. This is done only in the first
448-
* load. If done in every load, PTP application will fail when doing
449-
* unload / load (e.g. MTU change) while it is running.
450-
*/
451-
if (init_tc) {
452-
memset(&ptp->cc, 0, sizeof(ptp->cc));
453-
ptp->cc.read = qede_ptp_read_cc;
454-
ptp->cc.mask = CYCLECOUNTER_MASK(64);
455-
ptp->cc.shift = 0;
456-
ptp->cc.mult = 1;
457-
458-
timecounter_init(&ptp->tc, &ptp->cc,
459-
ktime_to_ns(ktime_get_real()));
460-
}
448+
/* Init cyclecounter and timecounter */
449+
memset(&ptp->cc, 0, sizeof(ptp->cc));
450+
ptp->cc.read = qede_ptp_read_cc;
451+
ptp->cc.mask = CYCLECOUNTER_MASK(64);
452+
ptp->cc.shift = 0;
453+
ptp->cc.mult = 1;
461454

462-
return rc;
455+
timecounter_init(&ptp->tc, &ptp->cc, ktime_to_ns(ktime_get_real()));
456+
457+
return 0;
463458
}
464459

465-
int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
460+
int qede_ptp_enable(struct qede_dev *edev)
466461
{
467462
struct qede_ptp *ptp;
468463
int rc;
@@ -483,7 +478,7 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
483478

484479
edev->ptp = ptp;
485480

486-
rc = qede_ptp_init(edev, init_tc);
481+
rc = qede_ptp_init(edev);
487482
if (rc)
488483
goto err1;
489484

drivers/net/ethernet/qlogic/qede/qede_ptp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);
4141
void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
4242
int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
4343
void qede_ptp_disable(struct qede_dev *edev);
44-
int qede_ptp_enable(struct qede_dev *edev, bool init_tc);
44+
int qede_ptp_enable(struct qede_dev *edev);
4545
int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
4646

4747
static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,

0 commit comments

Comments
 (0)