Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

r8169: refactor chip version detection

Refactor chip version detection and merge both configuration tables.
Apart from reducing the code by a third, this paves the way for
merging chip version handling if only difference is the firmware.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/1fea533a-dd5a-4198-a9e2-895e11083947@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
2b065c09 cd384b85

+128 -197
+128 -197
drivers/net/ethernet/realtek/r8169_main.c
··· 91 91 #define JUMBO_9K (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) 92 92 #define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN) 93 93 94 - static const struct { 94 + static const struct rtl_chip_info { 95 + u16 mask; 96 + u16 val; 97 + enum mac_version mac_version; 95 98 const char *name; 96 99 const char *fw_name; 97 100 } rtl_chip_infos[] = { 98 - /* PCI devices. */ 99 - [RTL_GIGA_MAC_VER_02] = {"RTL8169s" }, 100 - [RTL_GIGA_MAC_VER_03] = {"RTL8110s" }, 101 - [RTL_GIGA_MAC_VER_04] = {"RTL8169sb/8110sb" }, 102 - [RTL_GIGA_MAC_VER_05] = {"RTL8169sc/8110sc" }, 103 - [RTL_GIGA_MAC_VER_06] = {"RTL8169sc/8110sc" }, 104 - /* PCI-E devices. */ 105 - [RTL_GIGA_MAC_VER_07] = {"RTL8102e" }, 106 - [RTL_GIGA_MAC_VER_08] = {"RTL8102e" }, 107 - [RTL_GIGA_MAC_VER_09] = {"RTL8102e/RTL8103e" }, 108 - [RTL_GIGA_MAC_VER_10] = {"RTL8101e/RTL8100e" }, 109 - [RTL_GIGA_MAC_VER_14] = {"RTL8401" }, 110 - [RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b" }, 111 - [RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp" }, 112 - [RTL_GIGA_MAC_VER_19] = {"RTL8168c/8111c" }, 113 - [RTL_GIGA_MAC_VER_20] = {"RTL8168c/8111c" }, 114 - [RTL_GIGA_MAC_VER_21] = {"RTL8168c/8111c" }, 115 - [RTL_GIGA_MAC_VER_22] = {"RTL8168c/8111c" }, 116 - [RTL_GIGA_MAC_VER_23] = {"RTL8168cp/8111cp" }, 117 - [RTL_GIGA_MAC_VER_24] = {"RTL8168cp/8111cp" }, 118 - [RTL_GIGA_MAC_VER_25] = {"RTL8168d/8111d", FIRMWARE_8168D_1}, 119 - [RTL_GIGA_MAC_VER_26] = {"RTL8168d/8111d", FIRMWARE_8168D_2}, 120 - [RTL_GIGA_MAC_VER_28] = {"RTL8168dp/8111dp" }, 121 - [RTL_GIGA_MAC_VER_29] = {"RTL8105e", FIRMWARE_8105E_1}, 122 - [RTL_GIGA_MAC_VER_30] = {"RTL8105e", FIRMWARE_8105E_1}, 123 - [RTL_GIGA_MAC_VER_31] = {"RTL8168dp/8111dp" }, 124 - [RTL_GIGA_MAC_VER_32] = {"RTL8168e/8111e", FIRMWARE_8168E_1}, 125 - [RTL_GIGA_MAC_VER_33] = {"RTL8168e/8111e", FIRMWARE_8168E_2}, 126 - [RTL_GIGA_MAC_VER_34] = {"RTL8168evl/8111evl", FIRMWARE_8168E_3}, 127 - [RTL_GIGA_MAC_VER_35] = {"RTL8168f/8111f", FIRMWARE_8168F_1}, 128 - [RTL_GIGA_MAC_VER_36] = {"RTL8168f/8111f", FIRMWARE_8168F_2}, 129 - [RTL_GIGA_MAC_VER_37] = {"RTL8402", FIRMWARE_8402_1 }, 130 - [RTL_GIGA_MAC_VER_38] = {"RTL8411", FIRMWARE_8411_1 }, 131 - [RTL_GIGA_MAC_VER_39] = {"RTL8106e", FIRMWARE_8106E_1}, 132 - [RTL_GIGA_MAC_VER_40] = {"RTL8168g/8111g", FIRMWARE_8168G_2}, 133 - [RTL_GIGA_MAC_VER_42] = {"RTL8168gu/8111gu", FIRMWARE_8168G_3}, 134 - [RTL_GIGA_MAC_VER_43] = {"RTL8106eus", FIRMWARE_8106E_2}, 135 - [RTL_GIGA_MAC_VER_44] = {"RTL8411b", FIRMWARE_8411_2 }, 136 - [RTL_GIGA_MAC_VER_46] = {"RTL8168h/8111h", FIRMWARE_8168H_2}, 137 - [RTL_GIGA_MAC_VER_48] = {"RTL8107e", FIRMWARE_8107E_2}, 138 - [RTL_GIGA_MAC_VER_51] = {"RTL8168ep/8111ep" }, 139 - [RTL_GIGA_MAC_VER_52] = {"RTL8168fp/RTL8117", FIRMWARE_8168FP_3}, 140 - [RTL_GIGA_MAC_VER_53] = {"RTL8168fp/RTL8117", }, 141 - [RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3}, 142 - /* reserve 62 for CFG_METHOD_4 in the vendor driver */ 143 - [RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2}, 144 - [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1}, 145 - [RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2}, 146 - [RTL_GIGA_MAC_VER_66] = {"RTL8125BP", FIRMWARE_8125BP_2}, 147 - [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2}, 148 - [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3}, 101 + /* 8126A family. */ 102 + { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71, "RTL8126A", FIRMWARE_8126A_3 }, 103 + { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_2 }, 104 + 105 + /* 8125BP family. */ 106 + { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66, "RTL8125BP", FIRMWARE_8125BP_2 }, 107 + 108 + /* 8125D family. */ 109 + { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65, "RTL8125D", FIRMWARE_8125D_2 }, 110 + { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64, "RTL8125D", FIRMWARE_8125D_1 }, 111 + 112 + /* 8125B family. */ 113 + { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63, "RTL8125B", FIRMWARE_8125B_2 }, 114 + 115 + /* 8125A family. */ 116 + { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61, "RTL8125A", FIRMWARE_8125A_3 }, 117 + 118 + /* RTL8117 */ 119 + { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53, "RTL8168fp/RTL8117" }, 120 + { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52, "RTL8168fp/RTL8117", 121 + FIRMWARE_8168FP_3 }, 122 + 123 + /* 8168EP family. */ 124 + { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51, "RTL8168ep/8111ep" }, 125 + 126 + /* 8168H family. */ 127 + { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46, "RTL8168h/8111h", 128 + FIRMWARE_8168H_2 }, 129 + /* Realtek calls it RTL8168M, but it's handled like RTL8168H */ 130 + { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46, "RTL8168M", FIRMWARE_8168H_2 }, 131 + 132 + /* 8168G family. */ 133 + { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44, "RTL8411b", FIRMWARE_8411_2 }, 134 + { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42, "RTL8168gu/8111gu", 135 + FIRMWARE_8168G_3 }, 136 + { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40, "RTL8168g/8111g", 137 + FIRMWARE_8168G_2 }, 138 + 139 + /* 8168F family. */ 140 + { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38, "RTL8411", FIRMWARE_8411_1 }, 141 + { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36, "RTL8168f/8111f", 142 + FIRMWARE_8168F_2 }, 143 + { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35, "RTL8168f/8111f", 144 + FIRMWARE_8168F_1 }, 145 + 146 + /* 8168E family. */ 147 + { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34, "RTL8168evl/8111evl", 148 + FIRMWARE_8168E_3 }, 149 + { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32, "RTL8168e/8111e", 150 + FIRMWARE_8168E_1 }, 151 + { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33, "RTL8168e/8111e", 152 + FIRMWARE_8168E_2 }, 153 + 154 + /* 8168D family. */ 155 + { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25, "RTL8168d/8111d", 156 + FIRMWARE_8168D_1 }, 157 + { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26, "RTL8168d/8111d", 158 + FIRMWARE_8168D_2 }, 159 + 160 + /* 8168DP family. */ 161 + { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28, "RTL8168dp/8111dp" }, 162 + { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31, "RTL8168dp/8111dp" }, 163 + 164 + /* 8168C family. */ 165 + { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23, "RTL8168cp/8111cp" }, 166 + { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18, "RTL8168cp/8111cp" }, 167 + { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24, "RTL8168cp/8111cp" }, 168 + { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19, "RTL8168c/8111c" }, 169 + { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20, "RTL8168c/8111c" }, 170 + { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21, "RTL8168c/8111c" }, 171 + { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22, "RTL8168c/8111c" }, 172 + 173 + /* 8168B family. */ 174 + { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17, "RTL8168b/8111b" }, 175 + /* This one is very old and rare, support has been removed. 176 + * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11, "RTL8168b/8111b" }, 177 + */ 178 + 179 + /* 8101 family. */ 180 + { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39, "RTL8106e", FIRMWARE_8106E_1 }, 181 + { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37, "RTL8402", FIRMWARE_8402_1 }, 182 + { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29, "RTL8105e", FIRMWARE_8105E_1 }, 183 + { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30, "RTL8105e", FIRMWARE_8105E_1 }, 184 + { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08, "RTL8102e" }, 185 + { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08, "RTL8102e" }, 186 + { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07, "RTL8102e" }, 187 + { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07, "RTL8102e" }, 188 + { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14, "RTL8401" }, 189 + { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" }, 190 + { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" }, 191 + { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10, "RTL8101e/RTL8100e" }, 192 + 193 + /* 8110 family. */ 194 + { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06, "RTL8169sc/8110sc" }, 195 + { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05, "RTL8169sc/8110sc" }, 196 + { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04, "RTL8169sb/8110sb" }, 197 + { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03, "RTL8110s" }, 198 + { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02, "RTL8169s" }, 199 + 200 + /* Catch-all */ 201 + { 0x000, 0x000, RTL_GIGA_MAC_NONE } 149 202 }; 150 203 151 204 static const struct pci_device_id rtl8169_pci_tbl[] = { ··· 2318 2265 .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats, 2319 2266 }; 2320 2267 2321 - static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) 2268 + static const struct rtl_chip_info *rtl8169_get_chip_version(u16 xid, bool gmii) 2322 2269 { 2323 - /* 2324 - * The driver currently handles the 8168Bf and the 8168Be identically 2325 - * but they can be identified more specifically through the test below 2326 - * if needed: 2327 - * 2328 - * (RTL_R32(tp, TxConfig) & 0x700000) == 0x500000 ? 8168Bf : 8168Be 2329 - * 2330 - * Same thing for the 8101Eb and the 8101Ec: 2331 - * 2332 - * (RTL_R32(tp, TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec 2333 - */ 2334 - static const struct rtl_mac_info { 2335 - u16 mask; 2336 - u16 val; 2337 - enum mac_version ver; 2338 - } mac_info[] = { 2339 - /* 8126A family. */ 2340 - { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 }, 2341 - { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 }, 2342 - 2343 - /* 8125BP family. */ 2344 - { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66 }, 2345 - 2346 - /* 8125D family. */ 2347 - { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 }, 2348 - { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 }, 2349 - 2350 - /* 8125B family. */ 2351 - { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, 2352 - 2353 - /* 8125A family. */ 2354 - { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61 }, 2355 - /* It seems only XID 609 made it to the mass market. 2356 - * { 0x7cf, 0x608, RTL_GIGA_MAC_VER_60 }, 2357 - * { 0x7c8, 0x608, RTL_GIGA_MAC_VER_61 }, 2358 - */ 2359 - 2360 - /* RTL8117 */ 2361 - { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53 }, 2362 - { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52 }, 2363 - 2364 - /* 8168EP family. */ 2365 - { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51 }, 2366 - /* It seems this chip version never made it to 2367 - * the wild. Let's disable detection. 2368 - * { 0x7cf, 0x501, RTL_GIGA_MAC_VER_50 }, 2369 - * { 0x7cf, 0x500, RTL_GIGA_MAC_VER_49 }, 2370 - */ 2371 - 2372 - /* 8168H family. */ 2373 - { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46 }, 2374 - /* It seems this chip version never made it to 2375 - * the wild. Let's disable detection. 2376 - * { 0x7cf, 0x540, RTL_GIGA_MAC_VER_45 }, 2377 - */ 2378 - /* Realtek calls it RTL8168M, but it's handled like RTL8168H */ 2379 - { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46 }, 2380 - 2381 - /* 8168G family. */ 2382 - { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44 }, 2383 - { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42 }, 2384 - /* It seems this chip version never made it to 2385 - * the wild. Let's disable detection. 2386 - * { 0x7cf, 0x4c1, RTL_GIGA_MAC_VER_41 }, 2387 - */ 2388 - { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40 }, 2389 - 2390 - /* 8168F family. */ 2391 - { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38 }, 2392 - { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36 }, 2393 - { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35 }, 2394 - 2395 - /* 8168E family. */ 2396 - { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34 }, 2397 - { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32 }, 2398 - { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33 }, 2399 - 2400 - /* 8168D family. */ 2401 - { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25 }, 2402 - { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26 }, 2403 - 2404 - /* 8168DP family. */ 2405 - /* It seems this early RTL8168dp version never made it to 2406 - * the wild. Support has been removed. 2407 - * { 0x7cf, 0x288, RTL_GIGA_MAC_VER_27 }, 2408 - */ 2409 - { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28 }, 2410 - { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31 }, 2411 - 2412 - /* 8168C family. */ 2413 - { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23 }, 2414 - { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18 }, 2415 - { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24 }, 2416 - { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19 }, 2417 - { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20 }, 2418 - { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21 }, 2419 - { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22 }, 2420 - 2421 - /* 8168B family. */ 2422 - { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 }, 2423 - /* This one is very old and rare, support has been removed. 2424 - * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11 }, 2425 - */ 2426 - 2427 - /* 8101 family. */ 2428 - { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39 }, 2429 - { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37 }, 2430 - { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29 }, 2431 - { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30 }, 2432 - { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08 }, 2433 - { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08 }, 2434 - { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 }, 2435 - { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 }, 2436 - { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14 }, 2437 - { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 }, 2438 - { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09 }, 2439 - { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10 }, 2440 - 2441 - /* 8110 family. */ 2442 - { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06 }, 2443 - { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05 }, 2444 - { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04 }, 2445 - { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03 }, 2446 - { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02 }, 2447 - 2448 - /* Catch-all */ 2449 - { 0x000, 0x000, RTL_GIGA_MAC_NONE } 2270 + /* Chips combining a 1Gbps MAC with a 100Mbps PHY */ 2271 + static const struct rtl_chip_info rtl8106eus_info = { 2272 + .mac_version = RTL_GIGA_MAC_VER_43, 2273 + .name = "RTL8106eus", 2274 + .fw_name = FIRMWARE_8106E_2, 2450 2275 }; 2451 - const struct rtl_mac_info *p = mac_info; 2452 - enum mac_version ver; 2276 + static const struct rtl_chip_info rtl8107e_info = { 2277 + .mac_version = RTL_GIGA_MAC_VER_48, 2278 + .name = "RTL8107e", 2279 + .fw_name = FIRMWARE_8107E_2, 2280 + }; 2281 + const struct rtl_chip_info *p = rtl_chip_infos; 2453 2282 2454 2283 while ((xid & p->mask) != p->val) 2455 2284 p++; 2456 - ver = p->ver; 2457 2285 2458 - if (ver != RTL_GIGA_MAC_NONE && !gmii) { 2459 - if (ver == RTL_GIGA_MAC_VER_42) 2460 - ver = RTL_GIGA_MAC_VER_43; 2461 - else if (ver == RTL_GIGA_MAC_VER_46) 2462 - ver = RTL_GIGA_MAC_VER_48; 2463 - } 2286 + if (p->mac_version == RTL_GIGA_MAC_VER_42 && !gmii) 2287 + return &rtl8106eus_info; 2288 + if (p->mac_version == RTL_GIGA_MAC_VER_46 && !gmii) 2289 + return &rtl8107e_info; 2464 2290 2465 - return ver; 2291 + return p; 2466 2292 } 2467 2293 2468 2294 static void rtl_release_firmware(struct rtl8169_private *tp) ··· 5372 5440 5373 5441 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 5374 5442 { 5443 + const struct rtl_chip_info *chip; 5375 5444 struct rtl8169_private *tp; 5376 5445 int jumbo_max, region, rc; 5377 - enum mac_version chipset; 5378 5446 struct net_device *dev; 5379 5447 u32 txconfig; 5380 5448 u16 xid; ··· 5424 5492 xid = (txconfig >> 20) & 0xfcf; 5425 5493 5426 5494 /* Identify chip attached to board */ 5427 - chipset = rtl8169_get_mac_version(xid, tp->supports_gmii); 5428 - if (chipset == RTL_GIGA_MAC_NONE) 5495 + chip = rtl8169_get_chip_version(xid, tp->supports_gmii); 5496 + if (chip->mac_version == RTL_GIGA_MAC_NONE) 5429 5497 return dev_err_probe(&pdev->dev, -ENODEV, 5430 5498 "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n", 5431 5499 xid); 5432 - tp->mac_version = chipset; 5500 + tp->mac_version = chip->mac_version; 5501 + tp->fw_name = chip->fw_name; 5433 5502 5434 5503 /* Disable ASPM L1 as that cause random device stop working 5435 5504 * problems as well as full system hangs for some PCIe devices users. ··· 5535 5602 5536 5603 rtl_set_irq_mask(tp); 5537 5604 5538 - tp->fw_name = rtl_chip_infos[chipset].fw_name; 5539 - 5540 5605 tp->counters = dmam_alloc_coherent (&pdev->dev, sizeof(*tp->counters), 5541 5606 &tp->counters_phys_addr, 5542 5607 GFP_KERNEL); ··· 5559 5628 } 5560 5629 5561 5630 netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n", 5562 - rtl_chip_infos[chipset].name, dev->dev_addr, xid, tp->irq); 5631 + chip->name, dev->dev_addr, xid, tp->irq); 5563 5632 5564 5633 if (jumbo_max) 5565 5634 netdev_info(dev, "jumbo features [frames: %d bytes, tx checksumming: %s]\n",