162306a36Sopenharmony_ci/* nicstar.c  v0.22  Jawaid Bazyar (bazyar@hypermall.com)
262306a36Sopenharmony_ci * nicstar.c, M. Welsh (matt.welsh@cl.cam.ac.uk)
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Hacked October, 1997 by Jawaid Bazyar, Interlink Advertising Services Inc.
562306a36Sopenharmony_ci * 	http://www.hypermall.com/
662306a36Sopenharmony_ci * 10/1/97 - commented out CFG_PHYIE bit - we don't care when the PHY
762306a36Sopenharmony_ci *	interrupts us (except possibly for removal/insertion of the cable?)
862306a36Sopenharmony_ci * 10/4/97 - began heavy inline documentation of the code. Corrected typos
962306a36Sopenharmony_ci *	and spelling mistakes.
1062306a36Sopenharmony_ci * 10/5/97 - added code to handle PHY interrupts, disable PHY on
1162306a36Sopenharmony_ci *	loss of link, and correctly re-enable PHY when link is
1262306a36Sopenharmony_ci *	re-established. (put back CFG_PHYIE)
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *   Modified to work with the IDT7721 nicstar -- AAL5 (tested) only.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * Linux driver for the IDT77201 NICStAR PCI ATM controller.
1962306a36Sopenharmony_ci * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155;
2062306a36Sopenharmony_ci * see init_nicstar() for PHY initialization to change this. This driver
2162306a36Sopenharmony_ci * expects the Linux ATM stack to support scatter-gather lists 
2262306a36Sopenharmony_ci * (skb->atm.iovcnt != 0) for Rx skb's passed to vcc->push.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * Implementing minimal-copy of received data:
2562306a36Sopenharmony_ci *   IDT always receives data into a small buffer, then large buffers
2662306a36Sopenharmony_ci *     as needed. This means that data must always be copied to create
2762306a36Sopenharmony_ci *     the linear buffer needed by most non-ATM protocol stacks (e.g. IP)
2862306a36Sopenharmony_ci *     Fix is simple: make large buffers large enough to hold entire
2962306a36Sopenharmony_ci *     SDU, and leave <small_buffer_data> bytes empty at the start. Then
3062306a36Sopenharmony_ci *     copy small buffer contents to head of large buffer.
3162306a36Sopenharmony_ci *   Trick is to avoid fragmenting Linux, due to need for a lot of large
3262306a36Sopenharmony_ci *     buffers. This is done by 2 things:
3362306a36Sopenharmony_ci *       1) skb->destructor / skb->atm.recycle_buffer
3462306a36Sopenharmony_ci *            combined, allow nicstar_free_rx_skb to be called to
3562306a36Sopenharmony_ci *            recycle large data buffers
3662306a36Sopenharmony_ci *       2) skb_clone of received buffers
3762306a36Sopenharmony_ci *   See nicstar_free_rx_skb and linearize_buffer for implementation
3862306a36Sopenharmony_ci *     details.
3962306a36Sopenharmony_ci *
4062306a36Sopenharmony_ci *
4162306a36Sopenharmony_ci *
4262306a36Sopenharmony_ci * Copyright (c) 1996 University of Cambridge Computer Laboratory
4362306a36Sopenharmony_ci *
4462306a36Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify
4562306a36Sopenharmony_ci *   it under the terms of the GNU General Public License as published by
4662306a36Sopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
4762306a36Sopenharmony_ci *   (at your option) any later version.
4862306a36Sopenharmony_ci * 
4962306a36Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
5062306a36Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
5162306a36Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5262306a36Sopenharmony_ci *   GNU General Public License for more details.
5362306a36Sopenharmony_ci *
5462306a36Sopenharmony_ci *   You should have received a copy of the GNU General Public License
5562306a36Sopenharmony_ci *   along with this program; if not, write to the Free Software
5662306a36Sopenharmony_ci *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5762306a36Sopenharmony_ci *
5862306a36Sopenharmony_ci * M. Welsh, 6 July 1996
5962306a36Sopenharmony_ci *
6062306a36Sopenharmony_ci *
6162306a36Sopenharmony_ci */
62