staticint ionic_hwstamp_tx_mode(int config_tx_type)
{ switch (config_tx_type) { case HWTSTAMP_TX_OFF: return IONIC_TXSTAMP_OFF; case HWTSTAMP_TX_ON: return IONIC_TXSTAMP_ON; case HWTSTAMP_TX_ONESTEP_SYNC: return IONIC_TXSTAMP_ONESTEP_SYNC; case HWTSTAMP_TX_ONESTEP_P2P: return IONIC_TXSTAMP_ONESTEP_P2P; default: return -ERANGE;
}
}
static u64 ionic_hwstamp_rx_filt(int config_rx_filter)
{ switch (config_rx_filter) { case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: return IONIC_PKT_CLS_PTP1_ALL; case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: return IONIC_PKT_CLS_PTP1_SYNC; case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: return IONIC_PKT_CLS_PTP1_SYNC | IONIC_PKT_CLS_PTP1_DREQ;
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: return IONIC_PKT_CLS_PTP2_L4_ALL; case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: return IONIC_PKT_CLS_PTP2_L4_SYNC; case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: return IONIC_PKT_CLS_PTP2_L4_SYNC | IONIC_PKT_CLS_PTP2_L4_DREQ;
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: return IONIC_PKT_CLS_PTP2_L2_ALL; case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: return IONIC_PKT_CLS_PTP2_L2_SYNC; case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: return IONIC_PKT_CLS_PTP2_L2_SYNC | IONIC_PKT_CLS_PTP2_L2_DREQ;
case HWTSTAMP_FILTER_PTP_V2_EVENT: return IONIC_PKT_CLS_PTP2_ALL; case HWTSTAMP_FILTER_PTP_V2_SYNC: return IONIC_PKT_CLS_PTP2_SYNC; case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: return IONIC_PKT_CLS_PTP2_SYNC | IONIC_PKT_CLS_PTP2_DREQ;
case HWTSTAMP_FILTER_NTP_ALL: return IONIC_PKT_CLS_NTP_ALL;
/* Do not update phc during device upgrade, but keep polling to resume *afterupgrade.Sincewedon'tupdatethepointintimebasis,there *isnoexpectationthatwearemaintainingthephctimeduringthe *upgrade.Afterupgrade,itwillneedtobereadjustedbacktothe *correcttimebytheptpdaemon.
*/ if (test_bit(IONIC_LIF_F_FW_RESET, phc->lif->state)) return phc->aux_work_delay;
spin_lock_irqsave(&phc->lock, irqflags);
/* update point-in-time basis to now */
timecounter_read(&phc->tc);
/* Setphc commands are posted in-order, sequenced by phc->lock. We *needtodropthelockbeforewaitingforthecommandtocomplete.
*/
err = ionic_setphc_cmd(phc, &ctx);
/* max ticks is limited by the multiplier, or by the update period. */ if (phc->cc.shift + 2 + ilog2(IONIC_PHC_UPDATE_NS) >= 64) { /* max ticks that do not overflow when multiplied by max *adjustedmultiplier(twicetheinitialmultiplier)
*/
diff = U64_MAX / phc->cc.mult / 2;
} else { /* approx ticks at four times the update period */
diff = (u64)IONIC_PHC_UPDATE_NS << (phc->cc.shift + 2);
diff = DIV_ROUND_UP(diff, phc->cc.mult);
}
/* constrain to the hardware bitmask */
diff &= phc->cc.mask;
/* the wrap period is now defined by diff * *wewillupdatethetimebasisatabout1/4thewrapperiod,so *shouldnotseeadifferenceofmorethan+/-diff/4. * *thisissufficientnotseeadifferenceofmorethan+/-diff/2,as *requiredbytimecounter_cyc2time,todetectanoldtimestamp. * *adjusttheinitialmultiplier,beingcarefultoavoidoverflow: *-donotoverflow63bits:init_cc_mult*SCALED_PPM *-donotoverflow64bits:max_mult*(diff/2) * *wewanttoincreasetheinitialmultiplierasmuchaspossible,to *allowformorepreciseadjustmentinionic_phc_adjfine. * *onlyadjustthemultiplierifwecandoubleitormore.
*/
mult = U64_MAX / 2 / max(diff / 2, SCALED_PPM);
shift = mult / phc->cc.mult; if (shift >= 2) { /* initial multiplier will be 2^n of hardware cc.mult */
shift = fls(shift); /* increase cc.mult and cc.shift by the same 2^n and n. */
phc->cc.mult <<= shift;
phc->cc.shift += shift;
}
/* Update cycle_last at 1/4 the wrap period, or IONIC_PHC_UPDATE_NS */
delay = min_t(u64, IONIC_PHC_UPDATE_NS,
cyclecounter_cyc2ns(&phc->cc, diff / 4, 0, &frac));
dev_dbg(lif->ionic->dev, "Work delay %llu ms\n", delay / NSEC_PER_MSEC);
phc->aux_work_delay = nsecs_to_jiffies(delay);
phc->ptp_info = ionic_ptp_info;
/* We have allowed to adjust the multiplier up to +/- 1 part per 1. *HereexpressedasNORMAL_PPB(1billionpartsperbillion).
*/
phc->ptp_info.max_adj = NORMAL_PPB;
lif->phc = phc;
}
void ionic_lif_free_phc(struct ionic_lif *lif)
{ if (!lif->phc) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.