Re: Packets bouncing

Alfredo Cardigliano <[email protected]> Mon, 2 Sep 2019 14:49:18 +0200
Newsgroups gmane.linux.ntop.devel
Message-ID <[email protected]>
--===============8192780043463067447==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_D29EA775-6E3B-42C4-A17B-D66EED8B75E1"


--Apple-Mail=_D29EA775-6E3B-42C4-A17B-D66EED8B75E1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

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).

pfring_set_poll_watermark(rx_handle, 1)

Regards
Alfredo

> On 2 Sep 2019, at 12:33, Eitan Michaelson <[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=9Ceth1=
", 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]
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev


--Apple-Mail=_D29EA775-6E3B-42C4-A17B-D66EED8B75E1
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""><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><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On 2 Sep =
2019, at 12:33, Eitan Michaelson &lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; 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"">&nbsp;</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"">&nbsp; =
&nbsp;&nbsp;</span></font></div><div class=3D""><font face=3D"Consolas" =
class=3D""><span style=3D"font-style: normal;" class=3D"">&nbsp; &nbsp; =
pfring *rx_handle, *tx_handle;&nbsp;</span></font></div><div =
class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: =
normal;" class=3D"">&nbsp; &nbsp;&nbsp;</span></font></div><div =
class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: =
normal;" class=3D"">&nbsp; &nbsp; while (true)</span></font></div><div =
class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: =
normal;" class=3D"">&nbsp; &nbsp; {</span></font></div><div =
class=3D""><font face=3D"Consolas" class=3D""><span style=3D"font-style: =
normal;" class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; if ((rc =3D =
pfring_recv(rx_handle, &amp;localBuf_p, , MAX_SIZE, &amp;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"">&nbsp; &nbsp; =
&nbsp; &nbsp; {</span></font></div><div class=3D""><font face=3D"Consolas"=
 class=3D""><span style=3D"font-style: normal;" =
class=3D"">&nbsp;</span></font></div><div class=3D""><font =
face=3D"Consolas" class=3D""><span style=3D"font-style: normal;" =
class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
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"">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
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"">&nbsp; &nbsp; &nbsp; &nbsp; =
}</span></font></div><div class=3D""><font face=3D"Consolas" =
class=3D""><span style=3D"font-style: normal;" class=3D"">&nbsp; &nbsp; =
}</span></font></div><div class=3D"">&nbsp;</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 &nbsp;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"">&nbsp;</div><div class=3D"">&nbsp;</div><div =
class=3D"">Any clue?</div><div class=3D"">Is this normal?</div><div =
class=3D"">&nbsp;</div><div class=3D"">10x</div><div =
class=3D"">Eitan.</div><div =
class=3D"">&nbsp;</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"">http://listgateway.unipi.it/mailman/listinfo/ntop-dev</div></bl=
ockquote></div><br class=3D""></body></html>=

--Apple-Mail=_D29EA775-6E3B-42C4-A17B-D66EED8B75E1--

--===============8192780043463067447==
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
--===============8192780043463067447==--