static int usdf_fill_info_msg( uint32_t version, const struct fi_info *hints, void *src, void *dest, struct usd_device_attrs *dap, struct fi_info **fi_first, struct fi_info **fi_last) { struct fi_info *fi; struct fi_fabric_attr *fattrp; uint32_t addr_format; int ret; fi = fi_allocinfo(); if (fi == NULL) { ret = -FI_ENOMEM; goto fail; } fi->caps = USDF_MSG_CAPS; ret = validate_modebits(version, hints, USDF_MSG_SUPP_MODE, &fi->mode); if (ret) goto fail; if (hints != NULL) { addr_format = hints->addr_format; /* check that we are capable of what's requested */ if ((hints->caps & ~USDF_MSG_CAPS) != 0) { ret = -FI_ENODATA; goto fail; } fi->handle = hints->handle; } else { addr_format = FI_FORMAT_UNSPEC; } fi->ep_attr->type = FI_EP_MSG; ret = usdf_fill_addr_info(fi, addr_format, src, dest, dap); if (ret != 0) { goto fail; } /* fabric attrs */ fattrp = fi->fabric_attr; ret = usdf_fabric_getname(version, dap, &fattrp->name); if (ret < 0 || fattrp->name == NULL) { ret = -FI_ENOMEM; goto fail; } ret = usdf_msg_fill_ep_attr(hints, fi, dap); if (ret) goto fail; ret = usdf_msg_fill_dom_attr(version, hints, fi, dap); if (ret) goto fail; ret = usdf_msg_fill_tx_attr(version, hints, fi); if (ret) goto fail; ret = usdf_msg_fill_rx_attr(version, hints, fi); if (ret) goto fail; ret = usdf_alloc_fid_nic(fi, dap); if (ret) goto fail; /* add to tail of list */ if (*fi_first == NULL) { *fi_first = fi; } else { (*fi_last)->next = fi; } *fi_last = fi; return 0; fail: if (fi != NULL) { fi_freeinfo(fi); } return ret; }
static int usdf_fill_info_msg( struct fi_info *hints, struct sockaddr_in *src, struct sockaddr_in *dest, struct usd_device_attrs *dap, struct fi_info **fi_first, struct fi_info **fi_last) { struct fi_info *fi; struct fi_fabric_attr *fattrp; uint32_t addr_format; int ret; fi = fi_allocinfo(); if (fi == NULL) { ret = -FI_ENOMEM; goto fail; } fi->caps = USDF_MSG_CAPS; if (hints != NULL) { fi->mode = hints->mode & USDF_MSG_SUPP_MODE; addr_format = hints->addr_format; /* check that we are capable of what's requested */ if ((hints->caps & ~USDF_MSG_CAPS) != 0) { ret = -FI_ENODATA; goto fail; } /* app must support these modes */ if ((hints->mode & USDF_MSG_REQ_MODE) != USDF_MSG_REQ_MODE) { ret = -FI_ENODATA; goto fail; } fi->handle = hints->handle; } else { fi->mode = USDF_MSG_SUPP_MODE; addr_format = FI_FORMAT_UNSPEC; } fi->ep_attr->type = FI_EP_MSG; ret = usdf_fill_addr_info(fi, addr_format, src, dest, dap); if (ret != 0) { goto fail; } /* fabric attrs */ fattrp = fi->fabric_attr; fattrp->name = strdup(dap->uda_devname); if (fattrp->name == NULL) { ret = -FI_ENOMEM; goto fail; } ret = usdf_msg_fill_ep_attr(hints, fi, dap); if (ret) goto fail; ret = usdf_msg_fill_dom_attr(hints, fi); if (ret) goto fail; ret = usdf_msg_fill_tx_attr(hints, fi); if (ret) goto fail; ret = usdf_msg_fill_rx_attr(hints, fi); if (ret) goto fail; /* add to tail of list */ if (*fi_first == NULL) { *fi_first = fi; } else { (*fi_last)->next = fi; } *fi_last = fi; return 0; fail: if (fi != NULL) { fi_freeinfo(fi); } return ret; }
static int usdf_fill_info_msg( struct fi_info *hints, struct sockaddr_in *src, struct sockaddr_in *dest, struct usd_device_attrs *dap, struct fi_info **fi_first, struct fi_info **fi_last) { struct fi_info *fi; struct fi_fabric_attr *fattrp; struct fi_domain_attr *dattrp; struct fi_tx_attr *txattr; struct fi_rx_attr *rxattr; struct fi_ep_attr *eattrp; uint32_t addr_format; int ret; fi = fi_allocinfo(); if (fi == NULL) { ret = -FI_ENOMEM; goto fail; } fi->caps = USDF_MSG_CAPS; if (hints != NULL) { fi->mode = hints->mode & USDF_MSG_SUPP_MODE; addr_format = hints->addr_format; /* check that we are capable of what's requested */ if ((hints->caps & ~USDF_MSG_CAPS) != 0) { ret = -FI_ENODATA; goto fail; } /* app must support these modes */ if ((hints->mode & USDF_MSG_REQ_MODE) != USDF_MSG_REQ_MODE) { ret = -FI_ENODATA; goto fail; } } else { fi->mode = USDF_MSG_SUPP_MODE; addr_format = FI_FORMAT_UNSPEC; } fi->ep_attr->type = FI_EP_MSG; ret = usdf_fill_addr_info(fi, addr_format, src, dest, dap); if (ret != 0) { goto fail; } /* fabric attrs */ fattrp = fi->fabric_attr; fattrp->name = strdup(dap->uda_devname); if (fattrp->name == NULL) { ret = -FI_ENOMEM; goto fail; } /* TX attrs */ txattr = fi->tx_attr; if (hints != NULL && hints->tx_attr != NULL) { *txattr = *hints->tx_attr; } usdf_msg_fill_tx_attr(txattr); /* RX attrs */ rxattr = fi->rx_attr; if (hints != NULL && hints->rx_attr != NULL) { *rxattr = *hints->rx_attr; } usdf_msg_fill_rx_attr(rxattr); /* endpoint attrs */ eattrp = fi->ep_attr; eattrp->max_msg_size = USDF_MSG_MAX_MSG; eattrp->protocol = FI_PROTO_RUDP; eattrp->tx_ctx_cnt = 1; eattrp->rx_ctx_cnt = 1; /* domain attrs */ dattrp = fi->domain_attr; dattrp->threading = FI_THREAD_UNSPEC; dattrp->control_progress = FI_PROGRESS_AUTO; dattrp->data_progress = FI_PROGRESS_MANUAL; /* add to tail of list */ if (*fi_first == NULL) { *fi_first = fi; } else { (*fi_last)->next = fi; } *fi_last = fi; return 0; fail: if (fi != NULL) { fi_freeinfo(fi); } return ret; }