From 2e6d5650cb30e5ae4cc47c1fb9d85b48c49e6100 Mon Sep 17 00:00:00 2001
From: Amit Kumar <amit.kumar@iopsys.eu>
Date: Wed, 19 Apr 2023 05:27:19 +0000
Subject: [PATCH] qosmngr: qosmngr option to get num of queue

---
 include/qosmngr.h | 2 ++
 src/main.c        | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/qosmngr.h b/include/qosmngr.h
index 4947159..d745993 100644
--- a/include/qosmngr.h
+++ b/include/qosmngr.h
@@ -45,6 +45,8 @@
 #define OPT_BURST_SIZE   "burst_size"
 #define OPT_WEIGHT       "weight"
 
+#define QOS_MIN_Q_NUM_PER_PORT 4 //default minimum number of queue per port
+
 enum {
       QOS_POLICY_IFNAME,
       QOS_POLICY_QID,
diff --git a/src/main.c b/src/main.c
index be7e7e7..68ffc63 100644
--- a/src/main.c
+++ b/src/main.c
@@ -89,11 +89,12 @@ int main(int argc, char **argv)
 {
 	int ret;
 	int ch;
+	int num_of_q = QOS_MIN_Q_NUM_PER_PORT;
 
 	/* Logging to syslog */
 	openlog("qosmngr", LOG_PID|LOG_CONS, LOG_LOCAL1);
 
-	while ((ch = getopt(argc, argv, "vs:e:")) != -1) {
+	while ((ch = getopt(argc, argv, "vsq:e:")) != -1) {
 		switch (ch) {
 		case 'v':
 			qosmngr_version();
@@ -101,6 +102,10 @@ int main(int argc, char **argv)
 		case 's':
 			ubus_socket = optarg;
 			break;
+		case 'q':
+			num_of_q = get_no_of_q_per_port(argv[argc-1]);
+			printf("%d", num_of_q);
+			exit(0);
 		default:
 			break;
 		}
-- 
GitLab