diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2006-02-26 19:05:59 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-03-20 13:08:17 -0500 |
commit | 1d89b1ae6c203bc68a3f424be144abcdf62773c9 (patch) | |
tree | 9d1979c98843ba7d18f6272f13ea06c2591ee8d5 /drivers/infiniband/hw/mthca/mthca_av.c | |
parent | 14abdffcc0a0ca9c5bb3274648d073e09a6fd2ba (diff) |
IB/mthca: Implement query_ah method
Implement query_ah (except for AVs which are in HCA memory). This is
needed to implement RMPP duplicate session detection on sending side
(extraction of DGID/DLID and GRH flag from address handle).
Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_av.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_av.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 198f1267e984..f023d3936518 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -193,6 +193,37 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
195 | 195 | ||
196 | int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr) | ||
197 | { | ||
198 | struct mthca_ah *ah = to_mah(ibah); | ||
199 | struct mthca_dev *dev = to_mdev(ibah->device); | ||
200 | |||
201 | /* Only implement for MAD and memfree ah for now. */ | ||
202 | if (ah->type == MTHCA_AH_ON_HCA) | ||
203 | return -ENOSYS; | ||
204 | |||
205 | memset(attr, 0, sizeof *attr); | ||
206 | attr->dlid = be16_to_cpu(ah->av->dlid); | ||
207 | attr->sl = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; | ||
208 | attr->static_rate = ah->av->msg_sr & 0x7; | ||
209 | attr->src_path_bits = ah->av->g_slid & 0x7F; | ||
210 | attr->port_num = be32_to_cpu(ah->av->port_pd) >> 24; | ||
211 | attr->ah_flags = mthca_ah_grh_present(ah) ? IB_AH_GRH : 0; | ||
212 | |||
213 | if (attr->ah_flags) { | ||
214 | attr->grh.traffic_class = | ||
215 | be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20; | ||
216 | attr->grh.flow_label = | ||
217 | be32_to_cpu(ah->av->sl_tclass_flowlabel) & 0xfffff; | ||
218 | attr->grh.hop_limit = ah->av->hop_limit; | ||
219 | attr->grh.sgid_index = ah->av->gid_index & | ||
220 | (dev->limits.gid_table_len - 1); | ||
221 | memcpy(attr->grh.dgid.raw, ah->av->dgid, 16); | ||
222 | } | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
196 | int __devinit mthca_init_av_table(struct mthca_dev *dev) | 227 | int __devinit mthca_init_av_table(struct mthca_dev *dev) |
197 | { | 228 | { |
198 | int err; | 229 | int err; |