Browse Source

[infiniband] Allow MAD handlers to indicate response via return value

Now that MAD handlers no longer return a status code, we can allow
them to return a pointer to a MAD structure if and only if they want
to send a response.  This provides a more natural and flexible
approach than using a "response method" field within the handler's
descriptor.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
773028d34e

+ 4
- 9
src/include/gpxe/ib_gma.h View File

26
 	uint8_t class_version;
26
 	uint8_t class_version;
27
 	/** Method */
27
 	/** Method */
28
 	uint8_t method;
28
 	uint8_t method;
29
-	/** Response method, or zero */
30
-	uint8_t resp_method;
31
 	/** Attribute (in network byte order) */
29
 	/** Attribute (in network byte order) */
32
 	uint16_t attr_id;
30
 	uint16_t attr_id;
33
 	/** Handle attribute
31
 	/** Handle attribute
34
 	 *
32
 	 *
35
-	 * @v gma	General management agent
36
-	 * @v mad	MAD
37
-	 *
38
-	 * The handler should modify the MAD as applicable.  If the
39
-	 * handler returns with a non-zero value in the MAD's @c
40
-	 * method field, it will be sent as a response.
33
+	 * @v gma		General management agent
34
+	 * @v mad		MAD
35
+	 * @ret response	MAD response, or NULL to send no response
41
 	 */
36
 	 */
42
-	void ( * handle ) ( struct ib_gma *gma, union ib_mad *mad );
37
+	union ib_mad * ( * handle ) ( struct ib_gma *gma, union ib_mad *mad );
43
 };
38
 };
44
 
39
 
45
 /** GMA attribute handlers */
40
 /** GMA attribute handlers */

+ 80
- 51
src/net/infiniband/ib_gma.c View File

81
  *****************************************************************************
81
  *****************************************************************************
82
  */
82
  */
83
 
83
 
84
+/**
85
+ * Construct directed route response, if necessary
86
+ *
87
+ * @v gma		General management agent
88
+ * @v mad		MAD response without DR fields filled in
89
+ * @ret mad		MAD response with DR fields filled in
90
+ */
91
+static union ib_mad * ib_sma_dr_response ( struct ib_gma *gma,
92
+					   union ib_mad *mad ) {
93
+	struct ib_mad_hdr *hdr = &mad->hdr;
94
+	struct ib_mad_smp *smp = &mad->smp;
95
+	unsigned int hop_pointer;
96
+	unsigned int hop_count;
97
+
98
+	/* Set response fields for directed route SMPs */
99
+	if ( hdr->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE ) {
100
+		hdr->status |= htons ( IB_SMP_STATUS_D_INBOUND );
101
+		hop_pointer = smp->mad_hdr.class_specific.smp.hop_pointer;
102
+		hop_count = smp->mad_hdr.class_specific.smp.hop_count;
103
+		assert ( hop_count == hop_pointer );
104
+		if ( hop_pointer < ( sizeof ( smp->return_path.hops ) /
105
+				     sizeof ( smp->return_path.hops[0] ) ) ) {
106
+			smp->return_path.hops[hop_pointer] = gma->ibdev->port;
107
+		} else {
108
+			DBGC ( gma, "GMA %p invalid hop pointer %d\n",
109
+			       gma, hop_pointer );
110
+			return NULL;
111
+		}
112
+	}
113
+
114
+	return mad;
115
+}
116
+
84
 /**
117
 /**
85
  * Get node information
118
  * Get node information
86
  *
119
  *
87
  * @v gma		General management agent
120
  * @v gma		General management agent
88
  * @v mad		MAD
121
  * @v mad		MAD
122
+ * @ret response	MAD response
89
  */
123
  */
90
-static void ib_sma_get_node_info ( struct ib_gma *gma,
91
-				   union ib_mad *mad ) {
124
+static union ib_mad * ib_sma_get_node_info ( struct ib_gma *gma,
125
+					     union ib_mad *mad ) {
92
 	struct ib_device *ibdev = gma->ibdev;
126
 	struct ib_device *ibdev = gma->ibdev;
93
 	struct ib_node_info *node_info = &mad->smp.smp_data.node_info;
127
 	struct ib_node_info *node_info = &mad->smp.smp_data.node_info;
94
 
128
 
103
 		 sizeof ( node_info->port_guid ) );
137
 		 sizeof ( node_info->port_guid ) );
