1*4882a593Smuzhiyun/* nicstar.c v0.22 Jawaid Bazyar (bazyar@hypermall.com) 2*4882a593Smuzhiyun * nicstar.c, M. Welsh (matt.welsh@cl.cam.ac.uk) 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Hacked October, 1997 by Jawaid Bazyar, Interlink Advertising Services Inc. 5*4882a593Smuzhiyun * http://www.hypermall.com/ 6*4882a593Smuzhiyun * 10/1/97 - commented out CFG_PHYIE bit - we don't care when the PHY 7*4882a593Smuzhiyun * interrupts us (except possibly for removal/insertion of the cable?) 8*4882a593Smuzhiyun * 10/4/97 - began heavy inline documentation of the code. Corrected typos 9*4882a593Smuzhiyun * and spelling mistakes. 10*4882a593Smuzhiyun * 10/5/97 - added code to handle PHY interrupts, disable PHY on 11*4882a593Smuzhiyun * loss of link, and correctly re-enable PHY when link is 12*4882a593Smuzhiyun * re-established. (put back CFG_PHYIE) 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only. 15*4882a593Smuzhiyun * 16*4882a593Smuzhiyun * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * Linux driver for the IDT77201 NICStAR PCI ATM controller. 19*4882a593Smuzhiyun * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155; 20*4882a593Smuzhiyun * see init_nicstar() for PHY initialization to change this. This driver 21*4882a593Smuzhiyun * expects the Linux ATM stack to support scatter-gather lists 22*4882a593Smuzhiyun * (skb->atm.iovcnt != 0) for Rx skb's passed to vcc->push. 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * Implementing minimal-copy of received data: 25*4882a593Smuzhiyun * IDT always receives data into a small buffer, then large buffers 26*4882a593Smuzhiyun * as needed. This means that data must always be copied to create 27*4882a593Smuzhiyun * the linear buffer needed by most non-ATM protocol stacks (e.g. IP) 28*4882a593Smuzhiyun * Fix is simple: make large buffers large enough to hold entire 29*4882a593Smuzhiyun * SDU, and leave <small_buffer_data> bytes empty at the start. Then 30*4882a593Smuzhiyun * copy small buffer contents to head of large buffer. 31*4882a593Smuzhiyun * Trick is to avoid fragmenting Linux, due to need for a lot of large 32*4882a593Smuzhiyun * buffers. This is done by 2 things: 33*4882a593Smuzhiyun * 1) skb->destructor / skb->atm.recycle_buffer 34*4882a593Smuzhiyun * combined, allow nicstar_free_rx_skb to be called to 35*4882a593Smuzhiyun * recycle large data buffers 36*4882a593Smuzhiyun * 2) skb_clone of received buffers 37*4882a593Smuzhiyun * See nicstar_free_rx_skb and linearize_buffer for implementation 38*4882a593Smuzhiyun * details. 39*4882a593Smuzhiyun * 40*4882a593Smuzhiyun * 41*4882a593Smuzhiyun * 42*4882a593Smuzhiyun * Copyright (c) 1996 University of Cambridge Computer Laboratory 43*4882a593Smuzhiyun * 44*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify 45*4882a593Smuzhiyun * it under the terms of the GNU General Public License as published by 46*4882a593Smuzhiyun * the Free Software Foundation; either version 2 of the License, or 47*4882a593Smuzhiyun * (at your option) any later version. 48*4882a593Smuzhiyun * 49*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, 50*4882a593Smuzhiyun * but WITHOUT ANY WARRANTY; without even the implied warranty of 51*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 52*4882a593Smuzhiyun * GNU General Public License for more details. 53*4882a593Smuzhiyun * 54*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 55*4882a593Smuzhiyun * along with this program; if not, write to the Free Software 56*4882a593Smuzhiyun * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 57*4882a593Smuzhiyun * 58*4882a593Smuzhiyun * M. Welsh, 6 July 1996 59*4882a593Smuzhiyun * 60*4882a593Smuzhiyun * 61*4882a593Smuzhiyun */ 62