user_exp_rcv.h (1500B)
1/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ 2/* 3 * Copyright(c) 2020 - Cornelis Networks, Inc. 4 * Copyright(c) 2015 - 2017 Intel Corporation. 5 */ 6 7#ifndef _HFI1_USER_EXP_RCV_H 8#define _HFI1_USER_EXP_RCV_H 9 10#include "hfi.h" 11#include "exp_rcv.h" 12 13struct tid_pageset { 14 u16 idx; 15 u16 count; 16}; 17 18struct tid_user_buf { 19 unsigned long vaddr; 20 unsigned long length; 21 unsigned int npages; 22 struct page **pages; 23 struct tid_pageset *psets; 24 unsigned int n_psets; 25}; 26 27struct tid_rb_node { 28 struct mmu_interval_notifier notifier; 29 struct hfi1_filedata *fdata; 30 unsigned long phys; 31 struct tid_group *grp; 32 u32 rcventry; 33 dma_addr_t dma_addr; 34 bool freed; 35 unsigned int npages; 36 struct page *pages[]; 37}; 38 39static inline int num_user_pages(unsigned long addr, 40 unsigned long len) 41{ 42 const unsigned long spage = addr & PAGE_MASK; 43 const unsigned long epage = (addr + len - 1) & PAGE_MASK; 44 45 return 1 + ((epage - spage) >> PAGE_SHIFT); 46} 47 48int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd, 49 struct hfi1_ctxtdata *uctxt); 50void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd); 51int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, 52 struct hfi1_tid_info *tinfo); 53int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd, 54 struct hfi1_tid_info *tinfo); 55int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd, 56 struct hfi1_tid_info *tinfo); 57 58static inline struct mm_struct *mm_from_tid_node(struct tid_rb_node *node) 59{ 60 return node->notifier.mm; 61} 62 63#endif /* _HFI1_USER_EXP_RCV_H */