Mailing List Archive

Packets bouncing
Hello,
Consider the following pseudo code that attempts to send every inbound RX packet through the same port it was received.

// Note 2 deferment rings where the RX ring is attached "eth1, eth2, eth3" and
// the TX ring is attached only to "eth1"

pfring *rx_handle, *tx_handle;

while (true)
{
if ((rc = pfring_recv(rx_handle, &localBuf_p, , MAX_SIZE, &hdr, 1)) == 1)
{

pfring_send(tx_handle, localBuf_p, hdr.len, 1);
pfring_flush_tx_packets(tx_handle);
}
}

My setup includes a Linux box that runs this code, a PC that sends packets to the Linux “eth1” port, and an external sniffer that inspecting the traffic.
When sending a single packet (128 bytes) to Linux box over “eth1", 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.


Any clue?
Is this normal?

10x
Eitan.
Re: Packets bouncing [ In reply to ]
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 <eitanm@me.com> wrote:
>
> Hello,
> Consider the following pseudo code that attempts to send every inbound RX packet through the same port it was received.
>
> // Note 2 deferment rings where the RX ring is attached "eth1, eth2, eth3" and
> // the TX ring is attached only to "eth1"
>
> pfring *rx_handle, *tx_handle;
>
> while (true)
> {
> if ((rc = pfring_recv(rx_handle, &localBuf_p, , MAX_SIZE, &hdr, 1)) == 1)
> {
>
> pfring_send(tx_handle, localBuf_p, hdr.len, 1);
> pfring_flush_tx_packets(tx_handle);
> }
> }
>
> My setup includes a Linux box that runs this code, a PC that sends packets to the Linux “eth1” port, and an external sniffer that inspecting the traffic.
> When sending a single packet (128 bytes) to Linux box over “eth1", 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.
>
>
> Any clue?
> Is this normal?
>
> 10x
> Eitan.
>
> _______________________________________________
> Ntop-dev mailing list
> Ntop-dev@listgateway.unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev
Re: Packets bouncing [ In reply to ]
10x
It did the trick :)


> On 2 Sep 2019, at 15:49, Alfredo Cardigliano <cardigliano@ntop.org> wrote:
>
> 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 <eitanm@me.com <mailto:eitanm@me.com>> wrote:
>>
>> Hello,
>> Consider the following pseudo code that attempts to send every inbound RX packet through the same port it was received.
>>
>> // Note 2 deferment rings where the RX ring is attached "eth1, eth2, eth3" and
>> // the TX ring is attached only to "eth1"
>>
>> pfring *rx_handle, *tx_handle;
>>
>> while (true)
>> {
>> if ((rc = pfring_recv(rx_handle, &localBuf_p, , MAX_SIZE, &hdr, 1)) == 1)
>> {
>>
>> pfring_send(tx_handle, localBuf_p, hdr.len, 1);
>> pfring_flush_tx_packets(tx_handle);
>> }
>> }
>>
>> My setup includes a Linux box that runs this code, a PC that sends packets to the Linux “eth1” port, and an external sniffer that inspecting the traffic.
>> When sending a single packet (128 bytes) to Linux box over “eth1", 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.
>>
>>
>> Any clue?
>> Is this normal?
>>
>> 10x
>> Eitan.
>>
>> _______________________________________________
>> Ntop-dev mailing list
>> Ntop-dev@listgateway.unipi.it <mailto:Ntop-dev@listgateway.unipi.it>
>> http://listgateway.unipi.it/mailman/listinfo/ntop-dev
>
> _______________________________________________
> Ntop-dev mailing list
> Ntop-dev@listgateway.unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-dev