r8169: remove jumbo_tx_csum from chip config struct
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 17 Apr 2018 21:36:12 +0000 (23:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Apr 2018 01:11:59 +0000 (21:11 -0400)
According to the chip configuration entries only RTL8169 (ver <= 06)
supports tx checksumming for jumbo packets.
By the way: constant JUMBO_1K is a little misleading because it refers
to the standard packet size and not to a jumbo packet size.

By implementing this rule we can get rid of configuring tx checksumming
support per chip type.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c

index 94e91d3c2233dc6dfa6b5cd293835a2b43ce7b32..fcd42d0387b9990f8893470015b0d44fef9505a1 100644 (file)
@@ -171,12 +171,11 @@ enum rtl_tx_desc_version {
 #define JUMBO_7K       (7*1024 - ETH_HLEN - 2)
 #define JUMBO_9K       (9*1024 - ETH_HLEN - 2)
 
-#define _R(NAME,TD,FW,SZ,B) {  \
+#define _R(NAME,TD,FW,SZ) {    \
        .name = NAME,           \
        .txd_version = TD,      \
        .fw_name = FW,          \
        .jumbo_max = SZ,        \
-       .jumbo_tx_csum = B      \
 }
 
 static const struct {
@@ -184,135 +183,111 @@ static const struct {
        enum rtl_tx_desc_version txd_version;
        const char *fw_name;
        u16 jumbo_max;
-       bool jumbo_tx_csum;
 } rtl_chip_infos[] = {
        /* PCI devices. */
        [RTL_GIGA_MAC_VER_01] =
-               _R("RTL8169",           RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8169",           RTL_TD_0, NULL, JUMBO_7K),
        [RTL_GIGA_MAC_VER_02] =
-               _R("RTL8169s",          RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8169s",          RTL_TD_0, NULL, JUMBO_7K),
        [RTL_GIGA_MAC_VER_03] =
-               _R("RTL8110s",          RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8110s",          RTL_TD_0, NULL, JUMBO_7K),
        [RTL_GIGA_MAC_VER_04] =
-               _R("RTL8169sb/8110sb",  RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8169sb/8110sb",  RTL_TD_0, NULL, JUMBO_7K),
        [RTL_GIGA_MAC_VER_05] =
-               _R("RTL8169sc/8110sc",  RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8169sc/8110sc",  RTL_TD_0, NULL, JUMBO_7K),
        [RTL_GIGA_MAC_VER_06] =
-               _R("RTL8169sc/8110sc",  RTL_TD_0, NULL, JUMBO_7K, true),
+               _R("RTL8169sc/8110sc",  RTL_TD_0, NULL, JUMBO_7K),
        /* PCI-E devices. */
        [RTL_GIGA_MAC_VER_07] =
-               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K, true),
+               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_08] =
-               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K, true),
+               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_09] =
-               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K, true),
+               _R("RTL8102e",          RTL_TD_1, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_10] =
-               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K, true),
+               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_11] =
-               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K, false),
+               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K),
        [RTL_GIGA_MAC_VER_12] =
-               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K, false),
+               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K),
        [RTL_GIGA_MAC_VER_13] =
-               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K, true),
+               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_14] =
-               _R("RTL8100e",          RTL_TD_0, NULL, JUMBO_1K, true),
+               _R("RTL8100e",          RTL_TD_0, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_15] =
-               _R("RTL8100e",          RTL_TD_0, NULL, JUMBO_1K, true),
+               _R("RTL8100e",          RTL_TD_0, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_16] =
-               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K, true),
+               _R("RTL8101e",          RTL_TD_0, NULL, JUMBO_1K),
        [RTL_GIGA_MAC_VER_17] =
-               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K, false),
+               _R("RTL8168b/8111b",    RTL_TD_0, NULL, JUMBO_4K),
        [RTL_GIGA_MAC_VER_18] =
