Signed-off-by: Nicolas Morey-Chaisemartin <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/user_mad.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 268a2d2..e39bba4 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -408,6 +408,14 @@ static int same_destination(struct ib_user_mad_hdr *hdr1,
 	return 0;
 }
 
+static int cmp_tid(__be64 *a, __be64 *b)
+{
+	__be32 *a1 = (__be32 *)a;
+	__be32 *b1 = (__be32 *)b;
+
+	return ((*a1 == *b1) && (*(a1+1) == *(b1+1)));
+}	
+
 static int is_duplicate(struct ib_umad_file *file,
 			struct ib_umad_packet *packet)
 {
@@ -418,7 +426,7 @@ static int is_duplicate(struct ib_umad_file *file,
 	list_for_each_entry(sent_packet, &file->send_list, list) {
 		sent_hdr = (struct ib_mad_hdr *) sent_packet->mad.data;
 
-		if ((hdr->tid != sent_hdr->tid) ||
+		if ((!cmp_tid(&hdr->tid, &sent_hdr->tid)) ||
 		    (hdr->mgmt_class != sent_hdr->mgmt_class))
 			continue;
 
@@ -441,6 +449,15 @@ static int is_duplicate(struct ib_umad_file *file,
 	return 0;
 }
 
+static void copy_tid(__be64 *a, __be64 *b)
+{
+	__be32 *a1 = (__be32 *)a;
+	__be32 *b1 = (__be32 *)b;
+
+	*a1 = *b1;
+	*(a1+1) = *(b1+1);
+}	
+
 static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
 			     size_t count, loff_t *pos)
 {
@@ -557,7 +574,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
 		tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid;
 		*tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
 				   (be64_to_cpup(tid) & 0xffffffff));
-		rmpp_mad->mad_hdr.tid = *tid;
+		copy_tid(&rmpp_mad->mad_hdr.tid ,tid);
 	}
 
 	spin_lock_irq(&file->send_lock);

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to