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 C23C1A0032; Fri, 21 Oct 2022 11:21:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1CB0442C0F; Fri, 21 Oct 2022 11:21:15 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id C061742BF3 for ; Fri, 21 Oct 2022 11:21:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666344073; x=1697880073; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gZ8c11OML51hEL0Yu/QNp7vHJnBTeNcq194+xwtlhLE=; b=j9Y4N4N37+bl3eYdue7TDCi2MzyzOXUwPvPuUYVx15LhN9RR+oAjZWBT c+4w0G7vVwcY998DPwSLso3KreUbY6+iOW9ithjYdj3LHgOBeFrem/Pyc zvEZvIP5cLZRXNdhrIo5d8nsyckU7nZbSzIRKhNltPhlMM5rilI6U6H5b qjX6EFiMSem3j55VLtoLQqICTxLTwfaK7ixZ4FHmOTyzRJOKZV8XcRyoM apkpsJ8fJtwF0+g4PlcITg06wbavDBN87oRwYyCX87s2DwGTzrxqs4/ZN L+hctyFWBVsNjMAuMNpApBeVvWzYnqAWaZDDAteizUOMRrSWhaatJN+a4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="294355064" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="294355064" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 02:21:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="719619871" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="719619871" Received: from dpdk-jf-ntb-one.sh.intel.com ([10.67.111.104]) by FMSMGA003.fm.intel.com with ESMTP; 21 Oct 2022 02:21:09 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, ferruh.yigit@xilinx.com, beilei.xing@intel.com Cc: dev@dpdk.org, xiaoyun.li@intel.com, awogbemila@google.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, chenbo.xia@intel.com, helin.zhang@intel.com, Junfeng Guo Subject: [PATCH v7 4/8] net/gve: add support for link update Date: Fri, 21 Oct 2022 17:19:24 +0800 Message-Id: <20221021091928.2674471-5-junfeng.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021091928.2674471-1-junfeng.guo@intel.com> References: <20221020103656.1068036-1-junfeng.guo@intel.com> <20221021091928.2674471-1-junfeng.guo@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 Signed-off-by: Junfeng Guo --- doc/guides/nics/features/gve.ini | 1 + doc/guides/nics/gve.rst | 3 +++ drivers/net/gve/gve_ethdev.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini index 44aec28009..ae466ad677 100644 --- a/doc/guides/nics/features/gve.ini +++ b/doc/guides/nics/features/gve.ini @@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y Linux = Y x86-32 = Y x86-64 = Y diff --git a/doc/guides/nics/gve.rst b/doc/guides/nics/gve.rst index 703fbcc5de..c42ff23841 100644 --- a/doc/guides/nics/gve.rst +++ b/doc/guides/nics/gve.rst @@ -60,6 +60,9 @@ Features and Limitations In this release, the GVE PMD provides the basic functionality of packet reception and transmission. +Supported features of the GVE PMD are: + +- Link state information Currently, only GQI_QPL and GQI_RDA queue format are supported in PMD. Jumbo Frame is not supported in PMD for now. It'll be added in the future diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c index acbb412509..34243c1672 100644 --- a/drivers/net/gve/gve_ethdev.c +++ b/drivers/net/gve/gve_ethdev.c @@ -34,10 +34,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_DRV_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; } @@ -72,6 +101,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.34.1