xref: /dpdk/app/graph/ethdev_priv.h (revision e9fd1ebf981f361844aea9ec94e17f4bda5e1479)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2023 Marvell.
3  */
4 
5 #ifndef APP_GRAPH_ETHDEV_PRIV_H
6 #define APP_GRAPH_ETHDEV_PRIV_H
7 
8 #include "ethdev.h"
9 
10 #define NS_PER_SEC 1E9
11 
12 #define ETHDEV_RXQ_RSS_MAX	16
13 #define ETHDEV_RX_DESC_DEFAULT 1024
14 #define ETHDEV_TX_DESC_DEFAULT 1024
15 
16 struct ethdev_show_cmd_tokens {
17 	cmdline_fixed_string_t cmd;
18 	cmdline_fixed_string_t dev;
19 	cmdline_fixed_string_t show;
20 };
21 
22 struct ethdev_stats_cmd_tokens {
23 	cmdline_fixed_string_t cmd;
24 	cmdline_fixed_string_t dev;
25 	cmdline_fixed_string_t stats;
26 };
27 
28 struct ethdev_mtu_cmd_tokens {
29 	cmdline_fixed_string_t cmd;
30 	cmdline_fixed_string_t dev;
31 	cmdline_fixed_string_t mtu;
32 	uint16_t size;
33 };
34 
35 struct ethdev_prom_mode_cmd_tokens {
36 	cmdline_fixed_string_t cmd;
37 	cmdline_fixed_string_t dev;
38 	cmdline_fixed_string_t prom;
39 	cmdline_fixed_string_t enable;
40 };
41 
42 struct ethdev_ip4_cmd_tokens {
43 	cmdline_fixed_string_t cmd;
44 	cmdline_fixed_string_t dev;
45 	cmdline_fixed_string_t ip4;
46 	cmdline_fixed_string_t addr;
47 	cmdline_fixed_string_t add;
48 	cmdline_fixed_string_t ip;
49 	cmdline_fixed_string_t netmask;
50 	cmdline_fixed_string_t mask;
51 };
52 
53 struct ethdev_ip6_cmd_tokens {
54 	cmdline_fixed_string_t cmd;
55 	cmdline_fixed_string_t dev;
56 	cmdline_fixed_string_t ip6;
57 	cmdline_fixed_string_t addr;
58 	cmdline_fixed_string_t add;
59 	cmdline_fixed_string_t ip;
60 	cmdline_fixed_string_t netmask;
61 	cmdline_fixed_string_t mask;
62 };
63 
64 struct ethdev_fwd_cmd_tokens {
65 	cmdline_fixed_string_t cmd;
66 	cmdline_fixed_string_t fwd;
67 	cmdline_fixed_string_t tx_dev;
68 	cmdline_fixed_string_t rx_dev;
69 };
70 
71 struct ethdev_cmd_tokens {
72 	cmdline_fixed_string_t cmd;
73 	cmdline_fixed_string_t dev;
74 	cmdline_fixed_string_t rxq;
75 	cmdline_fixed_string_t txq;
76 	cmdline_fixed_string_t mempool;
77 	uint16_t nb_rxq;
78 	uint16_t nb_txq;
79 };
80 
81 struct ethdev_help_cmd_tokens {
82 	cmdline_fixed_string_t help;
83 	cmdline_fixed_string_t ethdev;
84 };
85 
86 struct ethdev_rss_config {
87 	uint32_t queue_id[ETHDEV_RXQ_RSS_MAX];
88 	uint32_t n_queues;
89 };
90 
91 struct ethdev_config {
92 	char dev_name[RTE_ETH_NAME_MAX_LEN];
93 	uint16_t port_id;
94 
95 	struct {
96 		uint32_t n_queues;
97 		uint32_t queue_size;
98 		char mempool_name[RTE_MEMPOOL_NAMESIZE];
99 		struct rte_mempool *mp;
100 		struct ethdev_rss_config *rss;
101 	} rx;
102 
103 	struct {
104 		uint32_t n_queues;
105 		uint32_t queue_size;
106 	} tx;
107 
108 	int promiscuous;
109 	uint32_t mtu;
110 };
111 
112 struct ethdev {
113 	TAILQ_ENTRY(ethdev) next;
114 	uint16_t tx_port_id;
115 	struct ethdev_config config;
116 	struct ipv4_addr_config ip4_addr;
117 	struct ipv6_addr_config ip6_addr;
118 };
119 TAILQ_HEAD(ethdev_head, ethdev);
120 #endif
121