Either a machine or ice packs will work to help with pain and swelling following surgery or even pre-op if you have a lot of pain. No matter what you use to ice, be sure to place a towel between the ice source and your skin to prevent skin damage. And be sure to ice both the front and back of the joint.
With ice packs, you’ll have fluctuating cold temperatures as they go from frozen and icy cold to mushy and warmer in a fairly short period of time. You’ll need several of them to rotate to get the best result. Ice machines maintain a more constant temperature. Instead of ice, freeze water bottles to place in the water and replace them every 4-6 hours. This can let you use the machine overnight without having to get up. When you fill the machine, put frozen bottles in along with some loose ice, then fill with water. This will ensure the circulating water is cold from the start. Be sure to remove the labels from the bottles, as the material can disintegrate and clog your machine.