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 70AEC41BBB; Fri, 3 Feb 2023 11:05:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1EA940A79; Fri, 3 Feb 2023 11:05:56 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id BD4ED42BC9; Fri, 3 Feb 2023 11:05:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675418755; x=1706954755; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XWMJGCXHaKe8+r41tX2lcOEVrMnJeInVts8J4U7vppw=; b=fFWvvabO+ZfNN2WfP8odzLSzRXc1N3IRhVcOZhsuTPqcJGExEsVoAJtT 0B/uQJULNTuVe02c67ZS+B7xmOaBfPMKDFxHOM8BapRXZGkrc1BJ2qfRv NXJyisrwwch265hzGliqETUB34y9X3KTc2XRgiiMFh53mCIbPbTHev/EF KlfnehIz8CLj/2AZK5wT4hgf4ttSApnmdV8ECJlliOerTWboYkc4or+U/ vRM/jYrCY3BT3iy+5uVc18LzsVhv1+v0bn9vprv81XJ/QZtJtROdWFn0h b/6A+mKeQuJ4472egXRK6ZaBBf4Job1vECXZJ/t0lzNzm78C8f0byXo+Y g==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="316705047" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="316705047" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 02:05:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="994465474" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="994465474" Received: from silpixa00401385.ir.intel.com ([10.237.214.158]) by fmsmga005.fm.intel.com with ESMTP; 03 Feb 2023 02:05:52 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: jasvinder.singh@intel.com, Bruce Richardson , stable@dpdk.org, Cristian Dumitrescu Subject: [PATCH 1/4] examples/qos_sched: fix errors when TX port not up Date: Fri, 3 Feb 2023 10:05:30 +0000 Message-Id: <20230203100533.10377-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230203100533.10377-1-bruce.richardson@intel.com> References: <20230203100533.10377-1-bruce.richardson@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 The TX port config will fail if the port is not up, so wait 10 seconds on startup for it to start. Fixes: de3cfa2c9823 ("sched: initial import") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- examples/qos_sched/init.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 0709aec10c..6020367705 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -326,6 +326,8 @@ int app_init(void) for(i = 0; i < nb_pfc; i++) { uint32_t socket = rte_lcore_to_socket_id(qos_conf[i].rx_core); struct rte_ring *ring; + struct rte_eth_link link = {0}; + int retry_count = 100, retry_delay = 100; /* try every 100ms for 10 sec */ snprintf(ring_name, MAX_NAME_LEN, "ring-%u-%u", i, qos_conf[i].rx_core); ring = rte_ring_lookup(ring_name); @@ -356,6 +358,14 @@ int app_init(void) app_init_port(qos_conf[i].rx_port, qos_conf[i].mbuf_pool); app_init_port(qos_conf[i].tx_port, qos_conf[i].mbuf_pool); + rte_eth_link_get(qos_conf[i].tx_port, &link); + if (link.link_status == 0) + printf("Waiting for link on port %u\n", qos_conf[i].tx_port); + while (link.link_status == 0 && retry_count--) { + rte_delay_ms(retry_delay); + rte_eth_link_get(qos_conf[i].tx_port, &link); + } + qos_conf[i].sched_port = app_init_sched_port(qos_conf[i].tx_port, socket); } -- 2.37.2