[2/2] examples/qos_sched: report error if no pipes configured

Message ID 20230321131350.122290-3-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series small fixes for QoS profile handling |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Bruce Richardson March 21, 2023, 1:13 p.m. UTC
  Have the QoS scheduler sample application report an error if no pipes
are configured for a subport.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/qos_sched/init.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Cristian Dumitrescu March 21, 2023, 5:37 p.m. UTC | #1
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Tuesday, March 21, 2023 1:14 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Subject: [PATCH 2/2] examples/qos_sched: report error if no pipes configured
> 
> Have the QoS scheduler sample application report an error if no pipes
> are configured for a subport.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  

Patch

diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 7a27c03b64..d8abae635a 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -233,6 +233,7 @@  app_init_sched_port(uint32_t portid, uint32_t socketid)
 	struct rte_eth_link link;
 	struct rte_sched_port *port = NULL;
 	uint32_t pipe, subport;
+	uint32_t pipe_count;
 	int err;
 
 	err = rte_eth_link_get(portid, &link);
@@ -263,6 +264,7 @@  app_init_sched_port(uint32_t portid, uint32_t socketid)
 		uint32_t n_pipes_per_subport =
 			subport_params[subport].n_pipes_per_subport_enabled;
 
+		pipe_count = 0;
 		for (pipe = 0; pipe < n_pipes_per_subport; pipe++) {
 			if (app_pipe_to_profile[subport][pipe] != -1) {
 				err = rte_sched_pipe_config(port, subport, pipe,
@@ -272,8 +274,13 @@  app_init_sched_port(uint32_t portid, uint32_t socketid)
 							"for profile %d, err=%d\n", pipe,
 							app_pipe_to_profile[subport][pipe], err);
 				}
+				pipe_count++;
 			}
 		}
+
+		if (pipe_count == 0)
+			rte_exit(EXIT_FAILURE, "Error: invalid config, no pipes enabled for sched subport %u\n",
+					subport);
 	}
 
 	return port;