18c2ecf20Sopenharmony_ci/* nicstar.c  v0.22  Jawaid Bazyar (bazyar@hypermall.com)
28c2ecf20Sopenharmony_ci * nicstar.c, M. Welsh (matt.welsh@cl.cam.ac.uk)
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Hacked October, 1997 by Jawaid Bazyar, Interlink Advertising Services Inc.
58c2ecf20Sopenharmony_ci * 	http://www.hypermall.com/
68c2ecf20Sopenharmony_ci * 10/1/97 - commented out CFG_PHYIE bit - we don't care when the PHY
78c2ecf20Sopenharmony_ci *	interrupts us (except possibly for removal/insertion of the cable?)
88c2ecf20Sopenharmony_ci * 10/4/97 - began heavy inline documentation of the code. Corrected typos
98c2ecf20Sopenharmony_ci *	and spelling mistakes.
108c2ecf20Sopenharmony_ci * 10/5/97 - added code to handle PHY interrupts, disable PHY on
118c2ecf20Sopenharmony_ci *	loss of link, and correctly re-enable PHY when link is
128c2ecf20Sopenharmony_ci *	re-established. (put back CFG_PHYIE)
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *   Modified to work with the IDT7721 nicstar -- AAL5 (tested) only.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * Linux driver for the IDT77201 NICStAR PCI ATM controller.
198c2ecf20Sopenharmony_ci * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155;
208c2ecf20Sopenharmony_ci * see init_nicstar() for PHY initialization to change this. This driver
218c2ecf20Sopenharmony_ci * expects the Linux ATM stack to support scatter-gather lists 
228c2ecf20Sopenharmony_ci * (skb->atm.iovcnt != 0) for Rx skb's passed to vcc->push.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Implementing minimal-copy of received data:
258c2ecf20Sopenharmony_ci *   IDT always receives data into a small buffer, then large buffers
268c2ecf20Sopenharmony_ci *     as needed. This means that data must always be copied to create
278c2ecf20Sopenharmony_ci *     the linear buffer needed by most non-ATM protocol stacks (e.g. IP)
288c2ecf20Sopenharmony_ci *     Fix is simple: make large buffers large enough to hold entire
298c2ecf20Sopenharmony_ci *     SDU, and leave <small_buffer_data> bytes empty at the start. Then
308c2ecf20Sopenharmony_ci *     copy small buffer contents to head of large buffer.
318c2ecf20Sopenharmony_ci *   Trick is to avoid fragmenting Linux, due to need for a lot of large
328c2ecf20Sopenharmony_ci *     buffers. This is done by 2 things:
338c2ecf20Sopenharmony_ci *       1) skb->destructor / skb->atm.recycle_buffer
348c2ecf20Sopenharmony_ci *            combined, allow nicstar_free_rx_skb to be called to
358c2ecf20Sopenharmony_ci *            recycle large data buffers
368c2ecf20Sopenharmony_ci *       2) skb_clone of received buffers
378c2ecf20Sopenharmony_ci *   See nicstar_free_rx_skb and linearize_buffer for implementation
388c2ecf20Sopenharmony_ci *     details.
398c2ecf20Sopenharmony_ci *
408c2ecf20Sopenharmony_ci *
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * Copyright (c) 1996 University of Cambridge Computer Laboratory
438c2ecf20Sopenharmony_ci *
448c2ecf20Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify
458c2ecf20Sopenharmony_ci *   it under the terms of the GNU General Public License as published by
468c2ecf20Sopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
478c2ecf20Sopenharmony_ci *   (at your option) any later version.
488c2ecf20Sopenharmony_ci * 
498c2ecf20Sopenharmony_ci *   This program is distributed in the hope that it will be useful,
508c2ecf20Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
518c2ecf20Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
528c2ecf20Sopenharmony_ci *   GNU General Public License for more details.
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci *   You should have received a copy of the GNU General Public License
558c2ecf20Sopenharmony_ci *   along with this program; if not, write to the Free Software
568c2ecf20Sopenharmony_ci *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
578c2ecf20Sopenharmony_ci *
588c2ecf20Sopenharmony_ci * M. Welsh, 6 July 1996
598c2ecf20Sopenharmony_ci *
608c2ecf20Sopenharmony_ci *
618c2ecf20Sopenharmony_ci */
62