[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 06/13] hw/net/spapr_llan: Provide counter with dropped
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 06/13] hw/net/spapr_llan: Provide counter with dropped rx frames to the guest |
Date: |
Fri, 27 May 2016 13:04:51 +1000 |
From: Thomas Huth <address@hidden>
The last 8 bytes of the receive buffer list page (that has been supplied
by the guest with the H_REGISTER_LOGICAL_LAN call) contain a counter
for frames that have been dropped because there was no suitable receive
buffer available. This patch introduces code to use this field to
provide the information about dropped rx packets to the guest.
There it can be queried with "ethtool -S eth0 | grep rx_no_buffer".
Signed-off-by: Thomas Huth <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/net/spapr_llan.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index 36a9214..8b2eebd 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -123,6 +123,21 @@ static int spapr_vlan_can_receive(NetClientState *nc)
}
/**
+ * The last 8 bytes of the receive buffer list page (that has been
+ * supplied by the guest with the H_REGISTER_LOGICAL_LAN call) contain
+ * a counter for frames that have been dropped because there was no
+ * suitable receive buffer available. This function is used to increase
+ * this counter by one.
+ */
+static void spapr_vlan_record_dropped_rx_frame(VIOsPAPRVLANDevice *dev)
+{
+ uint64_t cnt;
+
+ cnt = vio_ldq(&dev->sdev, dev->buf_list + 4096 - 8);
+ vio_stq(&dev->sdev, dev->buf_list + 4096 - 8, cnt + 1);
+}
+
+/**
* Get buffer descriptor from one of our receive buffer pools
*/
static vlan_bd_t spapr_vlan_get_rx_bd_from_pool(VIOsPAPRVLANDevice *dev,
@@ -207,6 +222,7 @@ static ssize_t spapr_vlan_receive(NetClientState *nc, const
uint8_t *buf,
}
if (!dev->rx_bufs) {
+ spapr_vlan_record_dropped_rx_frame(dev);
return 0;
}
@@ -216,6 +232,7 @@ static ssize_t spapr_vlan_receive(NetClientState *nc, const
uint8_t *buf,
bd = spapr_vlan_get_rx_bd_from_page(dev, size);
}
if (!bd) {
+ spapr_vlan_record_dropped_rx_frame(dev);
return 0;
}
--
2.5.5
- [Qemu-ppc] [PULL 00/13] ppc-for-2.7 queue 20160527, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 02/13] target-ppc: Use movcond in isel, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 07/13] Added negative check for get_image_size(), David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 13/13] MAINTAINERS: Add David Gibson as ppc maintainer, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 04/13] target-ppc: Cleanups to rldinm, rldnm, rldimi, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 03/13] target-ppc: Use 32-bit rotate instead of deposit + 64-bit rotate, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 12/13] spapr_iommu: Move table allocation to helpers, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 06/13] hw/net/spapr_llan: Provide counter with dropped rx frames to the guest,
David Gibson <=
- [Qemu-ppc] [PULL 09/13] spapr: ensure device trees are always associated with DRC, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 01/13] target-ppc: Correct KVM synchronization for ppc_hash64_set_external_hpt(), David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 08/13] PPC/KVM: early validation of vcpu id, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 11/13] spapr_iommu: Finish renaming vfio_accel to need_vfio, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 05/13] hw/net/spapr_llan: Delay flushing of the RX queue while adding new RX buffers, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 10/13] spapr_pci: Use correct DMA LIOBN when composing the device tree, David Gibson, 2016/05/26
- Re: [Qemu-ppc] [PULL 00/13] ppc-for-2.7 queue 20160527, Peter Maydell, 2016/05/27