From nobody Thu Dec 18 19:30:37 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679980953; cv=none; d=zohomail.com; s=zohoarc; b=S9tZPt0G2O+bKkHFu6m+bd7I6oODKtdi09EBtn2EKs2iqFRZ3HzmvARcEk1VgetkmMl9eyIwUgyhY/uA71f5jgah4/LMnY5TCqX4ailiZlFKdrY6xHVYFjSmB5uuaxkIaZvuL+zE6BOpVdLXUAlStRDHF/qnh+wMN7vgXRp15Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679980953; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bKsSFxGTqrahS45ttQctrybhA/IDEg/dO3u0pmM8U30=; b=WM5iIDcFRf3uYpBV0rKH1X621YX3MV1s9PHSKRVnpLm5OYR9K9YqSwDZ1HPbSyqgCgVNVTZ3scHXXpPyP0GzPJI667bUr/smCZhChkLTE9UGXq9Wp4ZCVmlnJYcTW8GFcNimVkqTdCeq0YEtetJ/zBIebluMnLyWPW2E+MVUbAE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679980953951605.190867180663; Mon, 27 Mar 2023 22:22:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ph1kV-0005Yn-Vc; Tue, 28 Mar 2023 01:20:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ph1kU-0005YM-IV for qemu-devel@nongnu.org; Tue, 28 Mar 2023 01:19:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ph1kT-0007eq-2N for qemu-devel@nongnu.org; Tue, 28 Mar 2023 01:19:58 -0400 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-446-zPtyMszpMACl6Ncm8rrIjg-1; Tue, 28 Mar 2023 01:19:54 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD4F1101A553; Tue, 28 Mar 2023 05:19:53 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-204.pek2.redhat.com [10.72.13.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBB9E202701E; Tue, 28 Mar 2023 05:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679980796; 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=bKsSFxGTqrahS45ttQctrybhA/IDEg/dO3u0pmM8U30=; b=NIJfCWx66f4+5KrJzCZ+tTuFQLHqYD3Q7d4RGmYoW71zh+Rec8acE497mj1Oh6rGjSLWim Hk3lZ+8thhRmZlkLmvfdDM/siidCTikB4Naj8DHFJ4WKHVL7ntlknD3y8uBlM80PF195Kr x5vX2ZuqF5hudhvh3vC8xh/3ot/dIDc= X-MC-Unique: zPtyMszpMACl6Ncm8rrIjg-1 From: Jason Wang To: qemu-devel@nongnu.org Cc: Sriram Yagnaraman , Jason Wang Subject: [PULL 11/12] igb: implement VF Tx and Rx stats Date: Tue, 28 Mar 2023 13:19:16 +0800 Message-Id: <20230328051917.18006-12-jasowang@redhat.com> In-Reply-To: <20230328051917.18006-1-jasowang@redhat.com> References: <20230328051917.18006-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jasowang@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679980955103100005 Content-Type: text/plain; charset="utf-8" From: Sriram Yagnaraman Please note that loopback counters for VM to VM traffic is not implemented yet: VFGOTLBC, VFGPTLBC, VFGORLBC and VFGPRLBC. Signed-off-by: Sriram Yagnaraman Signed-off-by: Jason Wang --- hw/net/igb_core.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index fd61c6c..162ba8b 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@ -492,7 +492,7 @@ igb_tx_pkt_send(IGBCore *core, struct igb_tx *tx, int q= ueue_index) } =20 static void -igb_on_tx_done_update_stats(IGBCore *core, struct NetTxPkt *tx_pkt) +igb_on_tx_done_update_stats(IGBCore *core, struct NetTxPkt *tx_pkt, int qn) { static const int PTCregs[6] =3D { PTC64, PTC127, PTC255, PTC511, PTC1023, PTC1522 }; @@ -519,6 +519,13 @@ igb_on_tx_done_update_stats(IGBCore *core, struct NetT= xPkt *tx_pkt) core->mac[GPTC] =3D core->mac[TPT]; core->mac[GOTCL] =3D core->mac[TOTL]; core->mac[GOTCH] =3D core->mac[TOTH]; + + if (core->mac[MRQC] & 1) { + uint16_t pool =3D qn % IGB_NUM_VM_POOLS; + + core->mac[PVFGOTC0 + (pool * 64)] +=3D tot_len; + core->mac[PVFGPTC0 + (pool * 64)]++; + } } =20 static void @@ -583,7 +590,7 @@ igb_process_tx_desc(IGBCore *core, net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, vlan, vet); } if (igb_tx_pkt_send(core, tx, queue_index)) { - igb_on_tx_done_update_stats(core, tx->tx_pkt); + igb_on_tx_done_update_stats(core, tx->tx_pkt, queue_index); } } =20 @@ -1409,7 +1416,8 @@ igb_write_to_rx_buffers(IGBCore *core, } =20 static void -igb_update_rx_stats(IGBCore *core, size_t data_size, size_t data_fcs_size) +igb_update_rx_stats(IGBCore *core, const E1000E_RingInfo *rxi, + size_t data_size, size_t data_fcs_size) { e1000x_update_rx_total_stats(core->mac, data_size, data_fcs_size); =20 @@ -1425,6 +1433,16 @@ igb_update_rx_stats(IGBCore *core, size_t data_size,= size_t data_fcs_size) default: break; } + + if (core->mac[MRQC] & 1) { + uint16_t pool =3D rxi->idx % IGB_NUM_VM_POOLS; + + core->mac[PVFGORC0 + (pool * 64)] +=3D data_size + 4; + core->mac[PVFGPRC0 + (pool * 64)]++; + if (net_rx_pkt_get_packet_type(core->rx_pkt) =3D=3D ETH_PKT_MCAST)= { + core->mac[PVFMPRC0 + (pool * 64)]++; + } + } } =20 static inline bool @@ -1526,7 +1544,7 @@ igb_write_packet_to_guest(IGBCore *core, struct NetRx= Pkt *pkt, =20 } while (desc_offset < total_size); =20 - igb_update_rx_stats(core, size, total_size); + igb_update_rx_stats(core, rxi, size, total_size); } =20 static inline void --=20 2.7.4