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
160 // Define module-wide (static) variables
186 * pdev - pointer to PCI device information
193 * 0 - This device (fddi0, fddi1, etc) configured successfully
194 * -ENODEV - No devices present, or no SysKonnect FDDI PCI device
229 err = -EIO; in skfp_init_one()
237 err = -EIO; in skfp_init_one()
246 err = -EIO; in skfp_init_one()
254 err = -ENOMEM; in skfp_init_one()
258 dev->irq = pdev->irq; in skfp_init_one()
259 dev->netdev_ops = &skfp_netdev_ops; in skfp_init_one()
261 SET_NETDEV_DEV(dev, &pdev->dev); in skfp_init_one()
263 /* Initialize board structure with bus-specific info */ in skfp_init_one()
265 smc->os.dev = dev; in skfp_init_one()
266 smc->os.bus_type = SK_BUS_TYPE_PCI; in skfp_init_one()
267 smc->os.pdev = *pdev; in skfp_init_one()
268 smc->os.QueueSkb = MAX_TX_QUEUE_LEN; in skfp_init_one()
269 smc->os.MaxFrameSize = MAX_FRAME_SIZE; in skfp_init_one()
270 smc->os.dev = dev; in skfp_init_one()
271 smc->hw.slot = -1; in skfp_init_one()
272 smc->hw.iop = mem; in skfp_init_one()
273 smc->os.ResetRequested = FALSE; in skfp_init_one()
274 skb_queue_head_init(&smc->os.SendSkbQueue); in skfp_init_one()
276 dev->base_addr = (unsigned long)mem; in skfp_init_one()
289 if ((pdev->subsystem_device & 0xff00) == 0x5500 || in skfp_init_one()
290 (pdev->subsystem_device & 0xff00) == 0x5800) in skfp_init_one()
292 " found (SK-%04X)\n", dev->name, in skfp_init_one()
293 pdev->subsystem_device); in skfp_init_one()
295 printk("%s: FDDI PCI adapter found\n", dev->name); in skfp_init_one()
299 if (smc->os.SharedMemAddr) in skfp_init_one()
300 dma_free_coherent(&pdev->dev, smc->os.SharedMemSize, in skfp_init_one()
301 smc->os.SharedMemAddr, in skfp_init_one()
302 smc->os.SharedMemDMA); in skfp_init_one()
303 dma_free_coherent(&pdev->dev, MAX_FRAME_SIZE, in skfp_init_one()
304 smc->os.LocalRxBuffer, smc->os.LocalRxBufferDMA); in skfp_init_one()
330 if (lp->os.SharedMemAddr) { in skfp_remove_one()
331 dma_free_coherent(&pdev->dev, in skfp_remove_one()
332 lp->os.SharedMemSize, in skfp_remove_one()
333 lp->os.SharedMemAddr, in skfp_remove_one()
334 lp->os.SharedMemDMA); in skfp_remove_one()
335 lp->os.SharedMemAddr = NULL; in skfp_remove_one()
337 if (lp->os.LocalRxBuffer) { in skfp_remove_one()
338 dma_free_coherent(&pdev->dev, in skfp_remove_one()
340 lp->os.LocalRxBuffer, in skfp_remove_one()
341 lp->os.LocalRxBufferDMA); in skfp_remove_one()
342 lp->os.LocalRxBuffer = NULL; in skfp_remove_one()
345 iounmap(lp->hw.iop); in skfp_remove_one()
347 ioport_unmap(lp->hw.iop); in skfp_remove_one()
368 * dev - pointer to device information
373 * The adapter is also reset. The OS must call skfp_open() to open
374 * the adapter and bring it on-line.
377 * 0 - initialization succeeded
378 * -1 - initialization failed
383 skfddi_priv *bp = &smc->os; in skfp_driver_init()
384 int err = -EIO; in skfp_driver_init()
389 bp->base_addr = dev->base_addr; in skfp_driver_init()
392 smc->hw.irq = dev->irq; in skfp_driver_init()
394 spin_lock_init(&bp->DriverLock); in skfp_driver_init()
397 bp->LocalRxBuffer = dma_alloc_coherent(&bp->pdev.dev, MAX_FRAME_SIZE, in skfp_driver_init()
398 &bp->LocalRxBufferDMA, in skfp_driver_init()
400 if (!bp->LocalRxBuffer) { in skfp_driver_init()
407 bp->SharedMemSize = mac_drv_check_space(); in skfp_driver_init()
408 pr_debug("Memory for HWM: %ld\n", bp->SharedMemSize); in skfp_driver_init()
409 if (bp->SharedMemSize > 0) { in skfp_driver_init()
410 bp->SharedMemSize += 16; // for descriptor alignment in skfp_driver_init()
412 bp->SharedMemAddr = dma_alloc_coherent(&bp->pdev.dev, in skfp_driver_init()
413 bp->SharedMemSize, in skfp_driver_init()
414 &bp->SharedMemDMA, in skfp_driver_init()
416 if (!bp->SharedMemAddr) { in skfp_driver_init()
419 bp->SharedMemSize); in skfp_driver_init()
424 bp->SharedMemAddr = NULL; in skfp_driver_init()
427 bp->SharedMemHeap = 0; in skfp_driver_init()
437 pr_debug("HW-Addr: %pMF\n", smc->hw.fddi_canon_addr.a); in skfp_driver_init()
438 eth_hw_addr_set(dev, smc->hw.fddi_canon_addr.a); in skfp_driver_init()
445 if (bp->SharedMemAddr) { in skfp_driver_init()
446 dma_free_coherent(&bp->pdev.dev, in skfp_driver_init()
447 bp->SharedMemSize, in skfp_driver_init()
448 bp->SharedMemAddr, in skfp_driver_init()
449 bp->SharedMemDMA); in skfp_driver_init()
450 bp->SharedMemAddr = NULL; in skfp_driver_init()
452 if (bp->LocalRxBuffer) { in skfp_driver_init()
453 dma_free_coherent(&bp->pdev.dev, MAX_FRAME_SIZE, in skfp_driver_init()
454 bp->LocalRxBuffer, bp->LocalRxBufferDMA); in skfp_driver_init()
455 bp->LocalRxBuffer = NULL; in skfp_driver_init()
473 * dev - pointer to device information
479 * 0 - Adapter was successfully opened
480 * -EAGAIN - Could not register IRQ
488 /* Register IRQ - support shared interrupts by passing device ptr */ in skfp_open()
489 err = request_irq(dev->irq, skfp_interrupt, IRQF_SHARED, in skfp_open()
490 dev->name, dev); in skfp_open()
505 eth_hw_addr_set(dev, smc->hw.fddi_canon_addr.a); in skfp_open()
534 * dev - pointer to device information
538 * The interrupt service routine is deregistered with the OS.
552 skfddi_priv *bp = &smc->os; in skfp_close()
562 free_irq(dev->irq, dev); in skfp_close()
564 skb_queue_purge(&bp->SendSkbQueue); in skfp_close()
565 bp->QueueSkb = MAX_TX_QUEUE_LEN; in skfp_close()
583 * irq - interrupt vector
584 * dev_id - pointer to device information
597 * on Intel-based systems) is done by the operating system outside this
613 bp = &smc->os; in skfp_interrupt()
621 if ((inpd(ISR_A) & smc->hw.is_imask) == 0) { // IRQ? in skfp_interrupt()
626 spin_lock(&bp->DriverLock); in skfp_interrupt()
631 if (smc->os.ResetRequested) { in skfp_interrupt()
633 smc->os.ResetRequested = FALSE; in skfp_interrupt()
635 spin_unlock(&bp->DriverLock); in skfp_interrupt()
654 * dev - pointer to device information
663 * have an FDDI-specific get statistics handler,
677 /* Fill the bp->stats structure with driver-maintained counters */ in skfp_ctl_get_stats()
679 bp->os.MacStat.port_bs_flag[0] = 0x1234; in skfp_ctl_get_stats()
680 bp->os.MacStat.port_bs_flag[1] = 0x5678; in skfp_ctl_get_stats()
685 /* Fill the bp->stats structure with the SMT MIB object values */ in skfp_ctl_get_stats()
687 …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()
688 bp->stats.smt_op_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_op_version_id; in skfp_ctl_get_stats()
689 bp->stats.smt_hi_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_hi_version_id; in skfp_ctl_get_stats()
690 bp->stats.smt_lo_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_lo_version_id; in skfp_ctl_get_stats()
691 …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()
692 bp->stats.smt_mib_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_mib_version_id; in skfp_ctl_get_stats()
693 bp->stats.smt_mac_cts = bp->cmd_rsp_virt->smt_mib_get.smt_mac_ct; in skfp_ctl_get_stats()
694 bp->stats.smt_non_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_non_master_ct; in skfp_ctl_get_stats()
695 bp->stats.smt_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_master_ct; in skfp_ctl_get_stats()
696 bp->stats.smt_available_paths = bp->cmd_rsp_virt->smt_mib_get.smt_available_paths; in skfp_ctl_get_stats()
697 bp->stats.smt_config_capabilities = bp->cmd_rsp_virt->smt_mib_get.smt_config_capabilities; in skfp_ctl_get_stats()
698 bp->stats.smt_config_policy = bp->cmd_rsp_virt->smt_mib_get.smt_config_policy; in skfp_ctl_get_stats()
699 bp->stats.smt_connection_policy = bp->cmd_rsp_virt->smt_mib_get.smt_connection_policy; in skfp_ctl_get_stats()
700 bp->stats.smt_t_notify = bp->cmd_rsp_virt->smt_mib_get.smt_t_notify; in skfp_ctl_get_stats()
701 bp->stats.smt_stat_rpt_policy = bp->cmd_rsp_virt->smt_mib_get.smt_stat_rpt_policy; in skfp_ctl_get_stats()
702 bp->stats.smt_trace_max_expiration = bp->cmd_rsp_virt->smt_mib_get.smt_trace_max_expiration; in skfp_ctl_get_stats()
703 bp->stats.smt_bypass_present = bp->cmd_rsp_virt->smt_mib_get.smt_bypass_present; in skfp_ctl_get_stats()
704 bp->stats.smt_ecm_state = bp->cmd_rsp_virt->smt_mib_get.smt_ecm_state; in skfp_ctl_get_stats()
705 bp->stats.smt_cf_state = bp->cmd_rsp_virt->smt_mib_get.smt_cf_state; in skfp_ctl_get_stats()
706 bp->stats.smt_remote_disconnect_flag = bp->cmd_rsp_virt->smt_mib_get.smt_remote_disconnect_flag; in skfp_ctl_get_stats()
707 bp->stats.smt_station_status = bp->cmd_rsp_virt->smt_mib_get.smt_station_status; in skfp_ctl_get_stats()
708 bp->stats.smt_peer_wrap_flag = bp->cmd_rsp_virt->smt_mib_get.smt_peer_wrap_flag; in skfp_ctl_get_stats()
709 bp->stats.smt_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_msg_time_stamp.ls; in skfp_ctl_get_stats()
710 bp->stats.smt_transition_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_transition_time_stamp.ls; in skfp_ctl_get_stats()
711 bp->stats.mac_frame_status_functions = bp->cmd_rsp_virt->smt_mib_get.mac_frame_status_functions; in skfp_ctl_get_stats()
712 bp->stats.mac_t_max_capability = bp->cmd_rsp_virt->smt_mib_get.mac_t_max_capability; in skfp_ctl_get_stats()
713 bp->stats.mac_tvx_capability = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_capability; in skfp_ctl_get_stats()
714 bp->stats.mac_available_paths = bp->cmd_rsp_virt->smt_mib_get.mac_available_paths; in skfp_ctl_get_stats()
715 bp->stats.mac_current_path = bp->cmd_rsp_virt->smt_mib_get.mac_current_path; in skfp_ctl_get_stats()
716 memcpy(bp->stats.mac_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_upstream_nbr, FDDI_K_ALEN); in skfp_ctl_get_stats()
717 …memcpy(bp->stats.mac_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_downstream_nbr, FDDI_K_ALE… in skfp_ctl_get_stats()
718 …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()
719 …memcpy(bp->stats.mac_old_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_downstream_nbr, FD… in skfp_ctl_get_stats()
720 bp->stats.mac_dup_address_test = bp->cmd_rsp_virt->smt_mib_get.mac_dup_address_test; in skfp_ctl_get_stats()
721 bp->stats.mac_requested_paths = bp->cmd_rsp_virt->smt_mib_get.mac_requested_paths; in skfp_ctl_get_stats()
722 bp->stats.mac_downstream_port_type = bp->cmd_rsp_virt->smt_mib_get.mac_downstream_port_type; in skfp_ctl_get_stats()
723 memcpy(bp->stats.mac_smt_address, &bp->cmd_rsp_virt->smt_mib_get.mac_smt_address, FDDI_K_ALEN); in skfp_ctl_get_stats()
724 bp->stats.mac_t_req = bp->cmd_rsp_virt->smt_mib_get.mac_t_req; in skfp_ctl_get_stats()
725 bp->stats.mac_t_neg = bp->cmd_rsp_virt->smt_mib_get.mac_t_neg; in skfp_ctl_get_stats()
726 bp->stats.mac_t_max = bp->cmd_rsp_virt->smt_mib_get.mac_t_max; in skfp_ctl_get_stats()
727 bp->stats.mac_tvx_value = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_value; in skfp_ctl_get_stats()
728 bp->stats.mac_frame_error_threshold = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_threshold; in skfp_ctl_get_stats()
729 bp->stats.mac_frame_error_ratio = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_ratio; in skfp_ctl_get_stats()
730 bp->stats.mac_rmt_state = bp->cmd_rsp_virt->smt_mib_get.mac_rmt_state; in skfp_ctl_get_stats()
731 bp->stats.mac_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_da_flag; in skfp_ctl_get_stats()
732 bp->stats.mac_una_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_unda_flag; in skfp_ctl_get_stats()
733 bp->stats.mac_frame_error_flag = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_flag; in skfp_ctl_get_stats()
734 bp->stats.mac_ma_unitdata_available = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_available; in skfp_ctl_get_stats()
735 bp->stats.mac_hardware_present = bp->cmd_rsp_virt->smt_mib_get.mac_hardware_present; in skfp_ctl_get_stats()
736 bp->stats.mac_ma_unitdata_enable = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_enable; in skfp_ctl_get_stats()
737 bp->stats.path_tvx_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_tvx_lower_bound; in skfp_ctl_get_stats()
738 bp->stats.path_t_max_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_t_max_lower_bound; in skfp_ctl_get_stats()
739 bp->stats.path_max_t_req = bp->cmd_rsp_virt->smt_mib_get.path_max_t_req; in skfp_ctl_get_stats()
740 …memcpy(bp->stats.path_configuration, &bp->cmd_rsp_virt->smt_mib_get.path_configuration, sizeof(bp-… in skfp_ctl_get_stats()
741 bp->stats.port_my_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[0]; in skfp_ctl_get_stats()
742 bp->stats.port_my_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[1]; in skfp_ctl_get_stats()
743 bp->stats.port_neighbor_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[0]; in skfp_ctl_get_stats()
744 bp->stats.port_neighbor_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[1]; in skfp_ctl_get_stats()
745 bp->stats.port_connection_policies[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[0]; in skfp_ctl_get_stats()
746 bp->stats.port_connection_policies[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[1]; in skfp_ctl_get_stats()
747 bp->stats.port_mac_indicated[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[0]; in skfp_ctl_get_stats()
748 bp->stats.port_mac_indicated[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[1]; in skfp_ctl_get_stats()
749 bp->stats.port_current_path[0] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[0]; in skfp_ctl_get_stats()
750 bp->stats.port_current_path[1] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[1]; in skfp_ctl_get_stats()
751 …memcpy(&bp->stats.port_requested_paths[0 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths… in skfp_ctl_get_stats()
752 …memcpy(&bp->stats.port_requested_paths[1 * 3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths… in skfp_ctl_get_stats()
753 bp->stats.port_mac_placement[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[0]; in skfp_ctl_get_stats()
754 bp->stats.port_mac_placement[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[1]; in skfp_ctl_get_stats()
755 bp->stats.port_available_paths[0] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[0]; in skfp_ctl_get_stats()
756 bp->stats.port_available_paths[1] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[1]; in skfp_ctl_get_stats()
757 bp->stats.port_pmd_class[0] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[0]; in skfp_ctl_get_stats()
758 bp->stats.port_pmd_class[1] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[1]; in skfp_ctl_get_stats()
759 …bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in skfp_ctl_get_stats()
760 …bp->stats.port_connection_capabilities[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in skfp_ctl_get_stats()
761 bp->stats.port_bs_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[0]; in skfp_ctl_get_stats()
762 bp->stats.port_bs_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[1]; in skfp_ctl_get_stats()
763 bp->stats.port_ler_estimate[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[0]; in skfp_ctl_get_stats()
764 bp->stats.port_ler_estimate[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[1]; in skfp_ctl_get_stats()
765 bp->stats.port_ler_cutoff[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[0]; in skfp_ctl_get_stats()
766 bp->stats.port_ler_cutoff[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[1]; in skfp_ctl_get_stats()
767 bp->stats.port_ler_alarm[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[0]; in skfp_ctl_get_stats()
768 bp->stats.port_ler_alarm[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[1]; in skfp_ctl_get_stats()
769 bp->stats.port_connect_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[0]; in skfp_ctl_get_stats()
770 bp->stats.port_connect_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[1]; in skfp_ctl_get_stats()
771 bp->stats.port_pcm_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[0]; in skfp_ctl_get_stats()
772 bp->stats.port_pcm_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[1]; in skfp_ctl_get_stats()
773 bp->stats.port_pc_withhold[0] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[0]; in skfp_ctl_get_stats()
774 bp->stats.port_pc_withhold[1] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[1]; in skfp_ctl_get_stats()
775 bp->stats.port_ler_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[0]; in skfp_ctl_get_stats()
776 bp->stats.port_ler_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[1]; in skfp_ctl_get_stats()
777 bp->stats.port_hardware_present[0] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[0]; in skfp_ctl_get_stats()
778 bp->stats.port_hardware_present[1] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[1]; in skfp_ctl_get_stats()
781 /* Fill the bp->stats structure with the FDDI counter values */ in skfp_ctl_get_stats()
783 bp->stats.mac_frame_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.frame_cnt.ls; in skfp_ctl_get_stats()
784 bp->stats.mac_copied_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.copied_cnt.ls; in skfp_ctl_get_stats()
785 bp->stats.mac_transmit_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.transmit_cnt.ls; in skfp_ctl_get_stats()
786 bp->stats.mac_error_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.error_cnt.ls; in skfp_ctl_get_stats()
787 bp->stats.mac_lost_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.lost_cnt.ls; in skfp_ctl_get_stats()
788 bp->stats.port_lct_fail_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[0].ls; in skfp_ctl_get_stats()
789 bp->stats.port_lct_fail_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[1].ls; in skfp_ctl_get_stats()
790 bp->stats.port_lem_reject_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[0].ls; in skfp_ctl_get_stats()
791 bp->stats.port_lem_reject_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[1].ls; in skfp_ctl_get_stats()
792 bp->stats.port_lem_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[0].ls; in skfp_ctl_get_stats()
793 bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls; in skfp_ctl_get_stats()
796 return (struct net_device_stats *)&bp->os.MacStat; in skfp_ctl_get_stats()
813 * dev - pointer to device information
835 * On-board adapter filters are updated.
840 skfddi_priv *bp = &smc->os; in skfp_ctl_set_multicast_list()
843 spin_lock_irqsave(&bp->DriverLock, Flags); in skfp_ctl_set_multicast_list()
845 spin_unlock_irqrestore(&bp->DriverLock, Flags); in skfp_ctl_set_multicast_list()
856 if (dev->flags & IFF_PROMISC) { in skfp_ctl_set_multicast_list_wo_lock()
869 if (dev->flags & IFF_ALLMULTI) { in skfp_ctl_set_multicast_list_wo_lock()
879 (struct fddi_addr *)ha->addr, in skfp_ctl_set_multicast_list_wo_lock()
883 ha->addr); in skfp_ctl_set_multicast_list_wo_lock()
914 * dev - pointer to device information
915 * addr - pointer to sockaddr structure containing unicast address to set
918 * The address pointed to by addr->sa_data is a valid unicast
925 skfddi_priv *bp = &smc->os; in skfp_ctl_set_mac_address()
929 dev_addr_set(dev, p_sockaddr->sa_data); in skfp_ctl_set_mac_address()
930 spin_lock_irqsave(&bp->DriverLock, Flags); in skfp_ctl_set_mac_address()
932 spin_unlock_irqrestore(&bp->DriverLock, Flags); in skfp_ctl_set_mac_address()
950 * 0 - success
951 * other - failure
954 * dev - pointer to device information
955 * rq - pointer to ioctl request structure
956 * cmd - ?
964 skfddi_priv *lp = &smc->os; in skfp_siocdevprivate()
969 return -EFAULT; in skfp_siocdevprivate()
972 return -EOPNOTSUPP; in skfp_siocdevprivate()
976 ioc.len = sizeof(lp->MacStat); in skfp_siocdevprivate()
978 ? -EFAULT : 0; in skfp_siocdevprivate()
982 status = -EPERM; in skfp_siocdevprivate()
984 memset(&lp->MacStat, 0, sizeof(lp->MacStat)); in skfp_siocdevprivate()
988 printk("ioctl for %s: unknown cmd: %04x\n", dev->name, ioc.cmd); in skfp_siocdevprivate()
989 status = -EOPNOTSUPP; in skfp_siocdevprivate()
1009 * skb - pointer to sk_buff to queue for transmission
1010 * dev - pointer to device information
1016 * (skb->data) can be converted to a physical address
1028 * 0 - driver has queued and/or sent packet
1029 * 1 - caller should requeue the sk_buff for later transmission
1034 * 32-bit physical address can be determined.
1037 * same board and that the OS is not in another section of
1048 skfddi_priv *bp = &smc->os; in skfp_send_pkt()
1061 if (!(skb->len >= FDDI_K_LLC_ZLEN && skb->len <= FDDI_K_LLC_LEN)) { in skfp_send_pkt()
1062 bp->MacStat.gen.tx_errors++; /* bump error counter */ in skfp_send_pkt()
1068 if (bp->QueueSkb == 0) { // return with tbusy set: queue full in skfp_send_pkt()
1073 bp->QueueSkb--; in skfp_send_pkt()
1074 skb_queue_tail(&bp->SendSkbQueue, skb); in skfp_send_pkt()
1076 if (bp->QueueSkb == 0) { in skfp_send_pkt()
1097 * smc - pointer to smc (adapter) structure
1109 skfddi_priv *bp = &smc->os; in send_queued_packets()
1122 skb = skb_dequeue(&bp->SendSkbQueue); in send_queued_packets()
1129 spin_lock_irqsave(&bp->DriverLock, Flags); in send_queued_packets()
1130 fc = skb->data[0]; in send_queued_packets()
1137 if (!smc->ess.sync_bw_available) in send_queued_packets()
1142 if (smc->mib.fddiESSSynchTxMode) { in send_queued_packets()
1149 frame_status = hwm_tx_init(smc, fc, 1, skb->len, queue); in send_queued_packets()
1158 pr_debug("%s: out of TXDs.\n", bp->dev->name); in send_queued_packets()
1161 bp->dev->name); in send_queued_packets()
1166 skb_queue_head(&bp->SendSkbQueue, skb); in send_queued_packets()
1167 spin_unlock_irqrestore(&bp->DriverLock, Flags); in send_queued_packets()
1172 bp->QueueSkb++; // one packet less in local queue in send_queued_packets()
1175 CheckSourceAddress(skb->data, smc->hw.fddi_canon_addr.a); in send_queued_packets()
1179 dma_address = dma_map_single(&(&bp->pdev)->dev, skb->data, in send_queued_packets()
1180 skb->len, DMA_TO_DEVICE); in send_queued_packets()
1182 txd->txd_os.skb = skb; // save skb in send_queued_packets()
1183 txd->txd_os.dma_addr = dma_address; // save dma mapping in send_queued_packets()
1185 hwm_tx_frag(smc, skb->data, dma_address, skb->len, in send_queued_packets()
1189 dma_unmap_single(&(&bp->pdev)->dev, dma_address, in send_queued_packets()
1190 skb->len, DMA_TO_DEVICE); in send_queued_packets()
1193 spin_unlock_irqrestore(&bp->DriverLock, Flags); in send_queued_packets()
1229 * smc - A pointer to the SMT context struct.
1251 init_smt(smc, (smc->os.dev)->dev_addr); // Initialize the hardware. in ResetAdapter()
1257 skfp_ctl_set_multicast_list_wo_lock(smc->os.dev); in ResetAdapter()
1261 //--------------- functions called by hardware module ----------------
1274 * smc - A pointer to the SMT context struct.
1281 skfddi_priv *bp = &smc->os; in llc_restart_tx()
1286 spin_unlock(&bp->DriverLock); in llc_restart_tx()
1288 spin_lock(&bp->DriverLock); in llc_restart_tx()
1289 netif_start_queue(bp->dev);// system may send again if it was blocked in llc_restart_tx()
1301 * smc - A pointer to the SMT context struct.
1303 * size - Size of memory in bytes to allocate.
1314 virt = (void *) (smc->os.SharedMemAddr + smc->os.SharedMemHeap); in mac_drv_get_space()
1316 if ((smc->os.SharedMemHeap + size) > smc->os.SharedMemSize) { in mac_drv_get_space()
1320 smc->os.SharedMemHeap += size; // Move heap pointer. in mac_drv_get_space()
1325 (smc->os.SharedMemDMA + in mac_drv_get_space()
1326 ((char *) virt - (char *)smc->os.SharedMemAddr))); in mac_drv_get_space()
1338 * This memory must be non-cached, non-movable and non-swappable.
1341 * smc - A pointer to the SMT context struct.
1343 * size - Size of memory in bytes to allocate.
1356 // Descriptor memory must be aligned on 16-byte boundary. in mac_drv_get_desc_mem()
1360 size = (u_int) (16 - (((unsigned long) virt) & 15UL)); in mac_drv_get_desc_mem()
1380 * smc - A pointer to the SMT context struct.
1382 * virt - A (virtual) pointer into our 'shared' memory area.
1389 return smc->os.SharedMemDMA + in mac_drv_virt2phys()
1390 ((char *) virt - (char *)smc->os.SharedMemAddr); in mac_drv_virt2phys()
1399 * transfer. If the OS-specific module must prepare the system hardware
1406 * smc - A pointer to the SMT context struct.
1408 * virt - The virtual address of the data.
1410 * len - The length in bytes of the data.
1412 * flag - Indicates the transmit direction and the buffer type:
1424 return smc->os.SharedMemDMA + in dma_master()
1425 ((char *) virt - (char *)smc->os.SharedMemAddr); in dma_master()
1438 * smc - A pointer to the SMT context struct.
1440 * descr - A pointer to a TxD or RxD, respectively.
1442 * flag - Indicates the DMA transfer direction / SMT buffer:
1465 skfddi_priv *bp = &smc->os; in dma_complete()
1466 volatile struct s_smt_fp_rxd *r = &descr->r; in dma_complete()
1469 if (r->rxd_os.skb && r->rxd_os.dma_addr) { in dma_complete()
1470 int MaxFrameSize = bp->MaxFrameSize; in dma_complete()
1472 dma_unmap_single(&(&bp->pdev)->dev, in dma_complete()
1473 r->rxd_os.dma_addr, MaxFrameSize, in dma_complete()
1475 r->rxd_os.dma_addr = 0; in dma_complete()
1488 * smc - A pointer to the SMT context struct.
1490 * txd - A pointer to the last TxD which is used by the frame.
1502 if (!(skb = txd->txd_os.skb)) { in mac_drv_tx_complete()
1506 txd->txd_os.skb = NULL; in mac_drv_tx_complete()
1509 dma_unmap_single(&(&smc->os.pdev)->dev, txd->txd_os.dma_addr, in mac_drv_tx_complete()
1510 skb->len, DMA_TO_DEVICE); in mac_drv_tx_complete()
1511 txd->txd_os.dma_addr = 0; in mac_drv_tx_complete()
1513 smc->os.MacStat.gen.tx_packets++; // Count transmitted packets. in mac_drv_tx_complete()
1514 smc->os.MacStat.gen.tx_bytes+=skb->len; // Count bytes in mac_drv_tx_complete()
1531 printk(KERN_INFO "---Packet start---\n"); in dump_data()
1533 printk(KERN_INFO "------------------\n"); in dump_data()
1552 * smc - A pointer to the SMT context struct.
1554 * rxd - A pointer to the first RxD which is used by the receive frame.
1556 * frag_count - Count of RxDs used by the received frame.
1558 * len - Frame length.
1566 skfddi_priv *bp = &smc->os; in mac_drv_rx_complete()
1575 printk("fddi: Multi-fragment receive!\n"); in mac_drv_rx_complete()
1576 goto RequeueRxd; // Re-use the given RXD(s). in mac_drv_rx_complete()
1579 skb = rxd->rxd_os.skb; in mac_drv_rx_complete()
1582 smc->os.MacStat.gen.rx_errors++; in mac_drv_rx_complete()
1585 virt = skb->data; in mac_drv_rx_complete()
1589 dump_data(skb->data, len); in mac_drv_rx_complete()
1593 * +-------+-------+-------+------------+--------+------------+ in mac_drv_rx_complete()
1595 * +-------+-------+-------+------------+--------+------------+ in mac_drv_rx_complete()
1626 for (n = FDDI_MAC_HDR_LEN; n; n--) in mac_drv_rx_complete()
1627 *--virt = *--cp; in mac_drv_rx_complete()
1628 // adjust sbd->data pointer in mac_drv_rx_complete()
1630 len -= RifLength; in mac_drv_rx_complete()
1635 smc->os.MacStat.gen.rx_packets++; // Count indicated receive in mac_drv_rx_complete()
1637 smc->os.MacStat.gen.rx_bytes+=len; // Count bytes. in mac_drv_rx_complete()
1642 smc->os.MacStat.gen.multicast++; in mac_drv_rx_complete()
1646 rxd->rxd_os.skb = NULL; in mac_drv_rx_complete()
1648 skb->protocol = fddi_type_trans(skb, bp->dev); in mac_drv_rx_complete()
1656 pr_debug("Rx: re-queue RXD.\n"); in mac_drv_rx_complete()
1658 smc->os.MacStat.gen.rx_errors++; // Count receive packets in mac_drv_rx_complete()
1668 * The hardware module calls this function to request the OS-specific
1673 * smc - A pointer to the SMT context struct.
1675 * rxd - A pointer to the first RxD which is used by the receive frame.
1677 * frag_count - Count of RxDs used by the received frame.
1694 printk("fddi: Multi-fragment requeue!\n"); in mac_drv_requeue_rxd()
1696 MaxFrameSize = smc->os.MaxFrameSize; in mac_drv_requeue_rxd()
1698 for (; frag_count > 0; frag_count--) { in mac_drv_requeue_rxd()
1699 next_rxd = src_rxd->rxd_next; in mac_drv_requeue_rxd()
1702 skb = src_rxd->rxd_os.skb; in mac_drv_requeue_rxd()
1709 rxd->rxd_os.skb = skb; in mac_drv_requeue_rxd()
1712 v_addr = skb->data; in mac_drv_requeue_rxd()
1713 b_addr = dma_map_single(&(&smc->os.pdev)->dev, in mac_drv_requeue_rxd()
1716 rxd->rxd_os.dma_addr = b_addr; in mac_drv_requeue_rxd()
1720 rxd->rxd_os.skb = NULL; in mac_drv_requeue_rxd()
1721 v_addr = smc->os.LocalRxBuffer; in mac_drv_requeue_rxd()
1722 b_addr = smc->os.LocalRxBufferDMA; in mac_drv_requeue_rxd()
1726 rxd->rxd_os.skb = skb; in mac_drv_requeue_rxd()
1727 v_addr = skb->data; in mac_drv_requeue_rxd()
1728 b_addr = dma_map_single(&(&smc->os.pdev)->dev, v_addr, in mac_drv_requeue_rxd()
1730 rxd->rxd_os.dma_addr = b_addr; in mac_drv_requeue_rxd()
1751 * smc - A pointer to the SMT context struct.
1769 MaxFrameSize = smc->os.MaxFrameSize; in mac_drv_fill_rxd()
1780 v_addr = skb->data; in mac_drv_fill_rxd()
1781 b_addr = dma_map_single(&(&smc->os.pdev)->dev, v_addr, in mac_drv_fill_rxd()
1783 rxd->rxd_os.dma_addr = b_addr; in mac_drv_fill_rxd()
1791 v_addr = smc->os.LocalRxBuffer; in mac_drv_fill_rxd()
1792 b_addr = smc->os.LocalRxBufferDMA; in mac_drv_fill_rxd()
1795 rxd->rxd_os.skb = skb; in mac_drv_fill_rxd()
1812 * smc - A pointer to the SMT context struct.
1814 * rxd - A pointer to the first RxD which is used by the receive buffer.
1816 * frag_count - Count of RxDs used by the receive buffer.
1831 printk("fddi: Multi-fragment clear!\n"); in mac_drv_clear_rxd()
1833 for (; frag_count > 0; frag_count--) { in mac_drv_clear_rxd()
1834 skb = rxd->rxd_os.skb; in mac_drv_clear_rxd()
1836 skfddi_priv *bp = &smc->os; in mac_drv_clear_rxd()
1837 int MaxFrameSize = bp->MaxFrameSize; in mac_drv_clear_rxd()
1839 dma_unmap_single(&(&bp->pdev)->dev, in mac_drv_clear_rxd()
1840 rxd->rxd_os.dma_addr, MaxFrameSize, in mac_drv_clear_rxd()
1844 rxd->rxd_os.skb = NULL; in mac_drv_clear_rxd()
1846 rxd = rxd->rxd_next; // Next RXD. in mac_drv_clear_rxd()
1865 * smc - A pointer to the SMT context struct.
1867 * len - The length (in bytes) of the received frame (FC, DA, SA, Data).
1869 * fc - The Frame Control field of the received frame.
1871 * look_ahead - A pointer to the lookahead data buffer (may be NULL).
1873 * la_len - The length of the lookahead data stored in the lookahead
1904 skb->protocol = fddi_type_trans(skb, smc->os.dev); in mac_drv_rx_init()
1921 * smc - A pointer to the SMT context struct.
1937 * smc - A pointer to the SMT context struct.
1939 * status - The current ring status.
2010 * smc - A pointer to the SMT context struct.
2012 * stat - = 0: A ring operational change occurred.
2029 smc->os.MacStat.gen.rx_errors++; in smt_stat_counter()
2044 * smc - A pointer to the SMT context struct.
2046 * c_state - Possible values are:
2102 * smc - A pointer to the SMT context struct.
2104 * e_state - Possible values are:
2157 * smc - A pointer to the SMT context struct.
2159 * r_state - Possible values are:
2177 s = "RM1_NON_OP - not operational"; in rmt_state_change()
2180 s = "RM2_RING_OP - ring operational"; in rmt_state_change()
2183 s = "RM3_DETECT - detect dupl addresses"; in rmt_state_change()
2186 s = "RM4_NON_OP_DUP - dupl. addr detected"; in rmt_state_change()
2189 s = "RM5_RING_OP_DUP - ring oper. with dupl. addr"; in rmt_state_change()
2192 s = "RM6_DIRECTED - sending directed beacons"; in rmt_state_change()
2195 s = "RM7_TRACE - trace initiated"; in rmt_state_change()
2214 * smc - A pointer to the SMT context struct.
2223 smc->os.ResetRequested = TRUE; // Set flag. in drv_reset_indication()