+static void
+cfm_print_details(struct ds *ds, const struct cfm *cfm)
+{
+ struct remote_mp *rmp;
+
+ ds_put_format(ds, "---- %s ----\n", cfm->name);
+ ds_put_format(ds, "MPID %"PRIu64":%s%s%s\n", cfm->mpid,
+ cfm->extended ? " extended" : "",
+ cfm->fault ? " fault" : "",
+ cfm->unexpected_recv ? " unexpected_recv" : "");
+
+ ds_put_format(ds, "\topstate: %s\n", cfm->opup ? "up" : "down");
+ ds_put_format(ds, "\tremote_opstate: %s\n",
+ cfm->remote_opup ? "up" : "down");
+ ds_put_format(ds, "\tinterval: %dms\n", cfm->ccm_interval_ms);
+ ds_put_format(ds, "\tnext CCM tx: %lldms\n",
+ timer_msecs_until_expired(&cfm->tx_timer));
+ ds_put_format(ds, "\tnext fault check: %lldms\n",
+ timer_msecs_until_expired(&cfm->fault_timer));
+
+ HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
+ ds_put_format(ds, "Remote MPID %"PRIu64":%s\n",
+ rmp->mpid,
+ rmp->rdi ? " rdi" : "");
+ ds_put_format(ds, "\trecv since check: %s\n",
+ rmp->recv ? "true" : "false");
+ ds_put_format(ds, "\topstate: %s\n", rmp->opup? "up" : "down");
+ }
+}
+
+static void
+cfm_unixctl_show(struct unixctl_conn *conn,
+ const char *args, void *aux OVS_UNUSED)
+{
+ struct ds ds = DS_EMPTY_INITIALIZER;
+ const struct cfm *cfm;
+
+ if (strlen(args)) {
+ cfm = cfm_find(args);
+ if (!cfm) {
+ unixctl_command_reply(conn, 501, "no such CFM object");
+ return;
+ }
+ cfm_print_details(&ds, cfm);
+ } else {
+ HMAP_FOR_EACH (cfm, hmap_node, &all_cfms) {
+ cfm_print_details(&ds, cfm);
+ }