From 53d1b5cd28bff4250a8dabba70cf7a56b97d761f Mon Sep 17 00:00:00 2001 From: Knut Omang Date: Fri, 21 Oct 2016 08:23:39 +0200 Subject: [PATCH] sif: cq: transfer headroom attribute to user mode This commit makes sure old libsif versions works with the driver while providing a forward compatible way of making additional changes to the extra headroom in the CQs. We anticipate to be able to trim down the extra entries once we have PQP errors handled transparently. This commit then ensures that the headroom is only set in one place, at the driver side, and that user mode just can pick up the configured headroom from the kernel. This is done by providing the used headroom in a formerly reserved 32 bit field, thus no changes to the packet size is necessary. Nevertheless we increment the abi version from 3.6 to 3.7 to allow libsif to detect whether the headroom field can be trusted. Orabug: 24926265 Signed-off-by: Knut Omang Reviewed-by: franklin --- drivers/infiniband/hw/sif/sif_cq.c | 4 ++++ drivers/infiniband/hw/sif/sif_user.h | 4 ++-- drivers/infiniband/hw/sif/version.c | 6 +++--- drivers/infiniband/hw/sif/versioninfo.h | 8 ++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/sif/sif_cq.c b/drivers/infiniband/hw/sif/sif_cq.c index 2087ea67dc36..46b1ee9da9ae 100644 --- a/drivers/infiniband/hw/sif/sif_cq.c +++ b/drivers/infiniband/hw/sif/sif_cq.c @@ -107,6 +107,8 @@ struct ib_cq *sif_create_cq(struct ib_device *ibdev, int entries, user_mode = false; if (uc->abi_version < 0x0302) /* TBD: Remove - bw comp */ user_mode = !user_mode; + if (uc->abi_version < SIF_UVERBS_VERSION(3, 6)) + user_flags |= no_x_cqe; } cq = create_cq(pd, entries, comp_vector, proxy, user_mode, user_flags); @@ -119,6 +121,8 @@ struct ib_cq *sif_create_cq(struct ib_device *ibdev, int entries, memset(&resp, 0, sizeof(resp)); resp.cq_idx = cq->index; + if (user_mode) + resp.headroom = cq->entries - cq->ibcq.cqe; ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); if (ret) { destroy_cq(cq); diff --git a/drivers/infiniband/hw/sif/sif_user.h b/drivers/infiniband/hw/sif/sif_user.h index 1e62f4806c63..b03974981dcc 100644 --- a/drivers/infiniband/hw/sif/sif_user.h +++ b/drivers/infiniband/hw/sif/sif_user.h @@ -21,7 +21,7 @@ * */ #define SIF_UVERBS_ABI_MAJOR_VERSION 3 -#define SIF_UVERBS_ABI_MINOR_VERSION 6 +#define SIF_UVERBS_ABI_MINOR_VERSION 7 #define SIF_UVERBS_VERSION(x, y) ((x) << 8 | (y)) @@ -129,7 +129,7 @@ struct sif_create_cq_ext { struct sif_create_cq_resp_ext { __u32 cq_idx; - __u32 reserved; + __u32 headroom; /* #of reserved entries (not exposed to the user) in the CQ */ }; struct sif_create_qp_ext { diff --git a/drivers/infiniband/hw/sif/version.c b/drivers/infiniband/hw/sif/version.c index dfc3a07fc9af..e919c3ca07ec 100644 --- a/drivers/infiniband/hw/sif/version.c +++ b/drivers/infiniband/hw/sif/version.c @@ -4,12 +4,12 @@ struct sif_version sif_version = { .git_repo = "sifdrv [origin/master]", -.last_commit = "titan_1.0.5.0 Retest last allocated entry with roundrobin allocation", +.last_commit = "titan_1.0.6.0 cq: transfer headroom attribute to user mode", .git_status = "", -.build_git_time = "Mon, 03 Oct 2016 10:12:59 +0000", +.build_git_time = "Mon, 24 Oct 2016 11:51:44 +0000", .build_user = "komang", .git_psifapi_repo = "psifapi [origin/master]", -.last_psifapi_commit = "titan_1.0.5.0 preparations for venus", +.last_psifapi_commit = "titan_1.0.6.0 preparations for venus", .git_psifapi_status = "", }; diff --git a/drivers/infiniband/hw/sif/versioninfo.h b/drivers/infiniband/hw/sif/versioninfo.h index 36cdafaff1f4..711cce6ec972 100644 --- a/drivers/infiniband/hw/sif/versioninfo.h +++ b/drivers/infiniband/hw/sif/versioninfo.h @@ -1,6 +1,6 @@ /* Misc driver release info */ -#define BUILD_DATE "2016-10-03" -#define BUILD_TIME "10:12:59" -#define BUILD_EPOCH 1475489579 -#define TITAN_RELEASE "1.0.5.0" +#define BUILD_DATE "2016-10-24" +#define BUILD_TIME "11:51:44" +#define BUILD_EPOCH 1477309904 +#define TITAN_RELEASE "1.0.6.0" -- 2.50.1