104
 	node_info->partition_cap = htons ( 1 );
138
 	node_info->partition_cap = htons ( 1 );
105
 	node_info->local_port_num = ibdev->port;
139
 	node_info->local_port_num = ibdev->port;
140
+
141
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
142
+	return ib_sma_dr_response ( gma, mad );
106
 }
143
 }
107
 
144
 
108
 /**
145
 /**
110
  *
147
  *
111
  * @v gma		General management agent
148
  * @v gma		General management agent
112
  * @v mad		MAD
149
  * @v mad		MAD
150
+ * @ret response	MAD response
113
  */
151
  */
114
-static void ib_sma_get_node_desc ( struct ib_gma *gma,
115
-				   union ib_mad *mad ) {
152
+static union ib_mad * ib_sma_get_node_desc ( struct ib_gma *gma,
153
+					     union ib_mad *mad ) {
116
 	struct ib_device *ibdev = gma->ibdev;
154
 	struct ib_device *ibdev = gma->ibdev;
117
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
155
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
118
 	struct ib_gid_half *guid = &ibdev->gid.u.half[1];
156
 	struct ib_gid_half *guid = &ibdev->gid.u.half[1];
123
 		   guid->bytes[0], guid->bytes[1], guid->bytes[2],
161
 		   guid->bytes[0], guid->bytes[1], guid->bytes[2],
124
 		   guid->bytes[3], guid->bytes[4], guid->bytes[5],
162
 		   guid->bytes[3], guid->bytes[4], guid->bytes[5],
125
 		   guid->bytes[6], guid->bytes[7], ibdev->dev->name );
163
 		   guid->bytes[6], guid->bytes[7], ibdev->dev->name );
164
+
165
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
166
+	return ib_sma_dr_response ( gma, mad );
126
 }
167
 }
127
 
168
 
128
 /**
169
 /**
130
  *
171
  *
131
  * @v gma		General management agent
172
  * @v gma		General management agent
132
  * @v mad		MAD
173
  * @v mad		MAD
174
+ * @ret response	MAD response
133
  */
175
  */
134
-static void ib_sma_get_guid_info ( struct ib_gma *gma,
135
-				   union ib_mad *mad ) {
176
+static union ib_mad * ib_sma_get_guid_info ( struct ib_gma *gma,
177
+					     union ib_mad *mad ) {
136
 	struct ib_device *ibdev = gma->ibdev;
178
 	struct ib_device *ibdev = gma->ibdev;
137
 	struct ib_guid_info *guid_info = &mad->smp.smp_data.guid_info;
179
 	struct ib_guid_info *guid_info = &mad->smp.smp_data.guid_info;
138
 
180
 
139
 	memset ( guid_info, 0, sizeof ( *guid_info ) );
181
 	memset ( guid_info, 0, sizeof ( *guid_info ) );
140
 	memcpy ( guid_info->guid[0], &ibdev->gid.u.half[1],
182
 	memcpy ( guid_info->guid[0], &ibdev->gid.u.half[1],
141
 		 sizeof ( guid_info->guid[0] ) );
183
 		 sizeof ( guid_info->guid[0] ) );
184
+
185
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
186
+	return ib_sma_dr_response ( gma, mad );
142
 }
187
 }
143
 
188
 
144
 /**
189
 /**
146
  *
191
  *
147
  * @v gma		General management agent
192
  * @v gma		General management agent
148
  * @v mad		MAD
193
  * @v mad		MAD
194
+ * @ret response	MAD response
149
  */
195
  */
