Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
0002 /*
0003  * Copyright(c) 2020 - Cornelis Networks, Inc.
0004  * Copyright(c) 2015 - 2017 Intel Corporation.
0005  */
0006 
0007 #ifndef _HFI1_USER_EXP_RCV_H
0008 #define _HFI1_USER_EXP_RCV_H
0009 
0010 #include "hfi.h"
0011 #include "exp_rcv.h"
0012 
0013 struct tid_pageset {
0014     u16 idx;
0015     u16 count;
0016 };
0017 
0018 struct tid_user_buf {
0019     unsigned long vaddr;
0020     unsigned long length;
0021     unsigned int npages;
0022     struct page **pages;
0023     struct tid_pageset *psets;
0024     unsigned int n_psets;
0025 };
0026 
0027 struct tid_rb_node {
0028     struct mmu_interval_notifier notifier;
0029     struct hfi1_filedata *fdata;
0030     unsigned long phys;
0031     struct tid_group *grp;
0032     u32 rcventry;
0033     dma_addr_t dma_addr;
0034     bool freed;
0035     unsigned int npages;
0036     struct page *pages[];
0037 };
0038 
0039 static inline int num_user_pages(unsigned long addr,
0040                  unsigned long len)
0041 {
0042     const unsigned long spage = addr & PAGE_MASK;
0043     const unsigned long epage = (addr + len - 1) & PAGE_MASK;
0044 
0045     return 1 + ((epage - spage) >> PAGE_SHIFT);
0046 }
0047 
0048 int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd,
0049                struct hfi1_ctxtdata *uctxt);
0050 void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd);
0051 int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
0052                 struct hfi1_tid_info *tinfo);
0053 int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd,
0054                 struct hfi1_tid_info *tinfo);
0055 int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd,
0056                   struct hfi1_tid_info *tinfo);
0057 
0058 static inline struct mm_struct *mm_from_tid_node(struct tid_rb_node *node)
0059 {
0060     return node->notifier.mm;
0061 }
0062 
0063 #endif /* _HFI1_USER_EXP_RCV_H */