Subject: Re: Gigabit Ethernet
To: David Maxwell <david@fundy.ca>
From: Matthias Drochner <drochner@zel459.zel.kfa-juelich.de>
List: port-i386
Date: 09/05/1999 18:46:37
david@fundy.ca said:
> There are enough changes between NetBSD-1.4 and the version of FreeBSD
> that the drivers are for that it was slowing me down. 

Fwiw, I've written up a number of FreeBSD-NetBSD differences
I had to deal with when I ported network drivers.
I'll append it - hope it helps.

best regards
Matthias


1. Simple include file and definition stuff

1.1 #include file names/locations are quite different

1.2 packetfilter
    FreeBSD: "BPF"
    NetBSD: "BPFILTER"

    [looks gratitous; seems to differ a lot between OSes
    (DEC: "packetfilter")]

1.3 NetBSD needs to include "opt_inet.h" and "opt.ns.h"

1.4 global "bootverbose" doesn't exist on NetBSD

1.5 NetBSD has central PCI ID database and PCI register
    definitions

1.6 if_media: FreeBSD: IFM_1000_SX, NetBSD: IFM_1000_FX

    [there is nothing like 1000_FX - NetBSD is wrong]

1.7 different stuff in <sys/queue.h>
    (nothing like SLIST in NetBSD)

    [name differences gratitous, but an SLIST-like thing could be
    useful for NetBSD (less overhead than SIMPLEQ)]


2. Framework, not network specific

2.1 different autoconfiguration framework

2.2 printouts with device name
    FreeBSD: name:unit
    NetBSD: xname
    (similar in "struct ifnet")

2.3 interrupt handler void on FreeBSD, int on NetBSD

    [detection of stray interrupts???]

2.4 bus.h: access to virtual address for mapped range
    (BUS_SPACE_MAP_LINEAR should provide this)

    [Missing in NetBSD's bus_space framework. Potential
    source of inportability, use bus_space_xxx if feasible.]

2.5 bus_dma issues (FreeBSD has still old functions)


3. Network stuff

3.1 external mbuf storage handling
    FreeBSD: no argument to xxxfree()
    NetBSD: opaque argument to xxxfree()
    FreeBSD: driver implements reference counting
    NetBSD: automatic reference counting

3.2 FreeBSD has common ether_ioctl()

    [good - eliminates common code]

3.3 "struct ether_addr" member for address bytes
    FreeBSD: "octet"
    NetBSD: "ether_addr_octet"

    [gratitous]

3.4 "ethercom" vs. "arpcom" in softc

    [technically, NetBSD is right]

3.5 access to ethernet address
    FreeBSD: in "arpcom", accessed there
    NetBSD: passed to ether_ifattach(), accessed through ifp
     (LLADDR() - watch out for alignment problems!)

    [NetBSD can't deal with address changes at runtime]

3.6 multicast address list
    FreeBSD: plain list at ifp->if_multiaddrs
    NetBSD: special framework, part of "struct ethercom"

3.7 differing members in "struct ifnet", and different
    initialization (if_attach, ether_ifattach)
    -xname vs name:unit - see (2.1)
    -FreeBSD: xxxinit() - for use by ether_ioctl() - see (3.2)
    -ethernet address - see (3.5)

3.8 arguments to bpf functions
    FreeBSD: ifp
    NetBSD: ifp->if_bpf

3.9 passing of received packets to upper layer
    FreeBSD: ether header separate, to ether_input()
    NetBSD: whole packet, indirectly through ifp->ifp_input

    [recent change in NetBSD]

3.10 NetBSD has an MII framework; drivers provide register access
     only