http://bugs.gentoo.org/291907

This patch was merged from two patches extracted from this thread:
http://markmail.org/thread/qkd76gpdgefpjlfn

tc_stab.c: small fixes to commandline help


tc_core.c:
As kernel part of things relies on cell align which is always set to -1,
I also added it to userspace computation stage. This way if someone
specified e.g. 2048 and 512 for mtu and tsize respectively, one wouldn't
end with tsize supporting mtu 4096 suddenly, New default mtu is also set
to 2048 (disregarding weirdness of setting mtu to such values).


Unless I missed something, this is harmless and feels cleaner, but if it's
not allowed, documentation will have to be changed back to 2047 + extra
explanation as well.
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -197,12 +197,12 @@ int tc_calc_size_table(struct tc_sizespec *s, __u16 **stab)
 	}
 
 	if (s->mtu == 0)
-		s->mtu = 2047;
+		s->mtu = 2048;
 	if (s->tsize == 0)
 		s->tsize = 512;
 
 	s->cell_log = 0;
-	while ((s->mtu >> s->cell_log) > s->tsize - 1)
+	while ((s->mtu - 1 >> s->cell_log) > s->tsize - 1)
 		s->cell_log++;
 
 	*stab = malloc(s->tsize * sizeof(__u16));
--- a/tc/tc_stab.c
+++ b/tc/tc_stab.c
@@ -27,7 +27,7 @@ static void stab_help(void)
 	fprintf(stderr,
 		"Usage: ... stab [ mtu BYTES ] [ tsize SLOTS ] [ mpu BYTES ]\n"
 		"                [ overhead BYTES ] [ linklayer TYPE ] ...\n"
-		"   mtu       : max packet size we create rate map for {2047}\n"
+		"   mtu       : max packet size we create size table for {2048}\n"
 		"   tsize     : how many slots should size table have {512}\n"
 		"   mpu       : minimum packet size used in rate computations\n"
 		"   overhead  : per-packet size overhead used in rate computations\n"
-- 
2.42.0