150
-static void ib_sma_get_port_info ( struct ib_gma *gma,
151
-				   union ib_mad *mad ) {
196
+static union ib_mad * ib_sma_get_port_info ( struct ib_gma *gma,
197
+					     union ib_mad *mad ) {
152
 	struct ib_device *ibdev = gma->ibdev;
198
 	struct ib_device *ibdev = gma->ibdev;
153
 	struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
199
 	struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
154
 
200
 
174
 	port_info->init_type_reply__mtu_cap = IB_MTU_2048;
220
 	port_info->init_type_reply__mtu_cap = IB_MTU_2048;
175
 	port_info->operational_vls__enforcement = ( IB_VL_0 << 4 );
221
 	port_info->operational_vls__enforcement = ( IB_VL_0 << 4 );
176
 	port_info->guid_cap = 1;
222
 	port_info->guid_cap = 1;
223
+
224
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
225
+	return ib_sma_dr_response ( gma, mad );
177
 }
226
 }
178
 
227
 
179
 /**
228
 /**
181
  *
230
  *
182
  * @v gma		General management agent
231
  * @v gma		General management agent
183
  * @v mad		MAD
232
  * @v mad		MAD
233
+ * @ret response	MAD response
184
  */
234
  */
185
-static void ib_sma_set_port_info ( struct ib_gma *gma,
186
-				   union ib_mad *mad ) {
235
+static union ib_mad * ib_sma_set_port_info ( struct ib_gma *gma,
236
+					     union ib_mad *mad ) {
187
 	struct ib_device *ibdev = gma->ibdev;
237
 	struct ib_device *ibdev = gma->ibdev;
188
 	const struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
238
 	const struct ib_port_info *port_info = &mad->smp.smp_data.port_info;
189
 	int rc;
239
 	int rc;
201
 			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
251
 			htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
202
 	}
252
 	}
203
 
253
 
204
-	ib_sma_get_port_info ( gma, mad );
254
+	return ib_sma_get_port_info ( gma, mad );
205
 }
255
 }
206
 
256
 
207
 /**
257
 /**
209
  *
259
  *
210
  * @v gma		General management agent
260
  * @v gma		General management agent
211
  * @v mad		MAD
261
  * @v mad		MAD
262
+ * @ret response	MAD response
212
  */
263
  */
213
-static void ib_sma_get_pkey_table ( struct ib_gma *gma,
214
-				    union ib_mad *mad ) {
264
+static union ib_mad * ib_sma_get_pkey_table ( struct ib_gma *gma,
265
+					      union ib_mad *mad ) {
215
 	struct ib_device *ibdev = gma->ibdev;
266
 	struct ib_device *ibdev = gma->ibdev;
216
 	struct ib_pkey_table *pkey_table = &mad->smp.smp_data.pkey_table;
267
 	struct ib_pkey_table *pkey_table = &mad->smp.smp_data.pkey_table;
217
 
268
 
269
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
218
 	memset ( pkey_table, 0, sizeof ( *pkey_table ) );
270
 	memset ( pkey_table, 0, sizeof ( *pkey_table ) );
219
 	pkey_table->pkey[0] = htons ( ibdev->pkey );
271
 	pkey_table->pkey[0] = htons ( ibdev->pkey );
272
+
273
+	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
274
+	return ib_sma_dr_response ( gma, mad );
220
 }
275
 }
221
 
276
 
222
 /**
277
 /**
224
  *
279
  *
225
  * @v gma		General management agent
280
  * @v gma		General management agent
226
  * @v mad		MAD
281
  * @v mad		MAD
282
+ * @ret response	MAD response
227
  */
283
  */
228
-static void ib_sma_set_pkey_table ( struct ib_gma *gma,
229
-				    union ib_mad *mad ) {
284
+static union ib_mad * ib_sma_set_pkey_table ( struct ib_gma *gma,
285
+					      union ib_mad *mad ) {
230
 	struct ib_device *ibdev = gma->ibdev;
286
 	struct ib_device *ibdev = gma->ibdev;
231
 	struct ib_pkey_table *pkey_table = &mad->smp.smp_data.pkey_table;
287
 	struct ib_pkey_table *pkey_table = &mad->smp.smp_data.pkey_table;
232
 
288
 
233
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
289
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
234
 
290
 
235
-	ib_sma_get_pkey_table ( gma, mad );
291
+	return ib_sma_get_pkey_table ( gma, mad );
236
 }
292
 }
