diff options
author | Eli Cohen <eli@dev.mellanox.co.il> | 2014-09-14 09:47:54 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-10-09 03:08:40 -0400 |
commit | f83b42636a91e63f330ea90996646b4a885aca74 (patch) | |
tree | 543aa8c384b39a0f35a58e515dcd19dbda777e4d | |
parent | 1c3ce90d0acb0c661910dd84f416b3053e9710af (diff) |
IB/mlx5: Remove duplicate code from mlx5_set_path
Some of the fields were set twice. Re-organize to avoid that.
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 8c574b63d77b..34b92fc345b7 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -1302,6 +1302,11 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah, | |||
1302 | path->rlid = cpu_to_be16(ah->dlid); | 1302 | path->rlid = cpu_to_be16(ah->dlid); |
1303 | 1303 | ||
1304 | if (ah->ah_flags & IB_AH_GRH) { | 1304 | if (ah->ah_flags & IB_AH_GRH) { |
1305 | if (ah->grh.sgid_index >= dev->mdev->caps.port[port - 1].gid_table_len) { | ||
1306 | pr_err(KERN_ERR "sgid_index (%u) too large. max is %d\n", | ||
1307 | ah->grh.sgid_index, dev->mdev->caps.port[port - 1].gid_table_len); | ||
1308 | return -EINVAL; | ||
1309 | } | ||
1305 | path->grh_mlid |= 1 << 7; | 1310 | path->grh_mlid |= 1 << 7; |
1306 | path->mgid_index = ah->grh.sgid_index; | 1311 | path->mgid_index = ah->grh.sgid_index; |
1307 | path->hop_limit = ah->grh.hop_limit; | 1312 | path->hop_limit = ah->grh.hop_limit; |
@@ -1317,22 +1322,6 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah, | |||
1317 | path->static_rate = err; | 1322 | path->static_rate = err; |
1318 | path->port = port; | 1323 | path->port = port; |
1319 | 1324 | ||
1320 | if (ah->ah_flags & IB_AH_GRH) { | ||
1321 | if (ah->grh.sgid_index >= dev->mdev->caps.port[port - 1].gid_table_len) { | ||
1322 | pr_err(KERN_ERR "sgid_index (%u) too large. max is %d\n", | ||
1323 | ah->grh.sgid_index, dev->mdev->caps.port[port - 1].gid_table_len); | ||
1324 | return -EINVAL; | ||
1325 | } | ||
1326 | |||
1327 | path->grh_mlid |= 1 << 7; | ||
1328 | path->mgid_index = ah->grh.sgid_index; | ||
1329 | path->hop_limit = ah->grh.hop_limit; | ||
1330 | path->tclass_flowlabel = | ||
1331 | cpu_to_be32((ah->grh.traffic_class << 20) | | ||
1332 | (ah->grh.flow_label)); | ||
1333 | memcpy(path->rgid, ah->grh.dgid.raw, 16); | ||
1334 | } | ||
1335 | |||
1336 | if (attr_mask & IB_QP_TIMEOUT) | 1325 | if (attr_mask & IB_QP_TIMEOUT) |
1337 | path->ackto_lt = attr->timeout << 3; | 1326 | path->ackto_lt = attr->timeout << 3; |
1338 | 1327 | ||