}
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;
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);
}