Refactor packet mmap test to add tx ring.

This commit checks for `PACKET_MMAP_TX` support on the library API.
The use of loops makes the code a bit more compact.