#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
226995 |
|
01-Nov-2011 |
marius |
- Import the common MII bitbang'ing code from NetBSD and convert drivers to take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 4k. The only potential in-tree user left unconverted is xe(4), which generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just for the MII bitbang'ing code. The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access. - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4). - Sprinkle some const.
Thanks to the following testers: Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4)) Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4).
Reviewed by: yongari (subset of drivers) Obtained from: NetBSD (partially)
|
#
200950 |
|
24-Dec-2009 |
yongari |
Implement RX interrupt moderation using one-shot timer interrupt. Unlike TX interrupt, ST201 does not provide any mechanism to suppress RX interrupts. ste(4) can generate more than 70k RX interrupts under heavy RX traffics such that these excessive interrupts make system useless to process other useful things. Maybe this was the major reason why polling support code was introduced to ste(4). The STE_COUNTDOWN register provides a programmable counter that will generate an interrupt upon its expiration. We program STE_DMACTL register to use 3.2us clock rate to drive the counter register. Whenever ste(4) serves RX interrupt, the driver rearm the timer to expire after STE_IM_RX_TIMER_DEFAULT time and disables further generation of RX interrupts. This trick seems to work well and ste(4) generates less than 8k RX interrupts even under 64 bytes UDP torture test. Combined with TX interrupts, the total number of interrupts are less than 10k which looks reasonable on heavily loaded controller.
The default RX interrupt moderation time is 150us. Users can change the value at any time with dev.ste.%d.int_rx_mod sysctl node. Setting it 0 effectively disables the RX interrupt moderation feature. Now we have both TX/RX interrupt moderation code so remove loop of interrupt handler which resulted in sub-optimal performance as well as more register accesses.
|
#
200913 |
|
23-Dec-2009 |
yongari |
We don't need to generate DMA complete interrupt for every transmitted frames. So request interrupt for every 16th frames. Due to the limitation of hardware we can't suppress the interrupt as driver should have to check TX status register. The TX status register can store up to 31 TX status so driver can't send more than 31 frames without reading TX status register. With this change controller would not generate TX completion interrupt for every frame, so reclaim transmitted frames in ste_tick().
|
#
200912 |
|
23-Dec-2009 |
yongari |
Correct STE_COUNTDOWN register offset. The datasheet was wrong.
|
#
200911 |
|
23-Dec-2009 |
yongari |
Remove unused duplicated register definition. It seems the definition was made to access STE_ASICCTL register as 16bits but ste(4) always access the register as 32bits so it was never used before.
|
#
200910 |
|
23-Dec-2009 |
yongari |
Implement hardware MAC statistics counter support. The counters could be accessed with dev.ste.0.stats sysctl node.
|
#
200884 |
|
22-Dec-2009 |
yongari |
Reimplement Tx status error handler as recommended by datasheet. If ste(4) encounter TX underrun or excessive collisions the TX MAC of controller is stalled so driver should wake it up again. TX underrun requires increasing TX threshold value to minimize further TX underruns. Previously ste(4) used to reset controller to recover from TX underrun, excessive collision and reclaiming error. However datasheet says only TX underrun requires resetting entire controller. So implement ste_restart_tx() that restarts TX MAC and do not perform full reset except TX underrun case. Now ste(4) uses CSR_READ_2 instead of CSR_READ_1 to read STE_TX_STATUS register. This way ste(4) will also read frame id value and we can write the same value back to STE_TX_FRAMEID register instead of overwriting it to 0. The datasheet was wrong in write back of STE_TX_STATUS so add some comments why we do so. Also always invoke ste_txeoc() after ste_txeof() in ste_poll as without reading TX status register can stall TX MAC.
|
#
200877 |
|
22-Dec-2009 |
yongari |
Prefer bus_write_{1,2,4}/bus_read_{1,2,4} to bus_space_write_{1,2,4}/bus_space_read_{1,2,4}. Remove unused ste_bhandle and ste_btag in softc.
|
#
200875 |
|
22-Dec-2009 |
yongari |
Prefer memory space register mapping over io space. If memory space mapping fails fall back to old io space mapping. While I'm here use PCIR_BAR macro.
|
#
200865 |
|
22-Dec-2009 |
yongari |
Reimplement miibus_statchg method. Don't rely on link state change interrupt. If we want to use link state change interrupt ste(4) should also implement auto-negotiation complete handler as well as various PHY access handling. Now link state change is handled by mii(4) polling so it will automatically update link state UP/DOWN events which in turn make ste(4) usable with lagg(4).
r199559 added a private timer to drive watchdog and the timer also used to drive MAC statistics update. Because the MAC statistics update is called whenever statistics counter reaches near-full, it drove watchdog timer too fast such that it caused false watchdog timeouts under heavy TX traffic conditions. Fix the regression by separating ste_stats_update() from driving watchdog timer and introduce a new function ste_tick() that handles periodic job such as driving watchdog, MAC statistics update and link state check etc. While I'm here clear armed watchdog timer in ste_stop().
|
#
200856 |
|
22-Dec-2009 |
yongari |
Introduce sc_flags member variable and use it to keep track of link state and PHY related information. Remove ste_link and ste_one_phy variable of softc as it's not used anymore. While I'm here add IFF_DRV_RUNNING check in ste_start_locked().
|
#
200853 |
|
22-Dec-2009 |
yongari |
Add bus_dma(9) and endianness support to ste(4). o Sorted includes and added missing header files. o Added basic endianness support. In theory ste(4) should work on any architectures. o Remove the use of contigmalloc(9), contigfree(9) and vtophys(9). o Added 8 byte alignment limitation of TX/RX descriptor. o Added 1 byte alignment requirement for TX/RX buffers. o ste(4) controllers does not support DAC. Limit DMA address space to be within 32bit address. o Added spare DMA map to gracefully recover from DMA map failure. o Removed dead code for checking STE_RXSTAT_DMADONE bit. The bit was already checked in each iteration of loop so it can't be true. o Added second argument count to ste_rxeof(). It is used to limit number of iterations done in RX handler. ATM polling is the only consumer. o Removed ste_rxeoc() which was added to address RX stuck issue (cvs rev 1.66). Unlike TX descriptors, ST201 supports chaining descriptors to form a ring for RX descriptors. If RX descriptor chaining is not supported it's possible for controller to stop receiving incoming frames once controller pass the end of RX descriptor which in turn requires driver post new RX descriptors to receive more frames. For TX descriptors which does not support chaning, we exactly do manual chaining in driver by concatenating new descriptors to the end of previous TX chain. Maybe the workaround was borrowed from other drivers that does not support RX descriptor chaining, which is not valid for ST201 controllers. I still have no idea how this address RX stuck issue and I can't reproduce the RX stuck issue on DFE-550TX controller. o Removed hw.ste_rxsyncs sysctl as the workaround was removed. o TX/RX side bus_dmamap_load_mbuf_sg(9) support. o Reimplemented optimized ste_encap(). o Simplified TX logic of ste_start_locked(). o Added comments for TFD/RFD requirements. o Increased number of RX descriptors to 128 from 64. 128 gave much better performance than 64 under high network loads.
|
#
200804 |
|
21-Dec-2009 |
yongari |
Remove trailing white spaces.
|
#
200803 |
|
21-Dec-2009 |
yongari |
s/u_intXX_t/uintXX_t/g
|
#
199559 |
|
19-Nov-2009 |
jhb |
- Add a private timer to drive the transmit watchdog instead of using if_watchdog and if_timer. - Fix some issues in detach for sn(4), ste(4), and ti(4). Primarily this means calling ether_ifdetach() before anything else.
|
#
183714 |
|
09-Oct-2008 |
peter |
Clean out some empty mergeinfo records, presumably by people doing local cp/mv operations. The full repo-relative URL should be specified for the source in these cases.
|
#
181739 |
|
14-Aug-2008 |
imp |
Move the ste driver from sys/pci to sys/dev/ste.
|
#
167407 |
|
10-Mar-2007 |
yongari |
Add new ST201 PCI id.
PR: kern/108150
|
#
158471 |
|
12-May-2006 |
jhb |
Remove various bits of conditional Alpha code and fixup a few comments.
|
#
149646 |
|
30-Aug-2005 |
jhb |
Various locking fixes and mark MPSAFE: - Add locked variants of start(), init(), ifmedia_upd(), and poll() and stop recursing on the driver lock. - Add locking to ifmedia_upd() and ifmedia_sts(). - Use callout_*() instead of timeout/untimeout. - Fix locking in ioctl().
Tested by: Bob Bishop rb at gid dot co dot uk MFC after: 3 days
|
#
149189 |
|
17-Aug-2005 |
jhb |
Use device_printf() and if_printf() and remove ste_unit from the softc.
|
#
147256 |
|
10-Jun-2005 |
brooks |
Stop embedding struct ifnet at the top of driver softcs. Instead the 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
|
#
139825 |
|
07-Jan-2005 |
imp |
/* -> /*- for license, minor formatting changes
|
#
127937 |
|
06-Apr-2004 |
ru |
Actually fix the TX performance with polling(4) enabled by increasing the TX list size from 64 to 128, which is adequate for HZ=1000.
Submitted by: Vsevolod Lobko
|
#
127927 |
|
06-Apr-2004 |
ru |
- Improved the TX performance with polling(4) by only checking the status registers for error conditions and updating statistics when there are cycles left (inspired by the nge(4) driver).
- Removed the TX list counter and the producer/consumer gap; it's enough to just ensure we don't reuse the last (free) descriptor, as the chip may not have read its next pointer yet. If we reuse it, the TX may stall under a heavy TX load with polling enabled.
- Dropped code to recharge the watchdog timer, it's pointless; the watchdog routine will re-init the chip and both RX and TX lists.
|
#
127775 |
|
02-Apr-2004 |
ru |
Performance tuning.
Moved the RX ring resyncing code to ste_rxeoc(), and only run it if we were asked to POLL_AND_CHECK_STATUS, under DEVICE_POLLING. (This significantly reduces the CPU load.)
Improved the RX ring resyncing code by re-checking if the head is still empty before doing resyncing. This mostly affects the DEVICE_POLLING mode, where we run this code periodically. We could start checking with an empty head (well, an empty ring even), and after doing a few iterations, the chip might write a few entries, including the head, and we would bogusly consider this case as requiring resyncing. On a test box, this reduced the number of resyncs done by a factor of 10.
In ste_txeof(sc), only reset the watchdog timer to zero when the TX list is completely empty.
Converted ste_tx_prev_idx to a pointer -- faster.
Removed some bitrot.
|
#
127686 |
|
31-Mar-2004 |
ru |
Added polling(4) support for ste(4).
MFC after: 5 days
|
#
122689 |
|
14-Nov-2003 |
sam |
Drop the driver lock around calls to if_input to avoid a LOR when the packets are immediately returned for sending (e.g. when bridging or packet forwarding). There are more efficient ways to do this but for now use the least intrusive approach.
Reviewed by: imp, rwatson
|
#
108237 |
|
23-Dec-2002 |
phk |
Change the chip description from "DFE-550TX" to "DL10050". The DL10050 chip is used on the 550TX and 580TX cards, probably others as well.
|
#
102113 |
|
19-Aug-2002 |
ambrisko |
Don't read the PCI config space during mii operations. Instead save whether or not we have to limit the PHY detection in the softc structure. Then just check the flag.
Suggested by: jdp Reviewed by: jdp MFC after: 3 days
|
#
101493 |
|
07-Aug-2002 |
ambrisko |
Fixes for the D-Link DFE-580 card.
This is pretty much fixes any issue I can find: - Watchdog timeouts were due to starting the TX DMA engine before we had a packet ready for it. So the first packet sent never got out only if we sent more then one packet at a time did the others make it out and not blow up. Of course reseting the chip then caused us not to transmit the first packet again ie. catch-22. This required logic changes. - Combine interrupts on TX packets being queued up. - Don't keep running around the RX ring since we might get out of sync so only go around once per receive - Let the RX engine recover via the poll interface which is similar to the TX interface. This way the chip wakes up with no effort when we read enough packets. - Do better hand-shaking on RX & TX packets so they don't start of to soon. - Force a duplex setting when the link comes up after an ste_init or it will default to half-duplex and be really slow. This only happens on subsequent ste_init. The first one worked. - Don't call stat_update for every overflow. We only monitor the collisions so the tick interval is good enough for that. Just read in the collision stats to minimize bus reads. - Don't read the miibus every tick since it uses delays and delays are not good for performance. - Tie link events directly to the miibus code so the port gets set correctly if someone changes the port settings. - Reduce the extreme number of {R,T}FD's. They would consume 130K of kernel memory for each NIC. - Set the TX_THRESH to wait for the DMA engine to complete before running the TX FIFO. This hurts peak TX performance but under bi-directional load the DMA engine can't keep up with the FIFO. Testing shows that we end up in the case anyways (a la dc(4) issues but worse since the RX engine hogs everything). - When stopping the card do a reset since the reset verifies the card has stopped. Otherwise on heavy RX load the RX DMA engine is still stuffing packets into memory. If that happens after we free the DMA area memory bits get scribled in memory and bad things happen.
This card still has seemingly unfixable issues under heavy RX load in which the card takes over the PCI bus.
Sponsored by: Vernier Networks MFC after: 1 week
|
#
82214 |
|
23-Aug-2001 |
wpaul |
Fix a bug in the ste_setmulti() routine. The NIC has 4 16-bit multicast hash registers, not 2 32-bit ones. This would prevent the multicasr filter from being programmed correctly in some cases.
|
#
72200 |
|
09-Feb-2001 |
bmilekic |
Change and clean the mutex lock interface.
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)
|
#
67089 |
|
13-Oct-2000 |
wpaul |
Use device_get_nameunit(dev) as the mutex string when calling 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.
|
#
54268 |
|
07-Dec-1999 |
wpaul |
Spruce up the Sundance ST201 driver:
- Convert to using TX descritor polling similar to the xl driver (the ST201 is a clone of the 3c90xB chipset and offers the same transmit polling scheme). This should reduce TX overhad a little.
- Make sure to reset PHY when switching mode, as in the starfire driver.
- Fix instances of free() that should be contigfree().
- Remove dead code.
|
#
51360 |
|
18-Sep-1999 |
wpaul |
Clean up two cases of the alpha vtophys() hack that should be using alpha_XXX_dmamap() but aren't.
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
50130 |
|
21-Aug-1999 |
wpaul |
Remove MII/PHY related junk from here. It's not needed anymore.
|
#
50128 |
|
21-Aug-1999 |
wpaul |
This commit adds device driver support for the Sundance Technologies ST201 PCI fast ethernet controller. Currently, the only card I know that uses this chip is the D-Link DFE-550TX. (Don't ask me where to buy these: the only cards I have are samples sent to me by D-Link.)
This driver is the first to make use of the miibus code once I'm sure it all works together nicely, I'll start converting the other drivers.
The Sundance chip is a clone of the 3Com 3c90x Etherlink XL design only with its own register layout. Support is provided for ifmedia, hardware multicast filtering, bridging and promiscuous mode.
|