Skip to content

Commit

Permalink
prov/opx: define PAGE_SIZE if undefined
Browse files Browse the repository at this point in the history
Some arch like riscv does not have a standard defined PAGE_SIZE in sys/user.h.

Signed-off-by: Zhuo Zhi <h.dwwwwww@gmail.com>
  • Loading branch information
Xeonacid committed Aug 18, 2024
1 parent 90856f8 commit 8ef492b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions prov/opx/include/opa_user_gen1.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include "opa_udebug.h"
#include "opa_service.h"
#include "opa_user.h"
#include "ofi_mem.h"

#define HFI_RHF_USE_EGRBFR_MASK 0x1
#define HFI_RHF_USE_EGRBFR_SHIFT 15
Expand Down Expand Up @@ -567,7 +568,7 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl,
#endif
FI_DBG(&fi_opx_provider, FI_LOG_MR,
"OPX_DEBUG_ENTRY update [%p - %p], length %u (pages %lu)\n",
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE);
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]);

cmd.len = sizeof(tidinfo);
cmd.addr = (__u64) &tidinfo;
Expand All @@ -586,9 +587,9 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl,
FI_WARN(&fi_opx_provider, FI_LOG_MR,
"PARTIAL UPDATE errno %d \"%s\" INPUTS vaddr [%p - %p] length %u (pages %lu), OUTPUTS vaddr [%p - %p] length %u (pages %lu), tidcnt %u\n",
errno, strerror(errno), (void*)vaddr,
(void*)(vaddr + *length), *length, (*length) / PAGE_SIZE,
(void*)(vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE],
(void*)rettidinfo->vaddr,(void*)(rettidinfo->vaddr + rettidinfo->length),
rettidinfo->length, rettidinfo->length / PAGE_SIZE,
rettidinfo->length, rettidinfo->length / page_sizes[OFI_PAGE_SIZE],
rettidinfo->tidcnt);
}
/* Always update outputs, even on soft errors */
Expand All @@ -598,21 +599,21 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl,
FI_DBG(&fi_opx_provider, FI_LOG_MR,
"TID UPDATE IOCTL returned %d errno %d \"%s\" vaddr [%p - %p] length %u (pages %lu), tidcnt %u\n",
err, errno, strerror(errno), (void*)vaddr,
(void*)(vaddr + *length), *length, (*length) / PAGE_SIZE, *tidcnt);
(void*)(vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE], *tidcnt);

return 0;
}

if (errno == ENOSPC) {
FI_DBG(&fi_opx_provider, FI_LOG_MR,
"IOCTL FAILED : No TIDs available, requested range=%p-%p (%u bytes, %lu pages)\n",
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE);
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]);
err = -FI_ENOSPC;
} else {
FI_WARN(&fi_opx_provider, FI_LOG_MR,
"IOCTL FAILED ERR %d errno %d \"%s\" requested range=%p-%p (%u bytes, %lu pages)\n",
err, errno, strerror(errno),
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE);
(void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]);
}

/* Hard error, we can't trust these */
Expand Down

0 comments on commit 8ef492b

Please sign in to comment.