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