To prevent ear infections, after each dive, rinse your ear with either:
This will wash out the salt water. When the salt water dries, it leaves behind salt, which can badly dry out and irritate ears.
Keep a water bottle on hand with a narrow spigot to make it easier, but don’t squirt or force water inside your ear. Just pour it gently in, and only for a brief moment.
A 50/50 mix of alcohol and acid (isopropyl alcohol (70%) and normal white vinegar). Just a few drops. The vinegar dissolves salt and kills fungus, and the alcohol dries out the water.
An over-the counter mix, of alcohol and acid. For example, like Aqua Ear or similar. Don’t use too much at a time. Be aware that many drops are alcohol only, or are 95% alcohol and 5% glycerin to sooth. These are not good enough; the acid (vinegar) is needed.
A bit of oil before you go diving can coat and protect your ear from drying out. Ear shield is one option for over the counter. Some people swear by a drop or two of regular olive oil.
Vented ear plugs, such as Doc’s Proplugs can help protect ears by reducing the water which gets to the ears, and stop protective earwax from coming out.
If you already have an ear infection:
Use a few drops of Soliwax, which is an anti-fungal, anti-inflammatory, soothing wonder drug. A mix of Paradichlorobenzene, Benzocaine, Chlorbutol and Turpentine Oil. I keep this in my kit at all times now.
See a doctor
See a doctor. Don’t rely on advice from the internet, go get a professional opinion, ideally from an Ear, Nose and Throat specialist.