xref: /linux/drivers/net/ethernet/intel/ice/ice_ethtool.h (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2023 Intel Corporation */
3 
4 #ifndef _ICE_ETHTOOL_H_
5 #define _ICE_ETHTOOL_H_
6 
7 struct ice_phy_type_to_ethtool {
8 	u64 aq_link_speed;
9 	u8 link_mode;
10 };
11 
12 /* Macro to make PHY type to Ethtool link mode table entry.
13  * The index is the PHY type.
14  */
15 #define ICE_PHY_TYPE(LINK_SPEED, ETHTOOL_LINK_MODE) {\
16 	.aq_link_speed = ICE_AQ_LINK_SPEED_##LINK_SPEED, \
17 	.link_mode = ETHTOOL_LINK_MODE_##ETHTOOL_LINK_MODE##_BIT, \
18 }
19 
20 /* Lookup table mapping PHY type low to link speed and Ethtool link modes.
21  * Array index corresponds to HW PHY type bit, see
22  * ice_adminq_cmd.h:ICE_PHY_TYPE_LOW_*.
23  */
24 static const struct ice_phy_type_to_ethtool
25 phy_type_low_lkup[] = {
26 	[0] = ICE_PHY_TYPE(100MB, 100baseT_Full),
27 	[1] = ICE_PHY_TYPE(100MB, 100baseT_Full),
28 	[2] = ICE_PHY_TYPE(1000MB, 1000baseT_Full),
29 	[3] = ICE_PHY_TYPE(1000MB, 1000baseX_Full),
30 	[4] = ICE_PHY_TYPE(1000MB, 1000baseX_Full),
31 	[5] = ICE_PHY_TYPE(1000MB, 1000baseKX_Full),
32 	[6] = ICE_PHY_TYPE(1000MB, 1000baseT_Full),
33 	[7] = ICE_PHY_TYPE(2500MB, 2500baseT_Full),
34 	[8] = ICE_PHY_TYPE(2500MB, 2500baseX_Full),
35 	[9] = ICE_PHY_TYPE(2500MB, 2500baseX_Full),
36 	[10] = ICE_PHY_TYPE(5GB, 5000baseT_Full),
37 	[11] = ICE_PHY_TYPE(5GB, 5000baseT_Full),
38 	[12] = ICE_PHY_TYPE(10GB, 10000baseT_Full),
39 	[13] = ICE_PHY_TYPE(10GB, 10000baseCR_Full),
40 	[14] = ICE_PHY_TYPE(10GB, 10000baseSR_Full),
41 	[15] = ICE_PHY_TYPE(10GB, 10000baseLR_Full),
42 	[16] = ICE_PHY_TYPE(10GB, 10000baseKR_Full),
43 	[17] = ICE_PHY_TYPE(10GB, 10000baseCR_Full),
44 	[18] = ICE_PHY_TYPE(10GB, 10000baseKR_Full),
45 	[19] = ICE_PHY_TYPE(25GB, 25000baseCR_Full),
46 	[20] = ICE_PHY_TYPE(25GB, 25000baseCR_Full),
47 	[21] = ICE_PHY_TYPE(25GB, 25000baseCR_Full),
48 	[22] = ICE_PHY_TYPE(25GB, 25000baseCR_Full),
49 	[23] = ICE_PHY_TYPE(25GB, 25000baseSR_Full),
50 	[24] = ICE_PHY_TYPE(25GB, 25000baseSR_Full),
51 	[25] = ICE_PHY_TYPE(25GB, 25000baseKR_Full),
52 	[26] = ICE_PHY_TYPE(25GB, 25000baseKR_Full),
53 	[27] = ICE_PHY_TYPE(25GB, 25000baseKR_Full),
54 	[28] = ICE_PHY_TYPE(25GB, 25000baseSR_Full),
55 	[29] = ICE_PHY_TYPE(25GB, 25000baseCR_Full),
56 	[30] = ICE_PHY_TYPE(40GB, 40000baseCR4_Full),
57 	[31] = ICE_PHY_TYPE(40GB, 40000baseSR4_Full),
58 	[32] = ICE_PHY_TYPE(40GB, 40000baseLR4_Full),
59 	[33] = ICE_PHY_TYPE(40GB, 40000baseKR4_Full),
60 	[34] = ICE_PHY_TYPE(40GB, 40000baseSR4_Full),
61 	[35] = ICE_PHY_TYPE(40GB, 40000baseCR4_Full),
62 	[36] = ICE_PHY_TYPE(50GB, 50000baseCR2_Full),
63 	[37] = ICE_PHY_TYPE(50GB, 50000baseSR2_Full),
64 	[38] = ICE_PHY_TYPE(50GB, 50000baseSR2_Full),
65 	[39] = ICE_PHY_TYPE(50GB, 50000baseKR2_Full),
66 	[40] = ICE_PHY_TYPE(50GB, 50000baseSR2_Full),
67 	[41] = ICE_PHY_TYPE(50GB, 50000baseCR2_Full),
68 	[42] = ICE_PHY_TYPE(50GB, 50000baseSR2_Full),
69 	[43] = ICE_PHY_TYPE(50GB, 50000baseCR2_Full),
70 	[44] = ICE_PHY_TYPE(50GB, 50000baseCR_Full),
71 	[45] = ICE_PHY_TYPE(50GB, 50000baseSR_Full),
72 	[46] = ICE_PHY_TYPE(50GB, 50000baseLR_ER_FR_Full),
73 	[47] = ICE_PHY_TYPE(50GB, 50000baseLR_ER_FR_Full),
74 	[48] = ICE_PHY_TYPE(50GB, 50000baseKR_Full),
75 	[49] = ICE_PHY_TYPE(50GB, 50000baseSR_Full),
76 	[50] = ICE_PHY_TYPE(50GB, 50000baseCR_Full),
77 	[51] = ICE_PHY_TYPE(100GB, 100000baseCR4_Full),
78 	[52] = ICE_PHY_TYPE(100GB, 100000baseSR4_Full),
79 	[53] = ICE_PHY_TYPE(100GB, 100000baseLR4_ER4_Full),
80 	[54] = ICE_PHY_TYPE(100GB, 100000baseKR4_Full),
81 	[55] = ICE_PHY_TYPE(100GB, 100000baseCR4_Full),
82 	[56] = ICE_PHY_TYPE(100GB, 100000baseCR4_Full),
83 	[57] = ICE_PHY_TYPE(100GB, 100000baseSR4_Full),
84 	[58] = ICE_PHY_TYPE(100GB, 100000baseCR4_Full),
85 	[59] = ICE_PHY_TYPE(100GB, 100000baseCR4_Full),
86 	[60] = ICE_PHY_TYPE(100GB, 100000baseKR4_Full),
87 	[61] = ICE_PHY_TYPE(100GB, 100000baseCR2_Full),
88 	[62] = ICE_PHY_TYPE(100GB, 100000baseSR2_Full),
89 	[63] = ICE_PHY_TYPE(100GB, 100000baseLR4_ER4_Full),
90 };
91 
92 /* Lookup table mapping PHY type high to link speed and Ethtool link modes.
93  * Array index corresponds to HW PHY type bit, see
94  * ice_adminq_cmd.h:ICE_PHY_TYPE_HIGH_*
95  */
96 static const struct ice_phy_type_to_ethtool
97 phy_type_high_lkup[] = {
98 	[0] = ICE_PHY_TYPE(100GB, 100000baseKR2_Full),
99 	[1] = ICE_PHY_TYPE(100GB, 100000baseSR2_Full),
100 	[2] = ICE_PHY_TYPE(100GB, 100000baseCR2_Full),
101 	[3] = ICE_PHY_TYPE(100GB, 100000baseSR2_Full),
102 	[4] = ICE_PHY_TYPE(100GB, 100000baseCR2_Full),
103 	[5] = ICE_PHY_TYPE(200GB, 200000baseCR4_Full),
104 	[6] = ICE_PHY_TYPE(200GB, 200000baseSR4_Full),
105 	[7] = ICE_PHY_TYPE(200GB, 200000baseLR4_ER4_FR4_Full),
106 	[8] = ICE_PHY_TYPE(200GB, 200000baseLR4_ER4_FR4_Full),
107 	[9] = ICE_PHY_TYPE(200GB, 200000baseDR4_Full),
108 	[10] = ICE_PHY_TYPE(200GB, 200000baseKR4_Full),
109 	[11] = ICE_PHY_TYPE(200GB, 200000baseSR4_Full),
110 	[12] = ICE_PHY_TYPE(200GB, 200000baseCR4_Full),
111 };
112 
113 #endif /* !_ICE_ETHTOOL_H_ */
114