diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-01-12 18:55:41 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-01-12 18:55:41 -0500 |
commit | 9eacee2ac624bfa9740d49355dbe6ee88d0cba0a (patch) | |
tree | 44226d2cee7f9b9f1e588e27664cc2db15fb3eda /drivers/infiniband/hw/mthca | |
parent | c063a06835d3ccfa6c039d3a3869fcf22249c862 (diff) |
IB/mthca: Initialize grh_present before using it
build_mlx_header() was using sqp->ud_header.grh_present before it was
initialized by mthca_read_ah(). Furthermore, header->grh_present is
set by ib_ud_header_init, so there's no need to set it again in
mthca_read_ah().
Signed-off-by: Michael S. Tsirkin <mst@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 | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_dev.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 22fdc446f25c..a14eed08a0fc 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -163,6 +163,11 @@ int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah) | |||
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | int mthca_ah_grh_present(struct mthca_ah *ah) | ||
167 | { | ||
168 | return !!(ah->av->g_slid & 0x80); | ||
169 | } | ||
170 | |||
166 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | 171 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, |
167 | struct ib_ud_header *header) | 172 | struct ib_ud_header *header) |
168 | { | 173 | { |
@@ -172,8 +177,7 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
172 | header->lrh.service_level = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; | 177 | header->lrh.service_level = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; |
173 | header->lrh.destination_lid = ah->av->dlid; | 178 | header->lrh.destination_lid = ah->av->dlid; |
174 | header->lrh.source_lid = cpu_to_be16(ah->av->g_slid & 0x7f); | 179 | header->lrh.source_lid = cpu_to_be16(ah->av->g_slid & 0x7f); |
175 | if (ah->av->g_slid & 0x80) { | 180 | if (mthca_ah_grh_present(ah)) { |
176 | header->grh_present = 1; | ||
177 | header->grh.traffic_class = | 181 | header->grh.traffic_class = |
178 | (be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20) & 0xff; | 182 | (be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20) & 0xff; |
179 | header->grh.flow_label = | 183 | header->grh.flow_label = |
@@ -184,8 +188,6 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
184 | &header->grh.source_gid); | 188 | &header->grh.source_gid); |
185 | memcpy(header->grh.destination_gid.raw, | 189 | memcpy(header->grh.destination_gid.raw, |
186 | ah->av->dgid, 16); | 190 | ah->av->dgid, 16); |
187 | } else { | ||
188 | header->grh_present = 0; | ||
189 | } | 191 | } |
190 | 192 | ||
191 | return 0; | 193 | return 0; |
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index 795b379260bf..a104ab041ea3 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -520,6 +520,7 @@ int mthca_create_ah(struct mthca_dev *dev, | |||
520 | int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah); | 520 | int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah); |
521 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | 521 | int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, |
522 | struct ib_ud_header *header); | 522 | struct ib_ud_header *header); |
523 | int mthca_ah_grh_present(struct mthca_ah *ah); | ||
523 | 524 | ||
524 | int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); | 525 | int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); |
525 | int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); | 526 | int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 564b6d51c394..fba608ed7df2 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1434,7 +1434,7 @@ static int build_mlx_header(struct mthca_dev *dev, struct mthca_sqp *sqp, | |||
1434 | u16 pkey; | 1434 | u16 pkey; |
1435 | 1435 | ||
1436 | ib_ud_header_init(256, /* assume a MAD */ | 1436 | ib_ud_header_init(256, /* assume a MAD */ |
1437 | sqp->ud_header.grh_present, | 1437 | mthca_ah_grh_present(to_mah(wr->wr.ud.ah)), |
1438 | &sqp->ud_header); | 1438 | &sqp->ud_header); |
1439 | 1439 | ||
1440 | err = mthca_read_ah(dev, to_mah(wr->wr.ud.ah), &sqp->ud_header); | 1440 | err = mthca_read_ah(dev, to_mah(wr->wr.ud.ah), &sqp->ud_header); |