From owner-freebsd-net@FreeBSD.ORG Mon Sep 13 21:13:27 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2EA3816A4CE for ; Mon, 13 Sep 2004 21:13:27 +0000 (GMT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id B08A243D5F for ; Mon, 13 Sep 2004 21:13:26 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.12.10/8.12.10) with ESMTP id i8DLDQJt021099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 13 Sep 2004 17:13:26 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id i8DLDLZC067550; Mon, 13 Sep 2004 17:13:21 -0400 (EDT) (envelope-from gallatin) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16710.3441.49431.847790@grasshopper.cs.duke.edu> Date: Mon, 13 Sep 2004 17:13:21 -0400 (EDT) To: "Don Bowman" In-Reply-To: References: X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid cc: freebsd-net@freebsd.org Subject: RE: packet generator X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2004 21:13:27 -0000 Don Bowman writes: > From: owner-freebsd-net@freebsd.org > > [mailto:owner-freebsd-net@freebsd.org]On Behalf Of Andrew Gallatin > > Sent: September 10, 2004 19:08 PM > > To: freebsd-net@freebsd.org > > Subject: packet generator > > > > Does anybody have a free, in-kernel tool to generate packets quicky > > and send them out a particular etherent interface on FreeBSD? > > Something similar to pktgen on linux? > > > > I'm trying to excersize just the send-side of programmable firmware > > based NIC. The recieve side of the NIC firmware is not yet written, > > but I want to get started tuning and shaking the bugs out of the send > > side while the firmware author does the recieve path. The packets > > just get dropped on the floor by the NIC, so its a good way to test > > the interface.. > > > > ng_source was a netgraph module we wrote and contributed. > It can transmit ~800Kpps on a PCI-X system. The code is in > src/sys/netgraph/ng_source.c. I finally figured out that ngctl shutdown mx0:orphans will get things reset enough so that I can re-run the test. I send 1.6 million packets and set things up so that I see these stats at the end: Args: { outOctets=102400000 outFrames=1600000 queueOctets=64 queueFrames=1 startTime={ tv_sec=1095109553 tv_usec=628521 } endTime={ tv_sec=1095109557 tv_usec=546685 } elapsedTime={ tv_sec=3 tv_usec=918164 } } If I put counters in my driver's xmit routine, I see that my driver's xmit routine was called 683441 times. This means that the queue was only a little over two packets deep on average, and vmstat shows idle time. I've tried piping additional packets to nghook mx0:orphans input, but that does not seem to increase the queue depth. My default send queue maxlen is 255 (hw send fifo size) and I (think) I see ng_source increasing it: ng_source: changing ifq_maxlen from 255 to 4096 Hmm.. I wonder if I need to increase hz.. Thanks, Drew