Lines Matching refs:node
126 static int is_port_inactive(Node * node, Port * port, Switch * sw) in is_port_inactive() argument
130 (node->type != IB_NODE_SWITCH || in is_port_inactive()
131 (node->type == IB_NODE_SWITCH && sw->enhsp0))) in is_port_inactive()
136 static int get_node(Node * node, Port * port, ib_portid_t * portid) in get_node() argument
138 void *pi = port->portinfo, *ni = node->nodeinfo, *nd = node->nodedesc; in get_node()
141 memset(ni, 0, sizeof(node->nodeinfo)); in get_node()
145 memset(nd, 0, sizeof(node->nodedesc)); in get_node()
160 mad_decode_field(ni, IB_NODE_GUID_F, &node->nodeguid); in get_node()
161 mad_decode_field(ni, IB_NODE_TYPE_F, &node->type); in get_node()
162 mad_decode_field(ni, IB_NODE_NPORTS_F, &node->numports); in get_node()
171 node->nodeguid, node->nodedesc); in get_node()
215 static void dump_endnode(int dump, char *prompt, Node * node, Port * port) in dump_endnode() argument
223 prompt, node->nodeguid, in dump_endnode()
224 node->type == IB_NODE_SWITCH ? 0 : port->portnum); in dump_endnode()
229 remap_node_name(node_name_map, node->nodeguid, node->nodedesc); in dump_endnode()
233 (node->type <= IB_NODE_MAX ? node_type_str[node->type] : "???"), in dump_endnode()
234 node->nodeguid, in dump_endnode()
235 node->type == IB_NODE_SWITCH ? 0 : port->portnum, port->lid, in dump_endnode()
241 static void dump_route(int dump, Node * node, int outport, Port * port) in dump_route() argument
249 remap_node_name(node_name_map, node->nodeguid, node->nodedesc); in dump_route()
257 (node->type <= in dump_route()
258 IB_NODE_MAX ? node_type_str[node->type] : "???"), in dump_route()
267 Node *node, fromnode, tonode, nextnode; in find_route() local
292 node = &fromnode; in find_route()
296 dump_endnode(dump, "From", node, port); in find_route()
297 if (node->type == IB_NODE_SWITCH) { in find_route()
299 if (next_sw_outport < 0 || next_sw_outport > node->numports) { in find_route()
307 if (is_port_inactive(node, port, &sw)) in find_route()
313 if (node->type == IB_NODE_SWITCH) { in find_route()
331 } else if ((node->type == IB_NODE_CA) || in find_route()
332 (node->type == IB_NODE_ROUTER)) { in find_route()
378 node = &nextnode; in find_route()
380 dump_route(dump, node, outport, port); in find_route()
387 dump_endnode(dump, "To", node, port); in find_route()
392 clean_nodedesc(node->nodedesc), portnum, port->state); in find_route()
396 clean_nodedesc(node->nodedesc), outport, port->state); in find_route()
401 clean_nodedesc(node->nodedesc), to->lid, outport, sw.linearFDBtop); in find_route()
419 Node *node; in insert_node() local
421 for (node = nodestbl[hash]; node; node = node->htnext) in insert_node()
422 if (node->nodeguid == new->nodeguid) { in insert_node()
455 static void link_port(Port * port, Node * node) in link_port() argument
457 port->next = node->ports; in link_port()
458 node->ports = port; in link_port()
461 static int new_node(Node * node, Port * port, ib_portid_t * path, int dist) in new_node() argument
464 node->dist = -1; /* tag as target */ in new_node()
465 link_port(port, node); in new_node()
466 dump_endnode(ibverbose, "found target", node, port); in new_node()
471 if (insert_node(node) < 0) in new_node()
474 VERBOSE("insert dist %d node %p port %d lid %d", dist, node, in new_node()
477 link_port(port, node); in new_node()
479 node->dist = dist; in new_node()
480 node->path = *path; in new_node()
481 node->dnext = nodesdist[dist]; in new_node()
482 nodesdist[dist] = node; in new_node()
487 static int switch_mclookup(Node * node, ib_portid_t * portid, int mlid, in switch_mclookup() argument
511 maxsets = (node->numports + 15) / 16; /* round up */ in switch_mclookup()
527 node->nodeguid, mlid + 0xc000, i + set * 16); in switch_mclookup()
539 Node *node, *remotenode; in find_mcpath() local
548 if (!(node = calloc(1, sizeof(Node)))) in find_mcpath()
554 if (get_node(node, port, from) < 0) { in find_mcpath()
559 node->upnode = 0; /* root */ in find_mcpath()
560 if ((r = new_node(node, port, from, 0)) > 0) { in find_mcpath()
561 if (node->type != IB_NODE_SWITCH) { in find_mcpath()
566 if (switch_mclookup(node, from, mlid, map) < 0 || !map[0]) in find_mcpath()
568 return node; in find_mcpath()
573 for (node = nodesdist[dist]; node; node = node->dnext) { in find_mcpath()
575 path = &node->path; in find_mcpath()
577 VERBOSE("dist %d node %p", dist, node); in find_mcpath()
578 dump_endnode(ibverbose, "processing", node, in find_mcpath()
579 node->ports); in find_mcpath()
583 if (node->type != IB_NODE_SWITCH) { in find_mcpath()
588 node->upport = 0; /* starting here */ in find_mcpath()
591 node->nodeguid, port->lid, port->portnum, in find_mcpath()
597 node->upport = leafport; in find_mcpath()
599 if (switch_mclookup(node, path, mlid, map) < 0) { in find_mcpath()
601 "", node->nodeguid); in find_mcpath()
606 for (i = 1; i <= node->numports; i++) { in find_mcpath()
607 if (!map[i] || i == node->upport) in find_mcpath()
630 link_port(port, node); in find_mcpath()
655 remotenode->upnode = node; in find_mcpath()
692 static void dump_mcpath(Node * node, int dumplevel) in dump_mcpath() argument
696 if (node->upnode) in dump_mcpath()
697 dump_mcpath(node->upnode, dumplevel); in dump_mcpath()
700 remap_node_name(node_name_map, node->nodeguid, node->nodedesc); in dump_mcpath()
702 if (!node->dist) { in dump_mcpath()
704 (node->type <= in dump_mcpath()
705 IB_NODE_MAX ? node_type_str[node->type] : "???"), in dump_mcpath()
706 node->nodeguid, node->ports->portnum, node->ports->lid, in dump_mcpath()
707 node->ports->lid + (1 << node->ports->lmc) - 1, in dump_mcpath()
712 if (node->dist) { in dump_mcpath()
715 node->ports->remoteport->portnum, in dump_mcpath()
716 (node->type <= in dump_mcpath()
717 IB_NODE_MAX ? node_type_str[node->type] : in dump_mcpath()
718 "???"), node->nodeguid, node->upport); in dump_mcpath()
721 node->ports->remoteport->portnum, in dump_mcpath()
722 (node->type <= in dump_mcpath()
723 IB_NODE_MAX ? node_type_str[node->type] : in dump_mcpath()
724 "???"), node->nodeguid, node->upport, in dump_mcpath()
725 node->ports->lid, nodename); in dump_mcpath()
728 if (node->dist < 0) in dump_mcpath()
731 (node->type <= in dump_mcpath()
732 IB_NODE_MAX ? node_type_str[node->type] : "???"), in dump_mcpath()
733 node->nodeguid, node->ports->portnum, node->ports->lid, in dump_mcpath()
734 node->ports->lid + (1 << node->ports->lmc) - 1, in dump_mcpath()