dc05299628eda52de40d5486b532760b8319f949
[openwrt/staging/blocktrron.git] /
1 From b8bf38440ba94e8ed8e2ae55c5dfb0276d30e843 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Thu, 10 Oct 2024 12:58:02 +0200
4 Subject: [PATCH] r8169: enable SG/TSO on selected chip versions per default
5
6 Due to problem reports in the past SG and TSO/TSO6 are disabled per
7 default. It's not fully clear which chip versions are affected, so we
8 may impact also users of unaffected chip versions, unless they know
9 how to use ethtool for enabling SG/TSO/TSO6.
10 Vendor drivers r8168/r8125 enable SG/TSO/TSO6 for selected chip
11 versions per default, I'd interpret this as confirmation that these
12 chip versions are unaffected. So let's do the same here.
13
14 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
15 Reviewed-by: Simon Horman <horms@kernel.org>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 ---
18 drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++-----
19 1 file changed, 11 insertions(+), 5 deletions(-)
20
21 --- a/drivers/net/ethernet/realtek/r8169_main.c
22 +++ b/drivers/net/ethernet/realtek/r8169_main.c
23 @@ -5529,11 +5529,6 @@ static int rtl_init_one(struct pci_dev *
24
25 dev->features |= dev->hw_features;
26
27 - /* There has been a number of reports that using SG/TSO results in
28 - * tx timeouts. However for a lot of people SG/TSO works fine.
29 - * Therefore disable both features by default, but allow users to
30 - * enable them. Use at own risk!
31 - */
32 if (rtl_chip_supports_csum_v2(tp)) {
33 dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6;
34 netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2);
35 @@ -5544,6 +5539,17 @@ static int rtl_init_one(struct pci_dev *
36 netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1);
37 }
38
39 + /* There has been a number of reports that using SG/TSO results in
40 + * tx timeouts. However for a lot of people SG/TSO works fine.
41 + * It's not fully clear which chip versions are affected. Vendor
42 + * drivers enable SG/TSO for certain chip versions per default,
43 + * let's mimic this here. On other chip versions users can
44 + * use ethtool to enable SG/TSO, use at own risk!
45 + */
46 + if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
47 + tp->mac_version != RTL_GIGA_MAC_VER_61)
48 + dev->features |= dev->hw_features;
49 +
50 dev->hw_features |= NETIF_F_RXALL;
51 dev->hw_features |= NETIF_F_RXFCS;
52