xref: /dpdk/examples/ip_pipeline/link.h (revision fd5baf09cdf9170e0f92a112fd0ef19c29649330)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2018 Intel Corporation
3  */
4 
5 #ifndef _INCLUDE_LINK_H_
6 #define _INCLUDE_LINK_H_
7 
8 #include <stdint.h>
9 #include <sys/queue.h>
10 
11 #include "common.h"
12 
13 #ifndef LINK_RXQ_RSS_MAX
14 #define LINK_RXQ_RSS_MAX                                   16
15 #endif
16 
17 struct link {
18 	TAILQ_ENTRY(link) node;
19 	char name[NAME_SIZE];
20 	uint16_t port_id;
21 	uint32_t n_rxq;
22 	uint32_t n_txq;
23 };
24 
25 TAILQ_HEAD(link_list, link);
26 
27 int
28 link_init(void);
29 
30 struct link *
31 link_find(const char *name);
32 
33 struct link_params_rss {
34 	uint32_t queue_id[LINK_RXQ_RSS_MAX];
35 	uint32_t n_queues;
36 };
37 
38 struct link_params {
39 	const char *dev_name;
40 	uint16_t port_id; /**< Valid only when *dev_name* is NULL. */
41 
42 	struct {
43 		uint32_t n_queues;
44 		uint32_t queue_size;
45 		const char *mempool_name;
46 		struct link_params_rss *rss;
47 	} rx;
48 
49 	struct {
50 		uint32_t n_queues;
51 		uint32_t queue_size;
52 	} tx;
53 
54 	int promiscuous;
55 };
56 
57 struct link *
58 link_create(const char *name, struct link_params *params);
59 
60 int
61 link_is_up(const char *name);
62 
63 #endif /* _INCLUDE_LINK_H_ */
64