<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=windows-1252"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Michael,<br>
<br>
Thanks for your help. <br>
<br>
>From the first use of Winpcap I had the buffer size increased to
receive 640 packets (need only 64 in each chunk of data transfer), so
the buffer size is not a solution. Without buffer increased the problem
is much worse, of course, and I could no get the high rates of data
throughput. <br>
<br>
I also tried the buffer size to be set to exactly the amount I need to
transfer in one chunk of data (64 packets 8234 bytes each) and that
does not help. <br>
<br>
I will play more with the buffer size. Your analysis that these numbers
(default buffer size of 256,000 and 31 packets transmission of 263488)
is very close to what I see. May be it is indeed something is there
with the buffer size function. <br>
<br>
I  see that if I make the buffer very large when my program starts the
memory usage is increased to that amount of buffer set in my code,
therefore I thought that buffer size is set correctly. <br>
<br>
Because we use UDP there is obviously no flow control. I am sending
data from my detector and each image is 64 packets. I have control bits
in the first packet, so in my computer I can recognize the first packet
and if I miss some, I just skip the packets till reach to the next
frame/image. <br>
<br>
Thanks, <br>
<br>
Anton<br>
<br>
<blockquote
 cite="mid:EBC3E5C5B813D64186F74954243BB096CE79@XMBVAG73.northgrum.com"
 type="cite">
  <meta http-equiv="Content-Type"
 content="text/html; charset=windows-1252">
  <style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
  </style>
  <div
 style="direction: ltr; font-family: Tahoma; color: rgb(0, 0, 0); font-size: 10pt;">
  <p>I'll also note that 31*8234 = 255254 and 32*8234 = 263488 -- which
is right at the default 256,000 user buffer size.</p>
  <p> </p>
  <p>I think that's a big clue that increasing your buffer size will
help.</p>
  <div>
  <p> </p>
  <div style="font-family: Tahoma; font-size: 13px;">
  <p>Michael D. Black</p>
  <p>Senior Scientist</p>
  <p>NG Information Systems</p>
  <p>Advanced Analytics Directorate</p>
  <p> </p>
  </div>
  </div>
  <div
 style="font-family: Times New Roman; color: rgb(0, 0, 0); font-size: 16px;">
  <hr tabindex="-1">
  <div style="direction: ltr;" id="divRpF186428"><font face="Tahoma"
 size="2" color="#000000"><b>From:</b>
<a class="moz-txt-link-abbreviated" href="mailto:winpcap-users-bounces@winpcap.org">winpcap-users-bounces@winpcap.org</a> [<a class="moz-txt-link-abbreviated" href="mailto:winpcap-users-bounces@winpcap.org">winpcap-users-bounces@winpcap.org</a>]
on behalf of Anton Tremsin [<a class="moz-txt-link-abbreviated" href="mailto:ast@ssl.berkeley.edu">ast@ssl.berkeley.edu</a>]<br>
  <b>Sent:</b> Friday, February 04, 2011 11:39 PM<br>
  <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</a><br>
  <b>Cc:</b> Gianluca Varenni<br>
  <b>Subject:</b> EXT :Re: [Winpcap-users] Delay receiving packets -
wrongfunctionality ofpcap_setmintocopy()<br>
  </font><br>
  </div>
  <div>Gianluca,<br>
  <br>
Thanks a lot for helping me. I am in a dire situation since my detector
really needs that problem to be solved before our experiments in couple
of months time (need to do a lot of debugging and code writing after
Winpcap issue is solved).<br>
  <br>
I am not loosing packets. Sorry if I made it confusing.<br>
  <br>
The packets always arrive into my C code (although Wireshark may loose
them, maybe that was a confusion with packets being lost). I only need
my C code to work right.  The rest of packets come only after the
timeout.
  <br>
  <br>
I varied timeout from 1 ms to 20 sec and the effect is the same. With
timeout 0 - the packets do not arrive until I push more packets into
Chelsio card and these, in turn, push the once which were already in
some buffer.
  <br>
  <br>
I am using Chelsio card, but Winpcap I downloaded from the official
website (version 4.1.2).
  <br>
  <br>
The problem seems to be as if the function setmintocopy() does not work
right and the driver decides by itself how much to buffer before
sending it to me. One strange thing - the number of packets being
delivered to me changes from time to time, however very often number 31
(31 packets, 8234 bytes each) arrive in a single chunk. Sometimes it is
62 packets, sometimes other numbers, e.g. 57. etc.<br>
  <br>
I will be very glad if someone ca advise something I can try to resolve
that issue.<br>
  <br>
Thanks again,<br>
  <br>
