From owner-freebsd-stable@freebsd.org Fri Nov 13 21:30:48 2015 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C21AA2EF58 for ; Fri, 13 Nov 2015 21:30:48 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25166177E for ; Fri, 13 Nov 2015 21:30:48 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1ZxLvb-000GVW-8n for freebsd-stable@freebsd.org; Sat, 14 Nov 2015 00:30:39 +0300 Date: Sat, 14 Nov 2015 00:30:39 +0300 From: Slawa Olhovchenkov To: freebsd-stable@freebsd.org Subject: NETMAP and off-by-one? Message-ID: <20151113213039.GK48728@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 21:30:48 -0000 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. After put this packet ring is full, but no transmiting. This is bug?