From patchwork Fri Mar 18 17:42:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 87559 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 9B1C5B6F06 for ; Sat, 19 Mar 2011 04:42:21 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757240Ab1CRRmQ (ORCPT ); Fri, 18 Mar 2011 13:42:16 -0400 Received: from rere.qmqm.pl ([89.167.52.164]:52073 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757231Ab1CRRmP (ORCPT ); Fri, 18 Mar 2011 13:42:15 -0400 Received: by rere.qmqm.pl (Postfix, from userid 1000) id 328EA13909; Fri, 18 Mar 2011 18:42:13 +0100 (CET) Message-Id: <37d3c96bc52c87fcd4cdd39c9c852b1d2bbc249d.1300466356.git.mirq-linux@rere.qmqm.pl> From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH] net: implement dev_disable_lro() hw_features compatibility MIME-Version: 1.0 To: netdev@vger.kernel.org Cc: Ben Hutchings , "David S. Miller" Date: Fri, 18 Mar 2011 18:42:13 +0100 (CET) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Implement compatibility with new hw_features for dev_disable_lro(). This is a transition path - dev_disable_lro() should be later integrated into netdev_fix_features() after all drivers are converted. There's no point in exporting __ethtool_set_flags() as it and dev_disable_lro() are always built-in. Signed-off-by: Michał Mirosław --- Patch is build-tested only, as I don't have any LRO-capable hardware. It might be prettier to move dev_disable_lro() to ethtool.c. net/core/dev.c | 20 ++++++++++++-------- net/core/ethtool.c | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 0b88eba..105e082 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1353,14 +1353,18 @@ EXPORT_SYMBOL(dev_close); */ void dev_disable_lro(struct net_device *dev) { - if (dev->ethtool_ops && dev->ethtool_ops->get_flags && - dev->ethtool_ops->set_flags) { - u32 flags = dev->ethtool_ops->get_flags(dev); - if (flags & ETH_FLAG_LRO) { - flags &= ~ETH_FLAG_LRO; - dev->ethtool_ops->set_flags(dev, flags); - } - } + extern int __ethtool_set_flags(struct net_device *, u32); + u32 flags; + + if (dev->ethtool_ops && dev->ethtool_ops->get_flags) + flags = dev->ethtool_ops->get_flags(dev); + else + flags = ethtool_op_get_flags(dev); + + if (!(flags & ETH_FLAG_LRO)) + return; + + __ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO); WARN_ON(dev->features & NETIF_F_LRO); } EXPORT_SYMBOL(dev_disable_lro); diff --git a/net/core/ethtool.c b/net/core/ethtool.c index c1a71bb..7371177 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -513,7 +513,7 @@ static int ethtool_set_one_feature(struct net_device *dev, } } -static int __ethtool_set_flags(struct net_device *dev, u32 data) +int __ethtool_set_flags(struct net_device *dev, u32 data) { u32 changed;