From patchwork Fri Apr 29 05:34:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shan Wei X-Patchwork-Id: 93386 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 F3960B6F7E for ; Fri, 29 Apr 2011 15:38:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751653Ab1D2Fis (ORCPT ); Fri, 29 Apr 2011 01:38:48 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:57587 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751524Ab1D2Fiq (ORCPT ); Fri, 29 Apr 2011 01:38:46 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 3C733170115; Fri, 29 Apr 2011 13:38:34 +0800 (CST) Received: from mailserver.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p3T5cXXm006380; Fri, 29 Apr 2011 13:38:33 +0800 Received: from [10.167.225.31] ([10.167.225.31]) by mailserver.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011042913385959-177048 ; Fri, 29 Apr 2011 13:38:59 +0800 Message-ID: <4DBA4DF5.5020101@cn.fujitsu.com> Date: Fri, 29 Apr 2011 13:34:45 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13pre) Gecko/20101113 Shredder/3.1.7pre MIME-Version: 1.0 To: David Miller , netdev , rusty@rustcorp.com.au, mst@redhat.com, Eric Dumazet , mirq-linux@rere.qmqm.pl, mirqus@gmail.com, bhutchings@solarflare.com, dm@chelsio.com Subject: [PATCH 2/2 net-next] net: drivers: set TSO/UFO offload option explicitly X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-04-29 13:38:59, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-04-29 13:39:00, Serialize complete at 2011-04-29 13:39:00 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The device drivers should not use NETIF_F_ALL_TSO mask to set hw_features(or features), but have to explicitly set offload option. Because, This would make drivers automatically clain to support any new TSO feature an the moment of NETIF_F_ALL_TSO is expanded. Some code style tuning. Just compile test. Signed-off-by: Shan Wei --- drivers/net/loopback.c | 18 ++++++++---------- drivers/net/virtio_net.c | 9 ++++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index d70fb76..bfb6a4a 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -152,6 +152,9 @@ static const struct net_device_ops loopback_ops = { .ndo_get_stats64 = loopback_get_stats64, }; +#define LOOPBACK_USER_FEATURES (NETIF_F_TSO | NETIF_F_TSO_ECN | \ + NETIF_F_TSO6 | NETIF_F_UFO) + /* * The loopback device is special. There is only one instance * per network namespace. @@ -165,16 +168,11 @@ static void loopback_setup(struct net_device *dev) dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ dev->flags = IFF_LOOPBACK; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; - dev->hw_features = NETIF_F_ALL_TSO | NETIF_F_UFO; - dev->features = NETIF_F_SG | NETIF_F_FRAGLIST - | NETIF_F_ALL_TSO - | NETIF_F_UFO - | NETIF_F_NO_CSUM - | NETIF_F_RXCSUM - | NETIF_F_HIGHDMA - | NETIF_F_LLTX - | NETIF_F_NETNS_LOCAL - | NETIF_F_VLAN_CHALLENGED; + dev->hw_features = LOOPBACK_USER_FEATURES; + dev->features = NETIF_F_SG | NETIF_F_FRAGLIST + | LOOPBACK_USER_FEATURES | NETIF_F_NO_CSUM | NETIF_F_RXCSUM + | NETIF_F_HIGHDMA | NETIF_F_LLTX + | NETIF_F_NETNS_LOCAL | NETIF_F_VLAN_CHALLENGED; dev->ethtool_ops = &loopback_ethtool_ops; dev->header_ops = ð_header_ops; dev->netdev_ops = &loopback_ops; diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0cb0b06..addde86 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -875,6 +875,9 @@ static void virtnet_config_changed(struct virtio_device *vdev) virtnet_update_status(vi); } +#define VIRTNET_USER_FEATURES (NETIF_F_TSO | NETIF_F_TSO_ECN | \ + NETIF_F_TSO6 | NETIF_F_UFO) + static int virtnet_probe(struct virtio_device *vdev) { int err; @@ -904,8 +907,7 @@ static int virtnet_probe(struct virtio_device *vdev) dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { - dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO - | NETIF_F_TSO_ECN | NETIF_F_TSO6; + dev->hw_features |= VIRTNET_USER_FEATURES; } /* Individual feature bits: what can host handle? */ if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4)) @@ -918,7 +920,8 @@ static int virtnet_probe(struct virtio_device *vdev) dev->hw_features |= NETIF_F_UFO; if (gso) - dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); + dev->features |= dev->hw_features & + VIRTNET_USER_FEATURES; /* (!csum && gso) case will be fixed by register_netdev() */ }