8390.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. /* 8390.c: A general NS8390 ethernet driver core for linux. */
  2. /*
  3. Written 1992-94 by Donald Becker.
  4. Copyright 1993 United States Government as represented by the
  5. Director, National Security Agency.
  6. This software may be used and distributed according to the terms
  7. of the GNU General Public License, incorporated herein by reference.
  8. The author may be reached as becker@scyld.com, or C/O
  9. Scyld Computing Corporation
  10. 410 Severn Ave., Suite 210
  11. Annapolis MD 21403
  12. This is the chip-specific code for many 8390-based ethernet adaptors.
  13. This is not a complete driver, it must be combined with board-specific
  14. code such as ne.c, wd.c, 3c503.c, etc.
  15. Seeing how at least eight drivers use this code, (not counting the
  16. PCMCIA ones either) it is easy to break some card by what seems like
  17. a simple innocent change. Please contact me or Donald if you think
  18. you have found something that needs changing. -- PG
  19. Changelog:
  20. Paul Gortmaker : remove set_bit lock, other cleanups.
  21. Paul Gortmaker : add ei_get_8390_hdr() so we can pass skb's to
  22. ei_block_input() for eth_io_copy_and_sum().
  23. Paul Gortmaker : exchange static int ei_pingpong for a #define,
  24. also add better Tx error handling.
  25. Paul Gortmaker : rewrite Rx overrun handling as per NS specs.
  26. Alexey Kuznetsov : use the 8390's six bit hash multicast filter.
  27. Paul Gortmaker : tweak ANK's above multicast changes a bit.
  28. Paul Gortmaker : update packet statistics for v2.1.x
  29. Alan Cox : support arbitary stupid port mappings on the
  30. 68K Macintosh. Support >16bit I/O spaces
  31. Paul Gortmaker : add kmod support for auto-loading of the 8390
  32. module by all drivers that require it.
  33. Alan Cox : Spinlocking work, added 'BUG_83C690'
  34. Paul Gortmaker : Separate out Tx timeout code from Tx path.
  35. Paul Gortmaker : Remove old unused single Tx buffer code.
  36. Hayato Fujiwara : Add m32r support.
  37. Paul Gortmaker : use skb_padto() instead of stack scratch area
  38. Sources:
  39. The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
  40. */
  41. static const char version[] =
  42. "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
  43. #include <linux/module.h>
  44. #include <linux/kernel.h>
  45. #include <linux/jiffies.h>
  46. #include <linux/fs.h>
  47. #include <linux/types.h>
  48. #include <linux/string.h>
  49. #include <linux/bitops.h>
  50. #include <asm/system.h>
  51. #include <asm/uaccess.h>
  52. #include <asm/io.h>
  53. #include <asm/irq.h>
  54. #include <linux/delay.h>
  55. #include <linux/errno.h>
  56. #include <linux/fcntl.h>
  57. #include <linux/in.h>
  58. #include <linux/interrupt.h>
  59. #include <linux/init.h>
  60. #include <linux/crc32.h>
  61. #include <linux/netdevice.h>
  62. #include <linux/etherdevice.h>
  63. #define NS8390_CORE
  64. #include "8390.h"
  65. #define BUG_83C690
  66. /* These are the operational function interfaces to board-specific
  67. routines.
  68. void reset_8390(struct net_device *dev)
  69. Resets the board associated with DEV, including a hardware reset of
  70. the 8390. This is only called when there is a transmit timeout, and
  71. it is always followed by 8390_init().
  72. void block_output(struct net_device *dev, int count, const unsigned char *buf,
  73. int start_page)
  74. Write the COUNT bytes of BUF to the packet buffer at START_PAGE. The
  75. "page" value uses the 8390's 256-byte pages.
  76. void get_8390_hdr(struct net_device *dev, struct e8390_hdr *hdr, int ring_page)
  77. Read the 4 byte, page aligned 8390 header. *If* there is a
  78. subsequent read, it will be of the rest of the packet.
  79. void block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
  80. Read COUNT bytes from the packet buffer into the skb data area. Start
  81. reading from RING_OFFSET, the address as the 8390 sees it. This will always
  82. follow the read of the 8390 header.
  83. */
  84. #define ei_reset_8390 (ei_local->reset_8390)
  85. #define ei_block_output (ei_local->block_output)
  86. #define ei_block_input (ei_local->block_input)
  87. #define ei_get_8390_hdr (ei_local->get_8390_hdr)
  88. /* use 0 for production, 1 for verification, >2 for debug */
  89. #ifndef ei_debug
  90. int ei_debug = 1;
  91. #endif
  92. /* Index to functions. */
  93. static void ei_tx_intr(struct net_device *dev);
  94. static void ei_tx_err(struct net_device *dev);
  95. static void ei_tx_timeout(struct net_device *dev);
  96. static void ei_receive(struct net_device *dev);
  97. static void ei_rx_overrun(struct net_device *dev);
  98. /* Routines generic to NS8390-based boards. */
  99. static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
  100. int start_page);
  101. static void set_multicast_list(struct net_device *dev);
  102. static void do_set_multicast_list(struct net_device *dev);
  103. /*
  104. * SMP and the 8390 setup.
  105. *
  106. * The 8390 isnt exactly designed to be multithreaded on RX/TX. There is
  107. * a page register that controls bank and packet buffer access. We guard
  108. * this with ei_local->page_lock. Nobody should assume or set the page other
  109. * than zero when the lock is not held. Lock holders must restore page 0
  110. * before unlocking. Even pure readers must take the lock to protect in
  111. * page 0.
  112. *
  113. * To make life difficult the chip can also be very slow. We therefore can't
  114. * just use spinlocks. For the longer lockups we disable the irq the device
  115. * sits on and hold the lock. We must hold the lock because there is a dual
  116. * processor case other than interrupts (get stats/set multicast list in
  117. * parallel with each other and transmit).
  118. *
  119. * Note: in theory we can just disable the irq on the card _but_ there is
  120. * a latency on SMP irq delivery. So we can easily go "disable irq" "sync irqs"
  121. * enter lock, take the queued irq. So we waddle instead of flying.
  122. *
  123. * Finally by special arrangement for the purpose of being generally
  124. * annoying the transmit function is called bh atomic. That places
  125. * restrictions on the user context callers as disable_irq won't save
  126. * them.
  127. */
  128. /**
  129. * ei_open - Open/initialize the board.
  130. * @dev: network device to initialize
  131. *
  132. * This routine goes all-out, setting everything
  133. * up anew at each open, even though many of these registers should only
  134. * need to be set once at boot.
  135. */
  136. int ei_open(struct net_device *dev)
  137. {
  138. unsigned long flags;
  139. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  140. /* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout
  141. wrapper that does e.g. media check & then calls ei_tx_timeout. */
  142. if (dev->tx_timeout == NULL)
  143. dev->tx_timeout = ei_tx_timeout;
  144. if (dev->watchdog_timeo <= 0)
  145. dev->watchdog_timeo = TX_TIMEOUT;
  146. /*
  147. * Grab the page lock so we own the register set, then call
  148. * the init function.
  149. */
  150. spin_lock_irqsave(&ei_local->page_lock, flags);
  151. NS8390_init(dev, 1);
  152. /* Set the flag before we drop the lock, That way the IRQ arrives
  153. after its set and we get no silly warnings */
  154. netif_start_queue(dev);
  155. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  156. ei_local->irqlock = 0;
  157. return 0;
  158. }
  159. /**
  160. * ei_close - shut down network device
  161. * @dev: network device to close
  162. *
  163. * Opposite of ei_open(). Only used when "ifconfig <devname> down" is done.
  164. */
  165. int ei_close(struct net_device *dev)
  166. {
  167. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  168. unsigned long flags;
  169. /*
  170. * Hold the page lock during close
  171. */
  172. spin_lock_irqsave(&ei_local->page_lock, flags);
  173. NS8390_init(dev, 0);
  174. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  175. netif_stop_queue(dev);
  176. return 0;
  177. }
  178. /**
  179. * ei_tx_timeout - handle transmit time out condition
  180. * @dev: network device which has apparently fallen asleep
  181. *
  182. * Called by kernel when device never acknowledges a transmit has
  183. * completed (or failed) - i.e. never posted a Tx related interrupt.
  184. */
  185. void ei_tx_timeout(struct net_device *dev)
  186. {
  187. long e8390_base = dev->base_addr;
  188. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  189. int txsr, isr, tickssofar = jiffies - dev->trans_start;
  190. unsigned long flags;
  191. #if defined(CONFIG_M32R) && defined(CONFIG_SMP)
  192. unsigned long icucr;
  193. local_irq_save(flags);
  194. icucr = inl(M32R_ICU_CR1_PORTL);
  195. icucr |= M32R_ICUCR_ISMOD11;
  196. outl(icucr, M32R_ICU_CR1_PORTL);
  197. local_irq_restore(flags);
  198. #endif
  199. ei_local->stat.tx_errors++;
  200. spin_lock_irqsave(&ei_local->page_lock, flags);
  201. txsr = inb(e8390_base+EN0_TSR);
  202. isr = inb(e8390_base+EN0_ISR);
  203. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  204. printk(KERN_DEBUG "%s: Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
  205. dev->name, (txsr & ENTSR_ABT) ? "excess collisions." :
  206. (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar);
  207. if (!isr && !ei_local->stat.tx_packets)
  208. {
  209. /* The 8390 probably hasn't gotten on the cable yet. */
  210. ei_local->interface_num ^= 1; /* Try a different xcvr. */
  211. }
  212. /* Ugly but a reset can be slow, yet must be protected */
  213. disable_irq_nosync_lockdep(dev->irq);
  214. spin_lock(&ei_local->page_lock);
  215. /* Try to restart the card. Perhaps the user has fixed something. */
  216. ei_reset_8390(dev);
  217. NS8390_init(dev, 1);
  218. spin_unlock(&ei_local->page_lock);
  219. enable_irq_lockdep(dev->irq);
  220. netif_wake_queue(dev);
  221. }
  222. /**
  223. * ei_start_xmit - begin packet transmission
  224. * @skb: packet to be sent
  225. * @dev: network device to which packet is sent
  226. *
  227. * Sends a packet to an 8390 network device.
  228. */
  229. static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
  230. {
  231. long e8390_base = dev->base_addr;
  232. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  233. int send_length = skb->len, output_page;
  234. unsigned long flags;
  235. char buf[ETH_ZLEN];
  236. char *data = skb->data;
  237. if (skb->len < ETH_ZLEN) {
  238. memset(buf, 0, ETH_ZLEN); /* more efficient than doing just the needed bits */
  239. memcpy(buf, data, skb->len);
  240. send_length = ETH_ZLEN;
  241. data = buf;
  242. }
  243. /* Mask interrupts from the ethercard.
  244. SMP: We have to grab the lock here otherwise the IRQ handler
  245. on another CPU can flip window and race the IRQ mask set. We end
  246. up trashing the mcast filter not disabling irqs if we don't lock */
  247. spin_lock_irqsave(&ei_local->page_lock, flags);
  248. outb_p(0x00, e8390_base + EN0_IMR);
  249. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  250. /*
  251. * Slow phase with lock held.
  252. */
  253. disable_irq_nosync_lockdep_irqsave(dev->irq, &flags);
  254. spin_lock(&ei_local->page_lock);
  255. ei_local->irqlock = 1;
  256. /*
  257. * We have two Tx slots available for use. Find the first free
  258. * slot, and then perform some sanity checks. With two Tx bufs,
  259. * you get very close to transmitting back-to-back packets. With
  260. * only one Tx buf, the transmitter sits idle while you reload the
  261. * card, leaving a substantial gap between each transmitted packet.
  262. */
  263. if (ei_local->tx1 == 0)
  264. {
  265. output_page = ei_local->tx_start_page;
  266. ei_local->tx1 = send_length;
  267. if (ei_debug && ei_local->tx2 > 0)
  268. printk(KERN_DEBUG "%s: idle transmitter tx2=%d, lasttx=%d, txing=%d.\n",
  269. dev->name, ei_local->tx2, ei_local->lasttx, ei_local->txing);
  270. }
  271. else if (ei_local->tx2 == 0)
  272. {
  273. output_page = ei_local->tx_start_page + TX_PAGES/2;
  274. ei_local->tx2 = send_length;
  275. if (ei_debug && ei_local->tx1 > 0)
  276. printk(KERN_DEBUG "%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n",
  277. dev->name, ei_local->tx1, ei_local->lasttx, ei_local->txing);
  278. }
  279. else
  280. { /* We should never get here. */
  281. if (ei_debug)
  282. printk(KERN_DEBUG "%s: No Tx buffers free! tx1=%d tx2=%d last=%d\n",
  283. dev->name, ei_local->tx1, ei_local->tx2, ei_local->lasttx);
  284. ei_local->irqlock = 0;
  285. netif_stop_queue(dev);
  286. outb_p(ENISR_ALL, e8390_base + EN0_IMR);
  287. spin_unlock(&ei_local->page_lock);
  288. enable_irq_lockdep_irqrestore(dev->irq, &flags);
  289. ei_local->stat.tx_errors++;
  290. return 1;
  291. }
  292. /*
  293. * Okay, now upload the packet and trigger a send if the transmitter
  294. * isn't already sending. If it is busy, the interrupt handler will
  295. * trigger the send later, upon receiving a Tx done interrupt.
  296. */
  297. ei_block_output(dev, send_length, data, output_page);
  298. if (! ei_local->txing)
  299. {
  300. ei_local->txing = 1;
  301. NS8390_trigger_send(dev, send_length, output_page);
  302. dev->trans_start = jiffies;
  303. if (output_page == ei_local->tx_start_page)
  304. {
  305. ei_local->tx1 = -1;
  306. ei_local->lasttx = -1;
  307. }
  308. else
  309. {
  310. ei_local->tx2 = -1;
  311. ei_local->lasttx = -2;
  312. }
  313. }
  314. else ei_local->txqueue++;
  315. if (ei_local->tx1 && ei_local->tx2)
  316. netif_stop_queue(dev);
  317. else
  318. netif_start_queue(dev);
  319. /* Turn 8390 interrupts back on. */
  320. ei_local->irqlock = 0;
  321. outb_p(ENISR_ALL, e8390_base + EN0_IMR);
  322. spin_unlock(&ei_local->page_lock);
  323. enable_irq_lockdep_irqrestore(dev->irq, &flags);
  324. dev_kfree_skb (skb);
  325. ei_local->stat.tx_bytes += send_length;
  326. return 0;
  327. }
  328. /**
  329. * ei_interrupt - handle the interrupts from an 8390
  330. * @irq: interrupt number
  331. * @dev_id: a pointer to the net_device
  332. *
  333. * Handle the ether interface interrupts. We pull packets from
  334. * the 8390 via the card specific functions and fire them at the networking
  335. * stack. We also handle transmit completions and wake the transmit path if
  336. * necessary. We also update the counters and do other housekeeping as
  337. * needed.
  338. */
  339. irqreturn_t ei_interrupt(int irq, void *dev_id)
  340. {
  341. struct net_device *dev = dev_id;
  342. long e8390_base;
  343. int interrupts, nr_serviced = 0;
  344. struct ei_device *ei_local;
  345. e8390_base = dev->base_addr;
  346. ei_local = netdev_priv(dev);
  347. /*
  348. * Protect the irq test too.
  349. */
  350. spin_lock(&ei_local->page_lock);
  351. if (ei_local->irqlock)
  352. {
  353. #if 1 /* This might just be an interrupt for a PCI device sharing this line */
  354. /* The "irqlock" check is only for testing. */
  355. printk(ei_local->irqlock
  356. ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
  357. : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
  358. dev->name, inb_p(e8390_base + EN0_ISR),
  359. inb_p(e8390_base + EN0_IMR));
  360. #endif
  361. spin_unlock(&ei_local->page_lock);
  362. return IRQ_NONE;
  363. }
  364. /* Change to page 0 and read the intr status reg. */
  365. outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
  366. if (ei_debug > 3)
  367. printk(KERN_DEBUG "%s: interrupt(isr=%#2.2x).\n", dev->name,
  368. inb_p(e8390_base + EN0_ISR));
  369. /* !!Assumption!! -- we stay in page 0. Don't break this. */
  370. while ((interrupts = inb_p(e8390_base + EN0_ISR)) != 0
  371. && ++nr_serviced < MAX_SERVICE)
  372. {
  373. if (!netif_running(dev)) {
  374. printk(KERN_WARNING "%s: interrupt from stopped card\n", dev->name);
  375. /* rmk - acknowledge the interrupts */
  376. outb_p(interrupts, e8390_base + EN0_ISR);
  377. interrupts = 0;
  378. break;
  379. }
  380. if (interrupts & ENISR_OVER)
  381. ei_rx_overrun(dev);
  382. else if (interrupts & (ENISR_RX+ENISR_RX_ERR))
  383. {
  384. /* Got a good (?) packet. */
  385. ei_receive(dev);
  386. }
  387. /* Push the next to-transmit packet through. */
  388. if (interrupts & ENISR_TX)
  389. ei_tx_intr(dev);
  390. else if (interrupts & ENISR_TX_ERR)
  391. ei_tx_err(dev);
  392. if (interrupts & ENISR_COUNTERS)
  393. {
  394. ei_local->stat.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0);
  395. ei_local->stat.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1);
  396. ei_local->stat.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2);
  397. outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR); /* Ack intr. */
  398. }
  399. /* Ignore any RDC interrupts that make it back to here. */
  400. if (interrupts & ENISR_RDC)
  401. {
  402. outb_p(ENISR_RDC, e8390_base + EN0_ISR);
  403. }
  404. outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
  405. }
  406. if (interrupts && ei_debug)
  407. {
  408. outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
  409. if (nr_serviced >= MAX_SERVICE)
  410. {
  411. /* 0xFF is valid for a card removal */
  412. if(interrupts!=0xFF)
  413. printk(KERN_WARNING "%s: Too much work at interrupt, status %#2.2x\n",
  414. dev->name, interrupts);
  415. outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
  416. } else {
  417. printk(KERN_WARNING "%s: unknown interrupt %#2x\n", dev->name, interrupts);
  418. outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */
  419. }
  420. }
  421. spin_unlock(&ei_local->page_lock);
  422. return IRQ_RETVAL(nr_serviced > 0);
  423. }
  424. #ifdef CONFIG_NET_POLL_CONTROLLER
  425. void ei_poll(struct net_device *dev)
  426. {
  427. disable_irq_lockdep(dev->irq);
  428. ei_interrupt(dev->irq, dev);
  429. enable_irq_lockdep(dev->irq);
  430. }
  431. #endif
  432. /**
  433. * ei_tx_err - handle transmitter error
  434. * @dev: network device which threw the exception
  435. *
  436. * A transmitter error has happened. Most likely excess collisions (which
  437. * is a fairly normal condition). If the error is one where the Tx will
  438. * have been aborted, we try and send another one right away, instead of
  439. * letting the failed packet sit and collect dust in the Tx buffer. This
  440. * is a much better solution as it avoids kernel based Tx timeouts, and
  441. * an unnecessary card reset.
  442. *
  443. * Called with lock held.
  444. */
  445. static void ei_tx_err(struct net_device *dev)
  446. {
  447. long e8390_base = dev->base_addr;
  448. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  449. unsigned char txsr = inb_p(e8390_base+EN0_TSR);
  450. unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
  451. #ifdef VERBOSE_ERROR_DUMP
  452. printk(KERN_DEBUG "%s: transmitter error (%#2x): ", dev->name, txsr);
  453. if (txsr & ENTSR_ABT)
  454. printk("excess-collisions ");
  455. if (txsr & ENTSR_ND)
  456. printk("non-deferral ");
  457. if (txsr & ENTSR_CRS)
  458. printk("lost-carrier ");
  459. if (txsr & ENTSR_FU)
  460. printk("FIFO-underrun ");
  461. if (txsr & ENTSR_CDH)
  462. printk("lost-heartbeat ");
  463. printk("\n");
  464. #endif
  465. outb_p(ENISR_TX_ERR, e8390_base + EN0_ISR); /* Ack intr. */
  466. if (tx_was_aborted)
  467. ei_tx_intr(dev);
  468. else
  469. {
  470. ei_local->stat.tx_errors++;
  471. if (txsr & ENTSR_CRS) ei_local->stat.tx_carrier_errors++;
  472. if (txsr & ENTSR_CDH) ei_local->stat.tx_heartbeat_errors++;
  473. if (txsr & ENTSR_OWC) ei_local->stat.tx_window_errors++;
  474. }
  475. }
  476. /**
  477. * ei_tx_intr - transmit interrupt handler
  478. * @dev: network device for which tx intr is handled
  479. *
  480. * We have finished a transmit: check for errors and then trigger the next
  481. * packet to be sent. Called with lock held.
  482. */
  483. static void ei_tx_intr(struct net_device *dev)
  484. {
  485. long e8390_base = dev->base_addr;
  486. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  487. int status = inb(e8390_base + EN0_TSR);
  488. outb_p(ENISR_TX, e8390_base + EN0_ISR); /* Ack intr. */
  489. /*
  490. * There are two Tx buffers, see which one finished, and trigger
  491. * the send of another one if it exists.
  492. */
  493. ei_local->txqueue--;
  494. if (ei_local->tx1 < 0)
  495. {
  496. if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
  497. printk(KERN_ERR "%s: bogus last_tx_buffer %d, tx1=%d.\n",
  498. ei_local->name, ei_local->lasttx, ei_local->tx1);
  499. ei_local->tx1 = 0;
  500. if (ei_local->tx2 > 0)
  501. {
  502. ei_local->txing = 1;
  503. NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
  504. dev->trans_start = jiffies;
  505. ei_local->tx2 = -1,
  506. ei_local->lasttx = 2;
  507. }
  508. else ei_local->lasttx = 20, ei_local->txing = 0;
  509. }
  510. else if (ei_local->tx2 < 0)
  511. {
  512. if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
  513. printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
  514. ei_local->name, ei_local->lasttx, ei_local->tx2);
  515. ei_local->tx2 = 0;
  516. if (ei_local->tx1 > 0)
  517. {
  518. ei_local->txing = 1;
  519. NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
  520. dev->trans_start = jiffies;
  521. ei_local->tx1 = -1;
  522. ei_local->lasttx = 1;
  523. }
  524. else
  525. ei_local->lasttx = 10, ei_local->txing = 0;
  526. }
  527. // else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n",
  528. // dev->name, ei_local->lasttx);
  529. /* Minimize Tx latency: update the statistics after we restart TXing. */
  530. if (status & ENTSR_COL)
  531. ei_local->stat.collisions++;
  532. if (status & ENTSR_PTX)
  533. ei_local->stat.tx_packets++;
  534. else
  535. {
  536. ei_local->stat.tx_errors++;
  537. if (status & ENTSR_ABT)
  538. {
  539. ei_local->stat.tx_aborted_errors++;
  540. ei_local->stat.collisions += 16;
  541. }
  542. if (status & ENTSR_CRS)
  543. ei_local->stat.tx_carrier_errors++;
  544. if (status & ENTSR_FU)
  545. ei_local->stat.tx_fifo_errors++;
  546. if (status & ENTSR_CDH)
  547. ei_local->stat.tx_heartbeat_errors++;
  548. if (status & ENTSR_OWC)
  549. ei_local->stat.tx_window_errors++;
  550. }
  551. netif_wake_queue(dev);
  552. }
  553. /**
  554. * ei_receive - receive some packets
  555. * @dev: network device with which receive will be run
  556. *
  557. * We have a good packet(s), get it/them out of the buffers.
  558. * Called with lock held.
  559. */
  560. static void ei_receive(struct net_device *dev)
  561. {
  562. long e8390_base = dev->base_addr;
  563. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  564. unsigned char rxing_page, this_frame, next_frame;
  565. unsigned short current_offset;
  566. int rx_pkt_count = 0;
  567. struct e8390_pkt_hdr rx_frame;
  568. int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page;
  569. while (++rx_pkt_count < 10)
  570. {
  571. int pkt_len, pkt_stat;
  572. /* Get the rx page (incoming packet pointer). */
  573. outb_p(E8390_NODMA+E8390_PAGE1, e8390_base + E8390_CMD);
  574. rxing_page = inb_p(e8390_base + EN1_CURPAG);
  575. outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
  576. /* Remove one frame from the ring. Boundary is always a page behind. */
  577. this_frame = inb_p(e8390_base + EN0_BOUNDARY) + 1;
  578. if (this_frame >= ei_local->stop_page)
  579. this_frame = ei_local->rx_start_page;
  580. /* Someday we'll omit the previous, iff we never get this message.
  581. (There is at least one clone claimed to have a problem.)
  582. Keep quiet if it looks like a card removal. One problem here
  583. is that some clones crash in roughly the same way.
  584. */
  585. if (ei_debug > 0 && this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF))
  586. printk(KERN_ERR "%s: mismatched read page pointers %2x vs %2x.\n",
  587. dev->name, this_frame, ei_local->current_page);
  588. if (this_frame == rxing_page) /* Read all the frames? */
  589. break; /* Done for now */
  590. current_offset = this_frame << 8;
  591. ei_get_8390_hdr(dev, &rx_frame, this_frame);
  592. pkt_len = rx_frame.count - sizeof(struct e8390_pkt_hdr);
  593. pkt_stat = rx_frame.status;
  594. next_frame = this_frame + 1 + ((pkt_len+4)>>8);
  595. /* Check for bogosity warned by 3c503 book: the status byte is never
  596. written. This happened a lot during testing! This code should be
  597. cleaned up someday. */
  598. if (rx_frame.next != next_frame
  599. && rx_frame.next != next_frame + 1
  600. && rx_frame.next != next_frame - num_rx_pages
  601. && rx_frame.next != next_frame + 1 - num_rx_pages) {
  602. ei_local->current_page = rxing_page;
  603. outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY);
  604. ei_local->stat.rx_errors++;
  605. continue;
  606. }
  607. if (pkt_len < 60 || pkt_len > 1518)
  608. {
  609. if (ei_debug)
  610. printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n",
  611. dev->name, rx_frame.count, rx_frame.status,
  612. rx_frame.next);
  613. ei_local->stat.rx_errors++;
  614. ei_local->stat.rx_length_errors++;
  615. }
  616. else if ((pkt_stat & 0x0F) == ENRSR_RXOK)
  617. {
  618. struct sk_buff *skb;
  619. skb = dev_alloc_skb(pkt_len+2);
  620. if (skb == NULL)
  621. {
  622. if (ei_debug > 1)
  623. printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
  624. dev->name, pkt_len);
  625. ei_local->stat.rx_dropped++;
  626. break;
  627. }
  628. else
  629. {
  630. skb_reserve(skb,2); /* IP headers on 16 byte boundaries */
  631. skb->dev = dev;
  632. skb_put(skb, pkt_len); /* Make room */
  633. ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));
  634. skb->protocol=eth_type_trans(skb,dev);
  635. netif_rx(skb);
  636. dev->last_rx = jiffies;
  637. ei_local->stat.rx_packets++;
  638. ei_local->stat.rx_bytes += pkt_len;
  639. if (pkt_stat & ENRSR_PHY)
  640. ei_local->stat.multicast++;
  641. }
  642. }
  643. else
  644. {
  645. if (ei_debug)
  646. printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n",
  647. dev->name, rx_frame.status, rx_frame.next,
  648. rx_frame.count);
  649. ei_local->stat.rx_errors++;
  650. /* NB: The NIC counts CRC, frame and missed errors. */
  651. if (pkt_stat & ENRSR_FO)
  652. ei_local->stat.rx_fifo_errors++;
  653. }
  654. next_frame = rx_frame.next;
  655. /* This _should_ never happen: it's here for avoiding bad clones. */
  656. if (next_frame >= ei_local->stop_page) {
  657. printk("%s: next frame inconsistency, %#2x\n", dev->name,
  658. next_frame);
  659. next_frame = ei_local->rx_start_page;
  660. }
  661. ei_local->current_page = next_frame;
  662. outb_p(next_frame-1, e8390_base+EN0_BOUNDARY);
  663. }
  664. /* We used to also ack ENISR_OVER here, but that would sometimes mask
  665. a real overrun, leaving the 8390 in a stopped state with rec'vr off. */
  666. outb_p(ENISR_RX+ENISR_RX_ERR, e8390_base+EN0_ISR);
  667. return;
  668. }
  669. /**
  670. * ei_rx_overrun - handle receiver overrun
  671. * @dev: network device which threw exception
  672. *
  673. * We have a receiver overrun: we have to kick the 8390 to get it started
  674. * again. Problem is that you have to kick it exactly as NS prescribes in
  675. * the updated datasheets, or "the NIC may act in an unpredictable manner."
  676. * This includes causing "the NIC to defer indefinitely when it is stopped
  677. * on a busy network." Ugh.
  678. * Called with lock held. Don't call this with the interrupts off or your
  679. * computer will hate you - it takes 10ms or so.
  680. */
  681. static void ei_rx_overrun(struct net_device *dev)
  682. {
  683. long e8390_base = dev->base_addr;
  684. unsigned char was_txing, must_resend = 0;
  685. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  686. /*
  687. * Record whether a Tx was in progress and then issue the
  688. * stop command.
  689. */
  690. was_txing = inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
  691. outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
  692. if (ei_debug > 1)
  693. printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name);
  694. ei_local->stat.rx_over_errors++;
  695. /*
  696. * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
  697. * Early datasheets said to poll the reset bit, but now they say that
  698. * it "is not a reliable indicator and subsequently should be ignored."
  699. * We wait at least 10ms.
  700. */
  701. mdelay(10);
  702. /*
  703. * Reset RBCR[01] back to zero as per magic incantation.
  704. */
  705. outb_p(0x00, e8390_base+EN0_RCNTLO);
  706. outb_p(0x00, e8390_base+EN0_RCNTHI);
  707. /*
  708. * See if any Tx was interrupted or not. According to NS, this
  709. * step is vital, and skipping it will cause no end of havoc.
  710. */
  711. if (was_txing)
  712. {
  713. unsigned char tx_completed = inb_p(e8390_base+EN0_ISR) & (ENISR_TX+ENISR_TX_ERR);
  714. if (!tx_completed)
  715. must_resend = 1;
  716. }
  717. /*
  718. * Have to enter loopback mode and then restart the NIC before
  719. * you are allowed to slurp packets up off the ring.
  720. */
  721. outb_p(E8390_TXOFF, e8390_base + EN0_TXCR);
  722. outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START, e8390_base + E8390_CMD);
  723. /*
  724. * Clear the Rx ring of all the debris, and ack the interrupt.
  725. */
  726. ei_receive(dev);
  727. outb_p(ENISR_OVER, e8390_base+EN0_ISR);
  728. /*
  729. * Leave loopback mode, and resend any packet that got stopped.
  730. */
  731. outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR);
  732. if (must_resend)
  733. outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START + E8390_TRANS, e8390_base + E8390_CMD);
  734. }
  735. /*
  736. * Collect the stats. This is called unlocked and from several contexts.
  737. */
  738. static struct net_device_stats *get_stats(struct net_device *dev)
  739. {
  740. long ioaddr = dev->base_addr;
  741. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  742. unsigned long flags;
  743. /* If the card is stopped, just return the present stats. */
  744. if (!netif_running(dev))
  745. return &ei_local->stat;
  746. spin_lock_irqsave(&ei_local->page_lock,flags);
  747. /* Read the counter registers, assuming we are in page 0. */
  748. ei_local->stat.rx_frame_errors += inb_p(ioaddr + EN0_COUNTER0);
  749. ei_local->stat.rx_crc_errors += inb_p(ioaddr + EN0_COUNTER1);
  750. ei_local->stat.rx_missed_errors+= inb_p(ioaddr + EN0_COUNTER2);
  751. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  752. return &ei_local->stat;
  753. }
  754. /*
  755. * Form the 64 bit 8390 multicast table from the linked list of addresses
  756. * associated with this dev structure.
  757. */
  758. static inline void make_mc_bits(u8 *bits, struct net_device *dev)
  759. {
  760. struct dev_mc_list *dmi;
  761. for (dmi=dev->mc_list; dmi; dmi=dmi->next)
  762. {
  763. u32 crc;
  764. if (dmi->dmi_addrlen != ETH_ALEN)
  765. {
  766. printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name);
  767. continue;
  768. }
  769. crc = ether_crc(ETH_ALEN, dmi->dmi_addr);
  770. /*
  771. * The 8390 uses the 6 most significant bits of the
  772. * CRC to index the multicast table.
  773. */
  774. bits[crc>>29] |= (1<<((crc>>26)&7));
  775. }
  776. }
  777. /**
  778. * do_set_multicast_list - set/clear multicast filter
  779. * @dev: net device for which multicast filter is adjusted
  780. *
  781. * Set or clear the multicast filter for this adaptor. May be called
  782. * from a BH in 2.1.x. Must be called with lock held.
  783. */
  784. static void do_set_multicast_list(struct net_device *dev)
  785. {
  786. long e8390_base = dev->base_addr;
  787. int i;
  788. struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev);
  789. if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI)))
  790. {
  791. memset(ei_local->mcfilter, 0, 8);
  792. if (dev->mc_list)
  793. make_mc_bits(ei_local->mcfilter, dev);
  794. }
  795. else
  796. memset(ei_local->mcfilter, 0xFF, 8); /* mcast set to accept-all */
  797. /*
  798. * DP8390 manuals don't specify any magic sequence for altering
  799. * the multicast regs on an already running card. To be safe, we
  800. * ensure multicast mode is off prior to loading up the new hash
  801. * table. If this proves to be not enough, we can always resort
  802. * to stopping the NIC, loading the table and then restarting.
  803. *
  804. * Bug Alert! The MC regs on the SMC 83C690 (SMC Elite and SMC
  805. * Elite16) appear to be write-only. The NS 8390 data sheet lists
  806. * them as r/w so this is a bug. The SMC 83C790 (SMC Ultra and
  807. * Ultra32 EISA) appears to have this bug fixed.
  808. */
  809. if (netif_running(dev))
  810. outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
  811. outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
  812. for(i = 0; i < 8; i++)
  813. {
  814. outb_p(ei_local->mcfilter[i], e8390_base + EN1_MULT_SHIFT(i));
  815. #ifndef BUG_83C690
  816. if(inb_p(e8390_base + EN1_MULT_SHIFT(i))!=ei_local->mcfilter[i])
  817. printk(KERN_ERR "Multicast filter read/write mismap %d\n",i);
  818. #endif
  819. }
  820. outb_p(E8390_NODMA + E8390_PAGE0, e8390_base + E8390_CMD);
  821. if(dev->flags&IFF_PROMISC)
  822. outb_p(E8390_RXCONFIG | 0x18, e8390_base + EN0_RXCR);
  823. else if(dev->flags&IFF_ALLMULTI || dev->mc_list)
  824. outb_p(E8390_RXCONFIG | 0x08, e8390_base + EN0_RXCR);
  825. else
  826. outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
  827. }
  828. /*
  829. * Called without lock held. This is invoked from user context and may
  830. * be parallel to just about everything else. Its also fairly quick and
  831. * not called too often. Must protect against both bh and irq users
  832. */
  833. static void set_multicast_list(struct net_device *dev)
  834. {
  835. unsigned long flags;
  836. struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev);
  837. spin_lock_irqsave(&ei_local->page_lock, flags);
  838. do_set_multicast_list(dev);
  839. spin_unlock_irqrestore(&ei_local->page_lock, flags);
  840. }
  841. /**
  842. * ethdev_setup - init rest of 8390 device struct
  843. * @dev: network device structure to init
  844. *
  845. * Initialize the rest of the 8390 device structure. Do NOT __init
  846. * this, as it is used by 8390 based modular drivers too.
  847. */
  848. static void ethdev_setup(struct net_device *dev)
  849. {
  850. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  851. if (ei_debug > 1)
  852. printk(version);
  853. dev->hard_start_xmit = &ei_start_xmit;
  854. dev->get_stats = get_stats;
  855. dev->set_multicast_list = &set_multicast_list;
  856. ether_setup(dev);
  857. spin_lock_init(&ei_local->page_lock);
  858. }
  859. /**
  860. * alloc_ei_netdev - alloc_etherdev counterpart for 8390
  861. * @size: extra bytes to allocate
  862. *
  863. * Allocate 8390-specific net_device.
  864. */
  865. struct net_device *__alloc_ei_netdev(int size)
  866. {
  867. return alloc_netdev(sizeof(struct ei_device) + size, "eth%d",
  868. ethdev_setup);
  869. }
  870. /* This page of functions should be 8390 generic */
  871. /* Follow National Semi's recommendations for initializing the "NIC". */
  872. /**
  873. * NS8390_init - initialize 8390 hardware
  874. * @dev: network device to initialize
  875. * @startp: boolean. non-zero value to initiate chip processing
  876. *
  877. * Must be called with lock held.
  878. */
  879. void NS8390_init(struct net_device *dev, int startp)
  880. {
  881. long e8390_base = dev->base_addr;
  882. struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
  883. int i;
  884. int endcfg = ei_local->word16
  885. ? (0x48 | ENDCFG_WTS | (ei_local->bigendian ? ENDCFG_BOS : 0))
  886. : 0x48;
  887. if(sizeof(struct e8390_pkt_hdr)!=4)
  888. panic("8390.c: header struct mispacked\n");
  889. /* Follow National Semi's recommendations for initing the DP83902. */
  890. outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); /* 0x21 */
  891. outb_p(endcfg, e8390_base + EN0_DCFG); /* 0x48 or 0x49 */
  892. /* Clear the remote byte count registers. */
  893. outb_p(0x00, e8390_base + EN0_RCNTLO);
  894. outb_p(0x00, e8390_base + EN0_RCNTHI);
  895. /* Set to monitor and loopback mode -- this is vital!. */
  896. outb_p(E8390_RXOFF, e8390_base + EN0_RXCR); /* 0x20 */
  897. outb_p(E8390_TXOFF, e8390_base + EN0_TXCR); /* 0x02 */
  898. /* Set the transmit page and receive ring. */
  899. outb_p(ei_local->tx_start_page, e8390_base + EN0_TPSR);
  900. ei_local->tx1 = ei_local->tx2 = 0;
  901. outb_p(ei_local->rx_start_page, e8390_base + EN0_STARTPG);
  902. outb_p(ei_local->stop_page-1, e8390_base + EN0_BOUNDARY); /* 3c503 says 0x3f,NS0x26*/
  903. ei_local->current_page = ei_local->rx_start_page; /* assert boundary+1 */
  904. outb_p(ei_local->stop_page, e8390_base + EN0_STOPPG);
  905. /* Clear the pending interrupts and mask. */
  906. outb_p(0xFF, e8390_base + EN0_ISR);
  907. outb_p(0x00, e8390_base + EN0_IMR);
  908. /* Copy the station address into the DS8390 registers. */
  909. outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
  910. for(i = 0; i < 6; i++)
  911. {
  912. outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
  913. if (ei_debug > 1 && inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i])
  914. printk(KERN_ERR "Hw. address read/write mismap %d\n",i);
  915. }
  916. outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
  917. outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
  918. netif_start_queue(dev);
  919. ei_local->tx1 = ei_local->tx2 = 0;
  920. ei_local->txing = 0;
  921. if (startp)
  922. {
  923. outb_p(0xff, e8390_base + EN0_ISR);
  924. outb_p(ENISR_ALL, e8390_base + EN0_IMR);
  925. outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);
  926. outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR); /* xmit on. */
  927. /* 3c503 TechMan says rxconfig only after the NIC is started. */
  928. outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); /* rx on, */
  929. do_set_multicast_list(dev); /* (re)load the mcast table */
  930. }
  931. }
  932. /* Trigger a transmit start, assuming the length is valid.
  933. Always called with the page lock held */
  934. static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
  935. int start_page)
  936. {
  937. long e8390_base = dev->base_addr;
  938. struct ei_device *ei_local __attribute((unused)) = (struct ei_device *) netdev_priv(dev);
  939. outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD);
  940. if (inb_p(e8390_base + E8390_CMD) & E8390_TRANS)
  941. {
  942. printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n",
  943. dev->name);
  944. return;
  945. }
  946. outb_p(length & 0xff, e8390_base + EN0_TCNTLO);
  947. outb_p(length >> 8, e8390_base + EN0_TCNTHI);
  948. outb_p(start_page, e8390_base + EN0_TPSR);
  949. outb_p(E8390_NODMA+E8390_TRANS+E8390_START, e8390_base+E8390_CMD);
  950. }
  951. EXPORT_SYMBOL(ei_open);
  952. EXPORT_SYMBOL(ei_close);
  953. EXPORT_SYMBOL(ei_interrupt);
  954. #ifdef CONFIG_NET_POLL_CONTROLLER
  955. EXPORT_SYMBOL(ei_poll);
  956. #endif
  957. EXPORT_SYMBOL(NS8390_init);
  958. EXPORT_SYMBOL(__alloc_ei_netdev);
  959. #if defined(MODULE)
  960. int init_module(void)
  961. {
  962. return 0;
  963. }
  964. void cleanup_module(void)
  965. {
  966. }
  967. #endif /* MODULE */
  968. MODULE_LICENSE("GPL");