Skip to content

Commit

Permalink
prov/efa: rename p2p_available to mr_p2p_available
Browse files Browse the repository at this point in the history
Rename to mr_p2p_available to indicate that we check the mr is not NULL.

Signed-off-by: Jessie Yang <[email protected]>
  • Loading branch information
jiaxiyan authored and shijin-aws committed Sep 18, 2024
1 parent b0af713 commit 677bdeb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions prov/efa/src/rdm/efa_rdm_pke_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ssize_t efa_rdm_pke_init_payload_from_ope(struct efa_rdm_pke *pke,
size_t data_size)
{
int tx_iov_index, ret;
bool p2p_available;
bool mr_p2p_available;
bool use_inline_buf;
size_t tx_iov_offset, copied;
struct efa_mr *iov_mr;
Expand All @@ -62,14 +62,14 @@ ssize_t efa_rdm_pke_init_payload_from_ope(struct efa_rdm_pke *pke,
assert(tx_iov_index < ope->iov_count);
assert(tx_iov_offset < ope->iov[tx_iov_index].iov_len);
iov_mr = ope->desc[tx_iov_index];
p2p_available = false;
mr_p2p_available = false;
use_inline_buf = false;

if (iov_mr) {
ret = efa_rdm_ep_use_p2p(pke->ep, iov_mr);
if (ret < 0)
return ret;
p2p_available = ret;
mr_p2p_available = ret;
} else if (!efa_mr_is_hmem(iov_mr) &&
payload_offset + data_size <= efa_rdm_ep_domain(pke->ep)->device->efa_attr.inline_buf_size) {
use_inline_buf = true;
Expand All @@ -85,7 +85,7 @@ ssize_t efa_rdm_pke_init_payload_from_ope(struct efa_rdm_pke *pke,
* a copy from the user buffer to the internal bounce buffer is needed.
*/
if (tx_iov_offset + data_size <= ope->iov[tx_iov_index].iov_len &&
(use_inline_buf || (p2p_available && !(ope->fi_flags & FI_INJECT)))) {
(use_inline_buf || (mr_p2p_available && !(ope->fi_flags & FI_INJECT)))) {
pke->payload = (char *)ope->iov[tx_iov_index].iov_base + tx_iov_offset;
pke->payload_size = data_size;
pke->payload_mr = ope->desc[tx_iov_index];
Expand Down Expand Up @@ -250,15 +250,16 @@ int efa_rdm_pke_get_available_copy_methods(struct efa_rdm_ep *ep,
bool *restrict gdrcopy_available)
{
int ret;
bool p2p_available;
bool mr_p2p_available;

assert(efa_mr);
ret = efa_rdm_ep_use_p2p(ep, efa_mr);
if (ret < 0) {
return ret;
}

p2p_available = ret;
*local_read_available = p2p_available && efa_rdm_ep_support_rdma_read(ep);
mr_p2p_available = ret;
*local_read_available = mr_p2p_available && efa_rdm_ep_support_rdma_read(ep);
*cuda_memcpy_available = ep->cuda_api_permitted;
*gdrcopy_available = efa_mr->peer.flags & OFI_HMEM_DATA_DEV_REG_HANDLE;

Expand Down

0 comments on commit 677bdeb

Please sign in to comment.