Context. The η Carinae binary system hosts one of the most massive stars, which features the highest known mass-loss rate. This dense wind encounters the much faster wind expelled by the stellar companion, dissipating mechanical energy in the shock, where particles can be accelerated up to relativistic energies and subsequently produce very-high-energy γ-rays. Aims. We aim at comparing the variability of the γ-ray emission of η Carinae along the binary orbit with the predictions of simulations to establish the nature of the emission and of the seed particles. Methods. We have used data from the Fermi Large Area Telescope obtained during its first seven years of observations and spanning two passages of η Carinae at periastron. We performed the analysis using the new PASS8 pipeline and its improved instrument response function, extracting low and high-energy light curves as well as spectra in different orbital phase bins. We also introduced particle acceleration in hydrodynamic simulations of the system, assuming a dipolar magnetic field generated by the most massive star, and compared the γ-ray observations with the predictions of diffuse shock acceleration in a multi-cell geometry.Results. The main source of the γ-ray emission originates from a position compatible with η Carinae and located within the Homunculus Nebula. Two emission components can be distinguished. The low-energy component cuts off below 10 GeV and its flux, modulated by the orbital motion, varies by a factor less than 2. Short-term variability occurs at periastron. The flux of the high-energy component varies by a factor 3-4 but is different during the two periastrons. The variabilities observed at low energy, including some details of them, and those observed at high energy during the first half of the observations, match the prediction of the simulation, assuming a surface magnetic field of 500 G. The high-energy component and the thermal X-ray emission were weaker than expected around the second periastron suggesting a modification of the wind density in the inner wind collision zone. Conclusions. Diffuse shock acceleration in the complex geometry of the wind collision zone of η Carinae provides a convincing match to the observations and new diagnostic tools to probe the geometry and energetics of the system. This demonstrates that Fermi acceleration is at work in the wind collisions and that a few percent of the shock mechanical energy are converted into particle acceleration. Further observations are required to understand the periastron-to-periastron variability of the high-energy component and to associate it firmly with hadronic origin. We estimate that η Carinae is a pevatron at periastron and is bright enough to be detected by IceCube after many years of observations. Orbital modulations of the high-energy component can be distinguished from those of photo absorption by the four large size telescopes of the Cherenkov Telescope Array to be placed in the southern hemisphere.