New upstream version 18.02
[deb_dpdk.git] / examples / load_balancer / runtime.c
index 7f918aa..39a846a 100644 (file)
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 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) 2010-2014 Intel Corporation
  */
 
 #include <stdio.h>
@@ -47,9 +18,7 @@
 #include <rte_log.h>
 #include <rte_memory.h>
 #include <rte_memcpy.h>
-#include <rte_memzone.h>
 #include <rte_eal.h>
-#include <rte_per_lcore.h>
 #include <rte_launch.h>
 #include <rte_atomic.h>
 #include <rte_cycles.h>
@@ -58,7 +27,6 @@
 #include <rte_per_lcore.h>
 #include <rte_branch_prediction.h>
 #include <rte_interrupts.h>
-#include <rte_pci.h>
 #include <rte_random.h>
 #include <rte_debug.h>
 #include <rte_ether.h>
@@ -189,7 +157,7 @@ app_lcore_io_rx(
        uint32_t i;
 
        for (i = 0; i < lp->rx.n_nic_queues; i ++) {
-               uint8_t port = lp->rx.nic_queues[i].port;
+               uint16_t port = lp->rx.nic_queues[i].port;
                uint8_t queue = lp->rx.nic_queues[i].queue;
                uint32_t n_mbufs, j;
 
@@ -214,7 +182,7 @@ app_lcore_io_rx(
 
                        printf("I/O RX %u in (NIC port %u): NIC drop ratio = %.2f avg burst size = %.2f\n",
                                lcore,
-                               (unsigned) port,
+                               port,
                                (double) stats.imissed / (double) (stats.imissed + stats.ipackets),
                                ((double) lp->rx.nic_queues_count[i]) / ((double) lp->rx.nic_queues_iters[i]));
                        lp->rx.nic_queues_iters[i] = 0;
@@ -340,7 +308,7 @@ app_lcore_io_tx(
                uint32_t i;
 
                for (i = 0; i < lp->tx.n_nic_ports; i ++) {
-                       uint8_t port = lp->tx.nic_ports[i];
+                       uint16_t port = lp->tx.nic_ports[i];
                        struct rte_ring *ring = lp->tx.rings[port][worker];
                        uint32_t n_mbufs, n_pkts;
                        int ret;
@@ -396,7 +364,7 @@ app_lcore_io_tx(
 
                                printf("\t\t\tI/O TX %u out (port %u): avg burst size = %.2f\n",
                                        lcore,
-                                       (unsigned) port,
+                                       port,
                                        ((double) lp->tx.nic_ports_count[port]) / ((double) lp->tx.nic_ports_iters[port]));
                                lp->tx.nic_ports_iters[port] = 0;
                                lp->tx.nic_ports_count[port] = 0;
@@ -419,7 +387,7 @@ app_lcore_io_tx(
 static inline void
 app_lcore_io_tx_flush(struct app_lcore_params_io *lp)
 {
-       uint8_t port;
+       uint16_t port;
        uint32_t i;
 
        for (i = 0; i < lp->tx.n_nic_ports; i++) {
@@ -570,7 +538,7 @@ app_lcore_worker(
                        if (lp->rings_out_iters[port] == APP_STATS){
                                printf("\t\tWorker %u out (NIC port %u): enq success rate = %.2f\n",
                                        (unsigned) lp->worker_id,
-                                       (unsigned) port,
+                                       port,
                                        ((double) lp->rings_out_count[port]) / ((double) lp->rings_out_iters[port]));
                                lp->rings_out_iters[port] = 0;
                                lp->rings_out_count[port] = 0;