237
 
293
 
238
 /** List of attribute handlers */
294
 /** List of attribute handlers */
242
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
298
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
243
 		.class_version = IB_SMP_CLASS_VERSION,
299
 		.class_version = IB_SMP_CLASS_VERSION,
244
 		.method = IB_MGMT_METHOD_GET,
300
 		.method = IB_MGMT_METHOD_GET,
245
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
246
 		.attr_id = htons ( IB_SMP_ATTR_NODE_INFO ),
301
 		.attr_id = htons ( IB_SMP_ATTR_NODE_INFO ),
247
 		.handle = ib_sma_get_node_info,
302
 		.handle = ib_sma_get_node_info,
248
 	},
303
 	},
251
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
306
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
252
 		.class_version = IB_SMP_CLASS_VERSION,
307
 		.class_version = IB_SMP_CLASS_VERSION,
253
 		.method = IB_MGMT_METHOD_GET,
308
 		.method = IB_MGMT_METHOD_GET,
254
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
255
 		.attr_id = htons ( IB_SMP_ATTR_NODE_DESC ),
309
 		.attr_id = htons ( IB_SMP_ATTR_NODE_DESC ),
256
 		.handle = ib_sma_get_node_desc,
310
 		.handle = ib_sma_get_node_desc,
257
 	},
311
 	},
260
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
314
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
261
 		.class_version = IB_SMP_CLASS_VERSION,
315
 		.class_version = IB_SMP_CLASS_VERSION,
262
 		.method = IB_MGMT_METHOD_GET,
316
 		.method = IB_MGMT_METHOD_GET,
263
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
264
 		.attr_id = htons ( IB_SMP_ATTR_GUID_INFO ),
317
 		.attr_id = htons ( IB_SMP_ATTR_GUID_INFO ),
265
 		.handle = ib_sma_get_guid_info,
318
 		.handle = ib_sma_get_guid_info,
266
 	},
319
 	},
269
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
322
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
270
 		.class_version = IB_SMP_CLASS_VERSION,
323
 		.class_version = IB_SMP_CLASS_VERSION,
271
 		.method = IB_MGMT_METHOD_GET,
324
 		.method = IB_MGMT_METHOD_GET,
272
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
273
 		.attr_id = htons ( IB_SMP_ATTR_PORT_INFO ),
325
 		.attr_id = htons ( IB_SMP_ATTR_PORT_INFO ),
274
 		.handle = ib_sma_get_port_info,
326
 		.handle = ib_sma_get_port_info,
275
 	},
327
 	},
278
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
330
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
279
 		.class_version = IB_SMP_CLASS_VERSION,
331
 		.class_version = IB_SMP_CLASS_VERSION,
280
 		.method = IB_MGMT_METHOD_SET,
332
 		.method = IB_MGMT_METHOD_SET,
281
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
282
 		.attr_id = htons ( IB_SMP_ATTR_PORT_INFO ),
333
 		.attr_id = htons ( IB_SMP_ATTR_PORT_INFO ),
283
 		.handle = ib_sma_set_port_info,
334
 		.handle = ib_sma_set_port_info,
284
 	},
335
 	},
287
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
338
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
288
 		.class_version = IB_SMP_CLASS_VERSION,
339
 		.class_version = IB_SMP_CLASS_VERSION,
289
 		.method = IB_MGMT_METHOD_GET,
340
 		.method = IB_MGMT_METHOD_GET,
290
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
291
 		.attr_id = htons ( IB_SMP_ATTR_PKEY_TABLE ),
341
 		.attr_id = htons ( IB_SMP_ATTR_PKEY_TABLE ),
292
 		.handle = ib_sma_get_pkey_table,
342
 		.handle = ib_sma_get_pkey_table,
293
 	},
343
 	},
296
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
346
 		.mgmt_class_ignore = IB_SMP_CLASS_IGNORE,
297
 		.class_version = IB_SMP_CLASS_VERSION,
