X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fklnds%2Fralnd%2Fralnd.h;h=0252cff6a3505f6aa11f860aae4079b0a684bfce;hb=6815097cbb06aa1a727e6bf7a8ee9e916a33ee6d;hp=53762ebfb57d1bd6286374f81eec048f3fbf14b4;hpb=979f4b66a21eb2398434793d92caa98a12817e58;p=fs%2Flustre-release.git diff --git a/lnet/klnds/ralnd/ralnd.h b/lnet/klnds/ralnd/ralnd.h index 53762eb..0252cff 100644 --- a/lnet/klnds/ralnd/ralnd.h +++ b/lnet/klnds/ralnd/ralnd.h @@ -49,10 +49,11 @@ #include #include +#include #define DEBUG_SUBSYSTEM S_NAL -#include +#include #include #include #include @@ -75,7 +76,7 @@ #define RANAL_NTX 64 /* # tx descs */ #define RANAL_NTX_NBLK 256 /* # reserved tx descs */ -#define RANAL_FMA_CQ_SIZE 8192 /* # entries in receive CQ +#define RANAL_FMA_CQ_SIZE 8192 /* # entries in receive CQ * (overflow is a performance hit) */ #define RANAL_RESCHED 100 /* # scheduler loops before reschedule */ @@ -86,9 +87,11 @@ /* default vals for runtime tunables */ #define RANAL_TIMEOUT 30 /* comms timeout (seconds) */ #define RANAL_LISTENER_TIMEOUT 5 /* listener timeout (seconds) */ +#define RANAL_BACKLOG 127 /* listener's backlog */ +#define RANAL_PORT 988 /* listener's port */ #define RANAL_MAX_IMMEDIATE (2<<10) /* immediate payload breakpoint */ -typedef struct +typedef struct { int kra_timeout; /* comms timeout (seconds) */ int kra_listener_timeout; /* max time the listener can block */ @@ -107,14 +110,14 @@ typedef struct int rad_id; /* device id */ int rad_idx; /* index in kra_devices */ int rad_ready; /* set by device callback */ - struct list_head rad_connq; /* connections requiring attention */ - struct list_head rad_zombies; /* connections to free */ + struct list_head rad_ready_conns;/* connections ready to tx/rx */ + struct list_head rad_new_conns; /* new connections to complete */ wait_queue_head_t rad_waitq; /* scheduler waits here */ spinlock_t rad_lock; /* serialise */ void *rad_scheduler; /* scheduling thread */ } kra_device_t; - -typedef struct + +typedef struct { int kra_init; /* initialisation state */ int kra_shutdown; /* shut down? */ @@ -144,7 +147,7 @@ typedef struct long kra_new_min_timeout; /* minimum timeout on any new conn */ wait_queue_head_t kra_reaper_waitq; /* reaper sleeps here */ spinlock_t kra_reaper_lock; /* serialise */ - + struct list_head kra_connd_peers; /* peers waiting for a connection */ struct list_head kra_connd_acceptq; /* accepted sockets to handshake */ wait_queue_head_t kra_connd_waitq; /* connection daemons sleep here */ @@ -265,7 +268,7 @@ typedef struct kra_tx /* message descriptor */ struct list_head tx_list; /* queue on idle_txs/rac_sendq/rac_waitq */ struct kra_conn *tx_conn; /* owning conn */ lib_msg_t *tx_libmsg[2]; /* lib msgs to finalize on completion */ - unsigned long tx_qtime; /* when tx started to wait for something */ + unsigned long tx_qtime; /* when tx started to wait for something (jiffies) */ int tx_isnblk; /* I'm reserved for non-blocking sends */ int tx_nob; /* # bytes of payload */ int tx_buftype; /* payload buffer type */ @@ -286,37 +289,22 @@ typedef struct kra_tx /* message descriptor */ #define RANAL_BUF_VIRT_UNMAPPED 4 /* virtual: not mapped yet */ #define RANAL_BUF_VIRT_MAPPED 5 /* virtual: mapped already */ -#define RANAL_TX_IDLE 0x00 /* on freelist */ -#define RANAL_TX_SIMPLE 0x10 /* about to send a simple message */ -#define RANAL_TX_PUTI_REQ 0x20 /* PUT initiator about to send PUT_REQ */ -#define RANAL_TX_PUTI_WAIT_ACK 0x21 /* PUT initiator waiting for PUT_ACK */ -#define RANAL_TX_PUTI_RDMA 0x22 /* PUT initiator waiting for RDMA to complete */ -#define RANAL_TX_PUTI_DONE 0x23 /* PUT initiator about to send PUT_DONE */ -#define RANAL_TX_PUTT_NAK 0x30 /* PUT target about to send PUT_NAK */ -#define RANAL_TX_PUTT_ACK 0x30 /* PUT target about to send PUT_ACK */ -#define RANAL_TX_PUTT_WAIT_DONE 0x31 /* PUT target waiting for PUT_DONE */ -#define RANAL_TX_GETI_REQ 0x40 /* GET initiator about to send GET_REQ */ -#define RANAL_TX_GETI_WAIT_DONE 0x41 /* GET initiator waiting for GET_DONE */ -#define RANAL_TX_GETT_NAK 0x50 /* GET target about to send PUT_NAK */ -#define RANAL_TX_GETT_RDMA 0x51 /* GET target waiting for RDMA to complete */ -#define RANAL_TX_GETT_DONE 0x52 /* GET target about to send GET_DONE */ - typedef struct kra_conn -{ +{ struct kra_peer *rac_peer; /* owning peer */ struct list_head rac_list; /* stash on peer's conn list */ struct list_head rac_hashlist; /* stash in connection hash table */ - struct list_head rac_schedlist; /* schedule (on rad_connq) for attention */ + struct list_head rac_schedlist; /* schedule (on rad_???_conns) for attention */ struct list_head rac_fmaq; /* txs queued for FMA */ struct list_head rac_rdmaq; /* txs awaiting RDMA completion */ struct list_head rac_replyq; /* txs awaiting replies */ __u64 rac_peerstamp; /* peer's unique stamp */ __u64 rac_peer_connstamp; /* peer's unique connection stamp */ __u64 rac_my_connstamp; /* my unique connection stamp */ - unsigned long rac_last_tx; /* when I last sent an FMA message */ - unsigned long rac_last_rx; /* when I last received an FMA messages */ - long rac_keepalive; /* keepalive interval */ - long rac_timeout; /* infer peer death on (last_rx + timout > now) */ + unsigned long rac_last_tx; /* when I last sent an FMA message (jiffies) */ + unsigned long rac_last_rx; /* when I last received an FMA messages (jiffies) */ + long rac_keepalive; /* keepalive interval (seconds) */ + long rac_timeout; /* infer peer death if no rx for this many seconds */ __u32 rac_cqid; /* my completion callback id (non-unique) */ __u32 rac_tx_seq; /* tx msg sequence number */ __u32 rac_rx_seq; /* rx msg sequence number */ @@ -348,7 +336,7 @@ typedef struct kra_peer atomic_t rap_refcount; /* # users */ int rap_persistence; /* "known" peer refs */ int rap_connecting; /* connection forming */ - unsigned long rap_reconnect_time; /* CURRENT_TIME when reconnect OK */ + unsigned long rap_reconnect_time; /* CURRENT_SECONDS when reconnect OK */ unsigned long rap_reconnect_interval; /* exponential backoff */ } kra_peer_t; @@ -390,10 +378,10 @@ kranal_peer_decref(kra_peer_t *peer) } static inline struct list_head * -kranal_nid2peerlist (ptl_nid_t nid) +kranal_nid2peerlist (ptl_nid_t nid) { unsigned int hash = ((unsigned int)nid) % kranal_data.kra_peer_hash_size; - + return (&kranal_data.kra_peers[hash]); } @@ -422,27 +410,27 @@ kranal_conn_decref(kra_conn_t *conn) } static inline struct list_head * -kranal_cqid2connlist (__u32 cqid) +kranal_cqid2connlist (__u32 cqid) { unsigned int hash = cqid % kranal_data.kra_conn_hash_size; - + return (&kranal_data.kra_conns [hash]); } static inline kra_conn_t * -kranal_cqid2conn_locked (__u32 cqid) +kranal_cqid2conn_locked (__u32 cqid) { struct list_head *conns = kranal_cqid2connlist(cqid); struct list_head *tmp; kra_conn_t *conn; - + list_for_each(tmp, conns) { conn = list_entry(tmp, kra_conn_t, rac_hashlist); - + if (conn->rac_cqid == cqid) return conn; } - + return NULL; } @@ -453,30 +441,25 @@ kranal_tx_mapped (kra_tx_t *tx) tx->tx_buftype == RANAL_BUF_PHYS_MAPPED); } -#if CONFIG_X86 static inline __u64 kranal_page2phys (struct page *p) { - __u64 page_number = p - mem_map; - - return (page_number << PAGE_SHIFT); + return page_to_phys(p); } -#else -# error "no page->phys" -#endif -extern int kranal_listener_procint(ctl_table *table, - int write, struct file *filp, - void *buffer, size_t *lenp); -extern void kranal_update_reaper_timeout(long timeout); +extern void kranal_free_acceptsock (kra_acceptsock_t *ras); +extern int kranal_listener_procint (ctl_table *table, + int write, struct file *filp, + void *buffer, size_t *lenp); +extern void kranal_update_reaper_timeout (long timeout); extern void kranal_tx_done (kra_tx_t *tx, int completion); extern void kranal_unlink_peer_locked (kra_peer_t *peer); -extern void kranal_schedule_conn(kra_conn_t *conn); +extern void kranal_schedule_conn (kra_conn_t *conn); extern kra_peer_t *kranal_create_peer (ptl_nid_t nid); extern kra_peer_t *kranal_find_peer_locked (ptl_nid_t nid); extern void kranal_post_fma (kra_conn_t *conn, kra_tx_t *tx); extern int kranal_del_peer (ptl_nid_t nid, int single_share); -extern void kranal_device_callback(RAP_INT32 devid); +extern void kranal_device_callback (RAP_INT32 devid, RAP_PVOID arg); extern int kranal_thread_start (int(*fn)(void *arg), void *arg); extern int kranal_connd (void *arg); extern int kranal_reaper (void *arg); @@ -485,3 +468,4 @@ extern void kranal_close_conn_locked (kra_conn_t *conn, int error); extern void kranal_terminate_conn_locked (kra_conn_t *conn); extern void kranal_connect (kra_peer_t *peer); extern int kranal_conn_handshake (struct socket *sock, kra_peer_t *peer); +extern void kranal_pause(int ticks);