• A
    ip6_gre: fix device features for ioctl setup · e5a9336a
    Alexey Kodanev 提交于
    When ip6gre is created using ioctl, its features, such as
    scatter-gather, GSO and tx-checksumming will be turned off:
    
      # ip -f inet6 tunnel add gre6 mode ip6gre remote fd00::1
      # ethtool -k gre6 (truncated output)
        tx-checksumming: off
        scatter-gather: off
        tcp-segmentation-offload: off
        generic-segmentation-offload: off [requested on]
    
    But when netlink is used, they will be enabled:
      # ip link add gre6 type ip6gre remote fd00::1
      # ethtool -k gre6 (truncated output)
        tx-checksumming: on
        scatter-gather: on
        tcp-segmentation-offload: on
        generic-segmentation-offload: on
    
    This results in a loss of performance when gre6 is created via ioctl.
    The issue was found with LTP/gre tests.
    
    Fix it by moving the setup of device features to a separate function
    and invoke it with ndo_init callback because both netlink and ioctl
    will eventually call it via register_netdevice():
    
       register_netdevice()
           - ndo_init() callback -> ip6gre_tunnel_init() or ip6gre_tap_init()
               - ip6gre_tunnel_init_common()
                    - ip6gre_tnl_init_features()
    
    The moved code also contains two minor style fixes:
      * removed needless tab from GRE6_FEATURES on NETIF_F_HIGHDMA line.
      * fixed the issue reported by checkpatch: "Unnecessary parentheses around
        'nt->encap.type == TUNNEL_ENCAP_NONE'"
    
    Fixes: ac4eb009 ("ip6gre: Add support for basic offloads offloads excluding GSO")
    Signed-off-by: NAlexey Kodanev <alexey.kodanev@oracle.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    e5a9336a
ip6_gre.c 39.3 KB