ring: move duplicate/generic code parts from rx/tx into ring.c

We do not want to maintain duplicate code, so move this into a separate
file and name those *_generic() helpers.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>