From c19e6411670f55a55703f645dbf3b5d67cfb6a78 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Wed, 20 Dec 2023 21:44:12 +0800 Subject: [PATCH] swconfig: fix mt753x slow show --- .../patches/001-fix-mt753x-slow-show.patch | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 package/network/config/swconfig/patches/001-fix-mt753x-slow-show.patch diff --git a/package/network/config/swconfig/patches/001-fix-mt753x-slow-show.patch b/package/network/config/swconfig/patches/001-fix-mt753x-slow-show.patch new file mode 100644 index 0000000000..cf5f5fe4c1 --- /dev/null +++ b/package/network/config/swconfig/patches/001-fix-mt753x-slow-show.patch @@ -0,0 +1,41 @@ +--- a/cli.c ++++ b/cli.c +@@ -202,7 +202,7 @@ static void + print_usage(void) + { + printf("swconfig list\n"); +- printf("swconfig dev [port |vlan ] (help|set |get |load |show)\n"); ++ printf("swconfig dev [port |vlan ] (help|set |get |load |show all)\n"); + exit(1); + } + +@@ -247,6 +247,7 @@ int main(int argc, char **argv) + char *ckey = NULL; + char *cvalue = NULL; + char *csegment = NULL; ++ int show_all = 0; + + if((argc == 2) && !strcmp(argv[1], "list")) { + swlib_list(); +@@ -290,6 +291,8 @@ int main(int argc, char **argv) + csegment = argv[++i]; + cmd = CMD_PORTMAP; + } else if (!strcmp(arg, "show")) { ++ if (i + 1 < argc && !strcmp(argv[++i], "all")) ++ show_all = 1; + cmd = CMD_SHOW; + } else { + print_usage(); +@@ -375,8 +378,10 @@ int main(int argc, char **argv) + show_global(dev); + for (i=0; i < dev->ports; i++) + show_port(dev, i); +- for (i=0; i < dev->vlans; i++) +- show_vlan(dev, i, true); ++ if (show_all) { ++ for (i=0; i < dev->vlans; i++) ++ show_vlan(dev, i, true); ++ } + } + break; + }