The purpose of the ferrite is additional high-frequency filtering of the incoming DC voltage [being either the USB voltage or the external voltage on pin Vin].
The diodes are there as protection against reverse voltage when powered by the Vin pin.
Paul