347
 		.class_version = IB_SMP_CLASS_VERSION,
298
 		.method = IB_MGMT_METHOD_SET,
348
 		.method = IB_MGMT_METHOD_SET,
299
-		.resp_method = IB_MGMT_METHOD_GET_RESP,
300
 		.attr_id = htons ( IB_SMP_ATTR_PKEY_TABLE ),
349
 		.attr_id = htons ( IB_SMP_ATTR_PKEY_TABLE ),
301
 		.handle = ib_sma_set_pkey_table,
350
 		.handle = ib_sma_set_pkey_table,
302
 	},
351
 	},
314
  *
363
  *
315
  * @v gma		General management agent
364
  * @v gma		General management agent
316
  * @v mad		MAD
365
  * @v mad		MAD
366
+ * @ret mad		MAD response
317
  */
367
  */
318
-static void ib_handle_mad ( struct ib_gma *gma, union ib_mad *mad ) {
368
+static union ib_mad * ib_handle_mad ( struct ib_gma *gma, union ib_mad *mad ) {
319
 	struct ib_mad_hdr *hdr = &mad->hdr;
369
 	struct ib_mad_hdr *hdr = &mad->hdr;
320
 	struct ib_gma_handler *handler;
370
 	struct ib_gma_handler *handler;
321
 
371
 
325
 		     ( handler->class_version == hdr->class_version ) &&
375
 		     ( handler->class_version == hdr->class_version ) &&
326
 		     ( handler->method == hdr->method ) &&
376
 		     ( handler->method == hdr->method ) &&
327
 		     ( handler->attr_id == hdr->attr_id ) ) {
377
 		     ( handler->attr_id == hdr->attr_id ) ) {
328
-			hdr->method = handler->resp_method;
329
-			handler->handle ( gma, mad );
330
-			return;
378
+			return handler->handle ( gma, mad );
331
 		}
379
 		}
332
 	}
380
 	}
333
 
381
 
334
 	hdr->method = IB_MGMT_METHOD_TRAP;
382
 	hdr->method = IB_MGMT_METHOD_TRAP;
335
 	hdr->status = htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
383
 	hdr->status = htons ( IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR );
384
+	return mad;
336
 }
385
 }
337
 
386
 
338
 /**
387
 /**
353
 	struct ib_mad_request *request;
402
 	struct ib_mad_request *request;
354
 	union ib_mad *mad;
403
 	union ib_mad *mad;
355
 	struct ib_mad_hdr *hdr;
404
 	struct ib_mad_hdr *hdr;
356
-	unsigned int hop_pointer;
357
-	unsigned int hop_count;
405
+	union ib_mad *response;
358
 
406
 
359
 	/* Ignore errors */
407
 	/* Ignore errors */
360
 	if ( rc != 0 ) {
408
 	if ( rc != 0 ) {
395
 	}
443
 	}
396
 
444
 
397
 	/* Handle MAD */
445
 	/* Handle MAD */
398
-	ib_handle_mad ( gma, mad );
399
-
400
-	/* Finish processing if we have no response to send */
401
-	if ( ! hdr->method )
446
+	if ( ( response = ib_handle_mad ( gma, mad ) ) == NULL )
402
 		goto out;
447
 		goto out;
403
 
448
 
449
+	/* Re-use I/O buffer for response */
450
+	memcpy ( mad, response, sizeof ( *mad ) );
404
 	DBGC ( gma, "GMA %p TX TID %08x%08x (%02x,%02x,%02x,%04x) status "
451
 	DBGC ( gma, "GMA %p TX TID %08x%08x (%02x,%02x,%02x,%04x) status "
405
 	       "%04x\n", gma, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
452
 	       "%04x\n", gma, ntohl ( hdr->tid[0] ), ntohl ( hdr->tid[1] ),
406
 	       hdr->mgmt_class, hdr->class_version, hdr->method,
453
 	       hdr->mgmt_class, hdr->class_version, hdr->method,
407
 	       ntohs ( hdr->attr_id ), ntohs ( hdr->status ) );
454
 	       ntohs ( hdr->attr_id ), ntohs ( hdr->status ) );
