|
1 # This patch is fix for the Bug-22995977 |
|
2 # It is developed By solaris PSIF team. We plan to have a common upstream repo |
|
3 # and submit these changes to it, but do not yet have a target date of doing it |
|
4 diff -r 7ecef74fde26 src/sndrcv.c |
|
5 --- a/src/sndrcv.c Wed Jul 20 03:09:52 2016 -0700 |
|
6 +++ b/src/sndrcv.c Wed Jul 20 04:48:09 2016 -0700 |
|
7 @@ -68,6 +68,9 @@ |
|
8 #define CB_KICK_MASK (CB_KICK_ALIGN - 1) |
|
9 |
|
10 #define SQS_ACTIVE (get_psif_sq_hw__sq_next(qp->sq.hw) != 0xFFFFFFFF) |
|
11 + |
|
12 +bool reliable_qp(enum ibv_qp_type type); |
|
13 + |
|
14 #ifdef _ILP32 |
|
15 int sif_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr) |
|
16 { |
|
17 @@ -96,6 +99,13 @@ |
|
18 struct sif_qp *qp = to_sqp(ibqp); |
|
19 struct sif_sq *sq = &qp->sq; |
|
20 |
|
21 +#ifdef HAVE_VERBS_REGISTER_DRIVER |
|
22 + struct ibv_qp *ibv_qp = &qp->verbs_qp.qp; |
|
23 +#else |
|
24 + struct ibv_qp *ibv_qp = &qp->ibv_qp; |
|
25 +#endif |
|
26 + |
|
27 + |
|
28 if (!qp->sq.m.sz) /* no user space mappings, go via kernel */ |
|
29 return ibv_cmd_post_send(ibqp, wr, bad_wr); |
|
30 |
|
31 @@ -128,16 +138,43 @@ |
|
32 } |
|
33 pthread_mutex_unlock(&sq->lock); |
|
34 } |
|
35 + if (reliable_qp(ibv_qp->qp_type) |
|
36 + && ibv_qp->state == IBV_QPS_ERR) { |
|
37 + ret = 0; |
|
38 + goto flush_sq_wa4074; |
|
39 + } |
|
40 |
|
41 return 0; |
|
42 |
|
43 err_post_send: |
|
44 pthread_mutex_unlock(&sq->lock); |
|
45 *bad_wr = wr; |
|
46 + |
|
47 +flush_sq_wa4074: |
|
48 + /* WA #4074, issue SQ flush if QP in ERROR. */ |
|
49 +#if SIF_UVERBS_ABI_VERSION > SIF_UVERBS_VERSION(3,3) |
|
50 + if (reliable_qp(ibv_qp->qp_type) |
|
51 + && ibv_qp->state == IBV_QPS_ERR) { |
|
52 + |
|
53 + struct sif_context *uc = to_sctx(ibqp->context); |
|
54 + struct ibv_qp_attr attr; |
|
55 + memset(&attr, 0, sizeof(attr)); |
|
56 + |
|
57 + if (flush_qp(ibv_qp, &attr, FLUSH_SQ)) |
|
58 + sif_log(uc, SIF_INFO, "failed to flush SQ, QP %d", |
|
59 + ibv_qp->qp_num); |
|
60 + } |
|
61 +#endif |
|
62 + |
|
63 return ret; |
|
64 } |
|
65 #undef SQS_ACTIVE |
|
66 |
|
67 +bool reliable_qp(enum ibv_qp_type type) |
|
68 +{ |
|
69 + return (type == IBV_QPT_RC); |
|
70 +} |
|
71 + |
|
72 /* Return bypass mode offset or 0 if invalid for post_sends (see below) |
|
73 * (PSIF will take care of rejecting the post) |
|
74 */ |
|
75 @@ -225,9 +262,12 @@ |
|
76 "next_seq %x length %d", rq->entries, rq->extent, |
|
77 rq->index, rq->m.base, rq->sw->next_seq, rq->sw->length); |
|
78 } |
|
79 - /* Notify hw of new entries */ |
|
80 + |
|
81 + /* Enforce ordering of new rq entries and tail */ |
|
82 wmb(); |
|
83 set_psif_rq_sw__tail_indx(&rq->sw->d, rq->sw->next_seq); |
|
84 + /* Enforce visibility of rq tail on hw */ |
|
85 + wmb(); |
|
86 |
|
87 sif_log(uc, SIF_RCV, "Exit: success"); |
|
88 err_post_recv: |
|
89 diff -r 7ecef74fde26 src/uverbs.c |
|
90 --- a/src/uverbs.c Wed Jul 20 03:09:52 2016 -0700 |
|
91 +++ b/src/uverbs.c Wed Jul 20 04:48:09 2016 -0700 |
|
92 @@ -388,7 +388,7 @@ |
|
93 #if defined(__SVR4) && defined(__sun) |
|
94 cq->m.sz = page_align(cq->m.sz); |
|
95 off64_t offset = mmap_set_cmd(SIF_MAP_CQ, cq->index); |
|
96 - cq->m.base = mmap64(NULL, cq->m.sz, PROT_READ, MAP_SHARED, fd, offset); |
|
97 + cq->m.base = mmap64(NULL, cq->m.sz, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset); |
|
98 #else |
|
99 off_t offset = mmap_set_cmd(SIF_MAP_CQ, cq->index); |
|
100 cq->m.base = mmap(NULL, cq->m.sz, PROT_READ, MAP_SHARED, fd, offset); |