Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp477015ybl; Tue, 28 Jan 2020 06:34:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzmyAX/EtEvmvLHLk/XJba84L/HTn2F3989bWgr9cMoGyB7wIYKk0h7TSUcxq8MIVxt7fJq X-Received: by 2002:a05:6830:9a:: with SMTP id a26mr7811423oto.273.1580222049434; Tue, 28 Jan 2020 06:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222049; cv=none; d=google.com; s=arc-20160816; b=midpULh5OldLtJnIz+PjWfbpZXCo3TM0529Gbfp7W6m7NqGhmirKxvELyuA6Rm8Eri onSqLjTbTqzGx6PE398cILw8RVzx1FYpV8O6SQhyItMBaLwpI/J88qgO31/dOsHg9PcS l/k5QCt94moW0ELy9czx3FyABuaKUll8J5MXfvCiqhRfiSZpUAikmFpGxBXsR1/X/+0A KHr8gLqypvKZ0JoPQgFWqt/7D7jijIxUywfJcuktPrDVpJrZ582CHGC/VBvnw4kMk8K3 SheHOgk5H7MCFdQc+V0/jfKLleYL50hHVynOreOeMpA/YjSwfoQ89OUyZULX/c48u1hA gyIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4/c93+TkHQzWQSbYZRoOsQrFq18de4cCHPc26vjaons=; b=i+jSwZSALHSokMDqhPwXJgDdW9Y5DmcCDBa5Y9y2pO5dEPBzqkrb9s1lwYi7T2g2cL pE0h9FI4IXYeS5CZg9nZ56P2vaK4NgNVc+Tk2oFrQRLji41TvtQ3T7lgEiHHpT2ytySq +yECBJxsmq6amw8pzhiNqYZjApbC0S4L+W8d5pXVQafU66JABXbIcftw8zbHgJmUxRFH GJKPZPSliOyfiBJMmKryZJ3GWzYIIzSJIBcUlRtRZiIkuZCq0sMwxBj9hvKA6mu0Ioy5 lRp24ZsGOhXY0ZR4BKqbGsohnIwvbFs92PpDR+qD5I/ki0goy9sSq4RIvx4slQ9SE/Gy hURA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IUv4cIlA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si4962286oif.167.2020.01.28.06.33.57; Tue, 28 Jan 2020 06:34:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IUv4cIlA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733225AbgA1O0t (ORCPT + 99 others); Tue, 28 Jan 2020 09:26:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:54310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732581AbgA1O0p (ORCPT ); Tue, 28 Jan 2020 09:26:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8F052468D; Tue, 28 Jan 2020 14:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221605; bh=0XqpkmLl3ffexxC3nnJMff9DZryzxYfamhBtfVHPeKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUv4cIlAqJYGyBvbOAUSDq7JuAXj9u7+EtRvvOcDmgOJwinf1ev6/Vxrcr917rBS/ Ea9t6ai+Jj6AiPJVMOWL3IKfRhHvky0NVUIjE+WB6K9Sf20CUeoDnacAhJwveFgqUZ cT5UCdlrBgjJBwM0KwuWpOKGTx5ZVeE/UvwMmhhI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hughes , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.19 17/92] net: usb: lan78xx: Add .ndo_features_check Date: Tue, 28 Jan 2020 15:07:45 +0100 Message-Id: <20200128135811.377714272@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135809.344954797@linuxfoundation.org> References: <20200128135809.344954797@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Hughes [ Upstream commit ce896476c65d72b4b99fa09c2f33436b4198f034 ] As reported by Eric Dumazet, there are still some outstanding cases where the driver does not handle TSO correctly when skb's are over a certain size. Most cases have been fixed, this patch should ensure that forwarded SKB's that are greater than MAX_SINGLE_PACKET_SIZE - TX_OVERHEAD are software segmented and handled correctly. Signed-off-by: James Hughes Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/lan78xx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -3686,6 +3687,19 @@ static void lan78xx_tx_timeout(struct ne tasklet_schedule(&dev->bh); } +static netdev_features_t lan78xx_features_check(struct sk_buff *skb, + struct net_device *netdev, + netdev_features_t features) +{ + if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) + features &= ~NETIF_F_GSO_MASK; + + features = vlan_features_check(skb, features); + features = vxlan_features_check(skb, features); + + return features; +} + static const struct net_device_ops lan78xx_netdev_ops = { .ndo_open = lan78xx_open, .ndo_stop = lan78xx_stop, @@ -3699,6 +3713,7 @@ static const struct net_device_ops lan78 .ndo_set_features = lan78xx_set_features, .ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid, + .ndo_features_check = lan78xx_features_check, }; static void lan78xx_stat_monitor(struct timer_list *t)