From owner-freebsd-net@FreeBSD.ORG  Fri Aug 19 18:54:39 2011
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 616F41065670
	for <freebsd-net@freebsd.org>; Fri, 19 Aug 2011 18:54:39 +0000 (UTC)
	(envelope-from pyunyh@gmail.com)
Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com
	[209.85.210.45])
	by mx1.freebsd.org (Postfix) with ESMTP id 3805A8FC12
	for <freebsd-net@freebsd.org>; Fri, 19 Aug 2011 18:54:38 +0000 (UTC)
Received: by pzk33 with SMTP id 33so8801379pzk.18
	for <freebsd-net@freebsd.org>; Fri, 19 Aug 2011 11:54:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=from:date:to:cc:subject:message-id:reply-to:references:mime-version
	:content-type:content-disposition:in-reply-to:user-agent;
	bh=Q7hQAPWqz3XMhoqWDQssz8AnWOlaohd15/b9NnyIZyg=;
	b=FSFhnbLbmdLk4/lUX/guod2+QUHbn/T05PVmdGAW/Wiz1gF/nLAKB/27dnKX3RXwbe
	R0F6tvDALuEpsyPTKljVnKlFZG73Wd/ybwkl982f9atxDWsum4RbVJq9fjCr1xbxyLnZ
	FtHMQwr8osxOynFO2AkkO8mpuzP4kb1hTrwoM=
Received: by 10.142.13.2 with SMTP id 2mr32007wfm.97.1313778459264;
	Fri, 19 Aug 2011 11:27:39 -0700 (PDT)
Received: from pyunyh@gmail.com ([174.35.1.224])
	by mx.google.com with ESMTPS id s9sm2514293pbk.50.2011.08.19.11.27.36
	(version=TLSv1/SSLv3 cipher=OTHER);
	Fri, 19 Aug 2011 11:27:38 -0700 (PDT)
Received: by pyunyh@gmail.com (sSMTP sendmail emulation);
	Fri, 19 Aug 2011 11:27:34 -0700
From: YongHyeon PYUN <pyunyh@gmail.com>
Date: Fri, 19 Aug 2011 11:27:34 -0700
To: Ben Gray <ben.r.gray@gmail.com>
Message-ID: <20110819182734.GC17324@michelle.cdnetworks.com>
References: <4E4E3522.6030207@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4E4E3522.6030207@gmail.com>
User-Agent: Mutt/1.4.2.3i
Cc: freebsd-net@freebsd.org
Subject: Re: Test tools for new network driver
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: pyunyh@gmail.com
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Aug 2011 18:54:39 -0000

On Fri, Aug 19, 2011 at 11:04:18AM +0100, Ben Gray wrote:
> Hi,
> 
>     I'm not sure if this the right list to post to, but here goes ...
> 
>     I'm currently writing a driver for the SMSC LAN95xx range of USB to 
> Ethernet adapter chips 
> (http://www.smsc.com/index.php?tid=300&pid=135&tab=1). The basic RX/TX 
> works and now I'm trying to get the H/W checksum offload working, 
> however I've come across some problems with the H/W implementation, e.g. 
> it doesn't work with small (<64 byte) packets.
> 

In old days, it was common that see hardware issues where TX
checksum offloading does not work unless you manually pad the frame
to satisfy minimal frame size(60 bytes).  Check if the controller
has auto-padding feature or try manually pad it.

Note, current USB stack lacks TX/RX checksum offloading support. I
have a working patch which would give you some idea.

uether patch:
http://people.freebsd.org/~yongari/axe/usb_ethernet.diff4
axe(4) to enable TX/RX checksum offloading:
http://people.freebsd.org/~yongari/axe/axe_csum.diff4

>     So I was wondering if anyone knows of any test tools I can use to 
> fire all the different unusual sort of packets at the interface to see 
> how the H/W csum reacts, i.e. runt packets, packets with IP options, 
> IPv6 packets with extension headers, etc.
> 

I'm not aware of tools that can do you mentioned above. However, I
guess you can generate many test cases with existing tools(ping,
netperf etc).

>     Another question I had was; is there a kernel function to generate 
> a random MAC address ? Or is there a FreeBSD (or FOSS equivalent) 
> Ethernet manufacturer ID I could use for randomly generated MAC addresses ?
> 

See sk(4) how it uses randomly generated station address.

>     The primarily purpose is for the range of Texas Instruments ARM 
> development boards (Pandaboard & Beagleboard), however there does exist 
> at least one USB dongle you can buy for the PC which uses this chipset.
> 
> Thanks in advance,
> Ben