test/flow_classify: remove port bound requirement
[dpdk.git] / examples / ethtool / ethtool-app / ethapp.c
index 57c584e..0c3f1f6 100644 (file)
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2015 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2015 Intel Corporation
  */
 
 #include <cmdline_parse.h>
@@ -177,6 +148,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
        int id_port;
 
        for (id_port = 0; id_port < rte_eth_dev_count(); id_port++) {
+               memset(&info, 0, sizeof(info));
                if (rte_ethtool_get_drvinfo(id_port, &info)) {
                        printf("Error getting info for port %i\n", id_port);
                        return;
@@ -184,6 +156,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
                printf("Port %i driver: %s (ver: %s)\n",
                        id_port, info.driver, info.version
                      );
+               printf("firmware-version: %s\n", info.fw_version);
+               printf("bus-info: %s\n", info.bus_info);
        }
 }
 
@@ -339,6 +313,7 @@ pcmd_pause_callback(void *ptr_params,
        if (ptr_data != NULL) {
                stat = rte_ethtool_get_pauseparam(params->port, &info);
        } else {
+               memset(&info, 0, sizeof(info));
                if (strcasecmp("all", params->opt) == 0) {
                        info.tx_pause = 1;
                        info.rx_pause = 1;
@@ -352,6 +327,8 @@ pcmd_pause_callback(void *ptr_params,
                        info.tx_pause = 0;
                        info.rx_pause = 0;
                }
+               /* Assume auto-negotiation wanted */
+               info.autoneg = 1;
                stat = rte_ethtool_set_pauseparam(params->port, &info);
        }
        if (stat == 0) {
@@ -480,12 +457,9 @@ pcmd_macaddr_callback(void *ptr_params,
                        return;
                }
        }
-       if (stat == 0)
-               return;
-       else if (stat == -ENOTSUP)
-               printf("Port %i: Operation not supported\n", params->port);
-       else
-               printf("Port %i: Error %i\n", params->port, stat);
+
+       printf("Port %i: Error %s\n", params->port,
+              strerror(-stat));
 }
 
 static void
@@ -535,7 +509,6 @@ static void pcmd_portstats_callback(__rte_unused void *ptr_params,
        }
        stat = rte_ethtool_net_get_stats64(params->port, &stat_info);
        if (stat == 0) {
-               /* Most of rte_eth_stats is deprecated.. */
                printf("Port %i stats\n", params->port);
                printf("   In: %" PRIu64 " (%" PRIu64 " bytes)\n"
                        "  Out: %"PRIu64" (%"PRIu64 " bytes)\n"