Lines Matching refs:port

120 get_node(Node *node, Port *port, ib_portid_t *portid)
122 void *pi = port->portinfo, *ni = node->nodeinfo, *nd = node->nodedesc;
145 mad_decode_field(ni, IB_NODE_PORT_GUID_F, &port->portguid);
146 mad_decode_field(ni, IB_NODE_LOCAL_PORT_F, &port->portnum);
147 mad_decode_field(pi, IB_PORT_LID_F, &port->lid);
148 mad_decode_field(pi, IB_PORT_LMC_F, &port->lmc);
149 mad_decode_field(pi, IB_PORT_STATE_F, &port->state);
172 DEBUG("portid %s: forward lid %d to port %d",
194 dump_endnode(int dump, char *prompt, Node *node, Port *port)
203 node->type == IB_NODE_SWITCH ? 0 : port->portnum);
212 node->nodeguid, node->type == IB_NODE_SWITCH ? 0 : port->portnum,
213 port->lid, port->lid + (1 << port->lmc) - 1,
220 dump_route(int dump, Node *node, int outport, Port *port)
231 outport, port->portguid, port->portnum);
233 fprintf(f, "[%d] -> %s port {0x%016" PRIx64 "}[%d] lid %u-%u \"%s\"\n",
236 port->portguid, port->portnum,
237 port->lid, port->lid + (1 << port->lmc) - 1,
247 Port *port, fromport, toport, nextport;
265 port = &fromport;
266 portnum = port->portnum;
268 dump_endnode(dump, "From", node, port);
271 if (port->state != 4)
274 if (sameport(port, &toport))
288 IBWARN("can't reach port at %s", portid2str(from));
295 break; /* found SMA port */
302 if (!sameport(port, &fromport)) {
303 IBWARN("can't continue: reached CA or router port %" PRIx64 ", lid %d",
304 port->portguid, port->lid);
317 IBWARN("can't reach port at %s", portid2str(from));
320 /* fix port num to be seen from the CA or router side */
324 port = &nextport;
325 if (port->state != 4)
328 portnum = port->portnum;
329 dump_route(dump, node, outport, port);
336 dump_endnode(dump, "To", node, port);
340 IBWARN("Bad port state found: node \"%s\" port %d state %d",
341 clean_nodedesc(node->nodedesc), portnum, port->state);
344 IBWARN("Bad out port state found: node \"%s\" outport %d state %d",
345 clean_nodedesc(node->nodedesc), outport, port->state);
384 get_port(Port *port, int portnum, ib_portid_t *portid)
389 port->portnum = portnum;
394 mad_decode_field(pi, IB_PORT_LID_F, &port->lid);
395 mad_decode_field(pi, IB_PORT_LMC_F, &port->lmc);
396 mad_decode_field(pi, IB_PORT_STATE_F, &port->state);
397 mad_decode_field(pi, IB_PORT_PHYS_STATE_F, &port->physstate);
400 portid2str(portid), portnum, port->lid, port->state, port->physstate);
405 link_port(Port *port, Node *node)
407 port->next = node->ports;
408 node->ports = port;
412 new_node(Node *node, Port *port, ib_portid_t *path, int dist)
414 if (port->portguid == target_portguid) {
416 link_port(port, node);
417 dump_endnode(verbose, "found target", node, port);
425 VERBOSE("insert dist %d node %p port %d lid %d", dist, node, port->portnum, port->lid);
427 link_port(port, node);
472 VERBOSE("Switch guid 0x%" PRIx64 ": mlid 0x%x is forwarded to port %d",
487 Port *port, *remoteport;
498 if (!(port = calloc(1, sizeof(Port))))
501 if (get_node(node, port, from) < 0) {
507 if ((r = new_node(node, port, from, 0)) > 0) {
534 map[port->portnum] = 1;
536 DEBUG("Starting from CA 0x%" PRIx64 " lid %d port %d (leafport %d)",
537 node->nodeguid, port->lid, port->portnum, leafport);
540 /* if starting from a leaf port fix up port (up port) */
559 if (!(port = calloc(1, sizeof(Port))))
562 if (get_port(port, i, path) < 0) {
563 IBWARN("can't reach node %s port %d", portid2str(path), i);
567 if (port->physstate != 5) { /* LinkUP */
568 free(port);
573 link_port(port, node);
587 IBWARN("NodeInfo on %s port %d failed, skipping port",
597 remoteport->remoteport = port;
624 IBWARN("can't find to port\n");
642 printf("From %s 0x%" PRIx64 " port %d lid %u-%u \"%s\"\n",
666 printf("To %s 0x%" PRIx64 " port %d lid %u-%u \"%s\"\n",
789 IBERROR("can't resolve SM destination port %s", optarg);
818 IBERROR("can't resolve source port %s", argv[0]);
821 IBERROR("can't resolve destination port %s", argv[1]);
825 IBERROR("cannot resolve lid for port \'%s\'",
828 IBERROR("cannot resolve lid for port \'%s\'",
838 /* first find a direct path to the src port */
840 IBERROR("can't find a route to the src port");