app/testpmd: move dumping packets to a separate function