Commit fd02e803 authored by Eli Cohen's avatar Eli Cohen Committed by Roland Dreier

IB/mthca: Query SRQ srq_limit fixes

Fix endianness handling of srq_limit: it is big-endian in the context
structure, so we need to swab it before returning it.

Also add support for srq_limit query for Tavor (non-MemFree) HCAs.
Signed-off-by: default avatarEli Cohen <eli@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent bfef73fa
...@@ -49,7 +49,8 @@ struct mthca_tavor_srq_context { ...@@ -49,7 +49,8 @@ struct mthca_tavor_srq_context {
__be32 state_pd; __be32 state_pd;
__be32 lkey; __be32 lkey;
__be32 uar; __be32 uar;
__be32 wqe_cnt; __be16 limit_watermark;
__be16 wqe_cnt;
u32 reserved[2]; u32 reserved[2];
}; };
...@@ -369,6 +370,7 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr) ...@@ -369,6 +370,7 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr)
struct mthca_srq *srq = to_msrq(ibsrq); struct mthca_srq *srq = to_msrq(ibsrq);
struct mthca_mailbox *mailbox; struct mthca_mailbox *mailbox;
struct mthca_arbel_srq_context *arbel_ctx; struct mthca_arbel_srq_context *arbel_ctx;
struct mthca_tavor_srq_context *tavor_ctx;
u8 status; u8 status;
int err; int err;
...@@ -382,9 +384,11 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr) ...@@ -382,9 +384,11 @@ int mthca_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr)
if (mthca_is_memfree(dev)) { if (mthca_is_memfree(dev)) {
arbel_ctx = mailbox->buf; arbel_ctx = mailbox->buf;
srq_attr->srq_limit = arbel_ctx->limit_watermark; srq_attr->srq_limit = be16_to_cpu(arbel_ctx->limit_watermark);
} else } else {
srq_attr->srq_limit = 0; tavor_ctx = mailbox->buf;
srq_attr->srq_limit = be16_to_cpu(tavor_ctx->limit_watermark);
}
srq_attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max; srq_attr->max_wr = (mthca_is_memfree(dev)) ? srq->max - 1 : srq->max;
srq_attr->max_sge = srq->max_gs; srq_attr->max_sge = srq->max_gs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment