static void
kiblnd_del_peer_locked(struct kib_peer_ni *peer_ni)
{
- struct list_head *ctmp;
- struct list_head *cnxt;
+ struct kib_conn *cnxt;
struct kib_conn *conn;
if (list_empty(&peer_ni->ibp_conns)) {
kiblnd_unlink_peer_locked(peer_ni);
} else {
- list_for_each_safe(ctmp, cnxt, &peer_ni->ibp_conns) {
- conn = list_entry(ctmp, struct kib_conn, ibc_list);
-
+ list_for_each_entry_safe(conn, cnxt, &peer_ni->ibp_conns,
+ ibc_list)
kiblnd_close_conn_locked(conn, 0);
- }
/* NB closing peer_ni's last conn unlinked it. */
}
/* NB peer_ni now unlinked; might even be freed if the peer_ni table had the
spin_unlock(&conn->ibc_lock);
}
-int
-kiblnd_translate_mtu(int value)
-{
- switch (value) {
- default:
- return -1;
- case 0:
- return 0;
- case 256:
- return IB_MTU_256;
- case 512:
- return IB_MTU_512;
- case 1024:
- return IB_MTU_1024;
- case 2048:
- return IB_MTU_2048;
- case 4096:
- return IB_MTU_4096;
- }
-}
-
static void
kiblnd_setup_mtu_locked(struct rdma_cm_id *cmid)
{
- int mtu;
-
/* XXX There is no path record for iWARP, set by netdev->change_mtu? */
if (cmid->route.path_rec == NULL)
return;
- mtu = kiblnd_translate_mtu(*kiblnd_tunables.kib_ib_mtu);
- LASSERT (mtu >= 0);
- if (mtu != 0)
- cmid->route.path_rec->mtu = mtu;
+ if (*kiblnd_tunables.kib_ib_mtu)
+ cmid->route.path_rec->mtu =
+ ib_mtu_int_to_enum(*kiblnd_tunables.kib_ib_mtu);
}
static int
kiblnd_close_peer_conns_locked(struct kib_peer_ni *peer_ni, int why)
{
struct kib_conn *conn;
- struct list_head *ctmp;
- struct list_head *cnxt;
- int count = 0;
-
- list_for_each_safe(ctmp, cnxt, &peer_ni->ibp_conns) {
- conn = list_entry(ctmp, struct kib_conn, ibc_list);
+ struct kib_conn *cnxt;
+ int count = 0;
+ list_for_each_entry_safe(conn, cnxt, &peer_ni->ibp_conns,
+ ibc_list) {
CDEBUG(D_NET, "Closing conn -> %s, "
"version: %x, reason: %d\n",
libcfs_nid2str(peer_ni->ibp_nid),
int version, __u64 incarnation)
{
struct kib_conn *conn;
- struct list_head *ctmp;
- struct list_head *cnxt;
- int count = 0;
-
- list_for_each_safe(ctmp, cnxt, &peer_ni->ibp_conns) {
- conn = list_entry(ctmp, struct kib_conn, ibc_list);
+ struct kib_conn *cnxt;
+ int count = 0;
+ list_for_each_entry_safe(conn, cnxt, &peer_ni->ibp_conns,
+ ibc_list) {
if (conn->ibc_version == version &&
conn->ibc_incarnation == incarnation)
continue;
spin_unlock(&fps->fps_lock);
CDEBUG(D_NET, "Another thread is allocating new "
"FMR pool, waiting for her to complete\n");
- schedule();
+ wait_var_event(fps, !fps->fps_increasing);
goto again;
}
rc = kiblnd_create_fmr_pool(fps, &fpo);
spin_lock(&fps->fps_lock);
fps->fps_increasing = 0;
+ wake_up_var(fps);
if (rc == 0) {
fps->fps_version++;
list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);