History log of /freebsd-11-stable/sys/dev/en/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
332288 08-Apr-2018 brooks

MFC r331797:

Use an accessor function to access ifr_data.

This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size).

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14900

302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
298433 21-Apr-2016 pfg

sys: use our roundup2/rounddown2() macros when param.h is available.

rounddown2 tends to produce longer lines than the original code
and when the code has a high indentation level it was not really
advantageous to do the replacement.

This tries to strike a balance between readability using the macros
and flexibility of having the expressions, so not everything is
converted.


276692 05-Jan-2015 rwatson

To ease changes to underlying mbuf structure and the mbuf allocator, reduce
the knowledge of mbuf layout, and in particular constants such as M_EXT,
MLEN, MHLEN, and so on, in mbuf consumers by unifying various alignment
utility functions (M_ALIGN(), MH_ALIGN(), MEXT_ALIGN() in a single
M_ALIGN() macro, implemented by a now-inlined m_align() function:

- Move m_align() from uipc_mbuf.c to mbuf.h; mark as __inline.
- Reimplement M_ALIGN(), MH_ALIGN(), and MEXT_ALIGN() using m_align().
- Update consumers around the tree to simply use M_ALIGN().

This change eliminates a number of cases where mbuf consumers must be aware
of whether or not mbufs returned by the allocator use external storage, but
also assumptions about the size of the returned mbuf. This will make it
easier to introduce changes in how we use external storage, as well as
features such as variable-size mbufs.

Differential Revision: https://reviews.freebsd.org/D1436
Reviewed by: glebius, trasz, gnn, bz
Sponsored by: EMC / Isilon Storage Division


271849 19-Sep-2014 glebius

Mechanically convert to if_inc_counter().


260038 29-Dec-2013 dim

In sys/dev/en/midway.c, #if 0 an unused static function.

MFC after: 3 days


257176 26-Oct-2013 glebius

The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by: Netflix
Sponsored by: Nginx, Inc.


243857 04-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


232883 12-Mar-2012 scottl

Final pass at having devices use their bus parent for dma tags. The
remaining drivers that haven't been converted have various problems or
complexities that will be dealt with later. This list includes:

hptrr, hptmv, hpt27xx - device aggregation across multiple parents
drm - want to talk to the maintainer first
tsec, sec - Openfirmware devices, not sure if changes are warranted
fatm - Done except for unused testing code
usb - want to talk to the maintainer first
ce, cp, ctau, cx - Significant driver changes needed to convey parent info

There are also devices tucked into architecture subtrees that I'll leave
for the respective maintainers to deal with.


223624 28-Jun-2011 kevlo

Remove duplicate header includes


217556 18-Jan-2011 mdf

Specify a CTLTYPE_FOO so that a future sysctl(8) change does not need
to rely on the format string.


184712 06-Nov-2008 bz

Hide an unused variable in case we compile with neither INET nor INET6.
NATM needs 'struct in_addr' to compile, which is a problem on its own
but include in.h for now if we have NATM but neither INET or INET6.

MFC after: 2 months


177599 25-Mar-2008 ru

Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.
Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true
since the advent of MBUMA.

Reviewed by: arch

There are ongoing disputes as to whether we want to switch to directly using
UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.


170093 29-May-2007 rwatson

Where I previously removed calls to kdb_enter(), now remove include of
kdb.h.

Pointed out by: bde


170013 27-May-2007 rwatson

Rather than entering DDB with the message "unexpected error" and wedging
the card, panic explicitly if EN_DEBUG is enabled. In the (default)
case of !EN_DEBUG, the driver resets the card. Probably this case
shouldn't exist at all.


166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


165640 29-Dec-2006 jhb

Fix fat-fingering in previous commit.

Pointy hat to: jhb


165632 29-Dec-2006 jhb

Various bpf(4) related fixes to catch places up to the new bpf(4)
semantics.
- Stop testing bpf pointers for NULL. In some cases use
bpf_peers_present() and then call the function directly inside the
conditional block instead of the macro.
- For places where the entire conditional block is the macro, remove the
test and make the macro unconditional.
- Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of
the old semantics.

Reviewed by: csjp (older version)


162321 15-Sep-2006 glebius

- Consistently use if_printf() only in interface methods: if_start(),
if_watchdog, etc., or in functions used only in these methods.
In all other functions in the driver use device_printf().
- Use __func__ instead of typing function name.

Submitted by: Alex Lyashkov <umka sevcity.net>


156951 21-Mar-2006 harti

Subtracting two pointers produces a ptrdiff_t not a size_t so use
the %td to print this instead of %zu or %d.


151771 27-Oct-2005 jhb

Drop the driver lock around atm_input() analogous to all the ethernet
drivers dropping the driver lock around ether_input().

Silence by: harti


150712 29-Sep-2005 jhb

- Use PCIR_BAR macro rather than hardcoding 0x10.
- Use pci_enable_busmaster() rather than doing it by hand.
- Remove duplicate if_free().


150306 19-Sep-2005 imp

Make sure that we call if_free(ifp) after bus_teardown_intr. Since we
could get an interrupt after we free the ifp, and the interrupt
handler depended on the ifp being still alive, this could, in theory,
cause a crash. Eliminate this possibility by moving the if_free to
after the bus_teardown_intr() call.


150215 16-Sep-2005 ru

Fix "struct ifnet" leaks when attach() fails in the middle.


148887 09-Aug-2005 rwatson

Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags. Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags. This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by: pjd, bz
MFC after: 7 days


147256 10-Jun-2005 brooks

Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
- Struct arpcom is no longer referenced in normal interface code.
Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
To enforce this ac_enaddr has been renamed to _ac_enaddr.
- The second argument to ether_ifattach is now always the mac address
from driver private storage rather than sometimes being ac_enaddr.

Reviewed by: sobomax, sam


143161 05-Mar-2005 imp

Use BUS_PROBE_DEFAULT for pci probe return value


139749 06-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


132987 02-Aug-2004 green

* Add a "how" argument to uma_zone constructors and initialization functions
so that they know whether the allocation is supposed to be able to sleep
or not.
* Allow uma_zone constructors and initialation functions to return either
success or error. Almost all of the ones in the tree currently return
success unconditionally, but mbuf is a notable exception: the packet
zone constructor wants to be able to fail if it cannot suballocate an
mbuf cluster, and the mbuf allocators want to be able to fail in general
in a MAC kernel if the MAC mbuf initializer fails. This fixes the
panics people are seeing when they run out of memory for mbuf clusters.
* Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing
the default.

Both bmilekic and jeff have reviewed the changes made to make failable
zone allocations work.


131913 10-Jul-2004 marcel

Update for the KDB framework:
o Call kdb_enter() instead of Debugger().
o Don't make such calls conditional upon KDB instead of DDB because
they're already conditional upon EN_DEBUG.


129879 30-May-2004 phk

Add missing <sys/module.h> includes


127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


126396 29-Feb-2004 scottl

All three of these drivers abused cv_waitq_empty in the same way by spinning
on it in hopes of making sure that the waitq was empty before going on.
This wasn't needed and probably never would have worked as intended. Now
that cv_waitq_empty() and friends are gone, the code in these drivers that
spins on it can go away too. This should unbreak LINT.

Discussed with: kan


123593 17-Dec-2003 harti

Move the locking of the softc up to before the allocation of the
transmission map. This allocation accesses the softc so should
be under the lock (it uses NOWAIT).


121816 31-Oct-2003 brooks

Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By: re (in principle)
Reviewed By: njl, imp
Tested On: i386, amd64, sparc64
Obtained From: NetBSD (if_xname)


119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


119277 22-Aug-2003 imp

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


118607 07-Aug-2003 jhb

Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort. In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by: bde (kern_ktrace.c)


118548 06-Aug-2003 harti

Remove the ATMIOCENA and ATMIOCDIS ioctl. Everyting has been converted
to use the new OPENVCC and CLOSEVCC calls that allow the sepcification
of traffic parameters for the connections.


118534 06-Aug-2003 harti

Honor the new ATMIO_FLAG_ASYNC that requests asynchronuous open/close
operations on VCs.


118533 06-Aug-2003 harti

When sending check that the channel is really open. Get the information
whether we use AAL5 or not from the aal field of the channel parameters
instead of the flag in the pseudo header. This flag will go away soon.


118532 06-Aug-2003 harti

Print an array index that is computed as ptrdiff_t with %tu.


118523 06-Aug-2003 obrien

Change the format type to unbreak LINT on 64-bit platforms.


118495 05-Aug-2003 harti

Implement per-VC statistics.


118494 05-Aug-2003 harti

Implement the ATMIOCOPENVCC and ATMIOCCLOSEVCC ioctls(). This was the
last driver that did not know about those.


118491 05-Aug-2003 harti

Use the generic getvccs function from net/if_atmsubr.c and remove
the home-grown version.


118490 05-Aug-2003 harti

Arrghhh. Remove debugging printf's that slipped in in the pre-previous
commit.


118489 05-Aug-2003 harti

Use __FBSDID() as per style(9).


118487 05-Aug-2003 harti

Make the en(4) driver more like the other ATM drivers. This is the
preparation for supporting the OPENVCC and CLOSEVCC ioctls which
are needed for ng_atm. This required some re-organisation of the code
(mostly converting array indexes to pointers). This also gives us
an array of open vccs that will help in using the generic GETVCCS handler.


118484 05-Aug-2003 harti

Move the clearing of the IFF_RUNNING flag into the reset routine.
Otherwise the interface will report RUNNING to ifconfig after doing
'ifconfig down' although it isn't running anymore.


117641 15-Jul-2003 harti

Be careful to call bus_dmamap_load with BUS_DMA_NOWAIT so that the
callback will never be deferred. ATM needs to prevent cell and packet
ordering. Also use the default mutex and lock functions (those that
panic) for the tag creation.


117227 04-Jul-2003 harti

Delete a superfluous semi-colon.

Pointed out by: nick@garage.freebsd.pl


117126 01-Jul-2003 scottl

Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma. At the moment, this is used for the
asynchronous busdma_swi and callback mechanism. Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg. dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create(). The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms. The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by: tmm, gibbs


116297 13-Jun-2003 harti

Implement the ioctl that returns a list of currently open VCCs.


116294 13-Jun-2003 harti

Make the midway driver use the new ATM phy driver. This allows one to
toggle several media options (sonet/sdh, for example) with ifconfig and
to see the carrier state in ifconfig's output. It gives also read/write
access (given the right privilegs) to the S/Uni registers to user space
programs.


116192 11-Jun-2003 obrien

Use __FBSDID().


115833 04-Jun-2003 harti

Make the internal statistics sysctl an array of integers rather than a string.
While a string is readable without a tool, an array is easier to process for
a monitoring application. This also prevents the extra hoops we need with
sbufs and locking.

Move the mtx_init() in en_attach() higher before the first failure point so
that we can unconditionally destroy it in en_destroy().


115496 31-May-2003 phk

Fix off-by-one error in range check of VC index.

Found by: FlexeLint


114739 05-May-2003 harti

Define a link layer MIB for ATM. Most fields of this MIB are needed by
ILMI daemons. Factor out common softc fields for all ATM interfaces that
need to be externally visible into an ifatm structure and make the midway
driver using this structure and fill the MIB.


114201 29-Apr-2003 harti

Add module data and version to the atm_subr and reference this info from the
(currently) only consumer (en).

Add a sysctl node hw.atm where the atm drivers will hook on their hardware
sysctl sub-trees.

Make atm_ifattach call if_attach and remove the corresponding call to if_attach
from en. Create atm_ifdetach and use that in en.

While the last change actually changes the interface this is not a problem in
practice because the only other consumer of this API is an older LANAI driver
on the net, that is not ready for current anyway.

Reviewed by: -atm


114018 25-Apr-2003 harti

Convert the midway driver to use busdma. Except for this conversion the
following changes have been done:

- stylify. The original code was too hard to read.
- get rid of a number of compilation options (Adaptec-only, Eni-only, no-DMA).
- more debugging features.
- locking. This is not correct yet in the absence of interface layer locking,
but is correct enough to not to cause lock order reversals.
- remove RAW mode. There are no users of this in the tree and I doubt that
there are any.
- remove NetBSD compatibility code. There was no way to keep NetBSD non-busdma
and FreeBSD busdma code together.
- if_en now buildable as a module.

This has been actively tested on sparc64 and i386 with ENI server and
client cards and an Adaptec card (thanks to kjc).

Reviewed by: mdodd, arr


113506 15-Apr-2003 mdodd

- Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
such abuse isn't really needed. (And if we do need type information
associated with a module then we should make it explicit and not
use hacks.)


