Commit 91f559d3 authored by Alessandro Rubini's avatar Alessandro Rubini

time-unix: fix dumping of tx/rx timestamps

At frame level 1, we should print tx/rx timestamps we get.
Also, fix the printout to use %llx for the "secs" field, now that
is is 64 bits (2038 is coming).

Meanwhile, remove some redundant "if (t)", because all frame operations
have called with a valid timestamp pointer.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>

bah! next commit
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 9ff7f9cd
......@@ -120,8 +120,8 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
}
/* This is not really hw... */
pp_diag(ppi, time, 2, "recv stamp: %i.%09i (%s)\n",
(int)t->secs, (int)(t->scaled_nsecs >> 16),
pp_diag(ppi, time, 1, "recv stamp: %lli.%09i (%s)\n",
(long long)t->secs, (int)(t->scaled_nsecs >> 16),
tv ? "kernel" : "user");
return ret;
}
......@@ -198,8 +198,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
/* To fake a network frame loss, set the timestamp and do not send */
if (ppsi_drop_tx()) {
if (t)
ppi->t_ops->get(ppi, t);
ppi->t_ops->get(ppi, t);
pp_diag(ppi, frames, 1, "Drop sent frame\n");
return len;
}
......@@ -213,8 +212,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(hdr->h_source, ch->addr, ETH_ALEN);
if (t)
ppi->t_ops->get(ppi, t);
ppi->t_ops->get(ppi, t);
ret = send(ch->fd, hdr, len, 0);
if (ret < 0) {
......@@ -222,6 +220,9 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
strerror(errno));
return ret;
}
pp_diag(ppi, time, 1, "send stamp: %lli.%09i (%s)\n",
(long long)t->secs, (int)(t->scaled_nsecs >> 16),
"user");
if (pp_diag_allow(ppi, frames, 2))
dump_1588pkt("send: ", pkt, len, t, -1);
return ret;
......@@ -236,8 +237,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
memcpy(hdr->h_dest, macaddr[is_pdelay], ETH_ALEN);
memcpy(vhdr->h_source, ch->addr, ETH_ALEN);
if (t)
ppi->t_ops->get(ppi, t);
ppi->t_ops->get(ppi, t);
ret = send(ch->fd, vhdr, len, 0);
if (ret < 0) {
......@@ -245,6 +245,9 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
strerror(errno));
return ret;
}
pp_diag(ppi, time, 1, "send stamp: %lli.%09i (%s)\n",
(long long)t->secs, (int)(t->scaled_nsecs >> 16),
"user");
if (pp_diag_allow(ppi, frames, 2))
dump_1588pkt("send: ", vhdr, len, t, ppi->peer_vid);
......@@ -253,8 +256,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
addr.sin_port = htons(udpport[chtype]);
addr.sin_addr.s_addr = ppi->mcast_addr[is_pdelay];
if (t)
ppi->t_ops->get(ppi, t);
ppi->t_ops->get(ppi, t);
ret = sendto(ppi->ch[chtype].fd, pkt, len, 0,
(struct sockaddr *)&addr,
......@@ -264,6 +266,9 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
strerror(errno));
return ret;
}
pp_diag(ppi, time, 1, "send stamp: %lli.%09i (%s)\n",
(long long)t->secs, (int)(t->scaled_nsecs >> 16),
"user");
if (pp_diag_allow(ppi, frames, 2))
dump_payloadpkt("send: ", pkt, len, t);
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment