aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ntb
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-01-19 04:02:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-20 18:45:52 -0500
commit448c6fb3a39bf4d0b644f5b942b7aa9473b0f597 (patch)
tree4575fcc4198203712ac08eb7f4c9f66f49828754 /drivers/ntb
parent793c20e9c924e6bc91bc9b1c98e2f6b8e1bf2fae (diff)
NTB: Out of free receive entries issue
If the NTB client driver enqueues the maximum number of rx buffers, it will not be able to re-enqueue another in its callback handler due to a lack of free entries. This can be avoided by adding the current entry to the free queue prior to calling the client callback handler. With this change, ntb_netdev will no longer encounter a rx error on its first packet. Signed-off-by: Jon Mason <jon.mason@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ntb')
-rw-r--r--drivers/ntb/ntb_transport.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 69c58da0fa34..b3afb2442dc0 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -910,12 +910,15 @@ void ntb_transport_free(void *transport)
910static void ntb_rx_copy_task(struct ntb_transport_qp *qp, 910static void ntb_rx_copy_task(struct ntb_transport_qp *qp,
911 struct ntb_queue_entry *entry, void *offset) 911 struct ntb_queue_entry *entry, void *offset)
912{ 912{
913 memcpy(entry->buf, offset, entry->len); 913 void *cb_data = entry->cb_data;
914 unsigned int len = entry->len;
914 915
915 if (qp->rx_handler && qp->client_ready == NTB_LINK_UP) 916 memcpy(entry->buf, offset, entry->len);
916 qp->rx_handler(qp, qp->cb_data, entry->cb_data, entry->len);
917 917
918 ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q); 918 ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q);
919
920 if (qp->rx_handler && qp->client_ready == NTB_LINK_UP)
921 qp->rx_handler(qp, qp->cb_data, cb_data, len);
919} 922}
920 923
921static int ntb_process_rxc(struct ntb_transport_qp *qp) 924static int ntb_process_rxc(struct ntb_transport_qp *qp)