Infrared luminosity functions and dust mass functions in the EAGLE simulation