From: Richard Cochran <richardcochran@gmail.com>
To: Willem de Bruijn <willemb@google.com>
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, davem@davemloft.net
Subject: Re: [PATCH net-next 1/7] net-timestamp: explicit SO_TIMESTAMPING ancillary data struct
Date: Wed, 25 Jun 2014 06:56:08 +0200 [thread overview]
Message-ID: <20140625045607.GC3845@localhost.localdomain> (raw)
In-Reply-To: <1403624632-17327-2-git-send-email-willemb@google.com>
On Tue, Jun 24, 2014 at 11:43:46AM -0400, Willem de Bruijn wrote:
> The code is backward compatible with legacy applications that treat
> the ancillary data as an anonymous array 'struct timespec data[3]'.
> It will break applications that test the size of the cmsg data.
I think this introduces an unacceptable ABI change.
In linuxptp we have
if (SOL_SOCKET == level && SO_TIMESTAMPING == type) {
if (cm->cmsg_len < sizeof(*ts) * 3) {
pr_warning("short SO_TIMESTAMPING message");
return -1;
}
ts = (struct timespec *) CMSG_DATA(cm);
}
but other applications might barf if the length isn't exactly right.
> +/**
> + * struct sock_errqueue_timestamping - timestamps exposed through cmsg
> + *
> + * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_*
> + * communicate network timestamps to userspace by passing this struct
> + * through a cmsg in recvmsg().
> + *
> + * @ts_sw: the sw timestamp: the contents depends on ts_type.
This would overload the field. I don't like that.
> + * @ts_hw_sys: a hardware generated timestamp converted to system time.
> + * @ts_hw_raw: a hardware generated timestamp converted in its raw format.
> + * @ts_type: the type of timestamp ts_sw. One of SCM_TSTAMP_*
> + * @ts_key: socket flow index that the timestamps correspond to
> + * (stream transport protocols only, e.g., TCP seqno)
> + *
> + * The first three fields are dictated by historical use. The hardware
> + * timestamps are empty unless hardware timestamping is enabled, but
> + * they have to be present in each message.
> + */
> +struct sock_errqueue_timestamping {
> + struct timespec ts_sw;
> + struct timespec ts_hw_sys;
> + struct timespec ts_hw_raw;
> + __u32 ts_key;
> + __u16 ts_type;
> + __u16 ts_padding;
> +};
> +
> +enum {
> + SCM_TSTAMP_SND = 1,
> + SCM_TSTAMP_ACK = 2,
> + SCM_TSTAMP_ENQ = 3
> +};
So why not simply introduce a new kind of CMSG for these new time
stamps? It appears that the use case for these is totally different
than for SO_TIMESTAMPING. I can't imagine why you would want to mix
them together.
Thanks,
Richard
next prev parent reply other threads:[~2014-06-25 4:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 15:43 net-timestamp: MSG_TSTAMP flags and bytestream support Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 1/7] net-timestamp: explicit SO_TIMESTAMPING ancillary data struct Willem de Bruijn
2014-06-25 4:56 ` Richard Cochran [this message]
2014-06-25 21:18 ` Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 2/7] net-timestamp: MSG_TSTAMP one-shot tx timestamps Willem de Bruijn
2014-06-25 5:01 ` Richard Cochran
2014-06-25 21:20 ` Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 3/7] net-timestamp: tx timestamp without payload Willem de Bruijn
2014-06-25 5:16 ` Richard Cochran
2014-06-25 21:22 ` Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 4/7] net-timestamp: TCP timestamping Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 5/7] net-timestamp: ACK timestamp for bytestreams Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 6/7] net-timestamp: ENQ timestamp on enqueue to traffic shaping layer Willem de Bruijn
2014-06-24 15:43 ` [PATCH net-next 7/7] net-timestamp: expand documentation Willem de Bruijn
2014-06-25 7:32 ` net-timestamp: MSG_TSTAMP flags and bytestream support Richard Cochran
2014-06-25 21:11 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140625045607.GC3845@localhost.localdomain \
--to=richardcochran@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.