Optimizing flow control for buffered switches