r6040: add helpers to allocate and free the Tx/Rx buffers