From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43D74A00C4; Fri, 29 Jul 2022 21:31:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D482842C67; Fri, 29 Jul 2022 21:31:11 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5547042C5B for ; Fri, 29 Jul 2022 21:31:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659123069; x=1690659069; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4EHdOKf8wZFxrl7YNWatdF754h4BTk/VetjvDTiMrE=; b=Mlu6SBHm0IGPyhs3q6skmpVcS+zQQTsy5rAs+IlYl4zr5SqZ8ILmRNwu Z866Rv0QLFLov26nzmu2bue79A/hBGLHX8AasQtwstnF3Nvxhi5karCcB +UeKzYDmrtWOMGwCY0Ivz88aNxR+6MzVQQ+A83e4HiRSWFWarwNKRUdjY rz7iJi0fRnnkt/hx7MicIfRcjKiQBPkLKG8jQq1D+S8JLwO/LCSlf6lqu zgKX+cWywAlCg3+k1XRndSlk31JHYXWTGBjgi5uyNcE/ieCh5Vvoc2Kbk uDZcq8+PCfYoVjt6k15GYRrOjRI+mUtHFJVViRJjNvlp/MsKpNVMuN4yZ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10423"; a="268602924" X-IronPort-AV: E=Sophos;i="5.93,201,1654585200"; d="scan'208";a="268602924" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2022 12:31:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,201,1654585200"; d="scan'208";a="577059542" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.223.111]) by orsmga006.jf.intel.com with ESMTP; 29 Jul 2022 12:31:07 -0700 From: Xiaoyun Li To: junfeng.guo@intel.com, qi.z.zhang@intel.com, awogbemila@google.com, bruce.richardson@intel.com Cc: dev@dpdk.org, Xiaoyun Li Subject: [PATCH 04/10] net/gve: add link update support Date: Fri, 29 Jul 2022 19:30:36 +0000 Message-Id: <20220729193042.2764633-5-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220729193042.2764633-1-xiaoyun.li@intel.com> References: <20220729193042.2764633-1-xiaoyun.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Support dev_ops link_update. Signed-off-by: Xiaoyun Li --- drivers/net/gve/gve_ethdev.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c index f10f273f7d..435115c047 100644 --- a/drivers/net/gve/gve_ethdev.c +++ b/drivers/net/gve/gve_ethdev.c @@ -37,10 +37,39 @@ gve_dev_configure(__rte_unused struct rte_eth_dev *dev) return 0; } +static int +gve_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) +{ + struct gve_priv *priv = dev->data->dev_private; + struct rte_eth_link link; + int err; + + memset(&link, 0, sizeof(link)); + link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + link.link_autoneg = RTE_ETH_LINK_AUTONEG; + + if (!dev->data->dev_started) { + link.link_status = RTE_ETH_LINK_DOWN; + link.link_speed = RTE_ETH_SPEED_NUM_NONE; + } else { + link.link_status = RTE_ETH_LINK_UP; + PMD_INIT_LOG(DEBUG, "Get link status from hw"); + err = gve_adminq_report_link_speed(priv); + if (err) { + PMD_DRV_LOG(ERR, "Failed to get link speed."); + priv->link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; + } + link.link_speed = priv->link_speed; + } + + return rte_eth_linkstatus_set(dev, &link); +} + static int gve_dev_start(struct rte_eth_dev *dev) { dev->data->dev_started = 1; + gve_link_update(dev, 0); return 0; } @@ -73,6 +102,7 @@ static const struct eth_dev_ops gve_eth_dev_ops = { .dev_start = gve_dev_start, .dev_stop = gve_dev_stop, .dev_close = gve_dev_close, + .link_update = gve_link_update, }; static void -- 2.25.1