xref: /dpdk/examples/ip_pipeline/link.h (revision ecfc2b1c074a937a67fc8bb094e6f2ee6ca86f82)
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 *
34 link_next(struct link *link);
35 
36 struct link_params_rss {
37 	uint32_t queue_id[LINK_RXQ_RSS_MAX];
38 	uint32_t n_queues;
39 };
40 
41 struct link_params {
42 	const char *dev_name;
43 	uint16_t port_id; /**< Valid only when *dev_name* is NULL. */
44 
45 	struct {
46 		uint32_t n_queues;
47 		uint32_t queue_size;
48 		const char *mempool_name;
49 		struct link_params_rss *rss;
50 	} rx;
51 
52 	struct {
53 		uint32_t n_queues;
54 		uint32_t queue_size;
55 	} tx;
56 
57 	int promiscuous;
58 };
59 
60 struct link *
61 link_create(const char *name, struct link_params *params);
62 
63 int
64 link_is_up(const char *name);
65 
66 #endif /* _INCLUDE_LINK_H_ */
67