app/testpmd: move txonly prepare in separate function