From patchwork Wed Dec 23 06:46:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 560373 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 6D345140BBB for ; Wed, 23 Dec 2015 17:46:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933230AbbLWGqh (ORCPT ); Wed, 23 Dec 2015 01:46:37 -0500 Received: from mail.windriver.com ([147.11.1.11]:52952 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933064AbbLWGqg (ORCPT ); Wed, 23 Dec 2015 01:46:36 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id tBN6kQ5O028595 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 22 Dec 2015 22:46:26 -0800 (PST) Received: from sustaining-1.corp.ad.wrs.com (128.224.163.164) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.3.248.2; Tue, 22 Dec 2015 22:46:25 -0800 From: To: , , , , , , , , , , CC: , , Subject: [PATCH 1/1] ixgbe: force to synchronize reporting "link on" and getting speed and duplex Date: Wed, 23 Dec 2015 14:46:45 +0800 Message-ID: <1450853205-27133-1-git-send-email-zyjzyj2000@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Zhu Yanjun In X540 NIC, there is a time span between reporting "link on" and getting the speed and duplex. To a bonding driver in 802.3ad mode, this time span will make it not work well if the time span is big enough. The big time span will make bonding driver change the state of the slave device to up while the speed and duplex of the slave device can not be gotten. Later the bonding driver will not have change to get the speed and duplex of the slave device. The speed and duplex of the slave device are important to a bonding driver in 802.3ad mode. To 82599_SFP NIC and other kinds of NICs, this problem does not exist. As such, it is necessary for X540 to report"link on" when the link speed is not IXGBE_LINK_SPEED_UNKNOWN. Signed-off-by: Zhu Yanjun --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index aed8d02..cb9d310 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6479,7 +6479,21 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter) (flow_rx ? "RX" : (flow_tx ? "TX" : "None")))); - netif_carrier_on(netdev); + /* + * In X540 NIC, there is a time span between reporting "link on" + * and getting the speed and duplex. To a bonding driver in 802.3ad + * mode, this time span will make it not work well if the time span + * is big enough. To 82599_SFP NIC and other kinds of NICs, this + * problem does not exist. As such, it is better for X540 to report + * "link on" when the link speed is not IXGBE_LINK_SPEED_UNKNOWN. + */ + if ((hw->mac.type == ixgbe_mac_X540) && + (link_speed != IXGBE_LINK_SPEED_UNKNOWN)) { + netif_carrier_on(netdev); + } else { + netif_carrier_on(netdev); + } + ixgbe_check_vf_rate_limit(adapter); /* enable transmits */