while loop for rx

Signed-off-by: Carlo Caione <carlo.caione@gmail.com>