Пример #1
0
    def prepare_path_lid(self,path):
        """Coroutine to resolve *path* to a LID. This only does something if
        *path* is directed route. This must be performed when using directed
        route paths with asynchronous MAD transactors."""
        if (not isinstance(path,rdma.path.IBDRPath) or
            path.drDLID != IBA.LID_PERMISSIVE or
            getattr(path,"_cached_resolved_dlid",None) is not None):
            self._parent.result = self.get_path_lid(path);
            return;

        start_lid = path.DLID;
        if start_lid == IBA.LID_PERMISSIVE:
            start_lid = self.end_port.lid;

        # Use the SA to resolve the DR path to a LID.
        req = IBA.ComponentMask(IBA.SALinkRecord());
        for I in path.drPath[1:]:
            req.fromLID = start_lid;
            req.fromPort = ord(I);
            rep = yield self._parent.SubnAdmGet(req);
            start_lid = rep.toLID;
        path._cached_resolved_dlid = start_lid;
        self._parent.result = start_lid;
Пример #2
0
def topo_peer_SMP(sched,sbn,port,get_desc=True,path=None,
                  peer_path=None):
    """Coroutine to fetch a single connected peer. This updates
    :attr:`rdma.subnet.Subnet.topology`. It also fetches a port info to setup
    LID routing.

    *peer_path* is the path out *port*, created by
     :meth:`rdma.subnet.Subnet.advance_dr`.

    This does nothing if the information is already loaded."""
    peer_port = sbn.topology.get(port);
    if peer_port is None:
        portIdx = port.port_id;

        if peer_path is None:
            if path is None:
                path = sbn.get_path_smp(sched,port.to_end_port());
            peer_path = sbn.advance_dr(path,portIdx);

        if port.pinf is None:
            yield subnet_pinf_SMP(sched,sbn,portIdx,path);

        if (port.pinf.portState == IBA.PORT_STATE_DOWN or
            portIdx == 0):
            return

        # Resolve the DR path using the SA and update our topology information
        # as well.
        use_sa = isinstance(sched,rdma.satransactor.SATransactor);
        if use_sa:
            if path is None:
                path = sbn.get_path_smp(sched,port.to_end_port());
            req = IBA.ComponentMask(IBA.SALinkRecord());
            req.fromLID = yield sched.prepare_path_lid(path);
            req.fromPort = portIdx;
            rep = yield sched.SubnAdmGet(req);
            peer_path._cached_resolved_dlid = rep.toLID;
            peer_port = sbn.get_port(portIdx=rep.toPort,LID=rep.toLID,
                                     path=peer_path);

        peer_node,peer_zport = yield subnet_ninf_SMP(sched,sbn,peer_path,
                                                     get_desc,use_sa);
        get_desc = False;
        if not use_sa:
            lpn = getattr(peer_path,"_cached_subnet_localPortNum",
                          peer_node.ninf.localPortNum);
            peer_port = sbn.get_port(portIdx=lpn,
                                     path=peer_path);

        sbn.topology[port] = peer_port;
        sbn.topology[peer_port] = port;
    else:
        peer_node = peer_port.parent;
        peer_zport = peer_port.to_end_port();
        peer_path = sbn.get_path_smp(sched,peer_zport);

    if get_desc and peer_node.desc is None:
        sched.queue(peer_node.get_desc(sched,peer_path));

    if sbn.lid_routed and peer_zport.LID is None:
        yield subnet_pinf_SMP(sched,sbn,0,peer_path);