From owner-freebsd-stable@freebsd.org Fri Nov 13 23:40:07 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 272DFA2EE1A for ; Fri, 13 Nov 2015 23:40:07 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A829F1EC5 for ; Fri, 13 Nov 2015 23:40:06 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by lfdo63 with SMTP id o63so60970049lfd.2 for ; Fri, 13 Nov 2015 15:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=KwhkHv79we3yUqLUqbCvfwRA+70OH6zilHTmxL8YseY=; b=mc/njHf1khdQn7RJGhUwtd/czL2xZgQnSvUmTryoQ8x/Yhqd1HtPcSvJ5piBObwCaz Kgekw4jm8lAdp6vE+dZiWlQBBvF/S9x1++0ONiumxBN91hLXpIGy2bhuLlcnpWycHn+A jy73CCgEv1xt8QW0tWGwBrrgkI/f3J/mAjoTD/r+zJ57UDq/OW4A3UjZhB5S3LP7uCZU rP6VH83rGwffsWJJAzruU6YPWC1i28mXCcO7JBii7YSup/fOAEpZwvC/8onSETx2mpNs lW267KOqfUXRX+yTT3/C+L4n+pcSJWzXiKiZe0Dog2tw1+k05A3Cs8BMGXNB3v6GWy1V AR+g== MIME-Version: 1.0 X-Received: by 10.25.205.193 with SMTP id d184mr11517347lfg.72.1447458004452; Fri, 13 Nov 2015 15:40:04 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.114.78.3 with HTTP; Fri, 13 Nov 2015 15:40:04 -0800 (PST) In-Reply-To: <20151113213039.GK48728@zxy.spb.ru> References: <20151113213039.GK48728@zxy.spb.ru> Date: Fri, 13 Nov 2015 15:40:04 -0800 X-Google-Sender-Auth: HOHh9JeH-Z7sdCq0O9b-z-UGz_o Message-ID: Subject: Re: NETMAP and off-by-one? From: Luigi Rizzo To: Slawa Olhovchenkov Cc: Stable Stable Content-Type: text/plain; charset=UTF-8 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 23:40:07 -0000 On Fri, Nov 13, 2015 at 1:30 PM, Slawa Olhovchenkov 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) -----------------------------------------+-------------------------------