[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.
This commit is contained in:
Michael Brown
2009-07-10 22:31:40 +01:00
parent 94876f4bb6
commit 773028d34e
4 changed files with 104 additions and 71 deletions

View File

@@ -170,9 +170,10 @@ int ib_resolve_path ( struct ib_device *ibdev,
*
* @v gma General management agent
* @v mad MAD
* @ret response MAD response
*/
static void ib_handle_path_record ( struct ib_gma *gma,
union ib_mad *mad ) {
static union ib_mad * ib_handle_path_record ( struct ib_gma *gma,
union ib_mad *mad ) {
struct ib_device *ibdev = gma->ibdev;
struct ib_path_record *path_record = &mad->sa.sa_data.path_record;
struct ib_gid *dgid = &path_record->dgid;
@@ -185,7 +186,7 @@ static void ib_handle_path_record ( struct ib_gma *gma,
if ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ) {
DBGC ( gma, "GMA %p path record lookup failed with status "
"%04x\n", gma, ntohs ( mad->hdr.status ) );
return;
return NULL;
}
/* Extract values from MAD */
@@ -208,6 +209,8 @@ static void ib_handle_path_record ( struct ib_gma *gma,
cached->rate = rate;
cached->sl = sl;
}
return NULL;
}
/** Path record response handler */