[openib-general] [PATCH] relocate SA MAD definitions to ib_mad.h

Sean Hefty mshefty at ichips.intel.com
Tue Apr 19 16:20:32 PDT 2005


This patch moves the definitions of the SA MAD and header from ib_sa.h and
sa_query.c to ib_mad.h.  The definitions are needed by RMPP.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

Index: include/ib_mad.h
===================================================================
--- include/ib_mad.h	(revision 2168)
+++ include/ib_mad.h	(working copy)
@@ -39,6 +39,8 @@
 #if !defined( IB_MAD_H )
 #define IB_MAD_H
 
+#include <linux/pci.h>
+
 #include <ib_verbs.h>
 
 /* Management base version */
@@ -115,6 +117,12 @@
 	union ib_gid	dgid;
 } __attribute__ ((packed));
 
+/*
+ * These structures must be packed because they have 64-bit fields
+ * that are only 32-bit aligned.  64-bit architectures will lay them
+ * out wrong otherwise.  (And unfortunately they are sent on the wire
+ * so we can't change the layout)
+ */
 struct ib_mad_hdr {
 	u8	base_version;
 	u8	mgmt_class;
@@ -137,6 +145,17 @@
 	u32	paylen_newwin;
 } __attribute__ ((packed));
 
+typedef u64 __bitwise ib_sa_comp_mask;
+
+#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n))
+
+struct ib_sa_hdr {
+	u64			sm_key;
+	u16			attr_offset;
+	u16			reserved;
+	ib_sa_comp_mask		comp_mask;
+} __attribute__ ((packed));
+
 struct ib_mad {
 	struct ib_mad_hdr	mad_hdr;
 	u8			data[232];
@@ -148,6 +167,13 @@
 	u8			data[220];
 } __attribute__ ((packed));
 
+struct ib_sa_mad {
+	struct ib_mad_hdr	mad_hdr;
+	struct ib_rmpp_hdr	rmpp_hdr;
+	struct ib_sa_hdr	sa_hdr;
+	u8			data[200];
+} __attribute__ ((packed));
+
 struct ib_vendor_mad {
 	struct ib_mad_hdr	mad_hdr;
 	struct ib_rmpp_hdr	rmpp_hdr;
@@ -418,8 +444,7 @@
 			  void *buf);
 
 /**
- * ib_free_recv_mad - Returns data buffers used to receive a MAD to the
- *   access layer.
+ * ib_free_recv_mad - Returns data buffers used to receive a MAD.
  * @mad_recv_wc: Work completion information for a received MAD.
  *
  * Clients receiving MADs through their ib_mad_recv_handler must call this
Index: include/ib_sa.h
===================================================================
--- include/ib_sa.h	(revision 2168)
+++ include/ib_sa.h	(working copy)
@@ -89,10 +89,6 @@
 	}
 }
 
-typedef u64 __bitwise ib_sa_comp_mask;
-
-#define IB_SA_COMP_MASK(n)	((__force ib_sa_comp_mask) cpu_to_be64(1ull << n))
-
 /*
  * Structures for SA records are named "struct ib_sa_xxx_rec."  No
  * attempt is made to pack structures to match the physical layout of
Index: core/sa_query.c
===================================================================
--- core/sa_query.c	(revision 2168)
+++ core/sa_query.c	(working copy)
@@ -50,26 +50,6 @@
 MODULE_DESCRIPTION("InfiniBand subnet administration query support");
 MODULE_LICENSE("Dual BSD/GPL");
 
-/*
- * These two structures must be packed because they have 64-bit fields
- * that are only 32-bit aligned.  64-bit architectures will lay them
- * out wrong otherwise.  (And unfortunately they are sent on the wire
- * so we can't change the layout)
- */
-struct ib_sa_hdr {
-	u64			sm_key;
-	u16			attr_offset;
-	u16			reserved;
-	ib_sa_comp_mask		comp_mask;
-} __attribute__ ((packed));
-
-struct ib_sa_mad {
-	struct ib_mad_hdr	mad_hdr;
-	struct ib_rmpp_hdr	rmpp_hdr;
-	struct ib_sa_hdr	sa_hdr;
-	u8			data[200];
-} __attribute__ ((packed));
-
 struct ib_sa_sm_ah {
 	struct ib_ah        *ah;
 	struct kref          ref;



More information about the general mailing list