From patchwork Wed Apr 15 00:09:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Gross X-Patchwork-Id: 461323 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 777DD14021A for ; Wed, 15 Apr 2015 10:09:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C09B7A2F5B; Wed, 15 Apr 2015 00:09:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ldiLP0thcJVI; Wed, 15 Apr 2015 00:09:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 495C0A2EA7; Wed, 15 Apr 2015 00:09:27 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 075891C21C7 for ; Wed, 15 Apr 2015 00:09:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F3484A3098 for ; Wed, 15 Apr 2015 00:09:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d7Gs9enb-0_H for ; Wed, 15 Apr 2015 00:09:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from na3sys009aog130.obsmtp.com (na3sys009aog130.obsmtp.com [74.125.149.143]) by fraxinus.osuosl.org (Postfix) with SMTP id 050B9A2EA7 for ; Wed, 15 Apr 2015 00:09:22 +0000 (UTC) Received: from mail-pd0-f182.google.com ([209.85.192.182]) (using TLSv1) by na3sys009aob130.postini.com ([74.125.148.12]) with SMTP ID DSNKVS2sMndbc3iPhejrQ542BhJ0uv8FoZmU@postini.com; Tue, 14 Apr 2015 17:09:23 PDT Received: by mail-pd0-f182.google.com with SMTP id qd1so30273258pdb.2 for ; Tue, 14 Apr 2015 17:09:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Kr0LmqBhbFTDtSzuteyizXrG16hCx6EDGlQTn3ZY7MA=; b=I+I18++gNwxvaJP+TWoRMpLkm+LFeai83tW188oKsKNH/cdXCF1rMsiTxYYVsMRhuD lpU9xHTrMWYjIOkFH60WSYahhbeFcq/aDLSIQW+TGo9Ch2IGxw2kLixKDdA31OnnPEM0 8t6YbJ96R+ulioT61J6xqbI0RYr3YQaFMu+kFzsUgAnwGb1pVdKg4MgwCXbz8Z9WzFdO V9S4Jh+Ss1GHeXAAaIxZk6qMHwL23uBFos4b9+OjH7VnTGDsJuZXvIyv6I+lx7xixTgp 3nniqlvmzPPbv8aXz/yHMHG8G5e2+tR9UGZ+QGvYL9O3vzLQY+ONa38REFnOxExNziDk fG2w== X-Gm-Message-State: ALoCoQllJJqOuXY+yh5QCc9Lmmj5AudfLH/yhKl8fcQB3fLbo2UtpejQkG/3J/WWu1Dmhnk0gFvxQSgskJqdl9sYZItTdUYTPmkFZRFecB8cBa9YgBoSrOoHTMknzGntn0qYR+a7tsoXoaoSheEjViw2t56T9hvkDNHQimnj5wvsMHz1qM0w7wA= X-Received: by 10.70.5.225 with SMTP id v1mr40859579pdv.103.1429056562364; Tue, 14 Apr 2015 17:09:22 -0700 (PDT) X-Received: by 10.70.5.225 with SMTP id v1mr40859567pdv.103.1429056562297; Tue, 14 Apr 2015 17:09:22 -0700 (PDT) Received: from localhost.localdomain (c-71-202-123-143.hsd1.ca.comcast.net. [71.202.123.143]) by mx.google.com with ESMTPSA id nd3sm2227509pbc.9.2015.04.14.17.09.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 17:09:21 -0700 (PDT) From: Jesse Gross To: intel-wired-lan@lists.osuosl.org Date: Tue, 14 Apr 2015 17:09:14 -0700 Message-Id: <1429056554-120070-1-git-send-email-jesse@nicira.com> X-Mailer: git-send-email 1.9.1 Cc: Joe Stringer Subject: [Intel-wired-lan] [PATCH net v2] i40e: Implement ndo_features_check() X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" From: Joe Stringer i40e supports UDP tunnel headers up to 80 bytes in length, so this adds a check to ensure that it doesn't try to offload packets that exceed that. Signed-off-by: Joe Stringer Signed-off-by: Jesse Gross Acked-by: Jesse Brandeburg --- v2: Move #define above function comment. --- drivers/net/ethernet/intel/i40e/i40e_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index dadda3c..eeff157 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -7653,6 +7653,25 @@ static int i40e_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], return err; } +#define I40E_MAX_TUNNEL_HDR_LEN 80 +/** + * i40e_features_check - Validate encapsulated packet conforms to limits + * @skb: skb buff + * @netdev: This physical port's netdev + * @features: Offload features that the stack believes apply + **/ +static netdev_features_t i40e_features_check(struct sk_buff *skb, + struct net_device *dev, + netdev_features_t features) +{ + if (skb->encapsulation && + (skb_inner_mac_header(skb) - skb_transport_header(skb) > + I40E_MAX_TUNNEL_HDR_LEN)) + return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); + + return features; +} + static const struct net_device_ops i40e_netdev_ops = { .ndo_open = i40e_open, .ndo_stop = i40e_close, @@ -7687,6 +7706,7 @@ static const struct net_device_ops i40e_netdev_ops = { #endif .ndo_get_phys_port_id = i40e_get_phys_port_id, .ndo_fdb_add = i40e_ndo_fdb_add, + .ndo_features_check = i40e_features_check, }; /**