From patchwork Mon Apr 4 12:29:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 89618 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 9DE66B6FB2 for ; Mon, 4 Apr 2011 22:29:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753673Ab1DDM3W (ORCPT ); Mon, 4 Apr 2011 08:29:22 -0400 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:14551 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407Ab1DDM3V (ORCPT ); Mon, 4 Apr 2011 08:29:21 -0400 X-IronPort-AV: E=Sophos;i="4.63,296,1299456000"; d="scan'208";a="5124456" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 04 Apr 2011 12:29:20 +0000 Received: from [10.80.2.42] (10.80.2.42) by smtprelay.citrix.com (10.30.224.162) with Microsoft SMTP Server id 8.2.255.0; Mon, 4 Apr 2011 13:29:19 +0100 Subject: Re: [PATCH RESEND] net: convert xen-netfront to hw_features From: Ian Campbell To: David Miller CC: "mirq-linux@rere.qmqm.pl" , "netdev@vger.kernel.org" , Jeremy Fitzhardinge , "konrad.wilk@oracle.com" , "xen-devel@lists.xensource.com" , "virtualization@lists.linux-foundation.org" In-Reply-To: <20110401.205455.70198735.davem@davemloft.net> References: <20110331110136.03A1A13A6A@rere.qmqm.pl> <20110401.205455.70198735.davem@davemloft.net> Organization: Citrix Systems, Inc. Date: Mon, 4 Apr 2011 13:29:19 +0100 Message-ID: <1301920159.23887.96.camel@zakaz.uk.xensource.com> MIME-Version: 1.0 X-Mailer: Evolution 2.32.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 2011-04-02 at 04:54 +0100, David Miller wrote: > From: Michał Mirosław > Date: Thu, 31 Mar 2011 13:01:35 +0200 (CEST) > > > Not tested in any way. The original code for offload setting seems broken > > as it resets the features on every netback reconnect. > > > > This will set GSO_ROBUST at device creation time (earlier than connect time). > > > > RX checksum offload is forced on - so advertise as it is. > > > > Signed-off-by: Michał Mirosław > > Applied. Thanks, but unfortunately the patch results in the features all being disabled by default, since they are not set in the initial dev->features and the initial dev->wanted_features is based on features & hw_features. The ndo_fix_features hook only clears features and doesn't add new features (nor should it AFAICT). Features cannot be negotiated with the backend until xennet_connect(). The carrier is not enabled until the end of that function, therefore I think it is safe to start with a full set of features in dev->features and rely on the call to netdev_update_features() in xennet_connect() to clear those which turn out to be unavailable. The following works for me, I guess the alternative is for xennet_connect() to expand dev->features based on what it detects? Or is there a mechanism for a driver to inform the core that a new hardware feature has become available (I doubt that really happens on physical h/w so I guess not). Ian. 8<----------------- From 0b56469abe56efae415b4603ef508ce9aec0e4c1 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 4 Apr 2011 10:58:50 +0100 Subject: [PATCH] xen: netfront: assume all hw features are available until backend connection setup We need to assume that all features will be available when registering the netdev otherwise they are ommitted from the initial set of dev->wanted_features. When we connect to the backed we reduce the set as necessary due to the call to netdev_update_features() in xennet_connect(). Signed-off-by: Ian Campbell Cc: mirq-linux@rere.qmqm.pl Cc: netdev@vger.kernel.org Cc: Jeremy Fitzhardinge Cc: konrad.wilk@oracle.com Cc: Eric Dumazet Cc: xen-devel@lists.xensource.com --- drivers/net/xen-netfront.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 0cfe4cc..db9a763 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1251,6 +1251,14 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev NETIF_F_GSO_ROBUST; netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO; + /* + * Assume that all hw features are available for now. This set + * will be adjusted by the call to netdev_update_features() in + * xennet_connect() which is the earliest point where we can + * negotiate with the backend regarding supported features. + */ + netdev->features |= netdev->hw_features; + SET_ETHTOOL_OPS(netdev, &xennet_ethtool_ops); SET_NETDEV_DEV(netdev, &dev->dev);