42
42
* Represents a work completion event. Application will use the pollCQ verbs call to query for completion events.
43
43
*/
44
44
public class IbvWC {
45
- public static int CSIZE = 48 ;
45
+ public static int CSIZE = 48 ;
46
46
47
47
public enum IbvWcStatus {
48
- IBV_WC_SUCCESS , IBV_WC_LOC_LEN_ERR , IBV_WC_LOC_QP_OP_ERR , IBV_WC_LOC_EEC_OP_ERR , IBV_WC_LOC_PROT_ERR , IBV_WC_WR_FLUSH_ERR , IBV_WC_MW_BIND_ERR , IBV_WC_BAD_RESP_ERR , IBV_WC_LOC_ACCESS_ERR , IBV_WC_REM_INV_REQ_ERR , IBV_WC_REM_ACCESS_ERR , IBV_WC_REM_OP_ERR , IBV_WC_RETRY_EXC_ERR , IBV_WC_RNR_RETRY_EXC_ERR , IBV_WC_LOC_RDD_VIOL_ERR , IBV_WC_REM_INV_RD_REQ_ERR , IBV_WC_REM_ABORT_ERR , IBV_WC_INV_EECN_ERR , IBV_WC_INV_EEC_STATE_ERR , IBV_WC_FATAL_ERR , IBV_WC_RESP_TIMEOUT_ERR , IBV_WC_GENERAL_ERR
48
+ IBV_WC_SUCCESS , IBV_WC_LOC_LEN_ERR , IBV_WC_LOC_QP_OP_ERR , IBV_WC_LOC_EEC_OP_ERR , IBV_WC_LOC_PROT_ERR , IBV_WC_WR_FLUSH_ERR , IBV_WC_MW_BIND_ERR , IBV_WC_BAD_RESP_ERR , IBV_WC_LOC_ACCESS_ERR , IBV_WC_REM_INV_REQ_ERR , IBV_WC_REM_ACCESS_ERR , IBV_WC_REM_OP_ERR , IBV_WC_RETRY_EXC_ERR , IBV_WC_RNR_RETRY_EXC_ERR , IBV_WC_LOC_RDD_VIOL_ERR , IBV_WC_REM_INV_RD_REQ_ERR , IBV_WC_REM_ABORT_ERR , IBV_WC_INV_EECN_ERR , IBV_WC_INV_EEC_STATE_ERR , IBV_WC_FATAL_ERR , IBV_WC_RESP_TIMEOUT_ERR , IBV_WC_GENERAL_ERR ;
49
+
50
+ public static IbvWcStatus valueOf (int value ) {
51
+ /* this is slow but ok for debugging purposes */
52
+ for (IbvWcStatus status : values ()) {
53
+ if (status .ordinal () == value ) {
54
+ return status ;
55
+ }
56
+ }
57
+ throw new IllegalArgumentException ();
58
+ }
49
59
};
50
-
60
+
51
61
public enum IbvWcOpcode {
52
62
IBV_WC_SEND (0 ),
53
63
IBV_WC_RDMA_WRITE (1 ),
@@ -62,11 +72,20 @@ public enum IbvWcOpcode {
62
72
IbvWcOpcode (int opcode ) { this .opcode = opcode ; }
63
73
64
74
public int getOpcode () { return opcode ; }
75
+
76
+ public static IbvWcOpcode valueOf (int value ) {
77
+ for (IbvWcOpcode opcode : values ()) {
78
+ if (opcode .getOpcode () == value ) {
79
+ return opcode ;
80
+ }
81
+ }
82
+ throw new IllegalArgumentException ();
83
+ }
65
84
}
66
85
67
86
public static int CQ_OK = 0 ;
68
87
public static int CQ_EMPTY = -1 ;
69
- public static int CQ_POLL_ERR = -2 ;
88
+ public static int CQ_POLL_ERR = -2 ;
70
89
71
90
protected long wr_id ;
72
91
protected int status ;
@@ -81,7 +100,7 @@ public enum IbvWcOpcode {
81
100
protected short slid ;
82
101
protected short sl ;
83
102
protected short dlid_path_bits ;
84
-
103
+
85
104
protected int err ;
86
105
protected boolean isSend ;
87
106
protected short wqIndex ;
@@ -97,7 +116,7 @@ public IbvWC() {
97
116
isSend = false ;
98
117
wqIndex = -1 ;
99
118
}
100
-
119
+
101
120
public IbvWC clone (){
102
121
IbvWC wc = new IbvWC ();
103
122
wc .byte_len = this .byte_len ;
@@ -115,7 +134,7 @@ public IbvWC clone(){
115
134
wc .status = this .status ;
116
135
wc .wqIndex = this .wqIndex ;
117
136
wc .wr_id = this .wr_id ;
118
-
137
+
119
138
return wc ;
120
139
}
121
140
@@ -156,7 +175,7 @@ public void setStatus(int status) {
156
175
}
157
176
158
177
/**
159
- * Represents the opcode of the original operation for this completion event.
178
+ * Represents the opcode of the original operation for this completion event.
160
179
*
161
180
* @return the opcode
162
181
*/
@@ -356,7 +375,7 @@ public void setDlid_path_bits(short dlid_path_bits) {
356
375
public String getClassName () {
357
376
return IbvWC .class .getCanonicalName ();
358
377
}
359
-
378
+
360
379
/**
361
380
* Unsupported.
362
381
*
@@ -473,7 +492,7 @@ public void setTail3(short tail3) {
473
492
public void setDiff (short diff ) {
474
493
this .diff = diff ;
475
494
}
476
-
495
+
477
496
/**
478
497
* Unsupported.
479
498
*
0 commit comments