|
@@ -122,6 +122,25 @@ struct ib_mad_agent ib_cm_agent[] __ib_mad_agent = {
|
122
|
122
|
},
|
123
|
123
|
};
|
124
|
124
|
|
|
125
|
+
|
|
126
|
+ * Convert connection rejection reason to return status code
|
|
127
|
+ *
|
|
128
|
+ * @v reason Rejection reason (in network byte order)
|
|
129
|
+ * @ret rc Return status code
|
|
130
|
+ */
|
|
131
|
+static int ib_cm_rejection_reason_to_rc ( uint16_t reason ) {
|
|
132
|
+ switch ( reason ) {
|
|
133
|
+ case htons ( IB_CM_REJECT_BAD_SERVICE_ID ) :
|
|
134
|
+ return -ENODEV;
|
|
135
|
+ case htons ( IB_CM_REJECT_STALE_CONN ) :
|
|
136
|
+ return -EALREADY;
|
|
137
|
+ case htons ( IB_CM_REJECT_CONSUMER ) :
|
|
138
|
+ return -ENOTTY;
|
|
139
|
+ default:
|
|
140
|
+ return -EPERM;
|
|
141
|
+ }
|
|
142
|
+}
|
|
143
|
+
|
125
|
144
|
|
126
|
145
|
* Handle connection request transaction completion
|
127
|
146
|
*
|
|
@@ -189,9 +208,12 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
|
189
|
208
|
|
190
|
209
|
DBGC ( conn, "CM %p connection rejected (reason %d)\n",
|
191
|
210
|
conn, ntohs ( connect_rej->reason ) );
|
192
|
|
- private_data = &connect_rej->private_data;
|
193
|
|
- private_data_len = sizeof ( connect_rej->private_data );
|
194
|
|
- rc = -ENOTCONN;
|
|
211
|
+
|
|
212
|
+ if ( connect_rej->reason == htons ( IB_CM_REJECT_CONSUMER ) ) {
|
|
213
|
+ private_data = &connect_rej->private_data;
|
|
214
|
+ private_data_len = sizeof (connect_rej->private_data);
|
|
215
|
+ }
|
|
216
|
+ rc = ib_cm_rejection_reason_to_rc ( connect_rej->reason );
|
195
|
217
|
break;
|
196
|
218
|
|
197
|
219
|
default:
|