408
 	DBGC2_HDA ( gma, 0, mad, sizeof ( *mad ) );
455
 	DBGC2_HDA ( gma, 0, mad, sizeof ( *mad ) );
409
 
456
 
410
-	/* Set response fields for directed route SMPs */
411
-	if ( hdr->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE ) {
412
-		struct ib_mad_smp *smp = &mad->smp;
413
-
414
-		hdr->status |= htons ( IB_SMP_STATUS_D_INBOUND );
415
-		hop_pointer = smp->mad_hdr.class_specific.smp.hop_pointer;
416
-		hop_count = smp->mad_hdr.class_specific.smp.hop_count;
417
-		assert ( hop_count == hop_pointer );
418
-		if ( hop_pointer < ( sizeof ( smp->return_path.hops ) /
419
-				     sizeof ( smp->return_path.hops[0] ) ) ) {
420
-			smp->return_path.hops[hop_pointer] = ibdev->port;
421
-		} else {
422
-			DBGC ( gma, "GMA %p invalid hop pointer %d\n",
423
-			       gma, hop_pointer );
424
-			goto out;
425
-		}
426
-	}
427
-
428
 	/* Send MAD response, if applicable */
457
 	/* Send MAD response, if applicable */
429
 	if ( ( rc = ib_post_send ( ibdev, qp, av,
458
 	if ( ( rc = ib_post_send ( ibdev, qp, av,
430
 				   iob_disown ( iobuf ) ) ) != 0 ) {
459
 				   iob_disown ( iobuf ) ) ) != 0 ) {

+ 14
- 8
src/net/infiniband/ib_mcast.c View File

139
  *
139
  *
140
  * @v gma		General management agent
140
  * @v gma		General management agent
141
  * @v mad		MAD
141
  * @v mad		MAD
142
+ * @ret mad		MAD response
142
  */
143
  */
143
-static void ib_handle_mc_member_join ( struct ib_gma *gma,
144
-				       union ib_mad *mad ) {
144
+static union ib_mad * ib_handle_mc_member_join ( struct ib_gma *gma,
145
+						 union ib_mad *mad ) {
145
 	struct ib_device *ibdev = gma->ibdev;
146
 	struct ib_device *ibdev = gma->ibdev;
146
 	struct ib_mc_member_record *mc_member_record =
147
 	struct ib_mc_member_record *mc_member_record =
147
 		&mad->sa.sa_data.mc_member_record;
148
 		&mad->sa.sa_data.mc_member_record;
154
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
155
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
155
 		DBGC ( gma, "GMA %p join failed with status %04x\n",
156
 		DBGC ( gma, "GMA %p join failed with status %04x\n",
156
 		       gma, ntohs ( mad->hdr.status ) );
157
 		       gma, ntohs ( mad->hdr.status ) );
157
-		return;
158
+		return NULL;
158
 	}
159
 	}
159
 
160
 
160
 	/* Extract MAD parameters */
161
 	/* Extract MAD parameters */
169
 		       ntohl ( gid->u.dwords[1] ),
170
 		       ntohl ( gid->u.dwords[1] ),
170
 		       ntohl ( gid->u.dwords[2] ),
171
 		       ntohl ( gid->u.dwords[2] ),
171
 		       ntohl ( gid->u.dwords[3] ) );
172
 		       ntohl ( gid->u.dwords[3] ) );
172
-		return;
173
+		return NULL;
173
 	}
174
 	}
174
 	DBGC ( gma, "GMA %p QPN %lx joined %08x:%08x:%08x:%08x qkey %lx\n",
175
 	DBGC ( gma, "GMA %p QPN %lx joined %08x:%08x:%08x:%08x qkey %lx\n",
175
 	       gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
176
 	       gma, qp->qpn, ntohl ( gid->u.dwords[0] ),
180
 	if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
181
 	if ( ( rc = ib_modify_qp ( ibdev, qp, IB_MODIFY_QKEY, qkey ) ) != 0 ) {
181
 		DBGC ( gma, "GMA %p QPN %lx could not modify qkey: %s\n",
182
 		DBGC ( gma, "GMA %p QPN %lx could not modify qkey: %s\n",
182
 		       gma, qp->qpn, strerror ( rc ) );
183
 		       gma, qp->qpn, strerror ( rc ) );
183
-		return;
184
+		return NULL;
184
 	}
185
 	}
186
+
187
+	return NULL;
185
 }
