From patchwork Sun Oct 22 21:37:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Wang X-Patchwork-Id: 30670 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 677741B37E; Sun, 22 Oct 2017 14:58:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 32C171B37D for ; Sun, 22 Oct 2017 14:58:45 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2017 05:58:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,417,1503385200"; d="scan'208"; a="1027937646" Received: from dpdk-xiao-1.sh.intel.com ([10.67.110.153]) by orsmga003.jf.intel.com with ESMTP; 22 Oct 2017 05:58:43 -0700 From: Xiao Wang To: dev@dpdk.org Cc: jingjing.wu@intel.com, jing.d.chen@intel.com, Xiao Wang Date: Sun, 22 Oct 2017 14:37:17 -0700 Message-Id: <1508708240-69814-2-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1508708240-69814-1-git-send-email-xiao.w.wang@intel.com> References: <1508708240-69814-1-git-send-email-xiao.w.wang@intel.com> Subject: [dpdk-dev] [PATCH 1/4] net/fm10k: redefine link status semantics X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" As fm10k host interface is not directly connected to PHY, marking the link status as UP doesn't mean a lot to the application. So, this patch basically redefines the link status as the state of switch manager: when switch manager is running, it's LINK_UP; when switch manager goes down by calling the fmTerminate function, status turns to LINK_DOWN. Signed-off-by: Xiao Wang --- drivers/net/fm10k/fm10k.h | 1 + drivers/net/fm10k/fm10k_ethdev.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index 060982b..594dca4 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -155,6 +155,7 @@ struct fm10k_dev_info { struct fm10k_macvlan_filter_info macvlan; /* Flag to indicate if RX vector conditions satisfied */ bool rx_vec_allowed; + bool sm_down; }; /* diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 586f482..2587696 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1256,14 +1256,17 @@ static inline int fm10k_glort_valid(struct fm10k_hw *hw) fm10k_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { + struct fm10k_dev_info *dev_info = + FM10K_DEV_PRIVATE_TO_INFO(dev->data->dev_private); PMD_INIT_FUNC_TRACE(); - /* The host-interface link is always up. The speed is ~50Gbps per Gen3 - * x8 PCIe interface. For now, we leave the speed undefined since there - * is no 50Gbps Ethernet. */ + /* The speed is ~50Gbps per Gen3 x8 PCIe interface. For now, we + * leave the speed undefined since there is no 50Gbps Ethernet. + */ dev->data->dev_link.link_speed = 0; dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; - dev->data->dev_link.link_status = ETH_LINK_UP; + dev->data->dev_link.link_status = + dev_info->sm_down ? ETH_LINK_DOWN : ETH_LINK_UP; return 0; }