transport: Introduce method for fetching a deferred transmit time stamp.
When a messages is sent with the DEFER_EVENT flag, the lower transport code does not fetch the time stamp right away. This patch introduces a method that allows a second call to retrieve the waiting transmit time stamp. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
e160bad721
commit
5f9163af4b
11
transport.c
11
transport.c
|
@ -66,6 +66,17 @@ int transport_sendto(struct transport *t, struct fdarray *fda,
|
||||||
return t->send(t, fda, event, 0, msg, len, &msg->address, &msg->hwts);
|
return t->send(t, fda, event, 0, msg, len, &msg->address, &msg->hwts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int transport_txts(struct transport *t, struct fdarray *fda,
|
||||||
|
struct ptp_message *msg)
|
||||||
|
{
|
||||||
|
int cnt, len = ntohs(msg->header.messageLength);
|
||||||
|
struct hw_timestamp *hwts = &msg->hwts;
|
||||||
|
unsigned char pkt[1600];
|
||||||
|
|
||||||
|
cnt = sk_receive(fda->fd[FD_EVENT], pkt, len, NULL, hwts, MSG_ERRQUEUE);
|
||||||
|
return cnt > 0 ? 0 : cnt;
|
||||||
|
}
|
||||||
|
|
||||||
int transport_physical_addr(struct transport *t, uint8_t *addr)
|
int transport_physical_addr(struct transport *t, uint8_t *addr)
|
||||||
{
|
{
|
||||||
if (t->physical_addr) {
|
if (t->physical_addr) {
|
||||||
|
|
13
transport.h
13
transport.h
|
@ -101,6 +101,19 @@ int transport_peer(struct transport *t, struct fdarray *fda,
|
||||||
int transport_sendto(struct transport *t, struct fdarray *fda,
|
int transport_sendto(struct transport *t, struct fdarray *fda,
|
||||||
enum transport_event event, struct ptp_message *msg);
|
enum transport_event event, struct ptp_message *msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the transmit time stamp for a PTP message that was sent
|
||||||
|
* with the TRANS_DEFER_EVENT flag.
|
||||||
|
*
|
||||||
|
* @param t The transport.
|
||||||
|
* @param fda The array of descriptors filled in by transport_open.
|
||||||
|
* @param msg The message previously sent using transport_send(),
|
||||||
|
* transport_peer(), or transport_sendto().
|
||||||
|
* @return Zero on success, or negative value in case of an error.
|
||||||
|
*/
|
||||||
|
int transport_txts(struct transport *t, struct fdarray *fda,
|
||||||
|
struct ptp_message *msg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the transport's type.
|
* Returns the transport's type.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue