Re: [RFC v2 1/2] PCI-Express Non-Transparent Bridge Support
From: chetan loke <hidden>
Date: 2012-07-31 16:14:39
Also in:
linux-pci, lkml
On Sun, Jul 29, 2012 at 8:26 PM, Jon Mason [off-list ref] wrote: <snip>
+static void ntb_tx_copy_task(struct ntb_transport_qp *qp,
+ struct ntb_queue_entry *entry,
+ void *offset)
+{
+ struct ntb_payload_header *hdr = offset;
+
+ offset += sizeof(struct ntb_payload_header);
+ memcpy_toio(offset, entry->buf, entry->len);
+
+ hdr->len = entry->len;
+ hdr->ver = qp->tx_pkts;
+
+ /* Ensure that the data is fully copied out before setting the flag */
+ wmb();
+ hdr->flags = entry->flags | DESC_DONE_FLAG;
+
+ ntb_ring_sdb(qp->ndev, qp->qp_num);
+
+ /* The entry length can only be zero if the packet is intended to be a
+ * "link down" or similar. Since no payload is being sent in these
+ * cases, there is nothing to add to the completion queue.
+ */
+ if (entry->len > 0) {
+ qp->tx_bytes += entry->len;
+
+ /* Add fully transmitted data to completion queue */
+ ntb_list_add_tail(&qp->ntb_tx_comp_q_lock, &entry->entry,
+ &qp->tx_comp_q);
+
+ if (qp->tx_handler)
+ qp->tx_handler(qp->cb_data, qp);
+ } else
+ ntb_list_add_tail(&qp->ntb_tx_free_q_lock, &entry->entry,
+ &qp->tx_free_q);
+}I know you talked about a fixed array. But it's not here yet. So at all the call-sites, for [r/t]x_free_q , add the 'entry' to the head - change to ntb_list_add_head here and else where. Chetan Loke