112135 12-Mar-2003 kjc

clean up the en driver since it will survice for a while by
Harti Brandt's effort.
remove the DMA test to detect problems of the first generation PCI chipsets
back in 1998.
it is no longer needed and has been the source of the false alarm that
the driver uses too much stack space.


111888 04-Mar-2003 jlemon

Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control
at some future point. Packets may also be directly dispatched to a netisr
instead of queued, this may be of interest at some installations, but
currently defaults to off.

Reviewed by: hsu, silby, jayanth, sam
Sponsored by: DARPA, NAI Labs


111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


108466 30-Dec-2002 sam

Correct mbuf packet header propagation. Previously, packet headers
were sometimes propagated using M_COPY_PKTHDR which actually did
something between a "move" and a "copy" operation. This is replaced
by M_MOVE_PKTHDR (which copies the pkthdr contents and "removes" it
from the source mbuf) and m_dup_pkthdr which copies the packet
header contents including any m_tag chain. This corrects numerous
problems whereby mbuf tags could be lost during packet manipulations.

These changes also introduce arguments to m_tag_copy and m_tag_copy_chain
to specify if the tag copy work should potentially block. This
introduces an incompatibility with openbsd which we may want to revisit.

Note that move/dup of packet headers does not handle target mbufs
that have a cluster bound to them. We may want to support this;
for now we watch for it with an assert.

