Lines Matching +full:os +full:- +full:initiated
1 // SPDX-License-Identifier: GPL-2.0-or-later
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
51 * 03-Dec-03 SH Convert to PCI device model
53 * Compilation options (-Dxxx):
58 * - i386
59 * - sparc64
62 /* Version information string - should be updated prior to */
68 " SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
99 // Define module-wide (static) routines
159 // Define module-wide (static) variables
185 * pdev - pointer to PCI device information
192 * 0 - This device (fddi0, fddi1, etc) configured successfully
193 * -ENODEV - No devices present, or no SysKonnect FDDI PCI device
228 err = -EIO; in skfp_init_one()
236 err = -EIO; in skfp_init_one()
245 err = -EIO; in skfp_init_one()
253 err = -ENOMEM; in skfp_init_one()
257 dev->irq = pdev->irq; in skfp_init_one()
258 dev->netdev_ops = &skfp_netdev_ops; in skfp_init_one()
260 SET_NETDEV_DEV(dev, &pdev->dev); in skfp_init_one()
262 /* Initialize board structure with bus-specific info */ in skfp_init_one()
264 smc->os.dev = dev; in skfp_init_one()
265 smc->os.bus_type = SK_BUS_TYPE_PCI; in skfp_init_one()
266 smc->os.pdev = *pdev; in skfp_init_one()
267 smc->os.QueueSkb = MAX_TX_QUEUE_LEN; in skfp_init_one()
268 smc->os.MaxFrameSize = MAX_FRAME_SIZE; in skfp_init_one()
269 smc->os.dev = dev; in skfp_init_one()
270 smc->hw.slot = -1; in skfp_init_one()
271 smc->hw.iop = mem; in skfp_init_one()
272 smc->os.ResetRequested = FALSE; in skfp_init_one()
273 skb_queue_head_init(&smc->os.SendSkbQueue); in skfp_init_one()
275 dev->base_addr = (unsigned long)mem; in skfp_init_one()
288 if ((pdev->subsystem_device & 0xff00) == 0x5500 || in skfp_init_one()
289 (pdev->subsystem_device & 0xff00) == 0x5800) in skfp_init_one()
291 " found (SK-%04X)\n", dev->name, in skfp_init_one()
292 pdev->subsystem_device); in skfp_init_one()
294 printk("%s: FDDI PCI adapter found\n", dev->name); in skfp_init_one()
298 if (smc->os.SharedMemAddr) in skfp_init_one()
299 dma_free_coherent(&pdev->dev, smc->os.SharedMemSize, in skfp_init_one()
300 smc->os.SharedMemAddr, in skfp_init_one()
301 smc->os.SharedMemDMA); in skfp_init_one()
302 dma_free_coherent(&pdev->dev, MAX_FRAME_SIZE, in skfp_init_one()
303 smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA); in skfp_init_one()
329 if (lp->os.SharedMemAddr) { in skfp_remove_one()
330 dma_free_coherent(&pdev->dev, in skfp_remove_one()
331 lp->os.SharedMemSize, in skfp_remove_one()
332 lp->os.SharedMemAddr, in skfp_remove_one()
333 lp->os.SharedMemDMA); in skfp_remove_one()
334 lp->os.SharedMemAddr = NULL; in skfp_remove_one()
336 if (lp->os.LocalRxBuffer) { in skfp_remove_one()
337 dma_free_coherent(&pdev->dev, in skfp_remove_one()
339 lp->os.LocalRxBuffer, in skfp_remove_one()
340 lp->os.LocalRxBufferDMA); in skfp_remove_one()
341 lp->os.LocalRxBuffer = NULL; in skfp_remove_one()
344 iounmap(lp->hw.iop); in skfp_remove_one()
346 ioport_unmap(lp->hw.iop); in skfp_remove_one()
367 * dev - pointer to device information
372 * The adapter is also reset. The OS must call skfp_open() to open
373 * the adapter and bring it on-line.
376 * 0 - initialization succeeded
377 * -1 - initialization failed
382 skfddi_priv *bp = &smc->os; in skfp_driver_init()
383 int err = -EIO; in skfp_driver_init()
388 bp->base_addr = dev->base_addr; in skfp_driver_init()
391 smc->hw.irq = dev->irq; in skfp_driver_init()
393 spin_lock_init(&bp->DriverLock); in skfp_driver_init()
396 bp->LocalRxBuffer = dma_alloc_coherent(&bp->pdev.dev, MAX_FRAME_SIZE, in skfp_driver_init()
397 &bp->LocalRxBufferDMA, in skfp_driver_init()
399 if (!bp->LocalRxBuffer) { in skfp_driver_init()
406 bp->SharedMemSize = mac_drv_check_space(); in skfp_driver_init()
407 pr_debug("Memory for HWM: %ld\n", bp->SharedMemSize); in skfp_driver_init()
408 if (bp->SharedMemSize > 0) { in skfp_driver_init()
409 bp->SharedMemSize += 16; // for descriptor alignment in skfp_driver_init()
411 bp->SharedMemAddr = dma_alloc_coherent(&bp->pdev.dev, in skfp_driver_init()
412 bp->SharedMemSize, in skfp_driver_init()
413 &bp->SharedMemDMA, in skfp_driver_init()
415 if (!bp->SharedMemAddr) { in skfp_driver_init()
418 bp->SharedMemSize); in skfp_driver_init()
423 bp->SharedMemAddr = NULL; in skfp_driver_init()
426 bp->SharedMemHeap = 0; in skfp_driver_init()
436 pr_debug("HW-Addr: %pMF\n", smc->hw.fddi_canon_addr.a); in skfp_driver_init()
437 eth_hw_addr_set(dev, smc->hw.fddi_canon_addr.a); in skfp_driver_init()
444 if (bp->SharedMemAddr) { in skfp_driver_init()
445 dma_free_coherent(&bp->pdev.dev, in skfp_driver_init()
446 bp->SharedMemSize, in skfp_driver_init()
447 bp->SharedMemAddr, in skfp_driver_init()
448 bp->SharedMemDMA); in skfp_driver_init()
449 bp->SharedMemAddr = NULL; in skfp_driver_init()
451 if (bp->LocalRxBuffer) { in skfp_driver_init()
452 dma_free_coherent(&bp->pdev.dev, MAX_FRAME_SIZE, in skfp_driver_init()
453 bp->LocalRxBuffer, bp->LocalRxBufferDMA); in skfp_driver_init()
454 bp->LocalRxBuffer = NULL; in skfp_driver_init()
472 * dev - pointer to device information
478 * 0 - Adapter was successfully opened
479 * -EAGAIN - Could not register IRQ
487 /* Register IRQ - support shared interrupts by passing device ptr */ in skfp_open()
488 err = request_irq(dev->irq, skfp_interrupt, IRQF_SHARED, in skfp_open()
489 dev->name, dev); in skfp_open()
504 eth_hw_addr_set(dev, smc->hw.fddi_canon_addr.a); in skfp_open()
533 * dev - pointer to device information
537 * The interrupt service routine is deregistered with the OS.
551 skfddi_priv *bp = &smc->os; in skfp_close()
561 free_irq(dev->irq, dev); in skfp_close()
563 skb_queue_purge(&bp->SendSkbQueue); in skfp_close()
564 bp->QueueSkb = MAX_TX_QUEUE_LEN; in skfp_close()
582 * irq - interrupt vector
583 * dev_id - pointer to device information
596 * on Intel-based systems) is done by the operating system outside this
612 bp = &smc->os; in skfp_interrupt()
620 if ((inpd(ISR_A) & smc->hw.is_imask) == 0) { // IRQ? in skfp_interrupt()
625 spin_lock(&bp->DriverLock); in skfp_interrupt()
630 if (smc->os.ResetRequested) { in skfp_interrupt()
632 smc->os.ResetRequested = FALSE; in skfp_interrupt()
634 spin_unlock(&bp->DriverLock); in skfp_interrupt()
653 * dev - pointer to device information
662 * have an FDDI-specific get statistics handler,
676 /* Fill the bp->stats structure with driver-maintained counters */ in skfp_ctl_get_stats()
678 bp->os.MacStat.port_bs_flag[0] = 0x1234; in skfp_ctl_get_stats()
679 bp->os.MacStat.port_bs_flag[1] = 0x5678; in skfp_ctl_get_stats()
684 /* Fill the bp->stats structure with the SMT MIB object values */ in skfp_ctl_get_stats()
686 …memcpy(bp->stats.smt_station_id, &bp->cmd_rsp_virt->smt_mib_get.smt_station_id, sizeof(bp->cmd_rsp… in skfp_ctl_get_stats()
687 bp->stats.smt_op_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_op_version_id; in skfp_ctl_get_stats()
688 bp->stats.smt_hi_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_hi_version_id; in skfp_ctl_get_stats()
689 bp->stats.smt_lo_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_lo_version_id; in skfp_ctl_get_stats()
690 …memcpy(bp->stats.smt_user_data, &bp->cmd_rsp_virt->smt_mib_get.smt_user_data, sizeof(bp->cmd_rsp_v… in skfp_ctl_get_stats()
691 bp->stats.smt_mib_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_mib_version_id; in skfp_ctl_get_stats()
692 bp->stats.smt_mac_cts = bp->cmd_rsp_virt->smt_mib_get.smt_mac_ct; in skfp_ctl_get_stats()
693 bp->stats.smt_non_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_non_master_ct; in skfp_ctl_get_stats()
694 bp->stats.smt_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_master_ct; in skfp_ctl_get_stats()
695 bp->stats.smt_available_paths = bp->cmd_rsp_virt->smt_mib_get.smt_available_paths; in skfp_ctl_get_stats()
696 bp->stats.smt_config_capabilities = bp->cmd_rsp_virt->smt_mib_get.smt_config_capabilities; in skfp_ctl_get_stats()
697 bp->stats.smt_config_policy = bp->cmd_rsp_virt->smt_mib_get.smt_config_policy; in skfp_ctl_get_stats()
698 bp->stats.smt_connection_policy = bp->cmd_rsp_virt->smt_mib_get.smt_connection_policy; in skfp_ctl_get_stats()
699 bp->stats.smt_t_notify = bp->cmd_rsp_virt->smt_mib_get.smt_t_notify; in skfp_ctl_get_stats()
700 bp->stats.smt_stat_rpt_policy = bp->cmd_rsp_virt->smt_mib_get.smt_stat_rpt_policy; in skfp_ctl_get_stats()
701 bp->stats.smt_trace_max_expiration = bp->cmd_rsp_virt->smt_mib_get.smt_trace_max_expiration; in skfp_ctl_get_stats()
702 bp->stats.smt_bypass_present = bp->cmd_rsp_virt->smt_mib_get.smt_bypass_present; in skfp_ctl_get_stats()
703 bp->stats.smt_ecm_state = bp->cmd_rsp_virt->smt_mib_get.smt_ecm_state; in skfp_ctl_get_stats()
704 bp->stats.smt_cf_state = bp->cmd_rsp_virt->smt_mib_get.smt_cf_state; in skfp_ctl_get_stats()
705 bp->stats.smt_remote_disconnect_flag = bp->cmd_rsp_virt->smt_mib_get.smt_remote_disconnect_flag; in skfp_ctl_get_stats()
706 bp->stats.smt_station_status = bp->cmd_rsp_virt->smt_mib_get.smt_station_status; in skfp_ctl_get_stats()
707 bp->stats.smt_peer_wrap_flag = bp->cmd_rsp_virt->smt_mib_get.smt_peer_wrap_flag; in skfp_ctl_get_stats()
708 bp->stats.smt_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_msg_time_stamp.ls; in skfp_ctl_get_stats()
709 bp->stats.smt_transition_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_transition_time_stamp.ls; in skfp_ctl_get_stats()
710 bp->stats.mac_frame_status_functions = bp->cmd_rsp_virt->smt_mib_get.mac_frame_status_functions; in skfp_ctl_get_stats()
711 bp->stats.mac_t_max_capability = bp->cmd_rsp_virt->smt_mib_get.mac_t_max_capability; in skfp_ctl_get_stats()
712 bp->stats.mac_tvx_capability = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_capability; in skfp_ctl_get_stats()
713 bp->stats.mac_available_paths = bp->cmd_rsp_virt->smt_mib_get.mac_available_paths; in skfp_ctl_get_stats()
714 bp->stats.mac_current_path = bp->cmd_rsp_virt->smt_mib_get.mac_current_path; in skfp_ctl_get_stats()
715 memcpy(bp->stats.mac_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_upstream_nbr, FDDI_K_ALEN); in skfp_ctl_get_stats()
716 …memcpy(bp->stats.mac_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_downstream_nbr, FDDI_K_ALE… in skfp_ctl_get_stats()
717 …memcpy(bp->stats.mac_old_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_upstream_nbr, FDDI_K… in skfp_ctl_get_stats()
718 …memcpy(bp->stats.mac_old_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_downstream_nbr, FD… in skfp_ctl_get_stats()
719 bp->stats.mac_dup_address_test = bp->cmd_rsp_virt->smt_mib_get.mac_dup_address_test; in skfp_ctl_get_stats()
720 bp->stats.mac_requested_paths = bp->cmd_rsp_virt->smt_mib_get.mac_requested_paths; in skfp_ctl_get_stats()
721 bp->stats.mac_downstream_port_type = bp->cmd_rsp_virt->smt_mib_get.mac_downstream_port_type; in skfp_ctl_get_stats()
722 memcpy(bp->stats.mac_smt_address, &bp->cmd_rsp_virt->smt_mib_get.mac_smt_address, FDDI_K_ALEN); in skfp_ctl_get_stats()
723 bp->stats.mac_t_req = bp->cmd_rsp_virt->smt_mib_get.mac_t_req; in skfp_ctl_get_stats()
724 bp->stats.mac_t_neg = bp->cmd_rsp_virt->smt_mib_get.mac_t_neg; in skfp_ctl_get_stats()
725 bp->stats.mac_t_max = bp->cmd_rsp_virt->smt_mib_get.mac_t_max; in skfp_ctl_get_stats()
726 bp->stats.mac_tvx_value = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_value; in skfp_ctl_get_stats()
727 bp->stats.mac_frame_error_threshold = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_threshold; in skfp_ctl_get_stats()
728 bp->stats.mac_frame_error_ratio = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_ratio; in skfp_ctl_get_stats()
729 bp->stats.mac_rmt_state = bp->cmd_rsp_virt->smt_mib_get.mac_rmt_state; in skfp_ctl_get_stats()
730 bp->stats.mac_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_da_flag; in skfp_ctl_get_stats()
731 bp->stats.mac_una_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_unda_flag; in skfp_ctl_get_stats()
732 bp->stats.mac_frame_error_flag = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_flag; in skfp_ctl_get_stats()
733 bp->stats.mac_ma_unitdata_available = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_available; in skfp_ctl_get_stats()
734 bp->stats.mac_hardware_present = bp->cmd_rsp_virt->smt_mib_get.mac_hardware_present; in skfp_ctl_get_stats()
735 bp->stats.mac_ma_unitdata_enable = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_enable; in skfp_ctl_get_stats()
736 bp->stats.path_tvx_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_tvx_lower_bound; in skfp_ctl_get_stats()
737 bp->stats.path_t_max_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_t_max_lower_bound; in skfp_ctl_get_stats()
738 bp->stats.path_max_t_req = bp->cmd_rsp_virt->smt_mib_get.path_max_t_req; in skfp_ctl_get_stats()
739 …memcpy(bp->stats.path_configuration, &bp->cmd_rsp_virt->smt_mib_get.path_configuration, sizeof(bp-… in skfp_ctl_get_stats()
740 bp->stats.port_my_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[0]; in skfp_ctl_get_stats()
741 bp->stats.port_my_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[1]; in skfp_ctl_get_stats()
742 bp->stats.port_neighbor_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[0]; in skfp_ctl_get_stats()
743 bp->stats.port_neighbor_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[1]; in skfp_ctl_get_stats()
744 bp->stats.port_connection_policies[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[0]; in skfp_ctl_get_stats()
745 bp->stats.port_connection_policies[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[1]; in skfp_ctl_get_stats()
746 bp->stats.port_mac_indicated[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[0]; in skfp_ctl_get_stats()
747 bp->stats.port_mac_indicated[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[1]; in skfp_ctl_get_stats()
748 bp->stats.port_current_path[0] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[0]; in skfp_ctl_get_stats()
749 bp->stats.port_current_path[1] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[1]; in skfp_ctl_get_stats()
750 …memcpy(&bp->stats.port_requested_paths[0 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths… in skfp_ctl_get_stats()
751 …memcpy(&bp->stats.port_requested_paths[1 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths… in skfp_ctl_get_stats()
752 bp->stats.port_mac_placement[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[0]; in skfp_ctl_get_stats()
753 bp->stats.port_mac_placement[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[1]; in skfp_ctl_get_stats()
754 bp->stats.port_available_paths[0] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[0]; in skfp_ctl_get_stats()
755 bp->stats.port_available_paths[1] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[1]; in skfp_ctl_get_stats()
756 bp->stats.port_pmd_class[0] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[0]; in skfp_ctl_get_stats()
757 bp->stats.port_pmd_class[1] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[1]; in skfp_ctl_get_stats()
758 …bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in skfp_ctl_get_stats()
759 …bp->stats.port_connection_capabilities[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in skfp_ctl_get_stats()
760 bp->stats.port_bs_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[0]; in skfp_ctl_get_stats()
761 bp->stats.port_bs_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[1]; in skfp_ctl_get_stats()
762 bp->stats.port_ler_estimate[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[0]; in skfp_ctl_get_stats()
763 bp->stats.port_ler_estimate[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[1]; in skfp_ctl_get_stats()
764 bp->stats.port_ler_cutoff[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[0]; in skfp_ctl_get_stats()
765 bp->stats.port_ler_cutoff[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[1]; in skfp_ctl_get_stats()
766 bp->stats.port_ler_alarm[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[0]; in skfp_ctl_get_stats()
767 bp->stats.port_ler_alarm[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[1]; in skfp_ctl_get_stats()
768 bp->stats.port_connect_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[0]; in skfp_ctl_get_stats()
769 bp->stats.port_connect_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[1]; in skfp_ctl_get_stats()
770 bp->stats.port_pcm_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[0]; in skfp_ctl_get_stats()
771 bp->stats.port_pcm_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[1]; in skfp_ctl_get_stats()
772 bp->stats.port_pc_withhold[0] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[0]; in skfp_ctl_get_stats()
773 bp->stats.port_pc_withhold[1] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[1]; in skfp_ctl_get_stats()
774 bp->stats.port_ler_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[0]; in skfp_ctl_get_stats()
775 bp->stats.port_ler_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[1]; in skfp_ctl_get_stats()
776 bp->stats.port_hardware_present[0] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[0]; in skfp_ctl_get_stats()
777 bp->stats.port_hardware_present[1] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[1]; in skfp_ctl_get_stats()
780 /* Fill the bp->stats structure with the FDDI counter values */ in skfp_ctl_get_stats()
782 bp->stats.mac_frame_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.frame_cnt.ls; in skfp_ctl_get_stats()
783 bp->stats.mac_copied_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.copied_cnt.ls; in skfp_ctl_get_stats()
784 bp->stats.mac_transmit_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.transmit_cnt.ls; in skfp_ctl_get_stats()
785 bp->stats.mac_error_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.error_cnt.ls; in skfp_ctl_get_stats()
786 bp->stats.mac_lost_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.lost_cnt.ls; in skfp_ctl_get_stats()
787 bp->stats.port_lct_fail_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[0].ls; in skfp_ctl_get_stats()
788 bp->stats.port_lct_fail_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[1].ls; in skfp_ctl_get_stats()
789 bp->stats.port_lem_reject_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[0].ls; in skfp_ctl_get_stats()
790 bp->stats.port_lem_reject_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[1].ls; in skfp_ctl_get_stats()
791 bp->stats.port_lem_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[0].ls; in skfp_ctl_get_stats()
792 bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls; in skfp_ctl_get_stats()
795 return (struct net_device_stats *)&bp->os.MacStat; in skfp_ctl_get_stats()
812 * dev - pointer to device information
834 * On-board adapter filters are updated.
839 skfddi_priv *bp = &smc->os; in skfp_ctl_set_multicast_list()
842 spin_lock_irqsave(&bp->DriverLock, Flags); in skfp_ctl_set_multicast_list()
844 spin_unlock_irqrestore(&bp->DriverLock, Flags); in skfp_ctl_set_multicast_list()
855 if (dev->flags & IFF_PROMISC) { in skfp_ctl_set_multicast_list_wo_lock()
868 if (dev->flags & IFF_ALLMULTI) { in skfp_ctl_set_multicast_list_wo_lock()
878 (struct fddi_addr *)ha->addr, in skfp_ctl_set_multicast_list_wo_lock()
882 ha->addr); in skfp_ctl_set_multicast_list_wo_lock()
913 * dev - pointer to device information
914 * addr - pointer to sockaddr structure containing unicast address to set
917 * The address pointed to by addr->sa_data is a valid unicast
924 skfddi_priv *bp = &smc->os; in skfp_ctl_set_mac_address()
928 dev_addr_set(dev, p_sockaddr->sa_data); in skfp_ctl_set_mac_address()
929 spin_lock_irqsave(&bp->DriverLock, Flags); in skfp_ctl_set_mac_address()
931 spin_unlock_irqrestore(&bp->DriverLock, Flags); in skfp_ctl_set_mac_address()
949 * 0 - success
950 * other - failure
953 * dev - pointer to device information
954 * rq - pointer to ioctl request structure
955 * cmd - ?
963 skfddi_priv *lp = &smc->os; in skfp_siocdevprivate()
968 return -EFAULT; in skfp_siocdevprivate()
971 return -EOPNOTSUPP; in skfp_siocdevprivate()
975 ioc.len = sizeof(lp->MacStat); in skfp_siocdevprivate()
977 ? -EFAULT : 0; in skfp_siocdevprivate()
981 status = -EPERM; in skfp_siocdevprivate()
983 memset(&lp->MacStat, 0, sizeof(lp->MacStat)); in skfp_siocdevprivate()
987 printk("ioctl for %s: unknown cmd: %04x\n", dev->name, ioc.cmd); in skfp_siocdevprivate()
988 status = -EOPNOTSUPP; in skfp_siocdevprivate()
1008 * skb - pointer to sk_buff to queue for transmission
1009 * dev - pointer to device information
1015 * (skb->data) can be converted to a physical address
1027 * 0 - driver has queued and/or sent packet
1028 * 1 - caller should requeue the sk_buff for later transmission
1033 * 32-bit physical address can be determined.
1036 * same board and that the OS is not in another section of
1047 skfddi_priv *bp = &smc->os; in skfp_send_pkt()
1060 if (!(skb->len >= FDDI_K_LLC_ZLEN && skb->len <= FDDI_K_LLC_LEN)) { in skfp_send_pkt()
1061 bp->MacStat.gen.tx_errors++; /* bump error counter */ in skfp_send_pkt()
1067 if (bp->QueueSkb == 0) { // return with tbusy set: queue full in skfp_send_pkt()
1072 bp->QueueSkb--; in skfp_send_pkt()
1073 skb_queue_tail(&bp->SendSkbQueue, skb); in skfp_send_pkt()
1075 if (bp->QueueSkb == 0) { in skfp_send_pkt()
1096 * smc - pointer to smc (adapter) structure
1108 skfddi_priv *bp = &smc->os; in send_queued_packets()
1121 skb = skb_dequeue(&bp->SendSkbQueue); in send_queued_packets()
1128 spin_lock_irqsave(&bp->DriverLock, Flags); in send_queued_packets()
1129 fc = skb->data[0]; in send_queued_packets()
1136 if (!smc->ess.sync_bw_available) in send_queued_packets()
1141 if (smc->mib.fddiESSSynchTxMode) { in send_queued_packets()
1148 frame_status = hwm_tx_init(smc, fc, 1, skb->len, queue); in send_queued_packets()
1157 pr_debug("%s: out of TXDs.\n", bp->dev->name); in send_queued_packets()
1160 bp->dev->name); in send_queued_packets()
1165 skb_queue_head(&bp->SendSkbQueue, skb); in send_queued_packets()
1166 spin_unlock_irqrestore(&bp->DriverLock, Flags); in send_queued_packets()
1171 bp->QueueSkb++; // one packet less in local queue in send_queued_packets()
1174 CheckSourceAddress(skb->data, smc->hw.fddi_canon_addr.a); in send_queued_packets()
1178 dma_address = dma_map_single(&(&bp->pdev)->dev, skb->data, in send_queued_packets()
1179 skb->len, DMA_TO_DEVICE); in send_queued_packets()
1181 txd->txd_os.skb = skb; // save skb in send_queued_packets()
1182 txd->txd_os.dma_addr = dma_address; // save dma mapping in send_queued_packets()
1184 hwm_tx_frag(smc, skb->data, dma_address, skb->len, in send_queued_packets()
1188 dma_unmap_single(&(&bp->pdev)->dev, dma_address, in send_queued_packets()
1189 skb->len, DMA_TO_DEVICE); in send_queued_packets()
1192 spin_unlock_irqrestore(&bp->DriverLock, Flags); in send_queued_packets()
1228 * smc - A pointer to the SMT context struct.
1250 init_smt(smc, (smc->os.dev)->dev_addr); // Initialize the hardware. in ResetAdapter()
1256 skfp_ctl_set_multicast_list_wo_lock(smc->os.dev); in ResetAdapter()
1260 //--------------- functions called by hardware module ----------------
1273 * smc - A pointer to the SMT context struct.
1280 skfddi_priv *bp = &smc->os; in llc_restart_tx()
1285 spin_unlock(&bp->DriverLock); in llc_restart_tx()
1287 spin_lock(&bp->DriverLock); in llc_restart_tx()
1288 netif_start_queue(bp->dev);// system may send again if it was blocked in llc_restart_tx()
1300 * smc - A pointer to the SMT context struct.
1302 * size - Size of memory in bytes to allocate.
1313 virt = (void *) (smc->os.SharedMemAddr + smc->os.SharedMemHeap); in mac_drv_get_space()
1315 if ((smc->os.SharedMemHeap + size) > smc->os.SharedMemSize) { in mac_drv_get_space()
1319 smc->os.SharedMemHeap += size; // Move heap pointer. in mac_drv_get_space()
1324 (smc->os.SharedMemDMA + in mac_drv_get_space()
1325 ((char *) virt - (char *)smc->os.SharedMemAddr))); in mac_drv_get_space()
1337 * This memory must be non-cached, non-movable and non-swappable.
1340 * smc - A pointer to the SMT context struct.
1342 * size - Size of memory in bytes to allocate.
1355 // Descriptor memory must be aligned on 16-byte boundary. in mac_drv_get_desc_mem()
1359 size = (u_int) (16 - (((unsigned long) virt) & 15UL)); in mac_drv_get_desc_mem()
1379 * smc - A pointer to the SMT context struct.
1381 * virt - A (virtual) pointer into our 'shared' memory area.
1388 return smc->os.SharedMemDMA + in mac_drv_virt2phys()
1389 ((char *) virt - (char *)smc->os.SharedMemAddr); in mac_drv_virt2phys()
1398 * transfer. If the OS-specific module must prepare the system hardware
1405 * smc - A pointer to the SMT context struct.
1407 * virt - The virtual address of the data.
1409 * len - The length in bytes of the data.
1411 * flag - Indicates the transmit direction and the buffer type:
1423 return smc->os.SharedMemDMA + in dma_master()
1424 ((char *) virt - (char *)smc->os.SharedMemAddr); in dma_master()
1437 * smc - A pointer to the SMT context struct.
1439 * descr - A pointer to a TxD or RxD, respectively.
1441 * flag - Indicates the DMA transfer direction / SMT buffer:
1464 skfddi_priv *bp = &smc->os; in dma_complete()
1465 volatile struct s_smt_fp_rxd *r = &descr->r; in dma_complete()
1468 if (r->rxd_os.skb && r->rxd_os.dma_addr) { in dma_complete()
1469 int MaxFrameSize = bp->MaxFrameSize; in dma_complete()
1471 dma_unmap_single(&(&bp->pdev)->dev, in dma_complete()
1472 r->rxd_os.dma_addr, MaxFrameSize, in dma_complete()
1474 r->rxd_os.dma_addr = 0; in dma_complete()
1487 * smc - A pointer to the SMT context struct.
1489 * txd - A pointer to the last TxD which is used by the frame.
1501 if (!(skb = txd->txd_os.skb)) { in mac_drv_tx_complete()
1505 txd->txd_os.skb = NULL; in mac_drv_tx_complete()
1508 dma_unmap_single(&(&smc->os.pdev)->dev, txd->txd_os.dma_addr, in mac_drv_tx_complete()
1509 skb->len, DMA_TO_DEVICE); in mac_drv_tx_complete()
1510 txd->txd_os.dma_addr = 0; in mac_drv_tx_complete()
1512 smc->os.MacStat.gen.tx_packets++; // Count transmitted packets. in mac_drv_tx_complete()
1513 smc->os.MacStat.gen.tx_bytes+=skb->len; // Count bytes in mac_drv_tx_complete()
1530 printk(KERN_INFO "---Packet start---\n"); in dump_data()
1532 printk(KERN_INFO "------------------\n"); in dump_data()
1551 * smc - A pointer to the SMT context struct.
1553 * rxd - A pointer to the first RxD which is used by the receive frame.
1555 * frag_count - Count of RxDs used by the received frame.
1557 * len - Frame length.
1565 skfddi_priv *bp = &smc->os; in mac_drv_rx_complete()
1574 printk("fddi: Multi-fragment receive!\n"); in mac_drv_rx_complete()
1575 goto RequeueRxd; // Re-use the given RXD(s). in mac_drv_rx_complete()
1578 skb = rxd->rxd_os.skb; in mac_drv_rx_complete()
1581 smc->os.MacStat.gen.rx_errors++; in mac_drv_rx_complete()
1584 virt = skb->data; in mac_drv_rx_complete()
1588 dump_data(skb->data, len); in mac_drv_rx_complete()
1592 * +-------+-------+-------+------------+--------+------------+ in mac_drv_rx_complete()
1594 * +-------+-------+-------+------------+--------+------------+ in mac_drv_rx_complete()
1625 for (n = FDDI_MAC_HDR_LEN; n; n--) in mac_drv_rx_complete()
1626 *--virt = *--cp; in mac_drv_rx_complete()
1627 // adjust sbd->data pointer in mac_drv_rx_complete()
1629 len -= RifLength; in mac_drv_rx_complete()
1634 smc->os.MacStat.gen.rx_packets++; // Count indicated receive in mac_drv_rx_complete()
1636 smc->os.MacStat.gen.rx_bytes+=len; // Count bytes. in mac_drv_rx_complete()
1641 smc->os.MacStat.gen.multicast++; in mac_drv_rx_complete()
1645 rxd->rxd_os.skb = NULL; in mac_drv_rx_complete()
1647 skb->protocol = fddi_type_trans(skb, bp->dev); in mac_drv_rx_complete()
1655 pr_debug("Rx: re-queue RXD.\n"); in mac_drv_rx_complete()
1657 smc->os.MacStat.gen.rx_errors++; // Count receive packets in mac_drv_rx_complete()
1667 * The hardware module calls this function to request the OS-specific
1672 * smc - A pointer to the SMT context struct.
1674 * rxd - A pointer to the first RxD which is used by the receive frame.
1676 * frag_count - Count of RxDs used by the received frame.
1693 printk("fddi: Multi-fragment requeue!\n"); in mac_drv_requeue_rxd()
1695 MaxFrameSize = smc->os.MaxFrameSize; in mac_drv_requeue_rxd()
1697 for (; frag_count > 0; frag_count--) { in mac_drv_requeue_rxd()
1698 next_rxd = src_rxd->rxd_next; in mac_drv_requeue_rxd()
1701 skb = src_rxd->rxd_os.skb; in mac_drv_requeue_rxd()
1708 rxd->rxd_os.skb = skb; in mac_drv_requeue_rxd()
1711 v_addr = skb->data; in mac_drv_requeue_rxd()
1712 b_addr = dma_map_single(&(&smc->os.pdev)->dev, in mac_drv_requeue_rxd()
1715 rxd->rxd_os.dma_addr = b_addr; in mac_drv_requeue_rxd()
1719 rxd->rxd_os.skb = NULL; in mac_drv_requeue_rxd()
1720 v_addr = smc->os.LocalRxBuffer; in mac_drv_requeue_rxd()
1721 b_addr = smc->os.LocalRxBufferDMA; in mac_drv_requeue_rxd()
1725 rxd->rxd_os.skb = skb; in mac_drv_requeue_rxd()
1726 v_addr = skb->data; in mac_drv_requeue_rxd()
1727 b_addr = dma_map_single(&(&smc->os.pdev)->dev, v_addr, in mac_drv_requeue_rxd()
1729 rxd->rxd_os.dma_addr = b_addr; in mac_drv_requeue_rxd()
1750 * smc - A pointer to the SMT context struct.
1768 MaxFrameSize = smc->os.MaxFrameSize; in mac_drv_fill_rxd()
1779 v_addr = skb->data; in mac_drv_fill_rxd()
1780 b_addr = dma_map_single(&(&smc->os.pdev)->dev, v_addr, in mac_drv_fill_rxd()
1782 rxd->rxd_os.dma_addr = b_addr; in mac_drv_fill_rxd()
1790 v_addr = smc->os.LocalRxBuffer; in mac_drv_fill_rxd()
1791 b_addr = smc->os.LocalRxBufferDMA; in mac_drv_fill_rxd()
1794 rxd->rxd_os.skb = skb; in mac_drv_fill_rxd()
1811 * smc - A pointer to the SMT context struct.
1813 * rxd - A pointer to the first RxD which is used by the receive buffer.
1815 * frag_count - Count of RxDs used by the receive buffer.
1830 printk("fddi: Multi-fragment clear!\n"); in mac_drv_clear_rxd()
1832 for (; frag_count > 0; frag_count--) { in mac_drv_clear_rxd()
1833 skb = rxd->rxd_os.skb; in mac_drv_clear_rxd()
1835 skfddi_priv *bp = &smc->os; in mac_drv_clear_rxd()
1836 int MaxFrameSize = bp->MaxFrameSize; in mac_drv_clear_rxd()
1838 dma_unmap_single(&(&bp->pdev)->dev, in mac_drv_clear_rxd()
1839 rxd->rxd_os.dma_addr, MaxFrameSize, in mac_drv_clear_rxd()
1843 rxd->rxd_os.skb = NULL; in mac_drv_clear_rxd()
1845 rxd = rxd->rxd_next; // Next RXD. in mac_drv_clear_rxd()
1864 * smc - A pointer to the SMT context struct.
1866 * len - The length (in bytes) of the received frame (FC, DA, SA, Data).
1868 * fc - The Frame Control field of the received frame.
1870 * look_ahead - A pointer to the lookahead data buffer (may be NULL).
1872 * la_len - The length of the lookahead data stored in the lookahead
1903 skb->protocol = fddi_type_trans(skb, smc->os.dev); in mac_drv_rx_init()
1920 * smc - A pointer to the SMT context struct.
1936 * smc - A pointer to the SMT context struct.
1938 * status - The current ring status.
2009 * smc - A pointer to the SMT context struct.
2011 * stat - = 0: A ring operational change occurred.
2028 smc->os.MacStat.gen.rx_errors++; in smt_stat_counter()
2043 * smc - A pointer to the SMT context struct.
2045 * c_state - Possible values are:
2101 * smc - A pointer to the SMT context struct.
2103 * e_state - Possible values are:
2156 * smc - A pointer to the SMT context struct.
2158 * r_state - Possible values are:
2176 s = "RM1_NON_OP - not operational"; in rmt_state_change()
2179 s = "RM2_RING_OP - ring operational"; in rmt_state_change()
2182 s = "RM3_DETECT - detect dupl addresses"; in rmt_state_change()
2185 s = "RM4_NON_OP_DUP - dupl. addr detected"; in rmt_state_change()
2188 s = "RM5_RING_OP_DUP - ring oper. with dupl. addr"; in rmt_state_change()
2191 s = "RM6_DIRECTED - sending directed beacons"; in rmt_state_change()
2194 s = "RM7_TRACE - trace initiated"; in rmt_state_change()
2213 * smc - A pointer to the SMT context struct.
2222 smc->os.ResetRequested = TRUE; // Set flag. in drv_reset_indication()