Lines Matching +full:pci +full:- +full:host +full:- +full:cam +full:- +full:generic
13 * FDDI TURBOchannel, EISA and PCI controller families. Supported
18 * DEC FDDIcontroller/PCI (DEFPA)
40 * Adapter Probe -
45 * Bus-Specific Initialization -
46 * This driver currently supports both EISA and PCI controller
49 * initialization, the only bus-specific differences is in how the
51 * run-time critical code behaves the same on both families.
55 * Driver Open/Close -
67 * Driver Shutdown -
73 * to ensure that the adapter DMA engine is taken off-line. However,
79 * Interrupt Service Routine -
85 * Interrupt enabling/disabling can occur at many levels. At the host
87 * PIC (on Intel systems). Across the bus, both EISA and PCI adapters
88 * have a bus-logic chip interrupt enable/disable as well as a DMA
92 * bus-logic chip and assumes that Linux will take care of clearing or
93 * acknowledging any host-based interrupt chips.
95 * Control Functions -
103 * - Custom ioctl interface for executing port interface commands
104 * - Custom ioctl interface for adding unicast addresses to
105 * adapter CAM (to support bridge functions).
106 * - Custom ioctl interface for supporting firmware upgrades.
108 * Hardware (port interface) Support Routines -
110 * low-level port interface routines that are called frequently. They
113 * driver initialization and run-time code must make calls into the
114 * port interface, these routines were written to be as generic and
117 * Receive Path -
127 * single-fragment receive buffers of 4608 bytes, then allocates a
134 * Transmit Path -
142 * Before posting the buffer to the adapter, the driver sets a three-byte
153 * bytes available before the skb->data field on the outgoing transmit
155 * dev->hard_header_len to 24 bytes. 21 bytes accounts for the largest
163 * or DMAing directly from the FC byte which starts at skb->data. Should
165 * module should be updated and dev->hard_header_len should be increased.
167 * dev->hard_header_len should always be evenly divisible by 4 and at
172 * 16-Aug-96 LVS Created.
173 * 20-Aug-96 LVS Updated dfx_probe so that version information
178 * 09-Sep-96 LVS Updated dfx_ctl_set_multicast_list to enable
185 * 12-Sep-96 LVS Reset current address to factory address during
187 * single fragment which includes PRH->end of data.
189 * Jun 2000 jgarzik PCI and resource alloc cleanups
193 * Feb 2001 davej PCI enable cleanups.
197 * 23 Oct 2006 macro Big-endian host support.
199 * 01 Jul 2014 macro Fixes for DMA on 64-bit hosts.
207 #include <linux/dma-mapping.h>
216 #include <linux/pci.h>
246 #define DFX_BUS_EISA(dev) (dev->bus == &eisa_bus_type)
252 #define DFX_BUS_TC(dev) (dev->bus == &tc_bus_type)
258 #define dfx_use_mmio bp->mmio
263 /* Define module-wide (static) routines */
307 /* Define module-wide (static) variables */
327 * bp - pointer to board information
328 * offset - register offset from base I/O address
329 * data - for dfx_port_write_long, this is a value to write;
341 * This port block can be used to access PDQ, ESIC, and DEFEA on-board
344 * PCI port block base addresses are assigned by the PCI BIOS or system
353 * bp->base is a valid base I/O address for this adapter.
366 writel(data, bp->base.mem + offset); in dfx_writel()
372 outl(data, bp->base.port + offset); in dfx_outl()
377 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_write_long()
389 *data = readl(bp->base.mem + offset); in dfx_readl()
394 *data = inl(bp->base.port + offset); in dfx_inl()
399 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_read_long()
421 * bp - pointer to board information
422 * bar_start - pointer to store the start addresses
423 * bar_len - pointer to store the lengths of the areas
434 struct device *bdev = bp->bus_dev; in dfx_get_bars()
448 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_get_bars()
466 bar_len[0] = ((bar_hi - bar_lo) | PI_MEM_ADD_MASK_M) + in dfx_get_bars()
478 bar_start[0] = to_tc_dev(bdev)->resource.start + in dfx_get_bars()
514 * bdev - pointer to device information
519 * 0 - This device (fddi0, fddi1, etc) configured successfully
520 * -EBUSY - Failed to get resources, or dfx_driver_init failed.
523 * It compiles so it should work :-( (PCI cards do :-)
553 return -ENOMEM; in dfx_register()
556 /* Enable PCI device. */ in dfx_register()
560 pr_err("%s: Cannot enable PCI device, aborting\n", in dfx_register()
569 bp->bus_dev = bdev; in dfx_register()
572 bp->mmio = true; in dfx_register()
577 bp->mmio = false; in dfx_register()
583 bdev->driver->name); in dfx_register()
585 bp->mmio = false; in dfx_register()
591 bdev->driver->name); in dfx_register()
595 err = -EBUSY; in dfx_register()
600 bdev->driver->name); in dfx_register()
604 err = -EBUSY; in dfx_register()
610 bdev->driver->name); in dfx_register()
614 err = -EBUSY; in dfx_register()
621 bp->base.mem = ioremap(bar_start[0], bar_len[0]); in dfx_register()
622 if (!bp->base.mem) { in dfx_register()
624 err = -ENOMEM; in dfx_register()
628 bp->base.port = bar_start[0]; in dfx_register()
629 dev->base_addr = bar_start[0]; in dfx_register()
633 dev->netdev_ops = &dfx_netdev_ops; in dfx_register()
639 err = -ENODEV; in dfx_register()
647 printk("%s: registered as %s\n", print_name, dev->name); in dfx_register()
654 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_register()
657 (PI_ALIGN_K_DESC_BLK - 1); in dfx_register()
658 if (bp->kmalloced) in dfx_register()
660 bp->kmalloced, bp->kmalloced_dma); in dfx_register()
664 iounmap(bp->base.mem); in dfx_register()
696 * Initializes the bus-specific controller logic.
702 * dev - pointer to device information
706 * then perform bus-specific logic initialization.
712 * bp->base has already been set with the proper
716 * Interrupts are enabled at the adapter bus-specific logic.
724 struct device *bdev = bp->bus_dev; in dfx_bus_init()
733 bp->dev = dev; in dfx_bus_init()
738 dev->irq = to_tc_dev(bdev)->interrupt; in dfx_bus_init()
740 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_bus_init()
752 dev->irq = 9; in dfx_bus_init()
756 dev->irq = 10; in dfx_bus_init()
760 dev->irq = 11; in dfx_bus_init()
764 dev->irq = 15; in dfx_bus_init()
772 * taking 16 32-bit words, while IOCS1 is used for the in dfx_bus_init()
773 * Burst Holdoff register, taking a single 32-bit word in dfx_bus_init()
774 * only. We use the slot-specific I/O range as per the in dfx_bus_init()
787 val = (PI_ESIC_K_CSR_IO_LEN - 1) & ~3; in dfx_bus_init()
797 val = (PI_ESIC_K_BURST_HOLDOFF_LEN - 1) & ~3; in dfx_bus_init()
834 /* Get the interrupt level from the PCI Configuration Table */ in dfx_bus_init()
836 dev->irq = pdev->irq; in dfx_bus_init()
846 /* Enable interrupts at PCI bus interface chip (PFI) */ in dfx_bus_init()
858 * Uninitializes the bus-specific controller logic.
864 * dev - pointer to device information
867 * Perform bus-specific logic uninitialization.
873 * bp->base has already been set with the proper
877 * Interrupts are disabled at the adapter bus-specific logic.
883 struct device *bdev = bp->bus_dev; in dfx_bus_uninit()
893 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_bus_uninit()
907 /* Disable interrupts at PCI bus interface chip (PFI) */ in dfx_bus_uninit()
919 * Checks the configuration (burst size, full-duplex, etc.) If any parameters
926 * bp - pointer to board information
930 * PDQ, and all FDDI PCI controllers, all values are legal.
945 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_bus_config_check()
962 if (to_eisa_device(bdev)->id.driver_data == DEFEA_PROD_ID_2) { in dfx_bus_config_check()
982 switch (bp->burst_size) in dfx_bus_config_check()
986 bp->burst_size = PI_PDATA_B_DMA_BURST_SIZE_8; in dfx_bus_config_check()
993 /* Ensure that full-duplex mode is not enabled */ in dfx_bus_config_check()
995 bp->full_duplex_enb = PI_SNMP_K_FALSE; in dfx_bus_config_check()
1015 * dev - pointer to device information
1016 * print_name - printable device name
1019 * This function allocates additional resources such as the host memory
1023 * must call dfx_open() to open the adapter and bring it on-line.
1026 * DFX_K_SUCCESS - initialization succeeded
1027 * DFX_K_FAILURE - initialization failed - could not allocate memory
1043 struct device *bdev = bp->bus_dev; in dfx_driver_init()
1050 u32 data; /* host data register value */ in dfx_driver_init()
1056 /* Initialize bus-specific hardware registers */ in dfx_driver_init()
1069 bp->full_duplex_enb = PI_SNMP_K_FALSE; in dfx_driver_init()
1070 bp->req_ttrt = 8 * 12500; /* 8ms in 80 nanosec units */ in dfx_driver_init()
1071 bp->burst_size = PI_PDATA_B_DMA_BURST_SIZE_DEF; in dfx_driver_init()
1072 bp->rcv_bufs_to_post = RCV_BUFS_DEF; in dfx_driver_init()
1102 memcpy(&bp->factory_mac_addr[0], &le32, sizeof(u32)); in dfx_driver_init()
1111 memcpy(&bp->factory_mac_addr[4], &le32, sizeof(u16)); in dfx_driver_init()
1120 dev_addr_set(dev, bp->factory_mac_addr); in dfx_driver_init()
1129 (long long)bar_start, dev->irq, dev->dev_addr); in dfx_driver_init()
1140 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_driver_init()
1143 (PI_ALIGN_K_DESC_BLK - 1); in dfx_driver_init()
1144 bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size, in dfx_driver_init()
1145 &bp->kmalloced_dma, in dfx_driver_init()
1150 top_p = bp->kmalloced_dma; /* get physical address of buffer */ in dfx_driver_init()
1153 * To guarantee the 8K alignment required for the descriptor block, 8K - 1 in dfx_driver_init()
1158 * Note: If the assumptions change regarding the non-paged, non-cached, in dfx_driver_init()
1165 curr_v = top_v + (curr_p - top_p); in dfx_driver_init()
1169 bp->descr_block_virt = (PI_DESCR_BLOCK *) curr_v; in dfx_driver_init()
1170 bp->descr_block_phys = curr_p; in dfx_driver_init()
1176 bp->cmd_req_virt = (PI_DMA_CMD_REQ *) curr_v; in dfx_driver_init()
1177 bp->cmd_req_phys = curr_p; in dfx_driver_init()
1183 bp->cmd_rsp_virt = (PI_DMA_CMD_RSP *) curr_v; in dfx_driver_init()
1184 bp->cmd_rsp_phys = curr_p; in dfx_driver_init()
1188 /* Reserve space for the LLC host receive queue buffers */ in dfx_driver_init()
1190 bp->rcv_block_virt = curr_v; in dfx_driver_init()
1191 bp->rcv_block_phys = curr_p; in dfx_driver_init()
1194 curr_v += (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX); in dfx_driver_init()
1195 curr_p += (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX); in dfx_driver_init()
1200 bp->cons_block_virt = (PI_CONSUMER_BLOCK *) curr_v; in dfx_driver_init()
1201 bp->cons_block_phys = curr_p; in dfx_driver_init()
1206 print_name, bp->descr_block_virt, &bp->descr_block_phys); in dfx_driver_init()
1208 print_name, bp->cmd_req_virt, &bp->cmd_req_phys); in dfx_driver_init()
1210 print_name, bp->cmd_rsp_virt, &bp->cmd_rsp_phys); in dfx_driver_init()
1212 print_name, bp->rcv_block_virt, &bp->rcv_block_phys); in dfx_driver_init()
1214 print_name, bp->cons_block_virt, &bp->cons_block_phys); in dfx_driver_init()
1232 * bp - pointer to board information
1233 * get_buffers - non-zero if buffers to be allocated
1236 * Issues the low-level firmware/hardware calls necessary to bring
1238 * run-time.
1241 * DFX_K_SUCCESS - Adapter brought up successfully
1242 * DFX_K_FAILURE - Adapter initialization failed
1245 * bp->reset_type should be set to a valid reset type value before
1263 if (dfx_hw_dma_uninit(bp, bp->reset_type) != DFX_K_SUCCESS) in dfx_adap_init()
1265 printk("%s: Could not uninitialize/reset adapter!\n", bp->dev->name); in dfx_adap_init()
1279 * Note: We only need to clear host copies of these registers. The PDQ reset in dfx_adap_init()
1280 * takes care of the on-board register values. in dfx_adap_init()
1283 bp->cmd_req_reg.lword = 0; in dfx_adap_init()
1284 bp->cmd_rsp_reg.lword = 0; in dfx_adap_init()
1285 bp->rcv_xmt_reg.lword = 0; in dfx_adap_init()
1289 memset(bp->cons_block_virt, 0, sizeof(PI_CONSUMER_BLOCK)); in dfx_adap_init()
1296 bp->burst_size, in dfx_adap_init()
1299 printk("%s: Could not set adapter burst size!\n", bp->dev->name); in dfx_adap_init()
1306 * Assumption: 32-bit physical address of consumer block is 64 byte in dfx_adap_init()
1307 * aligned. That is, bits 0-5 of the address must be zero. in dfx_adap_init()
1312 bp->cons_block_phys, in dfx_adap_init()
1316 printk("%s: Could not set consumer block address!\n", bp->dev->name); in dfx_adap_init()
1327 * Assumption: 32-bit physical address of descriptor block in dfx_adap_init()
1331 (u32)(bp->descr_block_phys | in dfx_adap_init()
1335 bp->dev->name); in dfx_adap_init()
1341 bp->cmd_req_virt->cmd_type = PI_CMD_K_CHARS_SET; in dfx_adap_init()
1342 bp->cmd_req_virt->char_set.item[0].item_code = PI_ITEM_K_FLUSH_TIME; in dfx_adap_init()
1343 bp->cmd_req_virt->char_set.item[0].value = 3; /* 3 seconds */ in dfx_adap_init()
1344 bp->cmd_req_virt->char_set.item[0].item_index = 0; in dfx_adap_init()
1345 bp->cmd_req_virt->char_set.item[1].item_code = PI_ITEM_K_EOL; in dfx_adap_init()
1348 printk("%s: DMA command request failed!\n", bp->dev->name); in dfx_adap_init()
1354 bp->cmd_req_virt->cmd_type = PI_CMD_K_SNMP_SET; in dfx_adap_init()
1355 bp->cmd_req_virt->snmp_set.item[0].item_code = PI_ITEM_K_FDX_ENB_DIS; in dfx_adap_init()
1356 bp->cmd_req_virt->snmp_set.item[0].value = bp->full_duplex_enb; in dfx_adap_init()
1357 bp->cmd_req_virt->snmp_set.item[0].item_index = 0; in dfx_adap_init()
1358 bp->cmd_req_virt->snmp_set.item[1].item_code = PI_ITEM_K_MAC_T_REQ; in dfx_adap_init()
1359 bp->cmd_req_virt->snmp_set.item[1].value = bp->req_ttrt; in dfx_adap_init()
1360 bp->cmd_req_virt->snmp_set.item[1].item_index = 0; in dfx_adap_init()
1361 bp->cmd_req_virt->snmp_set.item[2].item_code = PI_ITEM_K_EOL; in dfx_adap_init()
1364 printk("%s: DMA command request failed!\n", bp->dev->name); in dfx_adap_init()
1368 /* Initialize adapter CAM */ in dfx_adap_init()
1372 printk("%s: Adapter CAM update failed!\n", bp->dev->name); in dfx_adap_init()
1380 printk("%s: Adapter filters update failed!\n", bp->dev->name); in dfx_adap_init()
1396 printk("%s: Receive buffer allocation failed\n", bp->dev->name); in dfx_adap_init()
1404 bp->cmd_req_virt->cmd_type = PI_CMD_K_START; in dfx_adap_init()
1407 printk("%s: Start command failed\n", bp->dev->name); in dfx_adap_init()
1432 * dev - pointer to device information
1438 * 0 - Adapter was successfully opened
1439 * -EAGAIN - Could not register IRQ or adapter initialization failed
1457 /* Register IRQ - support shared interrupts by passing device ptr */ in dfx_open()
1459 ret = request_irq(dev->irq, dfx_interrupt, IRQF_SHARED, dev->name, in dfx_open()
1462 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); in dfx_open()
1477 dev_addr_set(dev, bp->factory_mac_addr); in dfx_open()
1481 memset(bp->uc_table, 0, sizeof(bp->uc_table)); in dfx_open()
1482 memset(bp->mc_table, 0, sizeof(bp->mc_table)); in dfx_open()
1483 bp->uc_count = 0; in dfx_open()
1484 bp->mc_count = 0; in dfx_open()
1488 bp->ind_group_prom = PI_FSTATE_K_BLOCK; in dfx_open()
1489 bp->group_prom = PI_FSTATE_K_BLOCK; in dfx_open()
1491 spin_lock_init(&bp->lock); in dfx_open()
1495 bp->reset_type = PI_PDATA_A_RESET_M_SKIP_ST; /* skip self-test */ in dfx_open()
1498 printk(KERN_ERR "%s: Adapter open failed!\n", dev->name); in dfx_open()
1499 free_irq(dev->irq, dev); in dfx_open()
1500 return -EAGAIN; in dfx_open()
1521 * dev - pointer to device information
1577 bp->cmd_req_reg.lword = 0; in dfx_close()
1578 bp->cmd_rsp_reg.lword = 0; in dfx_close()
1579 bp->rcv_xmt_reg.lword = 0; in dfx_close()
1583 memset(bp->cons_block_virt, 0, sizeof(PI_CONSUMER_BLOCK)); in dfx_close()
1595 free_irq(dev->irq, dev); in dfx_close()
1613 * bp - pointer to board information
1643 printk("%s: Halt ID: Selftest Timeout\n", bp->dev->name); in dfx_int_pr_halt_id()
1647 printk("%s: Halt ID: Host Bus Parity Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1651 printk("%s: Halt ID: Host-Directed Halt\n", bp->dev->name); in dfx_int_pr_halt_id()
1655 printk("%s: Halt ID: Adapter Software Fault\n", bp->dev->name); in dfx_int_pr_halt_id()
1659 printk("%s: Halt ID: Adapter Hardware Fault\n", bp->dev->name); in dfx_int_pr_halt_id()
1663 printk("%s: Halt ID: FDDI Network PC Trace Path Test\n", bp->dev->name); in dfx_int_pr_halt_id()
1667 printk("%s: Halt ID: Adapter DMA Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1671 printk("%s: Halt ID: Firmware Image CRC Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1675 printk("%s: Halt ID: 68000 Bus Exception\n", bp->dev->name); in dfx_int_pr_halt_id()
1679 printk("%s: Halt ID: Unknown (code = %X)\n", bp->dev->name, halt_id); in dfx_int_pr_halt_id()
1697 * bp - pointer to board information
1728 * is responsible for reinitializing the adapter with the current CAM
1735 PI_UINT32 type_0_status; /* Host Interrupt Type 0 register */ in dfx_int_type_0_process()
1739 * Read host interrupt Type 0 register to determine which Type 0 in dfx_int_type_0_process()
1753 /* Check for Non-Existent Memory error */ in dfx_int_type_0_process()
1756 printk("%s: Non-Existent Memory Access Error\n", bp->dev->name); in dfx_int_type_0_process()
1761 printk("%s: Packet Memory Parity Error\n", bp->dev->name); in dfx_int_type_0_process()
1763 /* Check for Host Bus Parity error */ in dfx_int_type_0_process()
1766 printk("%s: Host Bus Parity Error\n", bp->dev->name); in dfx_int_type_0_process()
1768 /* Reset adapter and bring it back on-line */ in dfx_int_type_0_process()
1770 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1771 bp->reset_type = 0; /* rerun on-board diagnostics */ in dfx_int_type_0_process()
1772 printk("%s: Resetting adapter...\n", bp->dev->name); in dfx_int_type_0_process()
1775 printk("%s: Adapter reset failed! Disabling adapter interrupts.\n", bp->dev->name); in dfx_int_type_0_process()
1779 printk("%s: Adapter reset successful!\n", bp->dev->name); in dfx_int_type_0_process()
1789 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1809 * adapter to bring it back on-line. If reset fails, in dfx_int_type_0_process()
1813 printk("%s: Controller has transitioned to HALTED state!\n", bp->dev->name); in dfx_int_type_0_process()
1816 /* Reset adapter and bring it back on-line */ in dfx_int_type_0_process()
1818 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1819 bp->reset_type = 0; /* rerun on-board diagnostics */ in dfx_int_type_0_process()
1820 printk("%s: Resetting adapter...\n", bp->dev->name); in dfx_int_type_0_process()
1823 printk("%s: Adapter reset failed! Disabling adapter interrupts.\n", bp->dev->name); in dfx_int_type_0_process()
1827 printk("%s: Adapter reset successful!\n", bp->dev->name); in dfx_int_type_0_process()
1831 bp->link_available = PI_K_TRUE; /* set link available flag */ in dfx_int_type_0_process()
1849 * bp - pointer to board information
1882 /* Process xmt interrupts - frequent case, so always call this routine */ in dfx_int_common()
1887 /* Process rcv interrupts - frequent case, so always call this routine */ in dfx_int_common()
1898 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_int_common()
1904 /* Process Type 0 interrupts (if any) - infrequent, so only call when needed */ in dfx_int_common()
1923 * irq - interrupt vector
1924 * dev_id - pointer to device information
1933 * IRQ_HANDLED - an IRQ was handled.
1934 * IRQ_NONE - no IRQ was handled.
1938 * on Intel-based systems) is done by the operating system outside this
1951 struct device *bdev = bp->bus_dev; in dfx_interrupt()
1965 spin_lock(&bp->lock); in dfx_interrupt()
1967 /* Disable PDQ-PFI interrupts at PFI */ in dfx_interrupt()
1981 spin_unlock(&bp->lock); in dfx_interrupt()
1984 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_interrupt()
1991 spin_lock(&bp->lock); in dfx_interrupt()
2005 spin_unlock(&bp->lock); in dfx_interrupt()
2020 spin_lock(&bp->lock); in dfx_interrupt()
2025 spin_unlock(&bp->lock); in dfx_interrupt()
2044 * dev - pointer to device information
2053 * have an FDDI-specific get statistics handler,
2059 * decode the FDDI-specific statistics.
2079 /* Fill the bp->stats structure with driver-maintained counters */ in dfx_ctl_get_stats()
2081 bp->stats.gen.rx_packets = bp->rcv_total_frames; in dfx_ctl_get_stats()
2082 bp->stats.gen.tx_packets = bp->xmt_total_frames; in dfx_ctl_get_stats()
2083 bp->stats.gen.rx_bytes = bp->rcv_total_bytes; in dfx_ctl_get_stats()
2084 bp->stats.gen.tx_bytes = bp->xmt_total_bytes; in dfx_ctl_get_stats()
2085 bp->stats.gen.rx_errors = bp->rcv_crc_errors + in dfx_ctl_get_stats()
2086 bp->rcv_frame_status_errors + in dfx_ctl_get_stats()
2087 bp->rcv_length_errors; in dfx_ctl_get_stats()
2088 bp->stats.gen.tx_errors = bp->xmt_length_errors; in dfx_ctl_get_stats()
2089 bp->stats.gen.rx_dropped = bp->rcv_discards; in dfx_ctl_get_stats()
2090 bp->stats.gen.tx_dropped = bp->xmt_discards; in dfx_ctl_get_stats()
2091 bp->stats.gen.multicast = bp->rcv_multicast_frames; in dfx_ctl_get_stats()
2092 bp->stats.gen.collisions = 0; /* always zero (0) for FDDI */ in dfx_ctl_get_stats()
2096 bp->cmd_req_virt->cmd_type = PI_CMD_K_SMT_MIB_GET; in dfx_ctl_get_stats()
2098 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2100 /* Fill the bp->stats structure with the SMT MIB object values */ in dfx_ctl_get_stats()
2102 …memcpy(bp->stats.smt_station_id, &bp->cmd_rsp_virt->smt_mib_get.smt_station_id, sizeof(bp->cmd_rsp… in dfx_ctl_get_stats()
2103 bp->stats.smt_op_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_op_version_id; in dfx_ctl_get_stats()
2104 bp->stats.smt_hi_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_hi_version_id; in dfx_ctl_get_stats()
2105 bp->stats.smt_lo_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_lo_version_id; in dfx_ctl_get_stats()
2106 …memcpy(bp->stats.smt_user_data, &bp->cmd_rsp_virt->smt_mib_get.smt_user_data, sizeof(bp->cmd_rsp_v… in dfx_ctl_get_stats()
2107 bp->stats.smt_mib_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_mib_version_id; in dfx_ctl_get_stats()
2108 bp->stats.smt_mac_cts = bp->cmd_rsp_virt->smt_mib_get.smt_mac_ct; in dfx_ctl_get_stats()
2109 bp->stats.smt_non_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_non_master_ct; in dfx_ctl_get_stats()
2110 bp->stats.smt_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_master_ct; in dfx_ctl_get_stats()
2111 bp->stats.smt_available_paths = bp->cmd_rsp_virt->smt_mib_get.smt_available_paths; in dfx_ctl_get_stats()
2112 bp->stats.smt_config_capabilities = bp->cmd_rsp_virt->smt_mib_get.smt_config_capabilities; in dfx_ctl_get_stats()
2113 bp->stats.smt_config_policy = bp->cmd_rsp_virt->smt_mib_get.smt_config_policy; in dfx_ctl_get_stats()
2114 bp->stats.smt_connection_policy = bp->cmd_rsp_virt->smt_mib_get.smt_connection_policy; in dfx_ctl_get_stats()
2115 bp->stats.smt_t_notify = bp->cmd_rsp_virt->smt_mib_get.smt_t_notify; in dfx_ctl_get_stats()
2116 bp->stats.smt_stat_rpt_policy = bp->cmd_rsp_virt->smt_mib_get.smt_stat_rpt_policy; in dfx_ctl_get_stats()
2117 bp->stats.smt_trace_max_expiration = bp->cmd_rsp_virt->smt_mib_get.smt_trace_max_expiration; in dfx_ctl_get_stats()
2118 bp->stats.smt_bypass_present = bp->cmd_rsp_virt->smt_mib_get.smt_bypass_present; in dfx_ctl_get_stats()
2119 bp->stats.smt_ecm_state = bp->cmd_rsp_virt->smt_mib_get.smt_ecm_state; in dfx_ctl_get_stats()
2120 bp->stats.smt_cf_state = bp->cmd_rsp_virt->smt_mib_get.smt_cf_state; in dfx_ctl_get_stats()
2121 bp->stats.smt_remote_disconnect_flag = bp->cmd_rsp_virt->smt_mib_get.smt_remote_disconnect_flag; in dfx_ctl_get_stats()
2122 bp->stats.smt_station_status = bp->cmd_rsp_virt->smt_mib_get.smt_station_status; in dfx_ctl_get_stats()
2123 bp->stats.smt_peer_wrap_flag = bp->cmd_rsp_virt->smt_mib_get.smt_peer_wrap_flag; in dfx_ctl_get_stats()
2124 bp->stats.smt_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_msg_time_stamp.ls; in dfx_ctl_get_stats()
2125 bp->stats.smt_transition_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_transition_time_stamp.ls; in dfx_ctl_get_stats()
2126 bp->stats.mac_frame_status_functions = bp->cmd_rsp_virt->smt_mib_get.mac_frame_status_functions; in dfx_ctl_get_stats()
2127 bp->stats.mac_t_max_capability = bp->cmd_rsp_virt->smt_mib_get.mac_t_max_capability; in dfx_ctl_get_stats()
2128 bp->stats.mac_tvx_capability = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_capability; in dfx_ctl_get_stats()
2129 bp->stats.mac_available_paths = bp->cmd_rsp_virt->smt_mib_get.mac_available_paths; in dfx_ctl_get_stats()
2130 bp->stats.mac_current_path = bp->cmd_rsp_virt->smt_mib_get.mac_current_path; in dfx_ctl_get_stats()
2131 memcpy(bp->stats.mac_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_upstream_nbr, FDDI_K_ALEN); in dfx_ctl_get_stats()
2132 …memcpy(bp->stats.mac_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_downstream_nbr, FDDI_K_ALE… in dfx_ctl_get_stats()
2133 …memcpy(bp->stats.mac_old_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_upstream_nbr, FDDI_K… in dfx_ctl_get_stats()
2134 …memcpy(bp->stats.mac_old_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_downstream_nbr, FD… in dfx_ctl_get_stats()
2135 bp->stats.mac_dup_address_test = bp->cmd_rsp_virt->smt_mib_get.mac_dup_address_test; in dfx_ctl_get_stats()
2136 bp->stats.mac_requested_paths = bp->cmd_rsp_virt->smt_mib_get.mac_requested_paths; in dfx_ctl_get_stats()
2137 bp->stats.mac_downstream_port_type = bp->cmd_rsp_virt->smt_mib_get.mac_downstream_port_type; in dfx_ctl_get_stats()
2138 memcpy(bp->stats.mac_smt_address, &bp->cmd_rsp_virt->smt_mib_get.mac_smt_address, FDDI_K_ALEN); in dfx_ctl_get_stats()
2139 bp->stats.mac_t_req = bp->cmd_rsp_virt->smt_mib_get.mac_t_req; in dfx_ctl_get_stats()
2140 bp->stats.mac_t_neg = bp->cmd_rsp_virt->smt_mib_get.mac_t_neg; in dfx_ctl_get_stats()
2141 bp->stats.mac_t_max = bp->cmd_rsp_virt->smt_mib_get.mac_t_max; in dfx_ctl_get_stats()
2142 bp->stats.mac_tvx_value = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_value; in dfx_ctl_get_stats()
2143 bp->stats.mac_frame_error_threshold = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_threshold; in dfx_ctl_get_stats()
2144 bp->stats.mac_frame_error_ratio = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_ratio; in dfx_ctl_get_stats()
2145 bp->stats.mac_rmt_state = bp->cmd_rsp_virt->smt_mib_get.mac_rmt_state; in dfx_ctl_get_stats()
2146 bp->stats.mac_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_da_flag; in dfx_ctl_get_stats()
2147 bp->stats.mac_una_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_unda_flag; in dfx_ctl_get_stats()
2148 bp->stats.mac_frame_error_flag = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_flag; in dfx_ctl_get_stats()
2149 bp->stats.mac_ma_unitdata_available = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_available; in dfx_ctl_get_stats()
2150 bp->stats.mac_hardware_present = bp->cmd_rsp_virt->smt_mib_get.mac_hardware_present; in dfx_ctl_get_stats()
2151 bp->stats.mac_ma_unitdata_enable = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_enable; in dfx_ctl_get_stats()
2152 bp->stats.path_tvx_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_tvx_lower_bound; in dfx_ctl_get_stats()
2153 bp->stats.path_t_max_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_t_max_lower_bound; in dfx_ctl_get_stats()
2154 bp->stats.path_max_t_req = bp->cmd_rsp_virt->smt_mib_get.path_max_t_req; in dfx_ctl_get_stats()
2155 …memcpy(bp->stats.path_configuration, &bp->cmd_rsp_virt->smt_mib_get.path_configuration, sizeof(bp-… in dfx_ctl_get_stats()
2156 bp->stats.port_my_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[0]; in dfx_ctl_get_stats()
2157 bp->stats.port_my_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[1]; in dfx_ctl_get_stats()
2158 bp->stats.port_neighbor_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[0]; in dfx_ctl_get_stats()
2159 bp->stats.port_neighbor_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[1]; in dfx_ctl_get_stats()
2160 bp->stats.port_connection_policies[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[0]; in dfx_ctl_get_stats()
2161 bp->stats.port_connection_policies[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[1]; in dfx_ctl_get_stats()
2162 bp->stats.port_mac_indicated[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[0]; in dfx_ctl_get_stats()
2163 bp->stats.port_mac_indicated[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[1]; in dfx_ctl_get_stats()
2164 bp->stats.port_current_path[0] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[0]; in dfx_ctl_get_stats()
2165 bp->stats.port_current_path[1] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[1]; in dfx_ctl_get_stats()
2166 …memcpy(&bp->stats.port_requested_paths[0*3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[0… in dfx_ctl_get_stats()
2167 …memcpy(&bp->stats.port_requested_paths[1*3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[1… in dfx_ctl_get_stats()
2168 bp->stats.port_mac_placement[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[0]; in dfx_ctl_get_stats()
2169 bp->stats.port_mac_placement[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[1]; in dfx_ctl_get_stats()
2170 bp->stats.port_available_paths[0] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[0]; in dfx_ctl_get_stats()
2171 bp->stats.port_available_paths[1] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[1]; in dfx_ctl_get_stats()
2172 bp->stats.port_pmd_class[0] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[0]; in dfx_ctl_get_stats()
2173 bp->stats.port_pmd_class[1] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[1]; in dfx_ctl_get_stats()
2174 …bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in dfx_ctl_get_stats()
2175 …bp->stats.port_connection_capabilities[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in dfx_ctl_get_stats()
2176 bp->stats.port_bs_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[0]; in dfx_ctl_get_stats()
2177 bp->stats.port_bs_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[1]; in dfx_ctl_get_stats()
2178 bp->stats.port_ler_estimate[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[0]; in dfx_ctl_get_stats()
2179 bp->stats.port_ler_estimate[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[1]; in dfx_ctl_get_stats()
2180 bp->stats.port_ler_cutoff[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[0]; in dfx_ctl_get_stats()
2181 bp->stats.port_ler_cutoff[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[1]; in dfx_ctl_get_stats()
2182 bp->stats.port_ler_alarm[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[0]; in dfx_ctl_get_stats()
2183 bp->stats.port_ler_alarm[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[1]; in dfx_ctl_get_stats()
2184 bp->stats.port_connect_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[0]; in dfx_ctl_get_stats()
2185 bp->stats.port_connect_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[1]; in dfx_ctl_get_stats()
2186 bp->stats.port_pcm_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[0]; in dfx_ctl_get_stats()
2187 bp->stats.port_pcm_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[1]; in dfx_ctl_get_stats()
2188 bp->stats.port_pc_withhold[0] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[0]; in dfx_ctl_get_stats()
2189 bp->stats.port_pc_withhold[1] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[1]; in dfx_ctl_get_stats()
2190 bp->stats.port_ler_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[0]; in dfx_ctl_get_stats()
2191 bp->stats.port_ler_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[1]; in dfx_ctl_get_stats()
2192 bp->stats.port_hardware_present[0] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[0]; in dfx_ctl_get_stats()
2193 bp->stats.port_hardware_present[1] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[1]; in dfx_ctl_get_stats()
2197 bp->cmd_req_virt->cmd_type = PI_CMD_K_CNTRS_GET; in dfx_ctl_get_stats()
2199 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2201 /* Fill the bp->stats structure with the FDDI counter values */ in dfx_ctl_get_stats()
2203 bp->stats.mac_frame_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.frame_cnt.ls; in dfx_ctl_get_stats()
2204 bp->stats.mac_copied_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.copied_cnt.ls; in dfx_ctl_get_stats()
2205 bp->stats.mac_transmit_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.transmit_cnt.ls; in dfx_ctl_get_stats()
2206 bp->stats.mac_error_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.error_cnt.ls; in dfx_ctl_get_stats()
2207 bp->stats.mac_lost_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.lost_cnt.ls; in dfx_ctl_get_stats()
2208 bp->stats.port_lct_fail_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[0].ls; in dfx_ctl_get_stats()
2209 bp->stats.port_lct_fail_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[1].ls; in dfx_ctl_get_stats()
2210 bp->stats.port_lem_reject_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[0].ls; in dfx_ctl_get_stats()
2211 bp->stats.port_lem_reject_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[1].ls; in dfx_ctl_get_stats()
2212 bp->stats.port_lem_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[0].ls; in dfx_ctl_get_stats()
2213 bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls; in dfx_ctl_get_stats()
2215 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2232 * dev - pointer to device information
2236 * adapter filters and CAM:
2243 * (CAM max size - number of unicast addresses in CAM)
2245 * set driver-maintained multicast address count to zero
2248 * set driver-maintained multicast address count to incoming count
2249 * update adapter CAM
2259 * On-board adapter CAM and filters are updated.
2270 if (dev->flags & IFF_PROMISC) in dfx_ctl_set_multicast_list()
2271 bp->ind_group_prom = PI_FSTATE_K_PASS; /* Enable LLC ind/group prom mode */ in dfx_ctl_set_multicast_list()
2277 bp->ind_group_prom = PI_FSTATE_K_BLOCK; /* Disable LLC ind/group prom mode */ in dfx_ctl_set_multicast_list()
2281 * Note: The adapters utilize an on-board 64 entry CAM for in dfx_ctl_set_multicast_list()
2288 * The firmware reserves two CAM entries for SMT-related in dfx_ctl_set_multicast_list()
2291 * to add more than 62 addresses to the CAM. If we are, in dfx_ctl_set_multicast_list()
2298 if (netdev_mc_count(dev) > (PI_CMD_ADDR_FILTER_K_SIZE - bp->uc_count)) in dfx_ctl_set_multicast_list()
2300 bp->group_prom = PI_FSTATE_K_PASS; /* Enable LLC group prom mode */ in dfx_ctl_set_multicast_list()
2301 bp->mc_count = 0; /* Don't add mc addrs to CAM */ in dfx_ctl_set_multicast_list()
2305 bp->group_prom = PI_FSTATE_K_BLOCK; /* Disable LLC group prom mode */ in dfx_ctl_set_multicast_list()
2306 bp->mc_count = netdev_mc_count(dev); /* Add mc addrs to CAM */ in dfx_ctl_set_multicast_list()
2309 /* Copy addresses to multicast address table, then update adapter CAM */ in dfx_ctl_set_multicast_list()
2313 memcpy(&bp->mc_table[i++ * FDDI_K_ALEN], in dfx_ctl_set_multicast_list()
2314 ha->addr, FDDI_K_ALEN); in dfx_ctl_set_multicast_list()
2318 DBG_printk("%s: Could not update multicast address table!\n", dev->name); in dfx_ctl_set_multicast_list()
2322 …DBG_printk("%s: Multicast address table updated! Added %d addresses.\n", dev->name, bp->mc_count); in dfx_ctl_set_multicast_list()
2330 DBG_printk("%s: Could not update adapter filters!\n", dev->name); in dfx_ctl_set_multicast_list()
2334 DBG_printk("%s: Adapter filters updated!\n", dev->name); in dfx_ctl_set_multicast_list()
2346 * CAM and update dev_addr field in device table.
2352 * dev - pointer to device information
2353 * addr - pointer to sockaddr structure containing unicast address to add
2357 * unicast addresses to the adapter CAM. This is similar to adding
2359 * device structures with the new address, then update the adapter CAM
2367 * The address pointed to by addr->sa_data is a valid unicast
2371 * On-board adapter CAM is updated. On-board adapter filters
2380 /* Copy unicast address to driver-maintained structs and update count */ in dfx_ctl_set_mac_address()
2382 dev_addr_set(dev, p_sockaddr->sa_data); /* update device struct */ in dfx_ctl_set_mac_address()
2383 memcpy(&bp->uc_table[0], p_sockaddr->sa_data, FDDI_K_ALEN); /* update driver struct */ in dfx_ctl_set_mac_address()
2384 bp->uc_count = 1; in dfx_ctl_set_mac_address()
2387 * Verify we're not exceeding the CAM size by adding unicast address in dfx_ctl_set_mac_address()
2390 * already filled the CAM with 62 multicast addresses. in dfx_ctl_set_mac_address()
2392 * the CAM, we have to check to see that we're not in dfx_ctl_set_mac_address()
2393 * exceeding the CAM size. If we are, we have to enable in dfx_ctl_set_mac_address()
2398 if ((bp->uc_count + bp->mc_count) > PI_CMD_ADDR_FILTER_K_SIZE) in dfx_ctl_set_mac_address()
2400 bp->group_prom = PI_FSTATE_K_PASS; /* Enable LLC group prom mode */ in dfx_ctl_set_mac_address()
2401 bp->mc_count = 0; /* Don't add mc addrs to CAM */ in dfx_ctl_set_mac_address()
2407 DBG_printk("%s: Could not update adapter filters!\n", dev->name); in dfx_ctl_set_mac_address()
2411 DBG_printk("%s: Adapter filters updated!\n", dev->name); in dfx_ctl_set_mac_address()
2415 /* Update adapter CAM with new unicast address */ in dfx_ctl_set_mac_address()
2419 DBG_printk("%s: Could not set new MAC address!\n", dev->name); in dfx_ctl_set_mac_address()
2423 DBG_printk("%s: Adapter CAM updated with new MAC address\n", dev->name); in dfx_ctl_set_mac_address()
2435 * Procedure to update adapter CAM (Content Addressable Memory)
2442 * bp - pointer to board information
2445 * Updates adapter CAM with current contents of board structure
2447 * free entries in CAM, this routine ensures that the command
2451 * DFX_K_SUCCESS - Request succeeded
2452 * DFX_K_FAILURE - Request failed
2459 * On-board adapter CAM is updated.
2465 PI_LAN_ADDR *p_addr; /* pointer to CAM entry */ in dfx_ctl_update_cam()
2480 memset(bp->cmd_req_virt, 0, PI_CMD_REQ_K_SIZE_MAX); /* first clear buffer */ in dfx_ctl_update_cam()
2481 bp->cmd_req_virt->cmd_type = PI_CMD_K_ADDR_FILTER_SET; in dfx_ctl_update_cam()
2482 p_addr = &bp->cmd_req_virt->addr_filter_set.entry[0]; in dfx_ctl_update_cam()
2486 for (i=0; i < (int)bp->uc_count; i++) in dfx_ctl_update_cam()
2490 memcpy(p_addr, &bp->uc_table[i*FDDI_K_ALEN], FDDI_K_ALEN); in dfx_ctl_update_cam()
2497 for (i=0; i < (int)bp->mc_count; i++) in dfx_ctl_update_cam()
2499 if ((i + bp->uc_count) < PI_CMD_ADDR_FILTER_K_SIZE) in dfx_ctl_update_cam()
2501 memcpy(p_addr, &bp->mc_table[i*FDDI_K_ALEN], FDDI_K_ALEN); in dfx_ctl_update_cam()
2506 /* Issue command to update adapter CAM, then return */ in dfx_ctl_update_cam()
2527 * bp - pointer to board information
2533 * DFX_K_SUCCESS - Request succeeded.
2534 * DFX_K_FAILURE - Request failed.
2538 * address (FF-FF-FF-FF-FF-FF), so we'll always keep the
2542 * On-board adapter filters are updated.
2551 bp->cmd_req_virt->cmd_type = PI_CMD_K_FILTERS_SET; in dfx_ctl_update_filters()
2553 /* Initialize Broadcast filter - * ALWAYS ENABLED * */ in dfx_ctl_update_filters()
2555 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_BROADCAST; in dfx_ctl_update_filters()
2556 bp->cmd_req_virt->filter_set.item[i++].value = PI_FSTATE_K_PASS; in dfx_ctl_update_filters()
2560 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_IND_GROUP_PROM; in dfx_ctl_update_filters()
2561 bp->cmd_req_virt->filter_set.item[i++].value = bp->ind_group_prom; in dfx_ctl_update_filters()
2565 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_GROUP_PROM; in dfx_ctl_update_filters()
2566 bp->cmd_req_virt->filter_set.item[i++].value = bp->group_prom; in dfx_ctl_update_filters()
2570 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_EOL; in dfx_ctl_update_filters()
2592 * bp - pointer to board information
2609 * DFX_K_SUCCESS - DMA command succeeded
2610 * DFX_K_OUTSTATE - Adapter is NOT in proper state
2611 * DFX_K_HW_TIMEOUT - DMA command timed out
2636 bp->descr_block_virt->cmd_rsp[bp->cmd_rsp_reg.index.prod].long_0 = (u32) (PI_RCV_DESCR_M_SOP | in dfx_hw_dma_cmd_req()
2638 bp->descr_block_virt->cmd_rsp[bp->cmd_rsp_reg.index.prod].long_1 = bp->cmd_rsp_phys; in dfx_hw_dma_cmd_req()
2642 bp->cmd_rsp_reg.index.prod += 1; in dfx_hw_dma_cmd_req()
2643 bp->cmd_rsp_reg.index.prod &= PI_CMD_RSP_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2644 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_RSP_PROD, bp->cmd_rsp_reg.lword); in dfx_hw_dma_cmd_req()
2648 bp->descr_block_virt->cmd_req[bp->cmd_req_reg.index.prod].long_0 = (u32) (PI_XMT_DESCR_M_SOP | in dfx_hw_dma_cmd_req()
2650 bp->descr_block_virt->cmd_req[bp->cmd_req_reg.index.prod].long_1 = bp->cmd_req_phys; in dfx_hw_dma_cmd_req()
2654 bp->cmd_req_reg.index.prod += 1; in dfx_hw_dma_cmd_req()
2655 bp->cmd_req_reg.index.prod &= PI_CMD_REQ_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2656 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_REQ_PROD, bp->cmd_req_reg.lword); in dfx_hw_dma_cmd_req()
2663 for (timeout_cnt = 20000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_cmd_req()
2665 if (bp->cmd_req_reg.index.prod == (u8)(bp->cons_block_virt->cmd_req)) in dfx_hw_dma_cmd_req()
2674 bp->cmd_req_reg.index.comp += 1; in dfx_hw_dma_cmd_req()
2675 bp->cmd_req_reg.index.comp &= PI_CMD_REQ_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2676 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_REQ_PROD, bp->cmd_req_reg.lword); in dfx_hw_dma_cmd_req()
2683 for (timeout_cnt = 20000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_cmd_req()
2685 if (bp->cmd_rsp_reg.index.prod == (u8)(bp->cons_block_virt->cmd_rsp)) in dfx_hw_dma_cmd_req()
2694 bp->cmd_rsp_reg.index.comp += 1; in dfx_hw_dma_cmd_req()
2695 bp->cmd_rsp_reg.index.comp &= PI_CMD_RSP_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2696 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_RSP_PROD, bp->cmd_rsp_reg.lword); in dfx_hw_dma_cmd_req()
2710 * Host data register value in host_data if ptr is not NULL
2713 * bp - pointer to board information
2714 * command - port control command
2715 * data_a - port data A register value
2716 * data_b - port data B register value
2717 * host_data - ptr to host data register value
2720 * Send generic port control command to adapter by writing
2724 * DFX_K_SUCCESS - port control command succeeded
2725 * DFX_K_HW_TIMEOUT - port control command timed out
2763 for (; timeout_cnt > 0; timeout_cnt--) in dfx_hw_port_ctrl_req()
2774 * If the address of host_data is non-zero, assume caller has supplied a in dfx_hw_port_ctrl_req()
2797 * bp - pointer to board information
2798 * type - type of reset to perform
2851 * bp - pointer to board information
2887 * bp - pointer to board information
2888 * type - type of reset to perform
2896 * DFX_K_SUCCESS - adapter is in DMA_UNAVAILABLE state
2897 * DFX_K_HW_TIMEOUT - adapter did not reset properly
2916 for (timeout_cnt = 100000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_uninit()
2934 unsigned long x = (unsigned long)skb->data; in my_skb_align()
2939 skb_reserve(skb, v - x); in my_skb_align()
2949 * Produces buffers to adapter LLC Host receive descriptor block
2955 * bp - pointer to board information
2956 * get_buffers - non-zero if buffers to be allocated
2961 * LLC Host queue receive buffers.
2964 * Return 0 on success or -ENOMEM if buffer allocation failed (when using
2984 * first longword in each receive descriptor for entire LLC Host descriptor in dfx_rcv_init()
2994 * aligned. In other words, bits 0-6 of the length and address must in dfx_rcv_init()
2996 * all PDQ-based boards. We guaranteed both requirements during in dfx_rcv_init()
3002 for (i = 0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_init()
3003 for (j = 0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_init()
3008 newskb = __netdev_alloc_skb(bp->dev, NEW_SKB_SIZE, in dfx_rcv_init()
3011 return -ENOMEM; in dfx_rcv_init()
3018 dma_addr = dma_map_single(bp->bus_dev, in dfx_rcv_init()
3019 newskb->data, in dfx_rcv_init()
3022 if (dma_mapping_error(bp->bus_dev, dma_addr)) { in dfx_rcv_init()
3024 return -ENOMEM; in dfx_rcv_init()
3026 bp->descr_block_virt->rcv_data[i + j].long_0 = in dfx_rcv_init()
3031 bp->descr_block_virt->rcv_data[i + j].long_1 = in dfx_rcv_init()
3038 bp->p_rcv_buff_va[i+j] = (char *) newskb; in dfx_rcv_init()
3041 for (i=0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_init()
3042 for (j=0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_init()
3044 bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP | in dfx_rcv_init()
3046 …bp->descr_block_virt->rcv_data[i+j].long_1 = (u32) (bp->rcv_block_phys + (i * PI_RCV_DATA_K_SIZE_M… in dfx_rcv_init()
3047 bp->p_rcv_buff_va[i+j] = (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX)); in dfx_rcv_init()
3054 bp->rcv_xmt_reg.index.rcv_prod = bp->rcv_bufs_to_post; in dfx_rcv_init()
3055 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_rcv_init()
3072 * bp - pointer to board information
3104 p_type_2_cons = (PI_TYPE_2_CONSUMER *)(&bp->cons_block_virt->xmt_rcv_data); in dfx_rcv_queue_process()
3105 while (bp->rcv_xmt_reg.index.rcv_comp != p_type_2_cons->index.rcv_cons) in dfx_rcv_queue_process()
3111 entry = bp->rcv_xmt_reg.index.rcv_comp; in dfx_rcv_queue_process()
3113 p_buff = (char *) (((struct sk_buff *)bp->p_rcv_buff_va[entry])->data); in dfx_rcv_queue_process()
3115 p_buff = bp->p_rcv_buff_va[entry]; in dfx_rcv_queue_process()
3117 dma_addr = bp->descr_block_virt->rcv_data[entry].long_1; in dfx_rcv_queue_process()
3118 dma_sync_single_for_cpu(bp->bus_dev, in dfx_rcv_queue_process()
3127 bp->rcv_crc_errors++; in dfx_rcv_queue_process()
3129 bp->rcv_frame_status_errors++; in dfx_rcv_queue_process()
3135 /* The frame was received without errors - verify packet length */ in dfx_rcv_queue_process()
3138 pkt_len -= 4; /* subtract 4 byte CRC */ in dfx_rcv_queue_process()
3140 bp->rcv_length_errors++; in dfx_rcv_queue_process()
3148 newskb = netdev_alloc_skb(bp->dev, in dfx_rcv_queue_process()
3153 bp->bus_dev, in dfx_rcv_queue_process()
3154 newskb->data, in dfx_rcv_queue_process()
3158 bp->bus_dev, in dfx_rcv_queue_process()
3167 skb = (struct sk_buff *)bp->p_rcv_buff_va[entry]; in dfx_rcv_queue_process()
3168 dma_unmap_single(bp->bus_dev, in dfx_rcv_queue_process()
3173 bp->p_rcv_buff_va[entry] = (char *)newskb; in dfx_rcv_queue_process()
3174 bp->descr_block_virt->rcv_data[entry].long_1 = (u32)new_dma_addr; in dfx_rcv_queue_process()
3181 skb = netdev_alloc_skb(bp->dev, in dfx_rcv_queue_process()
3185 printk("%s: Could not allocate receive buffer. Dropping packet.\n", bp->dev->name); in dfx_rcv_queue_process()
3186 bp->rcv_discards++; in dfx_rcv_queue_process()
3193 bp->bus_dev, in dfx_rcv_queue_process()
3206 skb->protocol = fddi_type_trans(skb, bp->dev); in dfx_rcv_queue_process()
3207 bp->rcv_total_bytes += skb->len; in dfx_rcv_queue_process()
3211 bp->rcv_total_frames++; in dfx_rcv_queue_process()
3213 bp->rcv_multicast_frames++; in dfx_rcv_queue_process()
3226 bp->rcv_xmt_reg.index.rcv_prod += 1; in dfx_rcv_queue_process()
3227 bp->rcv_xmt_reg.index.rcv_comp += 1; in dfx_rcv_queue_process()
3244 * skb - pointer to sk_buff to queue for transmission
3245 * dev - pointer to device information
3251 * (skb->data) can be converted to a physical address
3258 * ensured that dev->hard_header_len includes three pad
3268 * 0 - driver queued packet, link is unavailable, or skbuff was bad
3269 * 1 - caller should requeue the sk_buff for later transmission
3282 * 32-bit physical address can be determined.
3314 if (!IN_RANGE(skb->len, FDDI_K_LLC_ZLEN, FDDI_K_LLC_LEN)) in dfx_xmt_queue_pkt()
3316 printk("%s: Invalid packet length - %u bytes\n", in dfx_xmt_queue_pkt()
3317 dev->name, skb->len); in dfx_xmt_queue_pkt()
3318 bp->xmt_length_errors++; /* bump error counter */ in dfx_xmt_queue_pkt()
3335 if (bp->link_available == PI_K_FALSE) in dfx_xmt_queue_pkt()
3338 bp->link_available = PI_K_TRUE; /* if so, set flag and continue */ in dfx_xmt_queue_pkt()
3341 bp->xmt_discards++; /* bump error counter */ in dfx_xmt_queue_pkt()
3351 skb->data[0] = DFX_PRH0_BYTE; /* these byte values are defined */ in dfx_xmt_queue_pkt()
3352 skb->data[1] = DFX_PRH1_BYTE; /* in the Motorola FDDI MAC chip */ in dfx_xmt_queue_pkt()
3353 skb->data[2] = DFX_PRH2_BYTE; /* specification */ in dfx_xmt_queue_pkt()
3355 dma_addr = dma_map_single(bp->bus_dev, skb->data, skb->len, in dfx_xmt_queue_pkt()
3357 if (dma_mapping_error(bp->bus_dev, dma_addr)) { in dfx_xmt_queue_pkt()
3362 spin_lock_irqsave(&bp->lock, flags); in dfx_xmt_queue_pkt()
3366 prod = bp->rcv_xmt_reg.index.xmt_prod; in dfx_xmt_queue_pkt()
3367 p_xmt_descr = &(bp->descr_block_virt->xmt_data[prod]); in dfx_xmt_queue_pkt()
3380 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[prod++]); /* also bump producer index */ in dfx_xmt_queue_pkt()
3388 * buffer from the PRH, not skb->data. in dfx_xmt_queue_pkt()
3392 * at skb->data. in dfx_xmt_queue_pkt()
3393 * 2. The 4-byte CRC is not appended to the buffer or in dfx_xmt_queue_pkt()
3395 * 3. Packet length (skb->len) is from FC to end of in dfx_xmt_queue_pkt()
3400 * contiguous, non-cached, locked memory space in dfx_xmt_queue_pkt()
3402 * skb->data. in dfx_xmt_queue_pkt()
3405 * by using dma_map_single() and is only 32-bits in dfx_xmt_queue_pkt()
3409 …p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP | PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR… in dfx_xmt_queue_pkt()
3410 p_xmt_descr->long_1 = (u32)dma_addr; in dfx_xmt_queue_pkt()
3423 if (prod == bp->rcv_xmt_reg.index.xmt_comp) in dfx_xmt_queue_pkt()
3426 spin_unlock_irqrestore(&bp->lock, flags); in dfx_xmt_queue_pkt()
3446 p_xmt_drv_descr->p_skb = skb; in dfx_xmt_queue_pkt()
3450 bp->rcv_xmt_reg.index.xmt_prod = prod; in dfx_xmt_queue_pkt()
3451 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_xmt_queue_pkt()
3452 spin_unlock_irqrestore(&bp->lock, flags); in dfx_xmt_queue_pkt()
3470 * bp - pointer to board information
3499 p_type_2_cons = (PI_TYPE_2_CONSUMER *)(&bp->cons_block_virt->xmt_rcv_data); in dfx_xmt_done()
3500 while (bp->rcv_xmt_reg.index.xmt_comp != p_type_2_cons->index.xmt_cons) in dfx_xmt_done()
3504 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[bp->rcv_xmt_reg.index.xmt_comp]); in dfx_xmt_done()
3508 bp->xmt_total_frames++; in dfx_xmt_done()
3509 bp->xmt_total_bytes += p_xmt_drv_descr->p_skb->len; in dfx_xmt_done()
3512 comp = bp->rcv_xmt_reg.index.xmt_comp; in dfx_xmt_done()
3513 dma_unmap_single(bp->bus_dev, in dfx_xmt_done()
3514 bp->descr_block_virt->xmt_data[comp].long_1, in dfx_xmt_done()
3515 p_xmt_drv_descr->p_skb->len, in dfx_xmt_done()
3517 dev_consume_skb_irq(p_xmt_drv_descr->p_skb); in dfx_xmt_done()
3530 bp->rcv_xmt_reg.index.xmt_comp += 1; in dfx_xmt_done()
3549 * bp - pointer to board information
3568 for (i = 0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_flush()
3569 for (j = 0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_flush()
3572 skb = (struct sk_buff *)bp->p_rcv_buff_va[i+j]; in dfx_rcv_flush()
3574 dma_unmap_single(bp->bus_dev, in dfx_rcv_flush()
3575 bp->descr_block_virt->rcv_data[i+j].long_1, in dfx_rcv_flush()
3580 bp->p_rcv_buff_va[i+j] = NULL; in dfx_rcv_flush()
3599 * bp - pointer to board information
3630 while (bp->rcv_xmt_reg.index.xmt_comp != bp->rcv_xmt_reg.index.xmt_prod) in dfx_xmt_flush()
3634 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[bp->rcv_xmt_reg.index.xmt_comp]); in dfx_xmt_flush()
3637 comp = bp->rcv_xmt_reg.index.xmt_comp; in dfx_xmt_flush()
3638 dma_unmap_single(bp->bus_dev, in dfx_xmt_flush()
3639 bp->descr_block_virt->xmt_data[comp].long_1, in dfx_xmt_flush()
3640 p_xmt_drv_descr->p_skb->len, in dfx_xmt_flush()
3642 dev_kfree_skb(p_xmt_drv_descr->p_skb); in dfx_xmt_flush()
3646 bp->xmt_discards++; in dfx_xmt_flush()
3659 bp->rcv_xmt_reg.index.xmt_comp += 1; in dfx_xmt_flush()
3664 prod_cons = (u32)(bp->cons_block_virt->xmt_rcv_data & ~PI_CONS_M_XMT_INDEX); in dfx_xmt_flush()
3665 prod_cons |= (u32)(bp->rcv_xmt_reg.index.xmt_prod << PI_CONS_V_XMT_INDEX); in dfx_xmt_flush()
3666 bp->cons_block_virt->xmt_rcv_data = prod_cons; in dfx_xmt_flush()
3681 * bdev - pointer to device information
3689 * It compiles so it should work :-( (PCI cards do :-)
3709 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_unregister()
3712 (PI_ALIGN_K_DESC_BLK - 1); in dfx_unregister()
3713 if (bp->kmalloced) in dfx_unregister()
3715 bp->kmalloced, bp->kmalloced_dma); in dfx_unregister()
3725 iounmap(bp->base.mem); in dfx_unregister()
3748 MODULE_DEVICE_TABLE(pci, dfx_pci_table);
3760 return dfx_register(&pdev->dev); in dfx_pci_register()
3765 dfx_unregister(&pdev->dev); in dfx_pci_unregister()
3792 { "DEC ", "PMAF-FA " },
3793 { "DEC ", "PMAF-FD " },
3794 { "DEC ", "PMAF-FS " },
3795 { "DEC ", "PMAF-FU " },
3865 MODULE_DESCRIPTION("DEC FDDIcontroller TC/EISA/PCI (DEFTA/DEFEA/DEFPA) driver "