Finally, M_COPYFLAGS was updated to include M_FIRSTFRAG|M_LASTFRAG.

Supported by: Vernier Networks
Reviewed by: Robert Watson <rwatson@FreeBSD.org>


106937 14-Nov-2002 sam

network interface driver changes:

o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by: many
Approved by: re


104116 28-Sep-2002 phk

Rename "struct device" to "struct midway_device" to avoid clashing
with newbus.


103040 06-Sep-2002 brooks

Don't include "bpf.h" when compiling on FreeBSD. We always compile in
bpf support these days.


92739 20-Mar-2002 alfred

Remove __P.


69152 25-Nov-2000 jlemon

Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue. Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue. An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.


68616 11-Nov-2000 bmilekic

Change check for existence of mbuf->m_ext.ext_free to check of new ext_type
in order to determine whether the ext_buf is a cluster, or some other type
of storage.

Reviewed by: jlemon


68478 08-Nov-2000 kjc

restore the freebsd local type-cast fixes that I mistakenly removed
in the previous commit while attempting to sync with netbsd.

Pointed out by: bde
(never thought of compiling i386's LINT with -64-bit-longs...)


68433 07-Nov-2000 kjc

newbusify the en atm driver.


68432 07-Nov-2000 kjc

newbusify the en atm driver.

also
- sync with netbsd
- fix a bug that miscalculates tx cell counts when the pointer size isn't 4

tested both ENI and Adaptec cards on both i386 and alpha.


68317 04-Nov-2000 bde

Added used include of <machine/bus.h> -- don't depend on evil namespace
pollution in <sys/mutex.h>. This was half fixed in rev.1.3 of
midwayreg.h. The pollution exposed the bug that this driver was using
toy versions of the bus space macros under FreeBSD. Disabling the
toy versions made this driver compile but dependent on the pollution.
There was still a toy version of bus_space_read_1() in unreachable code.


68316 04-Nov-2000 bde

Enabled the used include of <machine/bus.h> -- don't depend on evil
namespace pollution in <sys/mutex.h>. This was half fixed in rev.1.3
of midwayreg.h. The pollution exposed the bug that this driver was
using toy versions of the bus space macros under FreeBSD. Disabling
the toy versions made this driver compile and maybe support PIO space,
but dependent on the pollution.


67882 29-Oct-2000 phk

Remove unneeded #include <sys/proc.h> lines.


67440 22-Oct-2000 phk

Make LINT compile again.


67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


64837 19-Aug-2000 dwmalone

Replace the mbuf external reference counting code with something
that should be better.

The old code counted references to mbuf clusters by using the offset
of the cluster from the start of memory allocated for mbufs and
clusters as an index into an array of chars, which did the reference
counting. If the external storage was not a cluster then reference
counting had to be done by the code using that external storage.

NetBSD's system of linked lists of mbufs was cosidered, but Alfred
felt it would have locking issues when the kernel was made more
SMP friendly.

The system implimented uses a pool of unions to track external
storage. The union contains an int for counting the references and
a pointer for forming a free list. The reference counts are
incremented and decremented atomically and so should be SMP friendly.
This system can track reference counts for any sort of external
storage.

Access to the reference counting stuff is now through macros defined
in mbuf.h, so it should be easier to make changes to the system in
the future.

The possibility of storing the reference count in one of the
referencing mbufs was considered, but was rejected 'cos it would
often leave extra mbufs allocated. Storing the reference count in
the cluster was also considered, but because the external storage
may not be a cluster this isn't an option.

The size of the pool of reference counters is available in the
stats provided by "netstat -m".

PR: 19866
Submitted by: Bosko Milekic <bmilekic@dsuper.net>
Reviewed by: alfred (glanced at by others on -net)


58701 27-Mar-2000 imp

Ahhrggg. Put the test for the compat shims AFTER the file that includes
them.

Pointed out by: bde


58695 27-Mar-2000 imp

Per conversations in -current, add #error to these drivers when you don't
have the right compatibility shims enabled. ISA drivers to follow later.


56828 29-Jan-2000 peter

Remove #if NEN > 0 in the name of FreeBSD - it's not required as config
only compiles this file if it's true. NEN is still used though. :-(


52135 11-Oct-1999 phk

remove unused #include, add $FreeBSD$


50135 21-Aug-1999 msmith

Clean up after removing sys/eventhandler.h from sys/systm.h at the last
minute. This should cover all of the missed cases (and should let LINT
build again).


50107 21-Aug-1999 msmith

Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by: green


48645 06-Jul-1999 des

Rename bpfilter to bpf.


48528 03-Jul-1999 peter

Eliminate a bunch of #include "pci.h" and #if NPCI > 0 around entire
files. config will leave the whole file out if configured to do so.


46814 09-May-1999 peter

Missing revision markers.


46813 09-May-1999 peter

Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it. Driver writers can do
this if it's not defined. (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)


46695 08-May-1999 kjc

clean up en atm driver
o fix DDB support
- include "opt_ddb.h"
- fix Debugger() arg
pointed out by bde

o back out pvc shadow interface support
- it is currently not used
- to make it easier to merge another implementation

o misc minor cleanup


46603 06-May-1999 peter

Undo excess staticization - these two are meant to be callable from
DDB.


46112 27-Apr-1999 phk

Suser() simplification:

1:
s/suser/suser_xxx/

2:
Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.


46024 24-Apr-1999 peter

Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.


45575 11-Apr-1999 eivind

Staticize.


43295 27-Jan-1999 dillon

Fix warnings preparing for -Wall -Wcast-qual

Also disable one usb module in LINT due to fatal compilation errors,
temporary.


42426 09-Jan-1999 kjc

cleanup: remove part of the code for 2.1.

add two functions to get the MAC address of the card.

Obtained from: ALTQ


41771 14-Dec-1998 dillon

probe function changed from returning char * to const char *.


41514 04-Dec-1998 archie

Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by: Mike Spengler <mks@networkcs.com>


40118 09-Oct-1998 kjc

fix a bug which could lock up a transmitter.
don't use the entire buffer space. if WRTX becomes equal
to RDTX, the transmitter stops assuming the buffer is empty.


38371 17-Aug-1998 bde

FIxed printf format errors. Most of them were exposed by our ntohl()
returning long. There would be many more if int_32_t were not int.


38354 16-Aug-1998 bde

Use [u]intptr_t instead of [u_]long for casts between pointers and
integers. Don't forget to cast to (void *) as well.


37939 29-Jul-1998 kjc

update ATM driver. (base version: midway.c 1.67 --> 1.68)

several new features are added:
- support vc/vp shaping
- support pvc shadow interface

code cleanup:
- remove WMAYBE related code. ENI WMAYBE DMA doen't work.
- remove updating if_lastchange for every packet.
- BPF related code is moved to midway.c as it should be.
(bpfwrite should work if atm_pseudohdr and LLC/SNAP are
prepended.)
- BPF link type is changed to DLT_ATM_RFC1483.
BPF now understands only LLC/SNAP!! (because bpf can't
handle variable link header length.)
It is recommended to use LLC/SNAP instead of NULL
encapsulation for various reasons. (BPF, IPv6,
interoperability, etc.)

the code has been used for months in ALTQ and KAME IPv6.

OKed by phk long time ago.


36735 07-Jun-1998 dfr

This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.


35210 15-Apr-1998 bde

Support compiling with `gcc -ansi'.


33181 09-Feb-1998 eivind

Staticize.


32925 31-Jan-1998 eivind

Make POWERFAIL_NMI, PPS_SYNC and NATM new style options.

This also fixes a couple of defunct options; submitted by bde.


32350 08-Jan-1998 eivind

Make INET a proper option.

This will not make any of object files that LINT create change; there
might be differences with INET disabled, but hardly anything compiled
before without INET anyway. Now the 'obvious' things will give a
proper error if compiled without inet - ipx_ip, ipfw, tcp_debug. The
only thing that _should_ work (but can't be made to compile reasonably
easily) is sppp :-(

This commit move struct arpcom from <netinet/if_ether.h> to
<net/if_arp.h>.


30813 28-Oct-1997 bde

Removed unused #includes.


29024 02-Sep-1997 bde

Added used #include - don't depend on <sys/mbuf.h> including
<sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).


26640 14-Jun-1997 bde

Removed unused #includes.


25604 09-May-1997 kjc

This commit was generated by cvs2svn to compensate for changes in r25603,
which included commits to RCS files with non-trunk default branches.


25603 09-May-1997 kjc

import Chuck Cranor's ATM driver