Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp467465ybl; Tue, 28 Jan 2020 06:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxsIOna+pD8IC78cRNbe8MVONK/uuEvN9Sc5jXVtBwmKnLi040y7dt2zmbBPLBK5Z5FgKEX X-Received: by 2002:aca:3a05:: with SMTP id h5mr3063029oia.3.1580221547044; Tue, 28 Jan 2020 06:25:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221547; cv=none; d=google.com; s=arc-20160816; b=uDt4OfmpVdmE2oCfq0R8NUPUIeqztzYIQGOYWwLwkxvL4OznFFB7TQi1TVVHdzzBMq SBT+x3G+pTCpASbuWHbcYV98ytNoB1T1O8+oZ8KQgOJ7KwUp6pFsFAJH4IL2bj5JbR2k wyhwph5ZhK3cJ+wEvE4pJzKoDRWstOYf25+ADa/iJCUvzjqej6s/j/fpvA4Oyh7ajqxL u2PYi0a4mesv3AbdHn2/slcYL4jNyM8y25mBAvCyM+NtmdLS35C00fa0gVh3VBC5SWjp HdWzCWrvbtxVhlELjHdWSSg/HY+A/bWjvIQjonzUxW1CPOoNpGdkFg807BECd1RfrZqY 1+qw== 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=HU7SQA50coPYWPQl+3jdaJWcIICBGqXOTDGTAzaDPws=; b=iuts2dJxCnZvqhBSTgS5h16LdETk1TnIOFOomVmOVomuzgZrIfNfPWLLANnLQBMcdZ gdlItzrztKmp6u8wHeOdjzsjgg5YB+X2BGAHV3sKaM0xj3rDNCOkefytBfWK0Yy5E9xT zhjAF3Xi/X272wgvvbVo3Ic/Izh7Np9svzAJuOqLJKe4FCR7fKKIXDFAEoZtTEJs+8Vt XyFD2yhwNY11oDsQJbvjZQA8JAO3lhFBZGiLFwILWHNS62thygfKhWzIT5YS911q5/6c 0pA9zdkqv6l1zz7kNlIlL0IZ9JVxobf5SAJ8YZwJRwGRu4O+uPKtpA+5rb7fOlTlvjdh bDAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SY3zBPag; 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 z22si7650845otq.94.2020.01.28.06.25.35; Tue, 28 Jan 2020 06:25:47 -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=SY3zBPag; 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 S1729987AbgA1OYk (ORCPT + 99 others); Tue, 28 Jan 2020 09:24:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:51386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732664AbgA1OYi (ORCPT ); Tue, 28 Jan 2020 09:24:38 -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 24B7D24686; Tue, 28 Jan 2020 14:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221477; bh=/3l2Trj3+KfJHArCZMTjN+/sNNieSLhlNJk3rYqQWU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SY3zBPag6bI8j0upe0GePe/RsIM9wTPcJWEL7vJfMxFN4IRt8LupaQMopuJ6aa00n icj/SwbuBgGdxCuTsMoWccuG7fTv0fmjkpBpBeJ7hwyx3PXJVbMladJ5gny4jnLZ3n l+XBUaqdAHvRE1Q4qxQy0OxlSyfYWn3dsS2bCES8= 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.9 241/271] net: usb: lan78xx: Add .ndo_features_check Date: Tue, 28 Jan 2020 15:06:30 +0100 Message-Id: <20200128135910.477579436@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@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 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "lan78xx.h" @@ -3291,6 +3292,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, @@ -3304,6 +3318,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(unsigned long param)