mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
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: ccc67ef50b
("qede: Error recovery process")
Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d434d02f7e
commit
1c85f394c2
3 changed files with 14 additions and 19 deletions
|
@ -1229,7 +1229,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
|
||||||
|
|
||||||
/* PTP not supported on VFs */
|
/* PTP not supported on VFs */
|
||||||
if (!is_vf)
|
if (!is_vf)
|
||||||
qede_ptp_enable(edev, (mode == QEDE_PROBE_NORMAL));
|
qede_ptp_enable(edev);
|
||||||
|
|
||||||
edev->ops->register_ops(cdev, &qede_ll_ops, edev);
|
edev->ops->register_ops(cdev, &qede_ll_ops, edev);
|
||||||
|
|
||||||
|
|
|
@ -412,6 +412,7 @@ void qede_ptp_disable(struct qede_dev *edev)
|
||||||
if (ptp->tx_skb) {
|
if (ptp->tx_skb) {
|
||||||
dev_kfree_skb_any(ptp->tx_skb);
|
dev_kfree_skb_any(ptp->tx_skb);
|
||||||
ptp->tx_skb = NULL;
|
ptp->tx_skb = NULL;
|
||||||
|
clear_bit_unlock(QEDE_FLAGS_PTP_TX_IN_PRORGESS, &edev->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable PTP in HW */
|
/* Disable PTP in HW */
|
||||||
|
@ -423,7 +424,7 @@ void qede_ptp_disable(struct qede_dev *edev)
|
||||||
edev->ptp = NULL;
|
edev->ptp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
|
static int qede_ptp_init(struct qede_dev *edev)
|
||||||
{
|
{
|
||||||
struct qede_ptp *ptp;
|
struct qede_ptp *ptp;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -444,25 +445,19 @@ static int qede_ptp_init(struct qede_dev *edev, bool init_tc)
|
||||||
/* Init work queue for Tx timestamping */
|
/* Init work queue for Tx timestamping */
|
||||||
INIT_WORK(&ptp->work, qede_ptp_task);
|
INIT_WORK(&ptp->work, qede_ptp_task);
|
||||||
|
|
||||||
/* Init cyclecounter and timecounter. This is done only in the first
|
/* Init cyclecounter and timecounter */
|
||||||
* load. If done in every load, PTP application will fail when doing
|
memset(&ptp->cc, 0, sizeof(ptp->cc));
|
||||||
* unload / load (e.g. MTU change) while it is running.
|
ptp->cc.read = qede_ptp_read_cc;
|
||||||
*/
|
ptp->cc.mask = CYCLECOUNTER_MASK(64);
|
||||||
if (init_tc) {
|
ptp->cc.shift = 0;
|
||||||
memset(&ptp->cc, 0, sizeof(ptp->cc));
|
ptp->cc.mult = 1;
|
||||||
ptp->cc.read = qede_ptp_read_cc;
|
|
||||||
ptp->cc.mask = CYCLECOUNTER_MASK(64);
|
|
||||||
ptp->cc.shift = 0;
|
|
||||||
ptp->cc.mult = 1;
|
|
||||||
|
|
||||||
timecounter_init(&ptp->tc, &ptp->cc,
|
timecounter_init(&ptp->tc, &ptp->cc, ktime_to_ns(ktime_get_real()));
|
||||||
ktime_to_ns(ktime_get_real()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
|
int qede_ptp_enable(struct qede_dev *edev)
|
||||||
{
|
{
|
||||||
struct qede_ptp *ptp;
|
struct qede_ptp *ptp;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -483,7 +478,7 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc)
|
||||||
|
|
||||||
edev->ptp = ptp;
|
edev->ptp = ptp;
|
||||||
|
|
||||||
rc = qede_ptp_init(edev, init_tc);
|
rc = qede_ptp_init(edev);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ void qede_ptp_rx_ts(struct qede_dev *edev, struct sk_buff *skb);
|
||||||
void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
|
void qede_ptp_tx_ts(struct qede_dev *edev, struct sk_buff *skb);
|
||||||
int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
|
int qede_ptp_hw_ts(struct qede_dev *edev, struct ifreq *req);
|
||||||
void qede_ptp_disable(struct qede_dev *edev);
|
void qede_ptp_disable(struct qede_dev *edev);
|
||||||
int qede_ptp_enable(struct qede_dev *edev, bool init_tc);
|
int qede_ptp_enable(struct qede_dev *edev);
|
||||||
int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
|
int qede_ptp_get_ts_info(struct qede_dev *edev, struct ethtool_ts_info *ts);
|
||||||
|
|
||||||
static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
|
static inline void qede_ptp_record_rx_ts(struct qede_dev *edev,
|
||||||
|
|
Loading…
Reference in a new issue