Willem de Bruijn
2021-Feb-09 14:45 UTC
[PATCH RFC v2 3/4] virtio-net: support transmit timestamp
On Tue, Feb 9, 2021 at 4:43 AM Michael S. Tsirkin <mst at redhat.com> wrote:> > On Mon, Feb 08, 2021 at 01:55:57PM -0500, Willem de Bruijn wrote: > > From: Willem de Bruijn <willemb at google.com> > > > > Add optional PTP hardware tx timestamp offload for virtio-net. > > > > Accurate RTT measurement requires timestamps close to the wire. > > Introduce virtio feature VIRTIO_NET_F_TX_TSTAMP, the transmit > > equivalent to VIRTIO_NET_F_RX_TSTAMP. > > > > The driver sets VIRTIO_NET_HDR_F_TSTAMP to request a timestamp > > returned on completion. If the feature is negotiated, the device > > either places the timestamp or clears the feature bit. > > > > The timestamp straddles (virtual) hardware domains. Like PTP, use > > international atomic time (CLOCK_TAI) as global clock base. The driver > > must sync with the device, e.g., through kvm-clock. > > > > Modify can_push to ensure that on tx completion the header, and thus > > timestamp, is in a predicatable location at skb_vnet_hdr. > > > > RFC: this implementation relies on the device writing to the buffer. > > That breaks DMA_TO_DEVICE semantics. For now, disable when DMA is on. > > If you do something like this, please do it in the validate > callback and clear the features you aren't using.Ah yes. Thanks for the tip. I'll do that .. .. once I'm sure that this approach of using an outbuf for I/O is actually allowed behavior. I'm not entirely convinced yet myself. Jason also pointed out more specific concerns. I'll look into that further.