188
 }
186
 
189
 
187
 /**
190
 /**
189
  *
192
  *
190
  * @v gma		General management agent
193
  * @v gma		General management agent
191
  * @v mad		MAD
194
  * @v mad		MAD
195
+ * @v response		MAD response
192
  */
196
  */
193
-static void ib_handle_mc_member_leave ( struct ib_gma *gma,
194
-					union ib_mad *mad ) {
197
+static union ib_mad * ib_handle_mc_member_leave ( struct ib_gma *gma,
198
+						  union ib_mad *mad ) {
195
 	struct ib_mc_member_record *mc_member_record =
199
 	struct ib_mc_member_record *mc_member_record =
196
 		&mad->sa.sa_data.mc_member_record;
200
 		&mad->sa.sa_data.mc_member_record;
197
 	struct ib_gid *gid;
201
 	struct ib_gid *gid;
200
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
204
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
201
 		DBGC ( gma, "GMA %p leave failed with status %04x\n",
205
 		DBGC ( gma, "GMA %p leave failed with status %04x\n",
202
 		       gma, ntohs ( mad->hdr.status ) );
206
 		       gma, ntohs ( mad->hdr.status ) );
203
-		return;
207
+		return NULL;
204
 	}
208
 	}
205
 
209
 
206
 	/* Extract MAD parameters */
210
 	/* Extract MAD parameters */
208
 	DBGC ( gma, "GMA %p left %08x:%08x:%08x:%08x\n", gma,
212
 	DBGC ( gma, "GMA %p left %08x:%08x:%08x:%08x\n", gma,
209
 	       ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
213
 	       ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
210
 	       ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ) );
214
 	       ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ) );
215
+
216
+	return NULL;
211
 }
217
 }
212
 
218
 
213
 /** Multicast membership record response handler */
219
 /** Multicast membership record response handler */

+ 6
- 3
src/net/infiniband/ib_pathrec.c View File

170
  *
170
  *
171
  * @v gma		General management agent
171
  * @v gma		General management agent
172
  * @v mad		MAD
172
  * @v mad		MAD
173
+ * @ret response	MAD response
173
  */
174
  */
174
-static void ib_handle_path_record ( struct ib_gma *gma,
175
-				    union ib_mad *mad ) {
175
+static union ib_mad * ib_handle_path_record ( struct ib_gma *gma,
176
+					      union ib_mad *mad ) {
176
 	struct ib_device *ibdev = gma->ibdev;
177
 	struct ib_device *ibdev = gma->ibdev;
177
 	struct ib_path_record *path_record = &mad->sa.sa_data.path_record;
178
 	struct ib_path_record *path_record = &mad->sa.sa_data.path_record;
178
 	struct ib_gid *dgid = &path_record->dgid;
179
 	struct ib_gid *dgid = &path_record->dgid;
185
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
186
 	if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
186
 		DBGC ( gma, "GMA %p path record lookup failed with status "
187
 		DBGC ( gma, "GMA %p path record lookup failed with status "
187
 		       "%04x\n", gma, ntohs ( mad->hdr.status ) );
188
 		       "%04x\n", gma, ntohs ( mad->hdr.status ) );
188
-		return;
189
+		return NULL;
189
 	}
190
 	}
190
 
191
 
191
 	/* Extract values from MAD */
192
 	/* Extract values from MAD */
208
 		cached->rate = rate;
209
 		cached->rate = rate;
209
 		cached->sl = sl;
210
 		cached->sl = sl;
210
 	}
211
 	}
212
+
213
+	return NULL;
211
 }
214
 }
212
 
215
 
213
 /** Path record response handler */
216
 /** Path record response handler */

Loading…
Cancel
Save