From patchwork Fri May 5 19:20:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Yasevich X-Patchwork-Id: 759138 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wKMF06CVCz9s7r for ; Sat, 6 May 2017 05:20:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xnn4h/Cn"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751240AbdEETUs (ORCPT ); Fri, 5 May 2017 15:20:48 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:36643 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbdEETUr (ORCPT ); Fri, 5 May 2017 15:20:47 -0400 Received: by mail-qk0-f193.google.com with SMTP id y128so2175872qka.3 for ; Fri, 05 May 2017 12:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=JKcbqHjG3/41Dq4LN9lYgg8UdP9/Lu11S+3F39aSZe0=; b=Xnn4h/CnIKfMhkxY/nQwoiGBAsv4MEMGdXpnwvhnFkAEPQSh1qXPPgOCAQJkcm9WwX g4G4TWV3FcDSwgjBdTKDxXvG1vpLIE+XmSO19tmbZ+A5zRSFCB33h2wmHHN7KDolP0k6 4L5//QDe0/MdozuaI2kWnAL15asV+iBQjazNMd3Fua57sjagNvL3atnuc3R6Mi5mV2Bk AANWW+3ksjTf9R30uRAc3ABHB4CdW/VZ3r5xMyf2mmw7w+1HDjDSQYQg4DGEscAKQ/h6 QnnXPnXTD4Qj+twTD/fN2WOPgGFWEcDkPBM4yS2NFTDjTPEFyv0q6trxUxapiW6ab9Uh npTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JKcbqHjG3/41Dq4LN9lYgg8UdP9/Lu11S+3F39aSZe0=; b=YL4WCJP6f+pyHUhChqC0g20hL5FsjxPMBf4CbYx25gE5euezKxbNFOzqEqdyQeEqzr mk7954LT7vJ6Ojll1AMqpqYSKYLFS4FQjDsa9k3X/dPcH6hhRqbrb8Sj/uh/yeoKwAnb 2PFxbOcXHIjgFUtI1oUZJjnNrgxsv8nkg6d5SV6ujmlWa6hdxRgZw4ZTWa8QLxXSVll/ 23spImoQZi57qAi609WFK2rvSbAsB+a8ZEpHXNTdSvGJRQHTw6Wl1oWSosY0YJNFNZMw HOALThB1KqJhYzfbhFsBZhUQ3rZeqKlYu1Q0eOeB1hkUMbaRC8JJLRWRpbsh9Z6jMpi5 RVZw== X-Gm-Message-State: AODbwcBODUDJonhN+7sBSE8nsKSTUv/dkkEtuYNm9kT8cK0HKa5uSmU7 wdiRMayhF1g2Cg== X-Received: by 10.55.140.134 with SMTP id o128mr10521105qkd.79.1494012046449; Fri, 05 May 2017 12:20:46 -0700 (PDT) Received: from flash.localdomain ([71.169.189.201]) by smtp.gmail.com with ESMTPSA id q30sm5180373qkh.39.2017.05.05.12.20.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 12:20:45 -0700 (PDT) From: Vladislav Yasevich X-Google-Original-From: Vladislav Yasevich To: netdev@vger.kernel.org Cc: mkubecek@suse.cz, alexander.duyck@gmail.com, avagin@openvz.org, Vladislav Yasevich Subject: [PATCH] vlan: Keep NETIF_F_HW_CSUM similar to other software devices Date: Fri, 5 May 2017 15:20:38 -0400 Message-Id: <1494012038-5776-1-git-send-email-vyasevic@redhat.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Vlan devices, like all other software devices, enable NETIF_F_HW_CSUM feature. However, unlike all the othe other software devices, vlans will switch to using IP|IPV6_CSUM features, if the underlying devices uses them. In these situations, checksum offload features on the vlan device can't be controlled via ethtool. This patch makes vlans keep HW_CSUM feature if the underlying device supports checksum offloading. This makes vlan devices behave like other software devices, and restores control to the user. A side-effect is that some offload settings (typically UFO) may be enabled on the vlan device while being disabled on the HW. However, the GSO code will correctly process the packets. This actually results in slightly better raw throughput. Signed-off-by: Vladislav Yasevich --- net/8021q/vlan_dev.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 9ee5787..ffc8167 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -626,10 +626,16 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; netdev_features_t old_features = features; + netdev_features_t real_dev_features = real_dev->features; - features = netdev_intersect_features(features, real_dev->vlan_features); + features = netdev_intersect_features(features, + (real_dev->vlan_features | + NETIF_F_HW_CSUM)); features |= NETIF_F_RXCSUM; - features = netdev_intersect_features(features, real_dev->features); + if (real_dev_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) + real_dev_features |= NETIF_F_HW_CSUM; + + features = netdev_intersect_features(features, real_dev_features); features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); features |= NETIF_F_LLTX;