Thread (17 messages) flat view 17 messages, 2 authors, 2015-08-03

Re: [PATCH 2/6] test_bpf: allow tests to specify an skb fragment.

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2015-08-03 15:29:45
Also in: lkml

On 08/03/2015 04:02 PM, Nicolas Schichan wrote:
This introduce a new test->aux flag (FLAG_SKB_FRAG) to tell the
populate_skb() function to add a fragment to the test skb containing
the data specified in test->frag_data).

Signed-off-by: Nicolas Schichan <redacted>
Acked-by: Alexei Starovoitov <redacted>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>

I'm good with this change here, just a comment below in general.
quoted hunk ↗ jump to hunk
  enum {
  	CLASSIC  = BIT(6),	/* Old BPF instructions only. */
@@ -81,6 +83,7 @@ struct bpf_test {
  		__u32 result;
  	} test[MAX_SUBTESTS];
  	int (*fill_helper)(struct bpf_test *self);
+	__u8 frag_data[MAX_DATA];
  };
We now have 286 tests, which is awesome!

Perhaps, we need to start thinking of a better test description method
soonish as the test_bpf.ko module grew to ~1.6M, i.e. whenever we add
to struct bpf_test, it adds memory overhead upon all test cases.
quoted hunk ↗ jump to hunk
  /* Large test cases need separate allocation and fill handler. */
@@ -4525,6 +4528,10 @@ static struct sk_buff *populate_skb(char *buf, int size)

  static void *generate_test_data(struct bpf_test *test, int sub)
  {
+	struct sk_buff *skb;
+	struct page *page;
+	void *ptr;
+
  	if (test->aux & FLAG_NO_DATA)
  		return NULL;
@@ -4532,7 +4539,36 @@ static void *generate_test_data(struct bpf_test *test, int sub)
  	 * subtests generate skbs of different sizes based on
  	 * the same data.
  	 */
-	return populate_skb(test->data, test->test[sub].data_size);
+	skb = populate_skb(test->data, test->test[sub].data_size);
+	if (!skb)
+		return NULL;
+
+	if (test->aux & FLAG_SKB_FRAG) {
Really minor nit: declaration of page, ptr could have been only in this block.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help