This source file includes following definitions.
- scifdev_alive
- scif_verify_epd
- scif_anon_inode_getfile
- scif_anon_inode_fput
1
2
3
4
5
6
7
8
9 #ifndef SCIF_EPD_H
10 #define SCIF_EPD_H
11
12 #include <linux/delay.h>
13 #include <linux/scif.h>
14 #include <linux/scif_ioctl.h>
15
16 #define SCIF_EPLOCK_HELD true
17
18 enum scif_epd_state {
19 SCIFEP_UNBOUND,
20 SCIFEP_BOUND,
21 SCIFEP_LISTENING,
22 SCIFEP_CONNECTED,
23 SCIFEP_CONNECTING,
24 SCIFEP_MAPPING,
25 SCIFEP_CLOSING,
26 SCIFEP_CLLISTEN,
27 SCIFEP_DISCONNECTED,
28 SCIFEP_ZOMBIE
29 };
30
31
32
33
34
35
36
37 struct scif_conreq {
38 struct scifmsg msg;
39 struct list_head list;
40 };
41
42
43 #define SCIF_ENDPT_QP_SIZE 0x1000
44
45
46
47
48
49
50
51
52
53 struct scif_endpt_qp_info {
54 struct scif_qp *qp;
55 dma_addr_t qp_offset;
56 dma_addr_t gnt_pld;
57 };
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 struct scif_endpt {
97 enum scif_epd_state state;
98 spinlock_t lock;
99 struct scif_port_id port;
100 struct scif_port_id peer;
101 int backlog;
102 struct scif_endpt_qp_info qp_info;
103 struct scif_dev *remote_dev;
104 u64 remote_ep;
105 int conreqcnt;
106 struct files_struct *files;
107 struct list_head conlist;
108 wait_queue_head_t conwq;
109 struct completion discon;
110 wait_queue_head_t sendwq;
111 wait_queue_head_t recvwq;
112 struct mutex sendlock;
113 struct mutex recvlock;
114 struct list_head list;
115 struct list_head li_accept;
116 int acceptcnt;
117 struct list_head liacceptlist;
118 struct list_head miacceptlist;
119 struct scif_endpt *listenep;
120 struct scif_port_id conn_port;
121 int conn_err;
122 int conn_async_state;
123 wait_queue_head_t conn_pend_wq;
124 struct list_head conn_list;
125 struct scif_endpt_rma_info rma_info;
126 struct list_head mmu_list;
127 struct file *anon;
128 };
129
130 static inline int scifdev_alive(struct scif_endpt *ep)
131 {
132 return _scifdev_alive(ep->remote_dev);
133 }
134
135
136
137
138
139
140
141
142 static inline int scif_verify_epd(struct scif_endpt *ep)
143 {
144 if (ep->state == SCIFEP_DISCONNECTED)
145 return -ECONNRESET;
146
147 if (ep->state != SCIFEP_CONNECTED)
148 return -ENOTCONN;
149
150 if (!scifdev_alive(ep))
151 return -ENODEV;
152
153 return 0;
154 }
155
156 static inline int scif_anon_inode_getfile(scif_epd_t epd)
157 {
158 epd->anon = anon_inode_getfile("scif", &scif_anon_fops, NULL, 0);
159
160 return PTR_ERR_OR_ZERO(epd->anon);
161 }
162
163 static inline void scif_anon_inode_fput(scif_epd_t epd)
164 {
165 if (epd->anon) {
166 fput(epd->anon);
167 epd->anon = NULL;
168 }
169 }
170
171 void scif_cleanup_zombie_epd(void);
172 void scif_teardown_ep(void *endpt);
173 void scif_cleanup_ep_qp(struct scif_endpt *ep);
174 void scif_add_epd_to_zombie_list(struct scif_endpt *ep, bool eplock_held);
175 void scif_get_node_info(void);
176 void scif_send_acks(struct scif_dev *dev);
177 void scif_conn_handler(struct work_struct *work);
178 int scif_rsrv_port(u16 port);
179 void scif_get_port(u16 port);
180 int scif_get_new_port(void);
181 void scif_put_port(u16 port);
182 int scif_user_send(scif_epd_t epd, void __user *msg, int len, int flags);
183 int scif_user_recv(scif_epd_t epd, void __user *msg, int len, int flags);
184 void scif_cnctreq(struct scif_dev *scifdev, struct scifmsg *msg);
185 void scif_cnctgnt(struct scif_dev *scifdev, struct scifmsg *msg);
186 void scif_cnctgnt_ack(struct scif_dev *scifdev, struct scifmsg *msg);
187 void scif_cnctgnt_nack(struct scif_dev *scifdev, struct scifmsg *msg);
188 void scif_cnctrej(struct scif_dev *scifdev, struct scifmsg *msg);
189 void scif_discnct(struct scif_dev *scifdev, struct scifmsg *msg);
190 void scif_discnt_ack(struct scif_dev *scifdev, struct scifmsg *msg);
191 void scif_clientsend(struct scif_dev *scifdev, struct scifmsg *msg);
192 void scif_clientrcvd(struct scif_dev *scifdev, struct scifmsg *msg);
193 int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block);
194 int __scif_flush(scif_epd_t epd);
195 int scif_mmap(struct vm_area_struct *vma, scif_epd_t epd);
196 __poll_t __scif_pollfd(struct file *f, poll_table *wait,
197 struct scif_endpt *ep);
198 int __scif_pin_pages(void *addr, size_t len, int *out_prot,
199 int map_flags, scif_pinned_pages_t *pages);
200 #endif