From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org
Cc: Sriram Yagnaraman <sriram.yagnaraman@est.tech>,
Jason Wang <jasowang@redhat.com>
Subject: [PULL 11/12] igb: implement VF Tx and Rx stats
Date: Tue, 28 Mar 2023 13:19:16 +0800 [thread overview]
Message-ID: <20230328051917.18006-12-jasowang@redhat.com> (raw)
In-Reply-To: <20230328051917.18006-1-jasowang@redhat.com>
From: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Please note that loopback counters for VM to VM traffic is not
implemented yet: VFGOTLBC, VFGPTLBC, VFGORLBC and VFGPRLBC.
Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
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 queue_index)
}
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] = { PTC64, PTC127, PTC255, PTC511,
PTC1023, PTC1522 };
@@ -519,6 +519,13 @@ igb_on_tx_done_update_stats(IGBCore *core, struct NetTxPkt *tx_pkt)
core->mac[GPTC] = core->mac[TPT];
core->mac[GOTCL] = core->mac[TOTL];
core->mac[GOTCH] = core->mac[TOTH];
+
+ if (core->mac[MRQC] & 1) {
+ uint16_t pool = qn % IGB_NUM_VM_POOLS;
+
+ core->mac[PVFGOTC0 + (pool * 64)] += tot_len;
+ core->mac[PVFGPTC0 + (pool * 64)]++;
+ }
}
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);
}
}
@@ -1409,7 +1416,8 @@ igb_write_to_rx_buffers(IGBCore *core,
}
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);
@@ -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 = rxi->idx % IGB_NUM_VM_POOLS;
+
+ core->mac[PVFGORC0 + (pool * 64)] += data_size + 4;
+ core->mac[PVFGPRC0 + (pool * 64)]++;
+ if (net_rx_pkt_get_packet_type(core->rx_pkt) == ETH_PKT_MCAST) {
+ core->mac[PVFMPRC0 + (pool * 64)]++;
+ }
+ }
}
static inline bool
@@ -1526,7 +1544,7 @@ igb_write_packet_to_guest(IGBCore *core, struct NetRxPkt *pkt,
} while (desc_offset < total_size);
- igb_update_rx_stats(core, size, total_size);
+ igb_update_rx_stats(core, rxi, size, total_size);
}
static inline void
--
2.7.4
next prev parent reply other threads:[~2023-03-28 5:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 5:19 [PULL 00/12] Net patches Jason Wang
2023-03-28 5:19 ` [PULL 01/12] igb: Save more Tx states Jason Wang
2023-03-28 5:19 ` [PULL 02/12] igb: Fix DMA requester specification for Tx packet Jason Wang
2023-03-28 5:19 ` [PULL 03/12] hw/net/net_tx_pkt: Ignore ECN bit Jason Wang
2023-03-28 5:19 ` [PULL 04/12] hw/net/net_tx_pkt: Align l3_hdr Jason Wang
2023-03-28 5:19 ` [PULL 05/12] MAINTAINERS: Add Sriram Yagnaraman as a igb reviewer Jason Wang
2023-03-28 5:19 ` [PULL 06/12] igb: handle PF/VF reset properly Jason Wang
2023-03-28 5:19 ` [PULL 07/12] igb: add ICR_RXDW Jason Wang
2023-03-28 5:19 ` [PULL 08/12] igb: implement VFRE and VFTE registers Jason Wang
2023-03-28 5:19 ` [PULL 09/12] igb: check oversized packets for VMDq Jason Wang
2023-03-28 5:19 ` [PULL 10/12] igb: respect E1000_VMOLR_RSSE Jason Wang
2023-03-28 5:19 ` Jason Wang [this message]
2023-03-28 5:19 ` [PULL 12/12] igb: respect VMVIR and VMOLR for VLAN Jason Wang
2023-03-28 16:00 ` [PULL 00/12] Net patches Peter Maydell
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=20230328051917.18006-12-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sriram.yagnaraman@est.tech \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).