From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxwqN-0006uO-N3 for qemu-devel@nongnu.org; Thu, 16 Feb 2012 03:37:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxwqJ-00023m-8u for qemu-devel@nongnu.org; Thu, 16 Feb 2012 03:37:35 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:52366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxwqI-00023a-Tn for qemu-devel@nongnu.org; Thu, 16 Feb 2012 03:37:31 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate03.web.de (Postfix) with ESMTP id E01221B245AF4 for ; Thu, 16 Feb 2012 09:37:28 +0100 (CET) Message-ID: <4F3CC043.1010607@web.de> Date: Thu, 16 Feb 2012 09:37:23 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1329379634-1498-1-git-send-email-zwu.kernel@gmail.com> In-Reply-To: <1329379634-1498-1-git-send-email-zwu.kernel@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDE180ECC2CDE19C5CB4271BD" Subject: Re: [Qemu-devel] [PATCH v2] slirp: fix packet requeue issue in batchq List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zwu.kernel@gmail.com Cc: aliguori@us.ibm.com, Zhi Yong Wu , qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDE180ECC2CDE19C5CB4271BD Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-02-16 09:07, zwu.kernel@gmail.com wrote: > From: Zhi Yong Wu >=20 Please summarize in a bit more details what was broken. > Signed-off-by: Zhi Yong Wu > --- > slirp/if.c | 19 +++++++++++++++++-- > slirp/mbuf.c | 3 +-- > 2 files changed, 18 insertions(+), 4 deletions(-) >=20 > diff --git a/slirp/if.c b/slirp/if.c > index 8e0cac2..57350d5 100644 > --- a/slirp/if.c > +++ b/slirp/if.c > @@ -22,6 +22,7 @@ ifs_remque(struct mbuf *ifm) > { > ifm->ifs_prev->ifs_next =3D ifm->ifs_next; > ifm->ifs_next->ifs_prev =3D ifm->ifs_prev; > + ifs_init(ifm); > } > =20 > void > @@ -154,7 +155,7 @@ if_start(Slirp *slirp) > { > uint64_t now =3D qemu_get_clock_ns(rt_clock); > int requeued =3D 0; > - struct mbuf *ifm, *ifqt; > + struct mbuf *ifm, *ifqt, *ifm_next; > =20 > DEBUG_CALL("if_start"); > =20 > @@ -162,6 +163,8 @@ if_start(Slirp *slirp) > return; /* Nothing to do */ > =20 > again: > + ifm_next =3D NULL; > + > /* check if we can really output */ > if (!slirp_can_output(slirp->opaque)) > return; > @@ -190,6 +193,7 @@ if_start(Slirp *slirp) > /* If there are more packets for this session, re-queue them */ > if (ifm->ifs_next !=3D /* ifm->ifs_prev !=3D */ ifm) { > insque(ifm->ifs_next, ifqt); > + ifm_next =3D ifm->ifs_next; > ifs_remque(ifm); > } > =20 > @@ -209,7 +213,18 @@ if_start(Slirp *slirp) > m_free(ifm); > } else { > /* re-queue */ > - insque(ifm, ifqt); > + if (ifm_next) { > + /*restore the original state of batchq*/ > + remque(ifm_next); > + insque(ifm, ifqt); > + ifm_next->ifs_prev->ifs_next =3D ifm; > + ifm->ifs_prev =3D ifm_next->ifs_prev; > + ifm->ifs_next =3D ifm_next; > + ifm_next->ifs_prev =3D ifm; > + } else { > + insque(ifm, ifqt); > + } > + > requeued++; > } > } > diff --git a/slirp/mbuf.c b/slirp/mbuf.c > index c699c75..f429c0a 100644 > --- a/slirp/mbuf.c > +++ b/slirp/mbuf.c > @@ -68,8 +68,7 @@ m_get(Slirp *slirp) > m->m_size =3D SLIRP_MSIZE - offsetof(struct mbuf, m_dat); > m->m_data =3D m->m_dat; > m->m_len =3D 0; > - m->m_nextpkt =3D NULL; > - m->m_prevpkt =3D NULL; > + ifs_init(m); > m->arp_requested =3D false; > m->expiration_date =3D (uint64_t)-1; > end_error: Wondering now: Is this hunk required or a cleanup? Jan --------------enigDE180ECC2CDE19C5CB4271BD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk88wEMACgkQitSsb3rl5xRuTQCgzgdQNI38YhcCkFGT/5/Uwh6c dnwAnjVjXtFGdXff9K48rNtY+Pj1wxAy =XGhj -----END PGP SIGNATURE----- --------------enigDE180ECC2CDE19C5CB4271BD--