本文整理汇总了C++中cl_ntoh16函数的典型用法代码示例。如果您正苦于以下问题:C++ cl_ntoh16函数的具体用法?C++ cl_ntoh16怎么用?C++ cl_ntoh16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cl_ntoh16函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cl_hton16
osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
const char *name, uint16_t pkey)
{
osm_prtn_t *p = NULL, *p_check;
pkey &= cl_hton16((uint16_t) ~ 0x8000);
if (!pkey) {
if (name && (p = osm_prtn_find_by_name(p_subn, name)))
return p;
if (!(pkey = generate_pkey(p_subn)))
return NULL;
}
p = osm_prtn_new(name, pkey);
if (!p) {
OSM_LOG(p_log, OSM_LOG_ERROR, "Unable to create"
" partition \'%s\' (0x%04x)\n", name, cl_ntoh16(pkey));
return NULL;
}
p_check = (osm_prtn_t *) cl_qmap_insert(&p_subn->prtn_pkey_tbl,
p->pkey, &p->map_item);
if (p != p_check) {
OSM_LOG(p_log, OSM_LOG_VERBOSE, "Duplicated partition"
" definition: \'%s\' (0x%04x) prev name \'%s\'"
". Will use it\n",
name, cl_ntoh16(pkey), p_check->name);
osm_prtn_delete(p_subn, &p);
p = p_check;
}
return p;
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:33,代码来源:osm_prtn.c
示例2: lr_rcv_build_physp_link
static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,
IN ib_net16_t to_lid, IN uint8_t from_port,
IN uint8_t to_port, IN cl_qlist_t * p_list)
{
osm_sa_item_t *p_lr_item;
p_lr_item = malloc(SA_LR_RESP_SIZE);
if (p_lr_item == NULL) {
OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1801: "
"Unable to acquire link record\n"
"\t\t\t\tFrom port %u\n" "\t\t\t\tTo port %u\n"
"\t\t\t\tFrom lid %u\n" "\t\t\t\tTo lid %u\n",
from_port, to_port,
cl_ntoh16(from_lid), cl_ntoh16(to_lid));
return;
}
memset(p_lr_item, 0, SA_LR_RESP_SIZE);
p_lr_item->resp.link_rec.from_port_num = from_port;
p_lr_item->resp.link_rec.to_port_num = to_port;
p_lr_item->resp.link_rec.to_lid = to_lid;
p_lr_item->resp.link_rec.from_lid = from_lid;
cl_qlist_insert_tail(p_list, &p_lr_item->list_item);
}
开发者ID:Maigard,项目名称:opensm-pnnl,代码行数:25,代码来源:osm_sa_link_record.c
示例3: sa_dump_one_mgrp
static void sa_dump_one_mgrp(osm_mgrp_t *p_mgrp, void *cxt)
{
struct opensm_dump_context dump_context;
osm_opensm_t *p_osm = ((struct opensm_dump_context *)cxt)->p_osm;
FILE *file = ((struct opensm_dump_context *)cxt)->file;
fprintf(file, "MC Group 0x%04x %s:"
" mgid=0x%016" PRIx64 ":0x%016" PRIx64
" port_gid=0x%016" PRIx64 ":0x%016" PRIx64
" qkey=0x%08x mlid=0x%04x mtu=0x%02x tclass=0x%02x"
" pkey=0x%04x rate=0x%02x pkt_life=0x%02x sl_flow_hop=0x%08x"
" scope_state=0x%02x proxy_join=0x%x" "\n\n",
cl_ntoh16(p_mgrp->mlid),
p_mgrp->well_known ? " (well known)" : "",
cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.prefix),
cl_ntoh64(p_mgrp->mcmember_rec.mgid.unicast.interface_id),
cl_ntoh64(p_mgrp->mcmember_rec.port_gid.unicast.prefix),
cl_ntoh64(p_mgrp->mcmember_rec.port_gid.unicast.interface_id),
cl_ntoh32(p_mgrp->mcmember_rec.qkey),
cl_ntoh16(p_mgrp->mcmember_rec.mlid),
p_mgrp->mcmember_rec.mtu,
p_mgrp->mcmember_rec.tclass,
cl_ntoh16(p_mgrp->mcmember_rec.pkey),
p_mgrp->mcmember_rec.rate,
p_mgrp->mcmember_rec.pkt_life,
cl_ntoh32(p_mgrp->mcmember_rec.sl_flow_hop),
p_mgrp->mcmember_rec.scope_state,
p_mgrp->mcmember_rec.proxy_join);
dump_context.p_osm = p_osm;
dump_context.file = file;
cl_qmap_apply_func(&p_mgrp->mcm_port_tbl,
mcast_mgr_dump_one_port, &dump_context);
}
开发者ID:Cai900205,项目名称:test,代码行数:35,代码来源:osm_sa.c
示例4: osm_pi_rcv_process_set
static void
osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
IN const uint8_t port_num, IN osm_madw_t * const p_madw)
{
osm_physp_t *p_physp;
ib_net64_t port_guid;
ib_smp_t *p_smp;
ib_port_info_t *p_pi;
osm_pi_context_t *p_context;
osm_log_level_t level;
OSM_LOG_ENTER(sm->p_log);
p_context = osm_madw_get_pi_context_ptr(p_madw);
CL_ASSERT(p_node);
p_physp = osm_node_get_physp_ptr(p_node, port_num);
CL_ASSERT(p_physp);
port_guid = osm_physp_get_port_guid(p_physp);
p_smp = osm_madw_get_smp_ptr(p_madw);
p_pi = (ib_port_info_t *) ib_smp_get_payload_ptr(p_smp);
/* check for error */
if (cl_ntoh16(p_smp->status) & 0x7fff) {
/* If port already ACTIVE, don't treat status 7 as error */
if (p_context->active_transition &&
(cl_ntoh16(p_smp->status) & 0x7fff) == 0x1c) {
level = OSM_LOG_INFO;
OSM_LOG(sm->p_log, OSM_LOG_INFO,
"Received error status 0x%x for SetResp() during ACTIVE transition\n",
cl_ntoh16(p_smp->status) & 0x7fff);
/* Should there be a subsequent Get to validate that port is ACTIVE ? */
} else {
level = OSM_LOG_ERROR;
OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F10: "
"Received error status for SetResp()\n");
}
osm_dump_port_info(sm->p_log,
osm_node_get_node_guid(p_node),
port_guid, port_num, p_pi, level);
}
OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
"Received logical SetResp() for GUID 0x%" PRIx64
", port num %u"
"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
" TID 0x%" PRIx64 "\n",
cl_ntoh64(port_guid), port_num,
cl_ntoh64(osm_node_get_node_guid(p_node)),
cl_ntoh64(p_smp->trans_id));
osm_physp_set_port_info(p_physp, p_pi);
OSM_LOG_EXIT(sm->p_log);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:58,代码来源:osm_port_info_rcv.c
示例5: osm_prtn_add_port
ib_api_status_t osm_prtn_add_port(osm_log_t * p_log, osm_subn_t * p_subn,
osm_prtn_t * p, ib_net64_t guid,
boolean_t full, boolean_t indx0)
{
ib_api_status_t status = IB_SUCCESS;
cl_map_t *p_tbl;
osm_port_t *p_port;
osm_physp_t *p_physp;
p_port = osm_get_port_by_guid(p_subn, guid);
if (!p_port) {
OSM_LOG(p_log, OSM_LOG_VERBOSE,
"port 0x%" PRIx64 " not found\n", cl_ntoh64(guid));
return status;
}
p_physp = p_port->p_physp;
if (!p_physp) {
OSM_LOG(p_log, OSM_LOG_VERBOSE,
"no physical for port 0x%" PRIx64 "\n",
cl_ntoh64(guid));
return status;
}
/* Set the pkey to be inserted to block 0 index 0 */
if (indx0) {
OSM_LOG(p_log, OSM_LOG_VERBOSE, "Setting pkey 0x%04x at indx0 "
"for port 0x%" PRIx64 "\n",
cl_ntoh16(p->pkey), cl_ntoh64(guid));
osm_pkey_tbl_set_indx0_pkey(p_log, p->pkey, full,
&p_physp->pkeys);
} else if (ib_pkey_get_base(p_physp->pkeys.indx0_pkey) ==
ib_pkey_get_base(p->pkey))
p_physp->pkeys.indx0_pkey = 0;
p_tbl = (full == TRUE) ? &p->full_guid_tbl : &p->part_guid_tbl;
if (p_subn->opt.allow_both_pkeys) {
if (cl_map_remove(p_tbl, guid))
OSM_LOG(p_log, OSM_LOG_VERBOSE, "port 0x%" PRIx64
" already in partition \'%s\' (0x%04x) full %d."
" Will overwrite\n",
cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey),
full);
} else {
if (cl_map_remove(&p->part_guid_tbl, guid) ||
cl_map_remove(&p->full_guid_tbl, guid))
OSM_LOG(p_log, OSM_LOG_VERBOSE, "port 0x%" PRIx64
" already in partition \'%s\' (0x%04x)."
" Will overwrite\n",
cl_ntoh64(guid), p->name, cl_ntoh16(p->pkey));
}
if (cl_map_insert(p_tbl, guid, p_physp) == NULL)
return IB_INSUFFICIENT_MEMORY;
return status;
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:57,代码来源:osm_prtn.c
示例6: __osm_vendor_ts_poller
/**********************************************************************
* Poller thread:
* Always receive 256byte mads from the devcie file
**********************************************************************/
void __osm_vendor_ts_poller(IN void *p_ptr)
{
int ts_ret_code;
struct ib_mad mad;
osm_mad_addr_t mad_addr;
osm_ts_bind_info_t *const p_bind = (osm_ts_bind_info_t *) p_ptr;
OSM_LOG_ENTER(p_bind->p_vend->p_log);
/* we set the type of cancelation for this thread */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
while (1) {
/* we read one mad at a time and pass it to the read callback function */
ts_ret_code = read(p_bind->ul_dev_fd, &mad, sizeof(mad));
if (ts_ret_code != sizeof(mad)) {
osm_log(p_bind->p_vend->p_log, OSM_LOG_ERROR,
"__osm_vendor_ts_poller: ERR 5003: "
"error with read, bytes = %d, errno = %d\n",
ts_ret_code, errno);
} else {
osm_log(p_bind->p_vend->p_log, OSM_LOG_DEBUG,
"__osm_vendor_ts_poller: "
"MAD QPN:%d SLID:0x%04x class:0x%02x "
"__osm_vendor_ts_poller:0x%02x attr:0x%04x status:0x%04x "
"__osm_vendor_ts_poller:0x%016" PRIx64 "\n",
cl_ntoh32(mad.dqpn),
cl_ntoh16(mad.slid),
mad.mgmt_class,
mad.r_method,
cl_ntoh16(mad.attribute_id),
cl_ntoh16(mad.status),
cl_ntoh64(mad.transaction_id));
/* first arrange an address */
__osm_ts_conv_mad_rcv_desc_to_osm_addr(p_bind->p_vend,
&mad,
(((ib_mad_t *) &
mad)->
mgmt_class ==
IB_MCLASS_SUBN_LID)
||
(((ib_mad_t *) &
mad)->
mgmt_class ==
IB_MCLASS_SUBN_DIR),
&mad_addr);
/* call the receiver callback */
/* HACK: this should be replaced with a call to the RMPP Assembly ... */
__osm_ts_rcv_callback(p_bind, &mad_addr, 256, &mad);
}
}
OSM_LOG_EXIT(p_bind->p_vend->p_log);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:59,代码来源:osm_vendor_ts.c
示例7: pi_rcv_check_and_fix_lid
static void pi_rcv_check_and_fix_lid(osm_log_t * log, ib_port_info_t * pi,
osm_physp_t * p)
{
if (PF(cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO)) {
OSM_LOG(log, OSM_LOG_ERROR, "ERR 0F04: "
"Got invalid base LID %u from the network. "
"Corrected to %u\n", cl_ntoh16(pi->base_lid),
cl_ntoh16(p->port_info.base_lid));
pi->base_lid = p->port_info.base_lid;
}
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:11,代码来源:osm_port_info_rcv.c
示例8: sa_dump_one_service
static void sa_dump_one_service(cl_list_item_t * p_list_item, void *cxt)
{
FILE *file = ((struct opensm_dump_context *)cxt)->file;
osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;
ib_service_record_t *p_sr = &p_svcr->service_record;
fprintf(file, "Service Record: id=0x%016" PRIx64
" gid=0x%016" PRIx64 ":0x%016" PRIx64
" pkey=0x%x"
" lease=0x%x"
" key=0x%02x%02x%02x%02x%02x%02x%02x%02x"
":0x%02x%02x%02x%02x%02x%02x%02x%02x"
" name=\'%s\'"
" data8=0x%02x%02x%02x%02x%02x%02x%02x%02x"
":0x%02x%02x%02x%02x%02x%02x%02x%02x"
" data16=0x%04x%04x%04x%04x:0x%04x%04x%04x%04x"
" data32=0x%08x%08x:0x%08x%08x"
" data64=0x%016" PRIx64 ":0x%016" PRIx64
" modified_time=0x%x lease_period=0x%x\n\n",
cl_ntoh64(p_sr->service_id),
cl_ntoh64(p_sr->service_gid.unicast.prefix),
cl_ntoh64(p_sr->service_gid.unicast.interface_id),
cl_ntoh16(p_sr->service_pkey),
cl_ntoh32(p_sr->service_lease),
p_sr->service_key[0], p_sr->service_key[1],
p_sr->service_key[2], p_sr->service_key[3],
p_sr->service_key[4], p_sr->service_key[5],
p_sr->service_key[6], p_sr->service_key[7],
p_sr->service_key[8], p_sr->service_key[9],
p_sr->service_key[10], p_sr->service_key[11],
p_sr->service_key[12], p_sr->service_key[13],
p_sr->service_key[14], p_sr->service_key[15],
p_sr->service_name,
p_sr->service_data8[0], p_sr->service_data8[1],
p_sr->service_data8[2], p_sr->service_data8[3],
p_sr->service_data8[4], p_sr->service_data8[5],
p_sr->service_data8[6], p_sr->service_data8[7],
p_sr->service_data8[8], p_sr->service_data8[9],
p_sr->service_data8[10], p_sr->service_data8[11],
p_sr->service_data8[12], p_sr->service_data8[13],
p_sr->service_data8[14], p_sr->service_data8[15],
cl_ntoh16(p_sr->service_data16[0]),
cl_ntoh16(p_sr->service_data16[1]),
cl_ntoh16(p_sr->service_data16[2]),
cl_ntoh16(p_sr->service_data16[3]),
cl_ntoh16(p_sr->service_data16[4]),
cl_ntoh16(p_sr->service_data16[5]),
cl_ntoh16(p_sr->service_data16[6]),
cl_ntoh16(p_sr->service_data16[7]),
cl_ntoh32(p_sr->service_data32[0]),
cl_ntoh32(p_sr->service_data32[1]),
cl_ntoh32(p_sr->service_data32[2]),
cl_ntoh32(p_sr->service_data32[3]),
cl_ntoh64(p_sr->service_data64[0]),
cl_ntoh64(p_sr->service_data64[1]),
p_svcr->modified_time, p_svcr->lease_period);
}
开发者ID:Cai900205,项目名称:test,代码行数:57,代码来源:osm_sa.c
示例9: __osm_sm_mad_ctrl_process_set
/****f* opensm: SM/__osm_sm_mad_ctrl_process_set
* NAME
* __osm_sm_mad_ctrl_process_set
*
* DESCRIPTION
* This function handles method Set() for received MADs.
*
* SYNOPSIS
*/
static void
__osm_sm_mad_ctrl_process_set(IN osm_sm_mad_ctrl_t * const p_ctrl,
IN osm_madw_t * p_madw)
{
ib_smp_t *p_smp;
cl_status_t status;
cl_disp_msgid_t msg_id = CL_DISP_MSGID_NONE;
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_SM_INFO:
msg_id = OSM_MSG_MAD_SM_INFO;
break;
default:
cl_atomic_inc(&p_ctrl->p_stats->qp0_mads_rcvd_unknown);
OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3107: "
"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;
}
if (msg_id == CL_DISP_MSGID_NONE) {
/*
There is an unknown MAD attribute type for which there is
no recipient. Simply retire the MAD here.
*/
osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
goto Exit;
}
/*
Post this MAD to the dispatcher for asynchronous
processing by the appropriate controller.
*/
OSM_LOG(p_ctrl->p_log, OSM_LOG_DEBUG, "Posting Dispatcher message %s\n",
osm_get_disp_msg_str(msg_id));
status = cl_disp_post(p_ctrl->h_disp, msg_id, p_madw,
__osm_sm_mad_ctrl_disp_done_callback, p_ctrl);
if (status != CL_SUCCESS) {
OSM_LOG(p_ctrl->p_log, OSM_LOG_ERROR, "ERR 3108: "
"Dispatcher post message failed (%s)\n",
CL_STATUS_MSG(status));
goto Exit;
}
Exit:
OSM_LOG_EXIT(p_ctrl->p_log);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:69,代码来源:osm_sm_mad_ctrl.c
示例10: sscanf
bool IBConnection::_readKeys( struct IBDest *remDest)
{
int parsed;
eq::lunchbox::Buffer<void*> buf;
buf.resize( KEY_MSG_SIZE );
uint64_t size = KEY_MSG_SIZE;
WSABUF wsaBuffer = { KEY_MSG_SIZE,
reinterpret_cast< char* >( buf.getData() ) };
DWORD got = 0;
DWORD flags = 0;
_socketConnection->readNB( wsaBuffer.buf, size);
_socketConnection->readSync( wsaBuffer.buf, size);
char* data = reinterpret_cast<char*>(buf.getData());
parsed = sscanf( data,
KEY_PRINT_FMT,
&remDest->lid,
&remDest->qpn,
&remDest->psn,
&remDest->rkey,
&remDest->vaddr );
remDest->lid = cl_ntoh16(remDest->lid);
remDest->qpn = cl_ntoh32(remDest->qpn);
remDest->psn = cl_ntoh32(remDest->psn);
remDest->rkey = cl_ntoh32(remDest->rkey);
if ( parsed != 5 )
return false;
remDest->vaddr = ( uintptr_t ) remDest->vaddr;
return true;
}
开发者ID:4Second2None,项目名称:Collage,代码行数:35,代码来源:ibConnection.cpp
示例11: handle_trap_event
/** =========================================================================
*/
static void handle_trap_event(_log_events_t *log, ib_mad_notice_attr_t *p_ntc)
{
if (ib_notice_is_generic(p_ntc)) {
fprintf(log->log_file,
"Generic trap type %d; event %d; from LID %u\n",
ib_notice_get_type(p_ntc),
cl_ntoh16(p_ntc->g_or_v.generic.trap_num),
cl_ntoh16(p_ntc->issuer_lid));
} else {
fprintf(log->log_file,
"Vendor trap type %d; from LID %u\n",
ib_notice_get_type(p_ntc),
cl_ntoh16(p_ntc->issuer_lid));
}
}
开发者ID:ChristianKniep,项目名称:opensm-qnibng,代码行数:18,代码来源:osmeventplugin.c
示例12: track_mgrp_w_partition
static ib_api_status_t
track_mgrp_w_partition(osm_log_t *p_log, osm_prtn_t *p, osm_mgrp_t *mgrp,
osm_subn_t *p_subn, const ib_gid_t *mgid,
ib_net16_t pkey)
{
char gid_str[INET6_ADDRSTRLEN];
osm_mgrp_t **tmp;
int i = 0;
/* check if we are already tracking this group */
for (i = 0; i < p->nmgrps; i++)
if (p->mgrps[i] == mgrp)
return (IB_SUCCESS);
/* otherwise add it to our list */
tmp = realloc(p->mgrps, (p->nmgrps +1) * sizeof(*p->mgrps));
if (tmp) {
p->mgrps = tmp;
p->mgrps[p->nmgrps] = mgrp;
p->nmgrps++;
} else {
OSM_LOG(p_log, OSM_LOG_ERROR,
"realloc error to create MC group (%s) in "
"partition (pkey 0x%04x)\n",
inet_ntop(AF_INET6, mgid->raw,
gid_str, sizeof gid_str),
cl_ntoh16(pkey));
mgrp->well_known = FALSE;
osm_mgrp_cleanup(p_subn, mgrp);
return (IB_ERROR);
}
mgrp->well_known = TRUE;
return (IB_SUCCESS);
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:34,代码来源:osm_prtn.c
示例13: insert_lid2sl_table
static void insert_lid2sl_table(struct sa_query_result *r)
{
unsigned int i;
for (i = 0; i < r->result_cnt; i++) {
ib_path_rec_t *p_pr = (ib_path_rec_t *)sa_get_query_rec(r->p_result_madw, i);
lid2sl_table[cl_ntoh16(p_pr->dlid)] = ib_path_rec_sl(p_pr);
}
}
开发者ID:Cai900205,项目名称:test,代码行数:8,代码来源:ibqueryerrors.c
示例14: osm_pkey_tbl_set_indx0_pkey
void osm_pkey_tbl_set_indx0_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
IN boolean_t full,
OUT osm_pkey_tbl_t * p_pkey_tbl)
{
p_pkey_tbl->indx0_pkey = (full == TRUE) ?
pkey | cl_hton16(0x8000) : pkey;
OSM_LOG(p_log, OSM_LOG_DEBUG, "pkey 0x%04x set at indx0\n",
cl_ntoh16(p_pkey_tbl->indx0_pkey));
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:9,代码来源:osm_pkey.c
示例15: ip_mgroup_pkey_ok
static inline boolean_t ip_mgroup_pkey_ok(struct part_conf *conf,
struct precreate_mgroup *group)
{
ib_net16_t mpkey = *(ib_net16_t *)&group->mgid.raw[4];
char gid_str[INET6_ADDRSTRLEN];
if (mgid_is_broadcast(&group->mgid)
|| mpkey == 0x0000 /* user requested "wild card" of pkey */
|| mpkey == conf->p_prtn->pkey) /* user was smart enough to match */
return (TRUE);
OSM_LOG(conf->p_log, OSM_LOG_ERROR,
"IP MC group (%s) specified with invalid pkey 0x%04x "
"for partition pkey = 0x%04x (%s)\n",
inet_ntop(AF_INET6, group->mgid.raw, gid_str, sizeof gid_str),
cl_ntoh16(mpkey), cl_ntoh16(conf->p_prtn->pkey), conf->p_prtn->name);
return (FALSE);
}
开发者ID:Cai900205,项目名称:test,代码行数:18,代码来源:osm_prtn_config.c
示例16: cl_plock_excl_acquire
/*
* SA DB Loader
*/
static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
ib_member_rec_t * p_mcm_rec,
unsigned well_known)
{
ib_net64_t comp_mask;
osm_mgrp_t *p_mgrp;
cl_plock_excl_acquire(&p_osm->lock);
p_mgrp = osm_get_mgrp_by_mgid(&p_osm->subn, &p_mcm_rec->mgid);
if (p_mgrp) {
if (p_mgrp->mlid == mlid) {
OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
"mgrp %04x is already here.", cl_ntoh16(mlid));
goto _out;
}
OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
"mlid %04x is already used by another MC group. Will "
"request clients reregistration.\n", cl_ntoh16(mlid));
p_mgrp = NULL;
goto _out;
}
comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL
| IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
if (!(p_mgrp = osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa,
comp_mask,
p_mcm_rec)) ||
p_mgrp->mlid != mlid) {
OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
"cannot create MC group with mlid 0x%04x and mgid "
"0x%016" PRIx64 ":0x%016" PRIx64 "\n", cl_ntoh16(mlid),
cl_ntoh64(p_mcm_rec->mgid.unicast.prefix),
cl_ntoh64(p_mcm_rec->mgid.unicast.interface_id));
p_mgrp = NULL;
} else if (well_known)
p_mgrp->well_known = TRUE;
_out:
cl_plock_release(&p_osm->lock);
return p_mgrp;
}
开发者ID:Cai900205,项目名称:test,代码行数:46,代码来源:osm_sa.c
示例17: perfmgr_db_fill_err_read
/**********************************************************************
* Fill in the various DB objects from their wire counter parts
**********************************************************************/
void
perfmgr_db_fill_err_read(ib_port_counters_t * wire_read,
perfmgr_db_err_reading_t * reading,
boolean_t xmit_wait_sup)
{
reading->symbol_err_cnt = cl_ntoh16(wire_read->symbol_err_cnt);
reading->link_err_recover = wire_read->link_err_recover;
reading->link_downed = wire_read->link_downed;
reading->rcv_err = cl_ntoh16(wire_read->rcv_err);
reading->rcv_rem_phys_err = cl_ntoh16(wire_read->rcv_rem_phys_err);
reading->rcv_switch_relay_err =
cl_ntoh16(wire_read->rcv_switch_relay_err);
reading->xmit_discards = cl_ntoh16(wire_read->xmit_discards);
reading->xmit_constraint_err = wire_read->xmit_constraint_err;
reading->rcv_constraint_err = wire_read->rcv_constraint_err;
reading->link_integrity =
PC_LINK_INT(wire_read->link_int_buffer_overrun);
reading->buffer_overrun =
PC_BUF_OVERRUN(wire_read->link_int_buffer_overrun);
reading->vl15_dropped = cl_ntoh16(wire_read->vl15_dropped);
if (xmit_wait_sup)
reading->xmit_wait = cl_ntoh32(wire_read->xmit_wait);
else
reading->xmit_wait = 0;
reading->time = time(NULL);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:29,代码来源:osm_perfmgr_db.c
示例18: generate_pkey
static uint16_t generate_pkey(osm_subn_t * p_subn)
{
uint16_t pkey;
cl_qmap_t *m = &p_subn->prtn_pkey_tbl;
while (global_pkey_counter < cl_ntoh16(IB_DEFAULT_PARTIAL_PKEY) - 1) {
pkey = ++global_pkey_counter;
pkey = cl_hton16(pkey);
if (cl_qmap_get(m, pkey) == cl_qmap_end(m))
return pkey;
}
return 0;
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:13,代码来源:osm_prtn.c
示例19: dump_sl2vl_tbl
static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt)
{
osm_port_t *p_port = (osm_port_t *) item;
osm_node_t *p_node = p_port->p_node;
uint32_t in_port, out_port,
num_ports = p_node->node_info.num_ports;
ib_net16_t base_lid = osm_port_get_base_lid(p_port);
osm_physp_t *p_physp;
ib_slvl_table_t *p_tbl;
int i, n;
char buf[1024];
const char * header_line = "#in out : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15";
const char * separator_line = "#--------------------------------------------------------";
if (!num_ports)
return;
fprintf(file, "%s 0x%016" PRIx64 ", base LID %d, "
"\"%s\"\n%s\n%s\n",
ib_get_node_type_str(p_node->node_info.node_type),
cl_ntoh64(p_port->guid), cl_ntoh16(base_lid),
p_node->print_desc, header_line, separator_line);
if (p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) {
for (out_port = 0; out_port <= num_ports; out_port++){
p_physp = osm_node_get_physp_ptr(p_node, out_port);
/* no need to print SL2VL table for port that is down */
if (!p_physp || !p_physp->p_remote_physp)
continue;
for (in_port = 0; in_port <= num_ports; in_port++) {
p_tbl = osm_physp_get_slvl_tbl(p_physp, in_port);
for (i = 0, n = 0; i < 16; i++)
n += sprintf(buf + n, " %-2d",
ib_slvl_table_get(p_tbl, i));
fprintf(file, "%-3d %-3d :%s\n",
in_port, out_port, buf);
}
}
} else {
p_physp = p_port->p_physp;
p_tbl = osm_physp_get_slvl_tbl(p_physp, 0);
for (i = 0, n = 0; i < 16; i++)
n += sprintf(buf + n, " %-2d",
ib_slvl_table_get(p_tbl, i));
fprintf(file, "%-3d %-3d :%s\n", 0, 0, buf);
}
fprintf(file, "%s\n\n", separator_line);
}
开发者ID:chu11,项目名称:opensm-snapshot,代码行数:51,代码来源:osm_dump.c
示例20: osm_switch_get_port_least_hops
uint8_t osm_switch_get_port_least_hops(IN const osm_switch_t * p_sw,
IN const osm_port_t * p_port)
{
uint16_t lid;
if (p_port->p_node->sw) {
if (p_port->p_node->sw == p_sw)
return 0;
lid = osm_node_get_base_lid(p_port->p_node, 0);
return osm_switch_get_least_hops(p_sw, cl_ntoh16(lid));
} else {
osm_physp_t *p = p_port->p_physp;
uint8_t hops;
if (!p || !p->p_remote_physp || !p->p_remote_physp->p_node->sw)
return OSM_NO_PATH;
if (p->p_remote_physp->p_node->sw == p_sw)
return 1;
lid = osm_node_get_base_lid(p->p_remote_physp->p_node, 0);
hops = osm_switch_get_least_hops(p_sw, cl_ntoh16(lid));
return hops != OSM_NO_PATH ? hops + 1 : OSM_NO_PATH;
}
}
开发者ID:ChristianKniep,项目名称:opensm-qnibng,代码行数:23,代码来源:osm_switch.c
注:本文中的cl_ntoh16函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论