#define DEBUG_SUBSYSTEM S_NAL
-#include <linux/kp30.h>
-#include <linux/portals_compat25.h>
+#include <libcfs/kp30.h>
#include <portals/p30.h>
#include <portals/lib-p30.h>
#include <portals/nal.h>
#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 */
#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 */
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? */
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 */
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 */
#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 */
}
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]);
}
}
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;
}
}
extern void kranal_free_acceptsock (kra_acceptsock_t *ras);
-extern int kranal_listener_procint (ctl_table *table,
- int write, struct file *filp,
+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_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);