Commit ccc3d902 authored by Alessandro Rubini's avatar Alessandro Rubini

diag: use new 'frames' diagnostics

By passing "-V -d 001" now I get level-1 diagnostics for frames (i.e.
sending and receiving):

Slave:

   diag-frames-1-eth0: RECV 44 bytes at 1362665418.025198568 (type 0)
   diag-frames-1-eth0: RECV 44 bytes at 1362665418.025970153 (type 8)
   diag-frames-1-eth0: SENT 44 bytes at 1362665416.806670510 (delay_req)
   diag-frames-1-eth0: RECV 54 bytes at 1362665416.808217467 (type 9)

Master:

   diag-frames-1-eth0: SENT 64 bytes at 1362665415.430554014 (announce)
   diag-frames-1-eth0: SENT 44 bytes at 1362665416.612818573 (sync)
   diag-frames-1-eth0: SENT 44 bytes at 1362665416.613056524 (follow_up)
   diag-frames-1-eth0: RECV 44 bytes at 1362665416.807983194 (type 1)
   diag-frames-1-eth0: SENT 54 bytes at 1362665416.808206209 (delay_resp)

(note: we don't tell names at receive time because the frame is still
to be validated).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 97f3751f
......@@ -65,12 +65,12 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
struct pp_state_table_item *ip;
int state, err = 0;
if (plen && pp_verbose_frames) {
PP_VPRINTF("RECV %02d bytes at %d.%09d (type %x)\n", plen,
if (plen)
pp_diag(ppi, frames, 1,
"RECV %02d bytes at %d.%09d (type %x)\n", plen,
(int)ppi->last_rcv_time.seconds,
(int)ppi->last_rcv_time.nanoseconds,
packet[0] & 0xf);
}
/*
* Since all ptp frames have the same header, parse it now.
......
......@@ -41,14 +41,12 @@ static inline int __send_and_log(struct pp_instance *ppi, int msglen,
{
if (ppi->n_ops->send(ppi, ppi->tx_frame, msglen + NP(ppi)->ptp_offset,
&ppi->last_snt_time, chtype, 0) < msglen) {
if (pp_verbose_frames)
PP_PRINTF("%s(%d) Message can't be sent\n",
pp_diag(ppi, frames, 1, "%s(%d) Message can't be sent\n",
pp_msg_names[msgtype], msgtype);
return -1;
}
/* FIXME: verbose_frames should be looped back in the send method */
if (pp_verbose_frames)
PP_VPRINTF("SENT %02d %d.%09d %s\n", msglen,
/* FIXME: diagnosticst should be looped back in the send method */
pp_diag(ppi, frames, 1, "SENT %02d bytes at %d.%09d (%s)\n", msglen,
ppi->last_snt_time.seconds,
ppi->last_snt_time.nanoseconds,
pp_msg_names[msgtype]);
......
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