--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/open-fabrics/libsif/patches/004-Bug23743649.patch Fri Jul 08 02:58:33 2016 -0700
@@ -0,0 +1,98 @@
+# This patch is fix for the Bug-22995977
+# It is developed By solaris PSIF team. We plan to have a common upstream repo
+# and submit these changes to it, but do not yet have a target date of doing it.
+diff -r 1dc0d37edf06 src/sndrcv.c
+--- a/src/sndrcv.c Mon Jun 27 14:10:53 2016 +0530
++++ b/src/sndrcv.c Mon Jun 27 15:34:44 2016 +0530
+@@ -68,6 +68,9 @@
+ #define CB_KICK_MASK (CB_KICK_ALIGN - 1)
+
+ #define SQS_ACTIVE (get_psif_sq_hw__sq_next(qp->sq.hw) != 0xFFFFFFFF)
++
++bool reliable_qp(enum ibv_qp_type type);
++
+ int sif_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr)
+ {
+ int ret = 0;
+@@ -76,6 +79,12 @@
+ struct sif_qp *qp = to_sqp(ibqp);
+ struct sif_sq *sq = &qp->sq;
+
++#ifdef HAVE_VERBS_REGISTER_DRIVER
++ struct ibv_qp *ibv_qp = &qp->verbs_qp.qp;
++#else
++ struct ibv_qp *ibv_qp = &qp->ibv_qp;
++#endif
++
+ if (!qp->sq.m.sz) /* no user space mappings, go via kernel */
+ return ibv_cmd_post_send(ibqp, wr, bad_wr);
+
+@@ -108,16 +117,43 @@
+ }
+ pthread_mutex_unlock(&sq->lock);
+ }
++if (reliable_qp(ibv_qp->qp_type)
++ && ibv_qp->state == IBV_QPS_ERR) {
++ ret = 0;
++ goto flush_sq_wa4074;
++ }
+
+ return 0;
+
+ err_post_send:
+ pthread_mutex_unlock(&sq->lock);
+ *bad_wr = wr;
++
++flush_sq_wa4074:
++ /* WA #4074, issue SQ flush if QP in ERROR. */
++#if SIF_UVERBS_ABI_VERSION > SIF_UVERBS_VERSION(3,3)
++ if (reliable_qp(ibv_qp->qp_type)
++ && ibv_qp->state == IBV_QPS_ERR) {
++
++ struct sif_context *uc = to_sctx(ibqp->context);
++ struct ibv_qp_attr attr;
++ memset(&attr, 0, sizeof(attr));
++
++ if (flush_qp(ibv_qp, &attr, FLUSH_SQ))
++ sif_log(uc, SIF_INFO, "failed to flush SQ, QP %d",
++ ibv_qp->qp_num);
++ }
++#endif
++
+ return ret;
+ }
+ #undef SQS_ACTIVE
+
++bool reliable_qp(enum ibv_qp_type type)
++{
++ return (type == IBV_QPT_RC);
++}
++
+ /* Return bypass mode offset or 0 if invalid for post_sends (see below)
+ * (PSIF will take care of rejecting the post)
+ */
+@@ -205,9 +241,11 @@
+ "next_seq %x length %d", rq->entries, rq->extent,
+ rq->index, rq->m.base, rq->sw->next_seq, rq->sw->length);
+ }
+- /* Notify hw of new entries */
++ /* Enforce ordering of new rq entries and tail */
+ wmb();
+ set_psif_rq_sw__tail_indx(&rq->sw->d, rq->sw->next_seq);
++ /* Enforce visibility of rq tail on hw */
++ wmb();
+
+ sif_log(uc, SIF_RCV, "Exit: success");
+ err_post_recv:
+diff -r 1dc0d37edf06 src/uverbs.c
+--- a/src/uverbs.c Mon Jun 27 14:10:53 2016 +0530
++++ b/src/uverbs.c Mon Jun 27 15:34:44 2016 +0530
+@@ -396,7 +396,7 @@
+ #if defined(__SVR4) && defined(__sun)
+ cq->m.sz = page_align(cq->m.sz);
+ off64_t offset = mmap_set_cmd(SIF_MAP_CQ, cq->index);
+- cq->m.base = mmap64(NULL, cq->m.sz, PROT_READ, MAP_SHARED, fd, offset);
++ cq->m.base = mmap64(NULL, cq->m.sz, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset);
+ #else
+ off_t offset = mmap_set_cmd(SIF_MAP_CQ, cq->index);
+ cq->m.base = mmap(NULL, cq->m.sz, PROT_READ, MAP_SHARED, fd, offset);