[openib-general] [PATCH]: ib_mad: Make receive list be per QP rather than just 1 for all QPs
Hal Rosenstock
halr at voltaire.com
Sat Sep 11 11:57:08 PDT 2004
ib_mad: Make receive list be per QP rather than just 1 for all QPs
Index: ib_mad.c
===================================================================
--- ib_mad.c (revision 786)
+++ ib_mad.c (working copy)
@@ -772,7 +772,7 @@
/* Link receive WR into posted receive MAD list */
spin_lock_irqsave(&priv->recv_list_lock, flags);
- list_add_tail((struct list_head *)mad_priv,
&priv->recv_posted_mad_list);
+ list_add_tail((struct list_head *)mad_priv,
&priv->recv_posted_mad_list[qp->qp_num]); /* This works now as only QP0
and 1 (no redirection)!!! */
spin_unlock_irqrestore(&priv->recv_list_lock, flags);
pci_unmap_addr_set(&mad_priv->header.buf, mapping, sg_list.addr);
@@ -819,16 +819,19 @@
*/
static void ib_mad_return_posted_recv_mads(struct ib_mad_port_private
*priv)
{
+ int i;
unsigned long flags;
/* PCI mapping ? */
- spin_lock_irqsave(&priv->recv_list_lock, flags);
- while (!list_empty(&priv->recv_posted_mad_list)) {
+ for (i = 0; i < IB_MAD_QPS_SUPPORTED; i++) {
+ spin_lock_irqsave(&priv->recv_list_lock, flags);
+ while (!list_empty(&priv->recv_posted_mad_list[i])) {
+ }
+ INIT_LIST_HEAD(&priv->recv_posted_mad_list[i]);
+ spin_unlock_irqrestore(&priv->recv_list_lock, flags);
}
- INIT_LIST_HEAD(&priv->recv_posted_mad_list);
- spin_unlock_irqrestore(&priv->recv_list_lock, flags);
}
/*
@@ -1149,8 +1152,10 @@
spin_lock_init(&priv->recv_list_lock);
spin_lock_init(&priv->send_list_lock);
- INIT_LIST_HEAD(&priv->recv_posted_mad_list);
INIT_LIST_HEAD(&priv->send_posted_mad_list);
+ for (i = 0; i < IB_MAD_QPS_SUPPORTED; i++) {
+ INIT_LIST_HEAD(&priv->recv_posted_mad_list[i]);
+ }
ib_mad_thread_init(priv);
ret = ib_mad_port_start(priv);
Index: ib_mad_priv.h
===================================================================
--- ib_mad_priv.h (revision 786)
+++ ib_mad_priv.h (working copy)
@@ -134,7 +134,7 @@
spinlock_t send_list_lock;
spinlock_t recv_list_lock;
struct list_head send_posted_mad_list;
- struct list_head recv_posted_mad_list;
+ struct list_head recv_posted_mad_list[IB_MAD_QPS_SUPPORTED];
struct ib_mad_thread_data thread_data;
};
Index: TODO
===================================================================
--- TODO (revision 784)
+++ TODO (working copy)
@@ -5,7 +5,7 @@
Short Term
Track count of posted sends and receives
Support call of ib_mad_post_send from any context
-Receive list per QP rather than 1 receive list
+Encode QP number in WRID of receive WRs
Fix list handling
Use wait queue and wait_event rather than signals and semaphores
Finish coding receive path
More information about the general
mailing list