[openib-general] OpenSM: Don't return NO RECORDS status in response to SA GetTable
Hal Rosenstock
halr at voltaire.com
Wed Jan 19 08:03:16 PST 2005
OpenSM: Don't return NO RECORDS status in response to SA GetTable
Index: osm_sa_vlarb_record.c
===================================================================
--- osm_sa_vlarb_record.c (revision 1582)
+++ osm_sa_vlarb_record.c (working copy)
@@ -509,7 +509,7 @@
"osm_vlarb_rec_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
@@ -603,4 +603,3 @@
Exit:
OSM_LOG_EXIT( p_rcv->p_log );
}
-
Index: osm_sa_lft_record.c
===================================================================
--- osm_sa_lft_record.c (revision 1582)
+++ osm_sa_lft_record.c (working copy)
@@ -453,7 +453,8 @@
"osm_lftr_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) &&
+ (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_service_record.c
===================================================================
--- osm_sa_service_record.c (revision 1582)
+++ osm_sa_service_record.c (working copy)
@@ -391,7 +391,6 @@
goto Exit;
}
-
trim_num_rec = 0;
#ifndef VENDOR_RMPP_SUPPORT
trim_num_rec = (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) /
sizeof(ib_service_record_t);
@@ -468,7 +467,8 @@
p_resp_sr = (ib_service_record_t*)ib_sa_mad_get_payload_ptr(
p_resp_sa_mad );
- if( num_rec == 0 )
+ if( (p_resp_sa_mad->method != IB_MAD_METHOD_GETTABLE_RESP) &&
+ (num_rec == 0))
{
p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
cl_memclr( p_resp_sr, sizeof(*p_resp_sr) );
@@ -835,7 +835,6 @@
p_recvd_service_rec =
(ib_service_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
-
cl_qlist_init(&sr_match_item.sr_list);
sr_match_item.p_service_rec = p_recvd_service_rec;
sr_match_item.comp_mask = p_sa_mad->comp_mask;
@@ -851,7 +850,8 @@
__get_matching_sr,
&context);
- if( cl_qlist_count( &sr_match_item.sr_list ) == 0 )
+ if ((p_sa_mad->method == IB_MAD_METHOD_GET) &&
+ (cl_qlist_count( &sr_match_item.sr_list ) == 0))
{
cl_plock_release(p_rcv->p_lock);
Index: osm_sa_portinfo_record.c
===================================================================
--- osm_sa_portinfo_record.c (revision 1582)
+++ osm_sa_portinfo_record.c (working copy)
@@ -719,7 +719,7 @@
"osm_pir_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_pkey_record.c
===================================================================
--- osm_sa_pkey_record.c (revision 1582)
+++ osm_sa_pkey_record.c (working copy)
@@ -365,7 +365,6 @@
cl_qlist_init( &rec_list );
-
context.p_rcvd_rec = p_rcvd_rec;
context.p_list = &rec_list;
context.comp_mask = p_rcvd_mad->comp_mask;
@@ -457,7 +456,7 @@
"osm_pkey_rec_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_slvl_record.c
===================================================================
--- osm_sa_slvl_record.c (revision 1582)
+++ osm_sa_slvl_record.c (working copy)
@@ -485,7 +485,7 @@
"osm_slvl_rec_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_node_record.c
===================================================================
--- osm_sa_node_record.c (revision 1582)
+++ osm_sa_node_record.c (working copy)
@@ -557,7 +557,7 @@
"osm_nr_rcv_process: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_link_record.c
===================================================================
--- osm_sa_link_record.c (revision 1582)
+++ osm_sa_link_record.c (working copy)
@@ -130,7 +130,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
/**********************************************************************
**********************************************************************/
ib_api_status_t
@@ -284,7 +283,6 @@
}
-
}
else
{
@@ -386,8 +384,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
-
/**********************************************************************
**********************************************************************/
static void
@@ -524,8 +520,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
-
/**********************************************************************
Returns the SA status to return to the client.
**********************************************************************/
@@ -552,6 +546,8 @@
p_lr = (ib_link_record_t*)ib_sa_mad_get_payload_ptr( p_sa_mad );
comp_mask = p_sa_mad->comp_mask;
+ *pp_src_port = NULL;
+ *pp_dest_port = NULL;
if( p_sa_mad->comp_mask & IB_LR_COMPMASK_FROM_LID )
{
@@ -559,10 +555,11 @@
cl_ntoh16(p_lr->from_lid),
(void**)pp_src_port );
- if( (status != CL_SUCCESS) || (*pp_src_port == NULL) )
+ if( ( (status != CL_SUCCESS) || (*pp_src_port == NULL) ) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
/*
- This 'error' is a the client's fault (bad gid) so
+ This 'error' is the client's fault (bad lid) so
don't enter it as an error in our own log.
Return an error response to the client.
*/
@@ -582,10 +579,11 @@
cl_ntoh16(p_lr->to_lid),
(void**)pp_dest_port );
- if( (status != CL_SUCCESS) || (*pp_dest_port == NULL) )
+ if( ( (status != CL_SUCCESS) || (*pp_dest_port == NULL) ) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
/*
- This 'error' is a the client's fault (bad gid) so
+ This 'error' is the client's fault (bad lid) so
don't enter it as an error in our own log.
Return an error response to the client.
*/
@@ -604,7 +602,6 @@
return( sa_status );
}
-
/**********************************************************************
**********************************************************************/
static void
@@ -703,7 +700,6 @@
/* C15-0.1.5 - always return SM_Key = 0 (table 151 p 782) */
p_resp_sa_mad->sm_key = 0;
-
#ifndef VENDOR_RMPP_SUPPORT
/* we support only one packet RMPP - so we will set the first and
last flags for gettable */
@@ -720,7 +716,7 @@
p_resp_lr = (ib_link_record_t*)ib_sa_mad_get_payload_ptr(
p_resp_sa_mad );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
cl_memclr( p_resp_lr, sizeof(*p_resp_lr) );
@@ -762,7 +758,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
/**********************************************************************
**********************************************************************/
void
@@ -810,7 +805,6 @@
goto Exit;
}
-
if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
osm_dump_link_record( p_rcv->p_log, p_lr, OSM_LOG_DEBUG );
@@ -837,7 +831,8 @@
cl_plock_release( p_rcv->p_lock );
- if( cl_qlist_count( &lr_list ) == 0 )
+ if( (cl_qlist_count( &lr_list ) == 0) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
Index: osm_sa_mcmember_record.c
===================================================================
--- osm_sa_mcmember_record.c (revision 1582)
+++ osm_sa_mcmember_record.c (working copy)
@@ -1678,16 +1678,16 @@
"osm_mcmr_query_mgrp: "
"Returning %u records.\n", num_rec );
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
goto Exit;
}
- /* */
- /* Get a MAD to reply. Address of Mad is in the received mad_wrapper
*/
- /* */
+ /*
+ * Get a MAD to reply. Address of Mad is in the received mad_wrapper
+ */
p_resp_madw = osm_mad_pool_get( p_rcv->p_mad_pool,
p_madw->h_bind,
num_rec * sizeof(ib_member_rec_t) +
IB_SA_MAD_HDR_SIZE,
Index: osm_sa_path_record.c
===================================================================
--- osm_sa_path_record.c (revision 1582)
+++ osm_sa_path_record.c (working copy)
@@ -941,7 +941,8 @@
if( comp_mask & IB_PR_COMPMASK_PKEY )
{
- if( p_pr->pkey != IB_DEFAULT_PKEY )
+ if ( (p_pr->pkey != IB_DEFAULT_PKEY) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
goto Exit;
@@ -950,7 +951,8 @@
if( comp_mask & IB_PR_COMPMASK_SL )
{
- if( p_pr->sl != OSM_DEFAULT_SL )
+ if( (p_pr->sl != OSM_DEFAULT_SL) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
goto Exit;
@@ -982,15 +984,17 @@
}
else
{
+ *pp_src_port = 0;
if( p_sa_mad->comp_mask & IB_PR_COMPMASK_SLID )
{
status = cl_ptr_vector_at( &p_rcv->p_subn->port_lid_tbl,
cl_ntoh16(p_pr->slid),
(void**)pp_src_port );
- if( (status != CL_SUCCESS) || (*pp_src_port == NULL) )
+ if( ( (status != CL_SUCCESS) || (*pp_src_port == NULL) ) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
/*
- This 'error' is a the client's fault (bad lid) so
+ This 'error' is the client's fault (bad lid) so
don't enter it as an error in our own log.
Return an error response to the client.
*/
@@ -1002,15 +1006,7 @@
sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
goto Exit;
}
-
}
- else
- {
- /*
- No source information specified.
- */
- *pp_src_port = 0;
- }
}
if( p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID )
@@ -1023,7 +1019,7 @@
&p_rcv->p_subn->port_guid_tbl ) )
{
/*
- This 'error' is a the client's fault (bad gid) so
+ This 'error' is the client's fault (bad gid) so
don't enter it as an error in our own log.
Return an error response to the client.
*/
@@ -1038,15 +1034,17 @@
}
else
{
+ *pp_dest_port = 0;
if( p_sa_mad->comp_mask & IB_PR_COMPMASK_DLID )
{
status = cl_ptr_vector_at( &p_rcv->p_subn->port_lid_tbl,
cl_ntoh16(p_pr->dlid),
(void**)pp_dest_port );
- if( (status != CL_SUCCESS) || (*pp_dest_port == NULL) )
+ if( ( (status != CL_SUCCESS) || (*pp_dest_port == NULL) ) &&
+ (p_sa_mad->method == IB_MAD_METHOD_GET) )
{
/*
- This 'error' is a the client's fault (bad gid) so
+ This 'error' is the client's fault (bad lid) so
don't enter it as an error in our own log.
Return an error response to the client.
*/
@@ -1058,15 +1056,7 @@
sa_status = IB_SA_MAD_STATUS_NO_RECORDS;
goto Exit;
}
-
}
- else
- {
- /*
- No destination information specified.
- */
- *pp_dest_port = 0;
- }
}
Exit:
@@ -1118,7 +1108,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
/**********************************************************************
**********************************************************************/
static void
@@ -1193,7 +1182,6 @@
OSM_LOG_EXIT( p_rcv->p_log );
}
-
/**********************************************************************
**********************************************************************/
static void
@@ -1260,7 +1248,7 @@
"Generating response with %u records.\n", num_rec );
}
- if( num_rec == 0 )
+ if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0))
{
osm_sa_send_error( p_rcv->p_resp, p_madw,
IB_SA_MAD_STATUS_NO_RECORDS );
@@ -1307,9 +1295,10 @@
p_resp_pr = (ib_path_rec_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad
);
- if( num_rec == 0 )
+ if ( num_rec == 0 )
{
- p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
+ if (p_resp_sa_mad->method == IB_MAD_METHOD_GET_RESP)
+ p_resp_sa_mad->status = IB_SA_MAD_STATUS_NO_RECORDS;
cl_memclr( p_resp_pr, sizeof(*p_resp_pr) );
}
else
More information about the general
mailing list