[openib-general] [PATCH 1/4] SA path record caching

Sean Hefty sean.hefty at intel.com
Wed Jan 25 11:42:01 PST 2006


Expose functions to pack/unpack SA attributes.  This capability is
also required by the local SA database.

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

---

Index: core/sa_query.c
===================================================================
--- core/sa_query.c	(revision 5098)
+++ core/sa_query.c	(working copy)
@@ -440,6 +440,32 @@ void ib_sa_cancel_query(int id, struct i
 }
 EXPORT_SYMBOL(ib_sa_cancel_query);
 
+int ib_sa_pack_attr(void *dst, void *src, int attr_id)
+{
+	switch (attr_id) {
+	case IB_SA_ATTR_PATH_REC:
+		ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table), src, dst);
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(ib_sa_pack_attr);
+
+int ib_sa_unpack_attr(void *dst, void *src, int attr_id)
+{
+	switch (attr_id) {
+	case IB_SA_ATTR_PATH_REC:
+		ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), src, dst);
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(ib_sa_unpack_attr);
+
 static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent)
 {
 	unsigned long flags;
Index: include/rdma/ib_sa.h
===================================================================
--- include/rdma/ib_sa.h	(revision 5098)
+++ include/rdma/ib_sa.h	(working copy)
@@ -398,5 +398,22 @@ ib_sa_mcmember_rec_delete(struct ib_devi
 					context, query);
 }
 
+/**
+ * ib_sa_pack_attr - Copy an SA attribute from a host defined structure to
+ *   a network packed structure.
+ * dst: Destination buffer.
+ * src: Source buffer.
+ * attr_id: Identifer of SA attribute: IB_SA_ATTR_*.
+ */
+int ib_sa_pack_attr(void *dst, void *src, int attr_id);
+
+/**
+ * ib_sa_unpack_attr - Copy an SA attribute from a packed network structure
+ *   to a host defined structure.
+ * dst: Destination buffer.
+ * src: Source buffer.
+ * attr_id: Identifer of SA attribute: IB_SA_ATTR_*.
+ */
+int ib_sa_unpack_attr(void *dst, void *src, int attr_id);
 
 #endif /* IB_SA_H */






More information about the general mailing list