/*
* Copyright (c) 2008, 2009 Nicira Networks.
*
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include <config.h>
#include "dynamic-string.h"
#include "netdev.h"
#include "odp-util.h"
+#include "svec.h"
#include "timeval.h"
#include "util.h"
" del-dp DP delete local datapath DP\n"
" add-if DP IFACE... add each IFACE as a port on DP\n"
" del-if DP IFACE... delete each IFACE from DP\n"
+ " dump-dps display names of all datapaths\n"
" show show basic info on all datapaths\n"
" show DP... show basic info on each DP\n"
" dump-flows DP display flows in DP\n"
int flags = 0;
int error;
- devname = strtok_r(argv[i], ",,", &save_ptr);
+ devname = strtok_r(argv[i], ",", &save_ptr);
if (!devname) {
ovs_error(0, "%s is not a valid network device name", argv[i]);
continue;
printf("\tports: cur:%"PRIu32", max:%"PRIu32"\n",
stats.n_ports, stats.max_ports);
printf("\tgroups: max:%"PRIu16"\n", stats.max_groups);
- printf("\tlookups: frags:%"PRIu64", hit:%"PRIu64", missed:%"PRIu64", "
- "lost:%"PRIu64"\n",
- stats.n_frags, stats.n_hit, stats.n_missed, stats.n_lost);
+ printf("\tlookups: frags:%llu, hit:%llu, missed:%llu, lost:%llu\n",
+ (unsigned long long int) stats.n_frags,
+ (unsigned long long int) stats.n_hit,
+ (unsigned long long int) stats.n_missed,
+ (unsigned long long int) stats.n_lost);
printf("\tqueues: max-miss:%"PRIu16", max-action:%"PRIu16"\n",
stats.max_miss_queue, stats.max_action_queue);
}
}
static void
-do_show(int argc UNUSED, char *argv[])
+do_show(int argc, char *argv[])
{
bool failure = false;
if (argc > 1) {
}
}
+static void
+do_dump_dps(int argc UNUSED, char *argv[] UNUSED)
+{
+ struct svec all_dps;
+ unsigned int i;
+ int error;
+
+ svec_init(&all_dps);
+ error = dp_enumerate(&all_dps);
+
+ for (i = 0; i < all_dps.n; i++) {
+ struct dpif dpif;
+ char dpif_name[IF_NAMESIZE];
+
+ if (dpif_open(all_dps.names[i], &dpif)) {
+ continue;
+ }
+ if (!dpif_get_name(&dpif, dpif_name, sizeof dpif_name)) {
+ printf("%s\n", dpif_name);
+ }
+ dpif_close(&dpif);
+ }
+
+ svec_destroy(&all_dps);
+ if (error) {
+ exit(EXIT_FAILURE);
+ }
+}
+
static void
do_dump_flows(int argc UNUSED, char *argv[])
{
{ "del-dp", 1, 1, do_del_dp },
{ "add-if", 2, INT_MAX, do_add_if },
{ "del-if", 2, INT_MAX, do_del_if },
+ { "dump-dps", 0, 0, do_dump_dps },
{ "show", 0, INT_MAX, do_show },
{ "dump-flows", 1, 1, do_dump_flows },
{ "del-flows", 1, 1, do_del_flows },