Commit Graph

40 Commits

Author SHA1 Message Date
itojun ecb5f2e56a revisit in6_ifattach().
- be persistent on initializing interfaces, even if there's manually-
  assigned linklocal, multicast/whatever initialization is necessary.
- do not cache mac addr in the kernel.  grab mac addr from existing cards
  (this is important when you swap ethernet cards back and forth)
now ppp6 works just fine!

call in6_ifattach() on ATM PVC interface to assign link-local, using
hardware MAC address as seed.

(the change is in sync with kame tree).
2000-04-12 10:36:38 +00:00
itojun 118d2b1d4f IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.
1999-07-01 08:12:45 +00:00
thorpej 1ab6db8e5f Fix printf format problems on Alpha. 1999-02-12 00:50:09 +00:00
chuck ce89209d42 when transmitting we cannot totally fill the circular buffer (i.e.
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>
1998-10-20 17:53:54 +00:00
pk 1f007a13cc Cast bus_size_t to u_long in printf() args. 1998-08-20 11:42:13 +00:00
eeh a2dd74ed79 Merge paddr_t changes into the main branch. 1998-08-13 02:10:37 +00:00
mycroft e2686d0a1b Use splnet, not splimp. 1998-08-08 23:51:39 +00:00
jonathan 3751946b97 defopt INET, NETATALK. 1998-07-05 00:51:04 +00:00
jonathan 466e784ee1 defopt DDB. 1998-07-04 22:18:13 +00:00
thorpej 095c4c092d Adjust for config changes. 1998-01-12 09:23:08 +00:00
chuck d3a7613827 midway update:
[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
1997-09-29 17:40:38 +00:00
cgd 5c2a76b304 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.
1997-07-07 22:52:17 +00:00
mycroft 103c7d360d Oops; forgot to GC the last mbuf allocated when out of clusters. 1997-04-28 17:03:58 +00:00
mycroft 68258fba20 Do not force the initial part of a packet into a separate mbuf. 1997-04-24 02:25:36 +00:00
mycroft 581399fc4c If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
1997-04-24 02:24:04 +00:00
chuck 63c14f2d75 MAJOR CHANGES: [contributed by Chuck Cranor <chuck@ccrc.wustl.edu> and
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>

   - 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:
   - 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-03-20 21:34:42 +00:00
chuck 7df0dbdd33 minor fixes to freebsd code sections from Kenjiro Cho <kjc@csl.sony.co.jp>
get ready to add support for adaptec version of midway card (which
has a different DMA interface).
1997-03-11 23:30:19 +00:00
chuck 16ef494b41 bug fix:
- 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]
1997-01-24 20:58:42 +00:00
chuck ae805c5cbf midway fixes:
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-21 20:49:22 +00:00
chuck 04550d40b6 netbsd pr#2919 (jukka.partanen@research.nokia.com):
- fix compiler warnings
1996-11-09 03:43:29 +00:00
cgd 2ab4192195 update alpha_XXX_dmamap() invocations to match prototype. 1996-10-25 21:33:30 +00:00
cgd 2e7c250f84 update drivers to use the new NetBSD/alpha DMA mapping hack, since
the old one is not workable with the new bus.h.
1996-10-23 04:37:31 +00:00
thorpej 16c4c5af26 New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
	  devices.  It's all "bus space" now, and space tags
	  differentiate the space with finer grain than the
	  bus chipset tag.
	- Add memory barrier methods.
	- Implement space alloc/free methods.
	- Implement region read/write methods (like memcpy to/from
	  bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
1996-10-21 22:24:37 +00:00
christos 86373f8cf9 backout kprintf changes 1996-10-13 01:37:04 +00:00
christos 4c14cd79b2 - printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:18:34 +00:00
chuck 9ee9129dc4 fix:
- fix memory sizing bug for 2MB cards.   driver now works for both 512KB
   and 2MB ATM cards (we just got 10 2MB cards).
1996-08-02 02:55:14 +00:00
chuck b3bed30d80 fixes/update:
- 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-17 03:53:39 +00:00
chuck 1e5c811090 midway fixes + new stuff:
- 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.
    - stats: 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-16 22:11:05 +00:00
cgd effd413ecd before #defining the vtophys() hack for the alpha, #undef vtophys since
it may be a macro.
1996-07-15 16:40:27 +00:00
cgd 8ab5d16b77 insert the normal NetBSD/Alpha vtophys() hack, so that this will compile
and link nicely on the Alpha.  It may even run, if well written.
1996-07-14 20:05:31 +00:00
cgd f632c1cea9 fix bogus casts from pointer to unsigned int. Use unsigned long for this. 1996-07-14 19:36:56 +00:00
chuck 6ae82431b5 fix:
- 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-11 22:48:10 +00:00
chuck 47131b5d81 fixes:
- 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-11 00:15:56 +00:00
chuck db41df67cd ported to FreeBSD 2.2-960612-SNAP. [thanks to Matt Thomas' driver work] 1996-07-03 17:21:58 +00:00
chuck 921ed68fff new: add a raw_threshold for raw mode. this basically tells the driver
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-29 23:23:35 +00:00
chuck 685684df93 change:
- 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-29 20:00:44 +00:00
chuck d8f8995650 new: add all needed hooks to engage raw mode. 1996-06-28 02:32:24 +00:00
chuck ff6f7d186b fixes/improvements:
- 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-27 04:29:40 +00:00
chuck 39b4f89493 fixes:
[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-26 04:08:53 +00:00
chuck ba63d22426 add support for efficient networks midway atm chip. 1996-06-22 01:50:52 +00:00