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 D577CA0560; Tue, 18 Oct 2022 13:15:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 561494282D; Tue, 18 Oct 2022 13:14:32 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id BA90D427F4 for ; Tue, 18 Oct 2022 13:14:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666091668; x=1697627668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yqm6RznDMb+3GeGiy0qL5E6/aVizb8kRHWg0K7zAx68=; b=J4ShXBJPzm9eeDSjEz/4iZj7cxDYuC5BAGgiY3birKxbdJSWcPPhjFNG FZLmysoQyGw38oA3Omt9ZeugP/F7YqihwVyLD4+Os3jFud6wKC0qvCg13 J1h+i4X2vG2pNlFMcmBzVY5vLZ2osWpuX/mdref3RG01g1X0/DR7+PBgs qGYtD1eppb7i+TleW+M7D6JIQZM0Q1rjesSjPDuxNvtAAkDQIrLB+KYLd Vg/BEXVjjICurImdU1QrOaUFkJCKxA684xwFoYVn1iCHvB31L+EQKZgs8 bltrE30P5DQCd0ep9j4lF2i6sl/95CwG+mHGlVfR2x42v81wC8UM+VpBq A==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="293441577" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="293441577" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 04:14:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="717884192" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="717884192" Received: from dpdk-jf-ntb-one.sh.intel.com ([10.67.111.104]) by FMSMGA003.fm.intel.com with ESMTP; 18 Oct 2022 04:14:26 -0700 From: Junfeng Guo To: andrew.rybchenko@oktetlabs.ru, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, junfeng.guo@intel.com Subject: [PATCH v3 08/15] net/idpf: add support for link status update Date: Tue, 18 Oct 2022 19:12:38 +0800 Message-Id: <20221018111245.890651-9-junfeng.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018111245.890651-1-junfeng.guo@intel.com> References: <20220905105828.3190335-1-junfeng.guo@intel.com> <20221018111245.890651-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 dev ops link_update. Signed-off-by: Beilei Xing Signed-off-by: Junfeng Guo --- drivers/net/idpf/idpf_ethdev.c | 21 +++++++++++++++++++++ drivers/net/idpf/idpf_ethdev.h | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 10ae5f14f1..ff0833b462 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -34,6 +34,26 @@ static int idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static void idpf_adapter_rel(struct idpf_adapter *adapter); +int +idpf_dev_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete) +{ + struct idpf_vport *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, @@ -49,6 +69,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 64da6fd2a5..863d163330 100644 --- a/drivers/net/idpf/idpf_ethdev.h +++ b/drivers/net/idpf/idpf_ethdev.h @@ -110,6 +110,10 @@ struct idpf_vport { /* Chunk info */ struct idpf_chunks_info chunks_info; + /* Event from ipf */ + bool link_up; + uint32_t link_speed; + uint16_t devarg_id; bool stopped; struct virtchnl2_vport_stats eth_stats_offset; @@ -202,6 +206,8 @@ _atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops) } struct idpf_adapter *idpf_find_adapter(struct rte_pci_device *pci_dev); +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_vc_check_api_version(struct idpf_adapter *adapter); int idpf_get_pkt_type(struct idpf_adapter *adapter); -- 2.34.1