From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C5F27A0093; Tue, 10 May 2022 22:17:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 921CE4282B; Tue, 10 May 2022 22:17:33 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0A25F4282E for ; Tue, 10 May 2022 22:17:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652213851; 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=Fgh/JaoE7AuhCPks92d5TYEQgnGedg99mZtYs+tQHjU=; b=TMF3c3nZU58OGmzOrTnEUsi8o7jq6uSn4ISGeRKFFxE7mGq8JxSKwFeQKp/8MiTuWI7TiM R4rm8AjWYAQQEMcHqa1UTDkqXp/xp3aPL1Khv3EZIFTIuBuHe/aWR/paG2sW1/Gxb2BdlO 5in68r0dgwVwwvViZNK+B9jDA6ddDQQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-50-S-UECU-SPxWWoA0r15QhbA-1; Tue, 10 May 2022 16:17:30 -0400 X-MC-Unique: S-UECU-SPxWWoA0r15QhbA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A9E5811E75; Tue, 10 May 2022 20:17:30 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F03D40CF8ED; Tue, 10 May 2022 20:17:28 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, i.maximets@ovn.org Cc: Maxime Coquelin Subject: [PATCH 5/5] vhost: add statistics for in-flight packets Date: Tue, 10 May 2022 22:17:20 +0200 Message-Id: <20220510201720.1262368-6-maxime.coquelin@redhat.com> In-Reply-To: <20220510201720.1262368-1-maxime.coquelin@redhat.com> References: <20220510201720.1262368-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds statistics for packets in-flight submission and completion, when Vhost async mode is used. Signed-off-by: Maxime Coquelin --- lib/vhost/vhost.c | 2 ++ lib/vhost/vhost.h | 2 ++ lib/vhost/virtio_net.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 721b3a3247..d9d31b2d03 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -45,6 +45,8 @@ static const struct vhost_vq_stats_name_off vhost_vq_stat_strings[] = { {"guest_notifications", offsetof(struct vhost_virtqueue, stats.guest_notifications)}, {"iotlb_hits", offsetof(struct vhost_virtqueue, stats.iotlb_hits)}, {"iotlb_misses", offsetof(struct vhost_virtqueue, stats.iotlb_misses)}, + {"inflight_submitted", offsetof(struct vhost_virtqueue, stats.inflight_submitted)}, + {"inflight_completed", offsetof(struct vhost_virtqueue, stats.inflight_completed)}, }; #define VHOST_NB_VQ_STATS RTE_DIM(vhost_vq_stat_strings) diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index 872675207e..1573d0afe9 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -136,6 +136,8 @@ struct virtqueue_stats { uint64_t guest_notifications; uint64_t iotlb_hits; uint64_t iotlb_misses; + uint64_t inflight_submitted; + uint64_t inflight_completed; }; /** diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index b1ea9fa4a5..c8905c770a 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -2115,6 +2115,7 @@ rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts, count, dma_id, vchan_id); vhost_queue_stats_update(dev, vq, pkts, n_pkts_cpl); + vq->stats.inflight_completed += n_pkts_cpl; out: rte_spinlock_unlock(&vq->access_lock); @@ -2158,6 +2159,9 @@ rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id, n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts, count, dma_id, vchan_id); + vhost_queue_stats_update(dev, vq, pkts, n_pkts_cpl); + vq->stats.inflight_completed += n_pkts_cpl; + return n_pkts_cpl; } @@ -2207,6 +2211,8 @@ virtio_dev_rx_async_submit(struct virtio_net *dev, uint16_t queue_id, nb_tx = virtio_dev_rx_async_submit_split(dev, vq, queue_id, pkts, count, dma_id, vchan_id); + vq->stats.inflight_submitted += nb_tx; + out: if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) vhost_user_iotlb_rd_unlock(vq); -- 2.35.1