+ DPIF_PORT_FOR_EACH (&dpif_port, &dump, dpif) {
+ printf("\tport %u: %s", dpif_port.port_no, dpif_port.name);
+
+ if (strcmp(dpif_port.type, "system")) {
+ int error;
+
+ printf (" (%s", dpif_port.type);
+
+ error = netdev_open(dpif_port.name, dpif_port.type, &netdev);
+ if (!error) {
+ struct shash config;
+
+ shash_init(&config);
+ error = netdev_get_config(netdev, &config);
+ if (!error) {
+ const struct shash_node **nodes;
+ size_t i;
+
+ nodes = shash_sort(&config);
+ for (i = 0; i < shash_count(&config); i++) {
+ const struct shash_node *node = nodes[i];
+ printf("%c %s=%s", i ? ',' : ':',
+ node->name, (char *) node->data);
+ }
+ free(nodes);
+ } else {
+ printf(", could not retrieve configuration (%s)",
+ strerror(error));
+ }
+ shash_destroy_free_data(&config);
+
+ netdev_close(netdev);
+ } else {
+ printf(": open failed (%s)", strerror(error));
+ }
+ putchar(')');
+ }
+ putchar('\n');
+
+ if (print_statistics) {
+ struct netdev_stats s;
+ int error;
+
+ error = netdev_open(dpif_port.name, dpif_port.type, &netdev);
+ if (error) {
+ printf(", open failed (%s)", strerror(error));
+ continue;
+ }
+ error = netdev_get_stats(netdev, &s);
+ if (error) {
+ printf(", could not retrieve stats (%s)", strerror(error));
+ continue;
+ }
+
+ netdev_close(netdev);
+ print_stat("\t\tRX packets:", s.rx_packets);
+ print_stat(" errors:", s.rx_errors);
+ print_stat(" dropped:", s.rx_dropped);
+ print_stat(" overruns:", s.rx_over_errors);
+ print_stat(" frame:", s.rx_frame_errors);
+ printf("\n");
+
+ print_stat("\t\tTX packets:", s.tx_packets);
+ print_stat(" errors:", s.tx_errors);
+ print_stat(" dropped:", s.tx_dropped);
+ print_stat(" aborted:", s.tx_aborted_errors);
+ print_stat(" carrier:", s.tx_carrier_errors);
+ printf("\n");
+
+ print_stat("\t\tcollisions:", s.collisions);
+ printf("\n");
+
+ print_stat("\t\tRX bytes:", s.rx_bytes);
+ print_human_size(s.rx_bytes);
+ print_stat(" TX bytes:", s.tx_bytes);
+ print_human_size(s.tx_bytes);
+ printf("\n");