/* Notify core of sending a packet. Ackcode is the ack code returned for async transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE for other cases (internal errors that don't justify a panic).  */
void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, int ackcode)
/* Notify core of sending a packet. Ackcode is the ack code returned for async transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE for other cases (internal errors that don't justify a panic).  */
void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, int ackcode)
{
	unsigned long flags;
	spin_lock_irqsave(&pending_packets_lock, flags);
	packet->ack_code = ackcode;
	if (packet->no_waiter || packet->state == hpsb_complete) {
		spin_unlock_irqrestore(&pending_packets_lock, flags);
		hpsb_free_packet(packet);
		return;
	}
	atomic_dec(&packet->refcnt);
	if (ackcode != ACK_PENDING || !packet->expect_response) {
		packet->state = hpsb_complete;
		list_del_init(&packet->queue);
		spin_unlock_irqrestore(&pending_packets_lock, flags);
		queue_packet_complete(packet);
		return;
	}
	packet->state = hpsb_pending;
	packet->sendtime = jiffies;
	spin_unlock_irqrestore(&pending_packets_lock, flags);
	mod_timer(&host->timeout, jiffies + host->timeout_interval);
}