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 4A8FAA0503; Wed, 18 May 2022 10:26:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C17F642BB3; Wed, 18 May 2022 10:25:36 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8ECE142B93 for ; Wed, 18 May 2022 10:25:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652862333; x=1684398333; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=moycy0KvyUtxaKPvG3UssynG9nthqJC7xBCFKtAw4Fo=; b=duisPstu3CF/4RAehdQ3WvygFRZlAK6JqawoxlW/haNibjq7JhcpdVUA U5IjKFDZ85i57O+V2iFekL10wlC1BqWGMzWkQ2nD5ZYHtfHfY8bGNSNcf c16g1P2IlvPPdcvbLH+QV1PxoXxPJrrp8XVYO5tp0xNktpmQYMln31u9Z 1yNi2gt2fHt8bV1ehiHN2s3GfcEHUBmRRzt/7mFzPRoAZ72aHsAob88hT rITiz05InVbKhqA5J4FXNmV55q6L5IaatawZi2ukv9qMsf1zA0Vzz459W GiKPjdJGiMDfkxJTVl9PUh6S2LdjhZXnBrUyvm1IiBdbhBiq/pBM4G4mb w==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="296841891" X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="296841891" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2022 01:25:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="545326764" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.119.111]) by orsmga006.jf.intel.com with ESMTP; 18 May 2022 01:25:31 -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 v3 07/11] net/idpf: support link update Date: Wed, 18 May 2022 16:25:27 +0800 Message-Id: <20220518082531.1604266-8-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518082531.1604266-1-junfeng.guo@intel.com> References: <20220509091133.3752306-10-junfeng.guo@intel.com> <20220518082531.1604266-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 95d2fd3968..97540f382a 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 80eba09184..38c5486ca6 100644 --- a/drivers/net/idpf/idpf_ethdev.h +++ b/drivers/net/idpf/idpf_ethdev.h @@ -190,6 +190,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