diff --git a/prov/efa/src/rdm/efa_rdm_ep.h b/prov/efa/src/rdm/efa_rdm_ep.h index 83e0a7c399a..0a67d23d49d 100644 --- a/prov/efa/src/rdm/efa_rdm_ep.h +++ b/prov/efa/src/rdm/efa_rdm_ep.h @@ -57,9 +57,13 @@ struct efa_rdm_ep { size_t mtu_size; size_t max_msg_size; /**< #FI_OPT_MAX_MSG_SIZE */ + size_t max_tagged_size; /**< #FI_OPT_MAX_TAGGED_SIZE */ size_t max_rma_size; /**< #FI_OPT_MAX_RMA_SIZE */ + size_t max_atomic_size; /**< #FI_OPT_MAX_ATOMIC_SIZE */ size_t inject_msg_size; /**< #FI_OPT_INJECT_MSG_SIZE */ + size_t inject_tagged_size; /**< #FI_OPT_INJECT_TAGGED_SIZE */ size_t inject_rma_size; /**< #FI_OPT_INJECT_RMA_SIZE */ + size_t inject_atomic_size; /**< #FI_OPT_INJECT_ATOMIC_SIZE */ /* Endpoint's capability to support zero-copy rx */ bool use_zcpy_rx; diff --git a/prov/efa/src/rdm/efa_rdm_ep_fiops.c b/prov/efa/src/rdm/efa_rdm_ep_fiops.c index 265c6f94c1d..d6f70f0992e 100644 --- a/prov/efa/src/rdm/efa_rdm_ep_fiops.c +++ b/prov/efa/src/rdm/efa_rdm_ep_fiops.c @@ -558,9 +558,13 @@ int efa_rdm_ep_open(struct fid_domain *domain, struct fi_info *info, } efa_rdm_ep->max_msg_size = info->ep_attr->max_msg_size; + efa_rdm_ep->max_tagged_size = info->ep_attr->max_msg_size; efa_rdm_ep->max_rma_size = info->ep_attr->max_msg_size; + efa_rdm_ep->max_atomic_size = info->ep_attr->max_msg_size; efa_rdm_ep->inject_msg_size = info->tx_attr->inject_size; + efa_rdm_ep->inject_tagged_size = info->tx_attr->inject_size; efa_rdm_ep->inject_rma_size = info->tx_attr->inject_size; + efa_rdm_ep->inject_atomic_size = info->tx_attr->inject_size; efa_rdm_ep->efa_max_outstanding_tx_ops = efa_domain->device->rdm_info->tx_attr->size; efa_rdm_ep->efa_max_outstanding_rx_ops = efa_domain->device->rdm_info->rx_attr->size; efa_rdm_ep->use_device_rdma = efa_rdm_get_use_device_rdma(info->fabric_attr->api_version); @@ -1661,15 +1665,27 @@ static int efa_rdm_ep_setopt(fid_t fid, int level, int optname, case FI_OPT_MAX_MSG_SIZE: EFA_RDM_EP_SETOPT_THRESHOLD(MAX_MSG_SIZE, efa_rdm_ep->max_msg_size, efa_rdm_ep->base_ep.info->ep_attr->max_msg_size) break; + case FI_OPT_MAX_TAGGED_SIZE: + EFA_RDM_EP_SETOPT_THRESHOLD(MAX_TAGGED_SIZE, efa_rdm_ep->max_tagged_size, efa_rdm_ep->base_ep.info->ep_attr->max_msg_size) + break; case FI_OPT_MAX_RMA_SIZE: EFA_RDM_EP_SETOPT_THRESHOLD(MAX_RMA_SIZE, efa_rdm_ep->max_rma_size, efa_rdm_ep->base_ep.info->ep_attr->max_msg_size) break; + case FI_OPT_MAX_ATOMIC_SIZE: + EFA_RDM_EP_SETOPT_THRESHOLD(MAX_ATOMIC_SIZE, efa_rdm_ep->max_atomic_size, efa_rdm_ep->base_ep.info->ep_attr->max_msg_size) + break; case FI_OPT_INJECT_MSG_SIZE: EFA_RDM_EP_SETOPT_THRESHOLD(INJECT_MSG_SIZE, efa_rdm_ep->inject_msg_size, efa_rdm_ep->base_ep.info->tx_attr->inject_size) break; + case FI_OPT_INJECT_TAGGED_SIZE: + EFA_RDM_EP_SETOPT_THRESHOLD(INJECT_TAGGED_SIZE, efa_rdm_ep->inject_tagged_size, efa_rdm_ep->base_ep.info->tx_attr->inject_size) + break; case FI_OPT_INJECT_RMA_SIZE: EFA_RDM_EP_SETOPT_THRESHOLD(INJECT_RMA_SIZE, efa_rdm_ep->inject_rma_size, efa_rdm_ep->base_ep.info->tx_attr->inject_size) break; + case FI_OPT_INJECT_ATOMIC_SIZE: + EFA_RDM_EP_SETOPT_THRESHOLD(INJECT_ATOMIC_SIZE, efa_rdm_ep->inject_atomic_size, efa_rdm_ep->base_ep.info->tx_attr->inject_size) + break; case FI_OPT_EFA_USE_DEVICE_RDMA: if (optlen != sizeof(bool)) return -FI_EINVAL; @@ -1752,24 +1768,48 @@ static int efa_rdm_ep_getopt(fid_t fid, int level, int optname, void *optval, *(size_t *) optval = efa_rdm_ep->max_msg_size; *optlen = sizeof (size_t); break; + case FI_OPT_MAX_TAGGED_SIZE: + if (*optlen < sizeof (size_t)) + return -FI_ETOOSMALL; + *(size_t *) optval = efa_rdm_ep->max_tagged_size; + *optlen = sizeof (size_t); + break; case FI_OPT_MAX_RMA_SIZE: if (*optlen < sizeof (size_t)) return -FI_ETOOSMALL; *(size_t *) optval = efa_rdm_ep->max_rma_size; *optlen = sizeof (size_t); break; + case FI_OPT_MAX_ATOMIC_SIZE: + if (*optlen < sizeof (size_t)) + return -FI_ETOOSMALL; + *(size_t *) optval = efa_rdm_ep->max_atomic_size; + *optlen = sizeof (size_t); + break; case FI_OPT_INJECT_MSG_SIZE: if (*optlen < sizeof (size_t)) return -FI_ETOOSMALL; *(size_t *) optval = efa_rdm_ep->inject_msg_size; *optlen = sizeof (size_t); break; + case FI_OPT_INJECT_TAGGED_SIZE: + if (*optlen < sizeof (size_t)) + return -FI_ETOOSMALL; + *(size_t *) optval = efa_rdm_ep->inject_tagged_size; + *optlen = sizeof (size_t); + break; case FI_OPT_INJECT_RMA_SIZE: if (*optlen < sizeof (size_t)) return -FI_ETOOSMALL; *(size_t *) optval = efa_rdm_ep->inject_rma_size; *optlen = sizeof (size_t); break; + case FI_OPT_INJECT_ATOMIC_SIZE: + if (*optlen < sizeof (size_t)) + return -FI_ETOOSMALL; + *(size_t *) optval = efa_rdm_ep->inject_atomic_size; + *optlen = sizeof (size_t); + break; case FI_OPT_EFA_EMULATED_READ: if (*optlen < sizeof(bool)) return -FI_ETOOSMALL; diff --git a/prov/efa/src/rdm/efa_rdm_msg.c b/prov/efa/src/rdm/efa_rdm_msg.c index 2126bb8575a..839cde917f0 100644 --- a/prov/efa/src/rdm/efa_rdm_msg.c +++ b/prov/efa/src/rdm/efa_rdm_msg.c @@ -559,6 +559,7 @@ ssize_t efa_rdm_msg_tinject(struct fid_ep *ep_fid, const void *buf, size_t len, struct efa_rdm_peer *peer; efa_rdm_ep = container_of(ep_fid, struct efa_rdm_ep, base_ep.util_ep.ep_fid.fid); + assert(len <= efa_rdm_ep->inject_tagged_size); peer = efa_rdm_ep_get_peer(efa_rdm_ep, dest_addr); assert(peer); @@ -585,6 +586,7 @@ ssize_t efa_rdm_msg_tinjectdata(struct fid_ep *ep_fid, const void *buf, size_t l struct efa_rdm_peer *peer; efa_rdm_ep = container_of(ep_fid, struct efa_rdm_ep, base_ep.util_ep.ep_fid.fid); + assert(len <= efa_rdm_ep->inject_tagged_size); peer = efa_rdm_ep_get_peer(efa_rdm_ep, dest_addr); assert(peer);