]> git.baikalelectronics.ru Git - kernel.git/commitdiff
r8169: improve rtl8169_tso_csum_v2
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 18 Apr 2020 21:10:44 +0000 (23:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Apr 2020 03:20:11 +0000 (20:20 -0700)
Simplify the code and avoid the overhead of calling vlan_get_protocol().

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

index e8c55b795c7637e3dda743879e60c327fdbb7df4..2cd2b038e4ebfc33b729a60e29d19a89268e2ae7 100644 (file)
@@ -4127,25 +4127,20 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
                                struct sk_buff *skb, u32 *opts)
 {
        u32 transport_offset = (u32)skb_transport_offset(skb);
-       u32 mss = skb_shinfo(skb)->gso_size;
+       struct skb_shared_info *shinfo = skb_shinfo(skb);
+       u32 mss = shinfo->gso_size;
 
        if (mss) {
-               switch (vlan_get_protocol(skb)) {
-               case htons(ETH_P_IP):
+               if (shinfo->gso_type & SKB_GSO_TCPV4) {
                        opts[0] |= TD1_GTSENV4;
-                       break;
-
-               case htons(ETH_P_IPV6):
+               } else if (shinfo->gso_type & SKB_GSO_TCPV6) {
                        if (skb_cow_head(skb, 0))
                                return false;
 
                        tcp_v6_gso_csum_prep(skb);
                        opts[0] |= TD1_GTSENV6;
-                       break;
-
-               default:
+               } else {
                        WARN_ON_ONCE(1);
-                       break;
                }
 
                opts[0] |= transport_offset << GTTCPHO_SHIFT;