Leveraging Programmable Switches to Enhance the Performance of Networks: Active and Passive Deployments