11da177e4SLinus Torvalds/* nicstar.c v0.22 Jawaid Bazyar (bazyar@hypermall.com) 21da177e4SLinus Torvalds * nicstar.c, M. Welsh (matt.welsh@cl.cam.ac.uk) 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Hacked October, 1997 by Jawaid Bazyar, Interlink Advertising Services Inc. 51da177e4SLinus Torvalds * http://www.hypermall.com/ 61da177e4SLinus Torvalds * 10/1/97 - commented out CFG_PHYIE bit - we don't care when the PHY 71da177e4SLinus Torvalds * interrupts us (except possibly for removal/insertion of the cable?) 81da177e4SLinus Torvalds * 10/4/97 - began heavy inline documentation of the code. Corrected typos 91da177e4SLinus Torvalds * and spelling mistakes. 101da177e4SLinus Torvalds * 10/5/97 - added code to handle PHY interrupts, disable PHY on 111da177e4SLinus Torvalds * loss of link, and correctly re-enable PHY when link is 121da177e4SLinus Torvalds * re-established. (put back CFG_PHYIE) 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds * Modified to work with the IDT7721 nicstar -- AAL5 (tested) only. 151da177e4SLinus Torvalds * 16*7ff6e6f7SAdrian Bunk * R. D. Rechenmacher <ron@fnal.gov>, Aug. 6, 1997 171da177e4SLinus Torvalds * 181da177e4SLinus Torvalds * Linux driver for the IDT77201 NICStAR PCI ATM controller. 191da177e4SLinus Torvalds * PHY component is expected to be 155 Mbps S/UNI-Lite or IDT 77155; 201da177e4SLinus Torvalds * see init_nicstar() for PHY initialization to change this. This driver 211da177e4SLinus Torvalds * expects the Linux ATM stack to support scatter-gather lists 221da177e4SLinus Torvalds * (skb->atm.iovcnt != 0) for Rx skb's passed to vcc->push. 231da177e4SLinus Torvalds * 241da177e4SLinus Torvalds * Implementing minimal-copy of received data: 251da177e4SLinus Torvalds * IDT always receives data into a small buffer, then large buffers 261da177e4SLinus Torvalds * as needed. This means that data must always be copied to create 271da177e4SLinus Torvalds * the linear buffer needed by most non-ATM protocol stacks (e.g. IP) 281da177e4SLinus Torvalds * Fix is simple: make large buffers large enough to hold entire 291da177e4SLinus Torvalds * SDU, and leave <small_buffer_data> bytes empty at the start. Then 301da177e4SLinus Torvalds * copy small buffer contents to head of large buffer. 311da177e4SLinus Torvalds * Trick is to avoid fragmenting Linux, due to need for a lot of large 321da177e4SLinus Torvalds * buffers. This is done by 2 things: 331da177e4SLinus Torvalds * 1) skb->destructor / skb->atm.recycle_buffer 341da177e4SLinus Torvalds * combined, allow nicstar_free_rx_skb to be called to 351da177e4SLinus Torvalds * recycle large data buffers 361da177e4SLinus Torvalds * 2) skb_clone of received buffers 371da177e4SLinus Torvalds * See nicstar_free_rx_skb and linearize_buffer for implementation 381da177e4SLinus Torvalds * details. 391da177e4SLinus Torvalds * 401da177e4SLinus Torvalds * 411da177e4SLinus Torvalds * 421da177e4SLinus Torvalds * Copyright (c) 1996 University of Cambridge Computer Laboratory 431da177e4SLinus Torvalds * 441da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 451da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 461da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 471da177e4SLinus Torvalds * (at your option) any later version. 481da177e4SLinus Torvalds * 491da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 501da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 511da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 521da177e4SLinus Torvalds * GNU General Public License for more details. 531da177e4SLinus Torvalds * 541da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 551da177e4SLinus Torvalds * along with this program; if not, write to the Free Software 561da177e4SLinus Torvalds * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 571da177e4SLinus Torvalds * 581da177e4SLinus Torvalds * M. Welsh, 6 July 1996 591da177e4SLinus Torvalds * 601da177e4SLinus Torvalds * 611da177e4SLinus Torvalds */ 62