summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_xl.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for the 3Com 556 and 556B mini-pci adapters used on somewpaul2000-08-281-9/+76
| | | | | | | laptops. I've checked that this still works with the other cards and it works with the 3c556 that I have access to, but I want to check that it works with the 556B mentioned in PR #20878 before I close out the PR and merge to -stable.
* Make all Ethernet drivers attach using ether_ifattach() and detach usingarchie2000-07-131-6/+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
* Use the correct register name. s/PCI_COMMAND_STATUS_REG/PCIR_COMMAND/peter2000-05-281-3/+3
|
* Move code to handle BPF and bridging for incoming Ethernet packets outarchie2000-05-141-37/+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
* Depend on miibus.peter2000-04-291-0/+2
| | | | | | | | Note that if_aue doesn't strictly depend on usb because it uses the method interface for calls rather than using internal symbols, and because it's a child driver of usb and therefore will not try and do anything unless the parent usb code is loaded at some point. if_aue does strictly depend on miibus as it will fail to link if it is missing.
* Close PR# 15986: issue an RX reset command when initializing the interface,wpaul2000-01-091-0/+4
| | | | | | | but only for those cards that don't use miibus (i.e. all the 10mbps only cards, and the 100baseFX card). PR: kern/15986
* It appears that under certain circumstances that I still can't quite pinwpaul2000-01-031-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | down, the dc driver and receiver can fall out of sync with one another, resulting in a condition where the chip continues to receive packets but the driver never notices. Normally, the receive handler checks each descriptor starting from the current producer index to see if the chip has relinquished ownership, indicating that a packet has been received. The driver hands the packet off to ether_input() and then prepares the descriptor to receive another frame before moving on to the next descriptor in the ring. But sometimes, the chip appears to skip a descriptor. This leaves the driver testing the status word in a descriptor that never gets updated. The driver still gets "RX done" interrupts but never advances further into the RX ring, until the ring fills up and the chip interrupts again to signal an error condition. Sometimes, the driver will remain in this desynchronized state, resulting in spotty performance until the interface is reset. Fortunately, it's fairly simple to detect this condition: if we call the rxeof routine but the number of received packets doesn't increase, we suspect that there could be a problem. In this case, we call a new routine called dc_rx_resync(), which scans ahead in the RX ring to see if there's a frame waiting for us somewhere beyond that the driver thinks is the current producer index. If it finds one, it bumps up the index and calls the rxeof handler again to snarf up the packet and bring the driver back in sync with the chip. (It may actually do this several times in the event that there's more than one "hole" in the ring.) So far the only card supported by if_dc which has exhibited this problem is a LinkSys LNE100TX v2.0 (82c115 PNIC II), and it only seems to happen on one particular system, however the fix is general enough and has low enough overhead that we may as well apply it for all supported chipsets. I also implemented the same fix for the 3Com xl driver, which is apparently vulnerable to the same problem. Problem originally noted and patch tested by: Matt Dillon
* Update the xl driver to recognize yet another 3c905B/3c905C class NIC:wpaul1999-12-161-0/+4
| | | | | | | | | | | | | | | | | the 3c450-TX HomeConnect. Like the 3cSOHO100-TX OfficeConnect, this NIC uses the same ASIC as the 3c905B/3c905C but is targeted for a particular market segment (home users). It is somewhat less expensive than the 3c905B/3c905C ($49, according to the 3Com web site), comes with its own custom driver kit and is bundled with various goofy Windows software packages designed to demonstrate the niftyness of home networking (networked game demos, etc...). Changes are: - Add PCI ID to list in if_xlreg.h. - Update xl_devs table in if_xl.c. - Update xl_choose_xcvr() to consider the HomeConnect the same as all the other 10baseT/100baseTX cards.
* Small tweak: just reset the transmit block instead of doing a global resetwpaul1999-10-251-2/+2
| | | | | in xl_init(). This achieves the effect that I wanted without totally resetting the chip.
* Make some small tweaks:wpaul1999-10-141-4/+26
| | | | | | | | | | | | - When setting/clearing promisc mode, just update the filter, don't reset the whole interface. - Call xl_init() in xl_ifmedia_upd() when setting miibus media modes. This fixes a problem with the 3c905B-COMBO where switching from 10base5/AUI or 10base2/BNC to a 10/100 mode doesn't always work right. - Attempt to reset the interface in xl_init() so that we know we're getting the receive and transmit rings reset properly.
* Change contigmalloc() lower memory bound from 1MB to 0 to improvewpaul1999-09-251-1/+1
| | | | | | | chances of allocations succeeding on systems with small amounts of RAM. Pointed out by: bde
* As suggested by phk, unconditionalize BPF support in these drivers. Sincewpaul1999-09-231-14/+0
| | | | | | | 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.
* Close PR #13665. I managed to figure out the problem, no thanks to thewpaul1999-09-201-16/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | submitter, who *still* hasn't bothered to answer me back. The thing which the submitter completely failed to mention is that his 3c900B-TPO card has the transceiver selection in the EEPROM set to "auto." You can tweak the setting using the 3C90XCFG.EXE utility that 3Com provides with the card. I'm not sure if it's supposed to default to auto or if the user fiddled with it. Currently, the xl driver only does autoselection for 10/100 NICs (i.e. those with NWAY autonegotiation capabilities). For the 10baseT, 10base5, 10base2, 10baseFL and 100baseFX cards, the driver sets the default media to whatever the EEPROM transceiver selector says. The problem is that the "auto" selection is mistakenly identified as "10/100 NWAY autoselection mode" and this is not handled correctly: the default media ends up being chosen as 100baseTX, which doesn't work because we've only added 10baseT media types to the ifmedia word. This leads to a panic in ifmedia_set() (something else which the submitter never bothered to mention). A workaround for this is to re-run the 3C90XCFG.EXE utility and change the transceiver selection to something besides "auto." I have also patched the driver to watch for the "auto" setting in the non-miibus case and select a reasonable default based on the card type instead of falling through to 100baseTX and exploding. PR: misc/13665
* Un-do the changes to the DRIVER_MODULE() declarations in these drivers.wpaul1999-09-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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*
* Goofed and didn't change the second DRIVER_MODULE() linking these withobrien1999-09-201-1/+1
| | | | | | the miibus. Noticed by: wpaul
* Change the name we register with DRIVER_MODULE() to include the leadingobrien1999-09-201-1/+1
| | | | | | "if_". Reviewed by: msmith, wpaul
* Add an alternate transmit strategy for 3c90xB adapters based on the transmitwpaul1999-09-201-71/+292
| | | | | | | | | | | | | | | strategy used in the 3Com Linux driver. The new strategy is to use transmit descriptor polling -- that is, the NIC polls the descriptors to see when new packets are available for transmission. The advantage to the new scheme is that no register accesses are needed in the transmit routine. The old scheme requires several register accesses to stall the TX engine, update the TX DMA list pointer register, then unstall the TX engine. Hopefully the new scheme will provide improved transmit performance with less CPU overhead. This only affects the 3c90xB or 3c90xC cards, not the 3c90x cards. This means the original 3c900 and 3c905 cards are unaffected. Newer cards include the 3c900B series, the 3c905B, 3c980, 3c980B, 3c905C and 3c905C, and the 3cSOHO100-TX OfficeConnect.
* Dangit: mispelled TORNADO in one place.wpaul1999-09-151-1/+1
|
* 3Com has produced their own Linux driver for the 3c90x/3c90xB series cards.wpaul1999-09-151-3/+8
| | | | | | | | It's GPL'ed of course, but looking over it tonight I learned of Yet Another Fast EtherLink XL Adapter: the 3c980C server adapter. This is basically an updated version of the 3c980 that uses the Tornado ASIC instead of the earlier Hurricane ASIC. The only change here is to add the new PCI device ID (0x9805) and corresponding table entries.
* Add a pointer to "controller miibus0" for people who will not read thepeter1999-09-081-0/+1
| | | | | commit messages or GENERIC and insist on running -CURRENT. It probably won't work, but it's worth a try.
* Just when I thought it was safe. In the original 3c905-TX NICs, thewpaul1999-09-011-0/+13
| | | | | | | | | | | | | | | | | | | external NatSemi PHY chip was programmed to respond to MII address 24. In the 3c905B ASICs, the transceiver is internal but it's still mapped to MII address 24. But *some* 3Com 3c905B ASIC revisions map the transceiver control registers to *all* MII addresses (0 through 31). The miibus code probes for PHYs at all MII addresses and because of this unusual behavior, it will attempt to map the same PHY registers several times over, which doesn't work. Naturally, the 3c905B NIC that I tested happened not to exhibit this behavior. The fix is to tweak xl_miibus_readreg() and xl_miibus_writereg() to only respond when attempting to read from MII address 24. This is safe to do since the 3Com documentation indicates that the PHY and/or internal transceiver will always be mapped to address 24, and there are no 3Com XL NICs with more than one PHY.
* Convert the 3Com XL driver to miibus. This one is a little trickywpaul1999-08-291-592/+172
| | | | | | | | | | | | | | | | due to the fact that there are non-MII cards supported by the same driver and I don't have all of the cards available for testing. There's also the 3c905B-COMBO which has MII, AUI and BNC media ports all in one package. Supporting the COMBO is difficult because we have to add the 10base5 and 10base2 media types to the same ifmedia struct as the MII-attached types, however there is no way to force the miibus and child PHYs into existence before xl_attach() completes, so there is no ifmedia struct available in xl_attach(). What we do inistead is use the mediainit method as a callback: when a child PHY is attached, it calls the miibus mediainit routine which selects a default media. This routing also calls the NIC driver's mediainit method (if it implements one) at which point we can safely add the other media types.
* $Id$ -> $FreeBSD$peter1999-08-281-2/+2
|
* Small tweak: in xl_rxeof(), rxstat should be u_int32_t, not u_int16_t.wpaul1999-08-191-3/+3
|
* Minor tweak for last commit: insert extra delay between issuing masterwpaul1999-08-021-2/+4
| | | | reset and RX/TX resets.
* Perform an RX reset and TX reset in xl_reset() along with the masterwpaul1999-08-021-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | reset command. I observed some anomalous behavior while testing a 3c905C with a Dell PowerEdge 4300/500 dual PIII 500Mhz system. The NIC would seem to work correctly most of the time but would sometimes fail to receive certain packets, in particular NFS create requests. I could mount an NFS filesystem from the PowerEdge and do an ls on it, but trying to do a "touch foo" would hang. Monitoring traffic from another host revealed that the client was properly sending an NFS create request but the server was not receiving it. It *did* receive it when I ran the same test with an Intel fxp card. I don't understand the exact mechanics of this strange behavior, but resetting the receiver and transmitter seems to get rid of it. I used to perform an RX and TX reset in xl_init(), but stopped doing it there because on 3c905B and later cards this causes the autoneg session to restart, which would lead to the NIC waiting a long time before exchanging traffic after being brought up the first time. Apparently the receiver and transmitter resets should be performed at least once when initializing the card. Hopefully this will cure problems that people have been having with the 3c905C -- this was the only strange behavior that I have observed with the 3c905C so far which does not appear with the 3c905B or 3c905.
* Some more small newbus cleanups. Remember to free all resources in casewpaul1999-07-231-15/+28
| | | | of failures in foo_attach(), simplify iospace/memspace things a little.
* Well, it seems that loading a PCI driver module after the system haswpaul1999-07-221-2/+8
| | | | | | | | | been booted works too -- very neat. However I don't want the system to stop for 5 seconds when the MII autoprobe is triggered in the xl and tl drivers since that's lame. Instead, only use the hard delay when we've been cold booted. If not, use the timeout mechanism instead. (The SysKonnect driver doesn't use the same autonegotiation scheme, so no change is required there.)
* Small tweak to newbus changes: return error status on failure correctlywpaul1999-07-221-2/+2
| | | | | in xl_attach() (not a problem if the attach never fails, but if it does the function would still return 0, which is wrong).
* Convert the xl driver to newbus. It is now possible to make this driverwpaul1999-07-201-87/+123
| | | | | | | | | | into a loadable module, and all of the platform dependencies are gone (except for the alpha_XXX_dmamap() thing, which is another issue -- I still don't know how to use the busdma stuff with a network driver). Also increase the delay in xl_reset(); testing on a 486/66 with a 3c905C shows that reading the EEPROM fails immediately after a reset. Waiting a little longer after the reset completes seems to fix it.
* Grrr.... forgot one line from the previous fix.wpaul1999-07-081-3/+3
|
* Fix a potential race condition that can occur in xl_start(). If the NICwpaul1999-07-071-3/+5
| | | | | | | | | | clears out the transmit queue and zeroes the downlist pointer register, but xl_txeof() isn't called before xl_start() tries to queue more packets, xl_start() will think that the DMA is still in progress and not update the downlist register again, thus causing packets to sit in the transmit queue forever. Patch provided by: Russell T Hunt <alaric@MIT.EDU>
* Rename bpfilter to bpf.des1999-07-061-8/+8
|
* Change the cast in pci_map_port() from u_short * to pci_port_t * so itpeter1999-07-021-3/+3
| | | | | | | compiles cleanly on the Alpha. (On the alpha, the port type is an int, not a short). Cast a couple of pointers to ints via 'uintptr_t' rather than 'unsigned int' since uintptr_t is long (64 bit) on Alpha, as are pointers.
* Change the warning message issued if pci_map_port() fails. I think thiswpaul1999-06-011-5/+5
| | | | | | | | | | happens if you have a BIOS with a 'Plug & Play OS' setting and you leave it set to 'Yes.' This is wrong for FreeBSD (and LoseNT): it should be set to 'No.' Apparently it's still possible to map the iobase of the NIC and have the card work by reading the config space manually (which is what the driver does if pci_map_port() fails) but we need to warn the user to do fix their machine anyway. Anyway, warn the user to check the 'Plug & Play OS' setting in their BIOS if mapping the io space fails.
* Whoops, forgot to update xl_mediacheck() to account for the 3c905C.wpaul1999-05-301-2/+3
|
* Head for the hills friends and neighbors, 3Com has yet another 3c90Xwpaul1999-05-301-2/+5
| | | | | | | | chipset. First you thrilled to the 3c905, then you trembled at the 3c905B, now gaze in wonder at: the 3c905C! This appears to be another 3c90X series chip called the Tornado (PCI ID 0x10B7/0x9200) and should be equivalent (from the driver API perspective) to the 3c905B, so all we have to do is add the PCI ID to the list.
* Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:peter1999-05-091-6/+2
| | | | | | | | #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.)
* Dynamically increase TX start threshold if TX underruns are detected.wpaul1999-05-051-4/+12
|
* Fix the media selection for the 3c900B-FL 10baseFL adapter. It actuallywpaul1999-05-041-44/+48
| | | | | | uses the AUI port with an on-board AUI to 10baseFL transceiver, not the 10baseT port like I had earlier suspected. The 3c900B-FL should be properly supported now.
* Bunch of updates:wpaul1999-04-301-95/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Try to unbreak what I broke by screwing with the tx queuing again. I'm waiting for a few more people to test out this code and report back before I move it into current. Hopefully it will be soon. Basically I reverted to the old TX queuing strategy. - Add experimental support for the 3c900B-FL (10mbps ST fiber). The card should be detected properly and the 10baseFL mode supported, but again I'm still waiting for word from a tester to see if this actually works. It shouldn't affect the other cards though; all the differences are in media selection. - Set the TX start threshold register to get better performance. - Increase the size of the RX and TX rings. UDP performance was pretty bad because the TX ring was too small. Should be substantially better now (I can saturate the link with either TCP or UDP now). - Change some of the #defines to reflect proper 3Com ASIC names (boomerang, cyclone, krakatoa, hurricane). - Simplify and reorganize interrupt handler; ack all interrupts right away and then process them. This avoids a potential race condition. (Noted by Matt Dillon.) - Reorganize the bridging code to eliminate using a goto to jump into the middle of an if() {} clause. Sorry, that just made my brain itch. - Use m_adj() in xl_rxeof(). - Make the payload alignment in xl_newbuf() the default (instead of just conditionally defined for the alpha) to improve NFS performance (avoids need for nfs_realign()).
* Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn'tpeter1999-04-241-2/+6
| | | | hurt the driver portability to 3.x too much for where drivers are shared.
* Bring the 'new-bus' to the i386. This extensively changes the way thepeter1999-04-161-3/+9
| | | | | | | | | | | | | | | | | | i386 platform boots, it is no longer ISA-centric, and is fully dynamic. Most old drivers compile and run without modification via 'compatability shims' to enable a smoother transition. eisa, isapnp and pccard* are not yet using the new resource manager. Once fully converted, all drivers will be loadable, including PCI and ISA. (Some other changes appear to have snuck in, including a port of Soren's ATA driver to the Alpha. Soren, back this out if you need to.) This is a checkpoint of work-in-progress, but is quite functional. The bulk of the work was done over the last few years by Doug Rabson and Garrett Wollman. Approved by: core
* Add bridging support (tested in 3.1-RELEASE by Steven Vetzalghelmer1999-04-161-13/+41
| | | | <svetzal@icom.ca>).
* - Close PR #11136: add PCI ID for another new cyclone device: thewpaul1999-04-151-31/+57
| | | | | | | | | | | | 3c900B-TPC (twisted pair and coax). Treated similarly to the 3c900B-COMBO, except no AUI port. - Fix media selection so that it's possible to select the AUI and BNC ports on the 3c905B-COMBO. This board is now fully supported. - Change TX queueing strategy to hopefully be more efficient by avoiding register accesses in xl_start(). Should provide small performance improvement and a little better reliability.
* Add support for the 3cSOHO100-TX, which is a "hurricane" chipsetwpaul1999-04-121-2/+6
| | | | | | (cut-down version of the "cyclone" for the small office/home office "cheap bastard" market). Basically the same as a 3c905B but without Wake-on-LAN, ROM socket, etc...
* Some small updates:wpaul1999-04-111-8/+25
| | | | | | | | | | | | | | | | - Wait longer for the reset to complete in xl_attach() to try and avoid 'command never completed' warnings. - Clean up a few odds and ends in xl_attach(). - Add PCI ID for the 3c905B-COMBO (a new card). Right now this is treated as a 3c905B; I need to dig up one of these cards for testing before I can make the AUI and BNC ports work. - Add a hack to force reading the I/O address directly from the PCI registers if pci_map_port() fails. I SHOULD NOT HAVE TO DO THIS: SOMEBODY WITH MORE PCI CLUES THAN I SHOULD INVESTIGATE WHY THIS HAPPENS.
OpenPOWER on IntegriCloud