/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2013, Intel Corporation.
*
* Author: Zach Brown <zab@zabbo.net>
* Author: Peter J. Braam <braam@clusterfs.com>
typedef struct /* per scheduler state */
{
- cfs_spinlock_t kss_lock; /* serialise */
+ 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;
typedef struct
{
- __u64 ksnn_incarnation; /* my epoch */
- cfs_spinlock_t ksnn_lock; /* serialise */
+ __u64 ksnn_incarnation; /* my epoch */
+ 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 */
- ksock_interface_t ksnn_interfaces[LNET_MAX_INTERFACES];
+ int ksnn_npeers; /* # peers */
+ int ksnn_shutdown; /* shutting down? */
+ int ksnn_ninterfaces; /* IP interfaces */
+ ksock_interface_t ksnn_interfaces[LNET_MAX_INTERFACES];
} ksock_net_t;
/** connd timeout */
int ksnd_nnets; /* # networks set up */
cfs_list_t ksnd_nets; /* list of nets */
/* stabilize peer/conn ops */
- cfs_rwlock_t ksnd_global_lock;
+ 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 */
cfs_list_t ksnd_enomem_conns; /* conns to retry: reaper_lock*/
cfs_waitq_t ksnd_reaper_waitq; /* reaper sleeps here */
cfs_time_t ksnd_reaper_waketime;/* when reaper will wake */
- cfs_spinlock_t ksnd_reaper_lock; /* serialise */
+ spinlock_t ksnd_reaper_lock; /* serialise */
int ksnd_enomem_tx; /* test ENOMEM sender */
int ksnd_stall_tx; /* test sluggish sender */
long ksnd_connd_starting_stamp;
/** # running connd */
unsigned ksnd_connd_running;
- cfs_spinlock_t ksnd_connd_lock; /* serialise */
+ spinlock_t ksnd_connd_lock; /* serialise */
- 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 */
+ cfs_list_t ksnd_idle_noop_txs; /* list head for freed noop tx */
+ spinlock_t ksnd_tx_lock; /* serialise, g_lock unsafe */
} ksock_nal_data_t;
__u32 ksnc_myipaddr; /* my IP */
__u32 ksnc_ipaddr; /* peer's IP */
int ksnc_port; /* peer's port */
- int ksnc_type:3; /* type of connection, should be signed value */
- int ksnc_closing:1; /* being shut down */
- int ksnc_flip:1; /* flip or not, only for V2.x */
- int ksnc_zc_capable:1; /* enable to ZC */
+ signed int ksnc_type:3; /* type of connection,
+ * should be signed value */
+ unsigned int ksnc_closing:1; /* being shut down */
+ unsigned int ksnc_flip:1; /* flip or not, only for V2.x */
+ unsigned int ksnc_zc_capable:1; /* enable to ZC */
struct ksock_proto *ksnc_proto; /* protocol for the connection */
/* reader */
cfs_list_t ksnp_conns; /* all active connections */
cfs_list_t ksnp_routes; /* routes */
cfs_list_t ksnp_tx_queue; /* waiting packets */
- cfs_spinlock_t ksnp_lock; /* serialize, NOT safe in g_lock */
+ spinlock_t ksnp_lock; /* serialize, g_lock unsafe */
cfs_list_t ksnp_zc_req_list; /* zero copy requests wait for ACK */
cfs_time_t ksnp_send_keepalive; /* time to send keepalive */
lnet_ni_t *ksnp_ni; /* which network */
{
int rc = -ESHUTDOWN;
- cfs_read_lock (&ksocknal_data.ksnd_global_lock);
- if (!conn->ksnc_closing) {
- LASSERT (cfs_atomic_read(&conn->ksnc_sock_refcount) > 0);
- cfs_atomic_inc(&conn->ksnc_sock_refcount);
- rc = 0;
- }
- cfs_read_unlock (&ksocknal_data.ksnd_global_lock);
+ read_lock(&ksocknal_data.ksnd_global_lock);
+ if (!conn->ksnc_closing) {
+ LASSERT(cfs_atomic_read(&conn->ksnc_sock_refcount) > 0);
+ cfs_atomic_inc(&conn->ksnc_sock_refcount);
+ rc = 0;
+ }
+ read_unlock(&ksocknal_data.ksnd_global_lock);
return (rc);
}
int error);
extern void ksocknal_notify (lnet_ni_t *ni, lnet_nid_t gw_nid, int alive);
extern void ksocknal_query (struct lnet_ni *ni, lnet_nid_t nid, cfs_time_t *when);
-extern int ksocknal_thread_start (int (*fn)(void *arg), void *arg);
+extern int ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name);
extern void ksocknal_thread_fini (void);
extern void ksocknal_launch_all_connections_locked (ksock_peer_t *peer);
extern ksock_route_t *ksocknal_find_connectable_route_locked (ksock_peer_t *peer);