Skip to content

Commit 124dac9

Browse files
kuba-mooPaolo Abeni
authored andcommitted
tools: ynltool: add page-pool stats
Replace the page-pool sample with page pool support in ynltool. # ynltool page-pool stats eth0[2] page pools: 18 (zombies: 0) refs: 171456 bytes: 702283776 (refs: 0 bytes: 0) recycling: 97.3% (alloc: 2679:6134966 recycle: 1250981:4719386) # ynltool -j page-pool stats | jq [ { "ifname": "eth0", "ifindex": 2, "page_pools": 18, "zombies": 0, "live": { "refs": 171456, "bytes": 702283776 }, "zombie": { "refs": 0, "bytes": 0 }, "recycling_pct": 97.2746, "alloc": { "slow": 2679, "fast": 6135029 }, "recycle": { "ring": 1250997, "cache": 4719432 } } ] # ynltool page-pool stats group-by pp pool id: 108 dev: eth0[2] napi: 530 inflight: 9472 pages 38797312 bytes recycling: 95.5% (alloc: 148:208379 recycle: 45386:153842) pool id: 107 dev: eth0[2] napi: 529 inflight: 9408 pages 38535168 bytes recycling: 94.9% (alloc: 147:180178 recycle: 42251:128808) Signed-off-by: Jakub Kicinski <[email protected]> Link: https://patch.msgid.link/[email protected] Acked-by: Stanislav Fomichev <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent b02d229 commit 124dac9

File tree

5 files changed

+473
-154
lines changed

5 files changed

+473
-154
lines changed

tools/net/ynl/samples/page-pool.c

Lines changed: 0 additions & 149 deletions
This file was deleted.

tools/net/ynl/ynltool/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CFLAGS := -Wall -Wextra -Werror -O2
1010
ifeq ("$(DEBUG)","1")
1111
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
1212
endif
13-
CFLAGS += -I../lib
13+
CFLAGS += -I../lib -I../generated -I../../../include/uapi/
1414

1515
SRC_VERSION := \
1616
$(shell make --no-print-directory -sC ../../../.. kernelversion || \
@@ -29,14 +29,17 @@ all: $(YNLTOOL)
2929

3030
Q = @
3131

32-
$(YNLTOOL): $(OBJS)
32+
$(YNLTOOL): ../libynl.a $(OBJS)
3333
$(Q)echo -e "\tLINK $@"
34-
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS)
34+
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lmnl
3535

36-
%.o: %.c main.h json_writer.h
36+
%.o: %.c ../libynl.a
3737
$(Q)echo -e "\tCC $@"
3838
$(Q)$(COMPILE.c) -MMD -c -o $@ $<
3939

40+
../libynl.a:
41+
$(Q)$(MAKE) -C ../
42+
4043
clean:
4144
rm -f *.o *.d *~
4245

tools/net/ynl/ynltool/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int do_help(int argc __attribute__((unused)),
4747
"Usage: %s [OPTIONS] OBJECT { COMMAND | help }\n"
4848
" %s version\n"
4949
"\n"
50-
" OBJECT := { }\n"
50+
" OBJECT := { page-pool }\n"
5151
" " HELP_SPEC_OPTIONS "\n"
5252
"",
5353
bin_name, bin_name);
@@ -71,6 +71,7 @@ static int do_version(int argc __attribute__((unused)),
7171

7272
static const struct cmd commands[] = {
7373
{ "help", do_help },
74+
{ "page-pool", do_page_pool },
7475
{ "version", do_version },
7576
{ 0 }
7677
};

tools/net/ynl/ynltool/main.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ struct cmd {
5959
int cmd_select(const struct cmd *cmds, int argc, char **argv,
6060
int (*help)(int argc, char **argv));
6161

62+
/* subcommands */
63+
int do_page_pool(int argc, char **argv);
64+
6265
#endif /* __YNLTOOL_H */

0 commit comments

Comments
 (0)