1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright Information:
7 * Copyright SysKonnect 1998,1999.
9 * The information in this file is provided "AS IS" without warranty.
12 * A Linux device driver supporting the SysKonnect FDDI PCI controller
16 * CG Christoph Goos (cgoos@syskonnect.de)
21 * Address all question to:
24 * The technical manual for the adapters is available from SysKonnect's
25 * web pages: www.syskonnect.com
26 * Goto "Support" and search Knowledge Base for "manual".
28 * Driver Architecture:
29 * The driver architecture is based on the DEC FDDI driver by
30 * Lawrence V. Stefani and several ethernet drivers.
31 * I also used an existing Windows NT miniport driver.
32 * All hardware dependent functions are handled by the SysKonnect
34 * The only headerfiles that are directly related to this source
35 * are skfddi.c, h/types.h, h/osdef1st.h, h/targetos.h.
36 * The others belong to the SysKonnect FDDI Hardware Module and
37 * should better not be changed.
39 * Modification History:
40 * Date Name Description
41 * 02-Mar-98 CG Created.
43 * 10-Mar-99 CG Support for 2.2.x added.
44 * 25-Mar-99 CG Corrected IRQ routing for SMP (APIC)
45 * 26-Oct-99 CG Fixed compilation error on 2.2.13
46 * 12-Nov-99 CG Source code release
47 * 22-Nov-99 CG Included in kernel source.
48 * 07-May-00 DM 64 bit fixes, new dma interface
49 * 31-Jul-03 DB Audit copy_*_user in skfp_ioctl
50 * Daniele Bellucci <bellucda@tiscali.it>
51 * 03-Dec-03 SH Convert to PCI device model
53 * Compilation options (-Dxxx):
54 * DRIVERDEBUG print lots of messages to log file
55 * DUMPPACKETS print received/transmitted packets to logfile
57 * Tested cpu architectures:
62 /* Version information string - should be updated prior to */
63 /* each new release!!! */
64 #define VERSION "2.07"
66 static const char * const boot_msg
=
67 "SysKonnect FDDI PCI Adapter driver v" VERSION
" for\n"
68 " SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
72 #include <linux/capability.h>
73 #include <linux/module.h>
74 #include <linux/kernel.h>
75 #include <linux/errno.h>
76 #include <linux/ioport.h>
77 #include <linux/interrupt.h>
78 #include <linux/pci.h>
79 #include <linux/netdevice.h>
80 #include <linux/fddidevice.h>
81 #include <linux/skbuff.h>
82 #include <linux/bitops.h>
83 #include <linux/gfp.h>
85 #include <asm/byteorder.h>
87 #include <linux/uaccess.h>
90 #undef ADDR // undo Linux definition
94 #include "h/smtstate.h"
97 // Define module-wide (static) routines
98 static int skfp_driver_init(struct net_device
*dev
);
99 static int skfp_open(struct net_device
*dev
);
100 static int skfp_close(struct net_device
*dev
);
101 static irqreturn_t
skfp_interrupt(int irq
, void *dev_id
);
102 static struct net_device_stats
*skfp_ctl_get_stats(struct net_device
*dev
);
103 static void skfp_ctl_set_multicast_list(struct net_device
*dev
);
104 static void skfp_ctl_set_multicast_list_wo_lock(struct net_device
*dev
);
105 static int skfp_ctl_set_mac_address(struct net_device
*dev
, void *addr
);
106 static int skfp_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
);
107 static netdev_tx_t
skfp_send_pkt(struct sk_buff
*skb
,
108 struct net_device
*dev
);
109 static void send_queued_packets(struct s_smc
*smc
);
110 static void CheckSourceAddress(unsigned char *frame
, unsigned char *hw_addr
);
111 static void ResetAdapter(struct s_smc
*smc
);
114 // Functions needed by the hardware module
115 void *mac_drv_get_space(struct s_smc
*smc
, u_int size
);
116 void *mac_drv_get_desc_mem(struct s_smc
*smc
, u_int size
);
117 unsigned long mac_drv_virt2phys(struct s_smc
*smc
, void *virt
);
118 unsigned long dma_master(struct s_smc
*smc
, void *virt
, int len
, int flag
);
119 void dma_complete(struct s_smc
*smc
, volatile union s_fp_descr
*descr
,
121 void mac_drv_tx_complete(struct s_smc
*smc
, volatile struct s_smt_fp_txd
*txd
);
122 void llc_restart_tx(struct s_smc
*smc
);
123 void mac_drv_rx_complete(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
124 int frag_count
, int len
);
125 void mac_drv_requeue_rxd(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
127 void mac_drv_fill_rxd(struct s_smc
*smc
);
128 void mac_drv_clear_rxd(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
130 int mac_drv_rx_init(struct s_smc
*smc
, int len
, int fc
, char *look_ahead
,
132 void dump_data(unsigned char *Data
, int length
);
134 // External functions from the hardware module
135 extern u_int
mac_drv_check_space(void);
136 extern int mac_drv_init(struct s_smc
*smc
);
137 extern void hwm_tx_frag(struct s_smc
*smc
, char far
* virt
, u_long phys
,
138 int len
, int frame_status
);
139 extern int hwm_tx_init(struct s_smc
*smc
, u_char fc
, int frag_count
,
140 int frame_len
, int frame_status
);
141 extern void fddi_isr(struct s_smc
*smc
);
142 extern void hwm_rx_frag(struct s_smc
*smc
, char far
* virt
, u_long phys
,
143 int len
, int frame_status
);
144 extern void mac_drv_rx_mode(struct s_smc
*smc
, int mode
);
145 extern void mac_drv_clear_rx_queue(struct s_smc
*smc
);
146 extern void enable_tx_irq(struct s_smc
*smc
, u_short queue
);
148 static const struct pci_device_id skfddi_pci_tbl
[] = {
149 { PCI_VENDOR_ID_SK
, PCI_DEVICE_ID_SK_FP
, PCI_ANY_ID
, PCI_ANY_ID
, },
150 { } /* Terminating entry */
152 MODULE_DEVICE_TABLE(pci
, skfddi_pci_tbl
);
153 MODULE_LICENSE("GPL");
154 MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>");
156 // Define module-wide (static) variables
158 static int num_boards
; /* total number of adapters configured */
160 static const struct net_device_ops skfp_netdev_ops
= {
161 .ndo_open
= skfp_open
,
162 .ndo_stop
= skfp_close
,
163 .ndo_start_xmit
= skfp_send_pkt
,
164 .ndo_get_stats
= skfp_ctl_get_stats
,
165 .ndo_set_rx_mode
= skfp_ctl_set_multicast_list
,
166 .ndo_set_mac_address
= skfp_ctl_set_mac_address
,
167 .ndo_do_ioctl
= skfp_ioctl
,
176 * Probes for supported FDDI PCI controllers
182 * pdev - pointer to PCI device information
184 * Functional Description:
185 * This is now called by PCI driver registration process
186 * for each board found.
189 * 0 - This device (fddi0, fddi1, etc) configured successfully
190 * -ENODEV - No devices present, or no SysKonnect FDDI PCI device
191 * present for this device name
195 * Device structures for FDDI adapters (fddi0, fddi1, etc) are
196 * initialized and the board resources are read and stored in
197 * the device structure.
199 static int skfp_init_one(struct pci_dev
*pdev
,
200 const struct pci_device_id
*ent
)
202 struct net_device
*dev
;
203 struct s_smc
*smc
; /* board pointer */
207 pr_debug("entering skfp_init_one\n");
210 printk("%s\n", boot_msg
);
212 err
= pci_enable_device(pdev
);
216 err
= pci_request_regions(pdev
, "skfddi");
220 pci_set_master(pdev
);
223 if (!(pci_resource_flags(pdev
, 0) & IORESOURCE_MEM
)) {
224 printk(KERN_ERR
"skfp: region is not an MMIO resource\n");
229 mem
= ioremap(pci_resource_start(pdev
, 0), 0x4000);
231 if (!(pci_resource_flags(pdev
, 1) & IO_RESOURCE_IO
)) {
232 printk(KERN_ERR
"skfp: region is not PIO resource\n");
237 mem
= ioport_map(pci_resource_start(pdev
, 1), FP_IO_LEN
);
240 printk(KERN_ERR
"skfp: Unable to map register, "
241 "FDDI adapter will be disabled.\n");
246 dev
= alloc_fddidev(sizeof(struct s_smc
));
248 printk(KERN_ERR
"skfp: Unable to allocate fddi device, "
249 "FDDI adapter will be disabled.\n");
254 dev
->irq
= pdev
->irq
;
255 dev
->netdev_ops
= &skfp_netdev_ops
;
257 SET_NETDEV_DEV(dev
, &pdev
->dev
);
259 /* Initialize board structure with bus-specific info */
260 smc
= netdev_priv(dev
);
262 smc
->os
.bus_type
= SK_BUS_TYPE_PCI
;
263 smc
->os
.pdev
= *pdev
;
264 smc
->os
.QueueSkb
= MAX_TX_QUEUE_LEN
;
265 smc
->os
.MaxFrameSize
= MAX_FRAME_SIZE
;
269 smc
->os
.ResetRequested
= FALSE
;
270 skb_queue_head_init(&smc
->os
.SendSkbQueue
);
272 dev
->base_addr
= (unsigned long)mem
;
274 err
= skfp_driver_init(dev
);
278 err
= register_netdev(dev
);
283 pci_set_drvdata(pdev
, dev
);
285 if ((pdev
->subsystem_device
& 0xff00) == 0x5500 ||
286 (pdev
->subsystem_device
& 0xff00) == 0x5800)
287 printk("%s: SysKonnect FDDI PCI adapter"
288 " found (SK-%04X)\n", dev
->name
,
289 pdev
->subsystem_device
);
291 printk("%s: FDDI PCI adapter found\n", dev
->name
);
295 if (smc
->os
.SharedMemAddr
)
296 dma_free_coherent(&pdev
->dev
, smc
->os
.SharedMemSize
,
297 smc
->os
.SharedMemAddr
,
298 smc
->os
.SharedMemDMA
);
299 dma_free_coherent(&pdev
->dev
, MAX_FRAME_SIZE
,
300 smc
->os
.LocalRxBuffer
, smc
->os
.LocalRxBufferDMA
);
310 pci_release_regions(pdev
);
312 pci_disable_device(pdev
);
317 * Called for each adapter board from pci_unregister_driver
319 static void skfp_remove_one(struct pci_dev
*pdev
)
321 struct net_device
*p
= pci_get_drvdata(pdev
);
322 struct s_smc
*lp
= netdev_priv(p
);
324 unregister_netdev(p
);
326 if (lp
->os
.SharedMemAddr
) {
327 dma_free_coherent(&pdev
->dev
,
328 lp
->os
.SharedMemSize
,
329 lp
->os
.SharedMemAddr
,
330 lp
->os
.SharedMemDMA
);
331 lp
->os
.SharedMemAddr
= NULL
;
333 if (lp
->os
.LocalRxBuffer
) {
334 dma_free_coherent(&pdev
->dev
,
336 lp
->os
.LocalRxBuffer
,
337 lp
->os
.LocalRxBufferDMA
);
338 lp
->os
.LocalRxBuffer
= NULL
;
343 ioport_unmap(lp
->hw
.iop
);
345 pci_release_regions(pdev
);
348 pci_disable_device(pdev
);
352 * ====================
353 * = skfp_driver_init =
354 * ====================
357 * Initializes remaining adapter board structure information
358 * and makes sure adapter is in a safe state prior to skfp_open().
364 * dev - pointer to device information
366 * Functional Description:
367 * This function allocates additional resources such as the host memory
368 * blocks needed by the adapter.
369 * The adapter is also reset. The OS must call skfp_open() to open
370 * the adapter and bring it on-line.
373 * 0 - initialization succeeded
374 * -1 - initialization failed
376 static int skfp_driver_init(struct net_device
*dev
)
378 struct s_smc
*smc
= netdev_priv(dev
);
379 skfddi_priv
*bp
= &smc
->os
;
382 pr_debug("entering skfp_driver_init\n");
384 // set the io address in private structures
385 bp
->base_addr
= dev
->base_addr
;
387 // Get the interrupt level from the PCI Configuration Table
388 smc
->hw
.irq
= dev
->irq
;
390 spin_lock_init(&bp
->DriverLock
);
392 // Allocate invalid frame
393 bp
->LocalRxBuffer
= dma_alloc_coherent(&bp
->pdev
.dev
, MAX_FRAME_SIZE
,
394 &bp
->LocalRxBufferDMA
,
396 if (!bp
->LocalRxBuffer
) {
397 printk("could not allocate mem for ");
398 printk("LocalRxBuffer: %d byte\n", MAX_FRAME_SIZE
);
402 // Determine the required size of the 'shared' memory area.
403 bp
->SharedMemSize
= mac_drv_check_space();
404 pr_debug("Memory for HWM: %ld\n", bp
->SharedMemSize
);
405 if (bp
->SharedMemSize
> 0) {
406 bp
->SharedMemSize
+= 16; // for descriptor alignment
408 bp
->SharedMemAddr
= dma_alloc_coherent(&bp
->pdev
.dev
,
412 if (!bp
->SharedMemAddr
) {
413 printk("could not allocate mem for ");
414 printk("hardware module: %ld byte\n",
420 bp
->SharedMemAddr
= NULL
;
423 bp
->SharedMemHeap
= 0;
425 card_stop(smc
); // Reset adapter.
427 pr_debug("mac_drv_init()..\n");
428 if (mac_drv_init(smc
) != 0) {
429 pr_debug("mac_drv_init() failed\n");
432 read_address(smc
, NULL
);
433 pr_debug("HW-Addr: %pMF\n", smc
->hw
.fddi_canon_addr
.a
);
434 memcpy(dev
->dev_addr
, smc
->hw
.fddi_canon_addr
.a
, ETH_ALEN
);
436 smt_reset_defaults(smc
, 0);
441 if (bp
->SharedMemAddr
) {
442 dma_free_coherent(&bp
->pdev
.dev
,
446 bp
->SharedMemAddr
= NULL
;
448 if (bp
->LocalRxBuffer
) {
449 dma_free_coherent(&bp
->pdev
.dev
, MAX_FRAME_SIZE
,
450 bp
->LocalRxBuffer
, bp
->LocalRxBufferDMA
);
451 bp
->LocalRxBuffer
= NULL
;
454 } // skfp_driver_init
469 * dev - pointer to device information
471 * Functional Description:
472 * This function brings the adapter to an operational state.
475 * 0 - Adapter was successfully opened
476 * -EAGAIN - Could not register IRQ
478 static int skfp_open(struct net_device
*dev
)
480 struct s_smc
*smc
= netdev_priv(dev
);
483 pr_debug("entering skfp_open\n");
484 /* Register IRQ - support shared interrupts by passing device ptr */
485 err
= request_irq(dev
->irq
, skfp_interrupt
, IRQF_SHARED
,
491 * Set current address to factory MAC address
493 * Note: We've already done this step in skfp_driver_init.
494 * However, it's possible that a user has set a node
495 * address override, then closed and reopened the
496 * adapter. Unless we reset the device address field
497 * now, we'll continue to use the existing modified
500 read_address(smc
, NULL
);
501 memcpy(dev
->dev_addr
, smc
->hw
.fddi_canon_addr
.a
, ETH_ALEN
);
507 /* Clear local multicast address tables */
508 mac_clear_multicast(smc
);
510 /* Disable promiscuous filter settings */
511 mac_drv_rx_mode(smc
, RX_DISABLE_PROMISC
);
513 netif_start_queue(dev
);
524 * Closes the device/module.
530 * dev - pointer to device information
532 * Functional Description:
533 * This routine closes the adapter and brings it to a safe state.
534 * The interrupt service routine is deregistered with the OS.
535 * The adapter can be opened again with another call to skfp_open().
541 * No further requests for this adapter are made after this routine is
542 * called. skfp_open() can be called to reset and reinitialize the
545 static int skfp_close(struct net_device
*dev
)
547 struct s_smc
*smc
= netdev_priv(dev
);
548 skfddi_priv
*bp
= &smc
->os
;
551 smt_reset_defaults(smc
, 1);
553 mac_drv_clear_tx_queue(smc
);
554 mac_drv_clear_rx_queue(smc
);
556 netif_stop_queue(dev
);
557 /* Deregister (free) IRQ */
558 free_irq(dev
->irq
, dev
);
560 skb_queue_purge(&bp
->SendSkbQueue
);
561 bp
->QueueSkb
= MAX_TX_QUEUE_LEN
;
573 * Interrupt processing routine
579 * irq - interrupt vector
580 * dev_id - pointer to device information
582 * Functional Description:
583 * This routine calls the interrupt processing routine for this adapter. It
584 * disables and reenables adapter interrupts, as appropriate. We can support
585 * shared interrupts since the incoming dev_id pointer provides our device
586 * structure context. All the real work is done in the hardware module.
592 * The interrupt acknowledgement at the hardware level (eg. ACKing the PIC
593 * on Intel-based systems) is done by the operating system outside this
596 * System interrupts are enabled through this call.
599 * Interrupts are disabled, then reenabled at the adapter.
602 static irqreturn_t
skfp_interrupt(int irq
, void *dev_id
)
604 struct net_device
*dev
= dev_id
;
605 struct s_smc
*smc
; /* private board structure pointer */
608 smc
= netdev_priv(dev
);
611 // IRQs enabled or disabled ?
612 if (inpd(ADDR(B0_IMSK
)) == 0) {
613 // IRQs are disabled: must be shared interrupt
616 // Note: At this point, IRQs are enabled.
617 if ((inpd(ISR_A
) & smc
->hw
.is_imask
) == 0) { // IRQ?
618 // Adapter did not issue an IRQ: must be shared interrupt
621 CLI_FBI(); // Disable IRQs from our adapter.
622 spin_lock(&bp
->DriverLock
);
624 // Call interrupt handler in hardware module (HWM).
627 if (smc
->os
.ResetRequested
) {
629 smc
->os
.ResetRequested
= FALSE
;
631 spin_unlock(&bp
->DriverLock
);
632 STI_FBI(); // Enable IRQs from our adapter.
639 * ======================
640 * = skfp_ctl_get_stats =
641 * ======================
644 * Get statistics for FDDI adapter
647 * Pointer to FDDI statistics structure
650 * dev - pointer to device information
652 * Functional Description:
653 * Gets current MIB objects from adapter, then
654 * returns FDDI statistics structure as defined
657 * Note: Since the FDDI statistics structure is
658 * still new and the device structure doesn't
659 * have an FDDI-specific get statistics handler,
660 * we'll return the FDDI statistics structure as
661 * a pointer to an Ethernet statistics structure.
662 * That way, at least the first part of the statistics
663 * structure can be decoded properly.
664 * We'll have to pay attention to this routine as the
665 * device structure becomes more mature and LAN media
669 static struct net_device_stats
*skfp_ctl_get_stats(struct net_device
*dev
)
671 struct s_smc
*bp
= netdev_priv(dev
);
673 /* Fill the bp->stats structure with driver-maintained counters */
675 bp
->os
.MacStat
.port_bs_flag
[0] = 0x1234;
676 bp
->os
.MacStat
.port_bs_flag
[1] = 0x5678;
677 // goos: need to fill out fddi statistic
679 /* Get FDDI SMT MIB objects */
681 /* Fill the bp->stats structure with the SMT MIB object values */
683 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
));
684 bp
->stats
.smt_op_version_id
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_op_version_id
;
685 bp
->stats
.smt_hi_version_id
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_hi_version_id
;
686 bp
->stats
.smt_lo_version_id
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_lo_version_id
;
687 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
));
688 bp
->stats
.smt_mib_version_id
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_mib_version_id
;
689 bp
->stats
.smt_mac_cts
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_mac_ct
;
690 bp
->stats
.smt_non_master_cts
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_non_master_ct
;
691 bp
->stats
.smt_master_cts
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_master_ct
;
692 bp
->stats
.smt_available_paths
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_available_paths
;
693 bp
->stats
.smt_config_capabilities
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_config_capabilities
;
694 bp
->stats
.smt_config_policy
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_config_policy
;
695 bp
->stats
.smt_connection_policy
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_connection_policy
;
696 bp
->stats
.smt_t_notify
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_t_notify
;
697 bp
->stats
.smt_stat_rpt_policy
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_stat_rpt_policy
;
698 bp
->stats
.smt_trace_max_expiration
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_trace_max_expiration
;
699 bp
->stats
.smt_bypass_present
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_bypass_present
;
700 bp
->stats
.smt_ecm_state
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_ecm_state
;
701 bp
->stats
.smt_cf_state
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_cf_state
;
702 bp
->stats
.smt_remote_disconnect_flag
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_remote_disconnect_flag
;
703 bp
->stats
.smt_station_status
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_station_status
;
704 bp
->stats
.smt_peer_wrap_flag
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_peer_wrap_flag
;
705 bp
->stats
.smt_time_stamp
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_msg_time_stamp
.ls
;
706 bp
->stats
.smt_transition_time_stamp
= bp
->cmd_rsp_virt
->smt_mib_get
.smt_transition_time_stamp
.ls
;
707 bp
->stats
.mac_frame_status_functions
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_frame_status_functions
;
708 bp
->stats
.mac_t_max_capability
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_t_max_capability
;
709 bp
->stats
.mac_tvx_capability
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_tvx_capability
;
710 bp
->stats
.mac_available_paths
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_available_paths
;
711 bp
->stats
.mac_current_path
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_current_path
;
712 memcpy(bp
->stats
.mac_upstream_nbr
, &bp
->cmd_rsp_virt
->smt_mib_get
.mac_upstream_nbr
, FDDI_K_ALEN
);
713 memcpy(bp
->stats
.mac_downstream_nbr
, &bp
->cmd_rsp_virt
->smt_mib_get
.mac_downstream_nbr
, FDDI_K_ALEN
);
714 memcpy(bp
->stats
.mac_old_upstream_nbr
, &bp
->cmd_rsp_virt
->smt_mib_get
.mac_old_upstream_nbr
, FDDI_K_ALEN
);
715 memcpy(bp
->stats
.mac_old_downstream_nbr
, &bp
->cmd_rsp_virt
->smt_mib_get
.mac_old_downstream_nbr
, FDDI_K_ALEN
);
716 bp
->stats
.mac_dup_address_test
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_dup_address_test
;
717 bp
->stats
.mac_requested_paths
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_requested_paths
;
718 bp
->stats
.mac_downstream_port_type
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_downstream_port_type
;
719 memcpy(bp
->stats
.mac_smt_address
, &bp
->cmd_rsp_virt
->smt_mib_get
.mac_smt_address
, FDDI_K_ALEN
);
720 bp
->stats
.mac_t_req
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_t_req
;
721 bp
->stats
.mac_t_neg
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_t_neg
;
722 bp
->stats
.mac_t_max
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_t_max
;
723 bp
->stats
.mac_tvx_value
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_tvx_value
;
724 bp
->stats
.mac_frame_error_threshold
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_frame_error_threshold
;
725 bp
->stats
.mac_frame_error_ratio
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_frame_error_ratio
;
726 bp
->stats
.mac_rmt_state
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_rmt_state
;
727 bp
->stats
.mac_da_flag
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_da_flag
;
728 bp
->stats
.mac_una_da_flag
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_unda_flag
;
729 bp
->stats
.mac_frame_error_flag
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_frame_error_flag
;
730 bp
->stats
.mac_ma_unitdata_available
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_ma_unitdata_available
;
731 bp
->stats
.mac_hardware_present
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_hardware_present
;
732 bp
->stats
.mac_ma_unitdata_enable
= bp
->cmd_rsp_virt
->smt_mib_get
.mac_ma_unitdata_enable
;
733 bp
->stats
.path_tvx_lower_bound
= bp
->cmd_rsp_virt
->smt_mib_get
.path_tvx_lower_bound
;
734 bp
->stats
.path_t_max_lower_bound
= bp
->cmd_rsp_virt
->smt_mib_get
.path_t_max_lower_bound
;
735 bp
->stats
.path_max_t_req
= bp
->cmd_rsp_virt
->smt_mib_get
.path_max_t_req
;
736 memcpy(bp
->stats
.path_configuration
, &bp
->cmd_rsp_virt
->smt_mib_get
.path_configuration
, sizeof(bp
->cmd_rsp_virt
->smt_mib_get
.path_configuration
));
737 bp
->stats
.port_my_type
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_my_type
[0];
738 bp
->stats
.port_my_type
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_my_type
[1];
739 bp
->stats
.port_neighbor_type
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_neighbor_type
[0];
740 bp
->stats
.port_neighbor_type
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_neighbor_type
[1];
741 bp
->stats
.port_connection_policies
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connection_policies
[0];
742 bp
->stats
.port_connection_policies
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connection_policies
[1];
743 bp
->stats
.port_mac_indicated
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_mac_indicated
[0];
744 bp
->stats
.port_mac_indicated
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_mac_indicated
[1];
745 bp
->stats
.port_current_path
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_current_path
[0];
746 bp
->stats
.port_current_path
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_current_path
[1];
747 memcpy(&bp
->stats
.port_requested_paths
[0 * 3], &bp
->cmd_rsp_virt
->smt_mib_get
.port_requested_paths
[0], 3);
748 memcpy(&bp
->stats
.port_requested_paths
[1 * 3], &bp
->cmd_rsp_virt
->smt_mib_get
.port_requested_paths
[1], 3);
749 bp
->stats
.port_mac_placement
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_mac_placement
[0];
750 bp
->stats
.port_mac_placement
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_mac_placement
[1];
751 bp
->stats
.port_available_paths
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_available_paths
[0];
752 bp
->stats
.port_available_paths
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_available_paths
[1];
753 bp
->stats
.port_pmd_class
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pmd_class
[0];
754 bp
->stats
.port_pmd_class
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pmd_class
[1];
755 bp
->stats
.port_connection_capabilities
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connection_capabilities
[0];
756 bp
->stats
.port_connection_capabilities
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connection_capabilities
[1];
757 bp
->stats
.port_bs_flag
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_bs_flag
[0];
758 bp
->stats
.port_bs_flag
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_bs_flag
[1];
759 bp
->stats
.port_ler_estimate
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_estimate
[0];
760 bp
->stats
.port_ler_estimate
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_estimate
[1];
761 bp
->stats
.port_ler_cutoff
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_cutoff
[0];
762 bp
->stats
.port_ler_cutoff
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_cutoff
[1];
763 bp
->stats
.port_ler_alarm
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_alarm
[0];
764 bp
->stats
.port_ler_alarm
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_alarm
[1];
765 bp
->stats
.port_connect_state
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connect_state
[0];
766 bp
->stats
.port_connect_state
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_connect_state
[1];
767 bp
->stats
.port_pcm_state
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pcm_state
[0];
768 bp
->stats
.port_pcm_state
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pcm_state
[1];
769 bp
->stats
.port_pc_withhold
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pc_withhold
[0];
770 bp
->stats
.port_pc_withhold
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_pc_withhold
[1];
771 bp
->stats
.port_ler_flag
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_flag
[0];
772 bp
->stats
.port_ler_flag
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_ler_flag
[1];
773 bp
->stats
.port_hardware_present
[0] = bp
->cmd_rsp_virt
->smt_mib_get
.port_hardware_present
[0];
774 bp
->stats
.port_hardware_present
[1] = bp
->cmd_rsp_virt
->smt_mib_get
.port_hardware_present
[1];
777 /* Fill the bp->stats structure with the FDDI counter values */
779 bp
->stats
.mac_frame_cts
= bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.frame_cnt
.ls
;
780 bp
->stats
.mac_copied_cts
= bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.copied_cnt
.ls
;
781 bp
->stats
.mac_transmit_cts
= bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.transmit_cnt
.ls
;
782 bp
->stats
.mac_error_cts
= bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.error_cnt
.ls
;
783 bp
->stats
.mac_lost_cts
= bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.lost_cnt
.ls
;
784 bp
->stats
.port_lct_fail_cts
[0] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.lct_rejects
[0].ls
;
785 bp
->stats
.port_lct_fail_cts
[1] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.lct_rejects
[1].ls
;
786 bp
->stats
.port_lem_reject_cts
[0] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.lem_rejects
[0].ls
;
787 bp
->stats
.port_lem_reject_cts
[1] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.lem_rejects
[1].ls
;
788 bp
->stats
.port_lem_cts
[0] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.link_errors
[0].ls
;
789 bp
->stats
.port_lem_cts
[1] = bp
->cmd_rsp_virt
->cntrs_get
.cntrs
.link_errors
[1].ls
;
792 return (struct net_device_stats
*)&bp
->os
.MacStat
;
797 * ==============================
798 * = skfp_ctl_set_multicast_list =
799 * ==============================
802 * Enable/Disable LLC frame promiscuous mode reception
803 * on the adapter and/or update multicast address table.
809 * dev - pointer to device information
811 * Functional Description:
812 * This function acquires the driver lock and only calls
813 * skfp_ctl_set_multicast_list_wo_lock then.
814 * This routine follows a fairly simple algorithm for setting the
815 * adapter filters and CAM:
817 * if IFF_PROMISC flag is set
818 * enable promiscuous mode
820 * disable promiscuous mode
821 * if number of multicast addresses <= max. multicast number
822 * add mc addresses to adapter table
824 * enable promiscuous mode
825 * update adapter filters
828 * Multicast addresses are presented in canonical (LSB) format.
831 * On-board adapter filters are updated.
833 static void skfp_ctl_set_multicast_list(struct net_device
*dev
)
835 struct s_smc
*smc
= netdev_priv(dev
);
836 skfddi_priv
*bp
= &smc
->os
;
839 spin_lock_irqsave(&bp
->DriverLock
, Flags
);
840 skfp_ctl_set_multicast_list_wo_lock(dev
);
841 spin_unlock_irqrestore(&bp
->DriverLock
, Flags
);
842 } // skfp_ctl_set_multicast_list
846 static void skfp_ctl_set_multicast_list_wo_lock(struct net_device
*dev
)
848 struct s_smc
*smc
= netdev_priv(dev
);
849 struct netdev_hw_addr
*ha
;
851 /* Enable promiscuous mode, if necessary */
852 if (dev
->flags
& IFF_PROMISC
) {
853 mac_drv_rx_mode(smc
, RX_ENABLE_PROMISC
);
854 pr_debug("PROMISCUOUS MODE ENABLED\n");
856 /* Else, update multicast address table */
858 mac_drv_rx_mode(smc
, RX_DISABLE_PROMISC
);
859 pr_debug("PROMISCUOUS MODE DISABLED\n");
861 // Reset all MC addresses
862 mac_clear_multicast(smc
);
863 mac_drv_rx_mode(smc
, RX_DISABLE_ALLMULTI
);
865 if (dev
->flags
& IFF_ALLMULTI
) {
866 mac_drv_rx_mode(smc
, RX_ENABLE_ALLMULTI
);
867 pr_debug("ENABLE ALL MC ADDRESSES\n");
868 } else if (!netdev_mc_empty(dev
)) {
869 if (netdev_mc_count(dev
) <= FPMAX_MULTICAST
) {
870 /* use exact filtering */
872 // point to first multicast addr
873 netdev_for_each_mc_addr(ha
, dev
) {
874 mac_add_multicast(smc
,
875 (struct fddi_addr
*)ha
->addr
,
878 pr_debug("ENABLE MC ADDRESS: %pMF\n",
882 } else { // more MC addresses than HW supports
884 mac_drv_rx_mode(smc
, RX_ENABLE_ALLMULTI
);
885 pr_debug("ENABLE ALL MC ADDRESSES\n");
887 } else { // no MC addresses
889 pr_debug("DISABLE ALL MC ADDRESSES\n");
892 /* Update adapter filters */
893 mac_update_multicast(smc
);
895 } // skfp_ctl_set_multicast_list_wo_lock
899 * ===========================
900 * = skfp_ctl_set_mac_address =
901 * ===========================
904 * set new mac address on adapter and update dev_addr field in device table.
910 * dev - pointer to device information
911 * addr - pointer to sockaddr structure containing unicast address to set
914 * The address pointed to by addr->sa_data is a valid unicast
915 * address and is presented in canonical (LSB) format.
917 static int skfp_ctl_set_mac_address(struct net_device
*dev
, void *addr
)
919 struct s_smc
*smc
= netdev_priv(dev
);
920 struct sockaddr
*p_sockaddr
= (struct sockaddr
*) addr
;
921 skfddi_priv
*bp
= &smc
->os
;
925 memcpy(dev
->dev_addr
, p_sockaddr
->sa_data
, FDDI_K_ALEN
);
926 spin_lock_irqsave(&bp
->DriverLock
, Flags
);
928 spin_unlock_irqrestore(&bp
->DriverLock
, Flags
);
930 return 0; /* always return zero */
931 } // skfp_ctl_set_mac_address
941 * Perform IOCTL call functions here. Some are privileged operations and the
942 * effective uid is checked in those cases.
950 * dev - pointer to device information
951 * rq - pointer to ioctl request structure
957 static int skfp_ioctl(struct net_device
*dev
, struct ifreq
*rq
, int cmd
)
959 struct s_smc
*smc
= netdev_priv(dev
);
960 skfddi_priv
*lp
= &smc
->os
;
961 struct s_skfp_ioctl ioc
;
964 if (copy_from_user(&ioc
, rq
->ifr_data
, sizeof(struct s_skfp_ioctl
)))
968 case SKFP_GET_STATS
: /* Get the driver statistics */
969 ioc
.len
= sizeof(lp
->MacStat
);
970 status
= copy_to_user(ioc
.data
, skfp_ctl_get_stats(dev
), ioc
.len
)
973 case SKFP_CLR_STATS
: /* Zero out the driver statistics */
974 if (!capable(CAP_NET_ADMIN
)) {
977 memset(&lp
->MacStat
, 0, sizeof(lp
->MacStat
));
981 printk("ioctl for %s: unknown cmd: %04x\n", dev
->name
, ioc
.cmd
);
982 status
= -EOPNOTSUPP
;
991 * =====================
993 * =====================
996 * Queues a packet for transmission and try to transmit it.
1002 * skb - pointer to sk_buff to queue for transmission
1003 * dev - pointer to device information
1005 * Functional Description:
1006 * Here we assume that an incoming skb transmit request
1007 * is contained in a single physically contiguous buffer
1008 * in which the virtual address of the start of packet
1009 * (skb->data) can be converted to a physical address
1010 * by using pci_map_single().
1012 * We have an internal queue for packets we can not send
1013 * immediately. Packets in this queue can be given to the
1014 * adapter if transmit buffers are freed.
1016 * We can't free the skb until after it's been DMA'd
1017 * out by the adapter, so we'll keep it in the driver and
1018 * return it in mac_drv_tx_complete.
1021 * 0 - driver has queued and/or sent packet
1022 * 1 - caller should requeue the sk_buff for later transmission
1025 * The entire packet is stored in one physically
1026 * contiguous buffer which is not cached and whose
1027 * 32-bit physical address can be determined.
1029 * It's vital that this routine is NOT reentered for the
1030 * same board and that the OS is not in another section of
1031 * code (eg. skfp_interrupt) for the same board on a
1037 static netdev_tx_t
skfp_send_pkt(struct sk_buff
*skb
,
1038 struct net_device
*dev
)
1040 struct s_smc
*smc
= netdev_priv(dev
);
1041 skfddi_priv
*bp
= &smc
->os
;
1043 pr_debug("skfp_send_pkt\n");
1046 * Verify that incoming transmit request is OK
1048 * Note: The packet size check is consistent with other
1049 * Linux device drivers, although the correct packet
1050 * size should be verified before calling the
1054 if (!(skb
->len
>= FDDI_K_LLC_ZLEN
&& skb
->len
<= FDDI_K_LLC_LEN
)) {
1055 bp
->MacStat
.gen
.tx_errors
++; /* bump error counter */
1056 // dequeue packets from xmt queue and send them
1057 netif_start_queue(dev
);
1059 return NETDEV_TX_OK
; /* return "success" */
1061 if (bp
->QueueSkb
== 0) { // return with tbusy set: queue full
1063 netif_stop_queue(dev
);
1064 return NETDEV_TX_BUSY
;
1067 skb_queue_tail(&bp
->SendSkbQueue
, skb
);
1068 send_queued_packets(netdev_priv(dev
));
1069 if (bp
->QueueSkb
== 0) {
1070 netif_stop_queue(dev
);
1072 return NETDEV_TX_OK
;
1078 * =======================
1079 * = send_queued_packets =
1080 * =======================
1083 * Send packets from the driver queue as long as there are some and
1084 * transmit resources are available.
1090 * smc - pointer to smc (adapter) structure
1092 * Functional Description:
1093 * Take a packet from queue if there is any. If not, then we are done.
1094 * Check if there are resources to send the packet. If not, requeue it
1096 * Set packet descriptor flags and give packet to adapter.
1097 * Check if any send resources can be freed (we do not use the
1098 * transmit complete interrupt).
1100 static void send_queued_packets(struct s_smc
*smc
)
1102 skfddi_priv
*bp
= &smc
->os
;
1103 struct sk_buff
*skb
;
1106 struct s_smt_fp_txd
*txd
; // Current TxD.
1107 dma_addr_t dma_address
;
1108 unsigned long Flags
;
1110 int frame_status
; // HWM tx frame status.
1112 pr_debug("send queued packets\n");
1114 // send first buffer from queue
1115 skb
= skb_dequeue(&bp
->SendSkbQueue
);
1118 pr_debug("queue empty\n");
1122 spin_lock_irqsave(&bp
->DriverLock
, Flags
);
1124 queue
= (fc
& FC_SYNC_BIT
) ? QUEUE_S
: QUEUE_A0
;
1126 // Check if the frame may/must be sent as a synchronous frame.
1128 if ((fc
& ~(FC_SYNC_BIT
| FC_LLC_PRIOR
)) == FC_ASYNC_LLC
) {
1129 // It's an LLC frame.
1130 if (!smc
->ess
.sync_bw_available
)
1131 fc
&= ~FC_SYNC_BIT
; // No bandwidth available.
1133 else { // Bandwidth is available.
1135 if (smc
->mib
.fddiESSSynchTxMode
) {
1136 // Send as sync. frame.
1142 frame_status
= hwm_tx_init(smc
, fc
, 1, skb
->len
, queue
);
1144 if ((frame_status
& (LOC_TX
| LAN_TX
)) == 0) {
1145 // Unable to send the frame.
1147 if ((frame_status
& RING_DOWN
) != 0) {
1149 pr_debug("Tx attempt while ring down.\n");
1150 } else if ((frame_status
& OUT_OF_TXD
) != 0) {
1151 pr_debug("%s: out of TXDs.\n", bp
->dev
->name
);
1153 pr_debug("%s: out of transmit resources",
1157 // Note: We will retry the operation as soon as
1158 // transmit resources become available.
1159 skb_queue_head(&bp
->SendSkbQueue
, skb
);
1160 spin_unlock_irqrestore(&bp
->DriverLock
, Flags
);
1161 return; // Packet has been queued.
1163 } // if (unable to send frame)
1165 bp
->QueueSkb
++; // one packet less in local queue
1167 // source address in packet ?
1168 CheckSourceAddress(skb
->data
, smc
->hw
.fddi_canon_addr
.a
);
1170 txd
= (struct s_smt_fp_txd
*) HWM_GET_CURR_TXD(smc
, queue
);
1172 dma_address
= pci_map_single(&bp
->pdev
, skb
->data
,
1173 skb
->len
, PCI_DMA_TODEVICE
);
1174 if (frame_status
& LAN_TX
) {
1175 txd
->txd_os
.skb
= skb
; // save skb
1176 txd
->txd_os
.dma_addr
= dma_address
; // save dma mapping
1178 hwm_tx_frag(smc
, skb
->data
, dma_address
, skb
->len
,
1179 frame_status
| FIRST_FRAG
| LAST_FRAG
| EN_IRQ_EOF
);
1181 if (!(frame_status
& LAN_TX
)) { // local only frame
1182 pci_unmap_single(&bp
->pdev
, dma_address
,
1183 skb
->len
, PCI_DMA_TODEVICE
);
1184 dev_kfree_skb_irq(skb
);
1186 spin_unlock_irqrestore(&bp
->DriverLock
, Flags
);
1189 return; // never reached
1191 } // send_queued_packets
1194 /************************
1196 * CheckSourceAddress
1198 * Verify if the source address is set. Insert it if necessary.
1200 ************************/
1201 static void CheckSourceAddress(unsigned char *frame
, unsigned char *hw_addr
)
1203 unsigned char SRBit
;
1205 if ((((unsigned long) frame
[1 + 6]) & ~0x01) != 0) // source routing bit
1208 if ((unsigned short) frame
[1 + 10] != 0)
1210 SRBit
= frame
[1 + 6] & 0x01;
1211 memcpy(&frame
[1 + 6], hw_addr
, ETH_ALEN
);
1213 } // CheckSourceAddress
1216 /************************
1220 * Reset the adapter and bring it back to operational mode.
1222 * smc - A pointer to the SMT context struct.
1226 ************************/
1227 static void ResetAdapter(struct s_smc
*smc
)
1230 pr_debug("[fddi: ResetAdapter]\n");
1232 // Stop the adapter.
1234 card_stop(smc
); // Stop all activity.
1236 // Clear the transmit and receive descriptor queues.
1237 mac_drv_clear_tx_queue(smc
);
1238 mac_drv_clear_rx_queue(smc
);
1240 // Restart the adapter.
1242 smt_reset_defaults(smc
, 1); // Initialize the SMT module.
1244 init_smt(smc
, (smc
->os
.dev
)->dev_addr
); // Initialize the hardware.
1246 smt_online(smc
, 1); // Insert into the ring again.
1249 // Restore original receive mode (multicasts, promiscuous, etc.).
1250 skfp_ctl_set_multicast_list_wo_lock(smc
->os
.dev
);
1254 //--------------- functions called by hardware module ----------------
1256 /************************
1260 * The hardware driver calls this routine when the transmit complete
1261 * interrupt bits (end of frame) for the synchronous or asynchronous
1264 * NOTE The hardware driver calls this function also if no packets are queued.
1265 * The routine must be able to handle this case.
1267 * smc - A pointer to the SMT context struct.
1271 ************************/
1272 void llc_restart_tx(struct s_smc
*smc
)
1274 skfddi_priv
*bp
= &smc
->os
;
1276 pr_debug("[llc_restart_tx]\n");
1278 // Try to send queued packets
1279 spin_unlock(&bp
->DriverLock
);
1280 send_queued_packets(smc
);
1281 spin_lock(&bp
->DriverLock
);
1282 netif_start_queue(bp
->dev
);// system may send again if it was blocked
1287 /************************
1291 * The hardware module calls this function to allocate the memory
1292 * for the SMT MBufs if the define MB_OUTSIDE_SMC is specified.
1294 * smc - A pointer to the SMT context struct.
1296 * size - Size of memory in bytes to allocate.
1298 * != 0 A pointer to the virtual address of the allocated memory.
1299 * == 0 Allocation error.
1301 ************************/
1302 void *mac_drv_get_space(struct s_smc
*smc
, unsigned int size
)
1306 pr_debug("mac_drv_get_space (%d bytes), ", size
);
1307 virt
= (void *) (smc
->os
.SharedMemAddr
+ smc
->os
.SharedMemHeap
);
1309 if ((smc
->os
.SharedMemHeap
+ size
) > smc
->os
.SharedMemSize
) {
1310 printk("Unexpected SMT memory size requested: %d\n", size
);
1313 smc
->os
.SharedMemHeap
+= size
; // Move heap pointer.
1315 pr_debug("mac_drv_get_space end\n");
1316 pr_debug("virt addr: %lx\n", (ulong
) virt
);
1317 pr_debug("bus addr: %lx\n", (ulong
)
1318 (smc
->os
.SharedMemDMA
+
1319 ((char *) virt
- (char *)smc
->os
.SharedMemAddr
)));
1321 } // mac_drv_get_space
1324 /************************
1326 * mac_drv_get_desc_mem
1328 * This function is called by the hardware dependent module.
1329 * It allocates the memory for the RxD and TxD descriptors.
1331 * This memory must be non-cached, non-movable and non-swappable.
1332 * This memory should start at a physical page boundary.
1334 * smc - A pointer to the SMT context struct.
1336 * size - Size of memory in bytes to allocate.
1338 * != 0 A pointer to the virtual address of the allocated memory.
1339 * == 0 Allocation error.
1341 ************************/
1342 void *mac_drv_get_desc_mem(struct s_smc
*smc
, unsigned int size
)
1347 pr_debug("mac_drv_get_desc_mem\n");
1349 // Descriptor memory must be aligned on 16-byte boundary.
1351 virt
= mac_drv_get_space(smc
, size
);
1353 size
= (u_int
) (16 - (((unsigned long) virt
) & 15UL));
1356 pr_debug("Allocate %u bytes alignment gap ", size
);
1357 pr_debug("for descriptor memory.\n");
1359 if (!mac_drv_get_space(smc
, size
)) {
1360 printk("fddi: Unable to align descriptor memory.\n");
1364 } // mac_drv_get_desc_mem
1367 /************************
1371 * Get the physical address of a given virtual address.
1373 * smc - A pointer to the SMT context struct.
1375 * virt - A (virtual) pointer into our 'shared' memory area.
1377 * Physical address of the given virtual address.
1379 ************************/
1380 unsigned long mac_drv_virt2phys(struct s_smc
*smc
, void *virt
)
1382 return smc
->os
.SharedMemDMA
+
1383 ((char *) virt
- (char *)smc
->os
.SharedMemAddr
);
1384 } // mac_drv_virt2phys
1387 /************************
1391 * The HWM calls this function, when the driver leads through a DMA
1392 * transfer. If the OS-specific module must prepare the system hardware
1393 * for the DMA transfer, it should do it in this function.
1395 * The hardware module calls this dma_master if it wants to send an SMT
1396 * frame. This means that the virt address passed in here is part of
1397 * the 'shared' memory area.
1399 * smc - A pointer to the SMT context struct.
1401 * virt - The virtual address of the data.
1403 * len - The length in bytes of the data.
1405 * flag - Indicates the transmit direction and the buffer type:
1406 * DMA_RD (0x01) system RAM ==> adapter buffer memory
1407 * DMA_WR (0x02) adapter buffer memory ==> system RAM
1408 * SMT_BUF (0x80) SMT buffer
1410 * >> NOTE: SMT_BUF and DMA_RD are always set for PCI. <<
1412 * Returns the pyhsical address for the DMA transfer.
1414 ************************/
1415 u_long
dma_master(struct s_smc
* smc
, void *virt
, int len
, int flag
)
1417 return smc
->os
.SharedMemDMA
+
1418 ((char *) virt
- (char *)smc
->os
.SharedMemAddr
);
1422 /************************
1426 * The hardware module calls this routine when it has completed a DMA
1427 * transfer. If the operating system dependent module has set up the DMA
1428 * channel via dma_master() (e.g. Windows NT or AIX) it should clean up
1431 * smc - A pointer to the SMT context struct.
1433 * descr - A pointer to a TxD or RxD, respectively.
1435 * flag - Indicates the DMA transfer direction / SMT buffer:
1436 * DMA_RD (0x01) system RAM ==> adapter buffer memory
1437 * DMA_WR (0x02) adapter buffer memory ==> system RAM
1438 * SMT_BUF (0x80) SMT buffer (managed by HWM)
1442 ************************/
1443 void dma_complete(struct s_smc
*smc
, volatile union s_fp_descr
*descr
, int flag
)
1445 /* For TX buffers, there are two cases. If it is an SMT transmit
1446 * buffer, there is nothing to do since we use consistent memory
1447 * for the 'shared' memory area. The other case is for normal
1448 * transmit packets given to us by the networking stack, and in
1449 * that case we cleanup the PCI DMA mapping in mac_drv_tx_complete
1452 * For RX buffers, we have to unmap dynamic PCI DMA mappings here
1453 * because the hardware module is about to potentially look at
1454 * the contents of the buffer. If we did not call the PCI DMA
1455 * unmap first, the hardware module could read inconsistent data.
1457 if (flag
& DMA_WR
) {
1458 skfddi_priv
*bp
= &smc
->os
;
1459 volatile struct s_smt_fp_rxd
*r
= &descr
->r
;
1461 /* If SKB is NULL, we used the local buffer. */
1462 if (r
->rxd_os
.skb
&& r
->rxd_os
.dma_addr
) {
1463 int MaxFrameSize
= bp
->MaxFrameSize
;
1465 pci_unmap_single(&bp
->pdev
, r
->rxd_os
.dma_addr
,
1466 MaxFrameSize
, PCI_DMA_FROMDEVICE
);
1467 r
->rxd_os
.dma_addr
= 0;
1473 /************************
1475 * mac_drv_tx_complete
1477 * Transmit of a packet is complete. Release the tx staging buffer.
1480 * smc - A pointer to the SMT context struct.
1482 * txd - A pointer to the last TxD which is used by the frame.
1486 ************************/
1487 void mac_drv_tx_complete(struct s_smc
*smc
, volatile struct s_smt_fp_txd
*txd
)
1489 struct sk_buff
*skb
;
1491 pr_debug("entering mac_drv_tx_complete\n");
1492 // Check if this TxD points to a skb
1494 if (!(skb
= txd
->txd_os
.skb
)) {
1495 pr_debug("TXD with no skb assigned.\n");
1498 txd
->txd_os
.skb
= NULL
;
1500 // release the DMA mapping
1501 pci_unmap_single(&smc
->os
.pdev
, txd
->txd_os
.dma_addr
,
1502 skb
->len
, PCI_DMA_TODEVICE
);
1503 txd
->txd_os
.dma_addr
= 0;
1505 smc
->os
.MacStat
.gen
.tx_packets
++; // Count transmitted packets.
1506 smc
->os
.MacStat
.gen
.tx_bytes
+=skb
->len
; // Count bytes
1509 dev_kfree_skb_irq(skb
);
1511 pr_debug("leaving mac_drv_tx_complete\n");
1512 } // mac_drv_tx_complete
1515 /************************
1517 * dump packets to logfile
1519 ************************/
1521 void dump_data(unsigned char *Data
, int length
)
1523 printk(KERN_INFO
"---Packet start---\n");
1524 print_hex_dump(KERN_INFO
, "", DUMP_PREFIX_NONE
, 16, 1, Data
, min_t(size_t, length
, 64), false);
1525 printk(KERN_INFO
"------------------\n");
1528 #define dump_data(data,len)
1529 #endif // DUMPPACKETS
1531 /************************
1533 * mac_drv_rx_complete
1535 * The hardware module calls this function if an LLC frame is received
1536 * in a receive buffer. Also the SMT, NSA, and directed beacon frames
1537 * from the network will be passed to the LLC layer by this function
1538 * if passing is enabled.
1540 * mac_drv_rx_complete forwards the frame to the LLC layer if it should
1541 * be received. It also fills the RxD ring with new receive buffers if
1542 * some can be queued.
1544 * smc - A pointer to the SMT context struct.
1546 * rxd - A pointer to the first RxD which is used by the receive frame.
1548 * frag_count - Count of RxDs used by the received frame.
1550 * len - Frame length.
1554 ************************/
1555 void mac_drv_rx_complete(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
1556 int frag_count
, int len
)
1558 skfddi_priv
*bp
= &smc
->os
;
1559 struct sk_buff
*skb
;
1560 unsigned char *virt
, *cp
;
1564 pr_debug("entering mac_drv_rx_complete (len=%d)\n", len
);
1565 if (frag_count
!= 1) { // This is not allowed to happen.
1567 printk("fddi: Multi-fragment receive!\n");
1568 goto RequeueRxd
; // Re-use the given RXD(s).
1571 skb
= rxd
->rxd_os
.skb
;
1573 pr_debug("No skb in rxd\n");
1574 smc
->os
.MacStat
.gen
.rx_errors
++;
1579 // The DMA mapping was released in dma_complete above.
1581 dump_data(skb
->data
, len
);
1584 * FDDI Frame format:
1585 * +-------+-------+-------+------------+--------+------------+
1586 * | FC[1] | DA[6] | SA[6] | RIF[0..18] | LLC[3] | Data[0..n] |
1587 * +-------+-------+-------+------------+--------+------------+
1589 * FC = Frame Control
1590 * DA = Destination Address
1591 * SA = Source Address
1592 * RIF = Routing Information Field
1593 * LLC = Logical Link Control
1596 // Remove Routing Information Field (RIF), if present.
1598 if ((virt
[1 + 6] & FDDI_RII
) == 0)
1602 // goos: RIF removal has still to be tested
1603 pr_debug("RIF found\n");
1604 // Get RIF length from Routing Control (RC) field.
1605 cp
= virt
+ FDDI_MAC_HDR_LEN
; // Point behind MAC header.
1607 ri
= ntohs(*((__be16
*) cp
));
1608 RifLength
= ri
& FDDI_RCF_LEN_MASK
;
1609 if (len
< (int) (FDDI_MAC_HDR_LEN
+ RifLength
)) {
1610 printk("fddi: Invalid RIF.\n");
1611 goto RequeueRxd
; // Discard the frame.
1614 virt
[1 + 6] &= ~FDDI_RII
; // Clear RII bit.
1617 virt
= cp
+ RifLength
;
1618 for (n
= FDDI_MAC_HDR_LEN
; n
; n
--)
1620 // adjust sbd->data pointer
1621 skb_pull(skb
, RifLength
);
1626 // Count statistics.
1627 smc
->os
.MacStat
.gen
.rx_packets
++; // Count indicated receive
1629 smc
->os
.MacStat
.gen
.rx_bytes
+=len
; // Count bytes.
1631 // virt points to header again
1632 if (virt
[1] & 0x01) { // Check group (multicast) bit.
1634 smc
->os
.MacStat
.gen
.multicast
++;
1637 // deliver frame to system
1638 rxd
->rxd_os
.skb
= NULL
;
1640 skb
->protocol
= fddi_type_trans(skb
, bp
->dev
);
1644 HWM_RX_CHECK(smc
, RX_LOW_WATERMARK
);
1648 pr_debug("Rx: re-queue RXD.\n");
1649 mac_drv_requeue_rxd(smc
, rxd
, frag_count
);
1650 smc
->os
.MacStat
.gen
.rx_errors
++; // Count receive packets
1653 } // mac_drv_rx_complete
1656 /************************
1658 * mac_drv_requeue_rxd
1660 * The hardware module calls this function to request the OS-specific
1661 * module to queue the receive buffer(s) represented by the pointer
1662 * to the RxD and the frag_count into the receive queue again. This
1663 * buffer was filled with an invalid frame or an SMT frame.
1665 * smc - A pointer to the SMT context struct.
1667 * rxd - A pointer to the first RxD which is used by the receive frame.
1669 * frag_count - Count of RxDs used by the received frame.
1673 ************************/
1674 void mac_drv_requeue_rxd(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
1677 volatile struct s_smt_fp_rxd
*next_rxd
;
1678 volatile struct s_smt_fp_rxd
*src_rxd
;
1679 struct sk_buff
*skb
;
1681 unsigned char *v_addr
;
1684 if (frag_count
!= 1) // This is not allowed to happen.
1686 printk("fddi: Multi-fragment requeue!\n");
1688 MaxFrameSize
= smc
->os
.MaxFrameSize
;
1690 for (; frag_count
> 0; frag_count
--) {
1691 next_rxd
= src_rxd
->rxd_next
;
1692 rxd
= HWM_GET_CURR_RXD(smc
);
1694 skb
= src_rxd
->rxd_os
.skb
;
1695 if (skb
== NULL
) { // this should not happen
1697 pr_debug("Requeue with no skb in rxd!\n");
1698 skb
= alloc_skb(MaxFrameSize
+ 3, GFP_ATOMIC
);
1701 rxd
->rxd_os
.skb
= skb
;
1702 skb_reserve(skb
, 3);
1703 skb_put(skb
, MaxFrameSize
);
1705 b_addr
= pci_map_single(&smc
->os
.pdev
,
1708 PCI_DMA_FROMDEVICE
);
1709 rxd
->rxd_os
.dma_addr
= b_addr
;
1711 // no skb available, use local buffer
1712 pr_debug("Queueing invalid buffer!\n");
1713 rxd
->rxd_os
.skb
= NULL
;
1714 v_addr
= smc
->os
.LocalRxBuffer
;
1715 b_addr
= smc
->os
.LocalRxBufferDMA
;
1718 // we use skb from old rxd
1719 rxd
->rxd_os
.skb
= skb
;
1721 b_addr
= pci_map_single(&smc
->os
.pdev
,
1724 PCI_DMA_FROMDEVICE
);
1725 rxd
->rxd_os
.dma_addr
= b_addr
;
1727 hwm_rx_frag(smc
, v_addr
, b_addr
, MaxFrameSize
,
1728 FIRST_FRAG
| LAST_FRAG
);
1732 } // mac_drv_requeue_rxd
1735 /************************
1739 * The hardware module calls this function at initialization time
1740 * to fill the RxD ring with receive buffers. It is also called by
1741 * mac_drv_rx_complete if rx_free is large enough to queue some new
1742 * receive buffers into the RxD ring. mac_drv_fill_rxd queues new
1743 * receive buffers as long as enough RxDs and receive buffers are
1746 * smc - A pointer to the SMT context struct.
1750 ************************/
1751 void mac_drv_fill_rxd(struct s_smc
*smc
)
1754 unsigned char *v_addr
;
1755 unsigned long b_addr
;
1756 struct sk_buff
*skb
;
1757 volatile struct s_smt_fp_rxd
*rxd
;
1759 pr_debug("entering mac_drv_fill_rxd\n");
1761 // Walk through the list of free receive buffers, passing receive
1762 // buffers to the HWM as long as RXDs are available.
1764 MaxFrameSize
= smc
->os
.MaxFrameSize
;
1765 // Check if there is any RXD left.
1766 while (HWM_GET_RX_FREE(smc
) > 0) {
1769 rxd
= HWM_GET_CURR_RXD(smc
);
1770 skb
= alloc_skb(MaxFrameSize
+ 3, GFP_ATOMIC
);
1773 skb_reserve(skb
, 3);
1774 skb_put(skb
, MaxFrameSize
);
1776 b_addr
= pci_map_single(&smc
->os
.pdev
,
1779 PCI_DMA_FROMDEVICE
);
1780 rxd
->rxd_os
.dma_addr
= b_addr
;
1782 // no skb available, use local buffer
1783 // System has run out of buffer memory, but we want to
1784 // keep the receiver running in hope of better times.
1785 // Multiple descriptors may point to this local buffer,
1786 // so data in it must be considered invalid.
1787 pr_debug("Queueing invalid buffer!\n");
1788 v_addr
= smc
->os
.LocalRxBuffer
;
1789 b_addr
= smc
->os
.LocalRxBufferDMA
;
1792 rxd
->rxd_os
.skb
= skb
;
1794 // Pass receive buffer to HWM.
1795 hwm_rx_frag(smc
, v_addr
, b_addr
, MaxFrameSize
,
1796 FIRST_FRAG
| LAST_FRAG
);
1798 pr_debug("leaving mac_drv_fill_rxd\n");
1799 } // mac_drv_fill_rxd
1802 /************************
1806 * The hardware module calls this function to release unused
1809 * smc - A pointer to the SMT context struct.
1811 * rxd - A pointer to the first RxD which is used by the receive buffer.
1813 * frag_count - Count of RxDs used by the receive buffer.
1817 ************************/
1818 void mac_drv_clear_rxd(struct s_smc
*smc
, volatile struct s_smt_fp_rxd
*rxd
,
1822 struct sk_buff
*skb
;
1824 pr_debug("entering mac_drv_clear_rxd\n");
1826 if (frag_count
!= 1) // This is not allowed to happen.
1828 printk("fddi: Multi-fragment clear!\n");
1830 for (; frag_count
> 0; frag_count
--) {
1831 skb
= rxd
->rxd_os
.skb
;
1833 skfddi_priv
*bp
= &smc
->os
;
1834 int MaxFrameSize
= bp
->MaxFrameSize
;
1836 pci_unmap_single(&bp
->pdev
, rxd
->rxd_os
.dma_addr
,
1837 MaxFrameSize
, PCI_DMA_FROMDEVICE
);
1840 rxd
->rxd_os
.skb
= NULL
;
1842 rxd
= rxd
->rxd_next
; // Next RXD.
1845 } // mac_drv_clear_rxd
1848 /************************
1852 * The hardware module calls this routine when an SMT or NSA frame of the
1853 * local SMT should be delivered to the LLC layer.
1855 * It is necessary to have this function, because there is no other way to
1856 * copy the contents of SMT MBufs into receive buffers.
1858 * mac_drv_rx_init allocates the required target memory for this frame,
1859 * and receives the frame fragment by fragment by calling mac_drv_rx_frag.
1861 * smc - A pointer to the SMT context struct.
1863 * len - The length (in bytes) of the received frame (FC, DA, SA, Data).
1865 * fc - The Frame Control field of the received frame.
1867 * look_ahead - A pointer to the lookahead data buffer (may be NULL).
1869 * la_len - The length of the lookahead data stored in the lookahead
1870 * buffer (may be zero).
1872 * Always returns zero (0).
1874 ************************/
1875 int mac_drv_rx_init(struct s_smc
*smc
, int len
, int fc
,
1876 char *look_ahead
, int la_len
)
1878 struct sk_buff
*skb
;
1880 pr_debug("entering mac_drv_rx_init(len=%d)\n", len
);
1882 // "Received" a SMT or NSA frame of the local SMT.
1884 if (len
!= la_len
|| len
< FDDI_MAC_HDR_LEN
|| !look_ahead
) {
1885 pr_debug("fddi: Discard invalid local SMT frame\n");
1886 pr_debug(" len=%d, la_len=%d, (ULONG) look_ahead=%08lXh.\n",
1887 len
, la_len
, (unsigned long) look_ahead
);
1890 skb
= alloc_skb(len
+ 3, GFP_ATOMIC
);
1892 pr_debug("fddi: Local SMT: skb memory exhausted.\n");
1895 skb_reserve(skb
, 3);
1897 skb_copy_to_linear_data(skb
, look_ahead
, len
);
1899 // deliver frame to system
1900 skb
->protocol
= fddi_type_trans(skb
, smc
->os
.dev
);
1904 } // mac_drv_rx_init
1907 /************************
1911 * This routine is called periodically by the SMT module to clean up the
1914 * Return any queued frames back to the upper protocol layers if the ring
1917 * smc - A pointer to the SMT context struct.
1921 ************************/
1922 void smt_timer_poll(struct s_smc
*smc
)
1927 /************************
1929 * ring_status_indication
1931 * This function indicates a change of the ring state.
1933 * smc - A pointer to the SMT context struct.
1935 * status - The current ring status.
1939 ************************/
1940 void ring_status_indication(struct s_smc
*smc
, u_long status
)
1942 pr_debug("ring_status_indication( ");
1943 if (status
& RS_RES15
)
1944 pr_debug("RS_RES15 ");
1945 if (status
& RS_HARDERROR
)
1946 pr_debug("RS_HARDERROR ");
1947 if (status
& RS_SOFTERROR
)
1948 pr_debug("RS_SOFTERROR ");
1949 if (status
& RS_BEACON
)
1950 pr_debug("RS_BEACON ");
1951 if (status
& RS_PATHTEST
)
1952 pr_debug("RS_PATHTEST ");
1953 if (status
& RS_SELFTEST
)
1954 pr_debug("RS_SELFTEST ");
1955 if (status
& RS_RES9
)
1956 pr_debug("RS_RES9 ");
1957 if (status
& RS_DISCONNECT
)
1958 pr_debug("RS_DISCONNECT ");
1959 if (status
& RS_RES7
)
1960 pr_debug("RS_RES7 ");
1961 if (status
& RS_DUPADDR
)
1962 pr_debug("RS_DUPADDR ");
1963 if (status
& RS_NORINGOP
)
1964 pr_debug("RS_NORINGOP ");
1965 if (status
& RS_VERSION
)
1966 pr_debug("RS_VERSION ");
1967 if (status
& RS_STUCKBYPASSS
)
1968 pr_debug("RS_STUCKBYPASSS ");
1969 if (status
& RS_EVENT
)
1970 pr_debug("RS_EVENT ");
1971 if (status
& RS_RINGOPCHANGE
)
1972 pr_debug("RS_RINGOPCHANGE ");
1973 if (status
& RS_RES0
)
1974 pr_debug("RS_RES0 ");
1976 } // ring_status_indication
1979 /************************
1983 * Gets the current time from the system.
1987 * The current time in TICKS_PER_SECOND.
1989 * TICKS_PER_SECOND has the unit 'count of timer ticks per second'. It is
1990 * defined in "targetos.h". The definition of TICKS_PER_SECOND must comply
1991 * to the time returned by smt_get_time().
1993 ************************/
1994 unsigned long smt_get_time(void)
2000 /************************
2004 * Status counter update (ring_op, fifo full).
2006 * smc - A pointer to the SMT context struct.
2008 * stat - = 0: A ring operational change occurred.
2009 * = 1: The FORMAC FIFO buffer is full / FIFO overflow.
2013 ************************/
2014 void smt_stat_counter(struct s_smc
*smc
, int stat
)
2016 // BOOLEAN RingIsUp ;
2018 pr_debug("smt_stat_counter\n");
2021 pr_debug("Ring operational change.\n");
2024 pr_debug("Receive fifo overflow.\n");
2025 smc
->os
.MacStat
.gen
.rx_errors
++;
2028 pr_debug("Unknown status (%d).\n", stat
);
2031 } // smt_stat_counter
2034 /************************
2038 * Sets CFM state in custom statistics.
2040 * smc - A pointer to the SMT context struct.
2042 * c_state - Possible values are:
2044 * EC0_OUT, EC1_IN, EC2_TRACE, EC3_LEAVE, EC4_PATH_TEST,
2045 * EC5_INSERT, EC6_CHECK, EC7_DEINSERT
2049 ************************/
2050 void cfm_state_change(struct s_smc
*smc
, int c_state
)
2078 s
= "SC10_C_WRAP_B";
2081 s
= "SC11_C_WRAP_S";
2084 pr_debug("cfm_state_change: unknown %d\n", c_state
);
2087 pr_debug("cfm_state_change: %s\n", s
);
2088 #endif // DRIVERDEBUG
2089 } // cfm_state_change
2092 /************************
2096 * Sets ECM state in custom statistics.
2098 * smc - A pointer to the SMT context struct.
2100 * e_state - Possible values are:
2102 * SC0_ISOLATED, SC1_WRAP_A (5), SC2_WRAP_B (6), SC4_THRU_A (12),
2103 * SC5_THRU_B (7), SC7_WRAP_S (8)
2107 ************************/
2108 void ecm_state_change(struct s_smc
*smc
, int e_state
)
2127 s
= "EC4_PATH_TEST";
2142 pr_debug("ecm_state_change: %s\n", s
);
2143 #endif //DRIVERDEBUG
2144 } // ecm_state_change
2147 /************************
2151 * Sets RMT state in custom statistics.
2153 * smc - A pointer to the SMT context struct.
2155 * r_state - Possible values are:
2157 * RM0_ISOLATED, RM1_NON_OP, RM2_RING_OP, RM3_DETECT,
2158 * RM4_NON_OP_DUP, RM5_RING_OP_DUP, RM6_DIRECTED, RM7_TRACE
2162 ************************/
2163 void rmt_state_change(struct s_smc
*smc
, int r_state
)
2173 s
= "RM1_NON_OP - not operational";
2176 s
= "RM2_RING_OP - ring operational";
2179 s
= "RM3_DETECT - detect dupl addresses";
2181 case RM4_NON_OP_DUP
:
2182 s
= "RM4_NON_OP_DUP - dupl. addr detected";
2184 case RM5_RING_OP_DUP
:
2185 s
= "RM5_RING_OP_DUP - ring oper. with dupl. addr";
2188 s
= "RM6_DIRECTED - sending directed beacons";
2191 s
= "RM7_TRACE - trace initiated";
2197 pr_debug("[rmt_state_change: %s]\n", s
);
2198 #endif // DRIVERDEBUG
2199 } // rmt_state_change
2202 /************************
2204 * drv_reset_indication
2206 * This function is called by the SMT when it has detected a severe
2207 * hardware problem. The driver should perform a reset on the adapter
2208 * as soon as possible, but not from within this function.
2210 * smc - A pointer to the SMT context struct.
2214 ************************/
2215 void drv_reset_indication(struct s_smc
*smc
)
2217 pr_debug("entering drv_reset_indication\n");
2219 smc
->os
.ResetRequested
= TRUE
; // Set flag.
2221 } // drv_reset_indication
2223 static struct pci_driver skfddi_pci_driver
= {
2225 .id_table
= skfddi_pci_tbl
,
2226 .probe
= skfp_init_one
,
2227 .remove
= skfp_remove_one
,
2230 module_pci_driver(skfddi_pci_driver
);