canbusload: Fix worst-case frame length estimation

The Tindell's method used previously is incorrect. It does not account for
the fact that the stuffed bits are themselves also subject to bit stuffing.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Michal Sojka
2014-01-30 16:23:32 +01:00
committed by Marc Kleine-Budde
parent 2206f92de7
commit d6b576c012
2 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -246,7 +246,7 @@ unsigned can_frame_length(struct canfd_frame *frame, enum cfl_mode mode, int mtu
case CFL_NO_BITSTUFFING:
return (eff ? 67 : 47) + frame->len * 8;
case CFL_WORSTCASE:
return ((eff ? 389 : 269) + frame->len * 48) / 5;
return (eff ? 80 : 55) + frame->len * 10;
case CFL_EXACT:
return cfl_exact((struct can_frame*)frame);
}