summaryrefslogtreecommitdiffstats
path: root/sys/dev/hme
Commit message (Collapse)AuthorAgeFilesLines
* - Use the revamped code from the gem(4) PCI front-end, whichmarius2008-04-262-162/+175
| | | | | | | | | doesn't require parts of the Expansion ROM to be copied around, for obtaining the MAC address on !OFW platforms. - Don't unnecessarily cache bus space tag and handle nor RIDs in the softcs of the front-ends. - Don't use function calls in initializers. - Let the SBus front-end depend on sbus(4).
* o Disable HMEDEBUG by default.marius2008-04-245-199/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add CTASSERTs ensuring that HME_NRXDESC and HME_NTXDESC are set to legal values. o Use appropriate maxsize, nsegments and maxsegsize parameters when creating DMA tags and correct some comments related to them. o The FreeBSD bus_dmamap_sync(9) supports ored together flags for quite some time now so collapse calls accordingly. o Add missing BUS_DMASYNC_PREREAD when syncing the control DMA maps in hme_rint() and hme_start_locked(). o Keep state of the link state and use it to enable or disable the MAC in hme_mii_statchg() accordingly as well as to return early from hme_start_locked() in case the link is down. o Introduce a sc_flags and use it to replace individual members like sc_pci. o Add bus_barrier(9) calls to hme_mac_bitflip(), hme_mii_readreg(), hme_mii_writereg() and hme_stop() to ensure the respective bit has been written before we starting polling on it and for the right bits to change. o Rather just returning in case hme_mac_bitflip() fails and leaving us in an undefined state report the problem and move on; chances are the requested configuration will become active shortly after. o Don't call hme_start_locked() in hme_init_locked() unconditionally but only after calls to hme_init_locked() when it's appropriate, i.e. in hme_watchdog(). o Add a KASSERT which asserts nsegs is valid also to hme_load_txmbuf(). o In hme_load_txmbuf(): - use a maximum of the newly introduced HME_NTXSEGS segments instead of the incorrect HME_NTXQ, which reflects the maximum TX queue length, for loading the mbufs and put the DMA segments back onto the stack instead of the softc as 16 should be ok there. - use the common errno(2) return values instead of homegrown ones, - given that hme_load_txmbuf() is allowed to fail resulting in a packet drop for quite some time now implement the functionality of hme_txcksum() by means of m_pullup(9), which de-obfuscates the code and allows to always retrieve the correct length of the IP header, [1] - also add a KASSERT which asserts nsegs is valid, - take advantage of m_collapse(9) instead of m_defrag(9) for performance reasons. o Don't bother to check whether the interface is running or whether its queue is empty before calling hme_start_locked() in hme_tint(), the former will check these anyway. o In hme_intr() call hme_rint() before hme_tint() as gem_tint() may take quite a while to return when it calls hme_start_locked(). o Get rid of sc_debug and just check if_flags for IFF_DEBUG directly. o Add a shadow sc_ifflags so we don't reset the chip when unnecessary. o Handle IFF_ALLMULTI correctly. [2] o Use PCIR_BAR instead of a homegrown macro. o Replace sc_enaddr[6] with sc_enaddr[ETHER_ADDR_LEN]. o Use the maximum of 256 TX descriptors for better performance as using all of them has no additional static cost rather than using just half of them. Reported by: rwatson [2] Suggested by: yongari [1] Reviewed by: yongari MFC after: 1 month
* Remove invalid BUS_DMA_ALLOCNOW when creating a tag which is used formarius2007-05-011-1/+1
| | | | a "static" memory allocation only.
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-232-2/+2
| | | | | | | | | | | | | 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@
* - Use the hme_tick() callout instead of if_slowtimo() for drivingmarius2006-12-062-17/+22
| | | | | | hme_watchdog() in order to avoid races accessing if_timer. - Use bus_get_dma_tag() so hme(4) works on platforms requiring it. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that.
* Remove the HME_LOCK_ASSERT() in hme_mifinit(), which was added in themarius2006-12-041-1/+0
| | | | | previous revision; it's actually ok when invoking hme_mifinit() from hme_config() without the lock held.
* - In hme_stop() mask all interrupts.marius2006-12-041-45/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In hme_eint() print MIF register contents on MIF interrupts. - In hme_mifinit() don't bother to preserve the previous MIF config. This was mainly done in order to preserve the PHY select bit (external or internal PHY) but which only needs to be set as appropriate when reading from or writing to the desired PHY in hme_mii_{read,write}reg(). Similarly don't bother to set the PHY select bit in hme_mii_statchg(). - In hme_mii_{read,write}reg() ignore requests to PHYs other than the external and internal PHY one. - Move enabling/disabling the MII drivers of the external transceiver from hme_init_locked() and based on the sheer presence of an external to hme_mifinit() and based on the currently selected media, defaulting to the internal transceiver when the media hasn't been set, yet. Invoke hme_mifinit() from the newly added hme_mediachange_locked() so the setting of the MII drivers is updated when changing media. These changes keep the MII bus from wedging (which manifests in the HME and the PHYs no longer being able to communicate with each other) when the PHY device drivers isolate the unused PHY in two-PHY configurations as present in f.e. Netra t1 100 while changing media, either from hme_init_locked() (see also below) or via ifconfig(8). They also allow for using both transceivers/PHYs. - In the newly added hme_mediachange_locked() also reset the PHYs in two- PHY configurations before invoking mii_mediachg(). This is required for successfully unisolating the previously unused PHY when switching between PHYs. - Now that changing media should no longer cause problems back out rev. 1.27 and re-enable setting the current media in hme_init_locked() (see the commit message of rev. 1.23 for more info). These changes are roughly a merge of NetBSD gem.c rev. 1.32 - 1.35 (1.30 was already fixed differently in our 1.36; 1.31 and 1.32 were wrong) with some parts reworked and things that don't make sense like setting the MII drivers and restoring the previous MIF and XIF settings in hme_mii_{read, write}reg() omitted. MFC after: 2 weeks
* Fix invalid reference of mbuf chains.yongari2006-08-121-16/+16
| | | | | | | | | | Use proper pointer dereference to inform modified mbuf chains to caller. While I'm here perform checksum offload setup after loading DMA maps as m_defrag(9) can return new mbuf chains. In collaboration with: glebius
* Fix typo in printf string.simon2006-05-271-2/+2
| | | | | MFC after: 1 week Approved by: cperciva (mentor)
* Backout rev. 1.46. It caused Rx checksum offload breakage on littleyongari2006-03-211-1/+1
| | | | | | | endian systems. Reported by: joerg Tested by: joerg
* fix Rx checksum computation on little endian systems.yongari2006-01-171-1/+1
| | | | Reported & Tested by: brad@OpenBSD
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-1/+1
| | | | | | | | | | 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.
* - Convert hme(4) to use TX side bus_dmamap_load_mbuf_sg(9).yongari2005-10-253-143/+136
| | | | | | | | | | | | | | | - Move hardware counter reading/zeroing to hme_tick(). This saves 8 register access per interrupt. [1] - Use imax macro for getting max. argument between two integers. - Invoke bus_dmamap_sync(9) first before freeing mbuf. - Check driver queue first to reduce locking operation in hme_start_locked() and interrupt handler. - Simplyfy watchdog timer setup in interrupt handler. - Don't log normal errors such as RX overrun. If we have DMA stuck condition, reinitialize the driver and log it. Reviewed by: marius Obtained from: OpenBSD [1]
* Move hme_stop() after ether_ifdetach() and if_free() to prevent akensmith2005-09-081-2/+2
| | | | | | | | | | memory-referenced-after-free panic if the hme interface fails to attach. Patch obtained from: marius Suggested same thing: brooks MFC after: 3 days
* - Remove redundant assertions that the driver lock is not held in attach()jhb2005-08-241-5/+2
| | | | | | | | | | | and detach() since mtx_lock() will assert that already since the driver lock is not recursive. - Move the call to callout_init_mtx() before hme_stop() so that the callout_stop() in hme_stop() doesn't operate on an uninitialized callout structure during attach. Reported by: yongari (2) MFC after: 3 days
* Add callout_drain()'s to foo_detach() after calling foo_stop() to make surejhb2005-08-171-0/+1
| | | | | | | | | that if softclock is running on another CPU and is blocked on our driver lock, we will wait until it has acquired the lock, seen that it was cancelled, dropped the lock, and awakened us so that we can safely destroy the mutex. MFC after: 3 days
* - Use callout_init_mtx() to close races between hme_stop() and hme_tick().jhb2005-08-101-57/+22
| | | | | | | | | | | - Use the driver lock instead of Giant in a bus dma callback. - Clear IFF_DRV_(RUNNING|OACTIVE) in hme_stop() instead of just clearing RUNNING in hme_ioctl() to be more like other ethernet drivers. - Lock the driver lock around mii operations. - Remove spls. - Cleanup locking in hme_ioctl(). MFC after: 1 week
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-9/+10
| | | | | | | | | | | | | | 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/+2
| | | | | | | | 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
* Add a missing mtx_destroy() in hme_pci_detach().marius2005-07-101-0/+1
| | | | | Reviewed by: yongari Approved by: re (scottl)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-104-20/+28
| | | | | | | | | | | | | | | | | | | | 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
* According to STP2002QFP User's Guide, it seems that driver shouldyongari2005-05-231-1/+4
| | | | | | | | | | | program RXMAC to discard frames with SA field matching the stations's MAC address. Experimentation shows that HME receives its own frames when it operates at 10Mbps half-duplex. With this change HME runs at 10Mbps half-duplx should work with IPv6. (No more "DAD detected duplicate IPv6 address".) Reported by: jacques brierre <jbrierre AT bellsouth DOT net> Reviewed by: marius
* Release the IRQ resource on detach. This fixes repeatedly loading andmarius2005-04-051-0/+1
| | | | | | unloading the hme(4) module in case it attaches to sbus(4). MFC after: 1 week
* Use BUS_PROBE_DEFAULT for pci probe return valueimp2005-03-051-1/+1
|
* - Fix braino introduced in rev. 1.17, unlike the X1032A (HME-ISP1040-combo)marius2005-03-021-8/+8
| | | | | | | | | | | | | and the X1034A (quad HME; QFE) cards the X1033A (single HME) don't have a PCI-PCI-bridge so we can't rely on the PCI slot number being useable as index for the network address to read from the VPD on the latter. Use the end tag to determine whether it is a QFE VPD with 4 NAs and only use the slot number as index in this case. - Remove a useless check. Prodded by: joerg Additional testing by: joerg MFC after: 1 day
* Add a note that all four HME chips on a SUNW,qfe card share the same PROM,marius2005-02-201-1/+2
| | | | | | making it a bit more clear why we can read four NAs from the VPD. MFC after: 1 day
* Fix "Duplicate mbuf free panic".yongari2005-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cause of "Duplicate mbuf free panic" is in the programming error of hme_load_txmbuf(). The code path of the panic is the following. 1. Due to unknown reason DMA engine was freezed. So TX descritors of HME become full and the last failed attempt to transmit a packet had set its associated mbuf address to hme_txdesc structure. Also the failed packet is requeued into interface queue structure in order to retrasmit it when there are more available TX descritors. 2. Since DMA engine was freezed, if_timer starts to decrement its counter. When if_timer expires it tries to reset HME. During the reset phase, hme_meminit() is called and it frees all associated mbuf with descriptors. The last failed mbuf is also freed here. 3. After HME reset completed, HME starts to retransmit packets by dequeing the first packet in interface queue.(Note! the packet was already freed in hme_meminit()!) 4. When a TX completion interrupt is posted by the HME, driver tries to free the successfylly transmitted mbuf. Since the mbuf was freed in step2, now we get "Duplicate mbuf free panic". However, the real cause is in DMA engine freeze. Since no fatal errors reported via interrupts, there might be other cause of the freeze. I tried hard to understand the cause of DMA engine freeze but couldn't find any clues. It seems that the freeze happens under very high network loads(e.g. 7.5-8.0 MB/s TX speed). Though this fix is not enough to eliminate DMA engine freeze it's better than panic. Reported by: jhb via sparc64 ML
* Fix kernel builds with INVARIANTS.obrien2005-01-161-1/+1
|
* Use bus_dmamap_load_mbuf_sg() for loading rx buffers.scottl2005-01-151-19/+7
|
* Some changes related to reading the MAC-address from the VPD on systemsmarius2004-12-121-19/+18
| | | | | | | | | | | | | | | | without Open Firmware: - The PCI data structure of some HME PROMs contains a non-zero interface revision in the class code. Thus remove the checks for matching class code and PCI data structure length and revsion. These were pretty much useless anyway as we only really need the pointer to the VPD which is located before the structure length and revision fields. - On Sun QFE (Quad FastEthernet) cards read the Nth MAC-address for the Nth HME controller instead of always the first one for all four HMEs. [1] - Improve the comment describing the used VPD format to better reflect reality. - Minor clean-up. Prodded by: joerg [1]
* Make hme(4) mpsafeyongari2004-11-224-29/+123
| | | | | | | | | | | | | - Let hme_start()/hme_init() acquire lock and then call hme_start_locked()/hme_init_locked() respectivly. - Teardown interrupt handler before hme_detach(). - Remove IFF_NEEDSGIANT flag and mark interrupt handler INTR_MPSAFE. - Set callout handler to CALLOUT_MPSAFE. - Add locks in hme MII interface. Reviewed by: jake Tested by: Julian C. Dunn <jdunn at opentrend dot net> MFC after: 2 weeks
* Make hme(4), i.e. the PCI-variant, MI by reading the MAC address on sytemsmarius2004-08-141-3/+152
| | | | | | | | | | | | | | | without Open Firmware directly instead of using OF_getetheraddr(). This is a bit painful though, as the MAC address is contained in the NA field of the VPD of the EBus bridge, which is is another function of the same chip. To make it worse, the VPD of the EBus bridge can't be accessed via the PCI capability pointer but has to be digged out from the Boot PROM and has a non-standard format. The PCI VPD struct and macros used here should be part of the FreeBSD PCI code nevertheless. Approved by: tmm Based on: NetBSD Tested with: Sun X1032A (hme(4)-isp(4)-combo card) on alpha and i386
* Since if_hme doesn't contain locking or run with INTR_MPSAFE, markrwatson2004-08-131-1/+2
| | | | the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
* - Use bus_space_subregion() rather than arithmetic on bus_space_handle_t. [1]marius2004-08-124-28/+30
| | | | | | | | - Properly use the error variable and return it on failure in the attach- routines. Reviewed by: tmm Inspired by: NetBSD [1]
* - Introduce an ofw_bus kobj-interface for retrieving the OFW node and amarius2004-08-121-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subset ("compatible", "device_type", "model" and "name") of the standard properties in drivers for devices on Open Firmware supported busses. The standard properties "reg", "interrupts" und "address" are not covered by this interface because they are only of interest in the respective bridge code. There's a remaining standard property "status" which is unclear how to support properly but which also isn't used in FreeBSD at present. This ofw_bus kobj-interface allows to replace the various (ebus_get_node(), ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type() vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one. This in turn allows to simplify and remove code-duplication in drivers for devices that can hang off of more than one OFW supported bus. - Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the drivers for their children to use the ofw_bus kobj-interface. The IVAR- interfaces of the Central, EBus and FHC are entirely replaced by this. The PCI bus driver used its own kobj-interface and now also uses the ofw_bus one. The IVARs special to the SBus, e.g. for retrieving the burst size, remain. Beware: this causes an ABI-breakage for modules of drivers which used the IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be recompiled. The style-inconsistencies introduced in some of the bus drivers will be fixed by tmm@ in a generic clean-up of the respective drivers later (he requested to add the changes in the "new" style). - Convert the powerpc MacIO bus driver and the drivers for its children to use the ofw_bus kobj-interface. This invloves removing the IVARs related to the "reg" property which were unused and a leftover from the NetBSD origini of the code. There's no ABI-breakage caused by this because none of these driver are currently built as modules. There are other powerpc bus drivers which can be converted to the ofw_bus kobj-interface, e.g. the PCI bus driver, which should be done together with converting powerpc to use the OFW PCI code from sparc64. - Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take advantage of the ofw_bus kobj-interface and simplify them a bit. Reviewed by: grehan, tmm Approved by: re (scottl) Discussed with: tmm Tested with: Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
* Implement TCP/UDP Transmit/Receive checksum offload.yongari2004-08-054-17/+174
| | | | | | | | | | | Since HME doesn't compensate the checksum for UDP datagram which can yield to 0x0, UDP transmit checksum offload is disabled by default. The UDP Transmit checksum offload can be reactivated by setting special link option link0 with ifconfig(8). Approved by: jake (mentor) Reviewed by: tmm Tested by: Herve Boulouis <amon@sockar.homeip.net>
* Second part of ALTQ driver modifications, covering:mlaier2004-08-011-3/+5
| | | | | | | | | | an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4) Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/ Tested by: Vaidas Damosevicius (an, ath, wi) Roman Divacky (vr) Submitted by: yongari (hme)
* Back out 1.23 until I figure out why it causes Netra t1 100 to no longermarius2004-06-121-1/+1
| | | | | | pass any traffic. Unfortunately this means no full-duplex link with auto- negotiation on hme(4) using DP83840A PHYs again. I really thought I had tested this also on a Netra t1 100...
* - Add a LLADDR() forgotten in the conversion to ether_crc32_le().marius2004-06-101-4/+2
| | | | | | - Remove a variable no longer used after the conversion. - While here, save on another one no longer really necessary after the conversion.
* Replace handrolled CRC calculation with ether_crc32_[lb]e().naddy2004-06-091-18/+2
|
* Add missing <sys/module.h> includes currently relying on nested includephk2004-06-033-0/+3
| | | | in <sys/kernel.h>
* In hme_init() call mii_mediachg() to make sure the current media is set.marius2004-05-291-1/+4
| | | | | | | | This is part 2/2 of fixing autonegotiation on hme(4) using DP83840A PHYs. It appears to also fix the occasional problems to establish a link on hme(4) using LU6612 PHYs and shouldn't hurt on those using QS6612 PHYs. Obtained from: NetBSD
* Remove a redundant include directivescottl2004-05-281-2/+0
|
* Mark the VLAN_MTU capability as initially enabled since it'syar2004-05-231-0/+1
| | | | hardcoded to "ON" for these interfaces.
* We don't need to initialize if_output, ether_ifattach() does itmux2004-05-231-1/+0
| | | | for us.
* Spelling and style fixes.marius2004-05-222-22/+22
| | | | Obtained from: NetBSD
* The Sun hme hardware supposedly supports Tx frames up to 65535 octets,joerg2004-05-061-3/+13
| | | | | | | | | and Rx frames up to 8191 octets, so it is perfectly capable of supporting vlan(4)-style VLAN natively. Thus, make it support VLAN `oversize' frames. Reviewed by: tmm
* Let ether_ifattach() announce our MAC address.mdodd2004-03-201-5/+0
| | | | Submitted by: Marius Strobl <marius@alchemy.franken.de>
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-172-16/+16
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+2
| | | | | | | | | | | | | 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)
OpenPOWER on IntegriCloud