Anton<br>
  <blockquote type="cite">
    <style>@font-face {
        font-family: Wingdings;
}
@font-face {
        font-family: Wingdings;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: Consolas;
}
@page WordSection1 {margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
LI.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
DIV.MsoNormal {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
PRE {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"; COLOR: black; FONT-SIZE: 10pt
}
P.MsoAcetate {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black; FONT-SIZE: 8pt
}
LI.MsoAcetate {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black; FONT-SIZE: 8pt
}
DIV.MsoAcetate {
        MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black; FONT-SIZE: 8pt
}
P.MsoListParagraph {
        MARGIN: 0in 0in 0pt 0.5in; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
LI.MsoListParagraph {
        MARGIN: 0in 0in 0pt 0.5in; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
DIV.MsoListParagraph {
        MARGIN: 0in 0in 0pt 0.5in; FONT-FAMILY: "Times New Roman","serif"; COLOR: black; FONT-SIZE: 12pt
}
SPAN.HTMLPreformattedChar {
        FONT-FAMILY: Consolas; COLOR: black
}
SPAN.EmailStyle20 {
        FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d
}
SPAN.EmailStyle21 {
        FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d
}
SPAN.BalloonTextChar {
        FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black
}
.MsoChpDefault {
        FONT-SIZE: 10pt
}
OL {
        MARGIN-BOTTOM: 0in
}
UL {
        MARGIN-BOTTOM: 0in
}
    </style>
    <div class="WordSection1">
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">Anton,</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">You
say that you are using a Chelsio board. Are you using the official
version of WinPcap or Chelsio provided you with a custom one? What do
you set as timeout and mintocopy?</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">Have
a nice day</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">GV</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <div>
    <div
 style="border-style: solid none none; border-color: -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
    <p class="MsoNormal"><b><span
 style="font-family: 'Tahoma','sans-serif'; color: windowtext; font-size: 10pt;">From:</span></b><span
 style="font-family: 'Tahoma','sans-serif'; color: windowtext; font-size: 10pt;">
    <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a>
[<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">mailto:winpcap-users-bounces@winpcap.org</a>]
    <b>On Behalf Of </b>Mark Pizzolato - WinPCap-Users<br>
    <b>Sent:</b> Friday, January 28, 2011 11:57 AM<br>
    <b>To:</b> <a moz-do-not-send="true"
 class="moz-txt-link-abbreviated"
 href="mailto:winpcap-users@winpcap.org" target="_blank">
winpcap-users@winpcap.org</a><br>
    <b>Subject:</b> Re: [Winpcap-users] Delay receiving packets - wrong
functionality ofpcap_setmintocopy()</span></p>
    </div>
    </div>
    <p class="MsoNormal"> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">Ho
Anton,</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">My
first question to you would be:</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">WHY
are you using WinPcap to receive UDP packets?</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">This
sounds like a job for a winsock application….</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <p style="text-indent: -0.25in;" class="MsoListParagraph"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"><span>-<span
 style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">         
    </span></span></span><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;">Mark
Pizzolato</span></p>
    <p class="MsoNormal"><span
 style="font-family: 'Calibri','sans-serif'; color: rgb(31, 73, 125); font-size: 11pt;"></span> </p>
    <div
 style="border-style: none none none solid; border-color: -moz-use-text-color; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">
    <div>
    <div
 style="border-style: solid none none; border-color: -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
    <p class="MsoNormal"><b><span
 style="font-family: 'Tahoma','sans-serif'; color: windowtext; font-size: 10pt;">From:</span></b><span
 style="font-family: 'Tahoma','sans-serif'; color: windowtext; font-size: 10pt;">
    <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">winpcap-users-bounces@winpcap.org</a>
[<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="mailto:winpcap-users-bounces@winpcap.org" target="_blank">mailto:winpcap-users-bounces@winpcap.org</a>]
    <b>On Behalf Of </b>Anton Tremsin<br>
    <b>Sent:</b> Friday, January 28, 2011 11:50 AM<br>
    <b>To:</b> <a moz-do-not-send="true"
 class="moz-txt-link-abbreviated"
 href="mailto:winpcap-users@winpcap.org" target="_blank">
winpcap-users@winpcap.org</a><br>
    <b>Subject:</b> [Winpcap-users] Delay receiving packets - wrong
functionality ofpcap_setmintocopy()</span></p>
    </div>
    </div>
    <p class="MsoNormal"> </p>
    <p style="margin-bottom: 12pt;" class="MsoNormal">I hope someone
can help my problem receiving packets in Windows7<br>
    <br>
I am sending data by UDP packets from an FPGA through 10GB card
(Chelsio). Using VC++ 2010 to compile code to receive them.
    <br>
    <br>
All packets arrive, no losses seen, but the problem is with the proper <b>operation
of pcap_setmintocopy() function.</b>
    <br>
    <br>
    <b>I send 64 packets with 8234 bytes each. Receiving them through
pcp_next_ex() and I only get 31 packets (sometimes 62, sometimes 47, 50
packets) before the timeout occurs. After timeout the rest of the
packets arrives.
    <br>
    </b><br>
I set the minimum amount of data in the kernel buffer that causes a
read from the application to return (unless the timeout expires) to be
1 byte or it to be all 8234x64 bytes, no difference. Looks like the
setmintocpy function has no effect on my kernel buffer to be copied to
my application. If I send another set of 64 packets - data arrives into
pcp_next_ex(), still only in lamp of 31 (62, 47,50) packets
    <br>
    <br>
That is a big problem for my application.<br>
    <br>
    <b>Is there anything I am doing wrong or need to change something
in the system/driver to make setmintocopy function to operate properly?<br>
    </b><br>
Thanks a lot for your help, <br>
    <br>
Anton Tremsin<br>
    <br>
    </p>
    <pre>-- </pre>
    <pre> </pre>
    <pre>Anton S. Tremsin, Ph.D.</pre>
    <pre>Space Sciences Laboratory</pre>
    <pre>University of California at Berkeley</pre>
    <pre>Berkeley, CA 94720</pre>
    <pre>Tel: (510) 642 4554</pre>
    </div>
    </div>
    <pre><fieldset class="mimeAttachmentHeader" target="_blank"></fieldset>
_______________________________________________
Winpcap-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:Winpcap-users@winpcap.org" target="_blank">Winpcap-users@winpcap.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="https://www.winpcap.org/mailman/listinfo/winpcap-users"
 target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a>
  </pre>
  </blockquote>
  <br>
  </div>
  </div>
  </div>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Winpcap-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a>
<a class="moz-txt-link-freetext" href="https://www.winpcap.org/mailman/listinfo/winpcap-users">https://www.winpcap.org/mailman/listinfo/winpcap-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>