From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anHYQ-00036b-4Q for qemu-devel@nongnu.org; Mon, 04 Apr 2016 23:21:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anHYO-0001Lk-IK for qemu-devel@nongnu.org; Mon, 04 Apr 2016 23:21:22 -0400 Date: Tue, 5 Apr 2016 12:18:05 +1000 From: David Gibson Message-ID: <20160405021805.GR16485@voom.fritz.box> References: <1459764790-17173-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kAOhhqH5290wydqT" Content-Disposition: inline In-Reply-To: <1459764790-17173-1-git-send-email-thuth@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.7] hw/net/spapr_llan: Provide counter with dropped rx frames to the guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: Jason Wang , qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org --kAOhhqH5290wydqT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 04, 2016 at 12:13:10PM +0200, Thomas Huth wrote: > 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". >=20 > Signed-off-by: Thomas Huth > --- > Note: The patch has to be applied on top of the "Delay flushing of the > RX queue while adding new RX buffers" patch that I sent last week > (otherwise there will be context conflicts with the "return" > statements). Applied to ppc-for-2.7, thanks. >=20 > hw/net/spapr_llan.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) >=20 > diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c > index d604d55..719ad29 100644 > --- a/hw/net/spapr_llan.c > +++ b/hw/net/spapr_llan.c > @@ -122,6 +122,21 @@ static int spapr_vlan_can_receive(NetClientState *nc) > } > =20 > /** > + * 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 =3D 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, > @@ -206,6 +221,7 @@ static ssize_t spapr_vlan_receive(NetClientState *nc,= const uint8_t *buf, > } > =20 > if (!dev->rx_bufs) { > + spapr_vlan_record_dropped_rx_frame(dev); > return 0; > } > =20 > @@ -215,6 +231,7 @@ static ssize_t spapr_vlan_receive(NetClientState *nc,= const uint8_t *buf, > bd =3D spapr_vlan_get_rx_bd_from_page(dev, size); > } > if (!bd) { > + spapr_vlan_record_dropped_rx_frame(dev); > return 0; > } > =20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --kAOhhqH5290wydqT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXAyBdAAoJEGw4ysog2bOSzjgQAK7DhPxeO9u1YqFmBOpRk59U NyFvG0IJns9jEzNeW+YzhU2AYqxhmfl+0OW2IuA3VdwHxAfFYWYd3s+6ngftYD5X QHol/3Bk6BBgo/G+It4MXweeEvetTNC0vHch+bHOcAqKxWnfw6AdLV0P9LZ+mxTy RbcaxIYB601hgvwg/99j5MNqU5GKBcSvE3FXof4LU0LbwPYIlbVod4kvxgUirmPV dTz/+yhRSZMKtT6tfwRM96zIZledTmc5zV2v/2VwrAf9ysLIcq6oZu811WKfIwAY kJEWc23EQkPDFvMft37+l0Gpadl0tmsJArz6W6+XhjLnX+nX7Z7V7yPpfRDk5TOi wrMtL3bQLgH4uadE4gVFoGNWm5nf+2+kr06x68irylUdshbNtwMOQikF51IuE/NG /p9VAUijXz5dByI2o8X9AMmCTVXo92ulsLPRcOWLxCZ3Oo9Dc03g0eQnz05atGLs nKk/qihPb60DVCdSh0Hja/gDEdDKXH5bYtdiBYLVMI8qL9a8DJXgkIuahXyocHG/ QqjGonnKSwHHzyEpD9Be3N84Q9Ig1BMMWqsGNyT9ew9HiszpAw9qxGv7T10zfelk 8LMHiUrIfwnRh7DWZyu76bAPFRbjVmjD58oIqLOx2ukJisRcNBUU7j0dlMPFQE4i 2seJUXCiUkfK/7gR2Dwz =Mesn -----END PGP SIGNATURE----- --kAOhhqH5290wydqT--