You should also check for "End Of Packet", i.e.
  assert(bit.band(wb.xstatus_xerror, 3) == 3) 
Otherwise, multi-buffer packets will be interpreted as separate packets.  It would also be fairly trivial to support multi-buffer packets here, just like in transmit()