CFT: sf(4)

Pyun YongHyeon pyunyh at
Sat Jan 12 02:38:01 PST 2008

On Wed, Jan 02, 2008 at 12:39:39PM +0900, To freebsd-current at wrote:
 > Hi,
 > I had been using the following overhauled sf(4) for serveral months
 > without issues. It would be really great sf(4) users can test the
 > driver and report back how it works on his/her box. Basically the
 > driver does the following thing.
 >  - bus_dma(9) conversion and endianness support : Now sf(4) should
 >     work on all architectures that FreeBSD runs.
 >  - Performance optimization : switch to type 2 Tx descriptor and
 >     removed lots of PCI register access. Rx alignment fixup is only
 >     called on strict-alignment architectures so i386/amd64 would
 >     get instant Rx performance boost.
 >  - AIC-6915 supports Rx/Tx checksum offload as well as hardware VLAN
 >     tag insertion/stripping if firmware is loaded into frame
 >     processor. Unfortunately the firmware is not available under BSD
 >     license so these additional hardware accelerations are not
 >     available yet on FreeBSD. :-(
 >  - Code cleanup & misc bug fixes.

A couple of days ago brueffer@ sent me a Starfire firmware. He said
gibbs@ sent him the firmware but checksum offload capability was not
added into driver at that time. So I took the firmware and wrote a
download routine from the information in datasheet. But the firmware
had a bug that prevents hardware from computing Tx checksumm.
Fortunately, I managed to analyze the bug and fixed it by hand. :-)

I've updated the overhauled sf(4) to use the firmware and fixed
several minor bugs in it. If there are no objections I'll commit it
in two weeks. The overhauled sf(4) has two sysctl variables not
present in stock version.

dev.sf.N.stats : N indicates instance number of driver.
With 'sysctl dev.sf.0.stats=1' command, you can see lots of useful
counters maintained by driver. Most counters are 32bit value but
number of Tx/Rx frames/octets and Rx bytes associated with packet
length are 64bit value.

dev.sf.N.int_mod : N indicates instance number of driver.
This controls how long sf(4) delays interrupt processing. Accepted
range is 0 to 31. Actual interrupt delay time is comuted by the
following expression.
  delay = dev.sf.N.int_mod * 102.4us
The default value is 1(e.g. 102.4us). 0 completely disables the
interrupt modertation.


Download and copy the above files to /usr/src/sys/pci directory and
rebuild sf(4). Because I removed unnecessary copy operation in Rx
path you should see instant performance boost on i386/amd64. sparc64
still need the copy operation, though. If you find any regression
please let me know.

Thank you!

Pyun YongHyeon

More information about the freebsd-current mailing list