Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2015 15:40:04 -0800
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Slawa Olhovchenkov <slw@zxy.spb.ru>
Cc:        Stable Stable <freebsd-stable@freebsd.org>
Subject:   Re: NETMAP and off-by-one?
Message-ID:  <CA%2BhQ2%2BjGrZXd5e_uR_3fBJNUeDo1eGB2hVoWJm4dsOze9KrYFA@mail.gmail.com>
In-Reply-To: <20151113213039.GK48728@zxy.spb.ru>
References:  <20151113213039.GK48728@zxy.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 13, 2015 at 1:30 PM, Slawa Olhovchenkov <slw@zxy.spb.ru> wrote:
> I am see strange things: like NETMAP stop transmit after `head` and `cur`
> touch `tail`.
>
> But:
>
> /*
>  * check if space is available in the ring.
>  */
> static inline int
> nm_ring_empty(struct netmap_ring *ring)
> {
>         return (ring->cur == ring->tail);
> }
>
> i.e. if cur == (tail-1) mod ring_size -- space is available in the
> ring and I can put packet in output buffer.

The design requires to leave at least one empty slot in the buffer.
The name of the function is correct, the comment is probably not,
unless a bug has creeped in recently the code was very careful
in not using the free slot that separates the two regions.

cheers
luigi

> After put this packet ring is full, but no transmiting.
>
> This is bug?
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-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%2BjGrZXd5e_uR_3fBJNUeDo1eGB2hVoWJm4dsOze9KrYFA>