summaryrefslogtreecommitdiffstats
path: root/sys/dev/sk
Commit message (Collapse)AuthorAgeFilesLines
* Remove printf's on mbuf/cluster allocation failures. There are nowluigi2001-12-141-4/+1
| | | | | | | equivalent and less dangerous (rate limited) messages in the mbuf allocation code. MFC after: 3 days
* Do not call mii_pollstat() from within device tick routines; the statusjlemon2001-09-291-2/+0
| | | | | | information is updated by mii_tick(). Pointed out by: wpaul (a while back)
* Apply patch supplied by Jonathan Chen: use the correct arguments towpaul2001-07-091-2/+2
| | | | | pci_enable_io(). We need to use SYS_RES_IOPORT/SYS_RES_MEMORY instead of PCIM_CMD_PORTEN/PCIM_CMD_MEMEN.
* Change m_devget()'s outdated and unused `offset' argument to actually meanbmilekic2001-06-201-3/+2
| | | | | | | | | | | | | | | | | | | | something: offset into the first mbuf of the target chain before copying the source data over. Make drivers using m_devget() with a first argument "data - ETHER_ALIGN" to use the offset argument to pass ETHER_ALIGN in. The way it was previously done is potentially dangerous if the source data was at the top of a page and the offset caused the previous page to be copied (if the previous page has not yet been appropriately mapped). The old `offset' argument in m_devget() is not used anywhere (it's always 0) and dates back to ~1995 (and earlier?) when support for ethernet trailers existed. With that support gone, it was merely collecting dust. Tested on alpha by: jlemon Partially submitted by: jlemon Reviewed by: jlemon MFC after: 3 weeks
* The sk driver developed a bug when the multicast code was changed towpaul2001-05-091-6/+7
| | | | | | | | | | | | | | use TAILQ macros. The sk_attach_xmac() routine calls sk_init_xmac() before doing the transceiver probe, but *before* ether_ifattach() is called. This causes sk_init_xmac() to call sk_setmulti(), which tries to do a TAILQ_FOREACH(), which it can't do because ether_ifattach() hasn't done a TAILQ_INIT() yet. This causes a NULL pointer dereference and panic in sk_setmulti() at driver load/initialization time. Fixed by calling ether_ifattach() before the MII probe. The code in RELENG_4 still uses the old way of enumerating the multicast list and doesn't have this problem. Yet.
* Big round of minor updates:wpaul2001-02-211-26/+21
| | | | | | | | | | | | | | - Use pci_get_powerstate()/pci_set_powerstate() in all the other drivers that need them so we don't have to fiddle with the PCI power management registers directly. - Use pci_enable_busmaster()/pci_enable_io() to turn on busmastering and PIO/memory mapped accesses. - Add support to the RealTek driver for the D-Link DFE-530TX+ which has a RealTek 8139 with its own PCI ID. (Submitted by Jason Wright) - Have the SiS 900/National DP83815 driver be sure to disable PME mode in sis_reset(). This apparently fixes a problem on some motherboards where the DP83815 chip fails to receive packets. (Submitted by Chuck McCrobie <mccrobie@cablespeed.com>)
* Change and clean the mutex lock interface.bmilekic2001-02-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Convert if_multiaddrs from LIST to TAILQ so that it can be traversedphk2001-02-061-8/+1
| | | | | | backwards in the three drivers which want to do that. Reviewed by: mikeh
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-1/+1
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead ofphk2001-02-031-2/+1
| | | | | | | <sys/queue.h> implementation details. Created with: /usr/sbin/sed Reviewed with: /sbin/md5
* Implement MTX_RECURSE flag for mtx_init().bmilekic2001-01-191-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Initialize/grab the mutex earlier in the attach phase, so thatwpaul2000-12-041-2/+3
| | | | | bailing out to the fail: label where we release/destroy the mutex will work without exploding.
* Change MEXTADD usage to pass the two new arguments.bmilekic2000-11-111-1/+1
| | | | Reviewed by: jlemon
* Fix a couple of cases where I tried to release the I/O space resource twicewpaul2000-11-021-1/+1
| | | | | (once as as an I/O space resource and once as an IRQ resource). There was a problem with this in if_rl too, which is how I found it.
* Add a missing SK_UNLOCK() to sk_attach_xmac().wpaul2000-10-251-0/+1
|
* Add actual URL for XMAC II datasheet in comments.archie2000-10-201-2/+4
|
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Use device_get_nameunit(dev) as the mutex string when callingwpaul2000-10-131-1/+1
| | | | | mtx_init() instead of hard-coded string constant. Also remember to do the mutex changes to the ste driver, which I forgot in the first commit.
* First round of converting network drivers from spls to mutexes. Thiswpaul2000-10-132-22/+58
| | | | | | | | takes care of all the 10/100 and gigE PCI drivers that I've done. Next will be the wireless drivers, then the USB ones. I may pick up some stragglers along the way. I'm sort of playing this by ear: if anyone spots any places where I've screwed up horribly, please let me know.
* Make if_sk stop using the "hide the softc structure in the jumbo buffer"bmilekic2000-10-122-27/+13
| | | | | | | now that the mbuf system can handle passing it to the driver itself. Reviewed by: wpaul Tested by: wpaul (Bill Paul) with "jumbograms" enabled
* Replace the mbuf external reference counting code with somethingdwmalone2000-08-192-71/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Add call to bus_generic_attach() at the end of sk_attach(). It turns out thatwpaul2000-08-021-0/+2
| | | | | | | | if you kldload this driver, all the subordinate devices are probed/attached as expected. But this is not the case when the driver is statically compiled into the kernel. Since I do most of my testing with modules, I failed to notice this. I'm not sure if it's intended behavior or not. I think it may be, but it seems a little counter-intuitive.
* Make all Ethernet drivers attach using ether_ifattach() and detach usingarchie2000-07-131-5/+3
| | | | | | | | | 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
* - Call mii_pollstat() after we bring up the link on a 1000baseTX cardwpaul2000-06-061-1/+4
| | | | | | | after autoneg so we make sure to set the link state and duplex mode correctly. - Make sure to set the 'ignore pause frames' bit on the XMAC. - Small linewrap fix.
* Use the correct register name. s/PCI_COMMAND_STATUS_REG/PCIR_COMMAND/peter2000-05-281-3/+3
|
* Back out the previous change to the queue(3) interface.jake2000-05-261-3/+3
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-3/+3
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Move code to handle BPF and bridging for incoming Ethernet packets outarchie2000-05-141-10/+0
| | | | | | | | | | | | | | | 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
* Add a missing MODULE_DEPEND() on miibus.. I was working frompeter2000-04-291-0/+2
| | | | KMODDEPS which this driver didn't have.
* Reoganize/update the SysKonnect driver:wpaul2000-04-223-161/+513
| | | | | | | | | | | | | | | | | | - Break out the support for the XMAC II's PHY into an miibus driver. - Reorganize the probe/attach stuff using newbus. Each XMAC is now attached to the parent GEnesis controller using newbus. This is necessary since each XMAC must also have an attached miibus, and the miibus read/write register routines need to be able to get at the softc struct for each XMAC, not the one for the parent controller. This allows me to get rid of the grotty code I added for selecting the unit numbers for the ifnet interfaces: the unit numbers are now derived from the newbus-assigned unit numbers, which should track with the ifnet interface numbers. I think. At the very least, there should never be any collisions. - Add support for the SK-9821 and SK-9822 1000baseTX adapters. Special thanks to SysKonnect for loaning me two adapters for testing.
* Call sk_start() at the end of sk_intr() if there's packets in thewpaul1999-09-251-0/+5
| | | | interface send queue that need to be processed.
* As suggested by phk, unconditionalize BPF support in these drivers. Sincewpaul1999-09-231-10/+1
| | | | | | | there are stubs compiled into the kernel if BPF support is not enabled, there aren't any problems with unresolved symbols. The modules in /modules are compiled with BPF support enabled anyway, so the most this will do is bloat GENERIC a little.
* Tweak these for what I hope is the last time: change the DRIVER_MODULE()wpaul1999-09-221-1/+1
| | | | | | | | | | declaration for the interface driver from "foo" to "if_foo" but leave the declaration for the miibus attached to the interface driver alone. This lets the internal module name be "if_foo" while still allowing the miibus instances to attach to "foo." This should allow ifconfig to autoload driver modules again without breaking the miibus attach.
* Un-do the changes to the DRIVER_MODULE() declarations in these drivers.wpaul1999-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This whole idea isn't going to work until somebody makes the bus/kld code smarter. The idea here is to change the module's internal name from "foo" to "if_foo" so that ifconfig can tell a network driver from a non-network one. However doing this doesn't work correctly no matter how you slice it. For everything to work, you have to change the name in both the driver_t struct and the DRIVER_MODULE() declaration. The problems are: - If you change the name in both places, then the kernel thinks that the device's name is now "if_foo", so you get things like: if_foo0: <FOO ethernet> irq foo at device foo on pcifoo if_foo0: Ethernet address: foo:foo:foo:foo:foo:foo This is bogus. Now the device name doesn't agree with the logical interface name. There's no reason for this, and it violates the principle of least astonishment. - If you leave the name in the driver_t struct as "foo" and only change the names in the DRIVER_MODULE() declaration to "if_foo" then attaching drivers to child devices doesn't work because the names don't agree. This breaks miibus: drivers that need to have miibuses and PHY drivers attached never get them. In other words: damned if you do, damned if you don't. This needs to be thought through some more. Since the drivers that use miibus are broken, I have to change these all back in order to make them work again. Yes this will stop ifconfig from being able to demand load driver modules. On the whole, I'd rather have that than having the drivers not work at all.
* Grrr. Okay, changing the devnames was a bad idea. Put them back the waywpaul1999-09-201-1/+1
| | | | they were.
* Fix the strings in the driver_t structs so that they match the new nameswpaul1999-09-201-1/+1
| | | | in the DRIVER_MODULES() declarations. *sigh*
* Change the name we register with DRIVER_MODULE() to include the leadingobrien1999-09-201-1/+1
| | | | | | "if_". Reviewed by: msmith, wpaul
* Fix the mechanism used to choose the unit numbers for the IP interfaceswpaul1999-09-182-7/+21
| | | | | attached by the SysKonnect driver. Use ifunit() to scan for existing skN interfaces and pick the first unused one.
* Don't restrict our requests for contiguous memory to addresses >= 1MB.bde1999-08-291-2/+2
| | | | | | | | This fixes, at least, panics in ncr_attach() on i386's with about 5MB of memory. The restriction was a hack to leave some low memory for ISA DMA, but on i386's we now allocate pages from the top down, so all the restriction did was cause our allocations to fail when there is no free memory above 1MB.
* $Id$ -> $FreeBSD$peter1999-08-283-4/+4
|
* Remember to clear the IFF_RUNNING and IFF_OACTIVE flags in sf_stop() andwpaul1999-07-251-2/+6
| | | | sk_stop().
* One last tweak before I turn in for the evening: the driver name inwpaul1999-07-231-3/+3
| | | | | | the driver_t declaration should be "skc" not "sk". Technically, "skc" is the parent PCI device (the SysKonnect GEnesis controller) and "sk0" and "sk1" are the network interfaces that get attached to it.
* Dangit. Somehow the pmap_kextract hack for alpha snuck back into thesewpaul1999-07-231-3/+2
| | | | | | files. Change them back to alpha_XXX_dmamap(). Pointed out by: Andrew Gallatin
* Some more small newbus cleanups. Remember to free all resources in casewpaul1999-07-231-14/+23
| | | | of failures in foo_attach(), simplify iospace/memspace things a little.
* Fix a small mind-o: one instance of SYS_RES_IOPORT should have beenwpaul1999-07-221-3/+3
| | | | SYS_RES_MEMOTY in sk_detatch().
* Convert the SysKonnect gigabit ethernet driver to newbus.wpaul1999-07-222-77/+131
|
* Make a few other cleanups while I'm in the area. Typo in comment, unusedwpaul1999-07-142-10/+4
| | | | structure members, etc. No functional changes.
* Revert some changes I had made to try and cut down on the number of TX EOFwpaul1999-07-141-11/+9
| | | | | | | | | | | | interrupts that were scheduled. Testing shows it didn't really do very much and it makes the code a little more complicated (which is never a good thing). Also fix the rambuffer offset initialization for the 512K/64K SRAM case (512K total using 64K chips). It should be 0. The only case with a non-standard rambuffer offset address is 1024K/64K according to the SysKonnect manual. (My card has the 1024/64 configuration and I don't know which card uses the 512/64 configuration, if any, so I'm not sure that this was really a problem for anyone.)
* if_sk.c: use pci_port_t instead of u_shortwpaul1999-07-092-6/+5
| | | | | if_skreg.h: use alpha_XXX_dmamap() instead of pmap_kextract hackery on alpha platform
* This commit adds driver support for the SysKonnect SK-984x serieswpaul1999-07-093-0/+3481
gigabit ethernet adapters. This includes two single port cards (single mode and multimode fiber) and two dual port cards (also single mode and multimode fiber). SysKonnect is currently the only vendor with a dual port gigabit ethernet NIC. The ports on dual port adapters are treated as separate network interfaces. Thus, if you have an SK-9844 dual port SX card, you should have both sk0 and sk1 interfaces attached. Dual port cards are implemented using two XMAC II chips connected to a single SysKonnect GEnesis controller. Hence, dual port cards are really one PCI device, as opposed to two separate PCI devices connected through a PCI to PCI bridge. Note that SysKonnect's drivers use the two ports for failover purposes rather that as two separate interfaces, plus they don't support jumbo frames. This applies to their Linux driver too. :) Support is provided for hardware multicast filtering, BPF and jumbo frames. The SysKonnect cards support TCP checksum offload however this feature is not currently enabled (hopefully it will be once we get checksum offload support). There are still a few things that need to be implemeted, like the ability to communicate with the on-board LM80 voltage/temperature monitor, but I wanted to get the driver under CVS control and into -current so people could bang on it. A big thanks for SysKonnect for making all their programming info for these cards (and for their FDDI and token ring cards) available without NDA (see www.syskonnect.com).
OpenPOWER on IntegriCloud