Commit febe73bd authored by Guillaume Matheron's avatar Guillaume Matheron Committed by Greg Kroah-Hartman

Staging: lustre: o2iblnd.c: Started fixing coding style

I focused on function declarations (placed return type on the same line
as function name), and spaces between function name and parenthesis
Signed-off-by: default avatarGuillaume Matheron <guillaume.matheron@ens.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9fb186cf
...@@ -53,8 +53,7 @@ static lnd_t the_o2iblnd = { ...@@ -53,8 +53,7 @@ static lnd_t the_o2iblnd = {
kib_data_t kiblnd_data; kib_data_t kiblnd_data;
static __u32 static __u32 kiblnd_cksum(void *ptr, int nob)
kiblnd_cksum(void *ptr, int nob)
{ {
char *c = ptr; char *c = ptr;
__u32 sum = 0; __u32 sum = 0;
...@@ -66,8 +65,7 @@ kiblnd_cksum(void *ptr, int nob) ...@@ -66,8 +65,7 @@ kiblnd_cksum(void *ptr, int nob)
return (sum == 0) ? 1 : sum; return (sum == 0) ? 1 : sum;
} }
static char * static char *kiblnd_msgtype2str(int type)
kiblnd_msgtype2str(int type)
{ {
switch (type) { switch (type) {
case IBLND_MSG_CONNREQ: case IBLND_MSG_CONNREQ:
...@@ -105,8 +103,7 @@ kiblnd_msgtype2str(int type) ...@@ -105,8 +103,7 @@ kiblnd_msgtype2str(int type)
} }
} }
static int static int kiblnd_msgtype2size(int type)
kiblnd_msgtype2size(int type)
{ {
const int hdr_size = offsetof(kib_msg_t, ibm_u); const int hdr_size = offsetof(kib_msg_t, ibm_u);
...@@ -139,15 +136,14 @@ kiblnd_msgtype2size(int type) ...@@ -139,15 +136,14 @@ kiblnd_msgtype2size(int type)
} }
} }
static int static int kiblnd_unpack_rd(kib_msg_t *msg, int flip)
kiblnd_unpack_rd(kib_msg_t *msg, int flip)
{ {
kib_rdma_desc_t *rd; kib_rdma_desc_t *rd;
int nob; int nob;
int n; int n;
int i; int i;
LASSERT (msg->ibm_type == IBLND_MSG_GET_REQ || LASSERT(msg->ibm_type == IBLND_MSG_GET_REQ ||
msg->ibm_type == IBLND_MSG_PUT_ACK); msg->ibm_type == IBLND_MSG_PUT_ACK);
rd = msg->ibm_type == IBLND_MSG_GET_REQ ? rd = msg->ibm_type == IBLND_MSG_GET_REQ ?
...@@ -167,7 +163,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) ...@@ -167,7 +163,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip)
return 1; return 1;
} }
nob = offsetof (kib_msg_t, ibm_u) + nob = offsetof(kib_msg_t, ibm_u) +
kiblnd_rd_msg_size(rd, msg->ibm_type, n); kiblnd_rd_msg_size(rd, msg->ibm_type, n);
if (msg->ibm_nob < nob) { if (msg->ibm_nob < nob) {
...@@ -187,8 +183,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip) ...@@ -187,8 +183,7 @@ kiblnd_unpack_rd(kib_msg_t *msg, int flip)
return 0; return 0;
} }
void void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version,
kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version,
int credits, lnet_nid_t dstnid, __u64 dststamp) int credits, lnet_nid_t dstnid, __u64 dststamp)
{ {
kib_net_t *net = ni->ni_data; kib_net_t *net = ni->ni_data;
...@@ -212,8 +207,7 @@ kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version, ...@@ -212,8 +207,7 @@ kiblnd_pack_msg (lnet_ni_t *ni, kib_msg_t *msg, int version,
} }
} }
int int kiblnd_unpack_msg(kib_msg_t *msg, int nob)
kiblnd_unpack_msg(kib_msg_t *msg, int nob)
{ {
const int hdr_size = offsetof(kib_msg_t, ibm_u); const int hdr_size = offsetof(kib_msg_t, ibm_u);
__u32 msg_cksum; __u32 msg_cksum;
...@@ -269,8 +263,8 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) ...@@ -269,8 +263,8 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob)
if (flip) { if (flip) {
/* leave magic unflipped as a clue to peer endianness */ /* leave magic unflipped as a clue to peer endianness */
msg->ibm_version = version; msg->ibm_version = version;
CLASSERT (sizeof(msg->ibm_type) == 1); CLASSERT(sizeof(msg->ibm_type) == 1);
CLASSERT (sizeof(msg->ibm_credits) == 1); CLASSERT(sizeof(msg->ibm_credits) == 1);
msg->ibm_nob = msg_nob; msg->ibm_nob = msg_nob;
__swab64s(&msg->ibm_srcnid); __swab64s(&msg->ibm_srcnid);
__swab64s(&msg->ibm_srcstamp); __swab64s(&msg->ibm_srcstamp);
...@@ -324,8 +318,7 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob) ...@@ -324,8 +318,7 @@ kiblnd_unpack_msg(kib_msg_t *msg, int nob)
return 0; return 0;
} }
int int kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid)
kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid)
{ {
kib_peer_t *peer; kib_peer_t *peer;
kib_net_t *net = ni->ni_data; kib_net_t *net = ni->ni_data;
...@@ -356,7 +349,7 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) ...@@ -356,7 +349,7 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid)
write_lock_irqsave(&kiblnd_data.kib_global_lock, flags); write_lock_irqsave(&kiblnd_data.kib_global_lock, flags);
/* always called with a ref on ni, which prevents ni being shutdown */ /* always called with a ref on ni, which prevents ni being shutdown */
LASSERT (net->ibn_shutdown == 0); LASSERT(net->ibn_shutdown == 0);
/* npeers only grows with the global lock held */ /* npeers only grows with the global lock held */
atomic_inc(&net->ibn_npeers); atomic_inc(&net->ibn_npeers);
...@@ -367,18 +360,17 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid) ...@@ -367,18 +360,17 @@ kiblnd_create_peer(lnet_ni_t *ni, kib_peer_t **peerp, lnet_nid_t nid)
return 0; return 0;
} }
void void kiblnd_destroy_peer(kib_peer_t *peer)
kiblnd_destroy_peer (kib_peer_t *peer)
{ {
kib_net_t *net = peer->ibp_ni->ni_data; kib_net_t *net = peer->ibp_ni->ni_data;
LASSERT (net != NULL); LASSERT(net != NULL);
LASSERT (atomic_read(&peer->ibp_refcount) == 0); LASSERT(atomic_read(&peer->ibp_refcount) == 0);
LASSERT (!kiblnd_peer_active(peer)); LASSERT(!kiblnd_peer_active(peer));
LASSERT (peer->ibp_connecting == 0); LASSERT(peer->ibp_connecting == 0);
LASSERT (peer->ibp_accepting == 0); LASSERT(peer->ibp_accepting == 0);
LASSERT (list_empty(&peer->ibp_conns)); LASSERT(list_empty(&peer->ibp_conns));
LASSERT (list_empty(&peer->ibp_tx_queue)); LASSERT(list_empty(&peer->ibp_tx_queue));
LIBCFS_FREE(peer, sizeof(*peer)); LIBCFS_FREE(peer, sizeof(*peer));
...@@ -389,8 +381,7 @@ kiblnd_destroy_peer (kib_peer_t *peer) ...@@ -389,8 +381,7 @@ kiblnd_destroy_peer (kib_peer_t *peer)
atomic_dec(&net->ibn_npeers); atomic_dec(&net->ibn_npeers);
} }
kib_peer_t * kib_peer_t *kiblnd_find_peer_locked(lnet_nid_t nid)
kiblnd_find_peer_locked (lnet_nid_t nid)
{ {
/* the caller is responsible for accounting the additional reference /* the caller is responsible for accounting the additional reference
* that this creates */ * that this creates */
...@@ -398,11 +389,11 @@ kiblnd_find_peer_locked (lnet_nid_t nid) ...@@ -398,11 +389,11 @@ kiblnd_find_peer_locked (lnet_nid_t nid)
struct list_head *tmp; struct list_head *tmp;
kib_peer_t *peer; kib_peer_t *peer;
list_for_each (tmp, peer_list) { list_for_each(tmp, peer_list) {
peer = list_entry(tmp, kib_peer_t, ibp_list); peer = list_entry(tmp, kib_peer_t, ibp_list);
LASSERT (peer->ibp_connecting > 0 || /* creating conns */ LASSERT(peer->ibp_connecting > 0 || /* creating conns */
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); /* active conn */ !list_empty(&peer->ibp_conns)); /* active conn */
...@@ -418,19 +409,17 @@ kiblnd_find_peer_locked (lnet_nid_t nid) ...@@ -418,19 +409,17 @@ kiblnd_find_peer_locked (lnet_nid_t nid)
return NULL; return NULL;
} }
void void kiblnd_unlink_peer_locked(kib_peer_t *peer)
kiblnd_unlink_peer_locked (kib_peer_t *peer)
{ {
LASSERT (list_empty(&peer->ibp_conns)); LASSERT(list_empty(&peer->ibp_conns));
LASSERT (kiblnd_peer_active(peer)); LASSERT(kiblnd_peer_active(peer));
list_del_init(&peer->ibp_list); list_del_init(&peer->ibp_list);
/* lose peerlist's ref */ /* lose peerlist's ref */
kiblnd_peer_decref(peer); kiblnd_peer_decref(peer);
} }
static int static int kiblnd_get_peer_info(lnet_ni_t *ni, int index,
kiblnd_get_peer_info(lnet_ni_t *ni, int index,
lnet_nid_t *nidp, int *count) lnet_nid_t *nidp, int *count)
{ {
kib_peer_t *peer; kib_peer_t *peer;
...@@ -442,10 +431,10 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index, ...@@ -442,10 +431,10 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index,
for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) {
list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { list_for_each(ptmp, &kiblnd_data.kib_peers[i]) {
peer = list_entry(ptmp, kib_peer_t, ibp_list); peer = list_entry(ptmp, kib_peer_t, ibp_list);
LASSERT (peer->ibp_connecting > 0 || LASSERT(peer->ibp_connecting > 0 ||
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); !list_empty(&peer->ibp_conns));
...@@ -468,8 +457,7 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index, ...@@ -468,8 +457,7 @@ kiblnd_get_peer_info(lnet_ni_t *ni, int index,
return -ENOENT; return -ENOENT;
} }
static void static void kiblnd_del_peer_locked(kib_peer_t *peer)
kiblnd_del_peer_locked(kib_peer_t *peer)
{ {
struct list_head *ctmp; struct list_head *ctmp;
struct list_head *cnxt; struct list_head *cnxt;
...@@ -478,7 +466,7 @@ kiblnd_del_peer_locked(kib_peer_t *peer) ...@@ -478,7 +466,7 @@ kiblnd_del_peer_locked(kib_peer_t *peer)
if (list_empty(&peer->ibp_conns)) { if (list_empty(&peer->ibp_conns)) {
kiblnd_unlink_peer_locked(peer); kiblnd_unlink_peer_locked(peer);
} else { } else {
list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) {
conn = list_entry(ctmp, kib_conn_t, ibc_list); conn = list_entry(ctmp, kib_conn_t, ibc_list);
kiblnd_close_conn_locked(conn, 0); kiblnd_close_conn_locked(conn, 0);
...@@ -489,10 +477,9 @@ kiblnd_del_peer_locked(kib_peer_t *peer) ...@@ -489,10 +477,9 @@ kiblnd_del_peer_locked(kib_peer_t *peer)
* last ref on it. */ * last ref on it. */
} }
static int static int kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)
kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)
{ {
LIST_HEAD (zombies); LIST_HEAD(zombies);
struct list_head *ptmp; struct list_head *ptmp;
struct list_head *pnxt; struct list_head *pnxt;
kib_peer_t *peer; kib_peer_t *peer;
...@@ -512,9 +499,9 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) ...@@ -512,9 +499,9 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)
} }
for (i = lo; i <= hi; i++) { for (i = lo; i <= hi; i++) {
list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) {
peer = list_entry(ptmp, kib_peer_t, ibp_list); peer = list_entry(ptmp, kib_peer_t, ibp_list);
LASSERT (peer->ibp_connecting > 0 || LASSERT(peer->ibp_connecting > 0 ||
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); !list_empty(&peer->ibp_conns));
...@@ -525,7 +512,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) ...@@ -525,7 +512,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)
continue; continue;
if (!list_empty(&peer->ibp_tx_queue)) { if (!list_empty(&peer->ibp_tx_queue)) {
LASSERT (list_empty(&peer->ibp_conns)); LASSERT(list_empty(&peer->ibp_conns));
list_splice_init(&peer->ibp_tx_queue, list_splice_init(&peer->ibp_tx_queue,
&zombies); &zombies);
...@@ -543,8 +530,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid) ...@@ -543,8 +530,7 @@ kiblnd_del_peer(lnet_ni_t *ni, lnet_nid_t nid)
return rc; return rc;
} }
static kib_conn_t * static kib_conn_t *kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index)
kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index)
{ {
kib_peer_t *peer; kib_peer_t *peer;
struct list_head *ptmp; struct list_head *ptmp;
...@@ -556,17 +542,17 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) ...@@ -556,17 +542,17 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index)
read_lock_irqsave(&kiblnd_data.kib_global_lock, flags); read_lock_irqsave(&kiblnd_data.kib_global_lock, flags);
for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) {
list_for_each (ptmp, &kiblnd_data.kib_peers[i]) { list_for_each(ptmp, &kiblnd_data.kib_peers[i]) {
peer = list_entry(ptmp, kib_peer_t, ibp_list); peer = list_entry(ptmp, kib_peer_t, ibp_list);
LASSERT (peer->ibp_connecting > 0 || LASSERT(peer->ibp_connecting > 0 ||
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); !list_empty(&peer->ibp_conns));
if (peer->ibp_ni != ni) if (peer->ibp_ni != ni)
continue; continue;
list_for_each (ctmp, &peer->ibp_conns) { list_for_each(ctmp, &peer->ibp_conns) {
if (index-- > 0) if (index-- > 0)
continue; continue;
...@@ -584,8 +570,7 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index) ...@@ -584,8 +570,7 @@ kiblnd_get_conn_by_idx(lnet_ni_t *ni, int index)
return NULL; return NULL;
} }
int int kiblnd_translate_mtu(int value)
kiblnd_translate_mtu(int value)
{ {
switch (value) { switch (value) {
default: default:
...@@ -605,8 +590,7 @@ kiblnd_translate_mtu(int value) ...@@ -605,8 +590,7 @@ kiblnd_translate_mtu(int value)
} }
} }
static void static void kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)
kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)
{ {
int mtu; int mtu;
...@@ -615,13 +599,12 @@ kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid) ...@@ -615,13 +599,12 @@ kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)
return; return;
mtu = kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu); mtu = kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu);
LASSERT (mtu >= 0); LASSERT(mtu >= 0);
if (mtu != 0) if (mtu != 0)
cmid->route.path_rec->mtu = mtu; cmid->route.path_rec->mtu = mtu;
} }
static int static int kiblnd_get_completion_vector(kib_conn_t *conn, int cpt)
kiblnd_get_completion_vector(kib_conn_t *conn, int cpt)
{ {
cpumask_t *mask; cpumask_t *mask;
int vectors; int vectors;
...@@ -648,8 +631,7 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt) ...@@ -648,8 +631,7 @@ kiblnd_get_completion_vector(kib_conn_t *conn, int cpt)
return 1; return 1;
} }
kib_conn_t * kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
int state, int version) int state, int version)
{ {
/* CAVEAT EMPTOR: /* CAVEAT EMPTOR:
...@@ -835,7 +817,7 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, ...@@ -835,7 +817,7 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
} }
/* Init successful! */ /* Init successful! */
LASSERT (state == IBLND_CONN_ACTIVE_CONNECT || LASSERT(state == IBLND_CONN_ACTIVE_CONNECT ||
state == IBLND_CONN_PASSIVE_WAIT); state == IBLND_CONN_PASSIVE_WAIT);
conn->ibc_state = state; conn->ibc_state = state;
...@@ -851,23 +833,22 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid, ...@@ -851,23 +833,22 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
return NULL; return NULL;
} }
void void kiblnd_destroy_conn(kib_conn_t *conn)
kiblnd_destroy_conn (kib_conn_t *conn)
{ {
struct rdma_cm_id *cmid = conn->ibc_cmid; struct rdma_cm_id *cmid = conn->ibc_cmid;
kib_peer_t *peer = conn->ibc_peer; kib_peer_t *peer = conn->ibc_peer;
int rc; int rc;
LASSERT (!in_interrupt()); LASSERT(!in_interrupt());
LASSERT (atomic_read(&conn->ibc_refcount) == 0); LASSERT(atomic_read(&conn->ibc_refcount) == 0);
LASSERT (list_empty(&conn->ibc_early_rxs)); LASSERT(list_empty(&conn->ibc_early_rxs));
LASSERT (list_empty(&conn->ibc_tx_noops)); LASSERT(list_empty(&conn->ibc_tx_noops));
LASSERT (list_empty(&conn->ibc_tx_queue)); LASSERT(list_empty(&conn->ibc_tx_queue));
LASSERT (list_empty(&conn->ibc_tx_queue_rsrvd)); LASSERT(list_empty(&conn->ibc_tx_queue_rsrvd));
LASSERT (list_empty(&conn->ibc_tx_queue_nocred)); LASSERT(list_empty(&conn->ibc_tx_queue_nocred));
LASSERT (list_empty(&conn->ibc_active_txs)); LASSERT(list_empty(&conn->ibc_active_txs));
LASSERT (conn->ibc_noops_posted == 0); LASSERT(conn->ibc_noops_posted == 0);
LASSERT (conn->ibc_nsends_posted == 0); LASSERT(conn->ibc_nsends_posted == 0);
switch (conn->ibc_state) { switch (conn->ibc_state) {
default: default:
...@@ -876,7 +857,7 @@ kiblnd_destroy_conn (kib_conn_t *conn) ...@@ -876,7 +857,7 @@ kiblnd_destroy_conn (kib_conn_t *conn)
case IBLND_CONN_DISCONNECTED: case IBLND_CONN_DISCONNECTED:
/* connvars should have been freed already */ /* connvars should have been freed already */
LASSERT (conn->ibc_connvars == NULL); LASSERT(conn->ibc_connvars == NULL);
break; break;
case IBLND_CONN_INIT: case IBLND_CONN_INIT:
...@@ -919,15 +900,14 @@ kiblnd_destroy_conn (kib_conn_t *conn) ...@@ -919,15 +900,14 @@ kiblnd_destroy_conn (kib_conn_t *conn)
LIBCFS_FREE(conn, sizeof(*conn)); LIBCFS_FREE(conn, sizeof(*conn));
} }
int int kiblnd_close_peer_conns_locked(kib_peer_t *peer, int why)
kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why)
{ {
kib_conn_t *conn; kib_conn_t *conn;
struct list_head *ctmp; struct list_head *ctmp;
struct list_head *cnxt; struct list_head *cnxt;
int count = 0; int count = 0;
list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) {
conn = list_entry(ctmp, kib_conn_t, ibc_list); conn = list_entry(ctmp, kib_conn_t, ibc_list);
CDEBUG(D_NET, "Closing conn -> %s, version: %x, reason: %d\n", CDEBUG(D_NET, "Closing conn -> %s, version: %x, reason: %d\n",
...@@ -941,8 +921,7 @@ kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why) ...@@ -941,8 +921,7 @@ kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why)
return count; return count;
} }
int int kiblnd_close_stale_conns_locked(kib_peer_t *peer,
kiblnd_close_stale_conns_locked (kib_peer_t *peer,
int version, __u64 incarnation) int version, __u64 incarnation)
{ {
kib_conn_t *conn; kib_conn_t *conn;
...@@ -950,7 +929,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer, ...@@ -950,7 +929,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer,
struct list_head *cnxt; struct list_head *cnxt;
int count = 0; int count = 0;
list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { list_for_each_safe(ctmp, cnxt, &peer->ibp_conns) {
conn = list_entry(ctmp, kib_conn_t, ibc_list); conn = list_entry(ctmp, kib_conn_t, ibc_list);
if (conn->ibc_version == version && if (conn->ibc_version == version &&
...@@ -969,8 +948,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer, ...@@ -969,8 +948,7 @@ kiblnd_close_stale_conns_locked (kib_peer_t *peer,
return count; return count;
} }
static int static int kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)
kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)
{ {
kib_peer_t *peer; kib_peer_t *peer;
struct list_head *ptmp; struct list_head *ptmp;
...@@ -991,10 +969,10 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) ...@@ -991,10 +969,10 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)
} }
for (i = lo; i <= hi; i++) { for (i = lo; i <= hi; i++) {
list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { list_for_each_safe(ptmp, pnxt, &kiblnd_data.kib_peers[i]) {
peer = list_entry(ptmp, kib_peer_t, ibp_list); peer = list_entry(ptmp, kib_peer_t, ibp_list);
LASSERT (peer->ibp_connecting > 0 || LASSERT(peer->ibp_connecting > 0 ||
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); !list_empty(&peer->ibp_conns));
...@@ -1017,8 +995,7 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid) ...@@ -1017,8 +995,7 @@ kiblnd_close_matching_conns(lnet_ni_t *ni, lnet_nid_t nid)
return (count == 0) ? -ENOENT : 0; return (count == 0) ? -ENOENT : 0;
} }
int int kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
{ {
struct libcfs_ioctl_data *data = arg; struct libcfs_ioctl_data *data = arg;
int rc = -EINVAL; int rc = -EINVAL;
...@@ -1049,7 +1026,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) ...@@ -1049,7 +1026,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
break; break;
} }
LASSERT (conn->ibc_cmid != NULL); LASSERT(conn->ibc_cmid != NULL);
data->ioc_nid = conn->ibc_peer->ibp_nid; data->ioc_nid = conn->ibc_peer->ibp_nid;
if (conn->ibc_cmid->route.path_rec == NULL) if (conn->ibc_cmid->route.path_rec == NULL)
data->ioc_u32[0] = 0; /* iWarp has no path MTU */ data->ioc_u32[0] = 0; /* iWarp has no path MTU */
...@@ -1071,8 +1048,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg) ...@@ -1071,8 +1048,7 @@ kiblnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
return rc; return rc;
} }
void void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)
kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)
{ {
unsigned long last_alive = 0; unsigned long last_alive = 0;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
...@@ -1084,7 +1060,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) ...@@ -1084,7 +1060,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)
peer = kiblnd_find_peer_locked(nid); peer = kiblnd_find_peer_locked(nid);
if (peer != NULL) { if (peer != NULL) {
LASSERT (peer->ibp_connecting > 0 || /* creating conns */ LASSERT(peer->ibp_connecting > 0 || /* creating conns */
peer->ibp_accepting > 0 || peer->ibp_accepting > 0 ||
!list_empty(&peer->ibp_conns)); /* active conn */ !list_empty(&peer->ibp_conns)); /* active conn */
last_alive = peer->ibp_last_alive; last_alive = peer->ibp_last_alive;
...@@ -1106,8 +1082,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) ...@@ -1106,8 +1082,7 @@ kiblnd_query (lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when)
return; return;
} }
void void kiblnd_free_pages(kib_pages_t *p)
kiblnd_free_pages(kib_pages_t *p)
{ {
int npages = p->ibp_npages; int npages = p->ibp_npages;
int i; int i;
...@@ -1120,8 +1095,7 @@ kiblnd_free_pages(kib_pages_t *p) ...@@ -1120,8 +1095,7 @@ kiblnd_free_pages(kib_pages_t *p)
LIBCFS_FREE(p, offsetof(kib_pages_t, ibp_pages[npages])); LIBCFS_FREE(p, offsetof(kib_pages_t, ibp_pages[npages]));
} }
int int kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)
kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)
{ {
kib_pages_t *p; kib_pages_t *p;
int i; int i;
...@@ -1151,19 +1125,18 @@ kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages) ...@@ -1151,19 +1125,18 @@ kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)
return 0; return 0;
} }
void void kiblnd_unmap_rx_descs(kib_conn_t *conn)
kiblnd_unmap_rx_descs(kib_conn_t *conn)
{ {
kib_rx_t *rx; kib_rx_t *rx;
int i; int i;
LASSERT (conn->ibc_rxs != NULL); LASSERT(conn->ibc_rxs != NULL);
LASSERT (conn->ibc_hdev != NULL); LASSERT(conn->ibc_hdev != NULL);
for (i = 0; i < IBLND_RX_MSGS(conn->ibc_version); i++) { for (i = 0; i < IBLND_RX_MSGS(conn->ibc_version); i++) {
rx = &conn->ibc_rxs[i]; rx = &conn->ibc_rxs[i];
LASSERT (rx->rx_nob >= 0); /* not posted */ LASSERT(rx->rx_nob >= 0); /* not posted */
kiblnd_dma_unmap_single(conn->ibc_hdev->ibh_ibdev, kiblnd_dma_unmap_single(conn->ibc_hdev->ibh_ibdev,
KIBLND_UNMAP_ADDR(rx, rx_msgunmap, KIBLND_UNMAP_ADDR(rx, rx_msgunmap,
...@@ -1176,8 +1149,7 @@ kiblnd_unmap_rx_descs(kib_conn_t *conn) ...@@ -1176,8 +1149,7 @@ kiblnd_unmap_rx_descs(kib_conn_t *conn)
conn->ibc_rx_pages = NULL; conn->ibc_rx_pages = NULL;
} }
void void kiblnd_map_rx_descs(kib_conn_t *conn)
kiblnd_map_rx_descs(kib_conn_t *conn)
{ {
kib_rx_t *rx; kib_rx_t *rx;
struct page *pg; struct page *pg;
...@@ -1196,7 +1168,7 @@ kiblnd_map_rx_descs(kib_conn_t *conn) ...@@ -1196,7 +1168,7 @@ kiblnd_map_rx_descs(kib_conn_t *conn)
rx->rx_msgaddr = kiblnd_dma_map_single(conn->ibc_hdev->ibh_ibdev, rx->rx_msgaddr = kiblnd_dma_map_single(conn->ibc_hdev->ibh_ibdev,
rx->rx_msg, IBLND_MSG_SIZE, rx->rx_msg, IBLND_MSG_SIZE,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
LASSERT (!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev, LASSERT(!kiblnd_dma_mapping_error(conn->ibc_hdev->ibh_ibdev,
rx->rx_msgaddr)); rx->rx_msgaddr));
KIBLND_UNMAP_ADDR_SET(rx, rx_msgunmap, rx->rx_msgaddr); KIBLND_UNMAP_ADDR_SET(rx, rx_msgunmap, rx->rx_msgaddr);
...@@ -1205,24 +1177,23 @@ kiblnd_map_rx_descs(kib_conn_t *conn) ...@@ -1205,24 +1177,23 @@ kiblnd_map_rx_descs(kib_conn_t *conn)
lnet_page2phys(pg) + pg_off); lnet_page2phys(pg) + pg_off);
pg_off += IBLND_MSG_SIZE; pg_off += IBLND_MSG_SIZE;
LASSERT (pg_off <= PAGE_SIZE); LASSERT(pg_off <= PAGE_SIZE);
if (pg_off == PAGE_SIZE) { if (pg_off == PAGE_SIZE) {
pg_off = 0; pg_off = 0;
ipg++; ipg++;
LASSERT (ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version)); LASSERT(ipg <= IBLND_RX_MSG_PAGES(conn->ibc_version));
} }
} }
} }
static void static void kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo)
kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo)
{ {
kib_hca_dev_t *hdev = tpo->tpo_hdev; kib_hca_dev_t *hdev = tpo->tpo_hdev;
kib_tx_t *tx; kib_tx_t *tx;
int i; int i;
LASSERT (tpo->tpo_pool.po_allocated == 0); LASSERT(tpo->tpo_pool.po_allocated == 0);
if (hdev == NULL) if (hdev == NULL)
return; return;
...@@ -1239,8 +1210,7 @@ kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo) ...@@ -1239,8 +1210,7 @@ kiblnd_unmap_tx_pool(kib_tx_pool_t *tpo)
tpo->tpo_hdev = NULL; tpo->tpo_hdev = NULL;
} }
static kib_hca_dev_t * static kib_hca_dev_t *kiblnd_current_hdev(kib_dev_t *dev)
kiblnd_current_hdev(kib_dev_t *dev)
{ {
kib_hca_dev_t *hdev; kib_hca_dev_t *hdev;
unsigned long flags; unsigned long flags;
...@@ -1265,8 +1235,7 @@ kiblnd_current_hdev(kib_dev_t *dev) ...@@ -1265,8 +1235,7 @@ kiblnd_current_hdev(kib_dev_t *dev)
return hdev; return hdev;
} }
static void static void kiblnd_map_tx_pool(kib_tx_pool_t *tpo)
kiblnd_map_tx_pool(kib_tx_pool_t *tpo)
{ {
kib_pages_t *txpgs = tpo->tpo_tx_pages; kib_pages_t *txpgs = tpo->tpo_tx_pages;
kib_pool_t *pool = &tpo->tpo_pool; kib_pool_t *pool = &tpo->tpo_pool;
...@@ -1278,15 +1247,15 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) ...@@ -1278,15 +1247,15 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo)
int ipage; int ipage;
int i; int i;
LASSERT (net != NULL); LASSERT(net != NULL);
dev = net->ibn_dev; dev = net->ibn_dev;
/* pre-mapped messages are not bigger than 1 page */ /* pre-mapped messages are not bigger than 1 page */
CLASSERT (IBLND_MSG_SIZE <= PAGE_SIZE); CLASSERT(IBLND_MSG_SIZE <= PAGE_SIZE);
/* No fancy arithmetic when we do the buffer calculations */ /* No fancy arithmetic when we do the buffer calculations */
CLASSERT (PAGE_SIZE % IBLND_MSG_SIZE == 0); CLASSERT(PAGE_SIZE % IBLND_MSG_SIZE == 0);
tpo->tpo_hdev = kiblnd_current_hdev(dev); tpo->tpo_hdev = kiblnd_current_hdev(dev);
...@@ -1300,29 +1269,28 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo) ...@@ -1300,29 +1269,28 @@ kiblnd_map_tx_pool(kib_tx_pool_t *tpo)
tx->tx_msgaddr = kiblnd_dma_map_single( tx->tx_msgaddr = kiblnd_dma_map_single(
tpo->tpo_hdev->ibh_ibdev, tx->tx_msg, tpo->tpo_hdev->ibh_ibdev, tx->tx_msg,
IBLND_MSG_SIZE, DMA_TO_DEVICE); IBLND_MSG_SIZE, DMA_TO_DEVICE);
LASSERT (!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev, LASSERT(!kiblnd_dma_mapping_error(tpo->tpo_hdev->ibh_ibdev,
tx->tx_msgaddr)); tx->tx_msgaddr));
KIBLND_UNMAP_ADDR_SET(tx, tx_msgunmap, tx->tx_msgaddr); KIBLND_UNMAP_ADDR_SET(tx, tx_msgunmap, tx->tx_msgaddr);
list_add(&tx->tx_list, &pool->po_free_list); list_add(&tx->tx_list, &pool->po_free_list);
page_offset += IBLND_MSG_SIZE; page_offset += IBLND_MSG_SIZE;
LASSERT (page_offset <= PAGE_SIZE); LASSERT(page_offset <= PAGE_SIZE);
if (page_offset == PAGE_SIZE) { if (page_offset == PAGE_SIZE) {
page_offset = 0; page_offset = 0;
ipage++; ipage++;
LASSERT (ipage <= txpgs->ibp_npages); LASSERT(ipage <= txpgs->ibp_npages);
} }
} }
} }
struct ib_mr * struct ib_mr *kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size)
kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size)
{ {
__u64 index; __u64 index;
LASSERT (hdev->ibh_mrs[0] != NULL); LASSERT(hdev->ibh_mrs[0] != NULL);
if (hdev->ibh_nmrs == 1) if (hdev->ibh_nmrs == 1)
return hdev->ibh_mrs[0]; return hdev->ibh_mrs[0];
...@@ -1336,14 +1304,13 @@ kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size) ...@@ -1336,14 +1304,13 @@ kiblnd_find_dma_mr(kib_hca_dev_t *hdev, __u64 addr, __u64 size)
return NULL; return NULL;
} }
struct ib_mr * struct ib_mr *kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd)
kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd)
{ {
struct ib_mr *prev_mr; struct ib_mr *prev_mr;
struct ib_mr *mr; struct ib_mr *mr;
int i; int i;
LASSERT (hdev->ibh_mrs[0] != NULL); LASSERT(hdev->ibh_mrs[0] != NULL);
if (*kiblnd_tunables.kib_map_on_demand > 0 && if (*kiblnd_tunables.kib_map_on_demand > 0 &&
*kiblnd_tunables.kib_map_on_demand <= rd->rd_nfrags) *kiblnd_tunables.kib_map_on_demand <= rd->rd_nfrags)
...@@ -1370,10 +1337,9 @@ kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd) ...@@ -1370,10 +1337,9 @@ kiblnd_find_rd_dma_mr(kib_hca_dev_t *hdev, kib_rdma_desc_t *rd)
return mr; return mr;
} }
static void static void kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool)
kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool)
{ {
LASSERT (pool->fpo_map_count == 0); LASSERT(pool->fpo_map_count == 0);
if (pool->fpo_fmr_pool != NULL) if (pool->fpo_fmr_pool != NULL)
ib_destroy_fmr_pool(pool->fpo_fmr_pool); ib_destroy_fmr_pool(pool->fpo_fmr_pool);
...@@ -1384,8 +1350,7 @@ kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool) ...@@ -1384,8 +1350,7 @@ kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool)
LIBCFS_FREE(pool, sizeof(kib_fmr_pool_t)); LIBCFS_FREE(pool, sizeof(kib_fmr_pool_t));
} }
static void static void kiblnd_destroy_fmr_pool_list(struct list_head *head)
kiblnd_destroy_fmr_pool_list(struct list_head *head)
{ {
kib_fmr_pool_t *pool; kib_fmr_pool_t *pool;
...@@ -1410,8 +1375,8 @@ static int kiblnd_fmr_flush_trigger(int ncpts) ...@@ -1410,8 +1375,8 @@ static int kiblnd_fmr_flush_trigger(int ncpts)
return max(IBLND_FMR_POOL_FLUSH, size); return max(IBLND_FMR_POOL_FLUSH, size);
} }
static int static int kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps,
kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) kib_fmr_pool_t **pp_fpo)
{ {
/* FMR pool for RDMA */ /* FMR pool for RDMA */
kib_dev_t *dev = fps->fps_net->ibn_dev; kib_dev_t *dev = fps->fps_net->ibn_dev;
...@@ -1451,8 +1416,8 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo) ...@@ -1451,8 +1416,8 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo)
return 0; return 0;
} }
static void static void kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps,
kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, struct list_head *zombies) struct list_head *zombies)
{ {
if (fps->fps_net == NULL) /* intialized? */ if (fps->fps_net == NULL) /* intialized? */
return; return;
...@@ -1473,8 +1438,7 @@ kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, struct list_head *zombies) ...@@ -1473,8 +1438,7 @@ kiblnd_fail_fmr_poolset(kib_fmr_poolset_t *fps, struct list_head *zombies)
spin_unlock(&fps->fps_lock); spin_unlock(&fps->fps_lock);
} }
static void static void kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps)
kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps)
{ {
if (fps->fps_net != NULL) { /* initialized? */ if (fps->fps_net != NULL) { /* initialized? */
kiblnd_destroy_fmr_pool_list(&fps->fps_failed_pool_list); kiblnd_destroy_fmr_pool_list(&fps->fps_failed_pool_list);
...@@ -1482,8 +1446,7 @@ kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps) ...@@ -1482,8 +1446,7 @@ kiblnd_fini_fmr_poolset(kib_fmr_poolset_t *fps)
} }
} }
static int static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net,
kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net,
int pool_size, int flush_trigger) int pool_size, int flush_trigger)
{ {
kib_fmr_pool_t *fpo; kib_fmr_pool_t *fpo;
...@@ -1506,8 +1469,7 @@ kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net, ...@@ -1506,8 +1469,7 @@ kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, kib_net_t *net,
return rc; return rc;
} }
static int static int kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now)
kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now)
{ {
if (fpo->fpo_map_count != 0) /* still in use */ if (fpo->fpo_map_count != 0) /* still in use */
return 0; return 0;
...@@ -1516,10 +1478,9 @@ kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now) ...@@ -1516,10 +1478,9 @@ kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, unsigned long now)
return cfs_time_aftereq(now, fpo->fpo_deadline); return cfs_time_aftereq(now, fpo->fpo_deadline);
} }
void void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
{ {
LIST_HEAD (zombies); LIST_HEAD(zombies);
kib_fmr_pool_t *fpo = fmr->fmr_pool; kib_fmr_pool_t *fpo = fmr->fmr_pool;
kib_fmr_poolset_t *fps = fpo->fpo_owner; kib_fmr_poolset_t *fps = fpo->fpo_owner;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
...@@ -1527,11 +1488,11 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) ...@@ -1527,11 +1488,11 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
int rc; int rc;
rc = ib_fmr_pool_unmap(fmr->fmr_pfmr); rc = ib_fmr_pool_unmap(fmr->fmr_pfmr);
LASSERT (rc == 0); LASSERT(rc == 0);
if (status != 0) { if (status != 0) {
rc = ib_flush_fmr_pool(fpo->fpo_fmr_pool); rc = ib_flush_fmr_pool(fpo->fpo_fmr_pool);
LASSERT (rc == 0); LASSERT(rc == 0);
} }
fmr->fmr_pool = NULL; fmr->fmr_pool = NULL;
...@@ -1556,8 +1517,7 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status) ...@@ -1556,8 +1517,7 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
kiblnd_destroy_fmr_pool_list(&zombies); kiblnd_destroy_fmr_pool_list(&zombies);
} }
int int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
__u64 iov, kib_fmr_t *fmr) __u64 iov, kib_fmr_t *fmr)
{ {
struct ib_pool_fmr *pfmr; struct ib_pool_fmr *pfmr;
...@@ -1627,17 +1587,15 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, ...@@ -1627,17 +1587,15 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
goto again; goto again;
} }
static void static void kiblnd_fini_pool(kib_pool_t *pool)
kiblnd_fini_pool(kib_pool_t *pool)
{ {
LASSERT (list_empty(&pool->po_free_list)); LASSERT(list_empty(&pool->po_free_list));
LASSERT (pool->po_allocated == 0); LASSERT(pool->po_allocated == 0);
CDEBUG(D_NET, "Finalize %s pool\n", pool->po_owner->ps_name); CDEBUG(D_NET, "Finalize %s pool\n", pool->po_owner->ps_name);
} }
static void static void kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size)
kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size)
{ {
CDEBUG(D_NET, "Initialize %s pool\n", ps->ps_name); CDEBUG(D_NET, "Initialize %s pool\n", ps->ps_name);
...@@ -1648,8 +1606,7 @@ kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size) ...@@ -1648,8 +1606,7 @@ kiblnd_init_pool(kib_poolset_t *ps, kib_pool_t *pool, int size)
pool->po_size = size; pool->po_size = size;
} }
static void static void kiblnd_destroy_pool_list(struct list_head *head)
kiblnd_destroy_pool_list(struct list_head *head)
{ {
kib_pool_t *pool; kib_pool_t *pool;
...@@ -1657,13 +1614,12 @@ kiblnd_destroy_pool_list(struct list_head *head) ...@@ -1657,13 +1614,12 @@ kiblnd_destroy_pool_list(struct list_head *head)
pool = list_entry(head->next, kib_pool_t, po_list); pool = list_entry(head->next, kib_pool_t, po_list);
list_del(&pool->po_list); list_del(&pool->po_list);
LASSERT (pool->po_owner != NULL); LASSERT(pool->po_owner != NULL);
pool->po_owner->ps_pool_destroy(pool); pool->po_owner->ps_pool_destroy(pool);
} }
} }
static void static void kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies)
kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies)
{ {
if (ps->ps_net == NULL) /* intialized? */ if (ps->ps_net == NULL) /* intialized? */
return; return;
...@@ -1682,8 +1638,7 @@ kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies) ...@@ -1682,8 +1638,7 @@ kiblnd_fail_poolset(kib_poolset_t *ps, struct list_head *zombies)
spin_unlock(&ps->ps_lock); spin_unlock(&ps->ps_lock);
} }
static void static void kiblnd_fini_poolset(kib_poolset_t *ps)
kiblnd_fini_poolset(kib_poolset_t *ps)
{ {
if (ps->ps_net != NULL) { /* initialized? */ if (ps->ps_net != NULL) { /* initialized? */
kiblnd_destroy_pool_list(&ps->ps_failed_pool_list); kiblnd_destroy_pool_list(&ps->ps_failed_pool_list);
...@@ -1691,8 +1646,7 @@ kiblnd_fini_poolset(kib_poolset_t *ps) ...@@ -1691,8 +1646,7 @@ kiblnd_fini_poolset(kib_poolset_t *ps)
} }
} }
static int static int kiblnd_init_poolset(kib_poolset_t *ps, int cpt,
kiblnd_init_poolset(kib_poolset_t *ps, int cpt,
kib_net_t *net, char *name, int size, kib_net_t *net, char *name, int size,
kib_ps_pool_create_t po_create, kib_ps_pool_create_t po_create,
kib_ps_pool_destroy_t po_destroy, kib_ps_pool_destroy_t po_destroy,
...@@ -1727,8 +1681,7 @@ kiblnd_init_poolset(kib_poolset_t *ps, int cpt, ...@@ -1727,8 +1681,7 @@ kiblnd_init_poolset(kib_poolset_t *ps, int cpt,
return rc; return rc;
} }
static int static int kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now)
kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now)
{ {
if (pool->po_allocated != 0) /* still in use */ if (pool->po_allocated != 0) /* still in use */
return 0; return 0;
...@@ -1737,10 +1690,9 @@ kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now) ...@@ -1737,10 +1690,9 @@ kiblnd_pool_is_idle(kib_pool_t *pool, unsigned long now)
return cfs_time_aftereq(now, pool->po_deadline); return cfs_time_aftereq(now, pool->po_deadline);
} }
void void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)
kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)
{ {
LIST_HEAD (zombies); LIST_HEAD(zombies);
kib_poolset_t *ps = pool->po_owner; kib_poolset_t *ps = pool->po_owner;
kib_pool_t *tmp; kib_pool_t *tmp;
unsigned long now = cfs_time_current(); unsigned long now = cfs_time_current();
...@@ -1750,7 +1702,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) ...@@ -1750,7 +1702,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)
if (ps->ps_node_fini != NULL) if (ps->ps_node_fini != NULL)
ps->ps_node_fini(pool, node); ps->ps_node_fini(pool, node);
LASSERT (pool->po_allocated > 0); LASSERT(pool->po_allocated > 0);
list_add(node, &pool->po_free_list); list_add(node, &pool->po_free_list);
pool->po_allocated--; pool->po_allocated--;
...@@ -1768,8 +1720,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node) ...@@ -1768,8 +1720,7 @@ kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node)
kiblnd_destroy_pool_list(&zombies); kiblnd_destroy_pool_list(&zombies);
} }
struct list_head * struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps)
kiblnd_pool_alloc_node(kib_poolset_t *ps)
{ {
struct list_head *node; struct list_head *node;
kib_pool_t *pool; kib_pool_t *pool;
...@@ -1831,8 +1782,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps) ...@@ -1831,8 +1782,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps)
goto again; goto again;
} }
void void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr)
kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr)
{ {
kib_pmr_pool_t *ppo = pmr->pmr_pool; kib_pmr_pool_t *ppo = pmr->pmr_pool;
struct ib_mr *mr = pmr->pmr_mr; struct ib_mr *mr = pmr->pmr_mr;
...@@ -1843,8 +1793,7 @@ kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr) ...@@ -1843,8 +1793,7 @@ kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr)
ib_dereg_mr(mr); ib_dereg_mr(mr);
} }
int int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,
kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,
kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr) kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr)
{ {
kib_phys_mr_t *pmr; kib_phys_mr_t *pmr;
...@@ -1889,19 +1838,18 @@ kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev, ...@@ -1889,19 +1838,18 @@ kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,
return rc; return rc;
} }
static void static void kiblnd_destroy_pmr_pool(kib_pool_t *pool)
kiblnd_destroy_pmr_pool(kib_pool_t *pool)
{ {
kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool); kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool);
kib_phys_mr_t *pmr; kib_phys_mr_t *pmr;
LASSERT (pool->po_allocated == 0); LASSERT(pool->po_allocated == 0);
while (!list_empty(&pool->po_free_list)) { while (!list_empty(&pool->po_free_list)) {
pmr = list_entry(pool->po_free_list.next, pmr = list_entry(pool->po_free_list.next,
kib_phys_mr_t, pmr_list); kib_phys_mr_t, pmr_list);
LASSERT (pmr->pmr_mr == NULL); LASSERT(pmr->pmr_mr == NULL);
list_del(&pmr->pmr_list); list_del(&pmr->pmr_list);
if (pmr->pmr_ipb != NULL) { if (pmr->pmr_ipb != NULL) {
...@@ -1927,8 +1875,8 @@ static inline int kiblnd_pmr_pool_size(int ncpts) ...@@ -1927,8 +1875,8 @@ static inline int kiblnd_pmr_pool_size(int ncpts)
return max(IBLND_PMR_POOL, size); return max(IBLND_PMR_POOL, size);
} }
static int static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size,
kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) kib_pool_t **pp_po)
{ {
struct kib_pmr_pool *ppo; struct kib_pmr_pool *ppo;
struct kib_pool *pool; struct kib_pool *pool;
...@@ -1970,13 +1918,12 @@ kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) ...@@ -1970,13 +1918,12 @@ kiblnd_create_pmr_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po)
return 0; return 0;
} }
static void static void kiblnd_destroy_tx_pool(kib_pool_t *pool)
kiblnd_destroy_tx_pool(kib_pool_t *pool)
{ {
kib_tx_pool_t *tpo = container_of(pool, kib_tx_pool_t, tpo_pool); kib_tx_pool_t *tpo = container_of(pool, kib_tx_pool_t, tpo_pool);
int i; int i;
LASSERT (pool->po_allocated == 0); LASSERT(pool->po_allocated == 0);
if (tpo->tpo_tx_pages != NULL) { if (tpo->tpo_tx_pages != NULL) {
kiblnd_unmap_tx_pool(tpo); kiblnd_unmap_tx_pool(tpo);
...@@ -2026,8 +1973,8 @@ static int kiblnd_tx_pool_size(int ncpts) ...@@ -2026,8 +1973,8 @@ static int kiblnd_tx_pool_size(int ncpts)
return max(IBLND_TX_POOL, ntx); return max(IBLND_TX_POOL, ntx);
} }
static int static int kiblnd_create_tx_pool(kib_poolset_t *ps, int size,
kiblnd_create_tx_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) kib_pool_t **pp_po)
{ {
int i; int i;
int npg; int npg;
...@@ -2110,8 +2057,7 @@ kiblnd_create_tx_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po) ...@@ -2110,8 +2057,7 @@ kiblnd_create_tx_pool(kib_poolset_t *ps, int size, kib_pool_t **pp_po)
return -ENOMEM; return -ENOMEM;
} }
static void static void kiblnd_tx_init(kib_pool_t *pool, struct list_head *node)
kiblnd_tx_init(kib_pool_t *pool, struct list_head *node)
{ {
kib_tx_poolset_t *tps = container_of(pool->po_owner, kib_tx_poolset_t, kib_tx_poolset_t *tps = container_of(pool->po_owner, kib_tx_poolset_t,
tps_poolset); tps_poolset);
...@@ -2120,8 +2066,7 @@ kiblnd_tx_init(kib_pool_t *pool, struct list_head *node) ...@@ -2120,8 +2066,7 @@ kiblnd_tx_init(kib_pool_t *pool, struct list_head *node)
tx->tx_cookie = tps->tps_next_tx_cookie++; tx->tx_cookie = tps->tps_next_tx_cookie++;
} }
static void static void kiblnd_net_fini_pools(kib_net_t *net)
kiblnd_net_fini_pools(kib_net_t *net)
{ {
int i; int i;
...@@ -2162,8 +2107,7 @@ kiblnd_net_fini_pools(kib_net_t *net) ...@@ -2162,8 +2107,7 @@ kiblnd_net_fini_pools(kib_net_t *net)
} }
} }
static int static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
{ {
unsigned long flags; unsigned long flags;
int cpt; int cpt;
...@@ -2291,8 +2235,7 @@ kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) ...@@ -2291,8 +2235,7 @@ kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts)
return rc; return rc;
} }
static int static int kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
{ {
struct ib_device_attr *attr; struct ib_device_attr *attr;
int rc; int rc;
...@@ -2336,8 +2279,7 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev) ...@@ -2336,8 +2279,7 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
return -EINVAL; return -EINVAL;
} }
static void static void kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev)
kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev)
{ {
int i; int i;
...@@ -2356,8 +2298,7 @@ kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev) ...@@ -2356,8 +2298,7 @@ kiblnd_hdev_cleanup_mrs(kib_hca_dev_t *hdev)
hdev->ibh_nmrs = 0; hdev->ibh_nmrs = 0;
} }
void void kiblnd_hdev_destroy(kib_hca_dev_t *hdev)
kiblnd_hdev_destroy(kib_hca_dev_t *hdev)
{ {
kiblnd_hdev_cleanup_mrs(hdev); kiblnd_hdev_cleanup_mrs(hdev);
...@@ -2370,8 +2311,7 @@ kiblnd_hdev_destroy(kib_hca_dev_t *hdev) ...@@ -2370,8 +2311,7 @@ kiblnd_hdev_destroy(kib_hca_dev_t *hdev)
LIBCFS_FREE(hdev, sizeof(*hdev)); LIBCFS_FREE(hdev, sizeof(*hdev));
} }
static int static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
{ {
struct ib_mr *mr; struct ib_mr *mr;
int i; int i;
...@@ -2442,7 +2382,7 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) ...@@ -2442,7 +2382,7 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
return PTR_ERR(mr); return PTR_ERR(mr);
} }
LASSERT (iova == ipb.addr); LASSERT(iova == ipb.addr);
hdev->ibh_mrs[i] = mr; hdev->ibh_mrs[i] = mr;
} }
...@@ -2454,14 +2394,13 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev) ...@@ -2454,14 +2394,13 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
return 0; return 0;
} }
static int /* DUMMY */
kiblnd_dummy_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) static int kiblnd_dummy_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
{ /* DUMMY */ {
return 0; return 0;
} }
static int static int kiblnd_dev_need_failover(kib_dev_t *dev)
kiblnd_dev_need_failover(kib_dev_t *dev)
{ {
struct rdma_cm_id *cmid; struct rdma_cm_id *cmid;
struct sockaddr_in srcaddr; struct sockaddr_in srcaddr;
...@@ -2516,12 +2455,11 @@ kiblnd_dev_need_failover(kib_dev_t *dev) ...@@ -2516,12 +2455,11 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
return 1; return 1;
} }
int int kiblnd_dev_failover(kib_dev_t *dev)
kiblnd_dev_failover(kib_dev_t *dev)
{ {
LIST_HEAD (zombie_tpo); LIST_HEAD(zombie_tpo);
LIST_HEAD (zombie_ppo); LIST_HEAD(zombie_ppo);
LIST_HEAD (zombie_fpo); LIST_HEAD(zombie_fpo);
struct rdma_cm_id *cmid = NULL; struct rdma_cm_id *cmid = NULL;
kib_hca_dev_t *hdev = NULL; kib_hca_dev_t *hdev = NULL;
kib_hca_dev_t *old; kib_hca_dev_t *old;
...@@ -2532,7 +2470,7 @@ kiblnd_dev_failover(kib_dev_t *dev) ...@@ -2532,7 +2470,7 @@ kiblnd_dev_failover(kib_dev_t *dev)
int rc = 0; int rc = 0;
int i; int i;
LASSERT (*kiblnd_tunables.kib_dev_failover > 1 || LASSERT(*kiblnd_tunables.kib_dev_failover > 1 ||
dev->ibd_can_failover || dev->ibd_can_failover ||
dev->ibd_hdev == NULL); dev->ibd_hdev == NULL);
...@@ -2655,11 +2593,10 @@ kiblnd_dev_failover(kib_dev_t *dev) ...@@ -2655,11 +2593,10 @@ kiblnd_dev_failover(kib_dev_t *dev)
return rc; return rc;
} }
void void kiblnd_destroy_dev(kib_dev_t *dev)
kiblnd_destroy_dev (kib_dev_t *dev)
{ {
LASSERT (dev->ibd_nnets == 0); LASSERT(dev->ibd_nnets == 0);
LASSERT (list_empty(&dev->ibd_nets)); LASSERT(list_empty(&dev->ibd_nets));
list_del(&dev->ibd_fail_list); list_del(&dev->ibd_fail_list);
list_del(&dev->ibd_list); list_del(&dev->ibd_list);
...@@ -2670,8 +2607,7 @@ kiblnd_destroy_dev (kib_dev_t *dev) ...@@ -2670,8 +2607,7 @@ kiblnd_destroy_dev (kib_dev_t *dev)
LIBCFS_FREE(dev, sizeof(*dev)); LIBCFS_FREE(dev, sizeof(*dev));
} }
static kib_dev_t * static kib_dev_t *kiblnd_create_dev(char *ifname)
kiblnd_create_dev(char *ifname)
{ {
struct net_device *netdev; struct net_device *netdev;
kib_dev_t *dev; kib_dev_t *dev;
...@@ -2723,13 +2659,12 @@ kiblnd_create_dev(char *ifname) ...@@ -2723,13 +2659,12 @@ kiblnd_create_dev(char *ifname)
return dev; return dev;
} }
static void static void kiblnd_base_shutdown(void)
kiblnd_base_shutdown(void)
{ {
struct kib_sched_info *sched; struct kib_sched_info *sched;
int i; int i;
LASSERT (list_empty(&kiblnd_data.kib_devs)); LASSERT(list_empty(&kiblnd_data.kib_devs));
CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n", CDEBUG(D_MALLOC, "before LND base cleanup: kmem %d\n",
atomic_read(&libcfs_kmemory)); atomic_read(&libcfs_kmemory));
...@@ -2740,12 +2675,12 @@ kiblnd_base_shutdown(void) ...@@ -2740,12 +2675,12 @@ kiblnd_base_shutdown(void)
case IBLND_INIT_ALL: case IBLND_INIT_ALL:
case IBLND_INIT_DATA: case IBLND_INIT_DATA:
LASSERT (kiblnd_data.kib_peers != NULL); LASSERT(kiblnd_data.kib_peers != NULL);
for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) { for (i = 0; i < kiblnd_data.kib_peer_hash_size; i++) {
LASSERT (list_empty(&kiblnd_data.kib_peers[i])); LASSERT(list_empty(&kiblnd_data.kib_peers[i]));
} }
LASSERT (list_empty(&kiblnd_data.kib_connd_zombies)); LASSERT(list_empty(&kiblnd_data.kib_connd_zombies));
LASSERT (list_empty(&kiblnd_data.kib_connd_conns)); LASSERT(list_empty(&kiblnd_data.kib_connd_conns));
/* flag threads to terminate; wake and wait for them to die */ /* flag threads to terminate; wake and wait for them to die */
kiblnd_data.kib_shutdown = 1; kiblnd_data.kib_shutdown = 1;
...@@ -2791,8 +2726,7 @@ kiblnd_base_shutdown(void) ...@@ -2791,8 +2726,7 @@ kiblnd_base_shutdown(void)
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
void void kiblnd_shutdown(lnet_ni_t *ni)
kiblnd_shutdown (lnet_ni_t *ni)
{ {
kib_net_t *net = ni->ni_data; kib_net_t *net = ni->ni_data;
rwlock_t *g_lock = &kiblnd_data.kib_global_lock; rwlock_t *g_lock = &kiblnd_data.kib_global_lock;
...@@ -2842,7 +2776,7 @@ kiblnd_shutdown (lnet_ni_t *ni) ...@@ -2842,7 +2776,7 @@ kiblnd_shutdown (lnet_ni_t *ni)
/* fall through */ /* fall through */
case IBLND_INIT_NOTHING: case IBLND_INIT_NOTHING:
LASSERT (atomic_read(&net->ibn_nconns) == 0); LASSERT(atomic_read(&net->ibn_nconns) == 0);
if (net->ibn_dev != NULL && if (net->ibn_dev != NULL &&
net->ibn_dev->ibd_nnets == 0) net->ibn_dev->ibd_nnets == 0)
...@@ -2865,14 +2799,13 @@ kiblnd_shutdown (lnet_ni_t *ni) ...@@ -2865,14 +2799,13 @@ kiblnd_shutdown (lnet_ni_t *ni)
return; return;
} }
static int static int kiblnd_base_startup(void)
kiblnd_base_startup(void)
{ {
struct kib_sched_info *sched; struct kib_sched_info *sched;
int rc; int rc;
int i; int i;
LASSERT (kiblnd_data.kib_init == IBLND_INIT_NOTHING); LASSERT(kiblnd_data.kib_init == IBLND_INIT_NOTHING);
try_module_get(THIS_MODULE); try_module_get(THIS_MODULE);
memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */ memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */
...@@ -2955,8 +2888,7 @@ kiblnd_base_startup(void) ...@@ -2955,8 +2888,7 @@ kiblnd_base_startup(void)
return -ENETDOWN; return -ENETDOWN;
} }
static int static int kiblnd_start_schedulers(struct kib_sched_info *sched)
kiblnd_start_schedulers(struct kib_sched_info *sched)
{ {
int rc = 0; int rc = 0;
int nthrs; int nthrs;
...@@ -2996,8 +2928,7 @@ kiblnd_start_schedulers(struct kib_sched_info *sched) ...@@ -2996,8 +2928,7 @@ kiblnd_start_schedulers(struct kib_sched_info *sched)
return rc; return rc;
} }
static int static int kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts)
kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts)
{ {
int cpt; int cpt;
int rc; int rc;
...@@ -3022,8 +2953,7 @@ kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts) ...@@ -3022,8 +2953,7 @@ kiblnd_dev_start_threads(kib_dev_t *dev, int newdev, __u32 *cpts, int ncpts)
return 0; return 0;
} }
static kib_dev_t * static kib_dev_t *kiblnd_dev_search(char *ifname)
kiblnd_dev_search(char *ifname)
{ {
kib_dev_t *alias = NULL; kib_dev_t *alias = NULL;
kib_dev_t *dev; kib_dev_t *dev;
...@@ -3055,8 +2985,7 @@ kiblnd_dev_search(char *ifname) ...@@ -3055,8 +2985,7 @@ kiblnd_dev_search(char *ifname)
return alias; return alias;
} }
int int kiblnd_startup(lnet_ni_t *ni)
kiblnd_startup (lnet_ni_t *ni)
{ {
char *ifname; char *ifname;
kib_dev_t *ibdev = NULL; kib_dev_t *ibdev = NULL;
...@@ -3066,7 +2995,7 @@ kiblnd_startup (lnet_ni_t *ni) ...@@ -3066,7 +2995,7 @@ kiblnd_startup (lnet_ni_t *ni)
int rc; int rc;
int newdev; int newdev;
LASSERT (ni->ni_lnd == &the_o2iblnd); LASSERT(ni->ni_lnd == &the_o2iblnd);
if (kiblnd_data.kib_init == IBLND_INIT_NOTHING) { if (kiblnd_data.kib_init == IBLND_INIT_NOTHING) {
rc = kiblnd_base_startup(); rc = kiblnd_base_startup();
...@@ -3090,7 +3019,7 @@ kiblnd_startup (lnet_ni_t *ni) ...@@ -3090,7 +3019,7 @@ kiblnd_startup (lnet_ni_t *ni)
if (ni->ni_interfaces[0] != NULL) { if (ni->ni_interfaces[0] != NULL) {
/* Use the IPoIB interface specified in 'networks=' */ /* Use the IPoIB interface specified in 'networks=' */
CLASSERT (LNET_MAX_INTERFACES > 1); CLASSERT(LNET_MAX_INTERFACES > 1);
if (ni->ni_interfaces[1] != NULL) { if (ni->ni_interfaces[1] != NULL) {
CERROR("Multiple interfaces not supported\n"); CERROR("Multiple interfaces not supported\n");
goto failed; goto failed;
...@@ -3150,21 +3079,19 @@ kiblnd_startup (lnet_ni_t *ni) ...@@ -3150,21 +3079,19 @@ kiblnd_startup (lnet_ni_t *ni)
return -ENETDOWN; return -ENETDOWN;
} }
static void __exit static void __exit kiblnd_module_fini(void)
kiblnd_module_fini (void)
{ {
lnet_unregister_lnd(&the_o2iblnd); lnet_unregister_lnd(&the_o2iblnd);
} }
static int __init static int __init kiblnd_module_init(void)
kiblnd_module_init (void)
{ {
int rc; int rc;
CLASSERT (sizeof(kib_msg_t) <= IBLND_MSG_SIZE); CLASSERT(sizeof(kib_msg_t) <= IBLND_MSG_SIZE);
CLASSERT (offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) CLASSERT(offsetof(kib_msg_t, ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS])
<= IBLND_MSG_SIZE); <= IBLND_MSG_SIZE);
CLASSERT (offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) CLASSERT(offsetof(kib_msg_t, ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS])
<= IBLND_MSG_SIZE); <= IBLND_MSG_SIZE);
rc = kiblnd_tunables_init(); rc = kiblnd_tunables_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment