History log of /freebsd-10-stable/sys/dev/sn/if_sn.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

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

# 250460 10-May-2013 eadler

Fxi a bunch of typos.

PR: misc/174625
Submitted by: Jeremy Chadwick <jdc@koitsu.org>


# 243857 04-Dec-2012 glebius

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


# 229767 07-Jan-2012 kevlo

ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again

Reviewed by: yongari


# 207554 03-May-2010 sobomax

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


# 199559 19-Nov-2009 jhb

- Add a private timer to drive the transmit watchdog instead of using
if_watchdog and if_timer.
- Fix some issues in detach for sn(4), ste(4), and ti(4). Primarily this
means calling ether_ifdetach() before anything else.


# 199414 17-Nov-2009 jhb

Use the bus_*() routines rather than bus_space_*() for register operations.


# 195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


# 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@


# 155283 04-Feb-2006 imp

Fix mismerge after last cvs update for the IFQ_DRV_DEQUEUE changes.


# 155280 04-Feb-2006 imp

Remove ifdef notyet for SIOCGHWADDR
Treat SIOCADDMULTI and SIOCDELMULTI the same, since they had the same code
Remove redundant assignment to error
Convert to using the altq interface completely.


# 154100 07-Jan-2006 imp

While reviewing if_sn in an attempt to understand network drivers
better, I discovered sn doing too many pointer dereferences. This
driver would do silly things like:
sn_foo(struct ifnet *ifp)
{
struct sn_softc *sc = ifp->if_softc;

sc->ifp->mumble
/* Other stuff */
}

while /* other stuff */ usually needed sc, the extra deref isn't
needed. Eliminate a few dozen of them.


# 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.


# 150183 15-Sep-2005 ru

Spell "destroy" correctly.


# 149095 15-Aug-2005 imp

Diff reduction to my tree: commit the trivial part of efforts to add
support for the really old Megahertz ethernet/modem combo cards.


# 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


# 148654 02-Aug-2005 rwatson

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


# 148144 18-Jul-2005 imp

Better name for type 4 chips


# 147872 10-Jul-2005 imp

Add a boatload of new device ids, gleaned from the pcmcia-cs-3.2.8
distribution. Add the appropriate devices to the man pages.

Obtained from: pcmcia-cs
Approved by: re (scottl)


# 147797 06-Jul-2005 imp

Add support for Farallon EtherMAC PC Card.
Move ethernet MAC address setting into pccard attachment
Fix panic from IFP2ENADDR() use prior to if_alloc
Remove OLDCARD compat support. This should work still on oldcard, however.
sn_attach now requires that the resources be activated now, so adjust.

Approved by: re (scottl)


# 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


# 139749 05-Jan-2005 imp

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


# 130270 09-Jun-2004 naddy

Replace handrolled CRC calculation with ether_crc32_[lb]e().


# 129616 23-May-2004 mux

We don't need to initialize if_output, ether_ifattach() does it
for us.


# 128307 16-Apr-2004 luigi

Remove two variables that became unused because of last commit.

Reported by: tinderbox


# 128293 15-Apr-2004 luigi

Remove improper use of if_addrhead in device drivers to check
if the link-level address has been initialized already.

The majority of modern drivers never does this and works fine, which
makes me think that the check is totally unnecessary and a residue
of cut&paste from other drivers.

This change is done to simplify locking because now almost none of the
drivers uses this field. The exceptions are "ct" "ctau" and "cx"
where i am not sure if i can remove that part.


# 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


# 126966 14-Mar-2004 mdodd

Announce ethernet MAC addresss in ether_ifattach().


# 123289 08-Dec-2003 obrien

Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.

Requested by: bde,imp


# 122678 14-Nov-2003 obrien

Remove duplicate FBSDID's, move others to their right place.


# 122642 14-Nov-2003 imp

Reconst-poison crc routine that was renamed to mchash.
re-remove the _ in u_intXX_t


# 122625 13-Nov-2003 obrien

Try to create some sort of consistency in how the routings to find the
multicast hash are written. There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).


# 122427 10-Nov-2003 imp

Don't establish the ISR in the sn_activate routine. I've had two
crashes that had sn0 as the irq that's being serviced, when there was
no sn0 in the system. This seems to prevent them. Also, we want to
wait until after we've registered with the network layer before we
turn on the interrupt spigot to avoid races.


