r8169: refactor chip version detection
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 15 Apr 2025 19:29:34 +0000 (21:29 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Apr 2025 01:44:30 +0000 (18:44 -0700)
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>
drivers/net/ethernet/realtek/r8169_main.c

index 8e62b10..b55a691 100644 (file)
 #define JUMBO_9K       (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)
 #define JUMBO_16K      (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN)
 
-static const struct {
+static const struct rtl_chip_info {
+       u16 mask;
+       u16 val;
+       enum mac_version mac_version;
        const char *name;
        const char *fw_name;
 } rtl_chip_infos[] = {
-       /* PCI devices. */
-       [RTL_GIGA_MAC_VER_02] = {"RTL8169s"                             },
-       [RTL_GIGA_MAC_VER_03] = {"RTL8110s"                             },
-       [RTL_GIGA_MAC_VER_04] = {"RTL8169sb/8110sb"                     },
-       [RTL_GIGA_MAC_VER_05] = {"RTL8169sc/8110sc"                     },
-       [RTL_GIGA_MAC_VER_06] = {"RTL8169sc/8110sc"                     },
-       /* PCI-E devices. */
-       [RTL_GIGA_MAC_VER_07] = {"RTL8102e"                             },
-       [RTL_GIGA_MAC_VER_08] = {"RTL8102e"                             },
-       [RTL_GIGA_MAC_VER_09] = {"RTL8102e/RTL8103e"                    },
-       [RTL_GIGA_MAC_VER_10] = {"RTL8101e/RTL8100e"                    },
-       [RTL_GIGA_MAC_VER_14] = {"RTL8401"                              },
-       [RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b"                       },
-       [RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp"                     },
-       [RTL_GIGA_MAC_VER_19] = {"RTL8168c/8111c"                       },
-       [RTL_GIGA_MAC_VER_20] = {"RTL8168c/8111c"                       },
-       [RTL_GIGA_MAC_VER_21] = {"RTL8168c/8111c"                       },
-       [RTL_GIGA_MAC_VER_22] = {"RTL8168c/8111c"                       },
-       [RTL_GIGA_MAC_VER_23] = {"RTL8168cp/8111cp"                     },
-       [RTL_GIGA_MAC_VER_24] = {"RTL8168cp/8111cp"                     },
-       [RTL_GIGA_MAC_VER_25] = {"RTL8168d/8111d",      FIRMWARE_8168D_1},
-       [RTL_GIGA_MAC_VER_26] = {"RTL8168d/8111d",      FIRMWARE_8168D_2},
-       [RTL_GIGA_MAC_VER_28] = {"RTL8168dp/8111dp"                     },
-       [RTL_GIGA_MAC_VER_29] = {"RTL8105e",            FIRMWARE_8105E_1},
-       [RTL_GIGA_MAC_VER_30] = {"RTL8105e",            FIRMWARE_8105E_1},
-       [RTL_GIGA_MAC_VER_31] = {"RTL8168dp/8111dp"                     },
-       [RTL_GIGA_MAC_VER_32] = {"RTL8168e/8111e",      FIRMWARE_8168E_1},
-       [RTL_GIGA_MAC_VER_33] = {"RTL8168e/8111e",      FIRMWARE_8168E_2},
-       [RTL_GIGA_MAC_VER_34] = {"RTL8168evl/8111evl",  FIRMWARE_8168E_3},
-       [RTL_GIGA_MAC_VER_35] = {"RTL8168f/8111f",      FIRMWARE_8168F_1},
-       [RTL_GIGA_MAC_VER_36] = {"RTL8168f/8111f",      FIRMWARE_8168F_2},
-       [RTL_GIGA_MAC_VER_37] = {"RTL8402",             FIRMWARE_8402_1 },
-       [RTL_GIGA_MAC_VER_38] = {"RTL8411",             FIRMWARE_8411_1 },
-       [RTL_GIGA_MAC_VER_39] = {"RTL8106e",            FIRMWARE_8106E_1},
-       [RTL_GIGA_MAC_VER_40] = {"RTL8168g/8111g",      FIRMWARE_8168G_2},
-       [RTL_GIGA_MAC_VER_42] = {"RTL8168gu/8111gu",    FIRMWARE_8168G_3},
-       [RTL_GIGA_MAC_VER_43] = {"RTL8106eus",          FIRMWARE_8106E_2},
-       [RTL_GIGA_MAC_VER_44] = {"RTL8411b",            FIRMWARE_8411_2 },
-       [RTL_GIGA_MAC_VER_46] = {"RTL8168h/8111h",      FIRMWARE_8168H_2},
-       [RTL_GIGA_MAC_VER_48] = {"RTL8107e",            FIRMWARE_8107E_2},
-       [RTL_GIGA_MAC_VER_51] = {"RTL8168ep/8111ep"                     },
-       [RTL_GIGA_MAC_VER_52] = {"RTL8168fp/RTL8117",  FIRMWARE_8168FP_3},
-       [RTL_GIGA_MAC_VER_53] = {"RTL8168fp/RTL8117",                   },
-       [RTL_GIGA_MAC_VER_61] = {"RTL8125A",            FIRMWARE_8125A_3},
-       /* reserve 62 for CFG_METHOD_4 in the vendor driver */
-       [RTL_GIGA_MAC_VER_63] = {"RTL8125B",            FIRMWARE_8125B_2},
-       [RTL_GIGA_MAC_VER_64] = {"RTL8125D",            FIRMWARE_8125D_1},
-       [RTL_GIGA_MAC_VER_65] = {"RTL8125D",            FIRMWARE_8125D_2},
-       [RTL_GIGA_MAC_VER_66] = {"RTL8125BP",           FIRMWARE_8125BP_2},
-       [RTL_GIGA_MAC_VER_70] = {"RTL8126A",            FIRMWARE_8126A_2},
-       [RTL_GIGA_MAC_VER_71] = {"RTL8126A",            FIRMWARE_8126A_3},
+       /* 8126A family. */
+       { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71, "RTL8126A", FIRMWARE_8126A_3 },
+       { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70, "RTL8126A", FIRMWARE_8126A_2 },
+
+       /* 8125BP family. */
+       { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66, "RTL8125BP", FIRMWARE_8125BP_2 },
+
+       /* 8125D family. */
+       { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65, "RTL8125D", FIRMWARE_8125D_2 },
+       { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64, "RTL8125D", FIRMWARE_8125D_1 },
+
+       /* 8125B family. */
+       { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63, "RTL8125B", FIRMWARE_8125B_2 },
+
+       /* 8125A family. */
+       { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61, "RTL8125A", FIRMWARE_8125A_3 },
+
+       /* RTL8117 */
+       { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53, "RTL8168fp/RTL8117" },
+       { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52, "RTL8168fp/RTL8117",
+         FIRMWARE_8168FP_3 },
+
+       /* 8168EP family. */
+       { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51, "RTL8168ep/8111ep" },
+
+       /* 8168H family. */
+       { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46, "RTL8168h/8111h",
+         FIRMWARE_8168H_2 },
+       /* Realtek calls it RTL8168M, but it's handled like RTL8168H */
+       { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46, "RTL8168M", FIRMWARE_8168H_2 },
+
+       /* 8168G family. */
+       { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44, "RTL8411b", FIRMWARE_8411_2 },
+       { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42, "RTL8168gu/8111gu",
+         FIRMWARE_8168G_3 },
+       { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40, "RTL8168g/8111g",
+         FIRMWARE_8168G_2 },
+
+       /* 8168F family. */
+       { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38, "RTL8411", FIRMWARE_8411_1 },
+       { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36, "RTL8168f/8111f",
+         FIRMWARE_8168F_2 },
+       { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35, "RTL8168f/8111f",
+         FIRMWARE_8168F_1 },
+
+       /* 8168E family. */
+       { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34, "RTL8168evl/8111evl",
+         FIRMWARE_8168E_3 },
+       { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32, "RTL8168e/8111e",
+         FIRMWARE_8168E_1 },
+       { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33, "RTL8168e/8111e",
+         FIRMWARE_8168E_2 },
+
+       /* 8168D family. */
+       { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25, "RTL8168d/8111d",
+         FIRMWARE_8168D_1 },
+       { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26, "RTL8168d/8111d",
+         FIRMWARE_8168D_2 },
+
+       /* 8168DP family. */
+       { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28, "RTL8168dp/8111dp" },
+       { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31, "RTL8168dp/8111dp" },
+
+       /* 8168C family. */
+       { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23, "RTL8168cp/8111cp" },
+       { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18, "RTL8168cp/8111cp" },
+       { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24, "RTL8168cp/8111cp" },
+       { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19, "RTL8168c/8111c" },
+       { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20, "RTL8168c/8111c" },
+       { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21, "RTL8168c/8111c" },
+       { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22, "RTL8168c/8111c" },
+
+       /* 8168B family. */
+       { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17, "RTL8168b/8111b" },
+       /* This one is very old and rare, support has been removed.
+        * { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11, "RTL8168b/8111b" },
+        */
+
+       /* 8101 family. */
+       { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39, "RTL8106e", FIRMWARE_8106E_1 },
+       { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37, "RTL8402", FIRMWARE_8402_1 },
+       { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29, "RTL8105e", FIRMWARE_8105E_1 },
+       { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30, "RTL8105e", FIRMWARE_8105E_1 },
+       { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08, "RTL8102e" },
+       { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08, "RTL8102e" },
+       { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07, "RTL8102e" },
+       { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07, "RTL8102e" },
+       { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14, "RTL8401" },
+       { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" },
+       { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09, "RTL8102e/RTL8103e" },
+       { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10, "RTL8101e/RTL8100e" },
+
+       /* 8110 family. */
+       { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06, "RTL8169sc/8110sc" },
+       { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05, "RTL8169sc/8110sc" },
+       { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04, "RTL8169sb/8110sb" },
+       { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03, "RTL8110s" },
+       { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02, "RTL8169s" },
+
+       /* Catch-all */
+       { 0x000, 0x000, RTL_GIGA_MAC_NONE }
 };
 
 static const struct pci_device_id rtl8169_pci_tbl[] = {
@@ -2265,151 +2318,30 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
        .get_eth_ctrl_stats     = rtl8169_get_eth_ctrl_stats,
 };
 
-static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii)
+static const struct rtl_chip_info *rtl8169_get_chip_version(u16 xid, bool gmii)
 {
-       /*
-        * The driver currently handles the 8168Bf and the 8168Be identically
-        * but they can be identified more specifically through the test below
-        * if needed:
-        *
-        * (RTL_R32(tp, TxConfig) & 0x700000) == 0x500000 ? 8168Bf : 8168Be
-        *
-        * Same thing for the 8101Eb and the 8101Ec:
-        *
-        * (RTL_R32(tp, TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec
-        */
-       static const struct rtl_mac_info {
-               u16 mask;
-               u16 val;
-               enum mac_version ver;
-       } mac_info[] = {
-               /* 8126A family. */
-               { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 },
-               { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 },
-
-               /* 8125BP family. */
-               { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66 },
-
-               /* 8125D family. */
-               { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 },
-               { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
-
-               /* 8125B family. */
-               { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 },
-
-               /* 8125A family. */
-               { 0x7cf, 0x609, RTL_GIGA_MAC_VER_61 },
-               /* It seems only XID 609 made it to the mass market.
-                * { 0x7cf, 0x608,      RTL_GIGA_MAC_VER_60 },
-                * { 0x7c8, 0x608,      RTL_GIGA_MAC_VER_61 },
-                */
-
-               /* RTL8117 */
-               { 0x7cf, 0x54b, RTL_GIGA_MAC_VER_53 },
-               { 0x7cf, 0x54a, RTL_GIGA_MAC_VER_52 },
-
-               /* 8168EP family. */
-               { 0x7cf, 0x502, RTL_GIGA_MAC_VER_51 },
-               /* It seems this chip version never made it to
-                * the wild. Let's disable detection.
-                * { 0x7cf, 0x501,      RTL_GIGA_MAC_VER_50 },
-                * { 0x7cf, 0x500,      RTL_GIGA_MAC_VER_49 },
-                */
-
-               /* 8168H family. */
-               { 0x7cf, 0x541, RTL_GIGA_MAC_VER_46 },
-               /* It seems this chip version never made it to
-                * the wild. Let's disable detection.
-                * { 0x7cf, 0x540,      RTL_GIGA_MAC_VER_45 },
-                */
-               /* Realtek calls it RTL8168M, but it's handled like RTL8168H */
-               { 0x7cf, 0x6c0, RTL_GIGA_MAC_VER_46 },
-
-               /* 8168G family. */
-               { 0x7cf, 0x5c8, RTL_GIGA_MAC_VER_44 },
-               { 0x7cf, 0x509, RTL_GIGA_MAC_VER_42 },
-               /* It seems this chip version never made it to
-                * the wild. Let's disable detection.
-                * { 0x7cf, 0x4c1,      RTL_GIGA_MAC_VER_41 },
-                */
-               { 0x7cf, 0x4c0, RTL_GIGA_MAC_VER_40 },
-
-               /* 8168F family. */
-               { 0x7c8, 0x488, RTL_GIGA_MAC_VER_38 },
-               { 0x7cf, 0x481, RTL_GIGA_MAC_VER_36 },
-               { 0x7cf, 0x480, RTL_GIGA_MAC_VER_35 },
-
-               /* 8168E family. */
-               { 0x7c8, 0x2c8, RTL_GIGA_MAC_VER_34 },
-               { 0x7cf, 0x2c1, RTL_GIGA_MAC_VER_32 },
-               { 0x7c8, 0x2c0, RTL_GIGA_MAC_VER_33 },
-
-               /* 8168D family. */
-               { 0x7cf, 0x281, RTL_GIGA_MAC_VER_25 },
-               { 0x7c8, 0x280, RTL_GIGA_MAC_VER_26 },
-
-               /* 8168DP family. */
-               /* It seems this early RTL8168dp version never made it to
-                * the wild. Support has been removed.
-                * { 0x7cf, 0x288,      RTL_GIGA_MAC_VER_27 },
-                */
-               { 0x7cf, 0x28a, RTL_GIGA_MAC_VER_28 },
-               { 0x7cf, 0x28b, RTL_GIGA_MAC_VER_31 },
-
-               /* 8168C family. */
-               { 0x7cf, 0x3c9, RTL_GIGA_MAC_VER_23 },
-               { 0x7cf, 0x3c8, RTL_GIGA_MAC_VER_18 },
-               { 0x7c8, 0x3c8, RTL_GIGA_MAC_VER_24 },
-               { 0x7cf, 0x3c0, RTL_GIGA_MAC_VER_19 },
-               { 0x7cf, 0x3c2, RTL_GIGA_MAC_VER_20 },
-               { 0x7cf, 0x3c3, RTL_GIGA_MAC_VER_21 },
-               { 0x7c8, 0x3c0, RTL_GIGA_MAC_VER_22 },
-
-               /* 8168B family. */
-               { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 },
-               /* This one is very old and rare, support has been removed.
-                * { 0x7c8, 0x300,      RTL_GIGA_MAC_VER_11 },
-                */
-
-               /* 8101 family. */
-               { 0x7c8, 0x448, RTL_GIGA_MAC_VER_39 },
-               { 0x7c8, 0x440, RTL_GIGA_MAC_VER_37 },
-               { 0x7cf, 0x409, RTL_GIGA_MAC_VER_29 },
-               { 0x7c8, 0x408, RTL_GIGA_MAC_VER_30 },
-               { 0x7cf, 0x349, RTL_GIGA_MAC_VER_08 },
-               { 0x7cf, 0x249, RTL_GIGA_MAC_VER_08 },
-               { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 },
-               { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 },
-               { 0x7cf, 0x240, RTL_GIGA_MAC_VER_14 },
-               { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 },
-               { 0x7c8, 0x248, RTL_GIGA_MAC_VER_09 },
-               { 0x7c8, 0x340, RTL_GIGA_MAC_VER_10 },
-
-               /* 8110 family. */
-               { 0xfc8, 0x980, RTL_GIGA_MAC_VER_06 },
-               { 0xfc8, 0x180, RTL_GIGA_MAC_VER_05 },
-               { 0xfc8, 0x100, RTL_GIGA_MAC_VER_04 },
-               { 0xfc8, 0x040, RTL_GIGA_MAC_VER_03 },
-               { 0xfc8, 0x008, RTL_GIGA_MAC_VER_02 },
-
-               /* Catch-all */
-               { 0x000, 0x000, RTL_GIGA_MAC_NONE   }
+       /* Chips combining a 1Gbps MAC with a 100Mbps PHY */
+       static const struct rtl_chip_info rtl8106eus_info = {
+               .mac_version = RTL_GIGA_MAC_VER_43,
+               .name = "RTL8106eus",
+               .fw_name = FIRMWARE_8106E_2,
+       };
+       static const struct rtl_chip_info rtl8107e_info = {
+               .mac_version = RTL_GIGA_MAC_VER_48,
+               .name = "RTL8107e",
+               .fw_name = FIRMWARE_8107E_2,
        };
-       const struct rtl_mac_info *p = mac_info;
-       enum mac_version ver;
+       const struct rtl_chip_info *p = rtl_chip_infos;
 
        while ((xid & p->mask) != p->val)
                p++;
-       ver = p->ver;
 
-       if (ver != RTL_GIGA_MAC_NONE && !gmii) {
-               if (ver == RTL_GIGA_MAC_VER_42)
-                       ver = RTL_GIGA_MAC_VER_43;
-               else if (ver == RTL_GIGA_MAC_VER_46)
-                       ver = RTL_GIGA_MAC_VER_48;
-       }
+       if (p->mac_version == RTL_GIGA_MAC_VER_42 && !gmii)
+               return &rtl8106eus_info;
+       if (p->mac_version == RTL_GIGA_MAC_VER_46 && !gmii)
+               return &rtl8107e_info;
 
-       return ver;
+       return p;
 }
 
 static void rtl_release_firmware(struct rtl8169_private *tp)
@@ -5440,9 +5372,9 @@ static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
 
 static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+       const struct rtl_chip_info *chip;
        struct rtl8169_private *tp;
        int jumbo_max, region, rc;
-       enum mac_version chipset;
        struct net_device *dev;
        u32 txconfig;
        u16 xid;
@@ -5492,12 +5424,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        xid = (txconfig >> 20) & 0xfcf;
 
        /* Identify chip attached to board */
-       chipset = rtl8169_get_mac_version(xid, tp->supports_gmii);
-       if (chipset == RTL_GIGA_MAC_NONE)
+       chip = rtl8169_get_chip_version(xid, tp->supports_gmii);
+       if (chip->mac_version == RTL_GIGA_MAC_NONE)
                return dev_err_probe(&pdev->dev, -ENODEV,
                                     "unknown chip XID %03x, contact r8169 maintainers (see MAINTAINERS file)\n",
                                     xid);
-       tp->mac_version = chipset;
+       tp->mac_version = chip->mac_version;
+       tp->fw_name = chip->fw_name;
 
        /* Disable ASPM L1 as that cause random device stop working
         * problems as well as full system hangs for some PCIe devices users.
@@ -5602,8 +5535,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        rtl_set_irq_mask(tp);
 
-       tp->fw_name = rtl_chip_infos[chipset].fw_name;
-
        tp->counters = dmam_alloc_coherent (&pdev->dev, sizeof(*tp->counters),
                                            &tp->counters_phys_addr,
                                            GFP_KERNEL);
@@ -5628,7 +5559,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n",
-                   rtl_chip_infos[chipset].name, dev->dev_addr, xid, tp->irq);
+                   chip->name, dev->dev_addr, xid, tp->irq);
 
        if (jumbo_max)
                netdev_info(dev, "jumbo features [frames: %d bytes, tx checksumming: %s]\n",