From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFB33C433E0 for ; Tue, 29 Dec 2020 09:17:59 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88AE3207CF for ; Tue, 29 Dec 2020 09:17:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88AE3207CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2FD21871B9; Tue, 29 Dec 2020 09:17:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E8JDUo+iXmSN; Tue, 29 Dec 2020 09:17:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 6576F871B4; Tue, 29 Dec 2020 09:17:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4CDB1C088B; Tue, 29 Dec 2020 09:17:58 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4722BC0174 for ; Tue, 29 Dec 2020 09:17:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 291012047B for ; Tue, 29 Dec 2020 09:17:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L3uy9jXePdlV for ; Tue, 29 Dec 2020 09:17:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by silver.osuosl.org (Postfix) with ESMTPS id 986202040B for ; Tue, 29 Dec 2020 09:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609233473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3a+7ld4pVpI/jzF0LVQOcnm0TWniIUVAixPWA1eaWIc=; b=N4zdhuL1+BBvUcZo/W2swrF0oX6vft8ga+RaAFI5qpAYnrDOwdmFBfUvpbNBlMMpG6Z2/+ PiILXNChdNvC6aSz9SekVeNrnnVJjVgjO5Lp+rEFLx13NDTJGXUTMkWiQOWbM0DLPH7TOd rWVhQH6zwZLHdxNTmckIjdFLTVWZU3M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-QuVpKqhuPhqdVu6Y8DRa_w-1; Tue, 29 Dec 2020 04:17:49 -0500 X-MC-Unique: QuVpKqhuPhqdVu6Y8DRa_w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2AE31801817; Tue, 29 Dec 2020 09:17:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D12360BE5; Tue, 29 Dec 2020 09:17:48 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 061F718095FF; Tue, 29 Dec 2020 09:17:48 +0000 (UTC) Date: Tue, 29 Dec 2020 04:17:29 -0500 (EST) From: Jason Wang To: Willem de Bruijn Message-ID: <1881606476.40780520.1609233449300.JavaMail.zimbra@redhat.com> In-Reply-To: References: <20201228162233.2032571-1-willemdebruijn.kernel@gmail.com> <20201228162233.2032571-3-willemdebruijn.kernel@gmail.com> <20201228122253-mutt-send-email-mst@kernel.org> <20201228162903-mutt-send-email-mst@kernel.org> Subject: Re: [PATCH rfc 2/3] virtio-net: support receive timestamp MIME-Version: 1.0 X-Originating-IP: [10.68.5.20, 10.4.195.11] Thread-Topic: virtio-net: support receive timestamp Thread-Index: ZlLLJvNx7Gch4gx6qQxAB6fxhIb6TQ== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Cc: Network Development , virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" ----- Original Message ----- > On Mon, Dec 28, 2020 at 7:55 PM Michael S. Tsirkin wrote: > > > > On Mon, Dec 28, 2020 at 02:30:31PM -0500, Willem de Bruijn wrote: > > > On Mon, Dec 28, 2020 at 12:29 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Dec 28, 2020 at 11:22:32AM -0500, Willem de Bruijn wrote: > > > > > From: Willem de Bruijn > > > > > > > > > > Add optional PTP hardware timestamp offload for virtio-net. > > > > > > > > > > Accurate RTT measurement requires timestamps close to the wire. > > > > > Introduce virtio feature VIRTIO_NET_F_RX_TSTAMP. If negotiated, the > > > > > virtio-net header is expanded with room for a timestamp. A host may > > > > > pass receive timestamps for all or some packets. A timestamp is valid > > > > > if non-zero. > > > > > > > > > > The timestamp straddles (virtual) hardware domains. Like PTP, use > > > > > international atomic time (CLOCK_TAI) as global clock base. It is > > > > > guest responsibility to sync with host, e.g., through kvm-clock. > > > > > > > > > > Signed-off-by: Willem de Bruijn > > > > > diff --git a/include/uapi/linux/virtio_net.h > > > > > b/include/uapi/linux/virtio_net.h > > > > > index f6881b5b77ee..0ffe2eeebd4a 100644 > > > > > --- a/include/uapi/linux/virtio_net.h > > > > > +++ b/include/uapi/linux/virtio_net.h > > > > > @@ -57,6 +57,7 @@ > > > > > * Steering */ > > > > > #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ > > > > > > > > > > +#define VIRTIO_NET_F_RX_TSTAMP 55 /* Host sends TAI > > > > > receive time */ > > > > > #define VIRTIO_NET_F_TX_HASH 56 /* Guest sends hash report */ > > > > > #define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */ > > > > > #define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */ > > > > > @@ -182,6 +183,17 @@ struct virtio_net_hdr_v1_hash { > > > > > }; > > > > > }; > > > > > > > > > > +struct virtio_net_hdr_v12 { > > > > > + struct virtio_net_hdr_v1 hdr; > > > > > + struct { > > > > > + __le32 value; > > > > > + __le16 report; > > > > > + __le16 flow_state; > > > > > + } hash; > > > > > + __virtio32 reserved; > > > > > + __virtio64 tstamp; > > > > > +}; > > > > > + > > > > > #ifndef VIRTIO_NET_NO_LEGACY > > > > > /* This header comes first in the scatter-gather list. > > > > > * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it > > > > > must > > > > > > > > > > > > So it looks like VIRTIO_NET_F_RX_TSTAMP should depend on both > > > > VIRTIO_NET_F_RX_TSTAMP and VIRTIO_NET_F_HASH_REPORT then? > > > > > > Do you mean VIRTIO_NET_F_TX_TSTAMP depends on VIRTIO_NET_F_RX_TSTAMP? > > > > > > I think if either is enabled we need to enable the extended layout. > > > Regardless of whether TX_HASH or HASH_REPORT are enabled. If they are > > > not, then those fields are ignored. > > > > I mean do we waste the 8 bytes for hash if TSTAMP is set but HASH is not? > > If TSTAMP depends on HASH then point is moot. > > True, but the two features really are independent. > > I did consider using configurable metadata layout depending on > features negotiated. If there are tons of optional extensions, that > makes sense. But it is more complex and parsing error prone. With a > handful of options each of a few bytes, that did not seem worth the > cost to me at this point. Consider NFV workloads(64B) packet. Most fields of current vnet header is even a burdern. It might be the time to introduce configurable or self-descriptive vnet header. > > And importantly, such a mode can always be added later as a separate > VIRTIO_NET_F_PACKED_HEADER option. What will do feature provide? Thanks > > If anything, perhaps if we increase the virtio_net_hdr_* allocation, > we should allocate some additional reserved space now? As each new > size introduces quite a bit of boilerplate. Also, e.g., in qemu just > to pass the sizes between virtio-net driver and vhost-net device. > > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization