aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c68
-rw-r--r--drivers/infiniband/hw/hfi1/user_exp_rcv.c45
-rw-r--r--drivers/infiniband/hw/hfi1/user_exp_rcv.h11
-rw-r--r--drivers/infiniband/hw/hfi1/user_sdma.c14
-rw-r--r--drivers/infiniband/hw/hfi1/user_sdma.h9
5 files changed, 72 insertions, 75 deletions
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 0b77283078e5..ab798a81d6b4 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -80,16 +80,18 @@ static u64 kvirt_to_phys(void *addr);
80static int assign_ctxt(struct file *fp, struct hfi1_user_info *uinfo); 80static int assign_ctxt(struct file *fp, struct hfi1_user_info *uinfo);
81static int init_subctxts(struct hfi1_ctxtdata *uctxt, 81static int init_subctxts(struct hfi1_ctxtdata *uctxt,
82 const struct hfi1_user_info *uinfo); 82 const struct hfi1_user_info *uinfo);
83static int user_init(struct file *fp); 83static int user_init(struct hfi1_filedata *fd);
84static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len); 84static int get_ctxt_info(struct hfi1_filedata *fd, void __user *ubase,
85static int get_base_info(struct file *fp, void __user *ubase, __u32 len); 85 __u32 len);
86static int setup_ctxt(struct file *fp); 86static int get_base_info(struct hfi1_filedata *fd, void __user *ubase,
87 __u32 len);
88static int setup_ctxt(struct hfi1_filedata *fd);
87static int setup_subctxt(struct hfi1_ctxtdata *uctxt); 89static int setup_subctxt(struct hfi1_ctxtdata *uctxt);
88static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo, 90static int get_user_context(struct hfi1_filedata *fd,
89 int devno); 91 struct hfi1_user_info *uinfo, int devno);
90static int find_shared_ctxt(struct file *fp, 92static int find_shared_ctxt(struct hfi1_filedata *fd,
91 const struct hfi1_user_info *uinfo); 93 const struct hfi1_user_info *uinfo);
92static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, 94static int allocate_ctxt(struct hfi1_filedata *fd, struct hfi1_devdata *dd,
93 struct hfi1_user_info *uinfo); 95 struct hfi1_user_info *uinfo);
94static unsigned int poll_urgent(struct file *fp, struct poll_table_struct *pt); 96static unsigned int poll_urgent(struct file *fp, struct poll_table_struct *pt);
95static unsigned int poll_next(struct file *fp, struct poll_table_struct *pt); 97static unsigned int poll_next(struct file *fp, struct poll_table_struct *pt);
@@ -238,17 +240,17 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
238 ret = assign_ctxt(fp, &uinfo); 240 ret = assign_ctxt(fp, &uinfo);
239 if (ret < 0) 241 if (ret < 0)
240 return ret; 242 return ret;
241 ret = setup_ctxt(fp); 243 ret = setup_ctxt(fd);
242 if (ret) 244 if (ret)
243 return ret; 245 return ret;
244 ret = user_init(fp); 246 ret = user_init(fd);
245 break; 247 break;
246 case HFI1_IOCTL_CTXT_INFO: 248 case HFI1_IOCTL_CTXT_INFO:
247 ret = get_ctxt_info(fp, (void __user *)(unsigned long)arg, 249 ret = get_ctxt_info(fd, (void __user *)(unsigned long)arg,
248 sizeof(struct hfi1_ctxt_info)); 250 sizeof(struct hfi1_ctxt_info));
249 break; 251 break;
250 case HFI1_IOCTL_USER_INFO: 252 case HFI1_IOCTL_USER_INFO:
251 ret = get_base_info(fp, (void __user *)(unsigned long)arg, 253 ret = get_base_info(fd, (void __user *)(unsigned long)arg,
252 sizeof(struct hfi1_base_info)); 254 sizeof(struct hfi1_base_info));
253 break; 255 break;
254 case HFI1_IOCTL_CREDIT_UPD: 256 case HFI1_IOCTL_CREDIT_UPD:
@@ -262,7 +264,7 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
262 sizeof(tinfo))) 264 sizeof(tinfo)))
263 return -EFAULT; 265 return -EFAULT;
264 266
265 ret = hfi1_user_exp_rcv_setup(fp, &tinfo); 267 ret = hfi1_user_exp_rcv_setup(fd, &tinfo);
266 if (!ret) { 268 if (!ret) {
267 /* 269 /*
268 * Copy the number of tidlist entries we used 270 * Copy the number of tidlist entries we used
@@ -284,7 +286,7 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
284 sizeof(tinfo))) 286 sizeof(tinfo)))
285 return -EFAULT; 287 return -EFAULT;
286 288
287 ret = hfi1_user_exp_rcv_clear(fp, &tinfo); 289 ret = hfi1_user_exp_rcv_clear(fd, &tinfo);
288 if (ret) 290 if (ret)
289 break; 291 break;
290 addr = arg + offsetof(struct hfi1_tid_info, tidcnt); 292 addr = arg + offsetof(struct hfi1_tid_info, tidcnt);
@@ -299,7 +301,7 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
299 sizeof(tinfo))) 301 sizeof(tinfo)))
300 return -EFAULT; 302 return -EFAULT;
301 303
302 ret = hfi1_user_exp_rcv_invalid(fp, &tinfo); 304 ret = hfi1_user_exp_rcv_invalid(fd, &tinfo);
303 if (ret) 305 if (ret)
304 break; 306 break;
305 addr = arg + offsetof(struct hfi1_tid_info, tidcnt); 307 addr = arg + offsetof(struct hfi1_tid_info, tidcnt);
@@ -436,7 +438,7 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)
436 unsigned long count = 0; 438 unsigned long count = 0;
437 439
438 ret = hfi1_user_sdma_process_request( 440 ret = hfi1_user_sdma_process_request(
439 kiocb->ki_filp, (struct iovec *)(from->iov + done), 441 fd, (struct iovec *)(from->iov + done),
440 dim, &count); 442 dim, &count);
441 if (ret) { 443 if (ret) {
442 reqs = ret; 444 reqs = ret;
@@ -863,7 +865,7 @@ static int assign_ctxt(struct file *fp, struct hfi1_user_info *uinfo)
863 if (uinfo->subctxt_cnt) { 865 if (uinfo->subctxt_cnt) {
864 struct hfi1_filedata *fd = fp->private_data; 866 struct hfi1_filedata *fd = fp->private_data;
865 867
866 ret = find_shared_ctxt(fp, uinfo); 868 ret = find_shared_ctxt(fd, uinfo);
867 if (ret < 0) 869 if (ret < 0)
868 goto done_unlock; 870 goto done_unlock;
869 if (ret) { 871 if (ret) {
@@ -878,7 +880,7 @@ static int assign_ctxt(struct file *fp, struct hfi1_user_info *uinfo)
878 */ 880 */
879 if (!ret) { 881 if (!ret) {
880 i_minor = iminor(file_inode(fp)) - HFI1_USER_MINOR_BASE; 882 i_minor = iminor(file_inode(fp)) - HFI1_USER_MINOR_BASE;
881 ret = get_user_context(fp, uinfo, i_minor); 883 ret = get_user_context(fp->private_data, uinfo, i_minor);
882 } 884 }
883done_unlock: 885done_unlock:
884 mutex_unlock(&hfi1_mutex); 886 mutex_unlock(&hfi1_mutex);
@@ -886,8 +888,8 @@ done:
886 return ret; 888 return ret;
887} 889}
888 890
889static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo, 891static int get_user_context(struct hfi1_filedata *fd,
890 int devno) 892 struct hfi1_user_info *uinfo, int devno)
891{ 893{
892 struct hfi1_devdata *dd = NULL; 894 struct hfi1_devdata *dd = NULL;
893 int devmax, npresent, nup; 895 int devmax, npresent, nup;
@@ -905,15 +907,14 @@ static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo,
905 else if (!dd->freectxts) 907 else if (!dd->freectxts)
906 return -EBUSY; 908 return -EBUSY;
907 909
908 return allocate_ctxt(fp, dd, uinfo); 910 return allocate_ctxt(fd, dd, uinfo);
909} 911}
910 912
911static int find_shared_ctxt(struct file *fp, 913static int find_shared_ctxt(struct hfi1_filedata *fd,
912 const struct hfi1_user_info *uinfo) 914 const struct hfi1_user_info *uinfo)
913{ 915{
914 int devmax, ndev, i; 916 int devmax, ndev, i;
915 int ret = 0; 917 int ret = 0;
916 struct hfi1_filedata *fd = fp->private_data;
917 918
918 devmax = hfi1_count_units(NULL, NULL); 919 devmax = hfi1_count_units(NULL, NULL);
919 920
@@ -960,10 +961,9 @@ done:
960 return ret; 961 return ret;
961} 962}
962 963
963static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, 964static int allocate_ctxt(struct hfi1_filedata *fd, struct hfi1_devdata *dd,
964 struct hfi1_user_info *uinfo) 965 struct hfi1_user_info *uinfo)
965{ 966{
966 struct hfi1_filedata *fd = fp->private_data;
967 struct hfi1_ctxtdata *uctxt; 967 struct hfi1_ctxtdata *uctxt;
968 unsigned ctxt; 968 unsigned ctxt;
969 int ret, numa; 969 int ret, numa;
@@ -1113,10 +1113,9 @@ bail:
1113 return ret; 1113 return ret;
1114} 1114}
1115 1115
1116static int user_init(struct file *fp) 1116static int user_init(struct hfi1_filedata *fd)
1117{ 1117{
1118 unsigned int rcvctrl_ops = 0; 1118 unsigned int rcvctrl_ops = 0;
1119 struct hfi1_filedata *fd = fp->private_data;
1120 struct hfi1_ctxtdata *uctxt = fd->uctxt; 1119 struct hfi1_ctxtdata *uctxt = fd->uctxt;
1121 1120
1122 /* make sure that the context has already been setup */ 1121 /* make sure that the context has already been setup */
@@ -1179,10 +1178,10 @@ static int user_init(struct file *fp)
1179 return 0; 1178 return 0;
1180} 1179}
1181 1180
1182static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len) 1181static int get_ctxt_info(struct hfi1_filedata *fd, void __user *ubase,
1182 __u32 len)
1183{ 1183{
1184 struct hfi1_ctxt_info cinfo; 1184 struct hfi1_ctxt_info cinfo;
1185 struct hfi1_filedata *fd = fp->private_data;
1186 struct hfi1_ctxtdata *uctxt = fd->uctxt; 1185 struct hfi1_ctxtdata *uctxt = fd->uctxt;
1187 int ret = 0; 1186 int ret = 0;
1188 1187
@@ -1220,9 +1219,8 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len)
1220 return ret; 1219 return ret;
1221} 1220}
1222 1221
1223static int setup_ctxt(struct file *fp) 1222static int setup_ctxt(struct hfi1_filedata *fd)
1224{ 1223{
1225 struct hfi1_filedata *fd = fp->private_data;
1226 struct hfi1_ctxtdata *uctxt = fd->uctxt; 1224 struct hfi1_ctxtdata *uctxt = fd->uctxt;
1227 struct hfi1_devdata *dd = uctxt->dd; 1225 struct hfi1_devdata *dd = uctxt->dd;
1228 int ret = 0; 1226 int ret = 0;
@@ -1257,7 +1255,7 @@ static int setup_ctxt(struct file *fp)
1257 goto done; 1255 goto done;
1258 } 1256 }
1259 1257
1260 ret = hfi1_user_sdma_alloc_queues(uctxt, fp); 1258 ret = hfi1_user_sdma_alloc_queues(uctxt, fd);
1261 if (ret) 1259 if (ret)
1262 goto done; 1260 goto done;
1263 /* 1261 /*
@@ -1269,7 +1267,7 @@ static int setup_ctxt(struct file *fp)
1269 * (due to the above wait_event_interruptible() until the master 1267 * (due to the above wait_event_interruptible() until the master
1270 * is setup. 1268 * is setup.
1271 */ 1269 */
1272 ret = hfi1_user_exp_rcv_init(fp); 1270 ret = hfi1_user_exp_rcv_init(fd);
1273 if (ret) 1271 if (ret)
1274 goto done; 1272 goto done;
1275 1273
@@ -1278,10 +1276,10 @@ done:
1278 return ret; 1276 return ret;
1279} 1277}
1280 1278
1281static int get_base_info(struct file *fp, void __user *ubase, __u32 len) 1279static int get_base_info(struct hfi1_filedata *fd, void __user *ubase,
1280 __u32 len)
1282{ 1281{
1283 struct hfi1_base_info binfo; 1282 struct hfi1_base_info binfo;
1284 struct hfi1_filedata *fd = fp->private_data;
1285 struct hfi1_ctxtdata *uctxt = fd->uctxt; 1283 struct hfi1_ctxtdata *uctxt = fd->uctxt;
1286 struct hfi1_devdata *dd = uctxt->dd; 1284 struct hfi1_devdata *dd = uctxt->dd;
1287 ssize_t sz; 1285 ssize_t sz;
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
index 6090933d5171..22ffda8bf65f 100644
--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c
+++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
@@ -87,7 +87,7 @@ static void unlock_exp_tids(struct hfi1_ctxtdata *uctxt,
87 struct hfi1_filedata *fd); 87 struct hfi1_filedata *fd);
88static u32 find_phys_blocks(struct page **pages, unsigned npages, 88static u32 find_phys_blocks(struct page **pages, unsigned npages,
89 struct tid_pageset *list); 89 struct tid_pageset *list);
90static int set_rcvarray_entry(struct file *fp, unsigned long vaddr, 90static int set_rcvarray_entry(struct hfi1_filedata *fd, unsigned long vaddr,
91 u32 rcventry, struct tid_group *grp, 91 u32 rcventry, struct tid_group *grp,
92 struct page **pages, unsigned npages); 92 struct page **pages, unsigned npages);
93static int tid_rb_insert(void *arg, struct mmu_rb_node *node); 93static int tid_rb_insert(void *arg, struct mmu_rb_node *node);
@@ -95,12 +95,11 @@ static void cacheless_tid_rb_remove(struct hfi1_filedata *fdata,
95 struct tid_rb_node *tnode); 95 struct tid_rb_node *tnode);
96static void tid_rb_remove(void *arg, struct mmu_rb_node *node); 96static void tid_rb_remove(void *arg, struct mmu_rb_node *node);
97static int tid_rb_invalidate(void *arg, struct mmu_rb_node *mnode); 97static int tid_rb_invalidate(void *arg, struct mmu_rb_node *mnode);
98static int program_rcvarray(struct file *fp, unsigned long vaddr, 98static int program_rcvarray(struct hfi1_filedata *fd, unsigned long vaddr,
99 struct tid_group *grp, 99 struct tid_group *grp, struct tid_pageset *sets,
100 struct tid_pageset *sets,
101 unsigned start, u16 count, struct page **pages, 100 unsigned start, u16 count, struct page **pages,
102 u32 *tidlist, unsigned *tididx, unsigned *pmapped); 101 u32 *tidlist, unsigned *tididx, unsigned *pmapped);
103static int unprogram_rcvarray(struct file *fp, u32 tidinfo, 102static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo,
104 struct tid_group **grp); 103 struct tid_group **grp);
105static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node); 104static void clear_tid_node(struct hfi1_filedata *fd, struct tid_rb_node *node);
106 105
@@ -160,9 +159,8 @@ static inline void tid_group_move(struct tid_group *group,
160 * receive caching. This needs to be done after the context has 159 * receive caching. This needs to be done after the context has
161 * been configured with the eager/expected RcvEntry counts. 160 * been configured with the eager/expected RcvEntry counts.
162 */ 161 */
163int hfi1_user_exp_rcv_init(struct file *fp) 162int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd)
164{ 163{
165 struct hfi1_filedata *fd = fp->private_data;
166 struct hfi1_ctxtdata *uctxt = fd->uctxt; 164 struct hfi1_ctxtdata *uctxt = fd->uctxt;
167 struct hfi1_devdata *dd = uctxt->dd; 165 struct hfi1_devdata *dd = uctxt->dd;
168 unsigned tidbase; 166 unsigned tidbase;
@@ -361,10 +359,10 @@ static inline void rcv_array_wc_fill(struct hfi1_devdata *dd, u32 index)
361 * can fit into the group. If the group becomes fully 359 * can fit into the group. If the group becomes fully
362 * used, move it to tid_full_list. 360 * used, move it to tid_full_list.
363 */ 361 */
364int hfi1_user_exp_rcv_setup(struct file *fp, struct hfi1_tid_info *tinfo) 362int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
363 struct hfi1_tid_info *tinfo)
365{ 364{
366 int ret = 0, need_group = 0, pinned; 365 int ret = 0, need_group = 0, pinned;
367 struct hfi1_filedata *fd = fp->private_data;
368 struct hfi1_ctxtdata *uctxt = fd->uctxt; 366 struct hfi1_ctxtdata *uctxt = fd->uctxt;
369 struct hfi1_devdata *dd = uctxt->dd; 367 struct hfi1_devdata *dd = uctxt->dd;
370 unsigned npages, ngroups, pageidx = 0, pageset_count, npagesets, 368 unsigned npages, ngroups, pageidx = 0, pageset_count, npagesets,
@@ -461,7 +459,7 @@ int hfi1_user_exp_rcv_setup(struct file *fp, struct hfi1_tid_info *tinfo)
461 struct tid_group *grp = 459 struct tid_group *grp =
462 tid_group_pop(&uctxt->tid_group_list); 460 tid_group_pop(&uctxt->tid_group_list);
463 461
464 ret = program_rcvarray(fp, vaddr, grp, pagesets, 462 ret = program_rcvarray(fd, vaddr, grp, pagesets,
465 pageidx, dd->rcv_entries.group_size, 463 pageidx, dd->rcv_entries.group_size,
466 pages, tidlist, &tididx, &mapped); 464 pages, tidlist, &tididx, &mapped);
467 /* 465 /*
@@ -507,7 +505,7 @@ int hfi1_user_exp_rcv_setup(struct file *fp, struct hfi1_tid_info *tinfo)
507 unsigned use = min_t(unsigned, pageset_count - pageidx, 505 unsigned use = min_t(unsigned, pageset_count - pageidx,
508 grp->size - grp->used); 506 grp->size - grp->used);
509 507
510 ret = program_rcvarray(fp, vaddr, grp, pagesets, 508 ret = program_rcvarray(fd, vaddr, grp, pagesets,
511 pageidx, use, pages, tidlist, 509 pageidx, use, pages, tidlist,
512 &tididx, &mapped); 510 &tididx, &mapped);
513 if (ret < 0) { 511 if (ret < 0) {
@@ -557,7 +555,7 @@ nomem:
557 * everything done so far so we don't leak resources. 555 * everything done so far so we don't leak resources.
558 */ 556 */
559 tinfo->tidlist = (unsigned long)&tidlist; 557 tinfo->tidlist = (unsigned long)&tidlist;
560 hfi1_user_exp_rcv_clear(fp, tinfo); 558 hfi1_user_exp_rcv_clear(fd, tinfo);
561 tinfo->tidlist = 0; 559 tinfo->tidlist = 0;
562 ret = -EFAULT; 560 ret = -EFAULT;
563 goto bail; 561 goto bail;
@@ -581,10 +579,10 @@ bail:
581 return ret > 0 ? 0 : ret; 579 return ret > 0 ? 0 : ret;
582} 580}
583 581
584int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo) 582int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd,
583 struct hfi1_tid_info *tinfo)
585{ 584{
586 int ret = 0; 585 int ret = 0;
587 struct hfi1_filedata *fd = fp->private_data;
588 struct hfi1_ctxtdata *uctxt = fd->uctxt; 586 struct hfi1_ctxtdata *uctxt = fd->uctxt;
589 u32 *tidinfo; 587 u32 *tidinfo;
590 unsigned tididx; 588 unsigned tididx;
@@ -599,7 +597,7 @@ int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo)
599 597
600 mutex_lock(&uctxt->exp_lock); 598 mutex_lock(&uctxt->exp_lock);
601 for (tididx = 0; tididx < tinfo->tidcnt; tididx++) { 599 for (tididx = 0; tididx < tinfo->tidcnt; tididx++) {
602 ret = unprogram_rcvarray(fp, tidinfo[tididx], NULL); 600 ret = unprogram_rcvarray(fd, tidinfo[tididx], NULL);
603 if (ret) { 601 if (ret) {
604 hfi1_cdbg(TID, "Failed to unprogram rcv array %d", 602 hfi1_cdbg(TID, "Failed to unprogram rcv array %d",
605 ret); 603 ret);
@@ -616,9 +614,9 @@ int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo)
616 return ret; 614 return ret;
617} 615}
618 616
619int hfi1_user_exp_rcv_invalid(struct file *fp, struct hfi1_tid_info *tinfo) 617int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd,
618 struct hfi1_tid_info *tinfo)
620{ 619{
621 struct hfi1_filedata *fd = fp->private_data;
622 struct hfi1_ctxtdata *uctxt = fd->uctxt; 620 struct hfi1_ctxtdata *uctxt = fd->uctxt;
623 unsigned long *ev = uctxt->dd->events + 621 unsigned long *ev = uctxt->dd->events +
624 (((uctxt->ctxt - uctxt->dd->first_dyn_alloc_ctxt) * 622 (((uctxt->ctxt - uctxt->dd->first_dyn_alloc_ctxt) *
@@ -733,7 +731,7 @@ static u32 find_phys_blocks(struct page **pages, unsigned npages,
733 731
734/** 732/**
735 * program_rcvarray() - program an RcvArray group with receive buffers 733 * program_rcvarray() - program an RcvArray group with receive buffers
736 * @fp: file pointer 734 * @fd: filedata pointer
737 * @vaddr: starting user virtual address 735 * @vaddr: starting user virtual address
738 * @grp: RcvArray group 736 * @grp: RcvArray group
739 * @sets: array of struct tid_pageset holding information on physically 737 * @sets: array of struct tid_pageset holding information on physically
@@ -758,13 +756,12 @@ static u32 find_phys_blocks(struct page **pages, unsigned npages,
758 * -ENOMEM or -EFAULT on error from set_rcvarray_entry(), or 756 * -ENOMEM or -EFAULT on error from set_rcvarray_entry(), or
759 * number of RcvArray entries programmed. 757 * number of RcvArray entries programmed.
760 */ 758 */
761static int program_rcvarray(struct file *fp, unsigned long vaddr, 759static int program_rcvarray(struct hfi1_filedata *fd, unsigned long vaddr,
762 struct tid_group *grp, 760 struct tid_group *grp,
763 struct tid_pageset *sets, 761 struct tid_pageset *sets,
764 unsigned start, u16 count, struct page **pages, 762 unsigned start, u16 count, struct page **pages,
765 u32 *tidlist, unsigned *tididx, unsigned *pmapped) 763 u32 *tidlist, unsigned *tididx, unsigned *pmapped)
766{ 764{
767 struct hfi1_filedata *fd = fp->private_data;
768 struct hfi1_ctxtdata *uctxt = fd->uctxt; 765 struct hfi1_ctxtdata *uctxt = fd->uctxt;
769 struct hfi1_devdata *dd = uctxt->dd; 766 struct hfi1_devdata *dd = uctxt->dd;
770 u16 idx; 767 u16 idx;
@@ -805,7 +802,7 @@ static int program_rcvarray(struct file *fp, unsigned long vaddr,
805 npages = sets[setidx].count; 802 npages = sets[setidx].count;
806 pageidx = sets[setidx].idx; 803 pageidx = sets[setidx].idx;
807 804
808 ret = set_rcvarray_entry(fp, vaddr + (pageidx * PAGE_SIZE), 805 ret = set_rcvarray_entry(fd, vaddr + (pageidx * PAGE_SIZE),
809 rcventry, grp, pages + pageidx, 806 rcventry, grp, pages + pageidx,
810 npages); 807 npages);
811 if (ret) 808 if (ret)
@@ -827,12 +824,11 @@ static int program_rcvarray(struct file *fp, unsigned long vaddr,
827 return idx; 824 return idx;
828} 825}
829 826
830static int set_rcvarray_entry(struct file *fp, unsigned long vaddr, 827static int set_rcvarray_entry(struct hfi1_filedata *fd, unsigned long vaddr,
831 u32 rcventry, struct tid_group *grp, 828 u32 rcventry, struct tid_group *grp,
832 struct page **pages, unsigned npages) 829 struct page **pages, unsigned npages)
833{ 830{
834 int ret; 831 int ret;
835 struct hfi1_filedata *fd = fp->private_data;
836 struct hfi1_ctxtdata *uctxt = fd->uctxt; 832 struct hfi1_ctxtdata *uctxt = fd->uctxt;
837 struct tid_rb_node *node; 833 struct tid_rb_node *node;
838 struct hfi1_devdata *dd = uctxt->dd; 834 struct hfi1_devdata *dd = uctxt->dd;
@@ -886,10 +882,9 @@ static int set_rcvarray_entry(struct file *fp, unsigned long vaddr,
886 return 0; 882 return 0;
887} 883}
888 884
889static int unprogram_rcvarray(struct file *fp, u32 tidinfo, 885static int unprogram_rcvarray(struct hfi1_filedata *fd, u32 tidinfo,
890 struct tid_group **grp) 886 struct tid_group **grp)
891{ 887{
892 struct hfi1_filedata *fd = fp->private_data;
893 struct hfi1_ctxtdata *uctxt = fd->uctxt; 888 struct hfi1_ctxtdata *uctxt = fd->uctxt;
894 struct hfi1_devdata *dd = uctxt->dd; 889 struct hfi1_devdata *dd = uctxt->dd;
895 struct tid_rb_node *node; 890 struct tid_rb_node *node;
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.h b/drivers/infiniband/hw/hfi1/user_exp_rcv.h
index 8a33a09493b1..9787511b30b4 100644
--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.h
+++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.h
@@ -71,10 +71,13 @@
71 } while (0) 71 } while (0)
72 72
73void hfi1_user_exp_rcv_grp_free(struct hfi1_ctxtdata *uctxt); 73void hfi1_user_exp_rcv_grp_free(struct hfi1_ctxtdata *uctxt);
74int hfi1_user_exp_rcv_init(struct file *fp); 74int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd);
75int hfi1_user_exp_rcv_free(struct hfi1_filedata *fd); 75int hfi1_user_exp_rcv_free(struct hfi1_filedata *fd);
76int hfi1_user_exp_rcv_setup(struct file *fp, struct hfi1_tid_info *tinfo); 76int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
77int hfi1_user_exp_rcv_clear(struct file *fp, struct hfi1_tid_info *tinfo); 77 struct hfi1_tid_info *tinfo);
78int hfi1_user_exp_rcv_invalid(struct file *fp, struct hfi1_tid_info *tinfo); 78int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd,
79 struct hfi1_tid_info *tinfo);
80int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd,
81 struct hfi1_tid_info *tinfo);
79 82
80#endif /* _HFI1_USER_EXP_RCV_H */ 83#endif /* _HFI1_USER_EXP_RCV_H */
diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c
index 17142c526c62..4ac4e9d6c464 100644
--- a/drivers/infiniband/hw/hfi1/user_sdma.c
+++ b/drivers/infiniband/hw/hfi1/user_sdma.c
@@ -372,9 +372,9 @@ static void sdma_kmem_cache_ctor(void *obj)
372 memset(tx, 0, sizeof(*tx)); 372 memset(tx, 0, sizeof(*tx));
373} 373}
374 374
375int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) 375int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt,
376 struct hfi1_filedata *fd)
376{ 377{
377 struct hfi1_filedata *fd;
378 int ret = 0; 378 int ret = 0;
379 char buf[64]; 379 char buf[64];
380 struct hfi1_devdata *dd; 380 struct hfi1_devdata *dd;
@@ -382,13 +382,11 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
382 struct hfi1_user_sdma_pkt_q *pq; 382 struct hfi1_user_sdma_pkt_q *pq;
383 unsigned long flags; 383 unsigned long flags;
384 384
385 if (!uctxt || !fp) { 385 if (!uctxt || !fd) {
386 ret = -EBADF; 386 ret = -EBADF;
387 goto done; 387 goto done;
388 } 388 }
389 389
390 fd = fp->private_data;
391
392 if (!hfi1_sdma_comp_ring_size) { 390 if (!hfi1_sdma_comp_ring_size) {
393 ret = -EINVAL; 391 ret = -EINVAL;
394 goto done; 392 goto done;
@@ -536,11 +534,11 @@ static u8 dlid_to_selector(u16 dlid)
536 return mapping[hash]; 534 return mapping[hash];
537} 535}
538 536
539int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, 537int hfi1_user_sdma_process_request(struct hfi1_filedata *fd,
540 unsigned long dim, unsigned long *count) 538 struct iovec *iovec, unsigned long dim,
539 unsigned long *count)
541{ 540{
542 int ret = 0, i; 541 int ret = 0, i;
543 struct hfi1_filedata *fd = fp->private_data;
544 struct hfi1_ctxtdata *uctxt = fd->uctxt; 542 struct hfi1_ctxtdata *uctxt = fd->uctxt;
545 struct hfi1_user_sdma_pkt_q *pq = fd->pq; 543 struct hfi1_user_sdma_pkt_q *pq = fd->pq;
546 struct hfi1_user_sdma_comp_q *cq = fd->cq; 544 struct hfi1_user_sdma_comp_q *cq = fd->cq;
diff --git a/drivers/infiniband/hw/hfi1/user_sdma.h b/drivers/infiniband/hw/hfi1/user_sdma.h
index 95ec7832e5e9..9181d7cbe8f6 100644
--- a/drivers/infiniband/hw/hfi1/user_sdma.h
+++ b/drivers/infiniband/hw/hfi1/user_sdma.h
@@ -80,8 +80,11 @@ struct hfi1_user_sdma_comp_q {
80 struct hfi1_sdma_comp_entry *comps; 80 struct hfi1_sdma_comp_entry *comps;
81}; 81};
82 82
83int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp); 83int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt,
84 struct hfi1_filedata *fd);
84int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd); 85int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd);
85int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, 86int hfi1_user_sdma_process_request(struct hfi1_filedata *fd,
86 unsigned long dim, unsigned long *count); 87 struct iovec *iovec, unsigned long dim,
88 unsigned long *count);
89
87#endif /* _HFI1_USER_SDMA_H */ 90#endif /* _HFI1_USER_SDMA_H */