Re: Packets bouncing
Eitan Michaelson <[email protected]> Mon, 2 Sep 2019 21:17:03 +0300
| Newsgroups | gmane.linux.ntop.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============3935953245021753217== Content-Type: multipart/alternative; boundary="Apple-Mail=_40DBB524-B235-4F50-BE02-27B47B8698CB" --Apple-Mail=_40DBB524-B235-4F50-BE02-27B47B8698CB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 10x It did the trick :) > On 2 Sep 2019, at 15:49, Alfredo Cardigliano <[email protected]> = wrote: >=20 > Hi Eitan > please try setting the poll watermark to 1 as below, otherwise pf_ring > tries to deliver packets in batch to improve the capture rate = (affecting > latency). >=20 > pfring_set_poll_watermark(rx_handle, 1) >=20 > Regards > Alfredo >=20 >> On 2 Sep 2019, at 12:33, Eitan Michaelson <[email protected] = <mailto:[email protected]>> wrote: >>=20 >> Hello, >> Consider the following pseudo code that attempts to send every = inbound RX packet through the same port it was received. >> =20 >> // Note 2 deferment rings where the RX ring is attached "eth1, eth2, = eth3" and >> // the TX ring is attached only to "eth1" >> =20 >> pfring *rx_handle, *tx_handle;=20 >> =20 >> while (true) >> { >> if ((rc =3D pfring_recv(rx_handle, &localBuf_p, , MAX_SIZE, = &hdr, 1)) =3D=3D 1) >> { >> =20 >> pfring_send(tx_handle, localBuf_p, hdr.len, 1); >> pfring_flush_tx_packets(tx_handle); >> } >> } >> =20 >> My setup includes a Linux box that runs this code, a PC that sends = packets to the Linux =E2=80=9Ceth1=E2=80=9D port, and an external = sniffer that inspecting the traffic. >> When sending a single packet (128 bytes) to Linux box over =E2=80=9Ceth= 1", the sniffer reports about 400ms delay until the packet is being sent = back. >> This Linux is an 8 cores x64 running basically only this code. >> =20 >> =20 >> Any clue? >> Is this normal? >> =20 >> 10x >> Eitan. >> =20 >> _______________________________________________ >> Ntop-dev mailing list >> [email protected] <mailto:[email protected]> >> http://listgateway.unipi.it/mailman/listinfo/ntop-dev >=20 > _______________________________________________ > Ntop-dev mailing list > [email protected] > http://listgateway.unipi.it/mailman/listinfo/ntop-dev --Apple-Mail=_40DBB524-B235-4F50-BE02-27B47B8698CB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" = class=3D"">10x<div class=3D"">It did the trick :)</div><div class=3D""><br= class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 2 Sep 2019, at 15:49, Alfredo Cardigliano <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><meta = http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" = class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: = space; line-break: after-white-space;" class=3D""><div class=3D"">Hi = Eitan</div><div class=3D"">please try setting the poll watermark to 1 as = below, otherwise pf_ring</div><div class=3D"">tries to deliver packets = in batch to improve the capture rate (affecting</div><div = class=3D"">latency).</div><div class=3D""><br class=3D""></div><div = class=3D"">pfring_set_poll_watermark(rx_handle, 1)</div><div = class=3D""><br class=3D""></div><div class=3D"">Regards</div>Alfredo<br = class=3D""><div class=3D""><br class=3D""><blockquote type=3D"cite" = class=3D""><div class=3D"">On 2 Sep 2019, at 12:33, Eitan Michaelson = <<a href=3D"mailto:[email protected]" class=3D"">[email protected]</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta = http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" = class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: = space; line-break: after-white-space;" class=3D""><div = class=3D"">Hello,</div><div class=3D"">Consider the following pseudo = code that attempts to send every inbound RX packet through the same port = it was received.</div><div class=3D""> </div><div class=3D""><font = face=3D"Consolas" class=3D""><span style=3D"font-style: normal;" = class=3D"">// Note 2 deferment rings where the RX ring is attached = "eth1, eth2, eth3" and</span></font></div><div class=3D""><font = face=3D"Consolas" class=3D""><span style=3D"font-style: normal;" = class=3D"">// the TX ring is attached only to = "eth1"</span></font></div><div class=3D""><font face=3D"Consolas" = class=3D""><span style=3D"font-style: normal;" class=3D""> = </span></font></div><div class=3D""><font face=3D"Consolas" = class=3D""><span style=3D"font-style: normal;" class=3D""> = pfring *rx_handle, *tx_handle; </span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> </span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> while (true)</span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> {</span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> if ((rc =3D = pfring_recv(rx_handle, &localBuf_p, , MAX_SIZE, &hdr, 1)) =3D=3D = 1)</span></font></div><div class=3D""><font face=3D"Consolas" = class=3D""><span style=3D"font-style: normal;" class=3D""> = {</span></font></div><div class=3D""><font face=3D"Consolas"= class=3D""><span style=3D"font-style: normal;" = class=3D""> </span></font></div><div class=3D""><font = face=3D"Consolas" class=3D""><span style=3D"font-style: normal;" = class=3D""> = pfring_send(tx_handle, localBuf_p, hdr.len, 1);</span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> = pfring_flush_tx_packets(tx_handle);</span></font></div><div = class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: = normal;" class=3D""> = }</span></font></div><div class=3D""><font face=3D"Consolas" = class=3D""><span style=3D"font-style: normal;" class=3D""> = }</span></font></div><div class=3D""> </div><div class=3D"">My = setup includes a Linux box that runs this code, a PC that sends packets = to the Linux =E2=80=9Ceth1=E2=80=9D port, and an external sniffer that = inspecting the traffic.</div><div class=3D"">When sending a single = packet (128 bytes) to Linux box over =E2=80=9Ceth1", the sniffer reports = about 400ms delay until the packet is being sent back.</div><div = class=3D"">This Linux is an 8 cores x64 running basically only this = code.</div><div class=3D""> </div><div class=3D""> </div><div = class=3D"">Any clue?</div><div class=3D"">Is this normal?</div><div = class=3D""> </div><div class=3D"">10x</div><div = class=3D"">Eitan.</div><div = class=3D""> </div></div>_____________________________________________= __<br class=3D"">Ntop-dev mailing list<br class=3D""><a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a><br class=3D""><a = href=3D"http://listgateway.unipi.it/mailman/listinfo/ntop-dev" = class=3D"">http://listgateway.unipi.it/mailman/listinfo/ntop-dev</a></div>= </blockquote></div><br = class=3D""></div>_______________________________________________<br = class=3D"">Ntop-dev mailing list<br class=3D""><a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a><br = class=3D"">http://listgateway.unipi.it/mailman/listinfo/ntop-dev</div></bl= ockquote></div><br class=3D""></div></body></html>= --Apple-Mail=_40DBB524-B235-4F50-BE02-27B47B8698CB-- --===============3935953245021753217== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ntop-dev mailing list [email protected] http://listgateway.unipi.it/mailman/listinfo/ntop-dev --===============3935953245021753217==--