Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2017 16:11:44 -0800
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Xiaoye Sun <Xiaoye.Sun@rice.edu>
Cc:        Vincenzo Maffione <v.maffione@gmail.com>, FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: [netmap] when does a packet in the netmap ring send out exactly
Message-ID:  <CA%2BhQ2%2Bh0QEx3LPvFGNZv5ZvBJOJ-X0go-=c3V0gr6FRhe7icXA@mail.gmail.com>
In-Reply-To: <CAJnByzhv27D_V=kyJjzQPQ28GM8kACKsH87MB5uDKVkQ-aka0g@mail.gmail.com>
References:  <CAJnByzh4Kzp6-DXXcB06QHSBJpHBKhtDnKUn7R%2BK0A_5VUThyw@mail.gmail.com> <CA%2B_eA9i5WOiA8j3y8fX65rzDLXEyt2B2wo8pK12jM2ZvEBURYg@mail.gmail.com> <CAJnByzhv27D_V=kyJjzQPQ28GM8kACKsH87MB5uDKVkQ-aka0g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
I think if you call the TXSYNC ioctl without advancing the head
pointer, then the tail is advanced
as much as possible.

Cheers
luigi

On Mon, Nov 20, 2017 at 3:35 PM, Xiaoye Sun <Xiaoye.Sun@rice.edu> wrote:
> Hi,
>
> I found that the tail pointer only moves when the ring has less than half
> of the slots available. This prevents me from knowing the accurate time
> when the packet in a slot is processed. Is there a way to move the tail
> pointer as long as the packet in the slot is processed? Is this a
> configurable feature?
>
> Best,
> Xiaoye
>
> On Fri, Oct 27, 2017 at 11:52 AM, Vincenzo Maffione <v.maffione@gmail.com>
> wrote:
>
>> Hi,
>>   This is actually a limitation of the netmap API: ring->tail is exposed
>> to the user so that it knows it can use the slots in the range
>> "[ring->head..ring->tail[" for new transmissions (note that head is
>> included, tail excluded, to prevent wraparound). However, there is no
>> explicit indication of "up to what slots packets were transmitted".
>> For hw NICs, however, ring->tail is an indication of where transmission
>> was completed.
>> Example:
>> 1) at the beginning ring->tail = ring->head = ring->cur = 0
>> 2) then your program moves head/cur forward: head = cur = 10
>> 3) you call TXSYNC, to submit the packets to the NIC.
>> 4) after the TXSYNC call, is very likely that tail is still 0, i.e.
>> because no transmission has been completed by the NIC (and no interrupt
>> generated).
>> 5) say after 20 us you issue another TXSYNC,  and in the meanwhile 6
>> packets had completed. In this case after TXSYNC you will find tail==5,
>> meaning that packets in the slots 0,1,2,3,4 and 5 have been completed. Note
>> that also the slot pointed by tail has been completed.
>>
>> But you are right that there is no way to receive completion notification
>> if the queue is not full. You must use TXSYNC to check (by sleeping or busy
>> wait) when tail moves forward.
>>
>> Cheers,
>>   Vincenzo
>>
>>
>> 2017-10-27 3:06 GMT+02:00 Xiaoye Sun <Xiaoye.Sun@rice.edu>:
>>
>>> Hi
>>>
>>> I write a netmap program that sends packets to the network. my program
>>> uses one netmap ring and fills the ring slots with packets.
>>> My program needs to do something (action A) after a particular packet
>>> (packet P) in the ring slot is sent to the network. so the program tracks
>>> the position of the tail point and checks if the tail point has moved
>>> across the slot I used to put that packet P.
>>> However, I found that the tail pointer may not move forward even seconds
>>> after the receiver side got packet P.
>>> Sometimes the tail pointer never moves forward until the TX ring is full.
>>> I try ioctl(NIOCTXSYNC), however, it cannot 100% solve the problem.
>>>
>>> My question is that is there a way to make the TX ring empty as early as
>>> possible so that I can know when my packet is sent out. or is there
>>> another
>>> way to know when the packet in the slot is sent to the network/NIC
>>> physical
>>> queue?
>>>
>>> I am using Linux 3.16.0-4-amd64.
>>>
>>> Thanks!
>>>
>>> Best,
>>> Xiaoye
>>> _______________________________________________
>>> freebsd-net@freebsd.org mailing list
>>> https://lists.freebsd.org/mailman/listinfo/freebsd-net
>>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>>>
>>
>>
>>
>> --
>> Vincenzo Maffione
>>
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



-- 
-----------------------------------------+-------------------------------
 Prof. Luigi RIZZO, rizzo@iet.unipi.it  . Dip. di Ing. dell'Informazione
 http://www.iet.unipi.it/~luigi/        . Universita` di Pisa
 TEL      +39-050-2217533               . via Diotisalvi 2
 Mobile   +39-338-6809875               . 56122 PISA (Italy)
-----------------------------------------+-------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2Bh0QEx3LPvFGNZv5ZvBJOJ-X0go-=c3V0gr6FRhe7icXA>