Esempio n. 1
0
 def _cache_make_ah(self,path):
     """Construct the address handle for UMAD and cache it in the path
     class"""
     assert(path.end_port == self.parent);
     # The kernel seems to have no way to explicitly set a permissive
     # SLID.. I wonder what it does?
     if path.SLID == IBA.LID_PERMISSIVE:
         slid_bits = 0;
     else:
         slid_bits = path.SLID_bits;
     if path.has_grh:
         res = self.ib_mad_addr_t.pack(cpu_to_be32(path.dqpn),
                                       cpu_to_be32(path.qkey),
                                       cpu_to_be16(path.DLID),
                                       path.SL,
                                       slid_bits,
                                       1,
                                       path.SGID_index,
                                       path.hop_limit,
                                       path.traffic_class,
                                       path.DGID,
                                       cpu_to_be32(path.flow_label),
                                       path.pkey_index);
     else:
         res = self.ib_mad_addr_local_t.pack(cpu_to_be32(path.dqpn),
                                             cpu_to_be32(path.qkey),
                                             cpu_to_be16(path.DLID),
                                             path.SL,
                                             slid_bits,
                                             path.pkey_index);
     path._cached_umad_ah = res;
     return res;
Esempio n. 2
0
 def _cache_make_ah(self, path):
     """Construct the address handle for UMAD and cache it in the path
     class"""
     assert (path.end_port == self.parent)
     # The kernel seems to have no way to explicitly set a permissive
     # SLID.. I wonder what it does?
     if path.SLID == IBA.LID_PERMISSIVE:
         slid_bits = 0
     else:
         slid_bits = path.SLID_bits
     if path.has_grh:
         res = self.ib_mad_addr_t.pack(cpu_to_be32(path.dqpn),
                                       cpu_to_be32(path.qkey),
                                       cpu_to_be16(path.DLID), path.SL,
                                       slid_bits, 1, path.SGID_index,
                                       path.hop_limit, path.traffic_class,
                                       path.DGID,
                                       cpu_to_be32(path.flow_label),
                                       path.pkey_index)
     else:
         res = self.ib_mad_addr_local_t.pack(cpu_to_be32(path.dqpn),
                                             cpu_to_be32(path.qkey),
                                             cpu_to_be16(path.DLID),
                                             path.SL, slid_bits,
                                             path.pkey_index)
     path._cached_umad_ah = res
     return res
Esempio n. 3
0
    def _unpack_rcv(self):
        """Switch a UMAD AH back into an IBPath. Note this is only
        used for recv'd AH's where the meaning of the fields is altered.

        Our convention is that the path describes the packet headers as they
        existed on the wire, so this untwiddles things."""
        (sqpn,
         qkey,
         SLID,
         self.SL,
         DLID_bits,
         self.has_grh,
         DGID_index,
         self.hop_limit,
         self.traffic_class,
         self.SGID,
         flow_label,
         pkey_index) = \
         UMAD.ib_mad_addr_t.unpack(self._cached_umad_ah);
        self.sqpn = cpu_to_be32(sqpn);
        # There is no pkey validation for SMPs (see IBA figure 156), so the
        # pkey should always be the default NOTE: mtcha at least has been seen
        # to return random values for pkey_index on SMPs, which is why we need
        # this check.
        if self.dqpn != 0:
            self.pkey_index = pkey_index;
        self.qkey = cpu_to_be32(qkey);
        self.DLID = DLID_bits | self.end_port.lid;
        self.SLID = cpu_to_be16(SLID);
        if self.has_grh:
            self.SGID = IBA.GID(self.SGID,True);
            self.DGID = self.end_port.gids[DGID_index];
            self.flow_label = cpu_to_be32(flow_label);
        else:
            del self.SGID
Esempio n. 4
0
    def _unpack_rcv(self):
        """Switch a UMAD AH back into an IBPath. Note this is only
        used for recv'd AH's where the meaning of the fields is altered.

        Our convention is that the path describes the packet headers as they
        existed on the wire, so this untwiddles things."""
        (sqpn,
         qkey,
         SLID,
         self.SL,
         DLID_bits,
         self.has_grh,
         DGID_index,
         self.hop_limit,
         self.traffic_class,
         self.SGID,
         flow_label,
         pkey_index) = \
         UMAD.ib_mad_addr_t.unpack(self._cached_umad_ah)
        self.sqpn = cpu_to_be32(sqpn)
        # There is no pkey validation for SMPs (see IBA figure 156), so the
        # pkey should always be the default NOTE: mtcha at least has been seen
        # to return random values for pkey_index on SMPs, which is why we need
        # this check.
        if self.dqpn != 0:
            self.pkey_index = pkey_index
        self.qkey = cpu_to_be32(qkey)
        self.DLID = DLID_bits | self.end_port.lid
        self.SLID = cpu_to_be16(SLID)
        if self.has_grh:
            self.SGID = IBA.GID(self.SGID, True)
            self.DGID = self.end_port.gids[DGID_index]
            self.flow_label = cpu_to_be32(flow_label)
        else:
            del self.SGID
Esempio n. 5
0
    def unpack_from(self, buffer, offset=0):
        from socket import htonl as cpu_to_be32
        from socket import htons as cpu_to_be16

        (self.agent_id,self.status,self.timeout_ms,self.retries,self.length,
         self.qpn,self.qkey,self.lid,self.sl,self.path_bits,self.grh_present,self.gid_index,
         self.hop_limit,self.traffic_class,self.gid,self.flow_label,self.pkey_index,self.reserved_58) = \
         struct.unpack_from("=LLLLLLLHBBBBBB16sLH6s",buffer,offset+0)

        self.qpn = cpu_to_be32(self.qpn)
        self.qkey = cpu_to_be32(self.qkey)
        self.lid = cpu_to_be16(self.lid)
        self.gid = IBA.GID(self.gid, raw=True)
        self.flow_label = cpu_to_be32(self.flow_label)
Esempio n. 6
0
    def unpack_from(self,buffer,offset=0):
        from socket import htonl as cpu_to_be32;
        from socket import htons as cpu_to_be16;

        (self.agent_id,self.status,self.timeout_ms,self.retries,self.length,
         self.qpn,self.qkey,self.lid,self.sl,self.path_bits,self.grh_present,self.gid_index,
         self.hop_limit,self.traffic_class,self.gid,self.flow_label,self.pkey_index,self.reserved_58) = \
         struct.unpack_from("=LLLLLLLHBBBBBB16sLH6s",buffer,offset+0);

        self.qpn = cpu_to_be32(self.qpn);
        self.qkey = cpu_to_be32(self.qkey);
        self.lid = cpu_to_be16(self.lid);
        self.gid = IBA.GID(self.gid,raw=True);
        self.flow_label = cpu_to_be32(self.flow_label);