Commit Graph

67 Commits

Author SHA1 Message Date
ru
985e35fdba Add missing mtx_destroy() when if_alloc() fails.
Add missing if_free() when mii_phy_probe() fails.
Put if_free() into the correct #ifdef in detach().
2005-09-16 09:20:58 +00:00
rwatson
5d770a09e8 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
2005-08-09 10:20:02 +00:00
rwatson
9918d13b80 Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by:	Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after:		1 week
2005-08-03 00:18:35 +00:00
brooks
567ba9b00a 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
2005-06-10 16:49:24 +00:00
sobomax
33d18fcacb Add missed KUE_UNLOCK(). This is NOOP yet, but may be handy later on. 2005-03-25 12:53:26 +00:00
sobomax
c30f56d563 Fix breakage in the previous commit caused by the last-minute change. 2005-03-25 12:50:57 +00:00
sobomax
9289f3e0c2 Move Rx/Tx lists management routines into central location. 2005-03-25 12:42:30 +00:00
sobomax
20ed90b901 Move xxx_newbuf() function, which was the same in all drivers into central
location.
2005-03-25 00:44:21 +00:00
imp
4b319958e7 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
rwatson
ff6c4b1448 Mark USB ethernet devices as IFF_NEEDSGIANT, since the USB framework
if_start routines cannot currently be entered without Giant.  When
the kernel is running with debug.mpsafenet != 0, this will defer
if_start execution to a task queue thread holding Giant, which may
introduce additional latency, but avoid incorrect execution.

Suggested by:	dfr
2004-08-11 03:38:55 +00:00
imp
f9dd4765eb MFp4: First batch of dev/usb/usbdevs.h -> usbdevs.h changes. 2004-06-27 12:41:44 +00:00
phk
9d102d7d5a Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
mux
03028ee82d We don't need to initialize if_output, ether_ifattach() does it
for us.
2004-05-23 16:11:53 +00:00
iedowse
74bd7acb1b Replace the static "qdat" structure with a per-instance softc field
in all USB ethernet drivers. The qdat structure contains a pointer
to the interface's struct ifnet and is used to process incoming
packets, so simultaneous use of two similar devices caused crashes
and confusion.

The if_udav driver appeared in the tree since Daan's PR, so I made
similar changes to that driver too.

PR:		kern/59290
Submitted by:	Daan Vreeken <Danovitsch@Vitsch.net>
2004-05-23 12:35:25 +00:00
mdodd
5c1fa8d5da Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +00:00
johan
54cb274195 Remove duplicate
#include <sys/cdefs.h>
__FBSDID(...);

Leave the one matching the other files in this directory.
2003-11-14 11:09:45 +00:00
brooks
f1e94c6f29 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
joe
7241c9b300 Make it easier to run this code on RELENG_4.
Submitted by:	luoqi
2003-10-04 21:41:01 +00:00
obrien
c63dab466c Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
jmg
97bff6f489 add missing machine/bus.h headers that are now necessary because of the
bus_dma addition.
2003-07-16 02:20:14 +00:00
mdodd
261178d14f - 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
murray
9cbd3070ae Add ID for Kawasaki LSI Inc. USB-Ethernet, rev 1.00/2.02 adapter.
PR:		kern/50064
Submitted by:	Scott Renfro <scott@renfro.org>
MFC after:	3 days
2003-04-07 10:26:59 +00:00
obrien
96d4258af9 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
alfred
bf8e8a6e8f 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
14c32b5f40 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
iedowse
43638d29a8 Re-fetch the interface handle after setting the config number,
because the previous interface handle gets freed when the config
number is set. This fixes a problem where memory could be accessed
after it was freed when the interface was ifconfig'd up.

Reviewed by:	n_hibma
2002-07-15 14:37:36 +00:00
joe
1593b63801 We not long need to use USBD_NO_TSLEEP. 2002-04-07 12:19:50 +00:00
joe
87c2c53d47 MFNetBSD: if_aue.c (1.26), if_auereg.h (1.6), if_cue.c (1.10),
if_cuereg.h (1.5), if_kue.c (1.11), if_kuereg.h (1.5)

    date: 2000/03/02 12:37:51;  author: augustss;
    Use ratecheck() to limit error messages on disconnect.
    Break out some common functionality.
