Example #1
0
void uct_ib_iface_fill_ah_attr(uct_ib_iface_t *iface, const uct_ib_address_t *ib_addr,
                               uint8_t path_bits, struct ibv_ah_attr *ah_attr)
{
    uint8_t is_global;

    memset(ah_attr, 0, sizeof(*ah_attr));

    uct_ib_address_unpack(ib_addr, &ah_attr->dlid, &is_global, &ah_attr->grh.dgid);
    ah_attr->sl            = iface->config.sl;
    ah_attr->src_path_bits = path_bits;
    ah_attr->dlid         |= path_bits;
    ah_attr->port_num      = iface->config.port_num;

    /* Create a global address only if we cannot reach the destination using local
     * address. It means either an Ethernet address, or IB address on a different subnet.
     */
    if (is_global &&
        ((iface->addr_type == UCT_IB_ADDRESS_TYPE_ETH) ||
         (iface->gid.global.subnet_prefix != ah_attr->grh.dgid.global.subnet_prefix)))
    {
        ah_attr->is_global      = 1;
        ah_attr->grh.sgid_index = iface->config.gid_index;
    } else {
        ah_attr->is_global      = 0;
    }
}
Example #2
0
int uct_ib_iface_is_reachable(const uct_iface_h tl_iface, const uct_device_addr_t *dev_addr,
                              const uct_iface_addr_t *iface_addr)
{
    uct_ib_iface_t *iface = ucs_derived_of(tl_iface, uct_ib_iface_t);
    const uct_ib_address_t *ib_addr = (const void*)dev_addr;
    union ibv_gid gid;
    uint8_t is_global;
    uint16_t lid;

    uct_ib_address_unpack(ib_addr, &lid, &is_global, &gid);

    switch (iface->addr_type) {
    case UCT_IB_ADDRESS_TYPE_LINK_LOCAL:
        /* IB */
        return ib_addr->flags & UCT_IB_ADDRESS_FLAG_LINK_LAYER_IB;
    case UCT_IB_ADDRESS_TYPE_SITE_LOCAL:
    case UCT_IB_ADDRESS_TYPE_GLOBAL:
        /* IB + same subnet prefix */
        return (ib_addr->flags & UCT_IB_ADDRESS_FLAG_LINK_LAYER_IB) &&
               (gid.global.subnet_prefix == iface->gid.global.subnet_prefix);
    case UCT_IB_ADDRESS_TYPE_ETH:
        /* there shouldn't be a lid and the gid flag should be on */
        return (ib_addr->flags & UCT_IB_ADDRESS_FLAG_LINK_LAYER_ETH) &&
               (ib_addr->flags & UCT_IB_ADDRESS_FLAG_GID) &&
               !(ib_addr->flags & UCT_IB_ADDRESS_FLAG_LID);
    default:
        return 0;
    }
}
Example #3
0
void uct_ib_iface_fill_ah_attr(uct_ib_iface_t *iface, const uct_ib_address_t *ib_addr,
                               uint8_t src_path_bits, struct ibv_ah_attr *ah_attr)
{
    memset(ah_attr, 0, sizeof(*ah_attr));

    uct_ib_address_unpack(ib_addr, &ah_attr->dlid, &ah_attr->is_global,
                          &ah_attr->grh.dgid);
    ah_attr->sl            = iface->sl;
    ah_attr->src_path_bits = src_path_bits;
    ah_attr->port_num      = iface->port_num;
}
Example #4
0
int uct_ib_iface_is_reachable(const uct_iface_h tl_iface, const uct_device_addr_t *dev_addr,
                              const uct_iface_addr_t *iface_addr)
{
    uct_ib_iface_t *iface = ucs_derived_of(tl_iface, uct_ib_iface_t);
    const uct_ib_address_t *ib_addr = (const void*)dev_addr;
    union ibv_gid gid;
    uint8_t is_global;
    uint16_t lid;

    uct_ib_address_unpack(ib_addr, &lid, &is_global, &gid);
    return (gid.global.subnet_prefix == iface->gid.global.subnet_prefix);
}