|
@@ -801,9 +801,14 @@ fail:
|
|
static int efx_ptp_stop(struct efx_nic *efx)
|
|
static int efx_ptp_stop(struct efx_nic *efx)
|
|
{
|
|
{
|
|
struct efx_ptp_data *ptp = efx->ptp_data;
|
|
struct efx_ptp_data *ptp = efx->ptp_data;
|
|
- int rc = efx_ptp_disable(efx);
|
|
|
|
struct list_head *cursor;
|
|
struct list_head *cursor;
|
|
struct list_head *next;
|
|
struct list_head *next;
|
|
|
|
+ int rc;
|
|
|
|
+
|
|
|
|
+ if (ptp == NULL)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ rc = efx_ptp_disable(efx);
|
|
|
|
|
|
if (ptp->rxfilter_installed) {
|
|
if (ptp->rxfilter_installed) {
|
|
efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED,
|
|
efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED,
|
|
@@ -828,6 +833,13 @@ static int efx_ptp_stop(struct efx_nic *efx)
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int efx_ptp_restart(struct efx_nic *efx)
|
|
|
|
+{
|
|
|
|
+ if (efx->ptp_data && efx->ptp_data->enabled)
|
|
|
|
+ return efx_ptp_start(efx);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
static void efx_ptp_pps_worker(struct work_struct *work)
|
|
static void efx_ptp_pps_worker(struct work_struct *work)
|
|
{
|
|
{
|
|
struct efx_ptp_data *ptp =
|
|
struct efx_ptp_data *ptp =
|
|
@@ -1125,7 +1137,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
|
|
{
|
|
{
|
|
if ((enable_wanted != efx->ptp_data->enabled) ||
|
|
if ((enable_wanted != efx->ptp_data->enabled) ||
|
|
(enable_wanted && (efx->ptp_data->mode != new_mode))) {
|
|
(enable_wanted && (efx->ptp_data->mode != new_mode))) {
|
|
- int rc;
|
|
|
|
|
|
+ int rc = 0;
|
|
|
|
|
|
if (enable_wanted) {
|
|
if (enable_wanted) {
|
|
/* Change of mode requires disable */
|
|
/* Change of mode requires disable */
|
|
@@ -1142,7 +1154,8 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
|
|
* succeed.
|
|
* succeed.
|
|
*/
|
|
*/
|
|
efx->ptp_data->mode = new_mode;
|
|
efx->ptp_data->mode = new_mode;
|
|
- rc = efx_ptp_start(efx);
|
|
|
|
|
|
+ if (netif_running(efx->net_dev))
|
|
|
|
+ rc = efx_ptp_start(efx);
|
|
if (rc == 0) {
|
|
if (rc == 0) {
|
|
rc = efx_ptp_synchronize(efx,
|
|
rc = efx_ptp_synchronize(efx,
|
|
PTP_SYNC_ATTEMPTS * 2);
|
|
PTP_SYNC_ATTEMPTS * 2);
|
|
@@ -1515,3 +1528,14 @@ void efx_ptp_probe(struct efx_nic *efx)
|
|
efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] =
|
|
efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] =
|
|
&efx_ptp_channel_type;
|
|
&efx_ptp_channel_type;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void efx_ptp_start_datapath(struct efx_nic *efx)
|
|
|
|
+{
|
|
|
|
+ if (efx_ptp_restart(efx))
|
|
|
|
+ netif_err(efx, drv, efx->net_dev, "Failed to restart PTP.\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void efx_ptp_stop_datapath(struct efx_nic *efx)
|
|
|
|
+{
|
|
|
|
+ efx_ptp_stop(efx);
|
|
|
|
+}
|