update Intel copyright years to 2014
[dpdk.git] / examples / load_balancer / runtime.c
index df3a3a0..e85abdb 100644 (file)
@@ -1,35 +1,34 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   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 
+ *   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 
+ *     * 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 
+ *     * 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 
+ *     * 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 
+ *   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.
- * 
  */
 
 #include <stdio.h>
@@ -165,11 +164,11 @@ app_lcore_io_rx_buffer_to_send (
                lp->rx.rings_count[worker] ++;
        }
        if (unlikely(lp->rx.rings_iters[worker] == APP_STATS)) {
-               uint32_t lcore = rte_lcore_id();
+               unsigned lcore = rte_lcore_id();
 
                printf("\tI/O RX %u out (worker %u): enq success rate = %.2f\n",
                        lcore,
-                       worker,
+                       (unsigned)worker,
                        ((double) lp->rx.rings_count[worker]) / ((double) lp->rx.rings_iters[worker]));
                lp->rx.rings_iters[worker] = 0;
                lp->rx.rings_count[worker] = 0;
@@ -186,7 +185,7 @@ app_lcore_io_rx(
        uint8_t pos_lb)
 {
        struct rte_mbuf *mbuf_1_0, *mbuf_1_1, *mbuf_2_0, *mbuf_2_1;
-       uint8_t *data_1_0, *data_1_1;
+       uint8_t *data_1_0, *data_1_1 = NULL;
        uint32_t i;
 
        for (i = 0; i < lp->rx.n_nic_queues; i ++) {
@@ -209,13 +208,13 @@ app_lcore_io_rx(
                lp->rx.nic_queues_count[i] += n_mbufs;
                if (unlikely(lp->rx.nic_queues_iters[i] == APP_STATS)) {
                        struct rte_eth_stats stats;
-                       uint32_t lcore = rte_lcore_id();
+                       unsigned lcore = rte_lcore_id();
 
                        rte_eth_stats_get(port, &stats);
 
                        printf("I/O RX %u in (NIC port %u): NIC drop ratio = %.2f avg burst size = %.2f\n",
                                lcore,
-                               (uint32_t) port,
+                               (unsigned) port,
                                (double) stats.ierrors / (double) (stats.ierrors + stats.ipackets),
                                ((double) lp->rx.nic_queues_count[i]) / ((double) lp->rx.nic_queues_iters[i]));
                        lp->rx.nic_queues_iters[i] = 0;
@@ -392,11 +391,11 @@ app_lcore_io_tx(
                        lp->tx.nic_ports_iters[port] ++;
                        lp->tx.nic_ports_count[port] += n_pkts;
                        if (unlikely(lp->tx.nic_ports_iters[port] == APP_STATS)) {
-                               uint32_t lcore = rte_lcore_id();
+                               unsigned lcore = rte_lcore_id();
 
                                printf("\t\t\tI/O TX %u out (port %u): avg burst size = %.2f\n",
                                        lcore,
-                                       (uint32_t) port,
+                                       (unsigned) 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;
@@ -564,8 +563,8 @@ app_lcore_worker(
                        }
                        if (lp->rings_out_iters[port] == APP_STATS){
                                printf("\t\tWorker %u out (NIC port %u): enq success rate = %.2f\n",
-                                       lp->worker_id,
-                                       (uint32_t) port,
+                                       (unsigned) lp->worker_id,
+                                       (unsigned) 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;
@@ -647,7 +646,7 @@ int
 app_lcore_main_loop(__attribute__((unused)) void *arg)
 {
        struct app_lcore_params *lp;
-       uint32_t lcore;
+       unsigned lcore;
 
        lcore = rte_lcore_id();
        lp = &app.lcore_params[lcore];
@@ -660,7 +659,7 @@ app_lcore_main_loop(__attribute__((unused)) void *arg)
        if (lp->type == e_APP_LCORE_WORKER) {
                printf("Logical core %u (worker %u) main loop.\n",
                        lcore,
-                       lp->worker.worker_id);
+                       (unsigned) lp->worker.worker_id);
                app_lcore_main_loop_worker();
        }