On Sat, Feb 24, 2018 at 01:49:35AM +0000, Chris Mi wrote:
> To verify this patch, the following is a sanity test case:
> 
> # tc qdisc delete dev $link ingress > /dev/null 2>&1;
> # tc qdisc add dev $link ingress;
> # tc filter add dev $link prio 1 protocol ip handle 0x80000001 parent ffff: 
> flower skip_hw src_mac e4:11:0:0:0:2 dst_mac e4:12:0:0:0:2 action drop;
> # tc filter show dev $link parent ffff:
> 
> filter pref 1 flower chain 0
> filter pref 1 flower chain 0 handle 0x80000001

I added these tests to my local tree for now.

diff --git a/tools/testing/radix-tree/idr-test.c 
b/tools/testing/radix-tree/idr-test.c
index 44ef9eba5a7a..28d99325a32d 100644
--- a/tools/testing/radix-tree/idr-test.c
+++ b/tools/testing/radix-tree/idr-test.c
@@ -178,6 +178,29 @@ void idr_get_next_test(int base)
        idr_destroy(&idr);
 }
 
+void idr_u32_test(struct idr *idr, int base)
+{
+       assert(idr_is_empty(idr));
+       idr_init_base(idr, base);
+       u32 handle = 10;
+       idr_alloc_u32(idr, NULL, &handle, handle, GFP_KERNEL);
+       BUG_ON(handle != 10);
+       idr_remove(idr, handle);
+       assert(idr_is_empty(idr));
+
+       handle = 0x80000001;
+       idr_alloc_u32(idr, NULL, &handle, handle, GFP_KERNEL);
+       BUG_ON(handle != 0x80000001);
+       idr_remove(idr, handle);
+       assert(idr_is_empty(idr));
+
+       handle = 0xffe00000;
+       idr_alloc_u32(idr, NULL, &handle, handle, GFP_KERNEL);
+       BUG_ON(handle != 0xffe00000);
+       idr_remove(idr, handle);
+       assert(idr_is_empty(idr));
+}
+
 void idr_checks(void)
 {
        unsigned long i;
@@ -248,6 +271,9 @@ void idr_checks(void)
        idr_get_next_test(0);
        idr_get_next_test(1);
        idr_get_next_test(4);
+       idr_u32_test(&idr, 0);
+       idr_u32_test(&idr, 1);
+       idr_u32_test(&idr, 4);
 }
 
 /*

Reply via email to