2002-04-07 12:04:02 +00:00
joe
a4f31aacb3 Use the UE_GET_XFERTYPE macro. 2002-04-06 21:28:57 +00:00
joe
998e04f9dc Rename foo_gone to foo_dying, in keeping with the rest of the usb code. 2002-04-06 20:17:13 +00:00
joe
9a33fe7e34 Replace device_t with device_ptr_t. 2002-04-06 19:55:52 +00:00
jhb
db9aa81e23 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
joe
0177db4b0b Use ANSI prototypes and declarations. 2002-04-02 11:54:28 +00:00
alfred
3264aec746 Remove __P. 2002-03-20 02:08:01 +00:00
peter
564eab1574 Make these depend on the usb module so they can use its symbols if they
are loaded as seperate .ko files
2001-08-22 05:33:57 +00:00
n_hibma
9bf2f7cd42 Add the Abocom URE 450 ethernet adapter.
Submitted by:   dima@bog.msu.su
2001-04-09 18:44:11 +00:00
n_hibma
3d472160f6 Add id for the IO Data ET/T
PR:		23877
Submitted by:	Makoto MATSUSHITA <matusita@jp.freebsd.org>
2001-04-07 20:47:29 +00:00
phk
d214ae2171 Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by:    mikeh
2001-02-06 10:12:15 +00:00
phk
408a00d7df Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead of
<sys/queue.h> implementation details.

Created with:   /usr/sbin/sed
Reviewed with:  /sbin/md5
2001-02-03 16:29:10 +00:00
bmilekic
37decc93f5 Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include
the MTX_RECURSE bit in the flag argument variable. This change is in
preparation for an upcoming (further) mutex API cleanup.
The witness code will call panic() if a lock is found to recurse but
the MTX_RECURSE bit was not set during the lock's initialization.

The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to
MTX_RECURSED, which is more appropriate given its meaning.

The following locks have been made "recursive," thus far:
eventhandler, Giant, callout, sched_lock, possibly some others declared
in the architecture-specific code, all of the network card driver locks
in pci/, as well as some other locks in dev/ stuff that I've found to
be recursive.

Reviewed by: jhb
2001-01-19 01:59:14 +00:00
wpaul
3aeab935cd Add a forgotten mutex_exit()/KUE_UNLOCK() to kue_init(). 2000-11-23 05:58:48 +00:00
wpaul
deefde18d9 Convert the USB ethernet drivers to use mutexes. Also convert
usb_ethersubr.c. This module maintains two queues for packets which
are each protected with one mutex. These are all the changes I can
do for now. Removing the USBD_NO_TSLEEP flag doesn't work yet: when
I tried it, the system would usually freeze up after a NIC had been
operating for a while. The usb_ethersubr module itself ought to
go away; this is the next thing I need to test.
2000-10-24 22:38:54 +00:00
phk
beadbd4365 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
archie
7357df6b48 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
wpaul
5e4b4dc43d Handle watchdog timeouts better. We can't really call the foo_init()
routines from foo_watchdog() because foo_watchdog() is called at
interrupt context, and that's a no-no due to the way the USB stack
is currently set up.

What we do now is call the TX end of frame handler manually to clear
the completed transmission, then check the send queue and send off
any frames that are pending.

Also turned off the interrupt pipe stuff in if_aue, since it appears
to tickle a bug in the USB stack that I haven't found yet.
2000-06-01 23:16:42 +00:00
n_hibma
d1a0c5a2fa OpenBSD has a broken debugger that does not grok static. Use a
#define Static  static

that the OpenBSD folks can define it to be empty if they like.
2000-04-03 20:58:30 +00:00
wpaul
dfc69b97fc Add vendor/product ID for two more KLSI-based devices, including a
USB ethernet adapter being handed out by @Home.
2000-03-29 19:44:48 +00:00
wpaul
7734cbcfd6 Regenerate usbdevs files.
Also add device entry in if_kue.c for the LINKSYS USB10T adapter.

Also add calls to bpfdetach() in detach routines.
2000-03-21 15:20:41 +00:00
wpaul
29a5e54ca9 Add another device/vendor code combination to support yet another
KLSI-based device (Skymaster DHU-0404).
2000-03-18 01:36:37 +00:00