[ofa-general] Re: [PATCH] opensm: osm_send_trap144() function

Hal Rosenstock hal.rosenstock at gmail.com
Tue Oct 28 13:26:02 PDT 2008


Sasha,

On Sat, Oct 25, 2008 at 1:52 PM, Sasha Khapyorsky <sashak at voltaire.com> wrote:
>
> Add ability to send trap 144 - osm_send_trap144() function. This can be
> useful when SMA doesn't support trap sending on some events, such as
> CapabilityMask change (ConnectX), OtherLocalChanges (no one supports
> this AFAIK).

What component beside the SMA would send the ones mentioned above ?
Also, how would it know whether or not to do this ?

-- Hal

> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  opensm/include/opensm/osm_sm.h |   23 +++++++++++++
>  opensm/opensm/osm_req.c        |   68 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 91 insertions(+), 0 deletions(-)
>
> diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
> index 5d46246..bc87ea6 100644
> --- a/opensm/include/opensm/osm_sm.h
> +++ b/opensm/include/opensm/osm_sm.h
> @@ -769,5 +769,28 @@ ib_api_status_t osm_sm_state_mgr_check_legality(IN osm_sm_t *sm,
>
>  void osm_report_sm_state(osm_sm_t *sm);
>
> +/****f* OpenSM: SM State Manager/osm_send_trap144
> +* NAME
> +*      osm_send_trap144
> +*
> +* DESCRIPTION
> +*      Send trap 144 to the master SM.
> +*
> +* SYNOPSIS
> +*/
> +int osm_send_trap144(osm_sm_t *sm, ib_net16_t local);
> +/*
> +* PARAMETERS
> +*      sm
> +*              [in] Pointer to an osm_sm_t object.
> +*
> +*      local
> +*              [in] OtherLocalChanges mask in network byte order.
> +*
> +* RETURN VALUES
> +*      0 on success, non-zero value otherwise.
> +*
> +*********/
> +
>  END_C_DECLS
>  #endif                         /* _OSM_SM_H_ */
> diff --git a/opensm/opensm/osm_req.c b/opensm/opensm/osm_req.c
> index 5f93551..0865ce5 100644
> --- a/opensm/opensm/osm_req.c
> +++ b/opensm/opensm/osm_req.c
> @@ -210,3 +210,71 @@ Exit:
>        OSM_LOG_EXIT(sm->p_log);
>        return (status);
>  }
> +
> +int osm_send_trap144(osm_sm_t *sm, ib_net16_t local)
> +{
> +       osm_madw_t *madw;
> +       ib_smp_t *smp;
> +       ib_mad_notice_attr_t *ntc;
> +       osm_port_t *port;
> +       ib_port_info_t *pi;
> +
> +       port = osm_get_port_by_guid(sm->p_subn, sm->p_subn->sm_port_guid);
> +       if (!port) {
> +               OSM_LOG(sm->p_log, OSM_LOG_ERROR,
> +                       "ERR 1104: cannot find SM port by guid 0x%" PRIx64 "\n",
> +                       cl_ntoh64(sm->p_subn->sm_port_guid));
> +               return -1;
> +       }
> +
> +       pi = &port->p_physp->port_info;
> +
> +       /* don't bother with sending trap when SMA supports this */
> +       if (!local &&
> +           pi->capability_mask&(IB_PORT_CAP_HAS_TRAP|IB_PORT_CAP_HAS_CAP_NTC))
> +               return 0;
> +
> +       madw = osm_mad_pool_get(sm->p_mad_pool,
> +                               osm_sm_mad_ctrl_get_bind_handle(&sm->mad_ctrl),
> +                               MAD_BLOCK_SIZE, NULL);
> +       if (madw == NULL) {
> +               OSM_LOG(sm->p_log, OSM_LOG_ERROR,
> +                       "ERR 1105: Unable to acquire MAD\n");
> +               return -1;
> +       }
> +
> +       madw->mad_addr.dest_lid = pi->master_sm_base_lid;
> +       madw->mad_addr.addr_type.smi.source_lid = pi->base_lid;
> +       madw->fail_msg = CL_DISP_MSGID_NONE;
> +
> +       smp = osm_madw_get_smp_ptr(madw);
> +       memset(smp, 0, sizeof(*smp));
> +
> +       smp->base_ver = 1;
> +       smp->mgmt_class = IB_MCLASS_SUBN_LID;
> +       smp->class_ver = 1;
> +       smp->method = IB_MAD_METHOD_TRAP;
> +       smp->trans_id = cl_hton64((uint64_t)cl_atomic_inc(&sm->sm_trans_id));
> +       smp->attr_id = IB_MAD_ATTR_NOTICE;
> +       smp->m_key = sm->p_subn->opt.m_key;
> +
> +       ntc = (ib_mad_notice_attr_t *)smp->data;
> +
> +       ntc->generic_type = 0x80 | IB_NOTICE_TYPE_INFO;
> +       ib_notice_set_prod_type_ho(ntc, IB_NODE_TYPE_CA);
> +       ntc->g_or_v.generic.trap_num = cl_hton16(144);
> +       ntc->issuer_lid = pi->base_lid;
> +       ntc->data_details.ntc_144.lid = pi->base_lid;
> +       ntc->data_details.ntc_144.local_changes = local ?
> +               TRAP_144_MASK_OTHER_LOCAL_CHANGES : 0;
> +       ntc->data_details.ntc_144.new_cap_mask = pi->capability_mask;
> +       ntc->data_details.ntc_144.change_flgs = local;
> +
> +       OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
> +               "Sending Trap 144, TID 0x%" PRIx64 " to SM lid %u\n",
> +               cl_ntoh64(smp->trans_id), cl_ntoh16(pi->master_sm_base_lid));
> +
> +       osm_vl15_post(sm->p_vl15, madw);
> +
> +       return 0;
> +}
> --
> 1.6.0.3.517.g759a
>
>



More information about the general mailing list