1*2bfe3f2eSlogwang /*-
2*2bfe3f2eSlogwang  *   BSD LICENSE
3*2bfe3f2eSlogwang  *
4*2bfe3f2eSlogwang  *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
5*2bfe3f2eSlogwang  *   All rights reserved.
6*2bfe3f2eSlogwang  *
7*2bfe3f2eSlogwang  *   Redistribution and use in source and binary forms, with or without
8*2bfe3f2eSlogwang  *   modification, are permitted provided that the following conditions
9*2bfe3f2eSlogwang  *   are met:
10*2bfe3f2eSlogwang  *
11*2bfe3f2eSlogwang  *     * Redistributions of source code must retain the above copyright
12*2bfe3f2eSlogwang  *       notice, this list of conditions and the following disclaimer.
13*2bfe3f2eSlogwang  *     * Redistributions in binary form must reproduce the above copyright
14*2bfe3f2eSlogwang  *       notice, this list of conditions and the following disclaimer in
15*2bfe3f2eSlogwang  *       the documentation and/or other materials provided with the
16*2bfe3f2eSlogwang  *       distribution.
17*2bfe3f2eSlogwang  *     * Neither the name of Intel Corporation nor the names of its
18*2bfe3f2eSlogwang  *       contributors may be used to endorse or promote products derived
19*2bfe3f2eSlogwang  *       from this software without specific prior written permission.
20*2bfe3f2eSlogwang  *
21*2bfe3f2eSlogwang  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*2bfe3f2eSlogwang  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*2bfe3f2eSlogwang  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24*2bfe3f2eSlogwang  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25*2bfe3f2eSlogwang  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26*2bfe3f2eSlogwang  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27*2bfe3f2eSlogwang  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28*2bfe3f2eSlogwang  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29*2bfe3f2eSlogwang  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*2bfe3f2eSlogwang  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*2bfe3f2eSlogwang  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*2bfe3f2eSlogwang  */
33*2bfe3f2eSlogwang 
34*2bfe3f2eSlogwang #ifndef _INIT_H_
35*2bfe3f2eSlogwang #define _INIT_H_
36*2bfe3f2eSlogwang 
37*2bfe3f2eSlogwang /*
38*2bfe3f2eSlogwang  * #include <rte_ring.h>
39*2bfe3f2eSlogwang  * #include "args.h"
40*2bfe3f2eSlogwang  */
41*2bfe3f2eSlogwang 
42*2bfe3f2eSlogwang /*
43*2bfe3f2eSlogwang  * Define a node structure with all needed info, including
44*2bfe3f2eSlogwang  * stats from the nodes.
45*2bfe3f2eSlogwang  */
46*2bfe3f2eSlogwang struct node {
47*2bfe3f2eSlogwang 	struct rte_ring *rx_q;
48*2bfe3f2eSlogwang 	unsigned int node_id;
49*2bfe3f2eSlogwang 	/* these stats hold how many packets the node will actually receive,
50*2bfe3f2eSlogwang 	 * and how many packets were dropped because the node's queue was full.
51*2bfe3f2eSlogwang 	 * The port-info stats, in contrast, record how many packets were received
52*2bfe3f2eSlogwang 	 * or transmitted on an actual NIC port.
53*2bfe3f2eSlogwang 	 */
54*2bfe3f2eSlogwang 	struct {
55*2bfe3f2eSlogwang 		uint64_t rx;
56*2bfe3f2eSlogwang 		uint64_t rx_drop;
57*2bfe3f2eSlogwang 	} stats;
58*2bfe3f2eSlogwang };
59*2bfe3f2eSlogwang 
60*2bfe3f2eSlogwang extern struct rte_efd_table *efd_table;
61*2bfe3f2eSlogwang extern struct node *nodes;
62*2bfe3f2eSlogwang 
63*2bfe3f2eSlogwang /*
64*2bfe3f2eSlogwang  * shared information between server and nodes: number of nodes,
65*2bfe3f2eSlogwang  * port numbers, rx and tx stats etc.
66*2bfe3f2eSlogwang  */
67*2bfe3f2eSlogwang extern struct shared_info *info;
68*2bfe3f2eSlogwang 
69*2bfe3f2eSlogwang extern struct rte_mempool *pktmbuf_pool;
70*2bfe3f2eSlogwang extern uint8_t num_nodes;
71*2bfe3f2eSlogwang extern unsigned int num_sockets;
72*2bfe3f2eSlogwang extern uint32_t num_flows;
73*2bfe3f2eSlogwang 
74*2bfe3f2eSlogwang int init(int argc, char *argv[]);
75*2bfe3f2eSlogwang 
76*2bfe3f2eSlogwang #endif /* ifndef _INIT_H_ */
77