xref: /dpdk/lib/ethdev/ethdev_linux_ethtool.h (revision 6285aa6af4d1e1899527884589cdd0025771edb3)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2024 NVIDIA Corporation & Affiliates
3  */
4 
5 #ifndef ETHDEV_ETHTOOL_H
6 #define ETHDEV_ETHTOOL_H
7 
8 #include <stdint.h>
9 #include <linux/ethtool.h>
10 
11 #include <rte_compat.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /*
18  * Convert bit from ETHTOOL_LINK_MODE_* to RTE_ETH_LINK_SPEED_*
19  */
20 __rte_internal
21 uint32_t rte_eth_link_speed_ethtool(enum ethtool_link_mode_bit_indices bit);
22 
23 /*
24  * Convert bitmap from ETHTOOL_GLINKSETTINGS ethtool_link_settings::link_mode_masks
25  * to bitmap RTE_ETH_LINK_SPEED_*
26  */
27 __rte_internal
28 uint32_t rte_eth_link_speed_glink(const uint32_t *bitmap, int8_t nwords);
29 
30 /*
31  * Convert bitmap from deprecated ETHTOOL_GSET ethtool_cmd::supported
32  * to bitmap RTE_ETH_LINK_SPEED_*
33  */
34 __rte_internal
35 uint32_t rte_eth_link_speed_gset(uint32_t legacy_bitmap);
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif /* ETHDEV_ETHTOOL_H */
42