DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: jasvinder.singh@intel.com,
	Bruce Richardson <bruce.richardson@intel.com>,
	stable@dpdk.org,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH 1/4] examples/qos_sched: fix errors when TX port not up
Date: Fri,  3 Feb 2023 10:05:30 +0000	[thread overview]
Message-ID: <20230203100533.10377-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230203100533.10377-1-bruce.richardson@intel.com>

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 <bruce.richardson@intel.com>
---
 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


  reply	other threads:[~2023-02-03 10:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 10:05 [PATCH 0/4] small fixes and improvements for qos_sched example Bruce Richardson
2023-02-03 10:05 ` Bruce Richardson [this message]
2023-02-17 16:19   ` [PATCH 1/4] examples/qos_sched: fix errors when TX port not up Dumitrescu, Cristian
2023-02-03 10:05 ` [PATCH 2/4] examples/qos_sched: remove TX buffering Bruce Richardson
2023-02-17 16:19   ` Dumitrescu, Cristian
2023-02-03 10:05 ` [PATCH 3/4] examples/qos_sched: use bigger bursts on dequeue Bruce Richardson
2023-02-17 16:20   ` Dumitrescu, Cristian
2023-02-03 10:05 ` [PATCH 4/4] examples/qos_sched: remove limit on core ids Bruce Richardson
2023-02-17 16:20   ` Dumitrescu, Cristian
2023-02-20 15:41 ` [PATCH 0/4] small fixes and improvements for qos_sched example Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203100533.10377-2-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).