afc: refactor afc_dispatch_packet and improve afc_file_write performance
afc: use static buffers where possible