aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/dc
Commit message (Collapse)AuthorAgeFilesLines
...
* There is no need to execute filter configuration when driver is notPyun YongHyeon2011-02-181-4/+2
| | | | | | | | running. Remove wrong driver state change in dc_setfilt_xircom(). While I'm here nuke unnecessary assignments. Notes: svn path=/head/; revision=218827
* Make sure to clear status word of TX descriptor in dc_list_tx_init().Pyun YongHyeon2011-02-181-5/+5
| | | | | | | Do not update if_opackets if the transmission had failed. Notes: svn path=/head/; revision=218826
* For controllers that have TX interrupt moderation capability,Pyun YongHyeon2011-02-182-1/+16
| | | | | | | | | | | | | | | | | | | request TX completion interrupt for every 8-th frames. Previously dc(4) requested TX completion interrupt if number of queued TX descriptors is greater than 64. This caused a lot of TX completion interrupt under high TX load once driver queued more than 64 TX descriptors. It's quite normal to see more than 64 queued TX descriptors under high TX load. This change reduces the number of TX completion interrupts to be less than 17k under high TX load. Because this change does not generate TX completion interrupt for each frame, add reclaiming transmitted buffers in dc_tick not to generate false watchdog timeouts. While I'm here add check for queued descriptors in dc_txeof() since there is no more work to do when there is no pending descriptors. Notes: svn path=/head/; revision=218820
* Remove use case of DC_TX_ONE. It was used to limit queue just 1 TXPyun YongHyeon2011-02-182-6/+0
| | | | | | | | | frame in DM910x controllers. In r67595(more than 10 years ago) it was replaced to use "Store and Forward" mode and made controller generate TX completion interrupt for every frame. Notes: svn path=/head/; revision=218789
* Apply special PHY initialization code for 21143 controllers beforePyun YongHyeon2011-02-181-31/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | any other media configuration. Otherwise some 21143 controller cannot establish a link. While I'm here remove the PHY initialization code in dc_setcfg(). Since dc_setcfg() is called whenever link state is changed, having the PHY initialization code in dc_setcfg() resulted in continuous link flips. After driver resets SIA, use default SIA transmit/receive configuration instead of disabling autosense/autonegotiation. Otherwise, controller fails to establish a link as well as losing auto-negotiation capability. For manual media configuration, always configure 21143 controller with specified media to ensure media change. This change makes ANA-6922 establish link with/without auto-negotiation. While I'm here be more strict on link UP/DOWN detection logic. Many thanks to marius who fixed several bugs in initial patch and even tested the patch on a couple of dc(4) controllers. PR: kern/79262 Reviewed by: marius Tested by: marius Notes: svn path=/head/; revision=218788
* When driver have to use base softc due to lack of SROM on secondPyun YongHyeon2011-02-181-2/+37
| | | | | | | | | | | | | | | | port, copy SROM information from base softc as well and run SROM parser again. This change is necessary for some dual port controllers to make dc(4) correctly detect PHY media based on first port configuration table. While I'm here add a check for validity of the base softc before duplicating SROM contents from base softc. If driver failed to attach to the first port it can access invalid area. PR: kern/79262 Reviewed by: marius Notes: svn path=/head/; revision=218787
* Always check memory allocation failure. If driver encounter memoryPyun YongHyeon2011-02-182-21/+60
| | | | | | | | | allocation error, do not attach driver. Reviewed by: marius Notes: svn path=/head/; revision=218786
* - Even after masking the media with IFM_GMASK the result may have bitsMarius Strobl2011-01-142-29/+11
| | | | | | | | | | | | | besides the duplex ones set so just comparing it with IFM_FDX may lead to false negatives. - Just let the default case handle all unsupported media types. - In pnphy_status() don't unnecessarily read a register twice. - Remove unnused macros. MFC after: 1 week Notes: svn path=/head/; revision=217417
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). This file was missed in r213893. Notes: svn path=/head/; revision=213908
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-152-37/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Notes: svn path=/head/; revision=213893
* It seems some multi-port dc(4) controllers shares SROM of the firstPyun YongHyeon2010-10-142-0/+47
| | | | | | | | | | | | | | | port such that reading station address from second port always returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there is no easy way to know whether SROM is shared or not. Workaround the issue by traversing dc(4) device list and see whether we're using second port and use station address of controller 0 as base station address of second port. PR: kern/79262 MFC after: 2 weeks Notes: svn path=/head/; revision=213841
* Consistently always explicitly set IFM_HDX for half-duplex.Marius Strobl2010-10-032-5/+9
| | | | | | | Obtained from: OpenBSD (mostly) Notes: svn path=/head/; revision=213384
* - In the spirit of previous simplifications factor out the checks for aMarius Strobl2010-10-022-42/+2
| | | | | | | | | | | | | | | | | | | | different PHY instance being selected and isolation out into the wrappers around the service methods rather than duplicating them over and over again (besides, a PHY driver shouldn't need to care about which instance it actually is). - Centralize the check for the need to isolate a non-zero PHY instance not supporting isolation in mii_mediachg() and just ignore it rather than panicing, which should sufficient given that a) things are likely to just work anyway if one doesn't plug in more than one port at a time and b) refusing to attach in this case just leaves us in a unknown but most likely also not exactly correct configuration (besides several drivers setting MIIF_NOISOLATE didn't care about these anyway, probably due to setting this flag for no real reason). - Minor fixes like removing unnecessary setting of sc->mii_anegticks, using sc->mii_anegticks instead of hardcoded values etc. Notes: svn path=/head/; revision=213364
* Use the mii_data provided via mii_attach_args and mii_pdata respectivelyMarius Strobl2010-09-272-2/+2
| | | | | | | instead of reaching out for the softc of the parent. Notes: svn path=/head/; revision=213229
* cardbus -> CardBusWarner Losh2010-01-031-1/+1
| | | | Notes: svn path=/head/; revision=201451
* Fix CardBus spelling.Warner Losh2010-01-031-3/+3
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=201449
* Fix card/device names, no functional changeMartin Blapp2010-01-032-18/+19
| | | | | | | | | | | The ADMtek AN985 is the cardbus variant of ADMtek AN983 The Netgear FA511 is just a relabled ADMtek AN985 PR: kern/50574 MFC after: 1 month Notes: svn path=/head/; revision=201430
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/Robert Watson2009-06-261-8/+8
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=195049
* When user_frac in the polling subsystem is low it is going to busy theAttilio Rao2009-05-301-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=193096
* - Set MIIF_NOLOOP and don't add IFM_LOOP as loopback apparently isn'tMarius Strobl2009-03-192-19/+12
| | | | | | | | | | | supported with these pseudo-PHYs. The MIIF_NOLOOP flag currently triggers nothing but hopefully will be respected by mii_phy_setmedia() later on. - Don't add IFM_NONE as isolation isn't supported by these pseudo-PHYs. - Use mii_phy_add_media() instead of mii_add_media() so the latter can be eventually retired. Notes: svn path=/head/; revision=190117
* remove now-redunant cardbus attachment.Warner Losh2009-03-091-1/+0
| | | | Notes: svn path=/head/; revision=189575
* - According to the corresponding Linux, NetBSD and OpenSolarisMarius Strobl2008-12-072-36/+47
| | | | | | | | | | | drivers, there should be a 1us delay after every write when bit-banging the MII. Also insert barriers in order to ensure the intended ordering. These changes hopefully will solve the bus wedging occasionally experienced with DM9102A since r182461. - Deobfuscate dc_mii_readreg() a bit. Notes: svn path=/head/; revision=185750
* cosmetic changes and style fixesMarius Strobl2008-09-302-47/+33
| | | | Notes: svn path=/head/; revision=183505
* For chips with a broken DC_ISR_RX_STATE which f.e. never signalsMarius Strobl2008-08-292-5/+11
| | | | | | | | | | | | | | | | | stopped nor the waiting state and also no other means to check whether the receiver is idle (see also r163774), we have no choice than to call mii_tick(9) unconditionally even in the case of the DC_REDUCED_MII_POLL handling as far as the RX side is concerned. This isn't necessarily worse than checking whether RX is idle though because unlike as with TX we're racing with the hardware, which might receive packets any time while we poll the MII, anyway. Reported and tested by: Jacob Owens Reviewed by: yongari MFC after: 3 days Notes: svn path=/head/; revision=182461
* - Use m_collapse(9) instead of m_defrag(9) if possible. This resultsMarius Strobl2008-08-231-18/+27
| | | | | | | | | | | | in a noticeable reduction in system time spent. - If bus_dmamap_load_mbuf_sg(9) fails with EFBIG and we already have defragmented the mbuf chain, don't bother to defragment and load it a second time just yet as it's likely to fail again anyway. MFC after: 3 days Notes: svn path=/head/; revision=182079
* Ethernet hardware address stored in DC_AL_PAR0/DC_AL_PAR1 registerPyun YongHyeon2008-06-081-6/+14
| | | | | | | | | | | | | | | is in little endian form. Likewise setting DC_AL_PAR0/DC_AL_PAR1 register expect the address to be in little endian form. For big endian architectures the address should be swapped to get correct one. Change setting/getting ethernet hardware address to big endian architecture frendly. Reported by: Robert Murillo ( billypilgrim782001 at yahoo dot com ) Tested by: Robert Murillo ( billypilgrim782001 at yahoo dot com ) Notes: svn path=/head/; revision=179647
* - Const'ify the dc_devs array.Marius Strobl2008-03-242-85/+84
| | | | | | | | | | | | | - Correct the maxsize parameter when creating the mbufs busdma tag to reflect the actual requirement of dc(4). - Move the KASSERT in dc_newbuf() to the right spot. - Also convert the TX side to take advantage of bus_dmamap_load_mbuf_sg(9). - Move the comment regarding dc_start_locked() to the right spot. MFC after: 2 weeks Notes: svn path=/head/; revision=177561
* Fix function prototype for device_shutdown method.Pyun YongHyeon2007-11-221-2/+4
| | | | Notes: svn path=/head/; revision=173839
* IEEE 802.3 Annex 28B.3 explicitly specifies the following relativePyun YongHyeon2007-11-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | priorities of the technologies supported by 802.3 Selector Field value. 1000BASE-T full duplex 1000BASE-T 100BASE-T2 full duplex 100BASE-TX full duplex 100BASE-T2 100BASE-T4 100BASE-TX 10BASE-T full duplex 10BAST-T However PHY drivers didn't honor the order such that 100BASE-T4 had higher priority than 100BASE-TX full duplex. Fix that long standing bugs such that have PHY drivers choose the highest common denominator ability. Fix a bug in dcphy which inadvertently aceepts 100BASE-T4. PR: 92599 Notes: svn path=/head/; revision=173665
* o In order to reduce bug and code duplication fold handling of NICsMarius Strobl2007-08-052-69/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requiring DC_TX_ALIGN or DC_TX_COALESCE, which was previously done in dc_start_locked(), into dc_encap(). o In dc_encap(): - If m_defrag() fails just drop the packet like other NIC drivers do. This should only happen when there's a mbuf shortage, in which case it was possible to end up with an IFQ full of packets which couldn't be processed as they couldn't be defragmented as they were taking up all the mbufs themselves. This includes adjusting dc_start_locked() to not trying to prepend the mbuf (chain) if dc_encap() has freed it. - Likewise, if bus_dmamap_load_mbuf() fails as dc_dma_map_txbuf() failed, free the mbuf possibly allocated by the above call to m_defrag() and drop the packet. o In dc_txeof(): - Don't clear IFF_DRV_OACTIVE unless there are at least 6 free TX descriptors. Further down the road dc_encap() will bail if there are only 5 or fewer free TX descriptors, causing dc_start_locked() to abort and prepend the dequeued mbuf again so it makes no sense to pretend we could process mbufs again when in fact we won't. While at it replace this magic 5 with a macro DC_TX_LIST_RSVD. - Just always assign idx to sc->dc_cdata.dc_tx_cons; it doesn't make much sense to exclude the idx == sc->dc_cdata.dc_tx_cons case. o In dc_dma_map_txbuf() there's no need to set sc->dc_cdata.dc_tx_err to error if the latter is != 0, bus_dmamap_load_mbuf() already returns the same error value in that case anyway. o For less overhead, convert to use bus_dmamap_load_mbuf_sg() for loading RX buffers. o Remove some banal and/or outdated comments. Approved by: re (kensmith) MFC after: 1 week Notes: svn path=/head/; revision=171729
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-1/+1
| | | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=166901
* Fix a bug originally introduced in rev. 1.74; don't reloaded theMarius Strobl2006-12-201-1/+2
| | | | | | | | | | | | | watchdog timer in dc_txeof() in case there are still unhandled descriptors as dc_poll() invokes dc_poll() unconditionally. Otherwise this would result in the watchdog timer constantly being being reloaded and thus circumvent that the watchdog ever fires in the DEVICE_POLLING case. Pointed out by: bde Notes: svn path=/head/; revision=165365
* - Use our own callout (the dc_tick() callout uses varying periodsMarius Strobl2006-12-062-27/+35
| | | | | | | | | | | | depending on the NIC and isn't used at all with HomePNA links) instead of if_slowtimo() for driving dc_watchdog() in order to avoid races accessing if_timer. - Use bus_get_dma_tag() so dc(4) works on platforms requiring it. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that. - Remove an alpha remnant in dc_softc. Notes: svn path=/head/; revision=164930
* Remove <sys/types.h>; including both <sys/param.h> and <sys/types.h>Marius Strobl2006-11-021-1/+0
| | | | | | | violates style(9). Notes: svn path=/head/; revision=163892
* - Wrap code optimized for architectures without alignment constraintsMarius Strobl2006-10-291-16/+22
| | | | | | | | | | | | | | | | | | | | | in #ifdef __NO_STRICT_ALIGNMENT rather than #ifdef __i386__. This means that amd64 now also uses the optimized code. [1] While at it, fix a nearby style(9) bug. - Remove the hw.dc_quick SYSCTL, which allowed to turn off the above mentioned optimization, as like the equivalent and already removed - In dc_setcfg() suppress printing a warning when forcing the receiver and transceiver to idle state times out for chips where the status bits in question just never change (observed in detail with DM9102A) and therefore the warning would be highly likely false positive. [2] - In dc_ifmedia_sts() add a missing DC_UNLOCK(). Tested by: Hans-Joerg Sirtl on amd64 [1] PR: 82681 [2] Obtained from: NetBSD tlp(4) [2] MFC after: 1 week Notes: svn path=/head/; revision=163774
* - Consistently use if_printf() only in interface methods: if_start(),Gleb Smirnoff2006-09-152-6/+8
| | | | | | | | | | | if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name. Submitted by: Alex Lyashkov <umka sevcity.net> Notes: svn path=/head/; revision=162321
* Replace hard-coded magic constants to system defined constantsPyun YongHyeon2006-08-022-2/+2
| | | | | | | | | (BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). These pseudo PHY drivers were forgotten from the conversion due to the repo copy to dc driver location. Notes: svn path=/head/; revision=160907
* Fix the last commit.Gleb Smirnoff2006-06-082-3/+8
| | | | | | | | Submitted by: jhb Pointy hat to: glebius Notes: svn path=/head/; revision=159393
* Add device IDs for Linksys PCMPC200 Cardbus card.Gleb Smirnoff2006-06-072-0/+12
| | | | | | | | PR: kern/75582 Submitted by: Gary Palmer Notes: svn path=/head/; revision=159372
* - Switch on the full 32-bit device ID to avoid collisions between theJohn Baldwin2006-06-032-205/+94
| | | | | | | | | | | | | | | | vendor-specific device ids across vendors. - Include the revision in the dc_devs[] array instead of special casing the revid handling in dc_devtype(). - Use PCI bus accessors to read registers instead of pci_read_config() where possible. - Use an 8-bit write to update the latency timer. - Use PCIR_xxx constants and remove unused DC_xxx related to standard PCI config registers. MFC after: 1 week Notes: svn path=/head/; revision=159202
* Use PCI bus accessors rather than reading config registers directly toJohn Baldwin2006-06-031-2/+3
| | | | | | | get the subvendor device id. Notes: svn path=/head/; revision=159201
* Remove various bits of conditional Alpha code and fixup a few comments.John Baldwin2006-05-121-48/+1
| | | | Notes: svn path=/head/; revision=158471
* Add device-id for the Neteasy DRP-32TXD cardbus 10/100 card. It's anotherJohn Baldwin2006-03-162-0/+13
| | | | | | | | | | ADMTek AN985 clone. MFC after: 3 days Tested by: Lila liladude at aruba dot it Notes: svn path=/head/; revision=156785
* Do not touch ifp->if_baudrate in miibus aware drivers.Gleb Smirnoff2006-02-141-1/+0
| | | | Notes: svn path=/head/; revision=155671
* Add missing parens.Gleb Smirnoff2005-12-281-1/+1
| | | | | | | Submitted by: njl Notes: svn path=/head/; revision=153800
* Check for IFF_DRV_RUNNING in the interrupt loop.Gleb Smirnoff2005-12-281-2/+3
| | | | | | | Reported & tested by: Martin P. Hansen <mph lima.dyndns.dk> Notes: svn path=/head/; revision=153792
* - Rev. 1.175 fixed compilation on sparc64 but also backed out zeroing ofMarius Strobl2005-12-051-5/+2
| | | | | | | | | | | | | | | | | the eaddr array (introduced in rev. 1.174) prior to writing to it. As dc_read_eeprom() is told to write only 3 16-bit words to eaddr but eaddr in fact is somewhat larger removal of the zeroing defeated the check whether the MAC address is all zero as there can be some random garbage in eaddr past the 3 words written to it and the check verifys all bits in eaddr. Solve this by changing the check to verify only the 3 words (happenning to be ETHER_ADDR_LEN bytes) written to eaddr. - While here change the notation of "FCode" in a nearby comment to the official way. Ok'ed by: marcel, ru Notes: svn path=/head/; revision=153111
* Fix on sparc64.Ruslan Ermilov2005-12-041-6/+2
| | | | Notes: svn path=/head/; revision=153077
* Fix the misalignment bugs differently than was done in the previousMarcel Moolenaar2005-12-022-23/+33
| | | | | | | | | | | | commit. Copy the ethernet address into a local buffer, which we know is sufficiently aligned for the width of the memory accesses that we do. This also eliminates all suspicious and potentionally harmful casts. In collaboration with: ru Notes: svn path=/head/; revision=153003
* Resolve misalignment traps caused by changes to IF_LLADDR().Marcel Moolenaar2005-11-222-8/+8
| | | | | | | | | | | | Use de16dec() and le16dec() to fetch the link-level address from struct ifnet. Tested on: alpha Reviewed by: jhb See also: de(4) Notes: svn path=/head/; revision=152671