Thousands of Brazilian troops have raided Rio de Janeiro favelas in a pre-dawn crackdown on criminal gangs, leaving parts of the city looking like a warzone.