Code can be read from https://www.godbolt.org/z/jaEj55MM6
In one of my later posts, you can see the mdio-tools equivalent to the "off" option: Ethernet LEDs control for TP-Link TL-WR1043ND v2/v3 - #4 by Cthulhu88
As mentioned in eth-leds.c header comment: Bus reads and writes are NOT atomic between ioctl calls.