5 * Copyright Information:
6 * Copyright SysKonnect 1998,1999.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * The information in this file is provided "AS IS" without warranty.
16 * A Linux device driver supporting the SysKonnect FDDI PCI controller
20 * CG Christoph Goos (cgoos@syskonnect.de)
25 * Address all question to:
28 * The technical manual for the adapters is available from SysKonnect's
29 * web pages: www.syskonnect.com
30 * Goto "Support" and search Knowledge Base for "manual".
32 * Driver Architecture:
33 * The driver architecture is based on the DEC FDDI driver by
34 * Lawrence V. Stefani and several ethernet drivers.
35 * I also used an existing Windows NT miniport driver.
36 * All hardware dependent fuctions are handled by the SysKonnect
38 * The only headerfiles that are directly related to this source
39 * are skfddi.c, h/types.h, h/osdef1st.h, h/targetos.h.
40 * The others belong to the SysKonnect FDDI Hardware Module and
41 * should better not be changed.
43 * Modification History:
44 * Date Name Description
45 * 02-Mar-98 CG Created.
47 * 10-Mar-99 CG Support for 2.2.x added.
48 * 25-Mar-99 CG Corrected IRQ routing for SMP (APIC)
49 * 26-Oct-99 CG Fixed compilation error on 2.2.13
50 * 12-Nov-99 CG Source code release
51 * 22-Nov-99 CG Included in kernel source.
52 * 07-May-00 DM 64 bit fixes, new dma interface
53 * 31-Jul-03 DB Audit copy_*_user in skfp_ioctl
54 * Daniele Bellucci <bellucda@tiscali.it>
55 * 03-Dec-03 SH Convert to PCI device model
57 * Compilation options (-Dxxx):
58 * DRIVERDEBUG print lots of messages to log file
59 * DUMPPACKETS print received/transmitted packets to logfile
61 * Tested cpu architectures:
66 /* Version information string - should be updated prior to */
67 /* each new release!!! */
68 #define VERSION "2.07"
70 static const char *boot_msg =
71 "SysKonnect FDDI PCI Adapter driver v" VERSION " for\n"
72 " SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
76 #include <linux/module.h>
77 #include <linux/kernel.h>
78 #include <linux/errno.h>
79 #include <linux/ioport.h>
80 #include <linux/slab.h>
81 #include <linux/interrupt.h>
82 #include <linux/pci.h>
83 #include <linux/netdevice.h>
84 #include <linux/fddidevice.h>
85 #include <linux/skbuff.h>
87 #include <asm/byteorder.h>
88 #include <asm/bitops.h>
90 #include <asm/uaccess.h>
93 #undef ADDR // undo Linux definition
97 #include "h/smtstate.h"
100 // Define module-wide (static) routines
101 static int skfp_driver_init(struct net_device *dev);
102 static int skfp_open(struct net_device *dev);
103 static int skfp_close(struct net_device *dev);
104 static irqreturn_t skfp_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 static struct net_device_stats *skfp_ctl_get_stats(struct net_device *dev);
106 static void skfp_ctl_set_multicast_list(struct net_device *dev);
107 static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev);
108 static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr);
109 static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
110 static int skfp_send_pkt(struct sk_buff *skb, struct net_device *dev);
111 static void send_queued_packets(struct s_smc *smc);
112 static void CheckSourceAddress(unsigned char *frame, unsigned char *hw_addr);
113 static void ResetAdapter(struct s_smc *smc);
116 // Functions needed by the hardware module
117 void *mac_drv_get_space(struct s_smc *smc, u_int size);
118 void *mac_drv_get_desc_mem(struct s_smc *smc, u_int size);
119 unsigned long mac_drv_virt2phys(struct s_smc *smc, void *virt);
120 unsigned long dma_master(struct s_smc *smc, void *virt, int len, int flag);
121 void dma_complete(struct s_smc *smc, volatile union s_fp_descr *descr,
123 void mac_drv_tx_complete(struct s_smc *smc, volatile struct s_smt_fp_txd *txd);
124 void llc_restart_tx(struct s_smc *smc);
125 void mac_drv_rx_complete(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
126 int frag_count, int len);
127 void mac_drv_requeue_rxd(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
129 void mac_drv_fill_rxd(struct s_smc *smc);
130 void mac_drv_clear_rxd(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
132 int mac_drv_rx_init(struct s_smc *smc, int len, int fc, char *look_ahead,
134 void smt_timer_poll(struct s_smc *smc);
135 void ring_status_indication(struct s_smc *smc, u_long status);
136 unsigned long smt_get_time(void);
137 void smt_stat_counter(struct s_smc *smc, int stat);
138 void cfm_state_change(struct s_smc *smc, int c_state);
139 void ecm_state_change(struct s_smc *smc, int e_state);
140 void pcm_state_change(struct s_smc *smc, int plc, int p_state);
141 void rmt_state_change(struct s_smc *smc, int r_state);
142 void drv_reset_indication(struct s_smc *smc);
143 void dump_data(unsigned char *Data, int length);
146 // External functions from the hardware module
147 extern u_int mac_drv_check_space();
148 extern void read_address(struct s_smc *smc, u_char * mac_addr);
149 extern void card_stop(struct s_smc *smc);
150 extern int mac_drv_init(struct s_smc *smc);
151 extern void hwm_tx_frag(struct s_smc *smc, char far * virt, u_long phys,
152 int len, int frame_status);
153 extern int hwm_tx_init(struct s_smc *smc, u_char fc, int frag_count,
154 int frame_len, int frame_status);
155 extern int init_smt(struct s_smc *smc, u_char * mac_addr);
156 extern void fddi_isr(struct s_smc *smc);
157 extern void hwm_rx_frag(struct s_smc *smc, char far * virt, u_long phys,
158 int len, int frame_status);
159 extern void mac_drv_rx_mode(struct s_smc *smc, int mode);
160 extern void mac_drv_clear_tx_queue(struct s_smc *smc);
161 extern void mac_drv_clear_rx_queue(struct s_smc *smc);
162 extern void mac_clear_multicast(struct s_smc *smc);
163 extern void enable_tx_irq(struct s_smc *smc, u_short queue);
164 extern void mac_drv_clear_txd(struct s_smc *smc);
166 static struct pci_device_id skfddi_pci_tbl[] = {
167 { PCI_VENDOR_ID_SK, PCI_DEVICE_ID_SK_FP, PCI_ANY_ID, PCI_ANY_ID, },
168 { } /* Terminating entry */
170 MODULE_DEVICE_TABLE(pci, skfddi_pci_tbl);
171 MODULE_LICENSE("GPL");
172 MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>");
174 // Define module-wide (static) variables
176 static int num_boards; /* total number of adapters configured */
179 #define PRINTK(s, args...) printk(s, ## args)
181 #define PRINTK(s, args...)
182 #endif // DRIVERDEBUG
184 #define PRIV(dev) (&(((struct s_smc *)dev->priv)->os))
192 * Probes for supported FDDI PCI controllers
198 * pdev - pointer to PCI device information
200 * Functional Description:
201 * This is now called by PCI driver registration process
202 * for each board found.
205 * 0 - This device (fddi0, fddi1, etc) configured successfully
206 * -ENODEV - No devices present, or no SysKonnect FDDI PCI device
207 * present for this device name
211 * Device structures for FDDI adapters (fddi0, fddi1, etc) are
212 * initialized and the board resources are read and stored in
213 * the device structure.
215 static int skfp_init_one(struct pci_dev *pdev,
216 const struct pci_device_id *ent)
218 struct net_device *dev;
219 struct s_smc *smc; /* board pointer */
220 unsigned long port, len;
223 PRINTK(KERN_INFO "entering skfp_init_one\n");
226 printk("%s\n", boot_msg);
228 err = pci_enable_device(pdev);
234 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
235 printk(KERN_ERR "skfp: region is not an MMIO resource\n");
239 port = pci_resource_start(pdev, 0);
240 len = pci_resource_len(pdev, 0);
243 printk(KERN_ERR "skfp: Invalid PCI region size: %lu\n", len);
248 if (!(pci_resource_flags(pdev, 1) & IO_RESOURCE_IO)) {
249 printk(KERN_ERR "skfp: region is not PIO resource\n");
254 port = pci_resource_start(pdev, 1);
255 len = pci_resource_len(pdev, 1);
256 if (len < FP_IO_LEN) {
257 printk(KERN_ERR "skfp: Invalid PCI region size: %d\n",
263 err = pci_request_regions(pdev, "skfddi");
267 pci_set_master(pdev);
269 dev = alloc_fddidev(sizeof(struct s_smc));
271 printk(KERN_ERR "skfp: Unable to allocate fddi device, "
272 "FDDI adapter will be disabled.\n");
278 dev->base_addr = (unsigned long) ioremap(port, len);
279 if (!dev->base_addr) {
280 printk(KERN_ERR "skfp: Unable to map MEMORY register, "
281 "FDDI adapter will be disabled.\n");
286 dev->base_addr = port;
289 dev->irq = pdev->irq;
290 dev->get_stats = &skfp_ctl_get_stats;
291 dev->open = &skfp_open;
292 dev->stop = &skfp_close;
293 dev->hard_start_xmit = &skfp_send_pkt;
294 dev->set_multicast_list = &skfp_ctl_set_multicast_list;
295 dev->set_mac_address = &skfp_ctl_set_mac_address;
296 dev->do_ioctl = &skfp_ioctl;
297 dev->header_cache_update = NULL; /* not supported */
299 SET_MODULE_OWNER(dev);
300 SET_NETDEV_DEV(dev, &pdev->dev);
302 /* Initialize board structure with bus-specific info */
303 smc = (struct s_smc *) dev->priv;
305 smc->os.bus_type = SK_BUS_TYPE_PCI;
306 smc->os.pdev = *pdev;
307 smc->os.QueueSkb = MAX_TX_QUEUE_LEN;
308 smc->os.MaxFrameSize = MAX_FRAME_SIZE;
311 smc->os.ResetRequested = FALSE;
312 skb_queue_head_init(&smc->os.SendSkbQueue);
314 err = skfp_driver_init(dev);
318 err = register_netdev(dev);
323 pci_set_drvdata(pdev, dev);
325 if ((pdev->subsystem_device & 0xff00) == 0x5500 ||
326 (pdev->subsystem_device & 0xff00) == 0x5800)
327 printk("%s: SysKonnect FDDI PCI adapter"
328 " found (SK-%04X)\n", dev->name,
329 pdev->subsystem_device);
331 printk("%s: FDDI PCI adapter found\n", dev->name);
335 if (smc->os.SharedMemAddr)
336 pci_free_consistent(pdev, smc->os.SharedMemSize,
337 smc->os.SharedMemAddr,
338 smc->os.SharedMemDMA);
339 pci_free_consistent(pdev, MAX_FRAME_SIZE,
340 smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA);
343 iounmap((void *) dev->base_addr);
348 pci_release_regions(pdev);
354 * Called for each adapter board from pci_unregister_driver
356 static void __devexit skfp_remove_one(struct pci_dev *pdev)
358 struct net_device *p = pci_get_drvdata(pdev);
359 struct s_smc *lp = p->priv;
361 unregister_netdev(p);
363 if (lp->os.SharedMemAddr) {
364 pci_free_consistent(&lp->os.pdev,
365 lp->os.SharedMemSize,
366 lp->os.SharedMemAddr,
367 lp->os.SharedMemDMA);
368 lp->os.SharedMemAddr = NULL;
370 if (lp->os.LocalRxBuffer) {
371 pci_free_consistent(&lp->os.pdev,
373 lp->os.LocalRxBuffer,
374 lp->os.LocalRxBufferDMA);
375 lp->os.LocalRxBuffer = NULL;
378 iounmap((void *) p->base_addr);
380 pci_release_regions(pdev);
383 pci_set_drvdata(pdev, NULL);
387 * ====================
388 * = skfp_driver_init =
389 * ====================
392 * Initializes remaining adapter board structure information
393 * and makes sure adapter is in a safe state prior to skfp_open().
399 * dev - pointer to device information
401 * Functional Description:
402 * This function allocates additional resources such as the host memory
403 * blocks needed by the adapter.
404 * The adapter is also reset. The OS must call skfp_open() to open
405 * the adapter and bring it on-line.
408 * 0 - initialization succeeded
409 * -1 - initialization failed
411 static int skfp_driver_init(struct net_device *dev)
413 struct s_smc *smc = (struct s_smc *) dev->priv;
414 skfddi_priv *bp = PRIV(dev);
417 PRINTK(KERN_INFO "entering skfp_driver_init\n");
419 // set the io address in private structures
420 bp->base_addr = dev->base_addr;
421 smc->hw.iop = dev->base_addr;
423 // Get the interrupt level from the PCI Configuration Table
424 smc->hw.irq = dev->irq;
426 spin_lock_init(&bp->DriverLock);
428 // Allocate invalid frame
429 bp->LocalRxBuffer = pci_alloc_consistent(&bp->pdev, MAX_FRAME_SIZE, &bp->LocalRxBufferDMA);
430 if (!bp->LocalRxBuffer) {
431 printk("could not allocate mem for ");
432 printk("LocalRxBuffer: %d byte\n", MAX_FRAME_SIZE);
436 // Determine the required size of the 'shared' memory area.
437 bp->SharedMemSize = mac_drv_check_space();
438 PRINTK(KERN_INFO "Memory for HWM: %ld\n", bp->SharedMemSize);
439 if (bp->SharedMemSize > 0) {
440 bp->SharedMemSize += 16; // for descriptor alignment
442 bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
445 if (!bp->SharedMemSize) {
446 printk("could not allocate mem for ");
447 printk("hardware module: %ld byte\n",
451 bp->SharedMemHeap = 0; // Nothing used yet.
454 bp->SharedMemAddr = NULL;
455 bp->SharedMemHeap = 0;
456 } // SharedMemSize > 0
458 memset(bp->SharedMemAddr, 0, bp->SharedMemSize);
460 card_stop(smc); // Reset adapter.
462 PRINTK(KERN_INFO "mac_drv_init()..\n");
463 if (mac_drv_init(smc) != 0) {
464 PRINTK(KERN_INFO "mac_drv_init() failed.\n");
467 read_address(smc, NULL);
468 PRINTK(KERN_INFO "HW-Addr: %02x %02x %02x %02x %02x %02x\n",
469 smc->hw.fddi_canon_addr.a[0],
470 smc->hw.fddi_canon_addr.a[1],
471 smc->hw.fddi_canon_addr.a[2],
472 smc->hw.fddi_canon_addr.a[3],
473 smc->hw.fddi_canon_addr.a[4],
474 smc->hw.fddi_canon_addr.a[5]);
475 memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, 6);
477 smt_reset_defaults(smc, 0);
482 if (bp->SharedMemAddr) {
483 pci_free_consistent(&bp->pdev,
487 bp->SharedMemAddr = NULL;
489 if (bp->LocalRxBuffer) {
490 pci_free_consistent(&bp->pdev, MAX_FRAME_SIZE,
491 bp->LocalRxBuffer, bp->LocalRxBufferDMA);
492 bp->LocalRxBuffer = NULL;
495 } // skfp_driver_init
510 * dev - pointer to device information
512 * Functional Description:
513 * This function brings the adapter to an operational state.
516 * 0 - Adapter was successfully opened
517 * -EAGAIN - Could not register IRQ
519 static int skfp_open(struct net_device *dev)
521 struct s_smc *smc = (struct s_smc *) dev->priv;
524 PRINTK(KERN_INFO "entering skfp_open\n");
525 /* Register IRQ - support shared interrupts by passing device ptr */
526 err = request_irq(dev->irq, (void *) skfp_interrupt, SA_SHIRQ,
532 * Set current address to factory MAC address
534 * Note: We've already done this step in skfp_driver_init.
535 * However, it's possible that a user has set a node
536 * address override, then closed and reopened the
537 * adapter. Unless we reset the device address field
538 * now, we'll continue to use the existing modified
541 read_address(smc, NULL);
542 memcpy(dev->dev_addr, smc->hw.fddi_canon_addr.a, 6);
548 /* Clear local multicast address tables */
549 mac_clear_multicast(smc);
551 /* Disable promiscuous filter settings */
552 mac_drv_rx_mode(smc, RX_DISABLE_PROMISC);
554 netif_start_queue(dev);
565 * Closes the device/module.
571 * dev - pointer to device information
573 * Functional Description:
574 * This routine closes the adapter and brings it to a safe state.
575 * The interrupt service routine is deregistered with the OS.
576 * The adapter can be opened again with another call to skfp_open().
582 * No further requests for this adapter are made after this routine is
583 * called. skfp_open() can be called to reset and reinitialize the
586 static int skfp_close(struct net_device *dev)
588 struct s_smc *smc = (struct s_smc *) dev->priv;
589 skfddi_priv *bp = PRIV(dev);
592 smt_reset_defaults(smc, 1);
594 mac_drv_clear_tx_queue(smc);
595 mac_drv_clear_rx_queue(smc);
597 netif_stop_queue(dev);
598 /* Deregister (free) IRQ */
599 free_irq(dev->irq, dev);
601 skb_queue_purge(&bp->SendSkbQueue);
602 bp->QueueSkb = MAX_TX_QUEUE_LEN;
614 * Interrupt processing routine
620 * irq - interrupt vector
621 * dev_id - pointer to device information
622 * regs - pointer to registers structure
624 * Functional Description:
625 * This routine calls the interrupt processing routine for this adapter. It
626 * disables and reenables adapter interrupts, as appropriate. We can support
627 * shared interrupts since the incoming dev_id pointer provides our device
628 * structure context. All the real work is done in the hardware module.
634 * The interrupt acknowledgement at the hardware level (eg. ACKing the PIC
635 * on Intel-based systems) is done by the operating system outside this
638 * System interrupts are enabled through this call.
641 * Interrupts are disabled, then reenabled at the adapter.
644 irqreturn_t skfp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
646 struct net_device *dev = (struct net_device *) dev_id;
647 struct s_smc *smc; /* private board structure pointer */
648 skfddi_priv *bp = PRIV(dev);
652 printk("%s: irq %d for unknown device\n", dev->name, irq);
656 smc = (struct s_smc *) dev->priv;
658 // IRQs enabled or disabled ?
659 if (inpd(ADDR(B0_IMSK)) == 0) {
660 // IRQs are disabled: must be shared interrupt
663 // Note: At this point, IRQs are enabled.
664 if ((inpd(ISR_A) & smc->hw.is_imask) == 0) { // IRQ?
665 // Adapter did not issue an IRQ: must be shared interrupt
668 CLI_FBI(); // Disable IRQs from our adapter.
669 spin_lock(&bp->DriverLock);
671 // Call interrupt handler in hardware module (HWM).
674 if (smc->os.ResetRequested) {
676 smc->os.ResetRequested = FALSE;
678 spin_unlock(&bp->DriverLock);
679 STI_FBI(); // Enable IRQs from our adapter.
686 * ======================
687 * = skfp_ctl_get_stats =
688 * ======================
691 * Get statistics for FDDI adapter
694 * Pointer to FDDI statistics structure
697 * dev - pointer to device information
699 * Functional Description:
700 * Gets current MIB objects from adapter, then
701 * returns FDDI statistics structure as defined
704 * Note: Since the FDDI statistics structure is
705 * still new and the device structure doesn't
706 * have an FDDI-specific get statistics handler,
707 * we'll return the FDDI statistics structure as
708 * a pointer to an Ethernet statistics structure.
709 * That way, at least the first part of the statistics
710 * structure can be decoded properly.
711 * We'll have to pay attention to this routine as the
712 * device structure becomes more mature and LAN media
716 struct net_device_stats *skfp_ctl_get_stats(struct net_device *dev)
718 struct s_smc *bp = (struct s_smc *) dev->priv;
720 /* Fill the bp->stats structure with driver-maintained counters */
722 bp->os.MacStat.port_bs_flag[0] = 0x1234;
723 bp->os.MacStat.port_bs_flag[1] = 0x5678;
724 // goos: need to fill out fddi statistic
726 /* Get FDDI SMT MIB objects */
728 /* Fill the bp->stats structure with the SMT MIB object values */
730 memcpy(bp->stats.smt_station_id, &bp->cmd_rsp_virt->smt_mib_get.smt_station_id, sizeof(bp->cmd_rsp_virt->smt_mib_get.smt_station_id));
731 bp->stats.smt_op_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_op_version_id;
732 bp->stats.smt_hi_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_hi_version_id;
733 bp->stats.smt_lo_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_lo_version_id;
734 memcpy(bp->stats.smt_user_data, &bp->cmd_rsp_virt->smt_mib_get.smt_user_data, sizeof(bp->cmd_rsp_virt->smt_mib_get.smt_user_data));
735 bp->stats.smt_mib_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_mib_version_id;
736 bp->stats.smt_mac_cts = bp->cmd_rsp_virt->smt_mib_get.smt_mac_ct;
737 bp->stats.smt_non_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_non_master_ct;
738 bp->stats.smt_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_master_ct;
739 bp->stats.smt_available_paths = bp->cmd_rsp_virt->smt_mib_get.smt_available_paths;
740 bp->stats.smt_config_capabilities = bp->cmd_rsp_virt->smt_mib_get.smt_config_capabilities;
741 bp->stats.smt_config_policy = bp->cmd_rsp_virt->smt_mib_get.smt_config_policy;
742 bp->stats.smt_connection_policy = bp->cmd_rsp_virt->smt_mib_get.smt_connection_policy;
743 bp->stats.smt_t_notify = bp->cmd_rsp_virt->smt_mib_get.smt_t_notify;
744 bp->stats.smt_stat_rpt_policy = bp->cmd_rsp_virt->smt_mib_get.smt_stat_rpt_policy;
745 bp->stats.smt_trace_max_expiration = bp->cmd_rsp_virt->smt_mib_get.smt_trace_max_expiration;
746 bp->stats.smt_bypass_present = bp->cmd_rsp_virt->smt_mib_get.smt_bypass_present;
747 bp->stats.smt_ecm_state = bp->cmd_rsp_virt->smt_mib_get.smt_ecm_state;
748 bp->stats.smt_cf_state = bp->cmd_rsp_virt->smt_mib_get.smt_cf_state;
749 bp->stats.smt_remote_disconnect_flag = bp->cmd_rsp_virt->smt_mib_get.smt_remote_disconnect_flag;
750 bp->stats.smt_station_status = bp->cmd_rsp_virt->smt_mib_get.smt_station_status;
751 bp->stats.smt_peer_wrap_flag = bp->cmd_rsp_virt->smt_mib_get.smt_peer_wrap_flag;
752 bp->stats.smt_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_msg_time_stamp.ls;
753 bp->stats.smt_transition_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_transition_time_stamp.ls;
754 bp->stats.mac_frame_status_functions = bp->cmd_rsp_virt->smt_mib_get.mac_frame_status_functions;
755 bp->stats.mac_t_max_capability = bp->cmd_rsp_virt->smt_mib_get.mac_t_max_capability;
756 bp->stats.mac_tvx_capability = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_capability;
757 bp->stats.mac_available_paths = bp->cmd_rsp_virt->smt_mib_get.mac_available_paths;
758 bp->stats.mac_current_path = bp->cmd_rsp_virt->smt_mib_get.mac_current_path;
759 memcpy(bp->stats.mac_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_upstream_nbr, FDDI_K_ALEN);
760 memcpy(bp->stats.mac_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_downstream_nbr, FDDI_K_ALEN);
761 memcpy(bp->stats.mac_old_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_upstream_nbr, FDDI_K_ALEN);
762 memcpy(bp->stats.mac_old_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_downstream_nbr, FDDI_K_ALEN);
763 bp->stats.mac_dup_address_test = bp->cmd_rsp_virt->smt_mib_get.mac_dup_address_test;
764 bp->stats.mac_requested_paths = bp->cmd_rsp_virt->smt_mib_get.mac_requested_paths;
765 bp->stats.mac_downstream_port_type = bp->cmd_rsp_virt->smt_mib_get.mac_downstream_port_type;
766 memcpy(bp->stats.mac_smt_address, &bp->cmd_rsp_virt->smt_mib_get.mac_smt_address, FDDI_K_ALEN);
767 bp->stats.mac_t_req = bp->cmd_rsp_virt->smt_mib_get.mac_t_req;
768 bp->stats.mac_t_neg = bp->cmd_rsp_virt->smt_mib_get.mac_t_neg;
769 bp->stats.mac_t_max = bp->cmd_rsp_virt->smt_mib_get.mac_t_max;
770 bp->stats.mac_tvx_value = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_value;
771 bp->stats.mac_frame_error_threshold = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_threshold;
772 bp->stats.mac_frame_error_ratio = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_ratio;
773 bp->stats.mac_rmt_state = bp->cmd_rsp_virt->smt_mib_get.mac_rmt_state;
774 bp->stats.mac_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_da_flag;
775 bp->stats.mac_una_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_unda_flag;
776 bp->stats.mac_frame_error_flag = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_flag;
777 bp->stats.mac_ma_unitdata_available = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_available;
778 bp->stats.mac_hardware_present = bp->cmd_rsp_virt->smt_mib_get.mac_hardware_present;
779 bp->stats.mac_ma_unitdata_enable = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_enable;
780 bp->stats.path_tvx_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_tvx_lower_bound;
781 bp->stats.path_t_max_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_t_max_lower_bound;
782 bp->stats.path_max_t_req = bp->cmd_rsp_virt->smt_mib_get.path_max_t_req;
783 memcpy(bp->stats.path_configuration, &bp->cmd_rsp_virt->smt_mib_get.path_configuration, sizeof(bp->cmd_rsp_virt->smt_mib_get.path_configuration));
784 bp->stats.port_my_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[0];
785 bp->stats.port_my_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[1];
786 bp->stats.port_neighbor_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[0];
787 bp->stats.port_neighbor_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[1];
788 bp->stats.port_connection_policies[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[0];
789 bp->stats.port_connection_policies[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[1];
790 bp->stats.port_mac_indicated[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[0];
791 bp->stats.port_mac_indicated[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[1];
792 bp->stats.port_current_path[0] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[0];
793 bp->stats.port_current_path[1] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[1];
794 memcpy(&bp->stats.port_requested_paths[0 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[0], 3);
795 memcpy(&bp->stats.port_requested_paths[1 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[1], 3);
796 bp->stats.port_mac_placement[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[0];
797 bp->stats.port_mac_placement[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[1];
798 bp->stats.port_available_paths[0] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[0];
799 bp->stats.port_available_paths[1] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[1];
800 bp->stats.port_pmd_class[0] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[0];
801 bp->stats.port_pmd_class[1] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[1];
802 bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabilities[0];
803 bp->stats.port_connection_capabilities[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabilities[1];
804 bp->stats.port_bs_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[0];
805 bp->stats.port_bs_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[1];
806 bp->stats.port_ler_estimate[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[0];
807 bp->stats.port_ler_estimate[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[1];
808 bp->stats.port_ler_cutoff[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[0];
809 bp->stats.port_ler_cutoff[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[1];
810 bp->stats.port_ler_alarm[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[0];
811 bp->stats.port_ler_alarm[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[1];
812 bp->stats.port_connect_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[0];
813 bp->stats.port_connect_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[1];
814 bp->stats.port_pcm_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[0];
815 bp->stats.port_pcm_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[1];
816 bp->stats.port_pc_withhold[0] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[0];
817 bp->stats.port_pc_withhold[1] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[1];
818 bp->stats.port_ler_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[0];
819 bp->stats.port_ler_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[1];
820 bp->stats.port_hardware_present[0] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[0];
821 bp->stats.port_hardware_present[1] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[1];
824 /* Fill the bp->stats structure with the FDDI counter values */
826 bp->stats.mac_frame_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.frame_cnt.ls;
827 bp->stats.mac_copied_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.copied_cnt.ls;
828 bp->stats.mac_transmit_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.transmit_cnt.ls;
829 bp->stats.mac_error_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.error_cnt.ls;
830 bp->stats.mac_lost_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.lost_cnt.ls;
831 bp->stats.port_lct_fail_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[0].ls;
832 bp->stats.port_lct_fail_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[1].ls;
833 bp->stats.port_lem_reject_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[0].ls;
834 bp->stats.port_lem_reject_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[1].ls;
835 bp->stats.port_lem_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[0].ls;
836 bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls;
839 return ((struct net_device_stats *) &bp->os.MacStat);
844 * ==============================
845 * = skfp_ctl_set_multicast_list =
846 * ==============================
849 * Enable/Disable LLC frame promiscuous mode reception
850 * on the adapter and/or update multicast address table.
856 * dev - pointer to device information
858 * Functional Description:
859 * This function acquires the driver lock and only calls
860 * skfp_ctl_set_multicast_list_wo_lock then.
861 * This routine follows a fairly simple algorithm for setting the
862 * adapter filters and CAM:
864 * if IFF_PROMISC flag is set
865 * enable promiscuous mode
867 * disable promiscuous mode
868 * if number of multicast addresses <= max. multicast number
869 * add mc addresses to adapter table
871 * enable promiscuous mode
872 * update adapter filters
875 * Multicast addresses are presented in canonical (LSB) format.
878 * On-board adapter filters are updated.
880 static void skfp_ctl_set_multicast_list(struct net_device *dev)
882 skfddi_priv *bp = PRIV(dev);
885 spin_lock_irqsave(&bp->DriverLock, Flags);
886 skfp_ctl_set_multicast_list_wo_lock(dev);
887 spin_unlock_irqrestore(&bp->DriverLock, Flags);
889 } // skfp_ctl_set_multicast_list
893 static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev)
895 struct s_smc *smc = (struct s_smc *) dev->priv;
896 struct dev_mc_list *dmi; /* ptr to multicast addr entry */
899 /* Enable promiscuous mode, if necessary */
900 if (dev->flags & IFF_PROMISC) {
901 mac_drv_rx_mode(smc, RX_ENABLE_PROMISC);
902 PRINTK(KERN_INFO "PROMISCUOUS MODE ENABLED\n");
904 /* Else, update multicast address table */
906 mac_drv_rx_mode(smc, RX_DISABLE_PROMISC);
907 PRINTK(KERN_INFO "PROMISCUOUS MODE DISABLED\n");
909 // Reset all MC addresses
910 mac_clear_multicast(smc);
911 mac_drv_rx_mode(smc, RX_DISABLE_ALLMULTI);
913 if (dev->flags & IFF_ALLMULTI) {
914 mac_drv_rx_mode(smc, RX_ENABLE_ALLMULTI);
915 PRINTK(KERN_INFO "ENABLE ALL MC ADDRESSES\n");
916 } else if (dev->mc_count > 0) {
917 if (dev->mc_count <= FPMAX_MULTICAST) {
918 /* use exact filtering */
920 // point to first multicast addr
923 for (i = 0; i < dev->mc_count; i++) {
924 mac_add_multicast(smc,
926 PRINTK(KERN_INFO "ENABLE MC ADDRESS:");
927 PRINTK(" %02x %02x %02x ",
931 PRINTK("%02x %02x %02x\n",
938 } else { // more MC addresses than HW supports
940 mac_drv_rx_mode(smc, RX_ENABLE_ALLMULTI);
941 PRINTK(KERN_INFO "ENABLE ALL MC ADDRESSES\n");
943 } else { // no MC addresses
945 PRINTK(KERN_INFO "DISABLE ALL MC ADDRESSES\n");
948 /* Update adapter filters */
949 mac_update_multicast(smc);
952 } // skfp_ctl_set_multicast_list_wo_lock
956 * ===========================
957 * = skfp_ctl_set_mac_address =
958 * ===========================
961 * set new mac address on adapter and update dev_addr field in device table.
967 * dev - pointer to device information
968 * addr - pointer to sockaddr structure containing unicast address to set
971 * The address pointed to by addr->sa_data is a valid unicast
972 * address and is presented in canonical (LSB) format.
974 static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr)
976 struct s_smc *smc = (struct s_smc *) dev->priv;
977 struct sockaddr *p_sockaddr = (struct sockaddr *) addr;
978 skfddi_priv *bp = (skfddi_priv *) & smc->os;
982 memcpy(dev->dev_addr, p_sockaddr->sa_data, FDDI_K_ALEN);
983 spin_lock_irqsave(&bp->DriverLock, Flags);
985 spin_unlock_irqrestore(&bp->DriverLock, Flags);
987 return (0); /* always return zero */
988 } // skfp_ctl_set_mac_address
998 * Perform IOCTL call functions here. Some are privileged operations and the
999 * effective uid is checked in those cases.
1007 * dev - pointer to device information
1008 * rq - pointer to ioctl request structure
1014 static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1016 skfddi_priv *lp = PRIV(dev);
1017 struct s_skfp_ioctl ioc;
1020 if (copy_from_user(&ioc, rq->ifr_data, sizeof(struct s_skfp_ioctl)))
1023 case SKFP_GET_STATS: /* Get the driver statistics */
1024 ioc.len = sizeof(lp->MacStat);
1025 status = copy_to_user(ioc.data, skfp_ctl_get_stats(dev), ioc.len)
1028 case SKFP_CLR_STATS: /* Zero out the driver statistics */
1029 if (!capable(CAP_NET_ADMIN)) {
1030 memset(&lp->MacStat, 0, sizeof(lp->MacStat));
1036 printk("ioctl for %s: unknow cmd: %04x\n", dev->name, ioc.cmd);
1037 status = -EOPNOTSUPP;
1046 * =====================
1048 * =====================
1051 * Queues a packet for transmission and try to transmit it.
1057 * skb - pointer to sk_buff to queue for transmission
1058 * dev - pointer to device information
1060 * Functional Description:
1061 * Here we assume that an incoming skb transmit request
1062 * is contained in a single physically contiguous buffer
1063 * in which the virtual address of the start of packet
1064 * (skb->data) can be converted to a physical address
1065 * by using pci_map_single().
1067 * We have an internal queue for packets we can not send
1068 * immediately. Packets in this queue can be given to the
1069 * adapter if transmit buffers are freed.
1071 * We can't free the skb until after it's been DMA'd
1072 * out by the adapter, so we'll keep it in the driver and
1073 * return it in mac_drv_tx_complete.
1076 * 0 - driver has queued and/or sent packet
1077 * 1 - caller should requeue the sk_buff for later transmission
1080 * The entire packet is stored in one physically
1081 * contiguous buffer which is not cached and whose
1082 * 32-bit physical address can be determined.
1084 * It's vital that this routine is NOT reentered for the
1085 * same board and that the OS is not in another section of
1086 * code (eg. skfp_interrupt) for the same board on a
1092 static int skfp_send_pkt(struct sk_buff *skb, struct net_device *dev)
1094 skfddi_priv *bp = PRIV(dev);
1096 PRINTK(KERN_INFO "skfp_send_pkt\n");
1099 * Verify that incoming transmit request is OK
1101 * Note: The packet size check is consistent with other
1102 * Linux device drivers, although the correct packet
1103 * size should be verified before calling the
1107 if (!(skb->len >= FDDI_K_LLC_ZLEN && skb->len <= FDDI_K_LLC_LEN)) {
1108 bp->MacStat.tx_errors++; /* bump error counter */
1109 // dequeue packets from xmt queue and send them
1110 netif_start_queue(dev);
1112 return (0); /* return "success" */
1114 if (bp->QueueSkb == 0) { // return with tbusy set: queue full
1116 netif_stop_queue(dev);
1120 skb_queue_tail(&bp->SendSkbQueue, skb);
1121 send_queued_packets((struct s_smc *) dev->priv);
1122 if (bp->QueueSkb == 0) {
1123 netif_stop_queue(dev);
1125 dev->trans_start = jiffies;
1132 * =======================
1133 * = send_queued_packets =
1134 * =======================
1137 * Send packets from the driver queue as long as there are some and
1138 * transmit resources are available.
1144 * smc - pointer to smc (adapter) structure
1146 * Functional Description:
1147 * Take a packet from queue if there is any. If not, then we are done.
1148 * Check if there are resources to send the packet. If not, requeue it
1150 * Set packet descriptor flags and give packet to adapter.
1151 * Check if any send resources can be freed (we do not use the
1152 * transmit complete interrupt).
1154 static void send_queued_packets(struct s_smc *smc)
1156 skfddi_priv *bp = (skfddi_priv *) & smc->os;
1157 struct sk_buff *skb;
1160 struct s_smt_fp_txd *txd; // Current TxD.
1161 dma_addr_t dma_address;
1162 unsigned long Flags;
1164 int frame_status; // HWM tx frame status.
1166 PRINTK(KERN_INFO "send queued packets\n");
1168 // send first buffer from queue
1169 skb = skb_dequeue(&bp->SendSkbQueue);
1172 PRINTK(KERN_INFO "queue empty\n");
1176 spin_lock_irqsave(&bp->DriverLock, Flags);
1178 queue = (fc & FC_SYNC_BIT) ? QUEUE_S : QUEUE_A0;
1180 // Check if the frame may/must be sent as a synchronous frame.
1182 if ((fc & ~(FC_SYNC_BIT | FC_LLC_PRIOR)) == FC_ASYNC_LLC) {
1183 // It's an LLC frame.
1184 if (!smc->ess.sync_bw_available)
1185 fc &= ~FC_SYNC_BIT; // No bandwidth available.
1187 else { // Bandwidth is available.
1189 if (smc->mib.fddiESSSynchTxMode) {
1190 // Send as sync. frame.
1196 frame_status = hwm_tx_init(smc, fc, 1, skb->len, queue);
1198 if ((frame_status & (LOC_TX | LAN_TX)) == 0) {
1199 // Unable to send the frame.
1201 if ((frame_status & RING_DOWN) != 0) {
1203 PRINTK("Tx attempt while ring down.\n");
1204 } else if ((frame_status & OUT_OF_TXD) != 0) {
1205 PRINTK("%s: out of TXDs.\n", bp->dev->name);
1207 PRINTK("%s: out of transmit resources",
1211 // Note: We will retry the operation as soon as
1212 // transmit resources become available.
1213 skb_queue_head(&bp->SendSkbQueue, skb);
1214 spin_unlock_irqrestore(&bp->DriverLock, Flags);
1215 return; // Packet has been queued.
1217 } // if (unable to send frame)
1219 bp->QueueSkb++; // one packet less in local queue
1221 // source address in packet ?
1222 CheckSourceAddress(skb->data, smc->hw.fddi_canon_addr.a);
1224 txd = (struct s_smt_fp_txd *) HWM_GET_CURR_TXD(smc, queue);
1226 dma_address = pci_map_single(&bp->pdev, skb->data,
1227 skb->len, PCI_DMA_TODEVICE);
1228 if (frame_status & LAN_TX) {
1229 txd->txd_os.skb = skb; // save skb
1230 txd->txd_os.dma_addr = dma_address; // save dma mapping
1232 hwm_tx_frag(smc, skb->data, dma_address, skb->len,
1233 frame_status | FIRST_FRAG | LAST_FRAG | EN_IRQ_EOF);
1235 if (!(frame_status & LAN_TX)) { // local only frame
1236 pci_unmap_single(&bp->pdev, dma_address,
1237 skb->len, PCI_DMA_TODEVICE);
1238 dev_kfree_skb_irq(skb);
1240 spin_unlock_irqrestore(&bp->DriverLock, Flags);
1243 return; // never reached
1245 } // send_queued_packets
1248 /************************
1250 * CheckSourceAddress
1252 * Verify if the source address is set. Insert it if necessary.
1254 ************************/
1255 void CheckSourceAddress(unsigned char *frame, unsigned char *hw_addr)
1257 unsigned char SRBit;
1259 if ((((unsigned long) frame[1 + 6]) & ~0x01) != 0) // source routing bit
1262 if ((unsigned short) frame[1 + 10] != 0)
1264 SRBit = frame[1 + 6] & 0x01;
1265 memcpy(&frame[1 + 6], hw_addr, 6);
1267 } // CheckSourceAddress
1270 /************************
1274 * Reset the adapter and bring it back to operational mode.
1276 * smc - A pointer to the SMT context struct.
1280 ************************/
1281 static void ResetAdapter(struct s_smc *smc)
1284 PRINTK(KERN_INFO "[fddi: ResetAdapter]\n");
1286 // Stop the adapter.
1288 card_stop(smc); // Stop all activity.
1290 // Clear the transmit and receive descriptor queues.
1291 mac_drv_clear_tx_queue(smc);
1292 mac_drv_clear_rx_queue(smc);
1294 // Restart the adapter.
1296 smt_reset_defaults(smc, 1); // Initialize the SMT module.
1298 init_smt(smc, (smc->os.dev)->dev_addr); // Initialize the hardware.
1300 smt_online(smc, 1); // Insert into the ring again.
1303 // Restore original receive mode (multicasts, promiscuous, etc.).
1304 skfp_ctl_set_multicast_list_wo_lock(smc->os.dev);
1308 //--------------- functions called by hardware module ----------------
1310 /************************
1314 * The hardware driver calls this routine when the transmit complete
1315 * interrupt bits (end of frame) for the synchronous or asynchronous
1318 * NOTE The hardware driver calls this function also if no packets are queued.
1319 * The routine must be able to handle this case.
1321 * smc - A pointer to the SMT context struct.
1325 ************************/
1326 void llc_restart_tx(struct s_smc *smc)
1328 skfddi_priv *bp = (skfddi_priv *) & smc->os;
1330 PRINTK(KERN_INFO "[llc_restart_tx]\n");
1332 // Try to send queued packets
1333 spin_unlock(&bp->DriverLock);
1334 send_queued_packets(smc);
1335 spin_lock(&bp->DriverLock);
1336 netif_start_queue(bp->dev);// system may send again if it was blocked
1341 /************************
1345 * The hardware module calls this function to allocate the memory
1346 * for the SMT MBufs if the define MB_OUTSIDE_SMC is specified.
1348 * smc - A pointer to the SMT context struct.
1350 * size - Size of memory in bytes to allocate.
1352 * != 0 A pointer to the virtual address of the allocated memory.
1353 * == 0 Allocation error.
1355 ************************/
1356 void *mac_drv_get_space(struct s_smc *smc, unsigned int size)
1360 PRINTK(KERN_INFO "mac_drv_get_space (%d bytes), ", size);
1361 virt = (void *) (smc->os.SharedMemAddr + smc->os.SharedMemHeap);
1363 if ((smc->os.SharedMemHeap + size) > smc->os.SharedMemSize) {
1364 printk("Unexpected SMT memory size requested: %d\n", size);
1367 smc->os.SharedMemHeap += size; // Move heap pointer.
1369 PRINTK(KERN_INFO "mac_drv_get_space end\n");
1370 PRINTK(KERN_INFO "virt addr: %lx\n", (ulong) virt);
1371 PRINTK(KERN_INFO "bus addr: %lx\n", (ulong)
1372 (smc->os.SharedMemDMA +
1373 ((char *) virt - (char *)smc->os.SharedMemAddr)));
1375 } // mac_drv_get_space
1378 /************************
1380 * mac_drv_get_desc_mem
1382 * This function is called by the hardware dependent module.
1383 * It allocates the memory for the RxD and TxD descriptors.
1385 * This memory must be non-cached, non-movable and non-swappable.
1386 * This memory should start at a physical page boundary.
1388 * smc - A pointer to the SMT context struct.
1390 * size - Size of memory in bytes to allocate.
1392 * != 0 A pointer to the virtual address of the allocated memory.
1393 * == 0 Allocation error.
1395 ************************/
1396 void *mac_drv_get_desc_mem(struct s_smc *smc, unsigned int size)
1401 PRINTK(KERN_INFO "mac_drv_get_desc_mem\n");
1403 // Descriptor memory must be aligned on 16-byte boundary.
1405 virt = mac_drv_get_space(smc, size);
1407 size = (u_int) (16 - (((unsigned long) virt) & 15UL));
1410 PRINTK("Allocate %u bytes alignment gap ", size);
1411 PRINTK("for descriptor memory.\n");
1413 if (!mac_drv_get_space(smc, size)) {
1414 printk("fddi: Unable to align descriptor memory.\n");
1417 return (virt + size);
1418 } // mac_drv_get_desc_mem
1421 /************************
1425 * Get the physical address of a given virtual address.
1427 * smc - A pointer to the SMT context struct.
1429 * virt - A (virtual) pointer into our 'shared' memory area.
1431 * Physical address of the given virtual address.
1433 ************************/
1434 unsigned long mac_drv_virt2phys(struct s_smc *smc, void *virt)
1436 return (smc->os.SharedMemDMA +
1437 ((char *) virt - (char *)smc->os.SharedMemAddr));
1438 } // mac_drv_virt2phys
1441 /************************
1445 * The HWM calls this function, when the driver leads through a DMA
1446 * transfer. If the OS-specific module must prepare the system hardware
1447 * for the DMA transfer, it should do it in this function.
1449 * The hardware module calls this dma_master if it wants to send an SMT
1450 * frame. This means that the virt address passed in here is part of
1451 * the 'shared' memory area.
1453 * smc - A pointer to the SMT context struct.
1455 * virt - The virtual address of the data.
1457 * len - The length in bytes of the data.
1459 * flag - Indicates the transmit direction and the buffer type:
1460 * DMA_RD (0x01) system RAM ==> adapter buffer memory
1461 * DMA_WR (0x02) adapter buffer memory ==> system RAM
1462 * SMT_BUF (0x80) SMT buffer
1464 * >> NOTE: SMT_BUF and DMA_RD are always set for PCI. <<
1466 * Returns the pyhsical address for the DMA transfer.
1468 ************************/
1469 u_long dma_master(struct s_smc * smc, void *virt, int len, int flag)
1471 return (smc->os.SharedMemDMA +
1472 ((char *) virt - (char *)smc->os.SharedMemAddr));
1476 /************************
1480 * The hardware module calls this routine when it has completed a DMA
1481 * transfer. If the operating system dependent module has set up the DMA
1482 * channel via dma_master() (e.g. Windows NT or AIX) it should clean up
1485 * smc - A pointer to the SMT context struct.
1487 * descr - A pointer to a TxD or RxD, respectively.
1489 * flag - Indicates the DMA transfer direction / SMT buffer:
1490 * DMA_RD (0x01) system RAM ==> adapter buffer memory
1491 * DMA_WR (0x02) adapter buffer memory ==> system RAM
1492 * SMT_BUF (0x80) SMT buffer (managed by HWM)
1496 ************************/
1497 void dma_complete(struct s_smc *smc, volatile union s_fp_descr *descr, int flag)
1499 /* For TX buffers, there are two cases. If it is an SMT transmit
1500 * buffer, there is nothing to do since we use consistent memory
1501 * for the 'shared' memory area. The other case is for normal
1502 * transmit packets given to us by the networking stack, and in
1503 * that case we cleanup the PCI DMA mapping in mac_drv_tx_complete
1506 * For RX buffers, we have to unmap dynamic PCI DMA mappings here
1507 * because the hardware module is about to potentially look at
1508 * the contents of the buffer. If we did not call the PCI DMA
1509 * unmap first, the hardware module could read inconsistent data.
1511 if (flag & DMA_WR) {
1512 skfddi_priv *bp = (skfddi_priv *) & smc->os;
1513 volatile struct s_smt_fp_rxd *r = &descr->r;
1515 /* If SKB is NULL, we used the local buffer. */
1516 if (r->rxd_os.skb && r->rxd_os.dma_addr) {
1517 int MaxFrameSize = bp->MaxFrameSize;
1519 pci_unmap_single(&bp->pdev, r->rxd_os.dma_addr,
1520 MaxFrameSize, PCI_DMA_FROMDEVICE);
1521 r->rxd_os.dma_addr = 0;
1527 /************************
1529 * mac_drv_tx_complete
1531 * Transmit of a packet is complete. Release the tx staging buffer.
1534 * smc - A pointer to the SMT context struct.
1536 * txd - A pointer to the last TxD which is used by the frame.
1540 ************************/
1541 void mac_drv_tx_complete(struct s_smc *smc, volatile struct s_smt_fp_txd *txd)
1543 struct sk_buff *skb;
1545 PRINTK(KERN_INFO "entering mac_drv_tx_complete\n");
1546 // Check if this TxD points to a skb
1548 if (!(skb = txd->txd_os.skb)) {
1549 PRINTK("TXD with no skb assigned.\n");
1552 txd->txd_os.skb = NULL;
1554 // release the DMA mapping
1555 pci_unmap_single(&smc->os.pdev, txd->txd_os.dma_addr,
1556 skb->len, PCI_DMA_TODEVICE);
1557 txd->txd_os.dma_addr = 0;
1559 smc->os.MacStat.tx_packets++; // Count transmitted packets.
1560 smc->os.MacStat.tx_bytes+=skb->len; // Count bytes
1563 dev_kfree_skb_irq(skb);
1565 PRINTK(KERN_INFO "leaving mac_drv_tx_complete\n");
1566 } // mac_drv_tx_complete
1569 /************************
1571 * dump packets to logfile
1573 ************************/
1575 void dump_data(unsigned char *Data, int length)
1578 unsigned char s[255], sh[10];
1582 printk(KERN_INFO "---Packet start---\n");
1583 for (i = 0, j = 0; i < length / 8; i++, j += 8)
1584 printk(KERN_INFO "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1585 Data[j + 0], Data[j + 1], Data[j + 2], Data[j + 3],
1586 Data[j + 4], Data[j + 5], Data[j + 6], Data[j + 7]);
1588 for (i = 0; i < length % 8; i++) {
1589 sprintf(sh, "%02x ", Data[j + i]);
1592 printk(KERN_INFO "%s\n", s);
1593 printk(KERN_INFO "------------------\n");
1596 #define dump_data(data,len)
1597 #endif // DUMPPACKETS
1599 /************************
1601 * mac_drv_rx_complete
1603 * The hardware module calls this function if an LLC frame is received
1604 * in a receive buffer. Also the SMT, NSA, and directed beacon frames
1605 * from the network will be passed to the LLC layer by this function
1606 * if passing is enabled.
1608 * mac_drv_rx_complete forwards the frame to the LLC layer if it should
1609 * be received. It also fills the RxD ring with new receive buffers if
1610 * some can be queued.
1612 * smc - A pointer to the SMT context struct.
1614 * rxd - A pointer to the first RxD which is used by the receive frame.
1616 * frag_count - Count of RxDs used by the received frame.
1618 * len - Frame length.
1622 ************************/
1623 void mac_drv_rx_complete(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
1624 int frag_count, int len)
1626 skfddi_priv *bp = (skfddi_priv *) & smc->os;
1627 struct sk_buff *skb;
1628 unsigned char *virt, *cp;
1632 PRINTK(KERN_INFO "entering mac_drv_rx_complete (len=%d)\n", len);
1633 if (frag_count != 1) { // This is not allowed to happen.
1635 printk("fddi: Multi-fragment receive!\n");
1636 goto RequeueRxd; // Re-use the given RXD(s).
1639 skb = rxd->rxd_os.skb;
1641 PRINTK(KERN_INFO "No skb in rxd\n");
1642 smc->os.MacStat.rx_errors++;
1647 // The DMA mapping was released in dma_complete above.
1649 dump_data(skb->data, len);
1652 * FDDI Frame format:
1653 * +-------+-------+-------+------------+--------+------------+
1654 * | FC[1] | DA[6] | SA[6] | RIF[0..18] | LLC[3] | Data[0..n] |
1655 * +-------+-------+-------+------------+--------+------------+
1657 * FC = Frame Control
1658 * DA = Destination Address
1659 * SA = Source Address
1660 * RIF = Routing Information Field
1661 * LLC = Logical Link Control
1664 // Remove Routing Information Field (RIF), if present.
1666 if ((virt[1 + 6] & FDDI_RII) == 0)
1670 // goos: RIF removal has still to be tested
1671 PRINTK(KERN_INFO "RIF found\n");
1672 // Get RIF length from Routing Control (RC) field.
1673 cp = virt + FDDI_MAC_HDR_LEN; // Point behind MAC header.
1675 ri = ntohs(*((unsigned short *) cp));
1676 RifLength = ri & FDDI_RCF_LEN_MASK;
1677 if (len < (int) (FDDI_MAC_HDR_LEN + RifLength)) {
1678 printk("fddi: Invalid RIF.\n");
1679 goto RequeueRxd; // Discard the frame.
1682 virt[1 + 6] &= ~FDDI_RII; // Clear RII bit.
1685 virt = cp + RifLength;
1686 for (n = FDDI_MAC_HDR_LEN; n; n--)
1688 // adjust sbd->data pointer
1689 skb_pull(skb, RifLength);
1694 // Count statistics.
1695 smc->os.MacStat.rx_packets++; // Count indicated receive packets.
1696 smc->os.MacStat.rx_bytes+=len; // Count bytes
1698 // virt points to header again
1699 if (virt[1] & 0x01) { // Check group (multicast) bit.
1701 smc->os.MacStat.multicast++;
1704 // deliver frame to system
1705 rxd->rxd_os.skb = NULL;
1707 skb->protocol = fddi_type_trans(skb, bp->dev);
1708 skb->dev = bp->dev; /* pass up device pointer */
1711 bp->dev->last_rx = jiffies;
1713 HWM_RX_CHECK(smc, RX_LOW_WATERMARK);
1717 PRINTK(KERN_INFO "Rx: re-queue RXD.\n");
1718 mac_drv_requeue_rxd(smc, rxd, frag_count);
1719 smc->os.MacStat.rx_errors++; // Count receive packets not indicated.
1721 } // mac_drv_rx_complete
1724 /************************
1726 * mac_drv_requeue_rxd
1728 * The hardware module calls this function to request the OS-specific
1729 * module to queue the receive buffer(s) represented by the pointer
1730 * to the RxD and the frag_count into the receive queue again. This
1731 * buffer was filled with an invalid frame or an SMT frame.
1733 * smc - A pointer to the SMT context struct.
1735 * rxd - A pointer to the first RxD which is used by the receive frame.
1737 * frag_count - Count of RxDs used by the received frame.
1741 ************************/
1742 void mac_drv_requeue_rxd(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
1745 volatile struct s_smt_fp_rxd *next_rxd;
1746 volatile struct s_smt_fp_rxd *src_rxd;
1747 struct sk_buff *skb;
1749 unsigned char *v_addr;
1752 if (frag_count != 1) // This is not allowed to happen.
1754 printk("fddi: Multi-fragment requeue!\n");
1756 MaxFrameSize = ((skfddi_priv *) & smc->os)->MaxFrameSize;
1758 for (; frag_count > 0; frag_count--) {
1759 next_rxd = src_rxd->rxd_next;
1760 rxd = HWM_GET_CURR_RXD(smc);
1762 skb = src_rxd->rxd_os.skb;
1763 if (skb == NULL) { // this should not happen
1765 PRINTK("Requeue with no skb in rxd!\n");
1766 skb = alloc_skb(MaxFrameSize + 3, GFP_ATOMIC);
1769 rxd->rxd_os.skb = skb;
1770 skb_reserve(skb, 3);
1771 skb_put(skb, MaxFrameSize);
1773 b_addr = pci_map_single(&smc->os.pdev,
1776 PCI_DMA_FROMDEVICE);
1777 rxd->rxd_os.dma_addr = b_addr;
1779 // no skb available, use local buffer
1780 PRINTK("Queueing invalid buffer!\n");
1781 rxd->rxd_os.skb = NULL;
1782 v_addr = smc->os.LocalRxBuffer;
1783 b_addr = smc->os.LocalRxBufferDMA;
1786 // we use skb from old rxd
1787 rxd->rxd_os.skb = skb;
1789 b_addr = pci_map_single(&smc->os.pdev,
1792 PCI_DMA_FROMDEVICE);
1793 rxd->rxd_os.dma_addr = b_addr;
1795 hwm_rx_frag(smc, v_addr, b_addr, MaxFrameSize,
1796 FIRST_FRAG | LAST_FRAG);
1800 } // mac_drv_requeue_rxd
1803 /************************
1807 * The hardware module calls this function at initialization time
1808 * to fill the RxD ring with receive buffers. It is also called by
1809 * mac_drv_rx_complete if rx_free is large enough to queue some new
1810 * receive buffers into the RxD ring. mac_drv_fill_rxd queues new
1811 * receive buffers as long as enough RxDs and receive buffers are
1814 * smc - A pointer to the SMT context struct.
1818 ************************/
1819 void mac_drv_fill_rxd(struct s_smc *smc)
1822 unsigned char *v_addr;
1823 unsigned long b_addr;
1824 struct sk_buff *skb;
1825 volatile struct s_smt_fp_rxd *rxd;
1827 PRINTK(KERN_INFO "entering mac_drv_fill_rxd\n");
1829 // Walk through the list of free receive buffers, passing receive
1830 // buffers to the HWM as long as RXDs are available.
1832 MaxFrameSize = ((skfddi_priv *) & smc->os)->MaxFrameSize;
1833 // Check if there is any RXD left.
1834 while (HWM_GET_RX_FREE(smc) > 0) {
1835 PRINTK(KERN_INFO ".\n");
1837 rxd = HWM_GET_CURR_RXD(smc);
1838 skb = alloc_skb(MaxFrameSize + 3, GFP_ATOMIC);
1841 skb_reserve(skb, 3);
1842 skb_put(skb, MaxFrameSize);
1844 b_addr = pci_map_single(&smc->os.pdev,
1847 PCI_DMA_FROMDEVICE);
1848 rxd->rxd_os.dma_addr = b_addr;
1850 // no skb available, use local buffer
1851 // System has run out of buffer memory, but we want to
1852 // keep the receiver running in hope of better times.
1853 // Multiple descriptors may point to this local buffer,
1854 // so data in it must be considered invalid.
1855 PRINTK("Queueing invalid buffer!\n");
1856 v_addr = smc->os.LocalRxBuffer;
1857 b_addr = smc->os.LocalRxBufferDMA;
1860 rxd->rxd_os.skb = skb;
1862 // Pass receive buffer to HWM.
1863 hwm_rx_frag(smc, v_addr, b_addr, MaxFrameSize,
1864 FIRST_FRAG | LAST_FRAG);
1866 PRINTK(KERN_INFO "leaving mac_drv_fill_rxd\n");
1867 } // mac_drv_fill_rxd
1870 /************************
1874 * The hardware module calls this function to release unused
1877 * smc - A pointer to the SMT context struct.
1879 * rxd - A pointer to the first RxD which is used by the receive buffer.
1881 * frag_count - Count of RxDs used by the receive buffer.
1885 ************************/
1886 void mac_drv_clear_rxd(struct s_smc *smc, volatile struct s_smt_fp_rxd *rxd,
1890 struct sk_buff *skb;
1892 PRINTK("entering mac_drv_clear_rxd\n");
1894 if (frag_count != 1) // This is not allowed to happen.
1896 printk("fddi: Multi-fragment clear!\n");
1898 for (; frag_count > 0; frag_count--) {
1899 skb = rxd->rxd_os.skb;
1901 skfddi_priv *bp = (skfddi_priv *) & smc->os;
1902 int MaxFrameSize = bp->MaxFrameSize;
1904 pci_unmap_single(&bp->pdev, rxd->rxd_os.dma_addr,
1905 MaxFrameSize, PCI_DMA_FROMDEVICE);
1908 rxd->rxd_os.skb = NULL;
1910 rxd = rxd->rxd_next; // Next RXD.
1913 } // mac_drv_clear_rxd
1916 /************************
1920 * The hardware module calls this routine when an SMT or NSA frame of the
1921 * local SMT should be delivered to the LLC layer.
1923 * It is necessary to have this function, because there is no other way to
1924 * copy the contents of SMT MBufs into receive buffers.
1926 * mac_drv_rx_init allocates the required target memory for this frame,
1927 * and receives the frame fragment by fragment by calling mac_drv_rx_frag.
1929 * smc - A pointer to the SMT context struct.
1931 * len - The length (in bytes) of the received frame (FC, DA, SA, Data).
1933 * fc - The Frame Control field of the received frame.
1935 * look_ahead - A pointer to the lookahead data buffer (may be NULL).
1937 * la_len - The length of the lookahead data stored in the lookahead
1938 * buffer (may be zero).
1940 * Always returns zero (0).
1942 ************************/
1943 int mac_drv_rx_init(struct s_smc *smc, int len, int fc,
1944 char *look_ahead, int la_len)
1946 struct sk_buff *skb;
1948 PRINTK("entering mac_drv_rx_init(len=%d)\n", len);
1950 // "Received" a SMT or NSA frame of the local SMT.
1952 if (len != la_len || len < FDDI_MAC_HDR_LEN || !look_ahead) {
1953 PRINTK("fddi: Discard invalid local SMT frame\n");
1954 PRINTK(" len=%d, la_len=%d, (ULONG) look_ahead=%08lXh.\n",
1955 len, la_len, (unsigned long) look_ahead);
1958 skb = alloc_skb(len + 3, GFP_ATOMIC);
1960 PRINTK("fddi: Local SMT: skb memory exhausted.\n");
1963 skb_reserve(skb, 3);
1965 memcpy(skb->data, look_ahead, len);
1967 // deliver frame to system
1968 skb->protocol = fddi_type_trans(skb, ((skfddi_priv *) & smc->os)->dev);
1969 skb->dev->last_rx = jiffies;
1973 } // mac_drv_rx_init
1976 /************************
1980 * This routine is called periodically by the SMT module to clean up the
1983 * Return any queued frames back to the upper protocol layers if the ring
1986 * smc - A pointer to the SMT context struct.
1990 ************************/
1991 void smt_timer_poll(struct s_smc *smc)
1996 /************************
1998 * ring_status_indication
2000 * This function indicates a change of the ring state.
2002 * smc - A pointer to the SMT context struct.
2004 * status - The current ring status.
2008 ************************/
2009 void ring_status_indication(struct s_smc *smc, u_long status)
2011 PRINTK("ring_status_indication( ");
2012 if (status & RS_RES15)
2013 PRINTK("RS_RES15 ");
2014 if (status & RS_HARDERROR)
2015 PRINTK("RS_HARDERROR ");
2016 if (status & RS_SOFTERROR)
2017 PRINTK("RS_SOFTERROR ");
2018 if (status & RS_BEACON)
2019 PRINTK("RS_BEACON ");
2020 if (status & RS_PATHTEST)
2021 PRINTK("RS_PATHTEST ");
2022 if (status & RS_SELFTEST)
2023 PRINTK("RS_SELFTEST ");
2024 if (status & RS_RES9)
2026 if (status & RS_DISCONNECT)
2027 PRINTK("RS_DISCONNECT ");
2028 if (status & RS_RES7)
2030 if (status & RS_DUPADDR)
2031 PRINTK("RS_DUPADDR ");
2032 if (status & RS_NORINGOP)
2033 PRINTK("RS_NORINGOP ");
2034 if (status & RS_VERSION)
2035 PRINTK("RS_VERSION ");
2036 if (status & RS_STUCKBYPASSS)
2037 PRINTK("RS_STUCKBYPASSS ");
2038 if (status & RS_EVENT)
2039 PRINTK("RS_EVENT ");
2040 if (status & RS_RINGOPCHANGE)
2041 PRINTK("RS_RINGOPCHANGE ");
2042 if (status & RS_RES0)
2045 } // ring_status_indication
2048 /************************
2052 * Gets the current time from the system.
2056 * The current time in TICKS_PER_SECOND.
2058 * TICKS_PER_SECOND has the unit 'count of timer ticks per second'. It is
2059 * defined in "targetos.h". The definition of TICKS_PER_SECOND must comply
2060 * to the time returned by smt_get_time().
2062 ************************/
2063 unsigned long smt_get_time(void)
2069 /************************
2073 * Status counter update (ring_op, fifo full).
2075 * smc - A pointer to the SMT context struct.
2077 * stat - = 0: A ring operational change occurred.
2078 * = 1: The FORMAC FIFO buffer is full / FIFO overflow.
2082 ************************/
2083 void smt_stat_counter(struct s_smc *smc, int stat)
2085 // BOOLEAN RingIsUp ;
2087 PRINTK(KERN_INFO "smt_stat_counter\n");
2090 PRINTK(KERN_INFO "Ring operational change.\n");
2093 PRINTK(KERN_INFO "Receive fifo overflow.\n");
2094 smc->os.MacStat.rx_errors++;
2097 PRINTK(KERN_INFO "Unknown status (%d).\n", stat);
2100 } // smt_stat_counter
2103 /************************
2107 * Sets CFM state in custom statistics.
2109 * smc - A pointer to the SMT context struct.
2111 * c_state - Possible values are:
2113 * EC0_OUT, EC1_IN, EC2_TRACE, EC3_LEAVE, EC4_PATH_TEST,
2114 * EC5_INSERT, EC6_CHECK, EC7_DEINSERT
2118 ************************/
2119 void cfm_state_change(struct s_smc *smc, int c_state)
2147 s = "SC10_C_WRAP_B";
2150 s = "SC11_C_WRAP_S";
2153 PRINTK(KERN_INFO "cfm_state_change: unknown %d\n", c_state);
2156 PRINTK(KERN_INFO "cfm_state_change: %s\n", s);
2157 #endif // DRIVERDEBUG
2158 } // cfm_state_change
2161 /************************
2165 * Sets ECM state in custom statistics.
2167 * smc - A pointer to the SMT context struct.
2169 * e_state - Possible values are:
2171 * SC0_ISOLATED, SC1_WRAP_A (5), SC2_WRAP_B (6), SC4_THRU_A (12),
2172 * SC5_THRU_B (7), SC7_WRAP_S (8)
2176 ************************/
2177 void ecm_state_change(struct s_smc *smc, int e_state)
2196 s = "EC4_PATH_TEST";
2211 PRINTK(KERN_INFO "ecm_state_change: %s\n", s);
2212 #endif //DRIVERDEBUG
2213 } // ecm_state_change
2216 /************************
2220 * Sets RMT state in custom statistics.
2222 * smc - A pointer to the SMT context struct.
2224 * r_state - Possible values are:
2226 * RM0_ISOLATED, RM1_NON_OP, RM2_RING_OP, RM3_DETECT,
2227 * RM4_NON_OP_DUP, RM5_RING_OP_DUP, RM6_DIRECTED, RM7_TRACE
2231 ************************/
2232 void rmt_state_change(struct s_smc *smc, int r_state)
2242 s = "RM1_NON_OP - not operational";
2245 s = "RM2_RING_OP - ring operational";
2248 s = "RM3_DETECT - detect dupl addresses";
2250 case RM4_NON_OP_DUP:
2251 s = "RM4_NON_OP_DUP - dupl. addr detected";
2253 case RM5_RING_OP_DUP:
2254 s = "RM5_RING_OP_DUP - ring oper. with dupl. addr";
2257 s = "RM6_DIRECTED - sending directed beacons";
2260 s = "RM7_TRACE - trace initiated";
2266 PRINTK(KERN_INFO "[rmt_state_change: %s]\n", s);
2267 #endif // DRIVERDEBUG
2268 } // rmt_state_change
2271 /************************
2273 * drv_reset_indication
2275 * This function is called by the SMT when it has detected a severe
2276 * hardware problem. The driver should perform a reset on the adapter
2277 * as soon as possible, but not from within this function.
2279 * smc - A pointer to the SMT context struct.
2283 ************************/
2284 void drv_reset_indication(struct s_smc *smc)
2286 PRINTK(KERN_INFO "entering drv_reset_indication\n");
2288 smc->os.ResetRequested = TRUE; // Set flag.
2290 } // drv_reset_indication
2292 static struct pci_driver skfddi_pci_driver = {
2294 .id_table = skfddi_pci_tbl,
2295 .probe = skfp_init_one,
2296 .remove = __devexit_p(skfp_remove_one),
2299 static int __init skfd_init(void)
2301 return pci_module_init(&skfddi_pci_driver);
2304 static void __exit skfd_exit(void)
2306 pci_unregister_driver(&skfddi_pci_driver);
2309 module_init(skfd_init);
2310 module_exit(skfd_exit);