diff options
Diffstat (limited to 'drivers/staging/lustre/lnet/klnds/socklnd')
5 files changed, 45 insertions, 50 deletions
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index d8bfcadd184a..ecfe73302350 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -1838,7 +1838,6 @@ ksocknal_query(lnet_ni_t *ni, lnet_nid_t nid, unsigned long *when) ksocknal_launch_all_connections_locked(peer); write_unlock_bh(glock); - return; } static void @@ -1874,52 +1873,51 @@ ksocknal_push_peer(ksock_peer_t *peer) } } -static int -ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id) +static int ksocknal_push(lnet_ni_t *ni, lnet_process_id_t id) { - ksock_peer_t *peer; + struct list_head *start; + struct list_head *end; struct list_head *tmp; - int index; - int i; - int j; int rc = -ENOENT; + unsigned int hsize = ksocknal_data.ksnd_peer_hash_size; - for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { - for (j = 0; ; j++) { - read_lock(&ksocknal_data.ksnd_global_lock); + if (id.nid == LNET_NID_ANY) { + start = &ksocknal_data.ksnd_peers[0]; + end = &ksocknal_data.ksnd_peers[hsize - 1]; + } else { + start = end = ksocknal_nid2peerlist(id.nid); + } - index = 0; - peer = NULL; + for (tmp = start; tmp <= end; tmp++) { + int peer_off; /* searching offset in peer hash table */ - list_for_each(tmp, &ksocknal_data.ksnd_peers[i]) { - peer = list_entry(tmp, ksock_peer_t, - ksnp_list); + for (peer_off = 0; ; peer_off++) { + ksock_peer_t *peer; + int i = 0; + read_lock(&ksocknal_data.ksnd_global_lock); + list_for_each_entry(peer, tmp, ksnp_list) { if (!((id.nid == LNET_NID_ANY || id.nid == peer->ksnp_id.nid) && (id.pid == LNET_PID_ANY || - id.pid == peer->ksnp_id.pid))) { - peer = NULL; + id.pid == peer->ksnp_id.pid))) continue; - } - if (index++ == j) { + if (i++ == peer_off) { ksocknal_peer_addref(peer); break; } } - read_unlock(&ksocknal_data.ksnd_global_lock); - if (peer != NULL) { - rc = 0; - ksocknal_push_peer(peer); - ksocknal_peer_decref(peer); - } - } + if (i == 0) /* no match */ + break; + rc = 0; + ksocknal_push_peer(peer); + ksocknal_peer_decref(peer); + } } - return rc; } @@ -2261,9 +2259,8 @@ ksocknal_base_shutdown(void) case SOCKNAL_INIT_ALL: case SOCKNAL_INIT_DATA: LASSERT(ksocknal_data.ksnd_peers != NULL); - for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) { + for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) LASSERT(list_empty(&ksocknal_data.ksnd_peers[i])); - } LASSERT(list_empty(&ksocknal_data.ksnd_nets)); LASSERT(list_empty(&ksocknal_data.ksnd_enomem_conns)); @@ -2427,7 +2424,7 @@ ksocknal_base_startup(void) ksocknal_data.ksnd_connd_starting = 0; ksocknal_data.ksnd_connd_failed_stamp = 0; - ksocknal_data.ksnd_connd_starting_stamp = get_seconds(); + ksocknal_data.ksnd_connd_starting_stamp = ktime_get_real_seconds(); /* must have at least 2 connds to remain responsive to accepts while * connecting */ if (*ksocknal_tunables.ksnd_nconnds < SOCKNAL_CONND_RESV + 1) @@ -2441,11 +2438,11 @@ ksocknal_base_startup(void) for (i = 0; i < *ksocknal_tunables.ksnd_nconnds; i++) { char name[16]; + spin_lock_bh(&ksocknal_data.ksnd_connd_lock); ksocknal_data.ksnd_connd_starting++; spin_unlock_bh(&ksocknal_data.ksnd_connd_lock); - snprintf(name, sizeof(name), "socknal_cd%02d", i); rc = ksocknal_thread_start(ksocknal_connd, (void *)((ulong_ptr_t)i), name); @@ -2706,6 +2703,7 @@ ksocknal_start_schedulers(struct ksock_sched_info *info) long id; char name[20]; ksock_sched_t *sched; + id = KSOCK_THREAD_ID(info->ksi_cpt, info->ksi_nthreads + i); sched = &info->ksi_scheds[KSOCK_THREAD_SID(id)]; snprintf(name, sizeof(name), "socknal_sd%02d_%02d", @@ -2835,7 +2833,6 @@ ksocknal_startup(lnet_ni_t *ni) return -ENETDOWN; } - static void __exit ksocknal_module_fini(void) { diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index a0fcbc39f86b..b349847f9cf9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -216,13 +216,13 @@ typedef struct { wait_queue_head_t ksnd_connd_waitq; /* connds sleep here */ int ksnd_connd_connecting; /* # connds connecting */ - long ksnd_connd_failed_stamp;/* time stamp of the + time64_t ksnd_connd_failed_stamp;/* time stamp of the * last failed * connecting attempt */ - unsigned ksnd_connd_starting; /* # starting connd */ - long ksnd_connd_starting_stamp;/* time stamp of the + time64_t ksnd_connd_starting_stamp;/* time stamp of the * last starting connd */ + unsigned ksnd_connd_starting; /* # starting connd */ unsigned ksnd_connd_running; /* # running connd */ spinlock_t ksnd_connd_lock; /* serialise */ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 0d5aac6a2bb3..477b385f15e0 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -89,7 +89,6 @@ ksocknal_alloc_tx_noop(__u64 cookie, int nonblk) return tx; } - void ksocknal_free_tx (ksock_tx_t *tx) { @@ -299,6 +298,7 @@ ksocknal_recv_kiov (ksock_conn_t *conn) lnet_kiov_t *kiov = conn->ksnc_rx_kiov; int nob; int rc; + LASSERT(conn->ksnc_rx_nkiov > 0); /* Never touch conn->ksnc_rx_kiov or change connection @@ -626,7 +626,7 @@ ksocknal_find_conn_locked(ksock_peer_t *peer, ksock_tx_t *tx, int nonblk) list_for_each (tmp, &peer->ksnp_conns) { ksock_conn_t *c = list_entry(tmp, ksock_conn_t, ksnc_list); int nob = atomic_read(&c->ksnc_tx_nob) + - c->ksnc_sock->sk->sk_wmem_queued; + c->ksnc_sock->sk->sk_wmem_queued; int rc; LASSERT(!c->ksnc_closing); @@ -714,7 +714,7 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn) LASSERT(tx->tx_resid == tx->tx_nob); CDEBUG (D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n", - tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type: + tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type : KSOCK_MSG_NOOP, tx->tx_nob, tx->tx_niov, tx->tx_nkiov); @@ -772,7 +772,6 @@ ksocknal_queue_tx_locked (ksock_tx_t *tx, ksock_conn_t *conn) spin_unlock_bh(&sched->kss_lock); } - ksock_route_t * ksocknal_find_connectable_route_locked (ksock_peer_t *peer) { @@ -1092,7 +1091,7 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip) conn->ksnc_rx_iov[niov].iov_len = nob; niov++; skipped += nob; - nob_to_skip -=nob; + nob_to_skip -= nob; } while (nob_to_skip != 0 && /* mustn't overflow conn's rx iov */ niov < sizeof(conn->ksnc_rx_iov_space) / sizeof (struct iovec)); @@ -1313,7 +1312,7 @@ ksocknal_recv (lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { - ksock_conn_t *conn = (ksock_conn_t *)private; + ksock_conn_t *conn = private; ksock_sched_t *sched = conn->ksnc_scheduler; LASSERT(mlen <= rlen); @@ -1998,7 +1997,7 @@ ksocknal_connect (ksock_route_t *route) * running out of resource. */ static int -ksocknal_connd_check_start(long sec, long *timeout) +ksocknal_connd_check_start(time64_t sec, long *timeout) { char name[16]; int rc; @@ -2048,7 +2047,7 @@ ksocknal_connd_check_start(long sec, long *timeout) /* we tried ... */ LASSERT(ksocknal_data.ksnd_connd_starting > 0); ksocknal_data.ksnd_connd_starting--; - ksocknal_data.ksnd_connd_failed_stamp = get_seconds(); + ksocknal_data.ksnd_connd_failed_stamp = ktime_get_real_seconds(); return 1; } @@ -2060,7 +2059,7 @@ ksocknal_connd_check_start(long sec, long *timeout) * again to recheck these conditions. */ static int -ksocknal_connd_check_stop(long sec, long *timeout) +ksocknal_connd_check_stop(time64_t sec, long *timeout) { int val; @@ -2141,7 +2140,7 @@ ksocknal_connd (void *arg) while (!ksocknal_data.ksnd_shuttingdown) { ksock_route_t *route = NULL; - long sec = get_seconds(); + time64_t sec = ktime_get_real_seconds(); long timeout = MAX_SCHEDULE_TIMEOUT; int dropped_lock = 0; @@ -2240,6 +2239,7 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer) list_for_each (ctmp, &peer->ksnp_conns) { int error; + conn = list_entry (ctmp, ksock_conn_t, ksnc_list); /* Don't need the {get,put}connsock dance to deref ksnc_sock */ @@ -2394,7 +2394,6 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer) return -EIO; } - static void ksocknal_check_peer_timeouts (int idx) { diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c index 340706110c21..679785b0209c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c @@ -355,9 +355,9 @@ ksocknal_lib_recv_kiov(ksock_conn_t *conn) LASSERT(i < niov); /* Dang! have to kmap again because I have nowhere to - * stash the mapped address. But by doing it while the - * page is still mapped, the kernel just bumps the map - * count and returns me the address it stashed. */ + * stash the mapped address. But by doing it while the + * page is still mapped, the kernel just bumps the map + * count and returns me the address it stashed. */ base = kmap(kiov[i].kiov_page) + kiov[i].kiov_offset; fragnob = kiov[i].kiov_len; if (fragnob > sum) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c index c3ac67698125..fdb2b23e2ef0 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c @@ -134,7 +134,6 @@ static unsigned int zc_recv_min_nfrags = 16; module_param(zc_recv_min_nfrags, int, 0644); MODULE_PARM_DESC(zc_recv_min_nfrags, "minimum # of fragments to enable ZC recv"); - #if SOCKNAL_VERSION_DEBUG static int protocol = 3; module_param(protocol, int, 0644); |