VIA VT8235 NIC driver question (if_fet.c)

Palle Girgensohn girgen at pingpong.net
Wed Aug 13 08:50:37 PDT 2003


Hi!

I just got an Asus A7V8X-X motherboard with an online NIC in the South 
bridge controller, VIA VT8235. I found a freebsd driver on VIA's site 
<http://www.viaarena.com/?PageID=71>, but it didn't build for FreeBSD 4.8. 
I removed some code, and it built, but I ususally don't hack network 
drivers, so I'd just like to check if my fix is safe or just plains stupid. 
The mbuf pkthdr struct has changed in 4.8 and no longer has the aux field, 
so I simply removed the code that handles this:

--- /home/girgen/VT8235/FREEBSD/if_fet.c        Wed Jan 15 19:03:54 2003
+++ if_fet.c    Wed Aug 13 17:21:24 2003
@@ -1640,7 +1640,7 @@
              * code does not call M_PREPEND properly.
              * (example: call to bpf_mtap from drivers)
              */
-#if __FreeBSD_version >= 410000
+#if __FreeBSD_version >= 410000 && __FreeBSD_version < 48000
             if ((cur_tx->fet_mbuf->m_flags & M_PKTHDR) != 0 && 
cur_tx->fet_mbuf->m_pkthdr.aux) {
                 m_freem(cur_tx->fet_mbuf->m_pkthdr.aux);
                 cur_tx->fet_mbuf->m_pkthdr.aux = NULL;
@@ -1697,7 +1697,7 @@
              * code does not call M_PREPEND properly.
              * (example: call to bpf_mtap from drivers)
              */
-#if __FreeBSD_version >= 410000
+#if __FreeBSD_version >= 410000 && __FreeBSD_version < 48000
             if ((cur_tx->fet_mbuf->m_flags & M_PKTHDR) != 0 && 
cur_tx->fet_mbuf->m_pkthdr.aux) {
                 m_freem(cur_tx->fet_mbuf->m_pkthdr.aux);
                 cur_tx->fet_mbuf->m_pkthdr.aux = NULL;
@@ -1973,7 +1973,7 @@
                 if(m->m_len == 0) {
                     tmp = m;
                     m = m->m_next;
-#if __FreeBSD_version >= 410000
+#if __FreeBSD_version >= 410000 && __FreeBSD_version < 48000
                     if ((tmp->m_flags & M_PKTHDR) != 0 && 
tmp->m_pkthdr.aux) {
                         m_freem(tmp->m_pkthdr.aux);
                         tmp->m_pkthdr.aux = NULL;


I enclose the driver code as distributed from VIA.

Thanks,
Palle
-------------- next part --------------
**
**
**  VIA Rhine Family Fast Ethernet Adapter
**
**  FreeBSD driver
**
**  v3.10 Jan. 2003
**
** 
         
Introduction:
=============

  The Fast Ethernet 10/100M FreeBSD driver is enclosed. This document shows you how to 
  setup the driver.

Contents of the Subdirectory:
=============================

    freebsd.txt           This file.
    freebsd.tar           Tar file include the following file list 
    if_fet.c              The FreeBSD driver source code
    if_fet.h              The FreeBSD driver header file

Installation:
=============

    1) Put the driver disc in Drive A. Under the prompt, type "mount_msdos /dev/fd0 /mnt".
       Then, type "cp /mnt/freebsd.tar /usr/src/sys/pci".

    2) Type the following commands:
       (a) "cd /usr/src/sys/pci"
       (b) "tar xvf freebsd.tar"
       (c) "cd /usr/src/sys/conf"
       (d) "ee files"

    3) Under editing file 'files'
       (a) In FREEBSD 3.x , please add one line as below:
           "pci/if_fet.c		optional	fet	device-driver"
           and mark this line as below:
           "#pci/if_vr.c		optional	vr	device-driver"
       (b) In FREEBSD 4.x , please add one line as below:
           "pci/if_fet.c		optional	fet"
           and mark this line as below:
           "#pci/if_vr.c		optional	vr"
       Then, save the file. It's important to mark if_vr.c, or you will use the
       old driver.
       			        
    4) Type the following commands:
       (a) "cd /usr/src/sys/i386/conf"
       (b) "cp GENERIC SERVER"
       (c) "ee SERVER"
       
    5) Under editing file 'SERVER', finding the division of NIC setting, and insert one line
       as below:
       "device fet0"
       And ,mark this line as below:
       "#device vr0"
       Then, save the file. It's important to mark device vr0, or you will use the
       old driver.

    6) Now, it's ready to recompile kernel; type the following commands:
       (a) cd /usr/src/sys/i386/conf
       (b) config SERVER
       (c) cd /usr/src/sys/compile/SERVER
       (d) make depend all install

    7) Before rebooting, make sure the network-related files under /etc are well-configured. 
       The files are listed below:
       (a) /etc/hosts
       (b) /etc/resolv.conf
       (c) /etc/host.conf
       (d) /etc/rc.conf

    8) Now, get ready to reboot, type "sync;sync;sync", and "shutdown -r now".
       
    9) Under the newly compiled kernel, type "ifconfig -a", and you can see a new device fet0 (not vr0).

Speed and duplex mode Setting:
==============================
You can use ifconfig command to force speed and duplex mode of NIC,
where # below is network interface number. We only support this function in
FreeBSD 4.x now.
(eg: Use "ifconfig fet0 media 100baseTX" command to force NIC to 100Mbps half-duplex mode)

1) Auto Mode (Autonegotiation)
    ifconfig fet# media auto

2) 100Mbps full-duplex mode
    ifconfig fet# media 100baseTX mediaopt full-duplex

3) 100Mbps half-duplex mode
    ifconfig fet# media 100baseTX

4) 10Mbps full-duplex mode
    ifconfig fet# media 10baseT/UTP mediaopt full-duplex

5) 10Mbps half-duplex mode
    ifconfig fet# media 10baseT/UTP


Driver tunable parameters (Experts only)
========================================

    You can tune up the performance of driver by modified the pre-define 
constants in header file if_fet.h.

DMA_LENGTH_DEF:
DMA_LENGTH_DEF is used for controlling the DMA length.
   0: 8 DWORDs 
   1: 16 DWORDs (Default)
   2: 32 DWORDs
   3: 64 DWORDs
   4: 128 DWORDs
   5: 256 DWORDs
   6: SF(flush till emply)
   7: SF(flush till emply)

TX_THRESH_DEF:
TX_THRESH_DEF is used for controlling the transmit fifo threshold.   
   0: indicate the txfifo threshold is 128 bytes. (Default)
   1: indicate the txfifo threshold is 256 bytes.
   2: indicate the txfifo threshold is 512 bytes.
   3: indicate the txfifo threshold is 1024 bytes.
   4: indicate that we use store and forward


QPACKET_DEF:
QPACKET_DEF is used for controlling the enable/disable the transmit 
   status write back queue.   
   0: Disable 
   1: Enable (Default)

VAL_PKT_LEN:
VAL_PKT_LEN is used to drop 802.3 frame with invalid length.
   0: Disable (Default)
   1: Enable 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: if_fet.c
Type: application/octet-stream
Size: 108075 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hardware/attachments/20030813/6591246a/if_fet-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: if_fet.h
Type: application/octet-stream
Size: 28204 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hardware/attachments/20030813/6591246a/if_fet-0003.obj


More information about the freebsd-hardware mailing list