+struct ptlrpc_bulk_desc {
+ int b_flags;
+ struct lustre_peer b_peer;
+ __u32 b_portal;
+ char *b_buf;
+ int b_buflen;
+ int (*b_cb)(struct ptlrpc_bulk_desc *, void *);
+ struct page *b_page;
+ struct obd_conn b_conn;
+ __u32 b_xid;
+
+ wait_queue_head_t b_waitq;
+
+ ptl_md_t b_md;
+ ptl_handle_md_t b_md_h;
+ ptl_handle_me_t b_me_h;
+};
+
+struct ptlrpc_service {
+ /* incoming request buffers */
+ /* FIXME: perhaps a list of EQs, if multiple NIs are used? */
+ char *srv_buf[RPC_RING_LENGTH];
+ __u32 srv_ref_count[RPC_RING_LENGTH];
+ ptl_handle_me_t srv_me_h[RPC_RING_LENGTH];
+ __u32 srv_buf_size;
+ __u32 srv_ring_length;
+ __u32 srv_req_portal;
+ __u32 srv_rep_portal;
+
+ __u32 srv_xid;
+
+ /* event queue */
+ ptl_handle_eq_t srv_eq_h;
+
+ __u32 srv_flags;
+ struct lustre_peer srv_self;
+ ptl_process_id_t srv_id;
+
+ struct task_struct *srv_thread;
+ wait_queue_head_t srv_waitq;
+ wait_queue_head_t srv_ctl_waitq;
+
+ spinlock_t srv_lock;
+ struct list_head srv_reqs;
+ ptl_event_t srv_ev;
+ int (*srv_handler)(struct obd_device *obddev,
+ struct ptlrpc_service *svc,
+ struct ptlrpc_request *req);
+};
+
+typedef int (*svc_handler_t)(struct obd_device *obddev,
+ struct ptlrpc_service *svc,
+ struct ptlrpc_request *req);
+
+
+
+/* rpc/niobuf.c */
+int ptlrpc_check_bulk_sent(struct ptlrpc_bulk_desc *);
+int ptlrpc_send_bulk(struct ptlrpc_bulk_desc *, int portal);
+int ptl_send_buf(struct ptlrpc_request *, struct lustre_peer *, int portal);
+int ptlrpc_register_bulk(struct ptlrpc_bulk_desc *);
+int ptlrpc_abort_bulk(struct ptlrpc_bulk_desc *bulk);
+int ptlrpc_reply(struct obd_device *obddev, struct ptlrpc_service *svc,
+ struct ptlrpc_request *req);
+int ptlrpc_error(struct obd_device *obddev, struct ptlrpc_service *svc,
+ struct ptlrpc_request *req);
+int ptl_send_rpc(struct ptlrpc_request *request, struct ptlrpc_client *cl);
+void ptlrpc_link_svc_me(struct ptlrpc_service *service, int i);
+
+/* rpc/client.c */
+int ptlrpc_connect_client(int dev, char *uuid, int req_portal, int rep_portal,
+ struct ptlrpc_client *cl);
+int ptlrpc_queue_wait(struct ptlrpc_client *cl, struct ptlrpc_request *req);
+int ptlrpc_queue_req(struct ptlrpc_client *peer, struct ptlrpc_request *req);
+struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, int opcode,
+ int count, int *lengths, char **bufs);
+void ptlrpc_free_req(struct ptlrpc_request *request);
+struct ptlrpc_bulk_desc *ptlrpc_prep_bulk(struct lustre_peer *);
+int ptlrpc_check_status(struct ptlrpc_request *req, int err);
+
+/* rpc/service.c */
+struct ptlrpc_service *
+ptlrpc_init_svc(__u32 bufsize, int req_portal, int rep_portal, char *uuid,
+ svc_handler_t);
+void ptlrpc_stop_thread(struct ptlrpc_service *svc);
+int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc,
+ char *name);