}
void
+kqswnal_notify_peer_down(kqswnal_tx_t *ktx)
+{
+ struct timeval now;
+ time_t then;
+
+ do_gettimeofday (&now);
+ then = now.tv_sec - (jiffies - ktx->ktx_launchtime)/HZ;
+
+ kpr_notify(&kqswnal_data.kqn_router, ktx->ktx_nid, 0, then);
+}
+
+void
kqswnal_unmap_tx (kqswnal_tx_t *ktx)
{
if (ktx->ktx_nmappedpages == 0)
kqswnal_txhandler(EP_TXD *txd, void *arg, int status)
{
kqswnal_tx_t *ktx = (kqswnal_tx_t *)arg;
- struct timeval now;
- time_t then;
LASSERT (txd != NULL);
LASSERT (ktx != NULL);
CERROR ("Tx completion to "LPX64" failed: %d\n",
ktx->ktx_nid, status);
- do_gettimeofday (&now);
- then = now.tv_sec - (jiffies - ktx->ktx_launchtime)/HZ;
-
- kpr_notify (&kqswnal_data.kqn_router,
- ktx->ktx_nid, 0, then);
-
+ kqswnal_notify_peer_down(ktx);
status = -EIO;
}
default: /* fatal error */
CERROR ("Tx to "LPX64" failed: %d\n", ktx->ktx_nid, rc);
-
- /* Tell router I think a node is down */
- kpr_notify (&kqswnal_data.kqn_router, ktx->ktx_nid,
- 0, ktx->ktx_launchtime);
+ kqswnal_notify_peer_down(ktx);
return (rc);
}
}
conn, rc, conn->ksnc_peer->ksnp_nid,
conn->ksnc_ipaddr, conn->ksnc_port);
else
- CERROR ("[%p] EOF from "LPX64" ip %08x:%d\n",
- conn, conn->ksnc_peer->ksnp_nid,
- conn->ksnc_ipaddr, conn->ksnc_port);
+ CWARN ("[%p] EOF from "LPX64" ip %08x:%d\n",
+ conn, conn->ksnc_peer->ksnp_nid,
+ conn->ksnc_ipaddr, conn->ksnc_port);
}
goto out;
}
snprintf (whenstr, sizeof(whenstr), "%ld", u->kpru_when);
portals_run_upcall (argv);
+
+ kfree (u);
}
void
/* can't do predictions... */
do_gettimeofday (&now);
if (when > now.tv_sec) {
- CERROR ("Ignoring prediction from %s of [%d] "LPX64" %s "
- "%ld seconds in the future\n",
- byNal ? "NAL" : "userspace",
- gateway_nalid, gateway_nid, alive ? "up" : "down",
- when - now.tv_sec);
+ CWARN ("Ignoring prediction from %s of [%d] "LPX64" %s "
+ "%ld seconds in the future\n",
+ byNal ? "NAL" : "userspace",
+ gateway_nalid, gateway_nid,
+ alive ? "up" : "down",
+ when - now.tv_sec);
return (EINVAL);
}
if (rc != 0) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
- CERROR ("Gateway not found\n");
+ CDEBUG (D_NET, "Gateway not found\n");
return (rc);
}
if (when < ge->kpge_timestamp) {
/* out of date information */
write_unlock_irqrestore (&kpr_rwlock, flags);
- CERROR ("Out of date\n");
+ CDEBUG (D_NET, "Out of date\n");
return (0);
}
if ((!ge->kpge_alive) == (!alive)) {
/* new date for old news */
write_unlock_irqrestore (&kpr_rwlock, flags);
- CERROR ("Old news\n");
+ CDEBUG (D_NET, "Old news\n");
return (0);
}
if (byNal) {
/* It wasn't userland that notified me... */
- CERROR ("Doing upcall\n");
+ CWARN ("Upcall: NAL %d NID "LPX64" is %s\n",
+ gateway_nalid, gateway_nid,
+ alive ? "alive" : "dead");
kpr_upcall (gateway_nalid, gateway_nid, alive, when);
} else {
- CERROR (" NOT Doing upcall\n");
+ CDEBUG (D_NET, " NOT Doing upcall\n");
}
return (0);
}
void
+kqswnal_notify_peer_down(kqswnal_tx_t *ktx)
+{
+ struct timeval now;
+ time_t then;
+
+ do_gettimeofday (&now);
+ then = now.tv_sec - (jiffies - ktx->ktx_launchtime)/HZ;
+
+ kpr_notify(&kqswnal_data.kqn_router, ktx->ktx_nid, 0, then);
+}
+
+void
kqswnal_unmap_tx (kqswnal_tx_t *ktx)
{
if (ktx->ktx_nmappedpages == 0)
kqswnal_txhandler(EP_TXD *txd, void *arg, int status)
{
kqswnal_tx_t *ktx = (kqswnal_tx_t *)arg;
- struct timeval now;
- time_t then;
LASSERT (txd != NULL);
LASSERT (ktx != NULL);
CERROR ("Tx completion to "LPX64" failed: %d\n",
ktx->ktx_nid, status);
- do_gettimeofday (&now);
- then = now.tv_sec - (jiffies - ktx->ktx_launchtime)/HZ;
-
- kpr_notify (&kqswnal_data.kqn_router,
- ktx->ktx_nid, 0, then);
-
+ kqswnal_notify_peer_down(ktx);
status = -EIO;
}
default: /* fatal error */
CERROR ("Tx to "LPX64" failed: %d\n", ktx->ktx_nid, rc);
-
- /* Tell router I think a node is down */
- kpr_notify (&kqswnal_data.kqn_router, ktx->ktx_nid,
- 0, ktx->ktx_launchtime);
+ kqswnal_notify_peer_down(ktx);
return (rc);
}
}
conn, rc, conn->ksnc_peer->ksnp_nid,
conn->ksnc_ipaddr, conn->ksnc_port);
else
- CERROR ("[%p] EOF from "LPX64" ip %08x:%d\n",
- conn, conn->ksnc_peer->ksnp_nid,
- conn->ksnc_ipaddr, conn->ksnc_port);
+ CWARN ("[%p] EOF from "LPX64" ip %08x:%d\n",
+ conn, conn->ksnc_peer->ksnp_nid,
+ conn->ksnc_ipaddr, conn->ksnc_port);
}
goto out;
}
snprintf (whenstr, sizeof(whenstr), "%ld", u->kpru_when);
portals_run_upcall (argv);
+
+ kfree (u);
}
void
/* can't do predictions... */
do_gettimeofday (&now);
if (when > now.tv_sec) {
- CERROR ("Ignoring prediction from %s of [%d] "LPX64" %s "
- "%ld seconds in the future\n",
- byNal ? "NAL" : "userspace",
- gateway_nalid, gateway_nid, alive ? "up" : "down",
- when - now.tv_sec);
+ CWARN ("Ignoring prediction from %s of [%d] "LPX64" %s "
+ "%ld seconds in the future\n",
+ byNal ? "NAL" : "userspace",
+ gateway_nalid, gateway_nid,
+ alive ? "up" : "down",
+ when - now.tv_sec);
return (EINVAL);
}
if (rc != 0) {
/* gateway not found */
write_unlock_irqrestore(&kpr_rwlock, flags);
- CERROR ("Gateway not found\n");
+ CDEBUG (D_NET, "Gateway not found\n");
return (rc);
}
if (when < ge->kpge_timestamp) {
/* out of date information */
write_unlock_irqrestore (&kpr_rwlock, flags);
- CERROR ("Out of date\n");
+ CDEBUG (D_NET, "Out of date\n");
return (0);
}
if ((!ge->kpge_alive) == (!alive)) {
/* new date for old news */
write_unlock_irqrestore (&kpr_rwlock, flags);
- CERROR ("Old news\n");
+ CDEBUG (D_NET, "Old news\n");
return (0);
}
if (byNal) {
/* It wasn't userland that notified me... */
- CERROR ("Doing upcall\n");
+ CWARN ("Upcall: NAL %d NID "LPX64" is %s\n",
+ gateway_nalid, gateway_nid,
+ alive ? "alive" : "dead");
kpr_upcall (gateway_nalid, gateway_nid, alive, when);
} else {
- CERROR (" NOT Doing upcall\n");
+ CDEBUG (D_NET, " NOT Doing upcall\n");
}
return (0);