aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@mellanox.co.il>2005-11-18 17:11:17 -0500
committerRoland Dreier <rolandd@cisco.com>2005-11-18 17:11:17 -0500
commit48fd0d1fdd357caa2de8cb4ce6af810df7535f43 (patch)
tree09e6f5113d908a7f059cc0b374c545d69e0f2a1d
parentcbc5b2bb9e226c2b2b981836d2289912e2ef3c1c (diff)
IB/mthca: Safer max_send_sge/max_recv_sge calculation
Calculation of QP capabilities still isn't exactly right in mthca: max_send_sge/max_recv_sge fields returned in create_qp can exceed the handware supported limits. Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 5899f0c765be..dd4e13303e96 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -918,10 +918,12 @@ static void mthca_adjust_qp_caps(struct mthca_dev *dev,
918 else 918 else
919 qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; 919 qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE;
920 920
921 qp->sq.max_gs = max_data_size / sizeof (struct mthca_data_seg); 921 qp->sq.max_gs = min_t(int, dev->limits.max_sg,
922 qp->rq.max_gs = (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - 922 max_data_size / sizeof (struct mthca_data_seg));
923 sizeof (struct mthca_next_seg)) / 923 qp->rq.max_gs = min_t(int, dev->limits.max_sg,
924 sizeof (struct mthca_data_seg); 924 (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) -
925 sizeof (struct mthca_next_seg)) /
926 sizeof (struct mthca_data_seg));
925} 927}
926 928
927/* 929/*