qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: aliguori@us.ibm.com, Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] slirp: fix packet requeue issue in batchq
Date: Thu, 16 Feb 2012 09:48:03 +0100	[thread overview]
Message-ID: <4F3CC2C3.9020401@web.de> (raw)
In-Reply-To: <CAEH94LgfcxBS_aX9ryJOR=j0Nwopwdjs7JkmG8_0hrmuZ2XaDw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3421 bytes --]

On 2012-02-16 09:45, Zhi Yong Wu wrote:
> On Thu, Feb 16, 2012 at 4:37 PM, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-02-16 09:07, zwu.kernel@gmail.com wrote:
>>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>>
>>
>> Please summarize in a bit more details what was broken.
> Should those bits be put in the message part of this part? or here?

Here, as a commit log.

> 
>>
>>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>> ---
>>>  slirp/if.c   |   19 +++++++++++++++++--
>>>  slirp/mbuf.c |    3 +--
>>>  2 files changed, 18 insertions(+), 4 deletions(-)
>>>
>>> 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 = ifm->ifs_next;
>>>       ifm->ifs_next->ifs_prev = ifm->ifs_prev;
>>> +        ifs_init(ifm);
>>>  }
>>>
>>>  void
>>> @@ -154,7 +155,7 @@ if_start(Slirp *slirp)
>>>  {
>>>      uint64_t now = qemu_get_clock_ns(rt_clock);
>>>      int requeued = 0;
>>> -     struct mbuf *ifm, *ifqt;
>>> +    struct mbuf *ifm, *ifqt, *ifm_next;
>>>
>>>       DEBUG_CALL("if_start");
>>>
>>> @@ -162,6 +163,8 @@ if_start(Slirp *slirp)
>>>          return; /* Nothing to do */
>>>
>>>   again:
>>> +        ifm_next = 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 != /* ifm->ifs_prev != */ ifm) {
>>>               insque(ifm->ifs_next, ifqt);
>>> +                ifm_next = ifm->ifs_next;
>>>               ifs_remque(ifm);
>>>       }
>>>
>>> @@ -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 = ifm;
>>> +                    ifm->ifs_prev = ifm_next->ifs_prev;
>>> +                    ifm->ifs_next = ifm_next;
>>> +                    ifm_next->ifs_prev = 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 = SLIRP_MSIZE - offsetof(struct mbuf, m_dat);
>>>       m->m_data = m->m_dat;
>>>       m->m_len = 0;
>>> -        m->m_nextpkt = NULL;
>>> -        m->m_prevpkt = NULL;
>>> +        ifs_init(m);
>>>          m->arp_requested = false;
>>>          m->expiration_date = (uint64_t)-1;
>>>  end_error:
>>
>> Wondering now: Is this hunk required or a cleanup?
> The former. I think that the pointer of one raw mbuf which are used to
> link the packets for the same session should default to itself, not
> NULL.

OK. Out of curiosity, is that an older issue or just related to the
requeuing we now practice?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2012-02-16  8:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  8:07 [Qemu-devel] [PATCH v2] slirp: fix packet requeue issue in batchq zwu.kernel
2012-02-16  8:37 ` Jan Kiszka
2012-02-16  8:45   ` Zhi Yong Wu
2012-02-16  8:46     ` Zhi Yong Wu
2012-02-16  8:48     ` Jan Kiszka [this message]
2012-02-16  9:21       ` Zhi Yong Wu
2012-02-16  9:30         ` Zhi Yong Wu

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=4F3CC2C3.9020401@web.de \
    --to=jan.kiszka@web.de \
    --cc=aliguori@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=wuzhy@linux.vnet.ibm.com \
    --cc=zwu.kernel@gmail.com \
    /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).