Lines Matching refs:bp

258 #define dfx_use_mmio bp->mmio
267 static void dfx_bus_config_check(DFX_board_t *bp);
272 static int dfx_adap_init(DFX_board_t *bp, int get_buffers);
277 static void dfx_int_pr_halt_id(DFX_board_t *bp);
278 static void dfx_int_type_0_process(DFX_board_t *bp);
285 static int dfx_ctl_update_cam(DFX_board_t *bp);
286 static int dfx_ctl_update_filters(DFX_board_t *bp);
288 static int dfx_hw_dma_cmd_req(DFX_board_t *bp);
289 static int dfx_hw_port_ctrl_req(DFX_board_t *bp, PI_UINT32 command, PI_UINT32 data_a, PI_UINT32 da…
290 static void dfx_hw_adap_reset(DFX_board_t *bp, PI_UINT32 type);
291 static int dfx_hw_adap_state_rd(DFX_board_t *bp);
292 static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type);
294 static int dfx_rcv_init(DFX_board_t *bp, int get_buffers);
295 static void dfx_rcv_queue_process(DFX_board_t *bp);
297 static void dfx_rcv_flush(DFX_board_t *bp);
299 static inline void dfx_rcv_flush(DFX_board_t *bp) {} in dfx_rcv_flush() argument
304 static int dfx_xmt_done(DFX_board_t *bp);
305 static void dfx_xmt_flush(DFX_board_t *bp);
364 static inline void dfx_writel(DFX_board_t *bp, int offset, u32 data) in dfx_writel() argument
366 writel(data, bp->base.mem + offset); in dfx_writel()
370 static inline void dfx_outl(DFX_board_t *bp, int offset, u32 data) in dfx_outl() argument
372 outl(data, bp->base.port + offset); in dfx_outl()
375 static void dfx_port_write_long(DFX_board_t *bp, int offset, u32 data) in dfx_port_write_long() argument
377 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_write_long()
380 dfx_writel(bp, offset, data); in dfx_port_write_long()
382 dfx_outl(bp, offset, data); in dfx_port_write_long()
386 static inline void dfx_readl(DFX_board_t *bp, int offset, u32 *data) in dfx_readl() argument
389 *data = readl(bp->base.mem + offset); in dfx_readl()
392 static inline void dfx_inl(DFX_board_t *bp, int offset, u32 *data) in dfx_inl() argument
394 *data = inl(bp->base.port + offset); in dfx_inl()
397 static void dfx_port_read_long(DFX_board_t *bp, int offset, u32 *data) in dfx_port_read_long() argument
399 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_read_long()
402 dfx_readl(bp, offset, data); in dfx_port_read_long()
404 dfx_inl(bp, offset, data); in dfx_port_read_long()
431 static void dfx_get_bars(DFX_board_t *bp, in dfx_get_bars() argument
434 struct device *bdev = bp->bus_dev; in dfx_get_bars()
537 DFX_board_t *bp; /* board pointer */ in dfx_register() local
549 dev = alloc_fddidev(sizeof(*bp)); in dfx_register()
568 bp = netdev_priv(dev); in dfx_register()
569 bp->bus_dev = bdev; in dfx_register()
572 bp->mmio = true; in dfx_register()
574 dfx_get_bars(bp, bar_start, bar_len); in dfx_register()
577 bp->mmio = false; in dfx_register()
578 dfx_get_bars(bp, bar_start, bar_len); in dfx_register()
585 bp->mmio = false; in dfx_register()
586 dfx_get_bars(bp, bar_start, bar_len); 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()
628 bp->base.port = bar_start[0]; in dfx_register()
654 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + 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()
723 DFX_board_t *bp = netdev_priv(dev); in dfx_bus_init() local
724 struct device *bdev = bp->bus_dev; in dfx_bus_init()
733 bp->dev = dev; in dfx_bus_init()
848 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, val); in dfx_bus_init()
882 DFX_board_t *bp = netdev_priv(dev); in dfx_bus_uninit() local
883 struct device *bdev = bp->bus_dev; in dfx_bus_uninit()
908 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, 0); in dfx_bus_uninit()
943 static void dfx_bus_config_check(DFX_board_t *bp) in dfx_bus_config_check() argument
945 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_bus_config_check()
967 status = dfx_hw_port_ctrl_req(bp, 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()
995 bp->full_duplex_enb = PI_SNMP_K_FALSE; in dfx_bus_config_check()
1042 DFX_board_t *bp = netdev_priv(dev); in dfx_driver_init() local
1043 struct device *bdev = bp->bus_dev; 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()
1083 dfx_bus_config_check(bp); in dfx_driver_init()
1087 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_DISABLE_ALL_INTS); in dfx_driver_init()
1091 (void) dfx_hw_dma_uninit(bp, PI_PDATA_A_RESET_M_SKIP_ST); in dfx_driver_init()
1095 if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_LO, 0, in dfx_driver_init()
1102 memcpy(&bp->factory_mac_addr[0], &le32, sizeof(u32)); in dfx_driver_init()
1104 if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_MLA, PI_PDATA_A_MLA_K_HI, 0, 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()
1140 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + 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()
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()
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()
1253 static int dfx_adap_init(DFX_board_t *bp, int get_buffers) in dfx_adap_init() argument
1259 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_DISABLE_ALL_INTS); in dfx_adap_init()
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()
1274 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_0_STATUS, PI_HOST_INT_K_ACK_ALL_TYPE_0); 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()
1293 if (dfx_hw_port_ctrl_req(bp, 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()
1310 if (dfx_hw_port_ctrl_req(bp, 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()
1330 if (dfx_hw_port_ctrl_req(bp, PI_PCTRL_M_INIT, 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()
1346 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) 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()
1362 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_adap_init()
1364 printk("%s: DMA command request failed!\n", bp->dev->name); in dfx_adap_init()
1370 if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS) in dfx_adap_init()
1372 printk("%s: Adapter CAM update failed!\n", bp->dev->name); in dfx_adap_init()
1378 if (dfx_ctl_update_filters(bp) != DFX_K_SUCCESS) in dfx_adap_init()
1380 printk("%s: Adapter filters update failed!\n", bp->dev->name); in dfx_adap_init()
1390 dfx_rcv_flush(bp); in dfx_adap_init()
1394 if (dfx_rcv_init(bp, get_buffers)) in dfx_adap_init()
1396 printk("%s: Receive buffer allocation failed\n", bp->dev->name); in dfx_adap_init()
1398 dfx_rcv_flush(bp); in dfx_adap_init()
1404 bp->cmd_req_virt->cmd_type = PI_CMD_K_START; in dfx_adap_init()
1405 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_adap_init()
1407 printk("%s: Start command failed\n", bp->dev->name); in dfx_adap_init()
1409 dfx_rcv_flush(bp); in dfx_adap_init()
1415 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_ENABLE_DEF_INTS); in dfx_adap_init()
1452 DFX_board_t *bp = netdev_priv(dev); in dfx_open() local
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()
1496 if (dfx_adap_init(bp, 1) != DFX_K_SUCCESS) in dfx_open()
1543 DFX_board_t *bp = netdev_priv(dev); in dfx_close() local
1549 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_DISABLE_ALL_INTS); in dfx_close()
1553 (void) dfx_hw_dma_uninit(bp, PI_PDATA_A_RESET_M_SKIP_ST); in dfx_close()
1564 dfx_xmt_flush(bp); in dfx_close()
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()
1587 dfx_rcv_flush(bp); in dfx_close()
1628 static void dfx_int_pr_halt_id(DFX_board_t *bp) in dfx_int_pr_halt_id() argument
1635 dfx_port_read_long(bp, PI_PDQ_K_REG_PORT_STATUS, &port_status); in dfx_int_pr_halt_id()
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()
1732 static void dfx_int_type_0_process(DFX_board_t *bp) in dfx_int_type_0_process() argument
1744 dfx_port_read_long(bp, PI_PDQ_K_REG_TYPE_0_STATUS, &type_0_status); in dfx_int_type_0_process()
1745 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_0_STATUS, type_0_status); 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()
1766 printk("%s: Host Bus Parity Error\n", bp->dev->name); 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()
1773 if (dfx_adap_init(bp, 0) != DFX_K_SUCCESS) 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()
1776 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_DISABLE_ALL_INTS); 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()
1790 dfx_xmt_flush(bp); /* flush any outstanding packets */ in dfx_int_type_0_process()
1791 (void) dfx_hw_port_ctrl_req(bp, in dfx_int_type_0_process()
1804 state = dfx_hw_adap_state_rd(bp); /* get adapter state */ 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()
1814 dfx_int_pr_halt_id(bp); /* display halt id as string */ 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()
1821 if (dfx_adap_init(bp, 0) != DFX_K_SUCCESS) 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()
1824 dfx_port_write_long(bp, PI_PDQ_K_REG_HOST_INT_ENB, PI_HOST_INT_K_DISABLE_ALL_INTS); 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()
1879 DFX_board_t *bp = netdev_priv(dev); in dfx_int_common() local
1884 if(dfx_xmt_done(bp)) /* free consumed xmt packets */ in dfx_int_common()
1889 dfx_rcv_queue_process(bp); /* service received LLC frames */ 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()
1902 dfx_port_read_long(bp, PI_PDQ_K_REG_PORT_STATUS, &port_status); in dfx_int_common()
1907 dfx_int_type_0_process(bp); /* process Type 0 interrupts */ in dfx_int_common()
1950 DFX_board_t *bp = netdev_priv(dev); in dfx_interrupt() local
1951 struct device *bdev = bp->bus_dev; in dfx_interrupt()
1961 dfx_port_read_long(bp, PFI_K_REG_STATUS, &status); in dfx_interrupt()
1965 spin_lock(&bp->lock); in dfx_interrupt()
1968 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, in dfx_interrupt()
1975 dfx_port_write_long(bp, PFI_K_REG_STATUS, in dfx_interrupt()
1977 dfx_port_write_long(bp, PFI_K_REG_MODE_CTRL, in dfx_interrupt()
1981 spin_unlock(&bp->lock); in dfx_interrupt()
1991 spin_lock(&bp->lock); in dfx_interrupt()
2005 spin_unlock(&bp->lock); in dfx_interrupt()
2010 dfx_port_read_long(bp, PI_PDQ_K_REG_PORT_STATUS, &status); in dfx_interrupt()
2020 spin_lock(&bp->lock); in dfx_interrupt()
2025 spin_unlock(&bp->lock); in dfx_interrupt()
2077 DFX_board_t *bp = netdev_priv(dev); in dfx_ctl_get_stats() local
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()
2097 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_ctl_get_stats()
2098 return (struct net_device_stats *)&bp->stats; 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()
2174bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in dfx_ctl_get_stats()
2175bp->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()
2198 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_ctl_get_stats()
2199 return (struct net_device_stats *)&bp->stats; 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()
2264 DFX_board_t *bp = netdev_priv(dev); in dfx_ctl_set_multicast_list() local
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()
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()
2313 memcpy(&bp->mc_table[i++ * FDDI_K_ALEN], in dfx_ctl_set_multicast_list()
2316 if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS) 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()
2328 if (dfx_ctl_update_filters(bp) != DFX_K_SUCCESS) in dfx_ctl_set_multicast_list()
2378 DFX_board_t *bp = netdev_priv(dev); in dfx_ctl_set_mac_address() local
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()
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()
2405 if (dfx_ctl_update_filters(bp) != DFX_K_SUCCESS) in dfx_ctl_set_mac_address()
2417 if (dfx_ctl_update_cam(bp) != DFX_K_SUCCESS) in dfx_ctl_set_mac_address()
2462 static int dfx_ctl_update_cam(DFX_board_t *bp) in dfx_ctl_update_cam() argument
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()
2508 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_ctl_update_cam()
2545 static int dfx_ctl_update_filters(DFX_board_t *bp) in dfx_ctl_update_filters() argument
2551 bp->cmd_req_virt->cmd_type = PI_CMD_K_FILTERS_SET; 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()
2574 if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS) in dfx_ctl_update_filters()
2620 static int dfx_hw_dma_cmd_req(DFX_board_t *bp) in dfx_hw_dma_cmd_req() argument
2627 status = dfx_hw_adap_state_rd(bp); in dfx_hw_dma_cmd_req()
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()
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()
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()
2735 DFX_board_t *bp, in dfx_hw_port_ctrl_req() argument
2752 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_DATA_A, data_a); in dfx_hw_port_ctrl_req()
2753 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_DATA_B, data_b); in dfx_hw_port_ctrl_req()
2754 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_CTRL, port_cmd); in dfx_hw_port_ctrl_req()
2765 dfx_port_read_long(bp, PI_PDQ_K_REG_PORT_CTRL, &port_cmd); in dfx_hw_port_ctrl_req()
2780 dfx_port_read_long(bp, PI_PDQ_K_REG_HOST_DATA, host_data); in dfx_hw_port_ctrl_req()
2819 DFX_board_t *bp, in dfx_hw_adap_reset() argument
2826 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_DATA_A, type); /* tell adapter type of reset */ in dfx_hw_adap_reset()
2827 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_RESET, PI_RESET_M_ASSERT_RESET); in dfx_hw_adap_reset()
2835 dfx_port_write_long(bp, PI_PDQ_K_REG_PORT_RESET, 0); in dfx_hw_adap_reset()
2866 static int dfx_hw_adap_state_rd(DFX_board_t *bp) in dfx_hw_adap_state_rd() argument
2870 dfx_port_read_long(bp, PI_PDQ_K_REG_PORT_STATUS, &port_status); in dfx_hw_adap_state_rd()
2906 static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type) in dfx_hw_dma_uninit() argument
2912 dfx_hw_adap_reset(bp, type); in dfx_hw_dma_uninit()
2918 if (dfx_hw_adap_state_rd(bp) == PI_STATE_K_DMA_UNAVAIL) in dfx_hw_dma_uninit()
2978 static int dfx_rcv_init(DFX_board_t *bp, int get_buffers) in dfx_rcv_init() argument
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()
3018 dma_addr = dma_map_single(bp->bus_dev, in dfx_rcv_init()
3022 if (dma_mapping_error(bp->bus_dev, dma_addr)) { 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()
3046bp->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()
3093 DFX_board_t *bp in dfx_rcv_queue_process() argument
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()
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()
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()
3296 DFX_board_t *bp = netdev_priv(dev); in dfx_xmt_queue_pkt() local
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()
3337 if (dfx_hw_adap_state_rd(bp) == PI_STATE_K_LINK_AVAIL) /* is link really available? */ 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()
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()
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()
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()
3490 static int dfx_xmt_done(DFX_board_t *bp) in dfx_xmt_done() argument
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()
3530 bp->rcv_xmt_reg.index.xmt_comp += 1; in dfx_xmt_done()
3564 static void dfx_rcv_flush( DFX_board_t *bp ) in dfx_rcv_flush() argument
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()
3622 static void dfx_xmt_flush( DFX_board_t *bp ) in dfx_xmt_flush() argument
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()
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()
3698 DFX_board_t *bp = netdev_priv(dev); in dfx_unregister() local
3709 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_unregister()
3713 if (bp->kmalloced) in dfx_unregister()
3715 bp->kmalloced, bp->kmalloced_dma); in dfx_unregister()
3719 dfx_get_bars(bp, bar_start, bar_len); in dfx_unregister()
3725 iounmap(bp->base.mem); in dfx_unregister()