Lines Matching full:packet
127 /* Number of bytes in NL packet header (cannot do
131 /* Number of bytes in NL packet header (cannot do
155 /* Network packet header of the first packet (a special case) */
157 /* Network packet header of the following packets (if any) */
159 /* Complete network packet (header + data) */
239 /* Flag if hw is ready to send next packet */
291 * Packet info structure for tx packets.
305 /* Count of packet fragments, starting at 0 */
308 /* Called after packet is sent and before is freed */
459 static void do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet) in do_send_packet() argument
462 unsigned short data_left = packet->length - packet->offset; in do_send_packet()
467 (packet->fragment_count == 0) 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()
482 /* First packet? */ in do_send_packet()
483 if (packet->fragment_count == 0) { in do_send_packet()
485 pkt.hdr_first.length_lsb = (unsigned char) packet->length; in do_send_packet()
487 (unsigned char) (packet->length >> 8); in do_send_packet()
491 ((unsigned char *) packet) + sizeof(struct ipw_tx_packet) + 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()
496 /* Last packet? (May also be first packet.) */ in do_send_packet()
497 if (packet->offset == packet->length) 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()
510 list_add(&packet->queue, &hw->tx_queue[0]); 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()
517 kfree(packet); in do_send_packet()
548 * If 'packet' is NULL, then this function allocates a new packet, setting its
551 * If 'packet' is not NULL, then this function enlarges it if it doesn't
556 struct ipw_rx_packet *packet, in pool_allocate() argument
560 if (!packet) { in pool_allocate()
565 packet = list_first_entry(&hw->rx_pool, in pool_allocate()
569 list_del(&packet->queue); in pool_allocate()
580 packet = kmalloc(sizeof(struct ipw_rx_packet) in pool_allocate()
582 if (!packet) 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()
590 struct ipw_rx_packet *old_packet = packet; in pool_allocate()
592 packet = kmalloc(sizeof(struct ipw_rx_packet) + in pool_allocate()
595 if (!packet) { in pool_allocate()
599 memcpy(packet, old_packet, in pool_allocate()
602 packet->capacity = old_packet->length + minimum_free_space; in pool_allocate()
606 return packet; in pool_allocate()
609 static void pool_free(struct ipw_hardware *hw, struct ipw_rx_packet *packet) in pool_free() argument
612 kfree(packet); in pool_free()
615 list_add(&packet->queue, &hw->rx_pool); in pool_free()
626 struct ipw_rx_packet *packet = NULL; in queue_received_packet() local
629 /* Discard packet if channel index is out of range. */ in queue_received_packet()
632 ": data packet has bad address %u\n", address); in queue_received_packet()
644 * Create a new packet, or assembler already contains one in queue_received_packet()
650 ": no memory for incoming data packet, dropped!\n"); in queue_received_packet()
656 /* Append this packet data onto existing data. */ in queue_received_packet()
662 packet = *assem; in queue_received_packet()
666 hw->rx_bytes_queued += packet->length; in queue_received_packet()
670 /* If it's a CTRL packet, don't assemble, just queue it. */ in queue_received_packet()
671 packet = pool_allocate(hw, NULL, length); in queue_received_packet()
672 if (!packet) { in queue_received_packet()
674 ": no memory for incoming ctrl packet, dropped!\n"); in queue_received_packet()
677 packet->protocol = protocol; in queue_received_packet()
678 packet->channel_idx = channel_idx; in queue_received_packet()
679 memcpy((unsigned char *)packet + sizeof(struct ipw_rx_packet), in queue_received_packet()
681 packet->length = length; in queue_received_packet()
685 * If this is the last packet, then send the assembled packet on to the in queue_received_packet()
688 if (packet) { in queue_received_packet()
690 list_add_tail(&packet->queue, &hw->rx_queue); in queue_received_packet()
711 struct ipw_rx_packet *packet = in ipw_receive_data_work() local
717 list_del(&packet->queue); in ipw_receive_data_work()
724 if (packet->protocol == TL_PROTOCOLID_COM_DATA) { in ipw_receive_data_work()
734 packet->channel_idx, in ipw_receive_data_work()
735 (unsigned char *)packet in ipw_receive_data_work()
737 packet->length); 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()
748 (unsigned char *)packet in ipw_receive_data_work()
750 packet->length); in ipw_receive_data_work()
752 pool_free(hw, packet); in ipw_receive_data_work()
775 ": control packet was %d bytes - wrong size!\n", in handle_received_CTRL_packet()
812 const union nl_packet *packet, in handle_received_packet() argument
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()
852 * Retrieve a packet from the IPW hardware.
866 ": received a packet of %u bytes - longer than the MTU!\n", len); in do_receive_packet()
882 ": received a packet of %u bytes - longer than the MTU!\n", len); in do_receive_packet()
950 * Send pending packet up to given priority, prioritize SETUP data until
963 struct ipw_tx_packet *packet = NULL; in send_pending_packet() local
965 /* Pick a packet */ in send_pending_packet()
968 packet = list_first_entry( in send_pending_packet()
974 list_del(&packet->queue); in send_pending_packet()
979 if (!packet) { in send_pending_packet()
988 do_send_packet(hw, packet); in send_pending_packet()
1238 struct ipw_tx_packet *packet) in send_packet() argument
1243 list_add_tail(&packet->queue, &hw->tx_queue[priority]); in send_packet()
1250 /* Create data packet, non-atomic allocation */
1255 struct ipw_tx_packet *packet = kzalloc( in alloc_data_packet() local
1259 if (!packet) in alloc_data_packet()
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()
1267 return packet; in alloc_data_packet()
1280 struct ipw_control_packet *packet = kzalloc(header_size, GFP_ATOMIC); in alloc_ctrl_packet() local
1282 if (!packet) in alloc_ctrl_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()
1291 return packet; in alloc_ctrl_packet()
1299 struct ipw_tx_packet *packet; in ipwireless_send_packet() local
1301 packet = alloc_data_packet(length, (channel_idx + 1), in ipwireless_send_packet()
1303 if (!packet) in ipwireless_send_packet()
1305 packet->packet_callback = callback; in ipwireless_send_packet()
1306 packet->callback_data = callback_data; in ipwireless_send_packet()
1307 memcpy((unsigned char *) packet + sizeof(struct ipw_tx_packet), data, in ipwireless_send_packet()
1310 send_packet(hw, PRIO_DATA, packet); in ipwireless_send_packet()
1317 struct ipw_control_packet *packet; in set_control_line() local
1323 packet = alloc_ctrl_packet(sizeof(struct ipw_control_packet), in set_control_line()
1325 if (!packet) 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()
1408 /* generate config packet */ in __handle_setup_get_version_rsp()
1433 /* generate open packet */ in __handle_setup_get_version_rsp()
1492 ": not enough memory to alloc control packet\n"); in __handle_setup_get_version_rsp()
1538 ": setup packet has bad address %d\n", address); in handle_received_SETUP_packet()
1570 struct ipw_setup_reboot_msg_ack *packet; in handle_received_SETUP_packet() local
1574 packet = alloc_ctrl_packet( in handle_received_SETUP_packet()
1578 if (!packet) { in handle_received_SETUP_packet()
1580 ": Not enough memory to send reboot packet"); 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()