struct lnet_test_peer *tp;
struct list_head *el;
struct list_head *next;
- struct list_head cull;
+ LIST_HEAD(cull);
/* NB: use lnet_net_lock(0) to serialize operations on test peers */
if (threshold != 0) {
return 0;
}
- /* removing entries */
- INIT_LIST_HEAD(&cull);
-
lnet_net_lock(0);
list_for_each_safe(el, next, &the_lnet.ln_test_peers) {
struct lnet_test_peer *tp;
struct list_head *el;
struct list_head *next;
- struct list_head cull;
- int fail = 0;
-
- INIT_LIST_HEAD(&cull);
+ LIST_HEAD(cull);
+ int fail = 0;
/* NB: use lnet_net_lock(0) to serialize operations on test peers */
lnet_net_lock(0);
/* drop all messages which are queued to be routed on that
* peer. */
if (!the_lnet.ln_routing) {
- struct list_head drop;
- INIT_LIST_HEAD(&drop);
+ LIST_HEAD(drop);
list_splice_init(&lp->lp_rtrq, &drop);
spin_unlock(&lp->lp_lock);
spin_unlock(&rxpeerni->lpni_lock);
}
static struct lnet_route *
-lnet_find_route_locked(struct lnet_remotenet *rnet,
+lnet_find_route_locked(struct lnet_remotenet *rnet, __u32 src_net,
struct lnet_route **prev_route,
struct lnet_peer_ni **gwni)
{
struct lnet_route *last_route;
struct lnet_route *route;
int rc;
+ __u32 restrict_net;
+ __u32 any_net = LNET_NIDNET(LNET_NID_ANY);
best_route = last_route = NULL;
list_for_each_entry(route, &rnet->lrn_routes, lr_list) {
if (!lnet_is_route_alive(route))
continue;
+ /* If the src_net is specified then we need to find an lpni
+ * on that network
+ */
+ restrict_net = src_net == any_net ? route->lr_lnet : src_net;
if (!best_route) {
- best_route = last_route = route;
- best_gw_ni = lnet_find_best_lpni_on_net(NULL,
- LNET_NID_ANY,
- route->lr_gateway,
- route->lr_lnet);
- LASSERT(best_gw_ni);
+ lpni = lnet_find_best_lpni_on_net(NULL, LNET_NID_ANY,
+ route->lr_gateway,
+ restrict_net);
+ if (lpni) {
+ best_route = last_route = route;
+ best_gw_ni = lpni;
+ } else
+ CERROR("Gateway %s does not have a peer NI on net %s\n",
+ libcfs_nid2str(route->lr_gateway->lp_primary_nid),
+ libcfs_net2str(restrict_net));
+
continue;
}
lpni = lnet_find_best_lpni_on_net(NULL, LNET_NID_ANY,
route->lr_gateway,
- route->lr_lnet);
- LASSERT(lpni);
+ restrict_net);
+ if (!lpni) {
+ CERROR("Gateway %s does not have a peer NI on net %s\n",
+ libcfs_nid2str(route->lr_gateway->lp_primary_nid),
+ libcfs_net2str(restrict_net));
+ continue;
+ }
if (rc == 1) {
best_route = route;
return -EHOSTUNREACH;
}
- best_route = lnet_find_route_locked(best_rnet, &last_route,
- &gwni);
+ best_route = lnet_find_route_locked(best_rnet,
+ LNET_NIDNET(src_nid),
+ &last_route, &gwni);
if (!best_route) {
CERROR("no route to %s from %s\n",
libcfs_nid2str(dst_nid),
again:
/*
- * If we're sending to ourselves then there is no need to go through
- * any selection. We can shortcut the entire process and send over
- * lolnd.
- *
- * However, we make two exceptions to this rule:
- * 1. If the src_nid is specified then our API defines that we must send
- * via that interface.
- * 2. Recovery messages must be sent to the lnet_ni that is being
- * recovered.
+ * If we're being asked to send to the loopback interface, there
+ * is no need to go through any selection. We can just shortcut
+ * the entire process and send over lolnd
*/
send_data.sd_msg = msg;
send_data.sd_cpt = cpt;
- if (src_nid == LNET_NID_ANY && !msg->msg_recovery &&
- lnet_nid2ni_locked(dst_nid, cpt)) {
+ if (LNET_NETTYP(LNET_NIDNET(dst_nid)) == LOLND) {
rc = lnet_handle_lo_send(&send_data);
lnet_net_unlock(cpt);
return rc;
lnet_finalize_expired_responses(void)
{
struct lnet_libmd *md;
- struct list_head local_queue;
struct lnet_rsp_tracker *rspt, *tmp;
ktime_t now;
int i;
return;
cfs_cpt_for_each(i, lnet_cpt_table()) {
- INIT_LIST_HEAD(&local_queue);
+ LIST_HEAD(local_queue);
lnet_net_lock(i);
if (!the_lnet.ln_mt_rstq[i]) {
lnet_recover_local_nis(void)
{
struct lnet_mt_event_info *ev_info;
- struct list_head processed_list;
- struct list_head local_queue;
+ LIST_HEAD(processed_list);
+ LIST_HEAD(local_queue);
struct lnet_handle_md mdh;
struct lnet_ni *tmp;
struct lnet_ni *ni;
int healthv;
int rc;
- INIT_LIST_HEAD(&local_queue);
- INIT_LIST_HEAD(&processed_list);
-
/*
* splice the recovery queue on a local queue. We will iterate
* through the local queue and update it as needed. Once we're
lnet_clean_resendqs(void)
{
struct lnet_msg *msg, *tmp;
- struct list_head msgs;
+ LIST_HEAD(msgs);
int i;
- INIT_LIST_HEAD(&msgs);
-
cfs_cpt_for_each(i, lnet_cpt_table()) {
lnet_net_lock(i);
list_splice_init(the_lnet.ln_mt_resendqs[i], &msgs);
lnet_recover_peer_nis(void)
{
struct lnet_mt_event_info *ev_info;
- struct list_head processed_list;
- struct list_head local_queue;
+ LIST_HEAD(processed_list);
+ LIST_HEAD(local_queue);
struct lnet_handle_md mdh;
struct lnet_peer_ni *lpni;
struct lnet_peer_ni *tmp;
int healthv;
int rc;
- INIT_LIST_HEAD(&local_queue);
- INIT_LIST_HEAD(&processed_list);
-
/*
* Always use cpt 0 for locking across all interactions with
* ln_mt_peerNIRecovq
if (!list_empty(&the_lnet.ln_drop_rules) &&
lnet_drop_rule_match(hdr, ni->ni_nid, NULL)) {
- CDEBUG(D_NET, "%s, src %s, dst %s: Dropping %s to simulate"
- "silent message loss\n",
+ CDEBUG(D_NET,
+ "%s, src %s, dst %s: Dropping %s to simulate silent message loss\n",
libcfs_nid2str(from_nid), libcfs_nid2str(src_nid),
libcfs_nid2str(dest_nid), lnet_msgtyp2str(type));
goto drop;
struct lnet_libmd *md, struct lnet_handle_md mdh)
{
s64 timeout_ns;
- bool new_entry = true;
struct lnet_rsp_tracker *local_rspt;
/*
* update the deadline on that one.
*/
lnet_rspt_free(rspt, cpt);
- new_entry = false;
} else {
/* new md */
rspt->rspt_mdh = mdh;
* list in order to expire all the older entries first.
*/
lnet_net_lock(cpt);
- if (!new_entry && !list_empty(&local_rspt->rspt_on_list))
- list_del_init(&local_rspt->rspt_on_list);
- list_add_tail(&local_rspt->rspt_on_list, the_lnet.ln_mt_rstq[cpt]);
+ list_move_tail(&local_rspt->rspt_on_list, the_lnet.ln_mt_rstq[cpt]);
lnet_net_unlock(cpt);
lnet_res_unlock(cpt);
}