Avnu / OpenAvnu

OpenAvnu - an Avnu sponsored repository for Time Sensitive Network (TSN and AVB) technology
464 stars 289 forks source link

[Q]Clarification for: getTxTimestamp #828

Open rabipaikaray opened 5 years ago

rabipaikaray commented 5 years ago

The function getTxTimestamp is called after sending an event message like Sync, Pdelay_Req, Pdelay_resp to collect the timestamp of the event message already sent. After sending the event message consider the message Pdelay_resp, this function polls for the timestamp for 63ms before throwing an error timestamp cannot be collected.

    unsigned req = TX_TIMEOUT_BASE; //1ms
int iter = TX_TIMEOUT_ITER; //6

    ts_good = port->getTxTimestamp
    ( this, tx_timestamp, unused, false );
while( ts_good != GPTP_EC_SUCCESS && iter-- != 0 )
{
    timer->sleep(req);
    if (ts_good != GPTP_EC_EAGAIN && iter < 1)
        GPTP_LOG_ERROR(
            "Error (TX) timestamping PDelay request "
            "(Retrying-%d), error=%d", iter, ts_good);
    ts_good = port->getTxTimestamp
        ( this, tx_timestamp, unused , iter == 0 );
    req *= 2;
}

My questions here are: -How did we come to a conclusion for this 63ms? Is this 63ms decided after a worst case delay of getting the timestamp from Kernel to user space? -Looks to me 63 ms is very high to full fill certain cases. Consider a case where device is configured as a master and received a Pdelay_Req message. After receiving the message it has to send Pdelay_resp and Pdelay_resp_follow_up within 10ms turnaround time. If the Pdelay_resp is getting timestamp beyond 10 ms slave might increase the timeout counter

Same also holds good for a Sync message sent and Follow_up packet has to be processed by getting the timestamp. If getting the timestamp is delayed to almost 60ms and master is sending the Follow_up after 60ms of Sync sent. Is it valid from protocol point of view?

Please reply if anyone has already done any analysis of this.

Thanks in advance.