From patchwork Thu Mar 1 09:31:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganesh Goudar X-Patchwork-Id: 879657 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=chelsio.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zsRyK1z8bz9s1X for ; Thu, 1 Mar 2018 20:31:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966912AbeCAJbQ (ORCPT ); Thu, 1 Mar 2018 04:31:16 -0500 Received: from stargate.chelsio.com ([12.32.117.8]:16359 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966771AbeCAJbO (ORCPT ); Thu, 1 Mar 2018 04:31:14 -0500 Received: from localhost (victim.blr.asicdesigners.com [10.193.185.129]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w219V5jp008618; Thu, 1 Mar 2018 01:31:06 -0800 From: Ganesh Goudar To: netdev@vger.kernel.org, davem@davemloft.net Cc: nirranjan@chelsio.com, indranil@chelsio.com, venkatesh@chelsio.com, leedom@chelsio.com, Arjun Vynipadath , Ganesh Goudar Subject: [PATCH net-next v2] cxgb4vf: Forcefully link up virtual interfaces Date: Thu, 1 Mar 2018 15:01:04 +0530 Message-Id: <1519896664-16403-1-git-send-email-ganeshgr@chelsio.com> X-Mailer: git-send-email 2.1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arjun Vynipadath The Virtual Interfaces are connected to an internal switch on the chip which allows VIs attached to the same port to talk to each other even when the port link is down. As a result, we generally want to always report a VI's link as being "up". Based on the original work by: Casey Leedom Signed-off-by: Arjun Vynipadath Signed-off-by: Ganesh Goudar --- V2: Doing force_link_up unconditionally --- drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index b7e79e6..361de86 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c @@ -155,8 +155,6 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok) const char *fc; const struct port_info *pi = netdev_priv(dev); - netif_carrier_on(dev); - switch (pi->link_cfg.speed) { case 100: s = "100Mbps"; @@ -202,7 +200,6 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok) netdev_info(dev, "link up, %s, full-duplex, %s PAUSE\n", s, fc); } else { - netif_carrier_off(dev); netdev_info(dev, "link down\n"); } } @@ -278,6 +275,17 @@ static int link_start(struct net_device *dev) */ if (ret == 0) ret = t4vf_enable_vi(pi->adapter, pi->viid, true, true); + + /* The Virtual Interfaces are connected to an internal switch on the + * chip which allows VIs attached to the same port to talk to each + * other even when the port link is down. As a result, we generally + * want to always report a VI's link as being "up", provided there are + * no errors in enabling vi. + */ + + if (ret == 0) + netif_carrier_on(dev); + return ret; }