remove unused ring includes
[dpdk.git] / examples / load_balancer / config.c
index f5fee6d..157fd52 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   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
@@ -17,7 +17,7 @@
  *     * 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
@@ -48,7 +48,6 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_launch.h>
@@ -64,7 +63,6 @@
 #include <rte_debug.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
-#include <rte_ring.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_ip.h>
@@ -155,7 +153,7 @@ str_to_unsigned_array(
        int i, num_splits = 0;
 
        /* copy s so we don't modify original string */
-       rte_snprintf(str, sizeof(str), "%s", s);
+       snprintf(str, sizeof(str), "%s", s);
        num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
 
        errno = 0;
@@ -232,7 +230,9 @@ parse_arg_rx(const char *arg)
                        return -7;
                }
                lp->type = e_APP_LCORE_IO;
-               for (i = 0; i < lp->io.rx.n_nic_queues; i ++) {
+               const size_t n_queues = RTE_MIN(lp->io.rx.n_nic_queues,
+                                               RTE_DIM(lp->io.rx.nic_queues));
+               for (i = 0; i < n_queues; i ++) {
                        if ((lp->io.rx.nic_queues[i].port == port) &&
                            (lp->io.rx.nic_queues[i].queue == queue)) {
                                return -8;
@@ -309,7 +309,9 @@ parse_arg_tx(const char *arg)
                        return -7;
                }
                lp->type = e_APP_LCORE_IO;
-               for (i = 0; i < lp->io.tx.n_nic_ports; i ++) {
+               const size_t n_ports = RTE_MIN(lp->io.tx.n_nic_ports,
+                                              RTE_DIM(lp->io.tx.nic_ports));
+               for (i = 0; i < n_ports; i ++) {
                        if (lp->io.tx.nic_ports[i] == port) {
                                return -8;
                        }
@@ -792,7 +794,9 @@ app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out)
                        continue;
                }
 
-               for (i = 0; i < lp->rx.n_nic_queues; i ++) {
+               const size_t n_queues = RTE_MIN(lp->rx.n_nic_queues,
+                                               RTE_DIM(lp->rx.nic_queues));
+               for (i = 0; i < n_queues; i ++) {
                        if ((lp->rx.nic_queues[i].port == port) &&
                            (lp->rx.nic_queues[i].queue == queue)) {
                                *lcore_out = lcore;
@@ -817,7 +821,9 @@ app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out)
                        continue;
                }
 
-               for (i = 0; i < lp->tx.n_nic_ports; i ++) {
+               const size_t n_ports = RTE_MIN(lp->tx.n_nic_ports,
+                                              RTE_DIM(lp->tx.nic_ports));
+               for (i = 0; i < n_ports; i ++) {
                        if (lp->tx.nic_ports[i] == port) {
                                *lcore_out = lcore;
                                return 0;