[openib-general] [PATCH 3/5] sa_query: add call to initialize ah_attr from an mcmember record
Sean Hefty
sean.hefty at intel.com
Fri Jun 9 14:49:28 PDT 2006
Export a call to initialize an ib_ah_attr structure based on an
MCMemberRecord returned from a multicast join request.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
--- svn3/gen2/trunk/src/linux-kernel/infiniband/include/rdma/ib_sa.h 2006-06-06 15:21:05.000000000 -0700
+++ svn/gen2/trunk/src/linux-kernel/infiniband/include/rdma/ib_sa.h 2006-06-06 15:56:37.000000000 -0700
@@ -380,6 +380,14 @@ int ib_init_ah_from_path(struct ib_devic
struct ib_sa_path_rec *rec,
struct ib_ah_attr *ah_attr);
+ /**
+ * ib_init_ah_from_mcmember - Initialize address handle attributes based on an
+ * SA mcmember record.
+ */
+int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
+ struct ib_sa_mcmember_rec *rec,
+ struct ib_ah_attr *ah_attr);
+
/**
* ib_sa_pack_attr - Copy an SA attribute from a host defined structure to
* a network packed structure.
--- svn3/gen2/trunk/src/linux-kernel/infiniband/core/sa_query.c 2006-06-06 15:21:05.000000000 -0700
+++ svn/gen2/trunk/src/linux-kernel/infiniband/core/sa_query.c 2006-06-06 15:57:21.000000000 -0700
@@ -471,6 +471,36 @@ int ib_init_ah_from_path(struct ib_devic
}
EXPORT_SYMBOL(ib_init_ah_from_path);
+int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
+ struct ib_sa_mcmember_rec *rec,
+ struct ib_ah_attr *ah_attr)
+{
+ int ret;
+ u16 gid_index;
+ u8 p;
+
+ ret = ib_find_cached_gid(device, &rec->port_gid, &p, &gid_index);
+ if (ret)
+ return ret;
+
+ memset(ah_attr, 0, sizeof *ah_attr);
+ ah_attr->dlid = be16_to_cpu(rec->mlid);
+ ah_attr->sl = rec->sl;
+ ah_attr->port_num = port_num;
+ ah_attr->static_rate = rec->rate;
+
+ ah_attr->ah_flags = IB_AH_GRH;
+ ah_attr->grh.dgid = rec->mgid;
+
+ ah_attr->grh.sgid_index = (u8) gid_index;
+ ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label);
+ ah_attr->grh.hop_limit = rec->hop_limit;
+ ah_attr->grh.traffic_class = rec->traffic_class;
+
+ return 0;
+}
+EXPORT_SYMBOL(ib_init_ah_from_mcmember);
+
int ib_sa_pack_attr(void *dst, void *src, int attr_id)
{
switch (attr_id) {
More information about the general
mailing list