Commit Graph

85 Commits

Author SHA1 Message Date
Marcel Moolenaar
c6ca21fb13 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.
2004-07-10 21:03:52 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Scott Long
474e30f0b1 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
2004-02-29 09:26:01 +00:00
Hartmut Brandt
70deac4477 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).
2003-12-17 10:01:46 +00:00
Brooks Davis
9bf40ede4a 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)
2003-10-31 18:32:15 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 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.
2003-08-22 05:54:52 +00:00
John Baldwin
8b149b5131 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)
2003-08-07 15:04:27 +00:00
Hartmut Brandt
68ece75839 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.
2003-08-06 14:53:27 +00:00
Hartmut Brandt
580f2456b7 Honor the new ATMIO_FLAG_ASYNC that requests asynchronuous open/close
operations on VCs.
2003-08-06 11:53:53 +00:00
Hartmut Brandt
2ac9f22556 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.
2003-08-06 11:35:41 +00:00
Hartmut Brandt
efa3048b1e Print an array index that is computed as ptrdiff_t with %tu. 2003-08-06 11:30:53 +00:00
David E. O'Brien
7df14ae5de Change the format type to unbreak LINT on 64-bit platforms. 2003-08-06 07:18:42 +00:00
Hartmut Brandt
01647af570 Implement per-VC statistics. 2003-08-05 13:45:54 +00:00
Hartmut Brandt
865613a3d4 Implement the ATMIOCOPENVCC and ATMIOCCLOSEVCC ioctls(). This was the
last driver that did not know about those.
2003-08-05 13:39:36 +00:00
Hartmut Brandt
449f11fac6 Use the generic getvccs function from net/if_atmsubr.c and remove
the home-grown version.
2003-08-05 12:26:26 +00:00
Hartmut Brandt
426b1fd112 Arrghhh. Remove debugging printf's that slipped in in the pre-previous
commit.
2003-08-05 12:20:19 +00:00
Hartmut Brandt
5d10eb7c79 Use __FBSDID() as per style(9). 2003-08-05 12:19:05 +00:00
Hartmut Brandt
3786d0183e 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.
2003-08-05 12:02:25 +00:00
Hartmut Brandt
c918a63dde 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.
2003-08-05 10:51:33 +00:00
Hartmut Brandt
71c47209f5 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.
2003-07-15 15:45:41 +00:00
Hartmut Brandt
98ab6e3295 Delete a superfluous semi-colon.
Pointed out by: nick@garage.freebsd.pl
2003-07-04 13:41:03 +00:00
Scott Long
f6b1c44d1f 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
2003-07-01 15:52:06 +00:00
Hartmut Brandt
8789c0e019 Implement the ioctl that returns a list of currently open VCCs. 2003-06-13 13:50:38 +00:00
Hartmut Brandt
1ba46a03b7 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.
2003-06-13 12:08:09 +00:00
David E. O'Brien
f4636c5959 Use __FBSDID(). 2003-06-11 06:34:30 +00:00
Hartmut Brandt
41a753193a 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().
2003-06-04 15:38:32 +00:00
Poul-Henning Kamp
01bfa91fa2 Fix off-by-one error in range check of VC index.
Found by:       FlexeLint
2003-05-31 19:01:08 +00:00
Hartmut Brandt
2102bdf21a 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.
2003-05-05 16:35:52 +00:00
Hartmut Brandt
d2c96fc51f 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
2003-04-29 08:07:44 +00:00
Hartmut Brandt
33cfde03bc 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
2003-04-25 16:14:03 +00:00
Matthew N. Dodd
f246e4a17f - 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.)
2003-04-15 06:37:30 +00:00
Kenjiro Cho
fec4b7015e 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.
2003-03-12 10:28:26 +00:00
Jonathan Lemon
1cafed3941 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
2003-03-04 23:19:55 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Sam Leffler
9967cafc49 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>
2002-12-30 20:22:40 +00:00
Sam Leffler
673d91916d 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
2002-11-14 23:54:55 +00:00
Poul-Henning Kamp
61ddb5c9d7 Rename "struct device" to "struct midway_device" to avoid clashing
with newbus.
2002-09-28 21:59:59 +00:00
Brooks Davis
6f9fe1334f Don't include "bpf.h" when compiling on FreeBSD. We always compile in
bpf support these days.
2002-09-06 20:07:50 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Jonathan Lemon
df5e198723 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.
2000-11-25 07:35:38 +00:00
Bosko Milekic
8bcbe4b7a6 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
2000-11-11 23:01:44 +00:00
Kenjiro Cho
41b4d8d540 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...)
2000-11-08 05:45:46 +00:00
Kenjiro Cho
44b5247d95 newbusify the en atm driver. 2000-11-07 09:31:28 +00:00
Kenjiro Cho
da33d58137 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.
2000-11-07 09:30:14 +00:00
Bruce Evans
f18c4450ac 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.
2000-11-04 15:03:34 +00:00
Bruce Evans
442ed3a3c4 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.
2000-11-04 14:31:47 +00:00
Poul-Henning Kamp
53ce36d17a Remove unneeded #include <sys/proc.h> lines. 2000-10-29 13:57:19 +00:00