app/testpmd: move speed and duplex parsing in a function