Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/siw: Change CQ flags from 64->32 bits

This patch changes the driver/user shared (mmapped) CQ notification
flags field from unsigned 64-bits size to unsigned 32-bits size. This
enables building siw on 32-bit architectures.

This patch changes the siw-abi, but as siw was only just merged in
this merge window cycle, there are no released kernels with the prior
abi. We are making no attempt to be binary compatible with siw user
space libraries prior to the merge of siw into the upstream kernel,
only moving forward with upstream kernels and upstream rdma-core
provided siw libraries are we guaranteeing compatibility.

Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Link: https://lore.kernel.org/r/20190809151816.13018-1-bmt@zurich.ibm.com
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Bernard Metzler and committed by
Doug Ledford
2c8ccb37 932727c5

+25 -12
+1 -1
drivers/infiniband/sw/siw/Kconfig
··· 1 1 config RDMA_SIW 2 2 tristate "Software RDMA over TCP/IP (iWARP) driver" 3 - depends on INET && INFINIBAND && LIBCRC32C && 64BIT 3 + depends on INET && INFINIBAND && LIBCRC32C 4 4 select DMA_VIRT_OPS 5 5 help 6 6 This driver implements the iWARP RDMA transport over
+1 -1
drivers/infiniband/sw/siw/siw.h
··· 214 214 struct siw_cq { 215 215 struct ib_cq base_cq; 216 216 spinlock_t lock; 217 - u64 *notify; 217 + struct siw_cq_ctrl *notify; 218 218 struct siw_cqe *queue; 219 219 u32 cq_put; 220 220 u32 cq_get;
+10 -4
drivers/infiniband/sw/siw/siw_qp.c
··· 1013 1013 */ 1014 1014 static bool siw_cq_notify_now(struct siw_cq *cq, u32 flags) 1015 1015 { 1016 - u64 cq_notify; 1016 + u32 cq_notify; 1017 1017 1018 1018 if (!cq->base_cq.comp_handler) 1019 1019 return false; 1020 1020 1021 - cq_notify = READ_ONCE(*cq->notify); 1021 + /* Read application shared notification state */ 1022 + cq_notify = READ_ONCE(cq->notify->flags); 1022 1023 1023 1024 if ((cq_notify & SIW_NOTIFY_NEXT_COMPLETION) || 1024 1025 ((cq_notify & SIW_NOTIFY_SOLICITED) && 1025 1026 (flags & SIW_WQE_SOLICITED))) { 1026 - /* dis-arm CQ */ 1027 - smp_store_mb(*cq->notify, SIW_NOTIFY_NOT); 1027 + /* 1028 + * CQ notification is one-shot: Since the 1029 + * current CQE causes user notification, 1030 + * the CQ gets dis-aremd and must be re-aremd 1031 + * by the user for a new notification. 1032 + */ 1033 + WRITE_ONCE(cq->notify->flags, SIW_NOTIFY_NOT); 1028 1034 1029 1035 return true; 1030 1036 }
+11 -5
drivers/infiniband/sw/siw/siw_verbs.c
··· 1049 1049 1050 1050 spin_lock_init(&cq->lock); 1051 1051 1052 - cq->notify = &((struct siw_cq_ctrl *)&cq->queue[size])->notify; 1052 + cq->notify = (struct siw_cq_ctrl *)&cq->queue[size]; 1053 1053 1054 1054 if (udata) { 1055 1055 struct siw_uresp_create_cq uresp = {}; ··· 1141 1141 siw_dbg_cq(cq, "flags: 0x%02x\n", flags); 1142 1142 1143 1143 if ((flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED) 1144 - /* CQ event for next solicited completion */ 1145 - smp_store_mb(*cq->notify, SIW_NOTIFY_SOLICITED); 1144 + /* 1145 + * Enable CQ event for next solicited completion. 1146 + * and make it visible to all associated producers. 1147 + */ 1148 + smp_store_mb(cq->notify->flags, SIW_NOTIFY_SOLICITED); 1146 1149 else 1147 - /* CQ event for any signalled completion */ 1148 - smp_store_mb(*cq->notify, SIW_NOTIFY_ALL); 1150 + /* 1151 + * Enable CQ event for any signalled completion. 1152 + * and make it visible to all associated producers. 1153 + */ 1154 + smp_store_mb(cq->notify->flags, SIW_NOTIFY_ALL); 1149 1155 1150 1156 if (flags & IB_CQ_REPORT_MISSED_EVENTS) 1151 1157 return cq->cq_put - cq->cq_get;
+2 -1
include/uapi/rdma/siw-abi.h
··· 180 180 * to control CQ arming. 181 181 */ 182 182 struct siw_cq_ctrl { 183 - __aligned_u64 notify; 183 + __u32 flags; 184 + __u32 pad; 184 185 }; 185 186 #endif