Re: [PATCH bpf-next v5 2/4] selftests/bpf: Add launch time request to xdp_hw_metadata

From
Daniel Borkmann <daniel@iogearbox.net>
Date
2025-01-15 14:57:16
Also in
bpf, intel-wired-lan, linux-doc, linux-kselftest, lkml, netdev
Reply to
Song Yoong Siang, 2025-01-14
On 1/14/25 4:27 PM, Song Yoong Siang wrote:
[...]
quoted hunk ↗ jump to hunk
+	/* Add mqprio qdisc with TC and hardware queue one-to-one mapping */
+	char map[256] = {0};
+	char queues[256] = {0};
+
+	for (i = 0; i < rxq; i++) {
+		char buf[8];
+
+		snprintf(buf, sizeof(buf), "%d ", i);
+		strcat(map, buf);
+
+		snprintf(buf, sizeof(buf), "1@%d ", i);
+		strcat(queues, buf);
+	}
+	run_command("sudo tc qdisc add dev %s handle 8001: parent root mqprio num_tc %d map %s queues %s hw 0",
+		    ifname, rxq, map, queues);
Fyi, above triggers selftest build errors:

  xdp_hw_metadata.c: In function ‘main’:
  xdp_hw_metadata.c:763:45: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Werror=format-truncation=]
    763 |                 snprintf(buf, sizeof(buf), "%d ", i);
        |                                             ^~
    TEST-OBJ [test_progs] arg_parsing.test.o
  xdp_hw_metadata.c:763:44: note: directive argument in the range [0, 2147483646]
    763 |                 snprintf(buf, sizeof(buf), "%d ", i);
        |                                            ^~~~~
  xdp_hw_metadata.c:763:17: note: ‘snprintf’ output between 3 and 12 bytes into a destination of size 8
    763 |                 snprintf(buf, sizeof(buf), "%d ", i);
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  xdp_hw_metadata.c:766:47: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Werror=format-truncation=]
    766 |                 snprintf(buf, sizeof(buf), "1@%d ", i);
        |                                               ^~
  xdp_hw_metadata.c:766:44: note: directive argument in the range [0, 2147483646]
    766 |                 snprintf(buf, sizeof(buf), "1@%d ", i);
        |                                            ^~~~~~~
  xdp_hw_metadata.c:766:17: note: ‘snprintf’ output between 5 and 14 bytes into a destination of size 8
    766 |                 snprintf(buf, sizeof(buf), "1@%d ", i);
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thread (9 messages) 9 messages, 3 authors, last reply 2025-01-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help