For some reason the version in Portuguese is Ferreira (the feminine form), not Ferreiro. No idea what the reason is. I somehow doubt that medieval Portugal was exceptionally gender-progressive.
A bit of googling gives me the explanation of "ferreira" being an old word for "iron mine", which to be honest is coherent with modern portuguese forms like "pedreira", toponymics ("ferreira" is a common place name), and the way names come about (João da Ferreira would own or work in the iron mine, or just come from one of the villages where there was an iron mine).