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 | |
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')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_av.c | 31 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_dev.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 1 |
3 files changed, 33 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; |
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index b2aea80a683f..ea48c897c7ce 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -539,6 +539,7 @@ int mthca_create_ah(struct mthca_dev *dev, | |||
539 | int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah); | 539 | int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah); |
540 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | 540 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, |
541 | struct ib_ud_header *header); | 541 | struct ib_ud_header *header); |
542 | int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr); | ||
542 | int mthca_ah_grh_present(struct mthca_ah *ah); | 543 | int mthca_ah_grh_present(struct mthca_ah *ah); |
543 | 544 | ||
544 | int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); | 545 | int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 084bea592df5..2c250bc11c33 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -1289,6 +1289,7 @@ int mthca_register_device(struct mthca_dev *dev) | |||
1289 | dev->ib_dev.alloc_pd = mthca_alloc_pd; | 1289 | dev->ib_dev.alloc_pd = mthca_alloc_pd; |
1290 | dev->ib_dev.dealloc_pd = mthca_dealloc_pd; | 1290 | dev->ib_dev.dealloc_pd = mthca_dealloc_pd; |
1291 | dev->ib_dev.create_ah = mthca_ah_create; | 1291 | dev->ib_dev.create_ah = mthca_ah_create; |
1292 | dev->ib_dev.query_ah = mthca_ah_query; | ||
1292 | dev->ib_dev.destroy_ah = mthca_ah_destroy; | 1293 | dev->ib_dev.destroy_ah = mthca_ah_destroy; |
1293 | 1294 | ||
1294 | if (dev->mthca_flags & MTHCA_FLAG_SRQ) { | 1295 | if (dev->mthca_flags & MTHCA_FLAG_SRQ) { |