summaryrefslogtreecommitdiff
path: root/sys/dev/ic/midway.c
AgeCommit message (Collapse)Author
2002-03-14First round of __P removal in sysTodd C. Miller
2001-11-06Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.Miod Vallat
(Look ma, I might have broken the tree)
2001-06-27ALTQ'ify network drivers.Kenjiro Cho
- use the new queue macros. - use IFQ_POLL() to peek at the next packet. - use IFQ_IS_EMPTY() for empty check. - drivers should always check if (m == NULL) after IFQ_DEQUEUE(), since it could return NULL even when IFQ_IS_EMPTY() is FALSE under rate-limiting. - drivers are supposed to call if_start from tx complete interrupts (in order to trigger the next dequeue under rate-limiting).
2000-10-09make midway.c (en* driver) work on non-32bit. from kjc@csl.sony.co.jpJun-ichiro itojun Hagino
2000-04-27Remove mtu cruftChris Cappuccio
1999-06-06use __sparc__Theo de Raadt
1999-01-11panic prints a newline for you, don't do it in the panic stringTodd C. Miller
1999-01-11more printf/panic merging, since panic() is stdargAaron Campbell
1998-10-20when transmitting we cannot totally fill the circular buffer (i.e.Theo de Raadt
we can't use up all of the remaining sc->txslot[chan].bfree free bytes) because that would cause the circular buffer read pointer to become equal to the write pointer, thus signaling 'empty buffer' to the hardware and stopping the transmitter. spotted and fixed by Kenjiro Cho <kjc@csl.sony.co.jp>
1997-09-29midway update:chuck
[1] add EN_ENIDMAFIX - the byte-aligner on the ENI version of the card appears to lose under heavy load so avoid using it. see comment in midway.c for full details. note that the Adaptec version of the card works properly under load. detected by Kenjiro Cho <kjc@csl.sony.co.jp> [confirmed by chuck] fix by chuck & kjc [2] update some freebsd specific code [from kjc] [3] for circular buffers: ensure there is always one free slot so that we can easily tell the difference between a full and empty list. re-structure a few loops to reflect this. fixes a problem with mbufs being free'd while still in DMA, and makes drive a bit more robust. detected and fixed by kjc also, pull in the following changes from netbsd: revision 1.29 date: 1997/07/07 22:52:17; author: cgd; state: Exp; lines: +29 -22 fix static inline functions' prototypes so they're correctly marked 'inline' as well as static. mark prototypes for static inline functions as possibly unused (with __attribute__ ((unused))), to avoid generating warnings when compiling without optimization but with most ports' default warning flags. Clean up prototype list spacing, and make it more consistent. --------------------------- revision 1.28 date: 1997/04/28 17:04:06; author: mycroft; state: Exp; lines: +2 -1 Oops; forgot to GC the last mbuf allocated when out of clusters. --------------------------- revision 1.27 date: 1997/04/24 02:25:37; author: mycroft; state: Exp; lines: +2 -2 Do not force the initial part of a packet into a separate mbuf. --------------------------- revision 1.26 date: 1997/04/24 02:24:07; author: mycroft; state: Exp; lines: +6 -3 If we fail to allocate a cluster to hold a large packet, simply drop it rather than using a chain of tiny mbufs.
1997-03-20MAJOR CHANGES: [contributed by Chuck Cranor <chuck@ccrc.wustl.edu> andchuck
Anne Hutton <hutton@isi.edu>]: - add support for Adaptec 155 PCI ATM cards (e.g. ANA-5940) - add sc->is_adaptec to handle differences between cards. - break out MID_MK_TXQ/MID_MK_RXQ seperate macros to handle the new Adaptec format TXQ/RXQ. - adjust en_dqneed to return 1 on ADP (since the Adaptec can DMA anything in one DRQ/DTQ!) - add hook for a bus specific reset function (adaptec has a seperate reset register that needs to be hit when resettting the midway). - adjust DMA test to not worry about burst sizes on the adaptec (since it handles it all for us!) and to handle the new DTQ/DRQ format. - add Adaptec DMA support to en_txlaunch() and en_service() BUG FIXES: - fixed receiver panic under heavy load ("lost mbuf in slot 0!"). when the reassembly buffer overflows, the T-bit is set in the RDB and the data field is empty. en_service() sets up a 4-byte (RDB size) dummy DMA without IF_ENQUEUE. but the recv intr handling in en_intr() always does IF_DEQUEUE. as a result, a successive recv intr loses its mbuf and leads to a panic. the solution is to only IF_DEQUEUE if the interrupt has non-zero length (indicating that there is an mbuf to get). in order for this to work, EN_DQ_MK must always be non-zero. we do this by or'ing in an unused bit (0x80000). reported by: Kenjiro Cho <kjc@csl.sony.co.jp> - fix setting of transmit channel when txspeed[] is non-zero (e.g. traffic shaping). the old scheme didn't work properly (it allowed the same VCI to use multiple tx channels thus defeating the txspeed[] parameter). the new scheme statically assigns a VC to a channel when txspeed[] is set. [note that the code to set txspeed[] isn't in the driver right now since a MI interface to do this hasn't been made yet] we add sc->txvc2slot[] and sc->txslot[n].nref for this. reported by: Kenjiro Cho <kjc@csl.sony.co.jp>, Milind M Buddihikot <milind@ccrc.wustl.edu>, Dong Lin <dong@eecs.harvard.edu> - if aal5 frame has a CRC error then the length field in the aal5 trailer may not be valid, so we can not use it [and we must dump the frame] contributed by: Yuhang Sun <sunyh@dworkin.wustl.edu> & chuck - when doing SRAM copies, be sure to round up the length to the next largest word (otherwise the driver will try to do a byte clean up DMA and then get an ID error interrupt). MINOR CLEANUPS: - add some extra support for a few more versions of FreeBSD contributed by: Kenjiro Cho <kjc@csl.sony.co.jp> - clean up loops in DMA test contributed by: Kenjiro Cho <kjc@csl.sony.co.jp> - restructure and cleanup of en_read/en_write macros/inlines - clean up some byte ordering stuff so that we are consistant throughout the driver
1997-01-24bug fix:chuck
- if aal5 frame has a CRC error then the length field in the aal5 trailer may not be valid, so we can not use it [and we must dump the frame] [Yuhang Sun <sunyh@dworkin.wustl.edu> & chuck@ccrc.wustl.edu]
1996-11-21correct version of last commitchuck
1996-11-21midway fixes:chuck
1. fix possible hang in en_txlaunch(). when attempting to extend the length of an mbuf to avoid a flush we should extend it by cnt [which is ((need - len) % 4)] rather than 4 - cnt. also, add an EN_DEBUG printf() when we pad/FLUSH a buffer to help with debugging/understanding what the driver is up to. 2. use interface packet counters 3. when turning off a recv VCI we recompute the new mode. make sure we don't include the "in service" bit in the new mode, otherwise a VCI may appear "hung" if you turn it off while a service interrupt is pending. 4. when shutting down a VCI that is still receiving data, don't bother going into "drain mode" if only the hardware in service bit is set (otherwise the VCI may get "hung" in drain mode). as a result of this we may get "unexpected rx interrupt" messages which are not really an error, so put this printf in EN_DEBUG. 5. be sure to zero txspeed[lcv] when enabling a VCI (start at full speed). (hooks for setting txspeed[] are currently not in the driver, but we are playing with it locally). credits: #1: Detected by: Zdenek Salvet <salvet@horn.ics.muni.cz>, fix by me. #2: Contributed by: Zdenek Salvet <salvet@horn.ics.muni.cz> #3,#4,#5: Detected by: Milind M. Buddhikot <milind@dworkin.wustl.edu>, fixed by me.
1996-11-12Arrival of new bus.h from NetBSDNiklas Hallqvist
1996-11-12s/bus.h/bus.old.h/ to make the transit to the bus_space bus.h an easy roadNiklas Hallqvist
possibly taken in small steps
1996-11-09netbsd pr#2919 (jukka.partanen@research.nokia.com):chuck
- fix compiler warnings
1996-08-02fix:chuck
- fix memory sizing bug for 2MB cards. driver now works for both 512KB and 2MB ATM cards (we just got 10 2MB cards).
1996-07-17fixes/update:chuck
- adjust txhiwat and mindma params a bit - fixed a couple of incorrectly labeled panic calls - the "location" was being calculated incorrectly in some cases (forgot to subtract off MID_RAMBASE). this only caused problem when trying to change the size of the tx/rx buffers (e.g. to 64KB). - fixed possible non-aligned DMA burst in the starting byte burst case. (e.g. if we could DMA 3 bytes, but only have 2 it is not legal for us to use MIDDMA_BYTE2 mode). - opt: on tx: try and avoid flushing the internal buffer by padding out the length of the last mbuf a bit (if possible)
1996-07-16midway fixes + new stuff:chuck
- alpha changes from cgd - merged multiple DRQ/DTQ ADD macros into a single DRQ and a single DTQ macro with a uniform interface to make the code simpler and easier to read. - en_start: only update atm_flags if EN_MBUF_OPT is enabled (which it should be) - for alburst: make sure we don't DMA more bytes than we need (on both tx and rx). if the alburst is larger than we need, drop to MIDDMA_WORD mode. - major change: enable the use of byte and 2 byte DMA on the trasmit side. this allows us to DMA from non-word sized/aligned mbufs directly. [the old code would always call en_mfix which would copy (or move) the data in order to ensure proper alignment... it turns out TCP gives us non-word sized/aligned mbufs when it is retransmitting, so we needed to handle this case more efficiently.] the following functions were changed to make this work: - en_dqneed: add an arg to let us know if we are transmitting or not. if we are TX, then we must take into account byte DMAs when estimating the number of DTQs we will need for a buffer - en_start: only mfix mbufs if DMA is disabled - en_txdma: only set launch.nodma if we have en_mfix'd the mbuf chain also, we may need a DTQ to flush the chip's internal byte buffer - en_txlaunch: only attempt a copy if we have the proper alignment. add byte dma code for the front and end of the buffer. make sure the internal dma buffer is flushed out. - en_dump: keep track of how many times we have to use byte sized DMA midwayreg: - add byte/2byte DMA defines midwayvar: - add new stat counter to monitor less-than-word lengthed DMA
1996-07-11fix:chuck
- en_mfix shouldn't touch M_EXT mbufs. change to avoid this [at the expense of allocating a new cluster mbuf to copy to]. XXX: en_mfix is getting called more often than I hoped it would (seems to happen when TCP retransmits... we get all sorts of odd sized, odd lengthed data mbufs, yuck). i may revise the xmit DMA code to use non-word sized dma.
1996-07-11fixes:chuck
- don't try and add a PDU trailer (or TBD for that matter) to an M_EXT mbuf. when M_EXT is set, the data area of the mbuf can be shared with other mbufs (see m_copym()), and writing to one M_EXT mbuf may invalidate another M_EXT mbuf (saw this with PDU trailers). - be sure to validate the length value from the PDU trailer so that it doesn't throw us out of sync with the chip (fixes yet another source of the dread "en_service: id mismatch" panic). - on recv, don't bother allocating an mbuf if mlen is zero since we are only going to toss the data anyway.
1996-07-03ported to FreeBSD 2.2-960612-SNAP.chuck
1996-06-29new: add a raw_threshold for raw mode. this basically tells the driverchuck
to ignore inbound data sizes less than the threshold. otherwise, when connected to a video aal0 input the driver gives us a massive stream of 56 byte mbufs each with one aal0 cell in it and the system just can't keep up with it, especially if the socket buffer size is large [it hangs until you turn off the video source]. fixes: when turning off a vc, try and check the freshest copy of the mode when seeing if we need to enter the "drain" state. also, don't panic if we get unexpected rx interrupt on a VCI (instead make sure the VC is off, print a warning, and move on!).
1996-06-29change:chuck
- change rxso into a void handle ... no need to know details at this low level. fix: - forgot to init "vci" during ENOTHER_DRAIN case of RX DMA interrupt [could cause a vm_fault on native mode connection close depending on needing to drain out the VC and also the random value of vci]
1996-06-28new: add all needed hooks to engage raw mode.chuck
1996-06-27fixes/improvements:chuck
- more stat counters (rxmbufout -- mbufs, ttrash -- trashed RBD) - add swsl_size to keep track of size of software slist - revise when we call en_service - fix handling of circular lists (was getting full vs empty confused in extreem cases...) - native mode atm: remove sbappend code: can't do it here since socket buffer is protected only by splsoftnet and that doesn't mask enintr off. forces us to switch to a two level interrupt scheme. revise call to atm_input to reflect that.
1996-06-26fixes:chuck
[1] rxslot "cur" pointer wasn't updated if we copied all data and didn't have any fill. this could cause a service id mismatch panic under load. [2] recv of aal0 forgot to include the cell header in the data length calc [add cell header length to midwayreg.h] [3] fix control info "chop" for raw mode and aal0 [4] handle rxsb better for native atm connections (XXX: still working on this ... not complete and needs revision)
1996-06-21use correct copyrightchuck
1996-06-21device driver from the Efficient Networks "MIDWAY" ATM155 chip.chuck