net: add rte prefix to ether structures
[dpdk.git] / examples / ethtool / ethtool-app / main.c
index bbab2f6..27c22cf 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
  */
 
 
@@ -49,8 +20,8 @@
 
 #define MAX_PORTS RTE_MAX_ETHPORTS
 #define MAX_BURST_LENGTH 32
-#define PORT_RX_QUEUE_SIZE 128
-#define PORT_TX_QUEUE_SIZE 256
+#define PORT_RX_QUEUE_SIZE 1024
+#define PORT_TX_QUEUE_SIZE 1024
 #define PKTPOOL_EXTRA_SIZE 512
 #define PKTPOOL_CACHE 32
 
@@ -61,7 +32,7 @@ struct txq_port {
 };
 
 struct app_port {
-       struct ether_addr mac_addr;
+       struct rte_ether_addr mac_addr;
        struct txq_port txq;
        rte_spinlock_t lock;
        int port_active;
@@ -160,6 +131,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
                                                     &nb_txd) < 0)
                        rte_exit(EXIT_FAILURE,
                                 "rte_eth_dev_adjust_nb_rx_tx_desc failed");
+
                if (rte_eth_rx_queue_setup(
                            idx_port, 0, nb_rxd,
                            rte_eth_dev_socket_id(idx_port), NULL,
@@ -186,9 +158,9 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
 static void process_frame(struct app_port *ptr_port,
        struct rte_mbuf *ptr_frame)
 {
-       struct ether_hdr *ptr_mac_hdr;
+       struct rte_ether_hdr *ptr_mac_hdr;
 
-       ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *);
+       ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *);
        ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr);
        ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr);
 }
@@ -275,7 +247,7 @@ int main(int argc, char **argv)
        if (cnt_args_parsed < 0)
                rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
 
-       cnt_ports = rte_eth_dev_count();
+       cnt_ports = rte_eth_dev_count_avail();
        printf("Number of NICs: %i\n", cnt_ports);
        if (cnt_ports == 0)
                rte_exit(EXIT_FAILURE, "No available NIC ports!\n");