On the Optimization of the IEEE 802.11 DCF: A Cross-Layer Perspective