summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
Commit message (Collapse)AuthorAgeFilesLines
* Fix function prototype for device_shutdown method.yongari2007-11-221-2/+4
|
* IEEE 802.3 Annex 28B.3 explicitly specifies the following relativeyongari2007-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
* o In order to reduce bug and code duplication fold handling of NICsmarius2007-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
* o break newbus api: add a new argument of type driver_filter_t topiso2007-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@
* Fix a bug originally introduced in rev. 1.74; don't reloaded themarius2006-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
* - Use our own callout (the dc_tick() callout uses varying periodsmarius2006-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.
* Remove <sys/types.h>; including both <sys/param.h> and <sys/types.h>marius2006-11-021-1/+0
| | | | violates style(9).
* - Wrap code optimized for architectures without alignment constraintsmarius2006-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
* - Consistently use if_printf() only in interface methods: if_start(),glebius2006-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>
* Replace hard-coded magic constants to system defined constantsyongari2006-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.
* Fix the last commit.glebius2006-06-082-3/+8
| | | | | Submitted by: jhb Pointy hat to: glebius
* Add device IDs for Linksys PCMPC200 Cardbus card.glebius2006-06-072-0/+12
| | | | | PR: kern/75582 Submitted by: Gary Palmer
* - Switch on the full 32-bit device ID to avoid collisions between thejhb2006-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
* Use PCI bus accessors rather than reading config registers directly tojhb2006-06-031-2/+3
| | | | get the subvendor device id.
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-121-48/+1
|
* Add device-id for the Neteasy DRP-32TXD cardbus 10/100 card. It's anotherjhb2006-03-162-0/+13
| | | | | | | ADMTek AN985 clone. MFC after: 3 days Tested by: Lila liladude at aruba dot it
* Do not touch ifp->if_baudrate in miibus aware drivers.glebius2006-02-141-1/+0
|
* Add missing parens.glebius2005-12-281-1/+1
| | | | Submitted by: njl
* Check for IFF_DRV_RUNNING in the interrupt loop.glebius2005-12-281-2/+3
| | | | Reported & tested by: Martin P. Hansen <mph lima.dyndns.dk>
* - Rev. 1.175 fixed compilation on sparc64 but also backed out zeroing ofmarius2005-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
* Fix on sparc64.ru2005-12-041-6/+2
|
* Fix the misalignment bugs differently than was done in the previousmarcel2005-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
* Resolve misalignment traps caused by changes to IF_LLADDR().marcel2005-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)
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-10/+10
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Make dc compile after repo-copy.imp2005-10-183-5/+6
|
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceglebius2005-10-051-0/+4
| | | | | | | | | opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules. Reviewed by: bde
* Big polling(4) cleanup.glebius2005-10-011-28/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* Use ansi function definitions in preference to K&R to reduce diffsimp2005-09-302-24/+10
| | | | with NetBSD (and cause it looks cooler).
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.ru2005-09-161-2/+2
| | | | | | when mii_phy_probe() or bus_setup_intr() fails. For drivers that call their detach() in this case, call if_free() there to cover this case too.
* When bus_alloc_resource_any() fails, dc_detach() is called and itkeramida2005-09-151-5/+11
| | | | | | | | | | attempts to deallocate busdma tags and resources that haven't been allocated yet, causing a panic every time a dc interface fails to attach. Fix by checking that we really have something to dealloc before calling bus_dma*() functions. Approved by: jhb MFC after: 1 week
* Better commentimp2005-08-291-1/+4
|
* Fix another instance of old info re: miibusimp2005-08-291-1/+1
|
* Fixup locking and mark MPSAFE:jhb2005-08-181-70/+77
| | | | | | | | | | | | | - Add locked versions of start and init. The SRM_MEDIA code in dc_init() stayed in dc_init() instead of moving to dc_init_locked() to make the locking saner. - Use callout_init_mtx(). - Fixup locking in detach and ioctl. - Lock the driver in the ifmedia callouts. - Don't recurse on the driver lock. - De-spl. MFC after: 3 days
* Use device_printf() and if_printf() and remove dc_unit from softc.jhb2005-08-102-36/+31
|
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-12/+13
| | | | | | | | | | | | | | 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
* Modify device drivers supporting multicast addresses to lock if_addr_mtxrwatson2005-08-031-0/+8
| | | | | | | | 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
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-102-25/+31
| | | | | | | | | | | | | | | | | | | | 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
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-293-6/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Fix newer Xircom CBE2-100 cards that were reportingimp2005-04-181-13/+14
| | | | | | | | dc0: MII without any PHY! We have to enable the connection to the MII first. Doing so fixes the problem cards without breaking the older, working cards. Bad card provided by: deischen
* Bugger, wiped out a needed comma in the previous commit.scottl2005-03-091-1/+1
|
* The DC driver asks for an alignment of PAGE_SIZE for data buffers, but alsoscottl2005-03-081-3/+3
| | | | | | | | | | asks that each buffer be (2048 * 256) bytes long. I suspect that alignment isn't a real requirement since busdma only recently started honoring it. The size is also bogus. Fix both of these and stop busdma from trying to exhaust the system memory pool with bounce pages. Submitted by: Kevin Oberman MFC After: 7 days
* Fix style(9) issues with __P removal.imp2005-02-241-71/+67
| | | | Noticed by: bde
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* /* -> /*- for license, minor formatting changesimp2005-01-072-2/+2
|
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Read the MAC address in the EEPROM in the correct byte order. Thismux2004-10-011-4/+4
| | | | | | | | | | is a no-op on little endian architectures, but fixes getting the MAC address for some dc(4) cards on big endian architectures. This is a RELENG_5 candidate. Tested by: gallatin (powerpc), marius (sparc64) First version of the patch written by: gallatin
* Add ALTQ support for dc(4), based upon a mostly-working patch from mlaier.green2004-10-011-15/+21
|
* Conditionalize IFF_NEEDSGIANT, like everything else here, on IS_MPSAFE.green2004-10-011-2/+3
| | | | | The driver doesn't look any less safe without Giant than with, and works with IS_MPSAFE set to 1 here, so others should probably test it as such.
* if_dc includes locking, but that locking is disabled by a #ifdefrwatson2004-08-251-1/+2
| | | | | | | | by default. As such, mark if_dc as IFF_NEEDSGIANT until such time as appropriate locking review and testing can take place, and the locking can be enabled by default. RELENG_5 candidate.
* - Make OF_getetheraddr() honour the "local-mac-address?" system configmarius2004-08-141-1/+1
| | | | | | | | | | | | | | | variable. If set to "true" OF_getetheraddr() will now return the unique MAC address stored in the "local-mac-address" property of the device's OFW node if present and the host address/system default MAC address if the node doesn't doesn't have such a property. If set to "false" the host address will be returned for all devices like before this change. This brings the behaviour of device drivers for NICs with OFW support/ FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4), regarding "local-mac-address?" in line with NetBSD and Solaris. The man pages of the respective drivers will be updated separately to reflect this change. - Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its functionality is now part of OF_getetheraddr().
OpenPOWER on IntegriCloud