Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Nov 2015 11:46:58 +0300
From:      Slawa Olhovchenkov <slw@zxy.spb.ru>
To:        Luigi Rizzo <rizzo@iet.unipi.it>
Cc:        Stable Stable <freebsd-stable@freebsd.org>
Subject:   Re: NETMAP and off-by-one?
Message-ID:  <20151114084658.GZ31314@zxy.spb.ru>
In-Reply-To: <CA%2BhQ2%2BjGrZXd5e_uR_3fBJNUeDo1eGB2hVoWJm4dsOze9KrYFA@mail.gmail.com>
References:  <20151113213039.GK48728@zxy.spb.ru> <CA%2BhQ2%2BjGrZXd5e_uR_3fBJNUeDo1eGB2hVoWJm4dsOze9KrYFA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 13, 2015 at 03:40:04PM -0800, Luigi Rizzo wrote:

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

Please, do some clarification, in case for transmit patch:

- can I put in txring in case cur == (tail-1) mod ring_size?
- can I use poll with only `events |= POLLIN` for transmiting?

in case for receive patch:

- can I detect input overflow?

> 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?20151114084658.GZ31314>