kvargs: use SPDX tags
[dpdk.git] / examples / load_balancer / main.h
index 650f750..9fefb62 100644 (file)
@@ -1,36 +1,5 @@
-/*-
- *   BSD LICENSE
- * 
- *   Copyright(c) 2010-2012 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.
- * 
- *  version: DPDK.L.1.2.3-3
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
  */
 
 #ifndef _MAIN_H_
 #endif
 
 #ifndef APP_MAX_IO_LCORES
+#if (APP_MAX_LCORES > 16)
 #define APP_MAX_IO_LCORES 16
+#else
+#define APP_MAX_IO_LCORES APP_MAX_LCORES
+#endif
 #endif
 #if (APP_MAX_IO_LCORES > APP_MAX_LCORES)
 #error "APP_MAX_IO_LCORES is too big"
 #endif
 
 #ifndef APP_MAX_WORKER_LCORES
+#if (APP_MAX_LCORES > 16)
 #define APP_MAX_WORKER_LCORES 16
+#else
+#define APP_MAX_WORKER_LCORES APP_MAX_LCORES
+#endif
 #endif
 #if (APP_MAX_WORKER_LCORES > APP_MAX_LCORES)
 #error "APP_MAX_WORKER_LCORES is too big"
 
 
 /* Mempools */
-#ifndef APP_DEFAULT_MBUF_SIZE
-#define APP_DEFAULT_MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
+#ifndef APP_DEFAULT_MBUF_DATA_SIZE
+#define APP_DEFAULT_MBUF_DATA_SIZE  RTE_MBUF_DEFAULT_BUF_SIZE
 #endif
 
 #ifndef APP_DEFAULT_MEMPOOL_BUFFERS
-#define APP_DEFAULT_MEMPOOL_BUFFERS   8192
+#define APP_DEFAULT_MEMPOOL_BUFFERS   8192 * 4
 #endif
 
 #ifndef APP_DEFAULT_MEMPOOL_CACHE_SIZE
 #define APP_DEFAULT_NIC_RX_FREE_THRESH  64
 #endif
 
+#ifndef APP_DEFAULT_NIC_RX_DROP_EN
+#define APP_DEFAULT_NIC_RX_DROP_EN 0
+#endif
+
 /* NIC TX */
 #ifndef APP_DEFAULT_NIC_TX_RING_SIZE
 #define APP_DEFAULT_NIC_TX_RING_SIZE 1024
@@ -238,7 +219,7 @@ struct app_lcore_params_io {
        struct {
                /* NIC */
                struct {
-                       uint8_t port;
+                       uint16_t port;
                        uint8_t queue;
                } nic_queues[APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE];
                uint32_t n_nic_queues;
@@ -265,7 +246,7 @@ struct app_lcore_params_io {
                struct rte_ring *rings[APP_MAX_NIC_PORTS][APP_MAX_WORKER_LCORES];
 
                /* NIC */
-               uint8_t nic_ports[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
+               uint16_t nic_ports[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
                uint32_t n_nic_ports;
 
                /* Internal buffers */
@@ -358,20 +339,13 @@ void app_print_usage(void);
 void app_init(void);
 int app_lcore_main_loop(void *arg);
 
-int app_get_nic_rx_queues_per_port(uint8_t port);
-int app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out);
-int app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out);
+int app_get_nic_rx_queues_per_port(uint16_t port);
+int app_get_lcore_for_nic_rx(uint16_t port, uint8_t queue,
+                             uint32_t *lcore_out);
+int app_get_lcore_for_nic_tx(uint16_t port, uint32_t *lcore_out);
 int app_is_socket_used(uint32_t socket);
 uint32_t app_get_lcores_io_rx(void);
 uint32_t app_get_lcores_worker(void);
 void app_print_params(void);
 
-#ifdef RTE_EXEC_ENV_BAREMETAL
-#define MAIN _main
-#else
-#define MAIN main
-#endif
-
-int MAIN(int argc, char **argv);
-
 #endif /* _MAIN_H_ */