Make trap generation sending be a transaction (expect a response) and handle incoming trap repress (notice attribute) ib_mad_is_response is now changed to better reflect responses (not just R bit in MAD header)
Signed-off-by: Hal Rosenstock <[email protected]> --- Changes from v1: Removed mistaken IB_MAD_ATTR_NOTICE handling in GetResp routine Removed superfluous check of trap repress as ib_smp_is_response is now sufficient by itself Added similar modification to several vendor layers (not compiled) diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h index 205d160..06f3e75 100644 --- a/opensm/include/iba/ib_types.h +++ b/opensm/include/iba/ib_types.h @@ -2,6 +2,7 @@ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -3763,8 +3764,8 @@ static inline boolean_t OSM_API ib_mad_is_response(IN const ib_mad_t * const p_mad) { CL_ASSERT(p_mad); - return ((p_mad->method & IB_MAD_METHOD_RESP_MASK) == - IB_MAD_METHOD_RESP_MASK); + return (p_mad->method & IB_MAD_METHOD_RESP_MASK || + p_mad->method == IB_MAD_METHOD_TRAP_REPRESS); } /* diff --git a/opensm/libvendor/osm_vendor_mtl.c b/opensm/libvendor/osm_vendor_mtl.c index 5fb05ef..6fc607e 100644 --- a/opensm/libvendor/osm_vendor_mtl.c +++ b/opensm/libvendor/osm_vendor_mtl.c @@ -66,8 +66,7 @@ uint64_t __osm_set_wrid_by_p_madw(IN osm_madw_t * p_madw) memcpy(&wrid, &p_madw, sizeof(osm_madw_t *)); wrid = (wrid << 1) | - ib_mad_is_response(p_madw->p_mad) | - (p_madw->p_mad->method == IB_MAD_METHOD_TRAP_REPRESS); + ib_mad_is_response(p_madw->p_mad); return wrid; } diff --git a/opensm/libvendor/osm_vendor_ts.c b/opensm/libvendor/osm_vendor_ts.c index 710d06f..2e24881 100644 --- a/opensm/libvendor/osm_vendor_ts.c +++ b/opensm/libvendor/osm_vendor_ts.c @@ -61,8 +61,7 @@ uint64_t __osm_set_wrid_by_p_madw(IN osm_madw_t * p_madw) memcpy(&wrid, &p_madw, sizeof(osm_madw_t *)); wrid = (wrid << 1) | - ib_mad_is_response(p_madw->p_mad) | - (p_madw->p_mad->method == IB_MAD_METHOD_TRAP_REPRESS); + ib_mad_is_response(p_madw->p_mad); return wrid; } diff --git a/opensm/opensm/osm_req.c b/opensm/opensm/osm_req.c index 2e851b2..1a46e50 100644 --- a/opensm/opensm/osm_req.c +++ b/opensm/opensm/osm_req.c @@ -246,6 +246,7 @@ int osm_send_trap144(osm_sm_t *sm, ib_net16_t local) madw->mad_addr.dest_lid = pi->master_sm_base_lid; madw->mad_addr.addr_type.smi.source_lid = pi->base_lid; + madw->resp_expected = TRUE; madw->fail_msg = CL_DISP_MSGID_NONE; smp = osm_madw_get_smp_ptr(madw); diff --git a/opensm/opensm/osm_sm_mad_ctrl.c b/opensm/opensm/osm_sm_mad_ctrl.c index 267ec85..5bea57e 100644 --- a/opensm/opensm/osm_sm_mad_ctrl.c +++ b/opensm/opensm/osm_sm_mad_ctrl.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -537,6 +538,57 @@ Exit: * SEE ALSO *********/ +/****f* opensm: SM/__osm_sm_mad_ctrl_process_trap_repress + * NAME + * __osm_sm_mad_ctrl_process_trap_repress + * + * DESCRIPTION + * This function handles method TrapRepress() for received MADs. + * + * SYNOPSIS + */ +static void +__osm_sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * const p_ctrl, + IN osm_madw_t * p_madw) +{ + ib_smp_t *p_smp; + + OSM_LOG_ENTER(p_ctrl->p_log); + + p_smp = osm_madw_get_smp_ptr(p_madw); + + /* + Note that attr_id (like the rest of the MAD) is in + network byte order. + */ + switch (p_smp->attr_id) { + case IB_MAD_ATTR_NOTICE: + break; + + default: + cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown); + OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3105: " + "Unsupported attribute = 0x%X\n", + cl_ntoh16(p_smp->attr_id)); + osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_ERROR); + break; + } + + osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw); + + OSM_LOG_EXIT(p_ctrl->p_log); +} + +/* + * PARAMETERS + * + * RETURN VALUES + * + * NOTES + * + * SEE ALSO + *********/ + /****f* opensm: SM/__osm_sm_mad_ctrl_rcv_callback * NAME * __osm_sm_mad_ctrl_rcv_callback @@ -577,8 +629,7 @@ __osm_sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, osm_dump_dr_smp(p_ctrl->p_log, p_smp, OSM_LOG_DEBUG); /* retire the mad or put it back */ - if (ib_smp_is_response(p_smp) || - (p_smp->method == IB_MAD_METHOD_TRAP_REPRESS)) { + if (ib_smp_is_response(p_smp)) { CL_ASSERT(p_madw->resp_expected == FALSE); __osm_sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw); } else if (p_madw->resp_expected == TRUE) @@ -624,10 +675,14 @@ __osm_sm_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, __osm_sm_mad_ctrl_process_set(p_ctrl, p_madw); break; + case IB_MAD_METHOD_TRAP_REPRESS: + CL_ASSERT(p_req_madw == NULL); + __osm_sm_mad_ctrl_process_trap_repress(p_ctrl, p_madw); + break; + case IB_MAD_METHOD_SEND: case IB_MAD_METHOD_REPORT: case IB_MAD_METHOD_REPORT_RESP: - case IB_MAD_METHOD_TRAP_REPRESS: default: cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown); OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3112: " diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c index 6639246..4576a8b 100644 --- a/opensm/opensm/osm_trap_rcv.c +++ b/opensm/opensm/osm_trap_rcv.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -649,18 +650,34 @@ Exit: } /********************************************************************** - CURRENTLY WE ARE NOT CREATING TRAPS - SO THIS CALL IN AN ERROR **********************************************************************/ static void trap_rcv_process_response(IN osm_sm_t * sm, IN const osm_madw_t * const p_madw) { + uint8_t payload[sizeof(ib_mad_notice_attr_t)]; + ib_smp_t *p_smp; + ib_mad_notice_attr_t *p_ntci = (ib_mad_notice_attr_t *) payload; + + CL_ASSERT(p_madw); + + if (!osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) + return; OSM_LOG_ENTER(sm->p_log); - OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3808: " - "This function is not supported yet\n"); + if (p_madw->p_mad->mgmt_class != IB_MCLASS_SUBN_LID && + p_madw->p_mad->mgmt_class != IB_MCLASS_SUBN_DIR) + goto Exit; + p_smp = osm_madw_get_smp_ptr(p_madw); + + memset(payload, 0, sizeof(payload)); + memcpy(payload, &p_smp->data, IB_SMP_DATA_SIZE); + + osm_dump_notice(sm->p_log, p_ntci, OSM_LOG_VERBOSE); + +Exit: OSM_LOG_EXIT(sm->p_log); } _______________________________________________ general mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
