[openib-general] [PATCH] ib_mad.c: Fix request/response matching
Hal Rosenstock
Tue Oct 5 11:54:15 PDT 2004
Fix endian of high tid so responses are properly matched to requests
Index: access/ib_mad.c
===================================================================
--- access/ib_mad.c (revision 923)
+++ access/ib_mad.c (working copy)
@@ -346,7 +346,7 @@
}
mad_send_wr->tid = ((struct ib_mad_hdr*)
- bus_to_virt(cur_send_wr->sg_list->addr))->tid;
+ bus_to_virt(cur_send_wr->sg_list->addr))->tid.id;
mad_send_wr->agent = mad_agent;
mad_send_wr->timeout_ms = cur_send_wr->wr.ud.timeout_ms;
if (mad_send_wr->timeout_ms)
@@ -420,7 +420,7 @@
void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc,
void *buf)
{
- printk(KERN_ERR "ib_coalesce_recv_mad() not implemented as yet\n");
+ printk(KERN_ERR "ib_coalesce_recv_mad() not implemented yet\n");
}
EXPORT_SYMBOL(ib_coalesce_recv_mad);
@@ -437,7 +437,7 @@
int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
struct ib_wc *wc)
{
- printk(KERN_ERR "ib_process_mad_wc() not implemented as yet\n");
+ printk(KERN_ERR "ib_process_mad_wc() not implemented yet\n");
return 0;
}
EXPORT_SYMBOL(ib_process_mad_wc);
@@ -684,7 +684,7 @@
/* Whether MAD was solicited determines type of routing to MAD client
*/
if (solicited) {
/* Routing is based on high 32 bits of transaction ID of MAD */
- hi_tid = mad->mad_hdr.tid >> 32;
+ hi_tid = be32_to_cpu(mad->mad_hdr.tid.tid_field.hi_tid);
list_for_each_entry(entry, &port_priv->agent_list, agent_list) {
if (entry->agent.hi_tid == hi_tid) {
mad_agent = entry;
@@ -693,7 +693,7 @@
}
if (!mad_agent) {
printk(KERN_ERR "No client 0x%x for received MAD\n",
- (u32)(mad->mad_hdr.tid >> 32));
+ hi_tid);
goto ret;
}
} else {
@@ -795,7 +795,7 @@
if (solicited) {
spin_lock_irqsave(&mad_agent_priv->send_list_lock, flags);
mad_send_wr = find_send_req(mad_agent_priv,
- recv->mad.mad.mad_hdr.tid);
+ recv->mad.mad.mad_hdr.tid.id);
if (!mad_send_wr) {
spin_unlock_irqrestore(&mad_agent_priv->send_list_lock,
flags);
@@ -936,6 +936,11 @@
}
}
+ /*
+ * Leave sends with timeouts on the send list
+ * until either matching response is received
+ * or timeout occurs
+ */
if (--mad_send_wr->refcount > 0) {
spin_unlock_irqrestore(&mad_agent_priv->send_list_lock, flags);
return;
@@ -1332,6 +1337,7 @@
list_del(&port_priv->recv_posted_mad_list[i]);
}
+
INIT_LIST_HEAD(&port_priv->recv_posted_mad_list[i]);
port_priv->recv_posted_mad_count[i] = 0;
spin_unlock_irqrestore(&port_priv->recv_list_lock, flags);
@@ -1353,6 +1359,7 @@
/* Call completion handler with flushed status !!! */
}
+
INIT_LIST_HEAD(&port_priv->send_posted_mad_list);
port_priv->send_posted_mad_count = 0;
spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
Index: include/ib_mad.h
===================================================================
--- include/ib_mad.h (revision 923)
+++ include/ib_mad.h (working copy)
@@ -69,6 +69,14 @@
union ib_gid dgid;
} __attribute__ ((packed));
+union ib_tid {
+ u64 id;
+ struct {
+ u32 hi_tid;
+ u32 lo_tid;
+ } tid_field;
+};
+
struct ib_mad_hdr {
u8 base_version;
u8 mgmt_class;
@@ -76,7 +84,7 @@
u8 method;
u16 status;
u16 class_specific;
- u64 tid;
+ union ib_tid tid;
u16 attr_id;
u16 resv;
u32 attr_mod;
Index: include/ib_smi.h
===================================================================
--- include/ib_smi.h (revision 923)
+++ include/ib_smi.h (working copy)
@@ -41,7 +41,7 @@
u16 status;
u8 hop_ptr;
u8 hop_cnt;
- u64 tid;
+ union ib_tid tid;
u16 attr_id;
u16 resv;
u32 attr_mod;
More information about the openib-general mailing list