If fish are gasping at the surface, it is a sign of too much CO2 in aquarium at that point due to CO2 buildup. Immediate actions that one can take are to aerate the tank, and do a large water change, which will usually immediately reset CO2 levels.
Despite the gasping fish, this does not mean that your plants are getting enough CO2 throughout the day. This is an enormous paradox that is difficult for newer planted tank aquarists to accept. Let us examine it through a chart below.
The blue line indicates the CO2 build up typical in tanks where there is the combination of poor CO2 off gassing (for folks afraid of losing CO2, so they have no surface agitation or circulation) and low injection rates.
Say one starts CO2 injection in the morning at 10 am, and the aquarium light comes on at 11am. CO2 levels dip as plants start to take up the CO2. As CO2 uptake by plants is the most at the start of the light window, this initial dip is large. Then CO2 builds up throughout the day. The aquarist might find that the drop checker turns green or yellow by mid day. (2pm). As the day goes on, CO2 might build to lethal levels (3pm) and give rise to gasping fish. Despite having a green drop checker mid day and gasping fish late day - the CO2 levels in this tank has actually been sub-optimal for most of the day.
The ideal chart of CO2 levels in tank should instead be as below.
We want a quick build-up of CO2 levels at start of day, and yet have CO2 saturation taper off steeply at optimal levels. This can only happen if there is a combination of high injection rates and high off gassing rate in a tank at the same time. A high injection rate without a high off gassing rate - the tank would just go into lethal CO2 levels quickly. Good surface agitation and turn over increases the rate of CO2 off gassing into the atmosphere as CO2 levels increase. This combination thus allows us to have optimal levels of CO2 early in the day, yet never have it exceed levels to be harmful to livestock.
Have adequate surface agitation (filter outflow near surface), a clean water surface, and circulation between top and deeper layers of water. I use surface skimmers on my tanks to keep the water surface clean and draw oxygenated water into the filter. When there is adequate gaseous exchange, CO2 can be injected quite vigorously in combination with good O2 levels without fish gasping at the surface.