IB/hfi1: Consolidate the creation of user TIDs

The function rcventry2tidinfo() only creates part of
a TID and all calls to it are only used to make a user
TID.  Consolidate all usage into a single routine.

Signed-off-by: Dean Luick <dean.luick@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Link: https://lore.kernel.org/r/167329105402.1472990.9685946655723333660.stgit@awfm-02.cornelisnetworks.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Dean Luick 2023-01-09 14:04:14 -05:00 committed by Leon Romanovsky
parent a479433a6b
commit d8f4ab01c6
2 changed files with 6 additions and 7 deletions

View File

@ -133,12 +133,13 @@ static inline struct tid_group *tid_group_pop(struct exp_tid_set *set)
return grp; return grp;
} }
static inline u32 rcventry2tidinfo(u32 rcventry) static inline u32 create_tid(u32 rcventry, u32 npages)
{ {
u32 pair = rcventry & ~0x1; u32 pair = rcventry & ~0x1;
return EXP_TID_SET(IDX, pair >> 1) | return EXP_TID_SET(IDX, pair >> 1) |
EXP_TID_SET(CTRL, 1 << (rcventry - pair)); EXP_TID_SET(CTRL, 1 << (rcventry - pair)) |
EXP_TID_SET(LEN, npages);
} }
/** /**

View File

@ -652,8 +652,7 @@ static int program_rcvarray(struct hfi1_filedata *fd, struct tid_user_buf *tbuf,
return ret; return ret;
mapped += npages; mapped += npages;
tidinfo = rcventry2tidinfo(rcventry - uctxt->expected_base) | tidinfo = create_tid(rcventry - uctxt->expected_base, npages);
EXP_TID_SET(LEN, npages);
tidlist[(*tididx)++] = tidinfo; tidlist[(*tididx)++] = tidinfo;
grp->used++; grp->used++;
grp->map |= 1 << useidx++; grp->map |= 1 << useidx++;
@ -853,9 +852,8 @@ static bool tid_rb_invalidate(struct mmu_interval_notifier *mni,
spin_lock(&fdata->invalid_lock); spin_lock(&fdata->invalid_lock);
if (fdata->invalid_tid_idx < uctxt->expected_count) { if (fdata->invalid_tid_idx < uctxt->expected_count) {
fdata->invalid_tids[fdata->invalid_tid_idx] = fdata->invalid_tids[fdata->invalid_tid_idx] =
rcventry2tidinfo(node->rcventry - uctxt->expected_base); create_tid(node->rcventry - uctxt->expected_base,
fdata->invalid_tids[fdata->invalid_tid_idx] |= node->npages);
EXP_TID_SET(LEN, node->npages);
if (!fdata->invalid_tid_idx) { if (!fdata->invalid_tid_idx) {
unsigned long *ev; unsigned long *ev;