X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fklnds%2Fsocklnd%2Fsocklnd.h;h=9384f033fe0a93f441a2dc4b72838526a4af01db;hb=1a73553d15b459208cbf7279ea6e5e5a110c632b;hp=8f98a8f367d305b6af0478f48d0a09d3ea3557a9;hpb=9f3469f1d00099b9301ba2b90c846c924ce7796b;p=fs%2Flustre-release.git diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index 8f98a8f..9384f03 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -62,41 +62,55 @@ # define SOCKNAL_RISK_KMAP_DEADLOCK 1 #endif +struct ksock_sched_info; + typedef struct /* per scheduler state */ { - cfs_spinlock_t kss_lock; /* serialise */ - cfs_list_t kss_rx_conns; /* conn waiting to be read */ - cfs_list_t kss_tx_conns; /* conn waiting to be written */ - cfs_list_t kss_zombie_noop_txs; /* zombie noop tx list */ - cfs_waitq_t kss_waitq; /* where scheduler sleeps */ - int kss_nconns; /* # connections assigned to this scheduler */ + cfs_spinlock_t kss_lock; /* serialise */ + cfs_list_t kss_rx_conns; /* conn waiting to be read */ + /* conn waiting to be written */ + cfs_list_t kss_tx_conns; + /* zombie noop tx list */ + cfs_list_t kss_zombie_noop_txs; + cfs_waitq_t kss_waitq; /* where scheduler sleeps */ + /* # connections assigned to this scheduler */ + int kss_nconns; + struct ksock_sched_info *kss_info; /* owner of it */ #if !SOCKNAL_SINGLE_FRAG_RX - struct page *kss_rx_scratch_pgs[LNET_MAX_IOV]; + struct page *kss_rx_scratch_pgs[LNET_MAX_IOV]; #endif #if !SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_SINGLE_FRAG_RX - struct iovec kss_scratch_iov[LNET_MAX_IOV]; + struct iovec kss_scratch_iov[LNET_MAX_IOV]; #endif } ksock_sched_t; -typedef struct -{ - unsigned int ksni_valid:1; /* been set yet? */ - unsigned int ksni_bound:1; /* bound to a cpu yet? */ - unsigned int ksni_sched:6; /* which scheduler (assumes < 64) */ -} ksock_irqinfo_t; +struct ksock_sched_info { + int ksi_nthreads_max; /* max allowed threads */ + int ksi_nthreads; /* number of threads */ + int ksi_cpt; /* CPT id */ + ksock_sched_t *ksi_scheds; /* array of schedulers */ +}; + +#define KSOCK_CPT_SHIFT 16 +#define KSOCK_THREAD_ID(cpt, sid) (((cpt) << KSOCK_CPT_SHIFT) | (sid)) +#define KSOCK_THREAD_CPT(id) ((id) >> KSOCK_CPT_SHIFT) +#define KSOCK_THREAD_SID(id) ((id) & ((1UL << KSOCK_CPT_SHIFT) - 1)) typedef struct /* in-use interface */ { - __u32 ksni_ipaddr; /* interface's IP address */ - __u32 ksni_netmask; /* interface's network mask */ - int ksni_nroutes; /* # routes using (active) */ - int ksni_npeers; /* # peers using (passive) */ - char ksni_name[16]; /* interface name */ + __u32 ksni_ipaddr; /* interface's IP address */ + __u32 ksni_netmask; /* interface's network mask */ + int ksni_nroutes; /* # routes using (active) */ + int ksni_npeers; /* # peers using (passive) */ + char ksni_name[IFNAMSIZ]; /* interface name */ } ksock_interface_t; typedef struct { - int *ksnd_timeout; /* "stuck" socket timeout (seconds) */ + /* "stuck" socket timeout (seconds) */ + int *ksnd_timeout; + /* # scheduler threads in each pool while starting */ + int *ksnd_nscheds; int *ksnd_nconnds; /* # connection daemons */ int *ksnd_nconnds_max; /* max # connection daemons */ int *ksnd_min_reconnectms; /* first connection retry after (ms)... */ @@ -141,6 +155,7 @@ typedef struct { __u64 ksnn_incarnation; /* my epoch */ cfs_spinlock_t ksnn_lock; /* serialise */ + cfs_list_t ksnn_list; /* chain on global list */ int ksnn_npeers; /* # peers */ int ksnn_shutdown; /* shutting down? */ int ksnn_ninterfaces; /* IP interfaces */ @@ -154,17 +169,19 @@ typedef struct typedef struct { - int ksnd_init; /* initialisation state */ - int ksnd_nnets; /* # networks set up */ - - cfs_rwlock_t ksnd_global_lock; /* stabilize peer/conn ops */ - cfs_list_t *ksnd_peers; /* hash table of all my known peers */ - int ksnd_peer_hash_size; /* size of ksnd_peers */ - - int ksnd_nthreads; /* # live threads */ - int ksnd_shuttingdown; /* tell threads to exit */ - int ksnd_nschedulers; /* # schedulers */ - ksock_sched_t *ksnd_schedulers; /* their state */ + int ksnd_init; /* initialisation state */ + int ksnd_nnets; /* # networks set up */ + cfs_list_t ksnd_nets; /* list of nets */ + /* stabilize peer/conn ops */ + cfs_rwlock_t ksnd_global_lock; + /* hash table of all my known peers */ + cfs_list_t *ksnd_peers; + int ksnd_peer_hash_size; /* size of ksnd_peers */ + + int ksnd_nthreads; /* # live threads */ + int ksnd_shuttingdown; /* tell threads to exit */ + /* schedulers information */ + struct ksock_sched_info **ksnd_sched_info; cfs_atomic_t ksnd_nactive_txs; /* #active txs */ @@ -196,8 +213,6 @@ typedef struct cfs_list_t ksnd_idle_noop_txs; /* list head for freed noop tx */ cfs_spinlock_t ksnd_tx_lock; /* serialise, NOT safe in g_lock */ - ksock_irqinfo_t ksnd_irqinfo[CFS_NR_IRQS];/* irq->scheduler lookup */ - } ksock_nal_data_t; #define SOCKNAL_INIT_NOTHING 0 @@ -587,9 +602,7 @@ extern void ksocknal_lib_save_callback(cfs_socket_t *sock, ksock_conn_t *conn); extern void ksocknal_lib_set_callback(cfs_socket_t *sock, ksock_conn_t *conn); extern void ksocknal_lib_reset_callback(cfs_socket_t *sock, ksock_conn_t *conn); extern void ksocknal_lib_push_conn (ksock_conn_t *conn); -extern void ksocknal_lib_bind_irq (unsigned int irq); extern int ksocknal_lib_get_conn_addrs (ksock_conn_t *conn); -extern unsigned int ksocknal_lib_sock_irq (cfs_socket_t *sock); extern int ksocknal_lib_setup_sock (cfs_socket_t *so); extern int ksocknal_lib_send_iov (ksock_conn_t *conn, ksock_tx_t *tx); extern int ksocknal_lib_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx);