Lines Matching +full:queue +full:- +full:pkt +full:- +full:tx
1 // SPDX-License-Identifier: GPL-2.0
13 * Copyright (C) 2006-2007 Jiri Kosina
60 timing_stats.read_time += (jiffies - start_time); in end_read_timing()
67 timing_stats.write_time += (jiffies - start_time); in end_write_timing()
74 unsigned long since = jiffies - timing_stats.last_report_time; in report_timing()
83 ": %u us elapsed - read %lu bytes in %u us, wrote %lu bytes in %u us\n", in report_timing()
163 #define HW_VERSION_UNKNOWN -1
175 #define IOTXR 0x0E /* Tx Fifo Register (Embedded to Host) */
205 unsigned short memreg_tx_old; /* TX Register (R/W) */
258 * a non-zero serial number (indicating the new firmware). Thereafter,
259 * the driver can safely ignore the Timer Recovery re-sends to avoid
260 * out-of-sync problems.
265 /* True if we are to send the set-up data to the hardware. */
291 * Packet info structure for tx packets.
295 struct list_head queue; member
336 struct list_head queue; member
350 if (hdr->packet_rank & NL_FIRST_PACKET) { in data_type()
351 switch (hdr->protocol) { in data_type()
411 BUG_ON(length > hw->ll_mtu); in do_send_fragment()
416 spin_lock_irqsave(&hw->lock, flags); in do_send_fragment()
418 hw->tx_ready = 0; in do_send_fragment()
421 if (hw->hw_version == HW_VERSION_1) { in do_send_fragment()
422 outw((unsigned short) length, hw->base_port + IODWR); in do_send_fragment()
431 outw(raw_data, hw->base_port + IODWR); in do_send_fragment()
434 outw(DCR_TXDONE, hw->base_port + IODCR); in do_send_fragment()
435 } else if (hw->hw_version == HW_VERSION_2) { in do_send_fragment()
436 outw((unsigned short) length, hw->base_port); in do_send_fragment()
445 outw(raw_data, hw->base_port); in do_send_fragment()
448 outw((unsigned short) 0xDEAD, hw->base_port); in do_send_fragment()
451 writew(MEMRX_RX, &hw->memory_info_regs->memreg_rx); in do_send_fragment()
454 spin_unlock_irqrestore(&hw->lock, flags); in do_send_fragment()
462 unsigned short data_left = packet->length - packet->offset; in do_send_packet()
464 union nl_packet pkt; in do_send_packet() local
467 (packet->fragment_count == 0) in do_send_packet()
470 fragment_data_len = hw->ll_mtu - header_size; in do_send_packet()
478 pkt.hdr_first.protocol = packet->protocol; in do_send_packet()
479 pkt.hdr_first.address = packet->dest_addr; in do_send_packet()
480 pkt.hdr_first.packet_rank = 0; in do_send_packet()
483 if (packet->fragment_count == 0) { in do_send_packet()
484 pkt.hdr_first.packet_rank |= NL_FIRST_PACKET; in do_send_packet()
485 pkt.hdr_first.length_lsb = (unsigned char) packet->length; in do_send_packet()
486 pkt.hdr_first.length_msb = in do_send_packet()
487 (unsigned char) (packet->length >> 8); in do_send_packet()
490 memcpy(pkt.rawpkt + header_size, in do_send_packet()
492 packet->offset, fragment_data_len); in do_send_packet()
493 packet->offset += fragment_data_len; in do_send_packet()
494 packet->fragment_count++; in do_send_packet()
497 if (packet->offset == packet->length) in do_send_packet()
498 pkt.hdr_first.packet_rank |= NL_LAST_PACKET; in do_send_packet()
499 do_send_fragment(hw, pkt.rawpkt, header_size + fragment_data_len); in do_send_packet()
501 /* If this packet has unsent data, then re-queue it. */ in do_send_packet()
502 if (packet->offset < packet->length) { in do_send_packet()
504 * Re-queue it at the head of the highest priority queue so in do_send_packet()
509 spin_lock_irqsave(&hw->lock, flags); in do_send_packet()
510 list_add(&packet->queue, &hw->tx_queue[0]); in do_send_packet()
511 hw->tx_queued++; in do_send_packet()
512 spin_unlock_irqrestore(&hw->lock, flags); in do_send_packet()
514 if (packet->packet_callback) in do_send_packet()
515 packet->packet_callback(packet->callback_data, in do_send_packet()
516 packet->length); in do_send_packet()
525 spin_lock_irqsave(&hw->lock, flags); in ipw_setup_hardware()
526 if (hw->hw_version == HW_VERSION_1) { in ipw_setup_hardware()
528 outw(DCR_RXRESET, hw->base_port + IODCR); in ipw_setup_hardware()
529 /* SB: Reset TX FIFO */ in ipw_setup_hardware()
530 outw(DCR_TXRESET, hw->base_port + IODCR); in ipw_setup_hardware()
532 /* Enable TX and RX interrupts. */ in ipw_setup_hardware()
533 outw(IER_TXENABLED | IER_RXENABLED, hw->base_port + IOIER); in ipw_setup_hardware()
539 unsigned short csr = readw(&hw->memregs_CCR->reg_config_and_status); in ipw_setup_hardware()
542 writew(csr, &hw->memregs_CCR->reg_config_and_status); in ipw_setup_hardware()
544 spin_unlock_irqrestore(&hw->lock, flags); in ipw_setup_hardware()
563 spin_lock_irqsave(&hw->lock, flags); in pool_allocate()
564 if (!list_empty(&hw->rx_pool)) { in pool_allocate()
565 packet = list_first_entry(&hw->rx_pool, in pool_allocate()
566 struct ipw_rx_packet, queue); in pool_allocate()
567 hw->rx_pool_size--; in pool_allocate()
568 spin_unlock_irqrestore(&hw->lock, flags); in pool_allocate()
569 list_del(&packet->queue); in pool_allocate()
572 ipwireless_ppp_mru(hw->network) + 2; in pool_allocate()
575 spin_unlock_irqrestore(&hw->lock, flags); in pool_allocate()
584 packet->capacity = new_capacity; in pool_allocate()
586 packet->length = 0; in pool_allocate()
589 if (packet->length + minimum_free_space > packet->capacity) { in pool_allocate()
593 old_packet->length + minimum_free_space, in pool_allocate()
601 + old_packet->length); in pool_allocate()
602 packet->capacity = old_packet->length + minimum_free_space; in pool_allocate()
611 if (hw->rx_pool_size > 6) in pool_free()
614 hw->rx_pool_size++; in pool_free()
615 list_add(&packet->queue, &hw->rx_pool); in pool_free()
625 unsigned int channel_idx = address - 1; in queue_received_packet()
637 * ->packet_assembler is safe to touch unlocked, this is the only place in queue_received_packet()
641 &hw->packet_assembler[channel_idx]; in queue_received_packet()
653 (*assem)->protocol = protocol; in queue_received_packet()
654 (*assem)->channel_idx = channel_idx; in queue_received_packet()
659 + (*assem)->length, data, length); in queue_received_packet()
660 (*assem)->length += length; in queue_received_packet()
665 spin_lock_irqsave(&hw->lock, flags); in queue_received_packet()
666 hw->rx_bytes_queued += packet->length; in queue_received_packet()
667 spin_unlock_irqrestore(&hw->lock, flags); in queue_received_packet()
670 /* If it's a CTRL packet, don't assemble, just queue it. */ in queue_received_packet()
677 packet->protocol = protocol; in queue_received_packet()
678 packet->channel_idx = channel_idx; in queue_received_packet()
681 packet->length = length; in queue_received_packet()
689 spin_lock_irqsave(&hw->lock, flags); in queue_received_packet()
690 list_add_tail(&packet->queue, &hw->rx_queue); in queue_received_packet()
691 /* Block reception of incoming packets if queue is full. */ in queue_received_packet()
692 hw->blocking_rx = in queue_received_packet()
693 (hw->rx_bytes_queued >= IPWIRELESS_RX_QUEUE_SIZE); in queue_received_packet()
695 spin_unlock_irqrestore(&hw->lock, flags); in queue_received_packet()
696 schedule_work(&hw->work_rx); in queue_received_packet()
709 spin_lock_irqsave(&hw->lock, flags); in ipw_receive_data_work()
710 while (!list_empty(&hw->rx_queue)) { in ipw_receive_data_work()
712 list_first_entry(&hw->rx_queue, in ipw_receive_data_work()
713 struct ipw_rx_packet, queue); in ipw_receive_data_work()
715 if (hw->shutting_down) in ipw_receive_data_work()
717 list_del(&packet->queue); in ipw_receive_data_work()
724 if (packet->protocol == TL_PROTOCOLID_COM_DATA) { in ipw_receive_data_work()
725 if (hw->network != NULL) { in ipw_receive_data_work()
727 spin_unlock_irqrestore(&hw->lock, flags); in ipw_receive_data_work()
733 hw->network, in ipw_receive_data_work()
734 packet->channel_idx, in ipw_receive_data_work()
737 packet->length); in ipw_receive_data_work()
738 spin_lock_irqsave(&hw->lock, flags); in ipw_receive_data_work()
741 hw->rx_bytes_queued -= packet->length; in ipw_receive_data_work()
747 handle_received_CTRL_packet(hw, packet->channel_idx, in ipw_receive_data_work()
750 packet->length); in ipw_receive_data_work()
754 * Unblock reception of incoming packets if queue is no longer in ipw_receive_data_work()
757 hw->blocking_rx = in ipw_receive_data_work()
758 hw->rx_bytes_queued >= IPWIRELESS_RX_QUEUE_SIZE; in ipw_receive_data_work()
759 if (hw->shutting_down) in ipw_receive_data_work()
762 spin_unlock_irqrestore(&hw->lock, flags); in ipw_receive_data_work()
775 ": control packet was %d bytes - wrong size!\n", in handle_received_CTRL_packet()
780 switch (body->sig_no) { in handle_received_CTRL_packet()
798 if (body->value) in handle_received_CTRL_packet()
799 hw->control_lines[channel_idx] |= changed_mask; in handle_received_CTRL_packet()
801 hw->control_lines[channel_idx] &= ~changed_mask; in handle_received_CTRL_packet()
802 if (hw->network) in handle_received_CTRL_packet()
804 hw->network, in handle_received_CTRL_packet()
806 hw->control_lines[channel_idx], in handle_received_CTRL_packet()
815 unsigned int protocol = packet->hdr.protocol; in handle_received_packet()
816 unsigned int address = packet->hdr.address; in handle_received_packet()
820 int is_last = packet->hdr.packet_rank & NL_LAST_PACKET; in handle_received_packet()
822 if (packet->hdr.packet_rank & NL_FIRST_PACKET) in handle_received_packet()
827 data = packet->rawpkt + header_length; in handle_received_packet()
828 data_len = len - header_length; in handle_received_packet()
844 if (hw->hw_version == HW_VERSION_1) in acknowledge_data_read()
845 outw(DCR_RXDONE, hw->base_port + IODCR); in acknowledge_data_read()
848 &hw->memory_info_regs->memreg_pc_interrupt_ack); in acknowledge_data_read()
858 unsigned char pkt[LL_MTU_MAX]; in do_receive_packet() local
862 if (hw->hw_version == HW_VERSION_1) { in do_receive_packet()
863 len = inw(hw->base_port + IODRR); in do_receive_packet()
864 if (len > hw->ll_mtu) { in do_receive_packet()
866 ": received a packet of %u bytes - longer than the MTU!\n", len); in do_receive_packet()
867 outw(DCR_RXDONE | DCR_RXRESET, hw->base_port + IODCR); in do_receive_packet()
872 __le16 raw_data = inw(hw->base_port + IODRR); in do_receive_packet()
875 pkt[i] = (unsigned char) data; in do_receive_packet()
876 pkt[i + 1] = (unsigned char) (data >> 8); in do_receive_packet()
879 len = inw(hw->base_port); in do_receive_packet()
880 if (len > hw->ll_mtu) { in do_receive_packet()
882 ": received a packet of %u bytes - longer than the MTU!\n", len); in do_receive_packet()
884 &hw->memory_info_regs->memreg_pc_interrupt_ack); in do_receive_packet()
889 __le16 raw_data = inw(hw->base_port); in do_receive_packet()
892 pkt[i] = (unsigned char) data; in do_receive_packet()
893 pkt[i + 1] = (unsigned char) (data >> 8); in do_receive_packet()
897 inw(hw->base_port); in do_receive_packet()
904 swap_packet_bitfield_from_le(pkt); in do_receive_packet()
907 dump_data_bytes("recv", pkt, len); in do_receive_packet()
909 handle_received_packet(hw, (union nl_packet *) pkt, len); in do_receive_packet()
919 * hardware initialization - any of its stuff will simply be queued in get_current_packet_priority()
922 return (hw->to_setup || hw->initializing in get_current_packet_priority()
934 spin_lock_irqsave(&hw->lock, flags); in get_packets_from_hw()
935 while (hw->rx_ready && !hw->blocking_rx) { in get_packets_from_hw()
937 hw->rx_ready--; in get_packets_from_hw()
938 spin_unlock_irqrestore(&hw->lock, flags); in get_packets_from_hw()
942 spin_lock_irqsave(&hw->lock, flags); in get_packets_from_hw()
944 spin_unlock_irqrestore(&hw->lock, flags); in get_packets_from_hw()
960 spin_lock_irqsave(&hw->lock, flags); in send_pending_packet()
961 if (hw->tx_queued && hw->tx_ready) { in send_pending_packet()
967 if (!list_empty(&hw->tx_queue[priority])) { in send_pending_packet()
969 &hw->tx_queue[priority], in send_pending_packet()
971 queue); in send_pending_packet()
973 hw->tx_queued--; in send_pending_packet()
974 list_del(&packet->queue); in send_pending_packet()
980 hw->tx_queued = 0; in send_pending_packet()
981 spin_unlock_irqrestore(&hw->lock, flags); in send_pending_packet()
985 spin_unlock_irqrestore(&hw->lock, flags); in send_pending_packet()
991 spin_lock_irqsave(&hw->lock, flags); in send_pending_packet()
993 if (!list_empty(&hw->tx_queue[priority])) { in send_pending_packet()
999 hw->tx_queued = 0; in send_pending_packet()
1001 spin_unlock_irqrestore(&hw->lock, flags); in send_pending_packet()
1014 spin_lock_irqsave(&hw->lock, flags); in ipwireless_do_tasklet()
1015 if (hw->shutting_down) { in ipwireless_do_tasklet()
1016 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_do_tasklet()
1020 if (hw->to_setup == 1) { in ipwireless_do_tasklet()
1024 hw->to_setup = 2; in ipwireless_do_tasklet()
1025 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_do_tasklet()
1036 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_do_tasklet()
1050 if (hw->hw_version == HW_VERSION_1) in is_card_present()
1051 return inw(hw->base_port + IOIR) != 0xFFFF; in is_card_present()
1053 return readl(&hw->memory_info_regs->memreg_card_present) == in is_card_present()
1062 irqn = inw(hw->base_port + IOIR); in ipwireless_handle_v1_interrupt()
1074 spin_lock_irqsave(&hw->lock, flags); in ipwireless_handle_v1_interrupt()
1075 hw->tx_ready = 1; in ipwireless_handle_v1_interrupt()
1076 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_handle_v1_interrupt()
1081 spin_lock_irqsave(&hw->lock, flags); in ipwireless_handle_v1_interrupt()
1082 hw->rx_ready++; in ipwireless_handle_v1_interrupt()
1083 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_handle_v1_interrupt()
1086 outw(ack, hw->base_port + IOIR); in ipwireless_handle_v1_interrupt()
1087 tasklet_schedule(&hw->tasklet); in ipwireless_handle_v1_interrupt()
1096 unsigned short csr = readw(&hw->memregs_CCR->reg_config_and_status); in acknowledge_pcmcia_interrupt()
1099 writew(csr, &hw->memregs_CCR->reg_config_and_status); in acknowledge_pcmcia_interrupt()
1105 int tx = 0; in ipwireless_handle_v2_v3_interrupt() local
1113 unsigned short memtx = readw(hw->memreg_tx); in ipwireless_handle_v2_v3_interrupt()
1116 readw(&hw->memory_info_regs->memreg_rx_done); in ipwireless_handle_v2_v3_interrupt()
1124 if (hw->memreg_tx == &hw->memory_info_regs->memreg_tx_new) { in ipwireless_handle_v2_v3_interrupt()
1125 memtx = readw(&hw->memory_info_regs->memreg_tx_old); in ipwireless_handle_v2_v3_interrupt()
1129 hw->memreg_tx = in ipwireless_handle_v2_v3_interrupt()
1130 &hw->memory_info_regs->memreg_tx_old; in ipwireless_handle_v2_v3_interrupt()
1149 writew(memtx_serial, hw->memreg_tx); in ipwireless_handle_v2_v3_interrupt()
1151 if (hw->serial_number_detected) { in ipwireless_handle_v2_v3_interrupt()
1152 if (memtx_serial != hw->last_memtx_serial) { in ipwireless_handle_v2_v3_interrupt()
1153 hw->last_memtx_serial = memtx_serial; in ipwireless_handle_v2_v3_interrupt()
1154 spin_lock_irqsave(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1155 hw->rx_ready++; in ipwireless_handle_v2_v3_interrupt()
1156 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1163 * If a non-zero serial number is seen, then enable in ipwireless_handle_v2_v3_interrupt()
1167 hw->serial_number_detected = 1; in ipwireless_handle_v2_v3_interrupt()
1171 spin_lock_irqsave(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1172 hw->rx_ready++; in ipwireless_handle_v2_v3_interrupt()
1173 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1179 writew(0, &hw->memory_info_regs->memreg_rx_done); in ipwireless_handle_v2_v3_interrupt()
1180 spin_lock_irqsave(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1181 hw->tx_ready = 1; in ipwireless_handle_v2_v3_interrupt()
1182 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_handle_v2_v3_interrupt()
1183 tx = 1; in ipwireless_handle_v2_v3_interrupt()
1185 if (tx) in ipwireless_handle_v2_v3_interrupt()
1187 &hw->memory_info_regs->memreg_pc_interrupt_ack); in ipwireless_handle_v2_v3_interrupt()
1191 if (tx || rx) in ipwireless_handle_v2_v3_interrupt()
1192 tasklet_schedule(&hw->tasklet); in ipwireless_handle_v2_v3_interrupt()
1194 if (hw->memreg_tx == &hw->memory_info_regs->memreg_tx_new) { in ipwireless_handle_v2_v3_interrupt()
1195 if (hw->serial_number_detected) in ipwireless_handle_v2_v3_interrupt()
1197 ": spurious interrupt - new_tx mode\n"); in ipwireless_handle_v2_v3_interrupt()
1200 ": no valid memreg_tx value - switching to the old memreg_tx\n"); in ipwireless_handle_v2_v3_interrupt()
1201 hw->memreg_tx = in ipwireless_handle_v2_v3_interrupt()
1202 &hw->memory_info_regs->memreg_tx_old; in ipwireless_handle_v2_v3_interrupt()
1207 ": spurious interrupt - old_tx mode\n"); in ipwireless_handle_v2_v3_interrupt()
1219 if (ipw->hardware->hw_version == HW_VERSION_1) in ipwireless_interrupt()
1220 return ipwireless_handle_v1_interrupt(irq, ipw->hardware); in ipwireless_interrupt()
1222 return ipwireless_handle_v2_v3_interrupt(irq, ipw->hardware); in ipwireless_interrupt()
1230 spin_lock_irqsave(&hw->lock, flags); in flush_packets_to_hw()
1232 spin_unlock_irqrestore(&hw->lock, flags); in flush_packets_to_hw()
1242 spin_lock_irqsave(&hw->lock, flags); in send_packet()
1243 list_add_tail(&packet->queue, &hw->tx_queue[priority]); in send_packet()
1244 hw->tx_queued++; in send_packet()
1245 spin_unlock_irqrestore(&hw->lock, flags); in send_packet()
1250 /* Create data packet, non-atomic allocation */
1262 INIT_LIST_HEAD(&packet->queue); in alloc_data_packet()
1263 packet->dest_addr = dest_addr; in alloc_data_packet()
1264 packet->protocol = protocol; in alloc_data_packet()
1265 packet->length = data_size; in alloc_data_packet()
1285 INIT_LIST_HEAD(&packet->header.queue); in alloc_ctrl_packet()
1286 packet->header.dest_addr = dest_addr; in alloc_ctrl_packet()
1287 packet->header.protocol = protocol; in alloc_ctrl_packet()
1288 packet->header.length = header_size - sizeof(struct ipw_tx_packet); in alloc_ctrl_packet()
1289 packet->body.sig_no = sig_no; in alloc_ctrl_packet()
1304 return -ENOMEM; in ipwireless_send_packet()
1305 packet->packet_callback = callback; in ipwireless_send_packet()
1306 packet->callback_data = callback_data; in ipwireless_send_packet()
1326 return -ENOMEM; in set_control_line()
1327 packet->header.length = sizeof(struct ipw_control_packet_body); in set_control_line()
1328 packet->body.value = (state == 0 ? 0 : 1); in set_control_line()
1329 send_packet(hw, prio, &packet->header); in set_control_line()
1338 hw->control_lines[channel_idx] |= IPW_CONTROL_LINE_DTR; in set_DTR()
1340 hw->control_lines[channel_idx] &= ~IPW_CONTROL_LINE_DTR; in set_DTR()
1349 hw->control_lines[channel_idx] |= IPW_CONTROL_LINE_RTS; in set_RTS()
1351 hw->control_lines[channel_idx] &= ~IPW_CONTROL_LINE_RTS; in set_RTS()
1417 config_packet->header.length = sizeof(struct tl_setup_config_msg); in __handle_setup_get_version_rsp()
1418 config_packet->body.port_no = port; in __handle_setup_get_version_rsp()
1419 config_packet->body.prio_data = PRIO_DATA; in __handle_setup_get_version_rsp()
1420 config_packet->body.prio_ctrl = PRIO_CTRL; in __handle_setup_get_version_rsp()
1421 send_packet(hw, PRIO_SETUP, &config_packet->header); in __handle_setup_get_version_rsp()
1430 config_done_packet->header.length = sizeof(struct tl_setup_config_done_msg); in __handle_setup_get_version_rsp()
1431 send_packet(hw, PRIO_SETUP, &config_done_packet->header); in __handle_setup_get_version_rsp()
1442 open_packet->header.length = sizeof(struct tl_setup_open_msg); in __handle_setup_get_version_rsp()
1443 open_packet->body.port_no = port; in __handle_setup_get_version_rsp()
1444 send_packet(hw, PRIO_SETUP, &open_packet->header); in __handle_setup_get_version_rsp()
1451 (hw->control_lines[channel_idx] & in __handle_setup_get_version_rsp()
1460 (hw->control_lines [channel_idx] & in __handle_setup_get_version_rsp()
1471 * from async -> sync PPP. in __handle_setup_get_version_rsp()
1479 info_packet->header.length = sizeof(struct tl_setup_info_msg); in __handle_setup_get_version_rsp()
1480 info_packet->body.driver_type = NDISWAN_DRIVER; in __handle_setup_get_version_rsp()
1481 info_packet->body.major_version = NDISWAN_DRIVER_MAJOR_VERSION; in __handle_setup_get_version_rsp()
1482 info_packet->body.minor_version = NDISWAN_DRIVER_MINOR_VERSION; in __handle_setup_get_version_rsp()
1483 send_packet(hw, PRIO_SETUP, &info_packet->header); in __handle_setup_get_version_rsp()
1486 hw->to_setup = 0; in __handle_setup_get_version_rsp()
1493 hw->to_setup = -1; in __handle_setup_get_version_rsp()
1499 del_timer(&hw->setup_timer); in handle_setup_get_version_rsp()
1500 hw->initializing = 0; in handle_setup_get_version_rsp()
1521 ver_packet->header.length = sizeof(struct tl_setup_get_version_qry); in ipw_send_setup_packet()
1526 send_packet(hw, PRIO_SETUP, &ver_packet->header); in ipw_send_setup_packet()
1542 switch (rx_msg->sig_no) { in handle_received_SETUP_packet()
1544 if (hw->to_setup) in handle_received_SETUP_packet()
1546 rx_msg->version_rsp_msg.version); in handle_received_SETUP_packet()
1551 unsigned int channel_idx = rx_msg->open_msg.port_no - 1; in handle_received_SETUP_packet()
1566 if (hw->to_setup) in handle_received_SETUP_packet()
1568 ": Setup not completed - ignoring reboot msg\n"); in handle_received_SETUP_packet()
1583 packet->header.length = in handle_received_SETUP_packet()
1585 send_packet(hw, PRIO_SETUP, &packet->header); in handle_received_SETUP_packet()
1586 if (hw->reboot_callback) in handle_received_SETUP_packet()
1587 hw->reboot_callback(hw->reboot_callback_data); in handle_received_SETUP_packet()
1594 (unsigned int) rx_msg->sig_no); in handle_received_SETUP_packet()
1602 if (hw->hw_version == HW_VERSION_1) { in do_close_hardware()
1603 /* Disable TX and RX interrupts. */ in do_close_hardware()
1604 outw(0, hw->base_port + IOIER); in do_close_hardware()
1607 irqn = inw(hw->base_port + IOIR); in do_close_hardware()
1609 outw(IR_TXINTR, hw->base_port + IOIR); in do_close_hardware()
1611 outw(IR_RXINTR, hw->base_port + IOIR); in do_close_hardware()
1613 synchronize_irq(hw->irq); in do_close_hardware()
1626 hw->irq = -1; in ipwireless_hardware_create()
1627 hw->initializing = 1; in ipwireless_hardware_create()
1628 hw->tx_ready = 1; in ipwireless_hardware_create()
1629 hw->rx_bytes_queued = 0; in ipwireless_hardware_create()
1630 hw->rx_pool_size = 0; in ipwireless_hardware_create()
1631 hw->last_memtx_serial = (unsigned short) 0xffff; in ipwireless_hardware_create()
1633 INIT_LIST_HEAD(&hw->tx_queue[i]); in ipwireless_hardware_create()
1635 INIT_LIST_HEAD(&hw->rx_queue); in ipwireless_hardware_create()
1636 INIT_LIST_HEAD(&hw->rx_pool); in ipwireless_hardware_create()
1637 spin_lock_init(&hw->lock); in ipwireless_hardware_create()
1638 tasklet_setup(&hw->tasklet, ipwireless_do_tasklet); in ipwireless_hardware_create()
1639 INIT_WORK(&hw->work_rx, ipw_receive_data_work); in ipwireless_hardware_create()
1640 timer_setup(&hw->setup_timer, ipwireless_setup_timer, 0); in ipwireless_hardware_create()
1653 if (hw->removed) { in ipwireless_init_hardware_v1()
1654 hw->removed = 0; in ipwireless_init_hardware_v1()
1655 enable_irq(hw->irq); in ipwireless_init_hardware_v1()
1657 hw->base_port = base_port; in ipwireless_init_hardware_v1()
1658 hw->hw_version = (is_v2_card ? HW_VERSION_2 : HW_VERSION_1); in ipwireless_init_hardware_v1()
1659 hw->ll_mtu = (hw->hw_version == HW_VERSION_1 ? LL_MTU_V1 : LL_MTU_V2); in ipwireless_init_hardware_v1()
1660 hw->memregs_CCR = (struct MEMCCR __iomem *) in ipwireless_init_hardware_v1()
1662 hw->memory_info_regs = (struct MEMINFREG __iomem *) common_memory; in ipwireless_init_hardware_v1()
1663 hw->memreg_tx = &hw->memory_info_regs->memreg_tx_new; in ipwireless_init_hardware_v1()
1664 hw->reboot_callback = reboot_callback; in ipwireless_init_hardware_v1()
1665 hw->reboot_callback_data = reboot_callback_data; in ipwireless_init_hardware_v1()
1670 hw->initializing = 1; in ipwireless_init_hardware_v2_v3()
1671 hw->init_loops = 0; in ipwireless_init_hardware_v2_v3()
1674 ipwireless_setup_timer(&hw->setup_timer); in ipwireless_init_hardware_v2_v3()
1681 hw->init_loops++; in ipwireless_setup_timer()
1683 if (hw->init_loops == TL_SETUP_MAX_VERSION_QRY && in ipwireless_setup_timer()
1684 hw->hw_version == HW_VERSION_2 && in ipwireless_setup_timer()
1685 hw->memreg_tx == &hw->memory_info_regs->memreg_tx_new) { in ipwireless_setup_timer()
1687 ": failed to startup using TX2, trying TX\n"); in ipwireless_setup_timer()
1689 hw->memreg_tx = &hw->memory_info_regs->memreg_tx_old; in ipwireless_setup_timer()
1690 hw->init_loops = 0; in ipwireless_setup_timer()
1693 if (hw->init_loops == TL_SETUP_MAX_VERSION_QRY) { in ipwireless_setup_timer()
1696 hw->initializing = 0; in ipwireless_setup_timer()
1702 spin_lock_irqsave(&hw->lock, flags); in ipwireless_setup_timer()
1703 hw->to_setup = 1; in ipwireless_setup_timer()
1704 hw->tx_ready = 1; in ipwireless_setup_timer()
1705 spin_unlock_irqrestore(&hw->lock, flags); in ipwireless_setup_timer()
1706 tasklet_schedule(&hw->tasklet); in ipwireless_setup_timer()
1709 mod_timer(&hw->setup_timer, in ipwireless_setup_timer()
1721 if (!hw->shutting_down) { in ipwireless_stop_interrupts()
1723 hw->shutting_down = 1; in ipwireless_stop_interrupts()
1724 del_timer(&hw->setup_timer); in ipwireless_stop_interrupts()
1739 flush_work(&hw->work_rx); in ipwireless_hardware_free()
1742 kfree(hw->packet_assembler[i]); in ipwireless_hardware_free()
1745 list_for_each_entry_safe(tp, tq, &hw->tx_queue[i], queue) { in ipwireless_hardware_free()
1746 list_del(&tp->queue); in ipwireless_hardware_free()
1750 list_for_each_entry_safe(rp, rq, &hw->rx_queue, queue) { in ipwireless_hardware_free()
1751 list_del(&rp->queue); in ipwireless_hardware_free()
1755 list_for_each_entry_safe(rp, rq, &hw->rx_pool, queue) { in ipwireless_hardware_free()
1756 list_del(&rp->queue); in ipwireless_hardware_free()
1769 hw->network = network; in ipwireless_associate_network()