tc divisor maximum is too small
From: Stanislav Kruchinin
Date: Wed Apr 25 2007 - 08:52:21 EST
I'm going to use tc with thousands of rules. To speed up rule processing I
want to use hashing filters with two last octets of source IP as a hash key.
# tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32
# tc filter add dev eth1 parent 1:0 prio 5 handle 2: protocol ip \
u32 divisor 65536
# tc filter add dev eth1 protocol ip parent 1:0 prio 5 u32 ht 800:: \
match ip src 10.0.0.0/16 \
hashkey mask 0x0000ffff at 12 \
Unfortunately, tc doesn't allow to create hash with more than 256 buckets,
because divisor's hardcoded maximum is 256.
Code from iproute2-2.6.20-070313, f_u32.c:
if (get_unsigned(&divisor, *argv, 0) ||
divisor == 0 ||
divisor > 0x100 || ((divisor - 1) & divisor))
The second rule in my example gives "Illegal "divisor"" message. It appears
that I can use only one last byte as hashing key and ruleset will be suboptimal.
I'm not a tc hacker so I need help to create patch, e.g. change the type of
divisor variable to "u_int32_t" and some related stuff.
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html