c9cb169
From patchwork Thu Jun 21 13:00:21 2018
c9cb169
Content-Type: text/plain; charset="utf-8"
c9cb169
MIME-Version: 1.0
c9cb169
Content-Transfer-Encoding: 7bit
c9cb169
Subject: [2/2] xen-netfront: Update features after registering netdev
c9cb169
X-Patchwork-Submitter: Ross Lagerwall <ross.lagerwall@citrix.com>
c9cb169
X-Patchwork-Id: 932720
c9cb169
Message-Id: <20180621130021.27029-3-ross.lagerwall@citrix.com>
c9cb169
To: <netdev@vger.kernel.org>
c9cb169
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
c9cb169
 Boris Ostrovsky <boris.ostrovsky@oracle.com>,
c9cb169
 Juergen Gross <jgross@suse.com>, "David S. Miller" <davem@davemloft.net>,
c9cb169
 <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
c9cb169
 Liam Shepherd <liam@dancer.es>
c9cb169
Date: Thu, 21 Jun 2018 14:00:21 +0100
c9cb169
From: Ross Lagerwall <ross.lagerwall@citrix.com>
c9cb169
List-Id: <netdev.vger.kernel.org>
c9cb169
c9cb169
Update the features after calling register_netdev() otherwise the
c9cb169
device features are not set up correctly and it not possible to change
c9cb169
the MTU of the device. After this change, the features reported by
c9cb169
ethtool match the device's features before the commit which introduced
c9cb169
the issue and it is possible to change the device's MTU.
c9cb169
c9cb169
Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
c9cb169
Reported-by: Liam Shepherd <liam@dancer.es>
c9cb169
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
c9cb169
Reviewed-by: Juergen Gross <jgross@suse.com>
c9cb169
---
c9cb169
 drivers/net/xen-netfront.c | 8 ++++----
c9cb169
 1 file changed, 4 insertions(+), 4 deletions(-)
c9cb169
c9cb169
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
c9cb169
index ee4cb6c..a57daec 100644
c9cb169
--- a/drivers/net/xen-netfront.c
c9cb169
+++ b/drivers/net/xen-netfront.c
c9cb169
@@ -1951,10 +1951,6 @@ static int xennet_connect(struct net_device *dev)
c9cb169
 	/* talk_to_netback() sets the correct number of queues */
c9cb169
 	num_queues = dev->real_num_tx_queues;
c9cb169
 
c9cb169
-	rtnl_lock();
c9cb169
-	netdev_update_features(dev);
c9cb169
-	rtnl_unlock();
c9cb169
-
c9cb169
 	if (dev->reg_state == NETREG_UNINITIALIZED) {
c9cb169
 		err = register_netdev(dev);
c9cb169
 		if (err) {
c9cb169
@@ -1964,6 +1960,10 @@ static int xennet_connect(struct net_device *dev)
c9cb169
 		}
c9cb169
 	}
c9cb169
 
c9cb169
+	rtnl_lock();
c9cb169
+	netdev_update_features(dev);
c9cb169
+	rtnl_unlock();
c9cb169
+
c9cb169
 	/*
c9cb169
 	 * All public and private state should now be sane.  Get
c9cb169
 	 * ready to start sending and receiving packets and give the driver