# 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)


# 121589 26-Oct-2003 imp

Make sn MPSAFE. This has survived a couple of make buildworlds with
my Megahertz XJ10BT.


# 121553 26-Oct-2003 imp

Style changes:
o kill register
o minor function name tweaks.


# 121514 25-Oct-2003 imp

Convert to bus_space.
Make the pccard attachment work with NEWCARD
Start locking of the driver, but only the macros are defined right now

Tested on: Megahertz CC10BT/2
# (These cards are very popular on ebay these days, and run < $10 including
# shipping from some sellers).


# 119419 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 111926 05-Mar-2003 peter

Finish driving a stake through the heart of netns and the associated
ifdefs scattered around the place - its dead Jim!

The SMB stuff had stolen AF_NS, make it official.


# 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.


# 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


# 104257 30-Sep-2002 brooks

Use if_printf(ifp, "blah") instead of printf("sn%d: blah", ifp->if_unit).


# 100426 21-Jul-2002 imp

Minor whitespace nits. remove #if 1 and #endif pair, but not code between.


# 81122 04-Aug-2001 imp

Kill debug output for sn device. It is confusing the natives


# 72084 06-Feb-2001 phk

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


# 72012 04-Feb-2001 phk

Another round of the <sys/queue.h> FOREACH transmogriffer.

Created with: sed(1)
Reviewed by: md5(1)


# 71999 04-Feb-2001 phk

Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)


# 71060 15-Jan-2001 toshi

Add support for SMC91C100FD chip of MELCO LPC-TX.

sn1 at port 0x240-0x24f irq 10 slot 0 on pccard0
sn1: SMC91C100FD UTP MAC address 00:a0:dc:22:26:8c

Submitted by: "KOMURO" <komujun@nifty.com>


# 69955 12-Dec-2000 imp

Add isa support:
o write isa driver routines.
o factor detach routine in sn_detach.


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 66058 19-Sep-2000 imp

Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.

Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.

compat devices should use the following:

/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */

This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.

Drivers wishing to not retain OLDCARD compatibility needn't do this.

ep driver minorly updated.

sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.


# 63090 13-Jul-2000 archie

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


# 60536 14-May-2000 archie

Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by: freebsd-net


# 59760 29-Apr-2000 phk

Remove unneeded #include <sys/kernel.h>


# 59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# 56397 22-Jan-2000 hosokawa

Don't execute MAC address initialization for non-pccard sn devices.


# 56366 21-Jan-2000 hosokawa

Added support for hex-encoded MAC address of Megahertz X-Jack Ethernet Card

Reviewed by: Warner Losh <imp@village.org>


# 55161 27-Dec-1999 imp

Two nits and disable isa probe due to its overly agressive claiming of
devices.
o Return ENXIO from sn_isa_probe
o Fix SN_DEBUG printf
o Use IFQ_MAXLEN rather than 8

I'll fix the isa probe when I get access to a real isa attachment
device to test against here in a few days.

Overly agressive snagging behavior noticed by: phk


# 54994 22-Dec-1999 imp

Newbusify the driver.

Add support, kinda, for megaheartz xjack nic cards. This support
works well for one machine per ethernet segment because it hard codes
the MAC address. The pccardd in -current doesn't have support to
parse the ethernet address from the CIS in the funky way that the
megaheartz card does things (it includes it in the info tuple, as
ascii, which is non-standard). I'd rather kludge this for the moment
and work to read the CIS from the kernel rather than mess with
pccardd.

The isa attachment is untested. The pccard attachment is known to
work since I'm committing over it.

Card Obtained from: Chris D. Faulhaber <jedger@fxp.org>


# 54881 20-Dec-1999 nyan

Removed unnecessary include files.


# 54786 18-Dec-1999 peter

Make this compile again.

GENERIC-broken-by: imp


# 54773 18-Dec-1999 imp

Driver for the smc91xx series of ethernet chips. Ported from PAO to
3.3R and then to -current. The pccard support has been left in the
driver, but is presently non-functional because we are using the
isa_compat layer for the moment.

Obtained From: PAO
Sponsored by: Timing Solutions