aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ip_pipeline/link.h
blob: 34ff1149e0f7e52e4564f700c56045b11abd0565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2010-2018 Intel Corporation
 */

#ifndef _INCLUDE_LINK_H_
#define _INCLUDE_LINK_H_

#include <stdint.h>
#include <sys/queue.h>

#include "common.h"

#ifndef LINK_RXQ_RSS_MAX
#define LINK_RXQ_RSS_MAX                                   16
#endif

struct link {
	TAILQ_ENTRY(link) node;
	char name[NAME_SIZE];
	uint16_t port_id;
	uint32_t n_rxq;
	uint32_t n_txq;
};

TAILQ_HEAD(link_list, link);

int
link_init(void);

struct link *
link_find(const char *name);

struct link *
link_next(struct link *link);

struct link_params_rss {
	uint32_t queue_id[LINK_RXQ_RSS_MAX];
	uint32_t n_queues;
};

struct link_params {
	const char *dev_name;
	uint16_t port_id; /**< Valid only when *dev_name* is NULL. */

	struct {
		uint32_t n_queues;
		uint32_t queue_size;
		const char *mempool_name;
		struct link_params_rss *rss;
	} rx;

	struct {
		uint32_t n_queues;
		uint32_t queue_size;
	} tx;

	int promiscuous;
};

struct link *
link_create(const char *name, struct link_params *params);

int
link_is_up(const char *name);

#endif /* _INCLUDE_LINK_H_ */