X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flinux%2Flustre_net.h;h=238468571da387fb3d169112d94f3d77ebeba18b;hb=867f92a22c4dae8b8c5d26b6c94150691d22e4a6;hp=2aa68624d38a1e9fd9bd713a237d75e2455adbac;hpb=6060a61624cc48b18b59a7bb99fdde355b0186ee;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 2aa6862..2384685 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -24,129 +24,205 @@ #define _LUSTRE_NET_H #include +#include +#include #include #include -/* FOO_REQUEST_PORTAL receives requests for the FOO subsystem. - * FOO_REPLY_PORTAL receives replies _from_ the FOO subsystem. */ +/* FOO_REQUEST_PORTAL is for incoming requests on the FOO + * FOO_REPLY_PORTAL is for incoming replies on the FOO + * FOO_BULK_PORTAL is for incoming bulk on the FOO + */ + #define OSC_REQUEST_PORTAL 1 #define OSC_REPLY_PORTAL 2 -#define MDS_REQUEST_PORTAL 3 -#define MDS_REPLY_PORTAL 4 -#define OST_REQUEST_PORTAL 5 -#define OST_REPLY_PORTAL 6 -#define MDC_BULK_PORTAL 7 -#define MDS_BULK_PORTAL 8 -#define OSC_BULK_PORTAL 9 -#define OST_BULK_PORTAL 10 +#define OSC_BULK_PORTAL 3 -/* default rpc ring length */ -#define RPC_RING_LENGTH 2 +#define OST_REQUEST_PORTAL 4 +#define OST_REPLY_PORTAL 5 +#define OST_BULK_PORTAL 6 -/* generic wrappable next */ -#define NEXT_INDEX(index, max) (((index+1) >= max) ? 0 : (index+1)) +#define MDC_REQUEST_PORTAL 7 +#define MDC_REPLY_PORTAL 8 +#define MDC_BULK_PORTAL 9 +#define MDS_REQUEST_PORTAL 10 +#define MDS_REPLY_PORTAL 11 +#define MDS_BULK_PORTAL 12 -struct ptlrpc_service { - char *srv_buf[RPC_RING_LENGTH]; - __u32 srv_buf_size; - __u32 srv_me_active; - __u32 srv_me_tail; - __u32 srv_md_active; - __u32 srv_ring_length; - __u32 srv_portal; - __u32 srv_ref_count[RPC_RING_LENGTH]; +#define LDLM_REQUEST_PORTAL 13 +#define LDLM_REPLY_PORTAL 14 - struct lustre_peer srv_self; +/* default rpc ring length */ +#define RPC_RING_LENGTH 2 - /* FIXME: perhaps a list of EQs, if multiple NIs are used? */ - ptl_handle_eq_t srv_eq_h; +#define SVC_STOPPING 1 +#define SVC_RUNNING 2 +#define SVC_STOPPED 4 +#define SVC_KILLED 8 +#define SVC_EVENT 16 +#define SVC_LIST 32 +#define SVC_SIGNAL 64 - ptl_handle_me_t srv_me_h[RPC_RING_LENGTH]; - ptl_process_id_t srv_id; - ptl_md_t srv_md[RPC_RING_LENGTH]; - ptl_handle_md_t srv_md_h[RPC_RING_LENGTH]; - wait_queue_head_t *srv_wait_queue; - int (*srv_req_unpack)(char *buf, int len, struct ptlreq_hdr **, - union ptl_req *); - int (*srv_rep_pack)(char *buf1, int len1, char *buf2, int len2, - struct ptlrep_hdr **, union ptl_rep*, - int *replen, char **repbuf); +struct ptlrpc_client { + struct lustre_peer cli_server; + struct obd_device *cli_obd; + __u32 cli_request_portal; + __u32 cli_reply_portal; + + spinlock_t cli_lock; + __u32 cli_xid; + struct semaphore cli_rpc_sem; }; +/* These do double-duty in rq_type and rq_flags */ +#define PTL_RPC_INTR 1 +#define PTL_RPC_REQUEST 2 +#define PTL_RPC_REPLY 3 +#define PTL_RPC_BULK 4 +#define PTL_RPC_SENT 5 +#define PTL_BULK_SENT 6 +#define PTL_BULK_RCVD 7 +#define PTL_RPC_ERR 8 struct ptlrpc_request { - struct list_head rq_list; - struct mds_obd *rq_obd; - struct ost_obd *rq_ost; - int rq_status; - - char *rq_reqbuf; - int rq_reqlen; - struct ptlreq_hdr *rq_reqhdr; - union ptl_req rq_req; + int rq_type; /* one of PTL_RPC_REQUEST, PTL_RPC_REPLY, PTL_RPC_BULK */ + spinlock_t rq_lock; + struct list_head rq_list; + struct obd_device *rq_obd; + int rq_status; + int rq_flags; + __u32 rq_connid; __u32 rq_xid; - char *rq_repbuf; - int rq_replen; - struct ptlrep_hdr *rq_rephdr; - union ptl_rep rq_rep; + int rq_reqlen; + char *rq_reqbuf; + struct lustre_msg *rq_reqmsg; + + int rq_replen; + char *rq_repbuf; + struct lustre_msg *rq_repmsg; char *rq_bulkbuf; int rq_bulklen; - int (*rq_bulk_cb)(struct ptlrpc_request *, void *); void * rq_reply_handle; - wait_queue_head_t rq_wait_for_rep; - wait_queue_head_t rq_wait_for_bulk; + wait_queue_head_t rq_wait_for_rep; + /* incoming reply */ ptl_md_t rq_reply_md; ptl_handle_md_t rq_reply_md_h; + ptl_handle_me_t rq_reply_me_h; + + /* outgoing req/rep */ ptl_md_t rq_req_md; - ptl_md_t rq_bulk_md; - ptl_handle_md_t rq_bulk_md_h; + ptl_handle_md_t rq_req_md_h; + __u32 rq_reply_portal; __u32 rq_req_portal; - __u32 rq_bulk_portal; struct lustre_peer rq_peer; }; -struct ptlrpc_client { - struct lustre_peer cli_server; - __u32 cli_request_portal; - __u32 cli_reply_portal; - __u32 cli_xid; - int (*cli_rep_unpack)(char *buf, int len, struct ptlrep_hdr **, - union ptl_rep *); - int (*cli_req_pack)(char *buf1, int len1, char *buf2, int len2, - struct ptlreq_hdr **, union ptl_req*, - int *reqlen, char **reqbuf); - int (*cli_enqueue)(struct ptlrpc_request *req); +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; -/* rpc/rpc.c */ -int ptl_send_buf(struct ptlrpc_request *request, struct lustre_peer *peer, - int portal, int is_request); -int ptl_send_rpc(struct ptlrpc_request *request, struct lustre_peer *peer); -int ptl_received_rpc(struct ptlrpc_service *service); -int rpc_register_service(struct ptlrpc_service *service, char *uuid); -int rpc_unregister_service(struct ptlrpc_service *service); -int ptlrpc_queue_wait(struct ptlrpc_request *req, - struct ptlrpc_client *cl); -struct ptlrpc_request *ptlrpc_prep_req(struct ptlrpc_client *cl, - int opcode, int namelen, char *name, - int tgtlen, char *tgt); -void ptlrpc_free_req(struct ptlrpc_request *request); + __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; -/* FIXME */ -#if 1 -# define LUSTRE_NAL "ksocknal" -#else -# define LUSTRE_NAL "kqswnal" -#endif + 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); +int rpc_unregister_service(struct ptlrpc_service *service); + +struct ptlrpc_svc_data { + char *name; + struct ptlrpc_service *svc; + struct obd_device *dev; +}; + +/* rpc/pack_generic.c */ +int lustre_pack_msg(int count, int *lens, char **bufs, int *len, char **buf); +int lustre_msg_size(int count, int *lengths); +int lustre_unpack_msg(char *buf, int len); +void *lustre_msg_buf(struct lustre_msg *m, int n); #endif