diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-07-30 18:14:15 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-07-30 18:14:15 -0400 |
commit | a670fcb43f01a67ef56176afc76e5d43d128b25c (patch) | |
tree | 09c9411c78a33ff980e9ea871bc7686e7589abbf /drivers/infiniband/core/verbs.c | |
parent | 327309e899662b482c58cf25f574513d38b5788c (diff) | |
parent | b0825488a642cadcf39709961dde61440cb0731c (diff) |
/spare/repo/netdev-2.6 branch 'master'
Diffstat (limited to 'drivers/infiniband/core/verbs.c')
-rw-r--r-- | drivers/infiniband/core/verbs.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 2516f9646515..506fdf1f2a26 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/err.h> | 41 | #include <linux/err.h> |
42 | 42 | ||
43 | #include <ib_verbs.h> | 43 | #include <ib_verbs.h> |
44 | #include <ib_cache.h> | ||
44 | 45 | ||
45 | /* Protection domains */ | 46 | /* Protection domains */ |
46 | 47 | ||
@@ -88,6 +89,40 @@ struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) | |||
88 | } | 89 | } |
89 | EXPORT_SYMBOL(ib_create_ah); | 90 | EXPORT_SYMBOL(ib_create_ah); |
90 | 91 | ||
92 | struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, struct ib_wc *wc, | ||
93 | struct ib_grh *grh, u8 port_num) | ||
94 | { | ||
95 | struct ib_ah_attr ah_attr; | ||
96 | u32 flow_class; | ||
97 | u16 gid_index; | ||
98 | int ret; | ||
99 | |||
100 | memset(&ah_attr, 0, sizeof ah_attr); | ||
101 | ah_attr.dlid = wc->slid; | ||
102 | ah_attr.sl = wc->sl; | ||
103 | ah_attr.src_path_bits = wc->dlid_path_bits; | ||
104 | ah_attr.port_num = port_num; | ||
105 | |||
106 | if (wc->wc_flags & IB_WC_GRH) { | ||
107 | ah_attr.ah_flags = IB_AH_GRH; | ||
108 | ah_attr.grh.dgid = grh->dgid; | ||
109 | |||
110 | ret = ib_find_cached_gid(pd->device, &grh->sgid, &port_num, | ||
111 | &gid_index); | ||
112 | if (ret) | ||
113 | return ERR_PTR(ret); | ||
114 | |||
115 | ah_attr.grh.sgid_index = (u8) gid_index; | ||
116 | flow_class = be32_to_cpu(grh->version_tclass_flow); | ||
117 | ah_attr.grh.flow_label = flow_class & 0xFFFFF; | ||
118 | ah_attr.grh.traffic_class = (flow_class >> 20) & 0xFF; | ||
119 | ah_attr.grh.hop_limit = grh->hop_limit; | ||
120 | } | ||
121 | |||
122 | return ib_create_ah(pd, &ah_attr); | ||
123 | } | ||
124 | EXPORT_SYMBOL(ib_create_ah_from_wc); | ||
125 | |||
91 | int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) | 126 | int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) |
92 | { | 127 | { |
93 | return ah->device->modify_ah ? | 128 | return ah->device->modify_ah ? |