#if defined(__KERNEL__) && defined(LNET_ROUTER)
-/* this is really lnet_proc.c */
+/* This is really lnet_proc.c. You might need to update sanity test 215
+ * if any file format is changed. */
static cfs_sysctl_table_header_t *lnet_table_header = NULL;
if (*ppos == 0) {
s += snprintf(s, tmpstr + tmpsiz - s,
- "%-24s %4s %5s %5s %5s %5s %5s %5s %s\n",
- "nid", "refs", "state", "max",
+ "%-24s %4s %5s %5s %5s %5s %5s %5s %5s %s\n",
+ "nid", "refs", "state", "last", "max",
"rtr", "min", "tx", "min", "queue");
LASSERT (tmpstr + tmpsiz - s > 0);
if (skip == 0) {
peer = lp;
- /* minor optimiztion: start from idx+1
+ /* minor optimization: start from idx+1
* on next iteration if we've just
* drained lp_hashlist */
if (lp->lp_hashlist.next ==
if (peer != NULL) {
lnet_nid_t nid = peer->lp_nid;
int nrefs = peer->lp_refcount;
+ int lastalive = -1;
char *aliveness = "NA";
int maxcr = peer->lp_ni->ni_peertxcredits;
int txcr = peer->lp_txcredits;
lnet_peer_aliveness_enabled(peer))
aliveness = peer->lp_alive ? "up" : "down";
+ if (lnet_peer_aliveness_enabled(peer)) {
+ cfs_time_t now = cfs_time_current();
+ cfs_duration_t delta;
+
+ delta = cfs_time_sub(now, peer->lp_last_alive);
+ lastalive = cfs_duration_sec(delta);
+
+ /* No need to mess up peers contents with
+ * arbitrarily long integers - it suffices to
+ * know that lastalive is more than 10000s old
+ */
+ if (lastalive >= 10000)
+ lastalive = 9999;
+ }
+
s += snprintf(s, tmpstr + tmpsiz - s,
- "%-24s %4d %5s %5d %5d %5d %5d %5d %d\n",
+ "%-24s %4d %5s %5d %5d %5d %5d %5d %5d %d\n",
libcfs_nid2str(nid), nrefs, aliveness,
- maxcr, rtrcr, minrtrcr, txcr,
+ lastalive, maxcr, rtrcr, minrtrcr, txcr,
mintxcr, txqnob);
LASSERT (tmpstr + tmpsiz - s > 0);
}
* to go via /proc for portability.
*/
{
- .ctl_name = PSDEV_LNET_STATS,
+ INIT_CTL_NAME(PSDEV_LNET_STATS)
.procname = "stats",
.mode = 0644,
.proc_handler = &proc_lnet_stats,
},
{
- .ctl_name = PSDEV_LNET_ROUTES,
+ INIT_CTL_NAME(PSDEV_LNET_ROUTES)
.procname = "routes",
.mode = 0444,
.proc_handler = &proc_lnet_routes,
},
{
- .ctl_name = PSDEV_LNET_ROUTERS,
+ INIT_CTL_NAME(PSDEV_LNET_ROUTERS)
.procname = "routers",
.mode = 0444,
.proc_handler = &proc_lnet_routers,
},
{
- .ctl_name = PSDEV_LNET_PEERS,
+ INIT_CTL_NAME(PSDEV_LNET_PEERS)
.procname = "peers",
.mode = 0444,
.proc_handler = &proc_lnet_peers,
},
{
- .ctl_name = PSDEV_LNET_PEERS,
+ INIT_CTL_NAME(PSDEV_LNET_PEERS)
.procname = "buffers",
.mode = 0444,
.proc_handler = &proc_lnet_buffers,
},
{
- .ctl_name = PSDEV_LNET_NIS,
+ INIT_CTL_NAME(PSDEV_LNET_NIS)
.procname = "nis",
.mode = 0444,
.proc_handler = &proc_lnet_nis,
},
- {0}
+ {
+ INIT_CTL_NAME(0)
+ }
};
static cfs_sysctl_table_t top_table[] = {
{
- .ctl_name = CTL_LNET,
+ INIT_CTL_NAME(CTL_LNET)
.procname = "lnet",
.mode = 0555,
.data = NULL,
.child = lnet_table,
},
{
- .ctl_name = 0
+ INIT_CTL_NAME(0)
}
};