From patchwork Tue Mar 19 16:18:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "junwang01@cestc.cn" X-Patchwork-Id: 138484 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1988043CEE; Tue, 19 Mar 2024 17:18:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 938BA40EE1; Tue, 19 Mar 2024 17:18:36 +0100 (CET) Received: from smtp.cecloud.com (unknown [1.203.97.246]) by mails.dpdk.org (Postfix) with ESMTP id A376140A79 for ; Tue, 19 Mar 2024 17:18:34 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by smtp.cecloud.com (Postfix) with ESMTP id 130547C0113 for ; Wed, 20 Mar 2024 00:18:31 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from izgc79c142y6tt9fty3vzrz.localdomain (unknown [47.122.22.90]) by smtp.cecloud.com (postfix) whith ESMTP id P235493T281471604355440S1710865095237294_; Wed, 20 Mar 2024 00:18:30 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: junwang01@cestc.cn X-SENDER: junwang01@cestc.cn X-LOGIN-NAME: junwang01@cestc.cn X-FST-TO: dev@dpdk.org X-RCPT-COUNT: 1 X-LOCAL-RCPT-COUNT: 0 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 47.122.22.90 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <4038681a301be5cd2635cab2ae8f55d5> X-System-Flag: 0 From: Jun Wang To: dev@dpdk.org Subject: [PATCH] net/ixgbe: using dpdk-dumpcap capture packet coredump Date: Wed, 20 Mar 2024 00:18:12 +0800 Message-Id: <1710865092-2796-1-git-send-email-junwang01@cestc.cn> X-Mailer: git-send-email 1.8.3.1 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 Signed-off-by: Jun Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 73 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c61c52b..0e624f5 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4313,49 +4313,50 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, #ifdef RTE_EXEC_ENV_FREEBSD wait = 1; #endif + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + if (vf) + diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait); + else + diag = ixgbe_check_link(hw, &link_speed, &link_up, wait); - if (vf) - diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait); - else - diag = ixgbe_check_link(hw, &link_speed, &link_up, wait); + if (diag != 0) { + link.link_speed = RTE_ETH_SPEED_NUM_100M; + link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + return rte_eth_linkstatus_set(dev, &link); + } - if (diag != 0) { - link.link_speed = RTE_ETH_SPEED_NUM_100M; - link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; - return rte_eth_linkstatus_set(dev, &link); - } + if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber && + !ad->sdp3_no_tx_disable) { + esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); + if ((esdp_reg & IXGBE_ESDP_SDP3)) + link_up = 0; + } - if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber && - !ad->sdp3_no_tx_disable) { - esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); - if ((esdp_reg & IXGBE_ESDP_SDP3)) - link_up = 0; - } - - if (link_up == 0) { - if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { - ixgbe_dev_wait_setup_link_complete(dev, 0); - /* NOTE: review for potential ordering optimization */ - if (!__atomic_test_and_set(&ad->link_thread_running, __ATOMIC_SEQ_CST)) { - /* To avoid race condition between threads, set - * the IXGBE_FLAG_NEED_LINK_CONFIG flag only - * when there is no link thread running. - */ - intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; - if (rte_thread_create_internal_control(&ad->link_thread_tid, - "ixgbe-link", - ixgbe_dev_setup_link_thread_handler, dev) < 0) { + if (link_up == 0) { + if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { + ixgbe_dev_wait_setup_link_complete(dev, 0); + /* NOTE: review for potential ordering optimization */ + if (!__atomic_test_and_set(&ad->link_thread_running, __ATOMIC_SEQ_CST)) { + /* To avoid race condition between threads, set + * the IXGBE_FLAG_NEED_LINK_CONFIG flag only + * when there is no link thread running. + */ + intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG; + if (rte_thread_create_internal_control(&ad->link_thread_tid, + "ixgbe-link", + ixgbe_dev_setup_link_thread_handler, dev) < 0) { + PMD_DRV_LOG(ERR, + "Create link thread failed!"); + /* NOTE: review for potential ordering optimization */ + __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + } + } else { PMD_DRV_LOG(ERR, - "Create link thread failed!"); - /* NOTE: review for potential ordering optimization */ - __atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST); + "Other link thread is running now!"); } - } else { - PMD_DRV_LOG(ERR, - "Other link thread is running now!"); } + return rte_eth_linkstatus_set(dev, &link); } - return rte_eth_linkstatus_set(dev, &link); } link.link_status = RTE_ETH_LINK_UP;