-               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_19] =
-               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_20] =
-               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_21] =
-               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_22] =
-               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168c/8111c",    RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_23] =
-               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_24] =
-               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K, false),
+               _R("RTL8168cp/8111cp",  RTL_TD_1, NULL, JUMBO_6K),
        [RTL_GIGA_MAC_VER_25] =
-               _R("RTL8168d/8111d",    RTL_TD_1, FIRMWARE_8168D_1,
-                                                       JUMBO_9K, false),
+               _R("RTL8168d/8111d",    RTL_TD_1, FIRMWARE_8168D_1, JUMBO_9K),
        [RTL_GIGA_MAC_VER_26] =
-               _R("RTL8168d/8111d",    RTL_TD_1, FIRMWARE_8168D_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8168d/8111d",    RTL_TD_1, FIRMWARE_8168D_2, JUMBO_9K),
        [RTL_GIGA_MAC_VER_27] =
-               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K, false),
+               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_28] =
-               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K, false),
+               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_29] =
-               _R("RTL8105e",          RTL_TD_1, FIRMWARE_8105E_1,
-                                                       JUMBO_1K, true),
+               _R("RTL8105e",          RTL_TD_1, FIRMWARE_8105E_1, JUMBO_1K),
        [RTL_GIGA_MAC_VER_30] =
-               _R("RTL8105e",          RTL_TD_1, FIRMWARE_8105E_1,
-                                                       JUMBO_1K, true),
+               _R("RTL8105e",          RTL_TD_1, FIRMWARE_8105E_1, JUMBO_1K),
        [RTL_GIGA_MAC_VER_31] =
-               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K, false),
+               _R("RTL8168dp/8111dp",  RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_32] =
-               _R("RTL8168e/8111e",    RTL_TD_1, FIRMWARE_8168E_1,
-                                                       JUMBO_9K, false),
+               _R("RTL8168e/8111e",    RTL_TD_1, FIRMWARE_8168E_1, JUMBO_9K),
        [RTL_GIGA_MAC_VER_33] =
