mirror of https://github.com/xemu-project/xemu.git
igb: implement VF Tx and Rx stats
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>
This commit is contained in:
parent
3c2e0a6853
commit
7581baed88
|
@ -492,7 +492,7 @@ igb_tx_pkt_send(IGBCore *core, struct igb_tx *tx, int queue_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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,
|
static const int PTCregs[6] = { PTC64, PTC127, PTC255, PTC511,
|
||||||
PTC1023, PTC1522 };
|
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[GPTC] = core->mac[TPT];
|
||||||
core->mac[GOTCL] = core->mac[TOTL];
|
core->mac[GOTCL] = core->mac[TOTL];
|
||||||
core->mac[GOTCH] = core->mac[TOTH];
|
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
|
static void
|
||||||
|
@ -583,7 +590,7 @@ igb_process_tx_desc(IGBCore *core,
|
||||||
net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, vlan, vet);
|
net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, vlan, vet);
|
||||||
}
|
}
|
||||||
if (igb_tx_pkt_send(core, tx, queue_index)) {
|
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
|
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);
|
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:
|
default:
|
||||||
break;
|
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
|
static inline bool
|
||||||
|
@ -1526,7 +1544,7 @@ igb_write_packet_to_guest(IGBCore *core, struct NetRxPkt *pkt,
|
||||||
|
|
||||||
} while (desc_offset < total_size);
|
} 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
|
static inline void
|
||||||
|
|
Loading…
Reference in New Issue