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 55600A050A; Sat, 7 May 2022 09:08:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55EEE42838; Sat, 7 May 2022 09:08:33 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id D751B42836 for ; Sat, 7 May 2022 09:08:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651907312; x=1683443312; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jsrZdz7jJIVUOwSH4nIFrOkxi3eq8IVmfeOo35vqU/g=; b=A7T04+CdQK3siw8QAMGhTYnMZHyni1Ld0QrcjB7xhlnynH7Od+wy5PDL jOR+OlEpnzsFMim80iSwmQZRarnGFDScqnSQwMUwy7wKIuptGMXv+XVer P4ePtp9hO46qe4nFcsdgo42j/sux9DHiMcKQc1oXe9atn1Alpi+OhIWLK SKk9cOT8KYCPiqSHY1PJmcDgzpyyEl4ptrk59gNWesj4zmofCteiDgcAs aB6FWwCAJEvyLFY60oCKoKoCacQGmYaQhO7zZvbYc3bmXpNMSkzTnKSqt FdksP08H0NyK3n/7B+lzoAVIS1dNxbsrMQxjgictmPK8bV2QiaQ2cIGVZ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="256157761" X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="256157761" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2022 00:08:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,206,1647327600"; d="scan'208";a="564217038" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.119.111]) by orsmga007.jf.intel.com with ESMTP; 07 May 2022 00:08:29 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, junfeng.guo@intel.com Subject: [RFC 7/9] net/idpf: support link update Date: Sat, 7 May 2022 15:07:24 +0800 Message-Id: <20220507070726.3263649-8-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220507070726.3263649-1-junfeng.guo@intel.com> References: <20220507070726.3263649-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 Add ops link_update. Signed-off-by: Beilei Xing Signed-off-by: Junfeng Guo --- drivers/net/idpf/idpf_ethdev.c | 22 ++++++++++++++++++++++ drivers/net/idpf/idpf_ethdev.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 01fd023bfc..39efb387cf 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -31,6 +31,27 @@ static int idpf_dev_close(struct rte_eth_dev *dev); static int idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +int +idpf_dev_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete) +{ + struct idpf_vport *vport = + (struct idpf_vport *)dev->data->dev_private; + struct rte_eth_link new_link; + + memset(&new_link, 0, sizeof(new_link)); + + new_link.link_speed = RTE_ETH_SPEED_NUM_NONE; + + new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP : + RTE_ETH_LINK_DOWN; + new_link.link_autoneg = !(dev->data->dev_conf.link_speeds & + RTE_ETH_LINK_SPEED_FIXED); + + return rte_eth_linkstatus_set(dev, &new_link); +} + static const struct eth_dev_ops idpf_eth_dev_ops = { .dev_supported_ptypes_get = idpf_dev_supported_ptypes_get, .dev_configure = idpf_dev_configure, @@ -46,6 +67,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = { .tx_queue_setup = idpf_tx_queue_setup, .tx_queue_release = idpf_dev_tx_queue_release, .dev_infos_get = idpf_dev_info_get, + .link_update = idpf_dev_link_update, }; static int diff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h index c5aa168d95..5520b2d6ce 100644 --- a/drivers/net/idpf/idpf_ethdev.h +++ b/drivers/net/idpf/idpf_ethdev.h @@ -189,6 +189,8 @@ _atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops) return !ret; } +int idpf_dev_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete); void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev); int idpf_check_api_version(struct idpf_adapter *adapter); int idpf_get_caps(struct idpf_adapter *adapter); -- 2.25.1