-               _R("RTL8168e/8111e",    RTL_TD_1, FIRMWARE_8168E_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8168e/8111e",    RTL_TD_1, FIRMWARE_8168E_2, JUMBO_9K),
        [RTL_GIGA_MAC_VER_34] =
-               _R("RTL8168evl/8111evl",RTL_TD_1, FIRMWARE_8168E_3,
-                                                       JUMBO_9K, false),
+               _R("RTL8168evl/8111evl",RTL_TD_1, FIRMWARE_8168E_3, JUMBO_9K),
        [RTL_GIGA_MAC_VER_35] =
-               _R("RTL8168f/8111f",    RTL_TD_1, FIRMWARE_8168F_1,
-                                                       JUMBO_9K, false),
+               _R("RTL8168f/8111f",    RTL_TD_1, FIRMWARE_8168F_1, JUMBO_9K),
        [RTL_GIGA_MAC_VER_36] =
-               _R("RTL8168f/8111f",    RTL_TD_1, FIRMWARE_8168F_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8168f/8111f",    RTL_TD_1, FIRMWARE_8168F_2, JUMBO_9K),
        [RTL_GIGA_MAC_VER_37] =
-               _R("RTL8402",           RTL_TD_1, FIRMWARE_8402_1,
-                                                       JUMBO_1K, true),
+               _R("RTL8402",           RTL_TD_1, FIRMWARE_8402_1,  JUMBO_1K),
        [RTL_GIGA_MAC_VER_38] =
-               _R("RTL8411",           RTL_TD_1, FIRMWARE_8411_1,
-                                                       JUMBO_9K, false),
+               _R("RTL8411",           RTL_TD_1, FIRMWARE_8411_1,  JUMBO_9K),
        [RTL_GIGA_MAC_VER_39] =
-               _R("RTL8106e",          RTL_TD_1, FIRMWARE_8106E_1,
-                                                       JUMBO_1K, true),
+               _R("RTL8106e",          RTL_TD_1, FIRMWARE_8106E_1, JUMBO_1K),
        [RTL_GIGA_MAC_VER_40] =
-               _R("RTL8168g/8111g",    RTL_TD_1, FIRMWARE_8168G_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8168g/8111g",    RTL_TD_1, FIRMWARE_8168G_2, JUMBO_9K),
        [RTL_GIGA_MAC_VER_41] =
-               _R("RTL8168g/8111g",    RTL_TD_1, NULL, JUMBO_9K, false),
+               _R("RTL8168g/8111g",    RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_42] =
-               _R("RTL8168g/8111g",    RTL_TD_1, FIRMWARE_8168G_3,
-                                                       JUMBO_9K, false),
+               _R("RTL8168g/8111g",    RTL_TD_1, FIRMWARE_8168G_3, JUMBO_9K),
        [RTL_GIGA_MAC_VER_43] =
-               _R("RTL8106e",          RTL_TD_1, FIRMWARE_8106E_2,
-                                                       JUMBO_1K, true),
+               _R("RTL8106e",          RTL_TD_1, FIRMWARE_8106E_2, JUMBO_1K),
        [RTL_GIGA_MAC_VER_44] =
-               _R("RTL8411",           RTL_TD_1, FIRMWARE_8411_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8411",           RTL_TD_1, FIRMWARE_8411_2,  JUMBO_9K),
        [RTL_GIGA_MAC_VER_45] =
-               _R("RTL8168h/8111h",    RTL_TD_1, FIRMWARE_8168H_1,
-                                                       JUMBO_9K, false),
+               _R("RTL8168h/8111h",    RTL_TD_1, FIRMWARE_8168H_1, JUMBO_9K),
        [RTL_GIGA_MAC_VER_46] =
-               _R("RTL8168h/8111h",    RTL_TD_1, FIRMWARE_8168H_2,
-                                                       JUMBO_9K, false),
+               _R("RTL8168h/8111h",    RTL_TD_1, FIRMWARE_8168H_2, JUMBO_9K),
        [RTL_GIGA_MAC_VER_47] =
-               _R("RTL8107e",          RTL_TD_1, FIRMWARE_8107E_1,
-                                                       JUMBO_1K, false),
+               _R("RTL8107e",          RTL_TD_1, FIRMWARE_8107E_1, JUMBO_1K),
        [RTL_GIGA_MAC_VER_48] =
-               _R("RTL8107e",          RTL_TD_1, FIRMWARE_8107E_2,
-                                                       JUMBO_1K, false),
+               _R("RTL8107e",          RTL_TD_1, FIRMWARE_8107E_2, JUMBO_1K),
        [RTL_GIGA_MAC_VER_49] =
-               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL,
-                                                       JUMBO_9K, false),
+               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_50] =
-               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL,
-                                                       JUMBO_9K, false),
+               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL, JUMBO_9K),
        [RTL_GIGA_MAC_VER_51] =
-               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL,
-                                                       JUMBO_9K, false),
+               _R("RTL8168ep/8111ep",  RTL_TD_1, NULL, JUMBO_9K),
 };
 #undef _R
 
@@ -1954,7 +1929,7 @@ static netdev_features_t rtl8169_fix_features(struct net_device *dev,
                features &= ~NETIF_F_ALL_TSO;
 
        if (dev->mtu > JUMBO_1K &&
-           !rtl_chip_infos[tp->mac_version].jumbo_tx_csum)
+           tp->mac_version > RTL_GIGA_MAC_VER_06)
                features &= ~NETIF_F_IP_CSUM;
 
        return features;
@@ -8338,7 +8313,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                netif_info(tp, probe, dev, "jumbo features [frames: %d bytes, "
                           "tx checksumming: %s]\n",
                           rtl_chip_infos[chipset].jumbo_max,
-                          rtl_chip_infos[chipset].jumbo_tx_csum ? "ok" : "ko");
+                         tp->mac_version <= RTL_GIGA_MAC_VER_06 ? "ok" : "ko");
        }
 
        if (r8168_check_dash(tp))