Lines Matching defs: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 */
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)
462 unsigned short data_left = packet->length - packet->offset;
467 (packet->fragment_count == 0)
478 pkt.hdr_first.protocol = packet->protocol;
479 pkt.hdr_first.address = packet->dest_addr;
482 /* First packet? */
483 if (packet->fragment_count == 0) {
485 pkt.hdr_first.length_lsb = (unsigned char) packet->length;
487 (unsigned char) (packet->length >> 8);
491 ((unsigned char *) packet) + sizeof(struct ipw_tx_packet) +
492 packet->offset, fragment_data_len);
493 packet->offset += fragment_data_len;
494 packet->fragment_count++;
496 /* Last packet? (May also be first packet.) */
497 if (packet->offset == packet->length)
501 /* If this packet has unsent data, then re-queue it. */
502 if (packet->offset < packet->length) {
510 list_add(&packet->queue, &hw->tx_queue[0]);
514 if (packet->packet_callback)
515 packet->packet_callback(packet->callback_data,
516 packet->length);
517 kfree(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,
560 if (!packet) {
565 packet = list_first_entry(&hw->rx_pool,
569 list_del(&packet->queue);
580 packet = kmalloc(sizeof(struct ipw_rx_packet)
582 if (!packet)
584 packet->capacity = new_capacity;
586 packet->length = 0;
589 if (packet->length + minimum_free_space > packet->capacity) {
590 struct ipw_rx_packet *old_packet = packet;
592 packet = kmalloc(sizeof(struct ipw_rx_packet) +
595 if (!packet) {
599 memcpy(packet, old_packet,
602 packet->capacity = old_packet->length + minimum_free_space;
606 return packet;
609 static void pool_free(struct ipw_hardware *hw, struct ipw_rx_packet *packet)
612 kfree(packet);
615 list_add(&packet->queue, &hw->rx_pool);
626 struct ipw_rx_packet *packet = NULL;
629 /* Discard packet if channel index is out of range. */
632 ": data packet has bad address %u\n", address);
644 * Create a new packet, or assembler already contains one
650 ": no memory for incoming data packet, dropped!\n");
656 /* Append this packet data onto existing data. */
662 packet = *assem;
666 hw->rx_bytes_queued += packet->length;
670 /* If it's a CTRL packet, don't assemble, just queue it. */
671 packet = pool_allocate(hw, NULL, length);
672 if (!packet) {
674 ": no memory for incoming ctrl packet, dropped!\n");
677 packet->protocol = protocol;
678 packet->channel_idx = channel_idx;
679 memcpy((unsigned char *)packet + sizeof(struct ipw_rx_packet),
681 packet->length = length;
685 * If this is the last packet, then send the assembled packet on to the
688 if (packet) {
690 list_add_tail(&packet->queue, &hw->rx_queue);
711 struct ipw_rx_packet *packet =
717 list_del(&packet->queue);
724 if (packet->protocol == TL_PROTOCOLID_COM_DATA) {
734 packet->channel_idx,
735 (unsigned char *)packet
737 packet->length);
741 hw->rx_bytes_queued -= packet->length;
747 handle_received_CTRL_packet(hw, packet->channel_idx,
748 (unsigned char *)packet
750 packet->length);
752 pool_free(hw, packet);
775 ": control packet was %d bytes - wrong size!\n",
812 const union nl_packet *packet,
815 unsigned int protocol = packet->hdr.protocol;
816 unsigned int address = packet->hdr.address;
820 int is_last = packet->hdr.packet_rank & NL_LAST_PACKET;
822 if (packet->hdr.packet_rank & NL_FIRST_PACKET)
827 data = packet->rawpkt + header_length;
852 * Retrieve a packet from the IPW hardware.
866 ": received a packet of %u bytes - longer than the MTU!\n", len);
882 ": received a packet of %u bytes - longer than the MTU!\n", len);
950 * Send pending packet up to given priority, prioritize SETUP data until
963 struct ipw_tx_packet *packet = NULL;
965 /* Pick a packet */
968 packet = list_first_entry(
974 list_del(&packet->queue);
979 if (!packet) {
988 do_send_packet(hw, packet);
1238 struct ipw_tx_packet *packet)
1243 list_add_tail(&packet->queue, &hw->tx_queue[priority]);
1250 /* Create data packet, non-atomic allocation */
1255 struct ipw_tx_packet *packet = kzalloc(
1259 if (!packet)
1262 INIT_LIST_HEAD(&packet->queue);
1263 packet->dest_addr = dest_addr;
1264 packet->protocol = protocol;
1265 packet->length = data_size;
1267 return packet;
1280 struct ipw_control_packet *packet = kzalloc(header_size, GFP_ATOMIC);
1282 if (!packet)
1285 INIT_LIST_HEAD(&packet->header.queue);
1286 packet->header.dest_addr = dest_addr;
1287 packet->header.protocol = protocol;
1288 packet->header.length = header_size - sizeof(struct ipw_tx_packet);
1289 packet->body.sig_no = sig_no;
1291 return packet;
1299 struct ipw_tx_packet *packet;
1301 packet = alloc_data_packet(length, (channel_idx + 1),
1303 if (!packet)
1305 packet->packet_callback = callback;
1306 packet->callback_data = callback_data;
1307 memcpy((unsigned char *) packet + sizeof(struct ipw_tx_packet), data,
1310 send_packet(hw, PRIO_DATA, packet);
1317 struct ipw_control_packet *packet;
1323 packet = alloc_ctrl_packet(sizeof(struct ipw_control_packet),
1325 if (!packet)
1327 packet->header.length = sizeof(struct ipw_control_packet_body);
1328 packet->body.value = (state == 0 ? 0 : 1);
1329 send_packet(hw, prio, &packet->header);
1408 /* generate config packet */
1433 /* generate open packet */
1492 ": not enough memory to alloc control packet\n");
1538 ": setup packet has bad address %d\n", address);
1570 struct ipw_setup_reboot_msg_ack *packet;
1574 packet = alloc_ctrl_packet(
1578 if (!packet) {
1580 ": Not enough memory to send reboot packet");
1583 packet->header.length =
1585 send_packet(hw, PRIO_SETUP, &packet->header);