Packets bouncing
Eitan Michaelson <[email protected]> Mon, 2 Sep 2019 13:33:50 +0300
| Newsgroups | gmane.linux.ntop.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============2843119558383493203==
Content-Type: multipart/alternative;
boundary="Apple-Mail=_5FF3E99E-9042-424E-8D7A-D5A9228BFC32"
--Apple-Mail=_5FF3E99E-9042-424E-8D7A-D5A9228BFC32
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
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=
--Apple-Mail=_5FF3E99E-9042-424E-8D7A-D5A9228BFC32
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"">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></body></html>=
--Apple-Mail=_5FF3E99E-9042-424E-8D7A-D5A9228BFC32--
--===============2843119558383493203==
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
--===============2843119558383493203==--