Let F/F+ be a CM field and let v be a finite unramified place of F above the prime p. Let r:Gal(Q/F)→GLn(Fp) be a continuous representation which we assume to be modular for a unitary group over F+ which is compact at all real places. We prove, under Taylor--Wiles hypotheses, that the smooth GLn(Fv)-action on the corresponding Hecke isotypical part of the mod-p cohomology with infinite level above v∣F+ determines r∣Gal(Qp/Fv), when this latter restriction is Fontaine--Laffaille and has a suitably generic semisimplification.