<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=DA link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Regarding the low speed NAT problem I have been
trying to fix on VirtualBox and based on some vbox developers information (that
I should compare VirtualBox and qemu regarding slirp) I have spent some time
this week-end compiling qemu in different versions testing it’s
performance:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>1. the developers at qemu appearently did something
between 0.8.0 and 0.8.1 (which is also menchoned in the ChangeLog: "slirp
fixes (Ed Swierk et al.)") that boosted NAT performance to near LAN speeds
in both directions. Unfortunately it seems like these fixes are already adopted
into VirtualBox - so that didn't give me much to go on. It would therfore seem
like the problem is located either in the alterations made in slirp by
VirtualBox since then or in the way slirp is utilized.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>2. Top speeds on qemu require kqemu enabled and RAM
"enough" preallocated – on VirtualBox it makes no difference
how much Base memory I give the virtual machine.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>As you mayby recall I have already been trying to
debug the problem – but with no luck. It has been diagnosed as a
scheduling problem by the vbox developers I just can’t understand why It
isn’t possible to up-prioritize the thread responsible for pushing
packets to the host interface – also I would like to add to the record the
hack I made where I opened a file for output and closed it again (se below) in DevPCNet.cpp
(func: </span></font><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>pcnetAsyncSendThread())</span></font><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial'>which
boosted the outbound speed approx 10x<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>The problem is at least related to Linux and Windows
hosts, but I must admit I have done most testing on Windows as this is the
target host system for my task.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>PS. I have reported this as a “major” bug
– but when I saw what other people regard as a major bug (network icon
blinking when no interface is attached – really is that a major bug…)
I realized that I should probably have registered it as “Critical”
;-)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>The hack in DevPCNet.cpp:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=blue
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:blue'>static</span></font><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'> DECLCALLBACK(<font
color=blue><span style='color:blue'>int</span></font>)
pcnetAsyncSendThread(PPDMDEVINS pDevIns, PPDMTHREAD pThread)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
PCNetState *pThis = PDMINS2DATA(pDevIns, PCNetState *);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
<font color=green><span style='color:green'>/*<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * We can enter this function in two
states, initializing or resuming.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     *<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * The idea about the initializing bit is
that we can do per-thread<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * initialization while the creator thread
can still pick up errors.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * At present, there is nothing to init,
or at least nothing that<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * need initing in the thread.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     */<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>           <font
color=blue><span style='color:blue'>if</span></font> (pThread->enmState ==
PDMTHREADSTATE_INITIALIZING)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>                      </span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>return</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> VINF_SUCCESS;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
<font color=green><span style='color:green'>/*<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * Stay in the run-loop until we're
supposed to leave the<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * running state. If something really bad
happens, we'll<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * quit the loop while in the running
state and return<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     * an error status to PDM and let it
terminate the thread.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>     */<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
<font color=blue><span style='color:blue'>while</span></font>
(pThread->enmState == PDMTHREADSTATE_RUNNING)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
{<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
<font color=green><span style='color:green'>/*<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         * Block until
we've got something to send or is supposed<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         * to leave the
running state.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         </span></font><font
size=2 color=green face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:green'>*/<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
<font color=blue><span style='color:blue'>int</span></font> rc =
RTSemEventWait(pThis->hSendEventSem, RT_INDEFINITE_WAIT);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
AssertRCReturn(rc, rc);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
<font color=blue><span style='color:blue'>if</span></font>
(RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>           
<font color=blue><span style='color:blue'>break</span></font>;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
<font color=green><span style='color:green'>/*<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         * Perform async
send. Mind that we might be requested to<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         * suspended while
waiting for the critical section.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>         */<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>AssertReleaseRCReturn(rc, rc);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
<font color=blue><span style='color:blue'>if</span></font>
(pThread->enmState == PDMTHREADSTATE_RUNNING)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
{<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>unsigned int Start = clock();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>           
rc = pcnetAsyncTransmit(pThis);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>unsigned int End = clock();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>FILE * pFile;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>pFile = fopen ("c:\\temp\\timing.txt","a+");<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>fprintf (pFile, "Elapapsed time: %d\n",End-Start);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=green
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";
color:green'>fclose (pFile);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>           
AssertReleaseRC(rc);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
}<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>       
PDMCritSectLeave(&pThis->CritSect);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
}<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>   
<font color=green><span style='color:green'>/* The thread is being suspended or
terminated. </span></font></span></font><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>*/<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>    <font
color=blue><span style='color:blue'>return</span></font> VINF_SUCCESS;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

</div>

</body>

</html>