1d30ea906Sjfb8856606 /* SPDX-License-Identifier: BSD-3-Clause
2d30ea906Sjfb8856606  * Copyright(c) 2010-2015 Intel Corporation
3a9643ea8Slogwang  */
4a9643ea8Slogwang 
5a9643ea8Slogwang #ifndef _RTE_ETHTOOL_H_
6a9643ea8Slogwang #define _RTE_ETHTOOL_H_
7a9643ea8Slogwang 
8a9643ea8Slogwang /*
9a9643ea8Slogwang  * This new interface is designed to provide a user-space shim layer for
10a9643ea8Slogwang  * Ethtool and Netdevice op API.
11a9643ea8Slogwang  *
121646932aSjfb8856606  * rte_ethtool_get_driver:          ethtool_ops::get_drvinfo
13a9643ea8Slogwang  * rte_ethtool_get_link:            ethtool_ops::get_link
14a9643ea8Slogwang  * rte_ethtool_get_regs_len:        ethtool_ops::get_regs_len
15a9643ea8Slogwang  * rte_ethtool_get_regs:            ethtool_ops::get_regs
16a9643ea8Slogwang  * rte_ethtool_get_eeprom_len:      ethtool_ops::get_eeprom_len
17a9643ea8Slogwang  * rte_ethtool_get_eeprom:          ethtool_ops::get_eeprom
18a9643ea8Slogwang  * rte_ethtool_set_eeprom:          ethtool_ops::set_eeprom
19a9643ea8Slogwang  * rte_ethtool_get_pauseparam:      ethtool_ops::get_pauseparam
20a9643ea8Slogwang  * rte_ethtool_set_pauseparam:      ethtool_ops::set_pauseparam
21a9643ea8Slogwang  *
22a9643ea8Slogwang  * rte_ethtool_net_open:            net_device_ops::ndo_open
23a9643ea8Slogwang  * rte_ethtool_net_stop:            net_device_ops::ndo_stop
24a9643ea8Slogwang  * rte_ethtool_net_set_mac_addr:    net_device_ops::ndo_set_mac_address
25a9643ea8Slogwang  * rte_ethtool_net_validate_addr:   net_device_ops::ndo_validate_addr
261646932aSjfb8856606  * rte_ethtool_net_change_mtu:      net_device_ops::ndo_change_mtu
27a9643ea8Slogwang  * rte_ethtool_net_get_stats64:     net_device_ops::ndo_get_stats64
28a9643ea8Slogwang  * rte_ethtool_net_vlan_rx_add_vid  net_device_ops::ndo_vlan_rx_add_vid
29a9643ea8Slogwang  * rte_ethtool_net_vlan_rx_kill_vid net_device_ops::ndo_vlan_rx_kill_vid
30a9643ea8Slogwang  * rte_ethtool_net_set_rx_mode      net_device_ops::ndo_set_rx_mode
31a9643ea8Slogwang  *
32a9643ea8Slogwang  */
33a9643ea8Slogwang #ifdef __cplusplus
34a9643ea8Slogwang extern "C" {
35a9643ea8Slogwang #endif
36a9643ea8Slogwang 
37a9643ea8Slogwang #include <stdint.h>
38a9643ea8Slogwang #include <rte_ethdev.h>
39a9643ea8Slogwang #include <linux/ethtool.h>
40a9643ea8Slogwang 
41a9643ea8Slogwang /**
42a9643ea8Slogwang  * Retrieve the Ethernet device driver information according to
43a9643ea8Slogwang  * attributes described by ethtool data structure, ethtool_drvinfo.
44a9643ea8Slogwang  *
45a9643ea8Slogwang  * @param port_id
46a9643ea8Slogwang  *   The port identifier of the Ethernet device.
47a9643ea8Slogwang  * @param drvinfo
48a9643ea8Slogwang  *   A pointer to get driver information
49a9643ea8Slogwang  * @return
50a9643ea8Slogwang  *   - (0) if successful.
51a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
52a9643ea8Slogwang  */
532bfe3f2eSlogwang int rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo);
54a9643ea8Slogwang 
55a9643ea8Slogwang /**
56a9643ea8Slogwang  * Retrieve the Ethernet device register length in bytes.
57a9643ea8Slogwang  *
58a9643ea8Slogwang  * @param port_id
59a9643ea8Slogwang  *   The port identifier of the Ethernet device.
60a9643ea8Slogwang  * @return
61a9643ea8Slogwang  *   - (> 0) # of device registers (in bytes) available for dump
62a9643ea8Slogwang  *   - (0) no registers available for dump.
63a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
64a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
65a9643ea8Slogwang  *   - others depends on the specific operations implementation.
66a9643ea8Slogwang  */
672bfe3f2eSlogwang int rte_ethtool_get_regs_len(uint16_t port_id);
68a9643ea8Slogwang 
69a9643ea8Slogwang /**
70a9643ea8Slogwang  * Retrieve the Ethernet device register information according to
71a9643ea8Slogwang  * attributes described by ethtool data structure, ethtool_regs
72a9643ea8Slogwang  *
73a9643ea8Slogwang  * @param port_id
74a9643ea8Slogwang  *   The port identifier of the Ethernet device.
75a9643ea8Slogwang  * @param reg
76a9643ea8Slogwang  *   A pointer to ethtool_regs that has register information
77a9643ea8Slogwang  * @param data
78a9643ea8Slogwang  *   A pointer to a buffer that is used to retrieve device register content
79a9643ea8Slogwang  * @return
80a9643ea8Slogwang  *   - (0) if successful.
81a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
82a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
83a9643ea8Slogwang  *   - others depends on the specific operations implementation.
84a9643ea8Slogwang  */
852bfe3f2eSlogwang int rte_ethtool_get_regs(uint16_t port_id, struct ethtool_regs *regs,
86a9643ea8Slogwang 			    void *data);
87a9643ea8Slogwang 
88a9643ea8Slogwang /**
89a9643ea8Slogwang  * Retrieve the Ethernet device link status
90a9643ea8Slogwang  *
91a9643ea8Slogwang  * @param port_id
92a9643ea8Slogwang  *   The port identifier of the Ethernet device.
93a9643ea8Slogwang  * @return
94a9643ea8Slogwang  *   - (1) if link up.
95a9643ea8Slogwang  *   - (0) if link down.
96a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
97a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
98a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
99a9643ea8Slogwang  *   - others depends on the specific operations implementation.
100a9643ea8Slogwang  */
1012bfe3f2eSlogwang int rte_ethtool_get_link(uint16_t port_id);
102a9643ea8Slogwang 
103a9643ea8Slogwang /**
104a9643ea8Slogwang  * Retrieve the Ethernet device EEPROM size
105a9643ea8Slogwang  *
106a9643ea8Slogwang  * @param port_id
107a9643ea8Slogwang  *   The port identifier of the Ethernet device.
108a9643ea8Slogwang  * @return
109a9643ea8Slogwang  *	 - (> 0) device EEPROM size in bytes
110a9643ea8Slogwang  *   - (0) device has NO EEPROM
111a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
112a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
113a9643ea8Slogwang  *   - others depends on the specific operations implementation.
114a9643ea8Slogwang  */
1152bfe3f2eSlogwang int rte_ethtool_get_eeprom_len(uint16_t port_id);
116a9643ea8Slogwang 
117a9643ea8Slogwang /**
118a9643ea8Slogwang  * Retrieve EEPROM content based upon eeprom range described in ethtool
119a9643ea8Slogwang  * data structure, ethtool_eeprom
120a9643ea8Slogwang  *
121a9643ea8Slogwang  * @param port_id
122a9643ea8Slogwang  *   The port identifier of the Ethernet device.
123a9643ea8Slogwang  * @param eeprom
124a9643ea8Slogwang  *	 The pointer of ethtool_eeprom that provides eeprom range
125a9643ea8Slogwang  * @param words
126a9643ea8Slogwang  *	 A buffer that holds data read from eeprom
127a9643ea8Slogwang  * @return
128a9643ea8Slogwang  *   - (0) if successful.
129a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
130a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
131a9643ea8Slogwang  *   - others depends on the specific operations implementation.
132a9643ea8Slogwang  */
1332bfe3f2eSlogwang int rte_ethtool_get_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
134a9643ea8Slogwang 			      void *words);
135a9643ea8Slogwang 
136a9643ea8Slogwang /**
137a9643ea8Slogwang  * Setting EEPROM content based upon eeprom range described in ethtool
138a9643ea8Slogwang  * data structure, ethtool_eeprom
139a9643ea8Slogwang  *
140a9643ea8Slogwang  * @param port_id
141a9643ea8Slogwang  *   The port identifier of the Ethernet device.
142a9643ea8Slogwang  * @param eeprom
143a9643ea8Slogwang  *	 The pointer of ethtool_eeprom that provides eeprom range
144a9643ea8Slogwang  * @param words
145a9643ea8Slogwang  *	 A buffer that holds data to be written into eeprom
146a9643ea8Slogwang  * @return
147a9643ea8Slogwang  *   - (0) if successful.
148a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
149a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
150a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
151a9643ea8Slogwang  *   - others depends on the specific operations implementation.
152a9643ea8Slogwang  */
1532bfe3f2eSlogwang int rte_ethtool_set_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
154a9643ea8Slogwang 			      void *words);
155a9643ea8Slogwang 
156a9643ea8Slogwang /**
157d30ea906Sjfb8856606  * Retrieve the type and size of plugin module EEPROM
158d30ea906Sjfb8856606  *
159d30ea906Sjfb8856606  * @param port_id
160d30ea906Sjfb8856606  *   The port identifier of the Ethernet device.
161d30ea906Sjfb8856606  * @param modinfo
162d30ea906Sjfb8856606  *	 The pointer that provides the type and size of plugin module EEPROM.
163d30ea906Sjfb8856606  * @return
164d30ea906Sjfb8856606  *   - (0) if successful.
165d30ea906Sjfb8856606  *   - (-ENOTSUP) if hardware doesn't support.
166d30ea906Sjfb8856606  *   - (-ENODEV) if *port_id* invalid.
167d30ea906Sjfb8856606  *   - others depends on the specific operations implementation.
168d30ea906Sjfb8856606  */
169d30ea906Sjfb8856606 int rte_ethtool_get_module_info(uint16_t port_id, uint32_t *modinfo);
170d30ea906Sjfb8856606 
171d30ea906Sjfb8856606 /**
172d30ea906Sjfb8856606  * Retrieve the data of plugin module EEPROM
173d30ea906Sjfb8856606  *
174d30ea906Sjfb8856606  * @param port_id
175d30ea906Sjfb8856606  *   The port identifier of the Ethernet device.
176d30ea906Sjfb8856606  * @param eeprom
177d30ea906Sjfb8856606  *	 The pointer of ethtool_eeprom that provides plugin module eeprom
178d30ea906Sjfb8856606  *   offset and length
179d30ea906Sjfb8856606  * @param words
180d30ea906Sjfb8856606  *	 A buffer that holds data read from plugin module eeprom
181d30ea906Sjfb8856606  * @return
182d30ea906Sjfb8856606  *   - (0) if successful.
183d30ea906Sjfb8856606  *   - (-ENOTSUP) if hardware doesn't support.
184d30ea906Sjfb8856606  *   - (-ENODEV) if *port_id* invalid.
185d30ea906Sjfb8856606  *   - others depends on the specific operations implementation.
186d30ea906Sjfb8856606  */
187d30ea906Sjfb8856606 int rte_ethtool_get_module_eeprom(uint16_t port_id,
188d30ea906Sjfb8856606 				  struct ethtool_eeprom *eeprom, void *words);
189d30ea906Sjfb8856606 
190d30ea906Sjfb8856606 /**
191a9643ea8Slogwang  * Retrieve the Ethernet device pause frame configuration according to
192a9643ea8Slogwang  * parameter attributes desribed by ethtool data structure,
193a9643ea8Slogwang  * ethtool_pauseparam.
194a9643ea8Slogwang  *
195a9643ea8Slogwang  * @param port_id
196a9643ea8Slogwang  *   The port identifier of the Ethernet device.
197a9643ea8Slogwang  * @param pause_param
198a9643ea8Slogwang  *	 The pointer of ethtool_coalesce that gets pause frame
199a9643ea8Slogwang  *	 configuration parameters
200a9643ea8Slogwang  * @return
201a9643ea8Slogwang  *   - (0) if successful.
202a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
203a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
204a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
205a9643ea8Slogwang  *   - others depends on the specific operations implementation.
206a9643ea8Slogwang  */
2072bfe3f2eSlogwang int rte_ethtool_get_pauseparam(uint16_t port_id,
208a9643ea8Slogwang 				   struct ethtool_pauseparam *pause_param);
209a9643ea8Slogwang 
210a9643ea8Slogwang /**
211a9643ea8Slogwang  * Setting the Ethernet device pause frame configuration according to
212a9643ea8Slogwang  * parameter attributes desribed by ethtool data structure, ethtool_pauseparam.
213a9643ea8Slogwang  *
214a9643ea8Slogwang  * @param port_id
215a9643ea8Slogwang  *   The port identifier of the Ethernet device.
216a9643ea8Slogwang  * @param pause_param
217a9643ea8Slogwang  *	 The pointer of ethtool_coalesce that gets ring configuration parameters
218a9643ea8Slogwang  * @return
219a9643ea8Slogwang  *   - (0) if successful.
220a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
221a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
222a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
223a9643ea8Slogwang  *   - others depends on the specific operations implementation.
224a9643ea8Slogwang  */
2252bfe3f2eSlogwang int rte_ethtool_set_pauseparam(uint16_t port_id,
226a9643ea8Slogwang 				   struct ethtool_pauseparam *param);
227a9643ea8Slogwang 
228a9643ea8Slogwang /**
229a9643ea8Slogwang  * Start the Ethernet device.
230a9643ea8Slogwang  *
231a9643ea8Slogwang  * @param port_id
232a9643ea8Slogwang  *   The port identifier of the Ethernet device.
233a9643ea8Slogwang  * @return
234a9643ea8Slogwang  *   - (0) if successful.
235a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
236a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
237a9643ea8Slogwang  *   - others depends on the specific operations implementation.
238a9643ea8Slogwang  */
2392bfe3f2eSlogwang int rte_ethtool_net_open(uint16_t port_id);
240a9643ea8Slogwang 
241a9643ea8Slogwang /**
242a9643ea8Slogwang  * Stop the Ethernet device.
243a9643ea8Slogwang  *
244a9643ea8Slogwang  * @param port_id
245a9643ea8Slogwang  *   The port identifier of the Ethernet device.
246a9643ea8Slogwang  * @return
247a9643ea8Slogwang  *   - (0) if successful.
248a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
249a9643ea8Slogwang  */
2502bfe3f2eSlogwang int rte_ethtool_net_stop(uint16_t port_id);
251a9643ea8Slogwang 
252a9643ea8Slogwang /**
253a9643ea8Slogwang  * Get the Ethernet device MAC address.
254a9643ea8Slogwang  *
255a9643ea8Slogwang  * @param port_id
256a9643ea8Slogwang  *   The port identifier of the Ethernet device.
257a9643ea8Slogwang  * @param addr
258a9643ea8Slogwang  *	 MAC address of the Ethernet device.
259a9643ea8Slogwang  * @return
260a9643ea8Slogwang  *   - (0) if successful.
261a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
262a9643ea8Slogwang  */
263*4418919fSjohnjiang int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr);
264a9643ea8Slogwang 
265a9643ea8Slogwang /**
266a9643ea8Slogwang  * Setting the Ethernet device MAC address.
267a9643ea8Slogwang  *
268a9643ea8Slogwang  * @param port_id
269a9643ea8Slogwang  *   The port identifier of the Ethernet device.
270a9643ea8Slogwang  * @param addr
271a9643ea8Slogwang  *	 The new MAC addr.
272a9643ea8Slogwang  * @return
273a9643ea8Slogwang  *   - (0) if successful.
274a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
275a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
276a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
277a9643ea8Slogwang  *   - others depends on the specific operations implementation.
278a9643ea8Slogwang  */
279*4418919fSjohnjiang int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr);
280a9643ea8Slogwang 
281a9643ea8Slogwang /**
282a9643ea8Slogwang  * Validate if the provided MAC address is valid unicast address
283a9643ea8Slogwang  *
284a9643ea8Slogwang  * @param port_id
285a9643ea8Slogwang  *   The port identifier of the Ethernet device.
286a9643ea8Slogwang  * @param addr
287a9643ea8Slogwang  *	 A pointer to a buffer (6-byte, 48bit) for the target MAC address
288a9643ea8Slogwang  * @return
289a9643ea8Slogwang  *   - (0) if successful.
290a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
291a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
292a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
293a9643ea8Slogwang  *   - others depends on the specific operations implementation.
294a9643ea8Slogwang  */
295*4418919fSjohnjiang int rte_ethtool_net_validate_addr(uint16_t port_id,
296*4418919fSjohnjiang 				struct rte_ether_addr *addr);
297a9643ea8Slogwang 
298a9643ea8Slogwang /**
299a9643ea8Slogwang  * Setting the Ethernet device maximum Tx unit.
300a9643ea8Slogwang  *
301a9643ea8Slogwang  * @param port_id
302a9643ea8Slogwang  *   The port identifier of the Ethernet device.
303a9643ea8Slogwang  * @param mtu
304a9643ea8Slogwang  *	 New MTU
305a9643ea8Slogwang  * @return
306a9643ea8Slogwang  *   - (0) if successful.
307a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
308a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
309a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
310a9643ea8Slogwang  *   - others depends on the specific operations implementation.
311a9643ea8Slogwang  */
3122bfe3f2eSlogwang int rte_ethtool_net_change_mtu(uint16_t port_id, int mtu);
313a9643ea8Slogwang 
314a9643ea8Slogwang /**
315a9643ea8Slogwang  * Retrieve the Ethernet device traffic statistics
316a9643ea8Slogwang  *
317a9643ea8Slogwang  * @param port_id
318a9643ea8Slogwang  *   The port identifier of the Ethernet device.
319a9643ea8Slogwang  * @param stats
320a9643ea8Slogwang  *	 A pointer to struct rte_eth_stats for statistics parameters
321a9643ea8Slogwang  * @return
322a9643ea8Slogwang  *   - (0) if successful.
323a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
324a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
325a9643ea8Slogwang  *   - (-EINVAL) if parameters invalid.
326a9643ea8Slogwang  *   - others depends on the specific operations implementation.
327a9643ea8Slogwang  */
3282bfe3f2eSlogwang int rte_ethtool_net_get_stats64(uint16_t port_id, struct rte_eth_stats *stats);
329a9643ea8Slogwang 
330a9643ea8Slogwang /**
331a9643ea8Slogwang  * Update the Ethernet device VLAN filter with new vid
332a9643ea8Slogwang  *
333a9643ea8Slogwang  * @param port_id
334a9643ea8Slogwang  *   The port identifier of the Ethernet device.
335a9643ea8Slogwang  * @param vid
336a9643ea8Slogwang  *	 A new VLAN id
337a9643ea8Slogwang  * @return
338a9643ea8Slogwang  *   - (0) if successful.
339a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
340a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
341a9643ea8Slogwang  *   - others depends on the specific operations implementation.
342a9643ea8Slogwang  */
3432bfe3f2eSlogwang int rte_ethtool_net_vlan_rx_add_vid(uint16_t port_id, uint16_t vid);
344a9643ea8Slogwang 
345a9643ea8Slogwang /**
346a9643ea8Slogwang  * Remove VLAN id from Ethernet device.
347a9643ea8Slogwang  *
348a9643ea8Slogwang  * @param port_id
349a9643ea8Slogwang  *   The port identifier of the Ethernet device.
350a9643ea8Slogwang  * @param vid
351a9643ea8Slogwang  *	 A new VLAN id
352a9643ea8Slogwang  * @return
353a9643ea8Slogwang  *   - (0) if successful.
354a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
355a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
356a9643ea8Slogwang  *   - others depends on the specific operations implementation.
357a9643ea8Slogwang  */
3582bfe3f2eSlogwang int rte_ethtool_net_vlan_rx_kill_vid(uint16_t port_id, uint16_t vid);
359a9643ea8Slogwang 
360a9643ea8Slogwang /**
361a9643ea8Slogwang  * Setting the Ethernet device rx mode.
362a9643ea8Slogwang  *
363a9643ea8Slogwang  * @param port_id
364a9643ea8Slogwang  *   The port identifier of the Ethernet device.
365a9643ea8Slogwang  * @return
366a9643ea8Slogwang  *   - (0) if successful.
367a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
368a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
369a9643ea8Slogwang  *   - others depends on the specific operations implementation.
370a9643ea8Slogwang  */
3712bfe3f2eSlogwang int rte_ethtool_net_set_rx_mode(uint16_t port_id);
372a9643ea8Slogwang 
373a9643ea8Slogwang /**
3742bfe3f2eSlogwang  * Getting ring parameters for Ethernet device.
375a9643ea8Slogwang  *
376a9643ea8Slogwang  * @param port_id
377a9643ea8Slogwang  *   The port identifier of the Ethernet device.
378a9643ea8Slogwang  * @param ring_param
379a9643ea8Slogwang  *   Pointer to struct ethrool_ringparam to receive parameters.
380a9643ea8Slogwang  * @return
381a9643ea8Slogwang  *   - (0) if successful.
382a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
383a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
384a9643ea8Slogwang  *   - others depends on the specific operations implementation.
385a9643ea8Slogwang  * @note
386a9643ea8Slogwang  *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam
387a9643ea8Slogwang  *   are used, and the function only gets parameters for queue 0.
388a9643ea8Slogwang  */
3892bfe3f2eSlogwang int rte_ethtool_get_ringparam(uint16_t port_id,
390a9643ea8Slogwang 	struct ethtool_ringparam *ring_param);
391a9643ea8Slogwang 
392a9643ea8Slogwang /**
3932bfe3f2eSlogwang  * Setting ring parameters for Ethernet device.
394a9643ea8Slogwang  *
395a9643ea8Slogwang  * @param port_id
396a9643ea8Slogwang  *   The port identifier of the Ethernet device.
397a9643ea8Slogwang  * @param ring_param
398a9643ea8Slogwang  *   Pointer to struct ethrool_ringparam with parameters to set.
399a9643ea8Slogwang  * @return
400a9643ea8Slogwang  *   - (0) if successful.
401a9643ea8Slogwang  *   - (-ENOTSUP) if hardware doesn't support.
402a9643ea8Slogwang  *   - (-ENODEV) if *port_id* invalid.
403a9643ea8Slogwang  *   - others depends on the specific operations implementation.
404a9643ea8Slogwang  * @note
405a9643ea8Slogwang  *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam
406a9643ea8Slogwang  *   are used, and the function only sets parameters for queue 0.
407a9643ea8Slogwang  */
4082bfe3f2eSlogwang int rte_ethtool_set_ringparam(uint16_t port_id,
409a9643ea8Slogwang 	struct ethtool_ringparam *ring_param);
410a9643ea8Slogwang 
411a9643ea8Slogwang 
412a9643ea8Slogwang #ifdef __cplusplus
413a9643ea8Slogwang }
414a9643ea8Slogwang #endif
415a9643ea8Slogwang 
416a9643ea8Slogwang #endif /* _RTE_ETHTOOL_H_ */
417